Release 2.7.3-1

SVN revision: 2058
This commit is contained in:
Stefan Ritt 2008-02-22 12:31:06 +00:00
parent 8c04e598c1
commit 329da1bc09
22 changed files with 275 additions and 162 deletions

View File

@ -1,3 +1,21 @@
Version 2.7.3, released Feb. 22th, 2008
=======================================
- Implemented native SSL support
- Added version information to elog.c
- Use absolute links for inline images in email notifications
- Put thumbnails in HTML encoded email notifications
- Adjusted menu height
- Remove ',' from date in CSV export
- Replace elog:... by HTML link when encoding is HTML
- Fixed importing of datetime attributes
- Added patch from Olivier Callot regarding max. line length in summary display
- Fixed shell problems under Linux
- Added code to auto-detect ImageMagick
- Implemented thumbnails for PDF and images with resizing and rotation
- Allow Ctrl-Shift-PgUp/PgDn for browsing
- Moved browsing buttons to the left side
Version 2.7.2, released Jan. 30th, 2008 Version 2.7.2, released Jan. 30th, 2008
======================================= =======================================

View File

@ -221,9 +221,6 @@ URL = http://your.proxy.host/subdir/
into elogd.cfg.<p> into elogd.cfg.<p>
Note that the variable $remote_host cannot be used inside elogd since the remote host is always
the proxy host (anybody knows how to fix that???).<p>
<hr><a name="imagemagick"> <div class=section>&nbsp; Installing ImageMagick &nbsp;</div> <p> <hr><a name="imagemagick"> <div class=section>&nbsp; Installing ImageMagick &nbsp;</div> <p>
When images are attached to ELOG entries, thumbnails can be created for quick preview. When images are attached to ELOG entries, thumbnails can be created for quick preview.
This works also for PDF and PostScript files. ELOG forwards any image operation This works also for PDF and PostScript files. ELOG forwards any image operation
@ -337,16 +334,28 @@ Logbook dir</b></CODE> in the <b><a href="config.html">elogd.cfg description</a>
<hr><a name="secure"> <hr><a name="secure">
<div class=section>&nbsp; Secure Connections HOWTO &nbsp;</div> <div class=section>&nbsp; Secure Connections HOWTO &nbsp;</div>
<p> <p>
Although the <code><b>elogd</b></code> program does not support secure <h3><i>Using elogd itself</i>:</h3>
connections over SSL directly, it is still possible to access <code><b>elogd</b></code>
securely using one of the following methods. <b>It is recommented to run elog Starting from version 2.7.3 on, the <code><b>elogd</b></code> program supports
through an HTTPS proxy to avoid exposing elog passwords to clear text sniffing secure connections over the Secure Socker Layer (SSL) directly.
<b>It is recommented to run elog
only through secure HTTPS connections if passwords are used. Otherwise the
passwords are send over the network in clear text and exposed to sniffing
attacks</b>. attacks</b>.
To use SSL, put <code><b>SSL = 1</b></code> into the config file. If the
<code><b>URL =</b></code> directive is used, make sure to use
<code><b>https://...</code></b> instead of <code><b>http://...</code></b>
there. The ELOG distribution contains a simple self-signed certificate in the
<code><b>ssl</b></code> subdirectory. One can replace this certificate and key
with a real ceritficate to avoid browser pop-up windows warning about the
self-signed certificate.
<h3><i>Using Apache</i>:</h3> <h3><i>Using Apache</i>:</h3>
The <a href="http://httpd.apache.org">Apache<a> web server can be used as a proxy Another possibility is to use the <a href="http://httpd.apache.org">Apache<a>
server allowing secure connections. To do so, Apache has to be configured web server as a proxy server allowing secure connections. To do so, Apache
has to be configured
accordingly and a certificate has to be generated. See some accordingly and a certificate has to be generated. See some
<a href="http://slacksite.com/apache/certificate.html">instructions</a> <a href="http://slacksite.com/apache/certificate.html">instructions</a>
on how to create a certificate, and see <i>Running elogd under Apache</i> on how to create a certificate, and see <i>Running elogd under Apache</i>
@ -396,51 +405,6 @@ access <b> <code>http://localhost:1234</code></b> from your browser and reach
<code><b>elogd</b></code> in a secure way. <code><b>elogd</b></code> in a secure way.
<p> <p>
<h3><i>Using stunnel</i>:</h3>
<i><b>Note: It was reported that the below instructions are outdated. However
I will leave them for a while as a working basis for someone who volunteers
to update them.</i></b>.<p>
To use <code><b>elogd</b></code> togethwer with
<a href="http://www.stunnel.or/g">stunnel</a>, following steps are necessary:
<OL>
<LI>Start <code><b>elogd</b></code>. If another Web server is running
on port 80, use a different port.
<P></P>
<LI>Configure stunnel. This requires the creation of a certificate. See
the <a href="http://www.stunnel.org/faq/certs.html">manual</a> for
details.
<P></P>
<LI>Start the <b><code>stunnel</code></b> program if not already done
and start it with:
<P>
<pre>stunnel -d 443 -r your.host.name:80</pre>
Substitute the port 80 if you started <code><b>elogd</b></code> on another port. This
causes <b><code>stunnel</code></b> to receive requests on the https port 443 and
forward them to the <code><b>elogd</b></code> port.
<P></P>
<LI>Put the URL under which <code><b>elogd</b></code> runs into elogd.cfg:<p>
<pre>URL = https://your.host.name/</pre>
Note the <b><code>https</code></b> at the beginning of the URL, which is
mandatory. Once you use the <b><code>https</code></b> URL, elog won't work
correctly when accessed not through stunnel via
<b><code>http://..</code></b>, since any redirection would always bring you
back to https://...).<p></p>
<LI>Connect to your logbook with a browser which supports SSL via:
<P>
<pre>https://your.host.name/</pre>
<LI>If you have problems, start stunnel in the foreground mode with
<P>
<pre>stunnel -f -d 443 -r your.host.name:80</pre>
This reveals any potential error.<p></p></LI>
</OL>
<p>
<hr><a name="tech"> <hr><a name="tech">
<div class=section>&nbsp; How It All Works &nbsp;</div> <div class=section>&nbsp; How It All Works &nbsp;</div>
<p> <p>

View File

@ -101,6 +101,18 @@ Use Mail Subject = Location
Specifies the TCP port under which the server is listening. Default is Specifies the TCP port under which the server is listening. Default is
80. Can be superseeded via the '-p' command line flag. 80. Can be superseeded via the '-p' command line flag.
</li> </li>
<li>
<b><code>SSL = &lt;0 | 1&gt;</code></b><br>
Turn on Secure Socket Layer transport. If SSL is on, one can connect
via <code><b>https://...</b></code> to the elogd daemon. If the
<code><b>URL =</b></code> directive is used, make sure to use
<code><b>https://...</code></b> instead of <code><b>http://...</code></b>
there. The ELOG distribution contains a simple self-signed certificate
in the <code><b>ssl</b></code> subdirectory. One can replace this
certificate and key with a real ceritficate to avoid browser pop-up
windows warning about the self-signed certificate. The default for
this option is <code><b>0</b></code>.
</li>
<li> <li>
<b><code>Resource dir = &lt;directory&gt;</code></b><br> <b><code>Resource dir = &lt;directory&gt;</code></b><br>
Specifies the root directory for ELOG resources like help files, Specifies the root directory for ELOG resources like help files,
@ -287,7 +299,7 @@ elogd -t &lt;your password&gt;
If one of the three cases is true: If one of the three cases is true:
<ul> <ul>
<li> <li>
<code><b>elogd</b></code> runs with <i>stunnel</i> <code><b>elogd</b></code> runs with <i>SSL</i> enabled
</li> </li>
<li> <li>
<code><b>elogd</b></code> runs under a proxy <code><b>elogd</b></code> runs under a proxy
@ -298,9 +310,8 @@ elogd -t &lt;your password&gt;
<p> <p>
then the URL under which <code><b>elogd</b></code> is running has to then the URL under which <code><b>elogd</b></code> is running has to
be specified manually with this statement. The URL has to contain the be specified manually with this statement. The URL has to contain the
port number if not the standard port 80 is used, it has to specify port number if not the standard port 80 is used or 433 for SSL,
<i>https://</i> if used under <i>stunnel</i>, and it has to contain and it has to contain the directory if used under a proxy like<br>
the directory if used under a proxy like<br>
<br> <br>
</p> </p>
<table border="0" cellpadding="10"> <table border="0" cellpadding="10">
@ -317,7 +328,7 @@ elogd -t &lt;your password&gt;
<code>URL = https://host.domain/</code> <code>URL = https://host.domain/</code>
</td> </td>
<td> <td>
if running under <i>stunnel</i> if SSL is enabled (SSL = 1)
</td> </td>
</tr> </tr>
<tr> <tr>

View File

@ -28,7 +28,7 @@
&nbsp;[<a class="nav" href="#links">Links</a>]&nbsp; *&nbsp;</div> &nbsp;[<a class="nav" href="#links">Links</a>]&nbsp; *&nbsp;</div>
<P class="Sub">Home of the <i>Electronic Logbook</i> package by <a href="mailto:Stefan.Ritt&#64;psi.ch"> <P class="Sub">Home of the <i>Electronic Logbook</i> package by <a href="mailto:Stefan.Ritt&#64;psi.ch">
Stefan Ritt</a></P> Stefan Ritt</a></P>
<div class="version">Current version is : 2.7.2</div> <div class="version">Current version is : 2.7.3</div>
<center> <center>
<a href="http://www.softpedia.com/progClean/ELOG-Clean-30897.html"><img border="0" src="http://www.softpedia.com/images/spyward/softpedia_free_award_f.gif" alt="certificate" title="certificate" /></a> <a href="http://www.softpedia.com/progClean/ELOG-Clean-30897.html"><img border="0" src="http://www.softpedia.com/images/spyward/softpedia_free_award_f.gif" alt="certificate" title="certificate" /></a>
</center> </center>

View File

@ -84,6 +84,10 @@ Section "ELOG system (required)" SecSystem
SetOutPath $INSTDIR\resources SetOutPath $INSTDIR\resources
File resources\eloghelp_english.html File resources\eloghelp_english.html
; ssl directory
SetOutPath $INSTDIR\ssl
File ssl\*.*
; src directory ; src directory
SetOutPath $INSTDIR\src SetOutPath $INSTDIR\src
File src\*.c File src\*.c

View File

@ -457,3 +457,10 @@ Please choose format to import: =
Enter text = Enter text =
Show HTML source code = Show HTML source code =
or until I log out = or until I log out =
Make smaller =
Original size =
Make larger =
Rotate left =
Rotate right =
Delete attachment =
Cannot create thumbnail, please check ImageMagick installation =

View File

@ -457,3 +457,10 @@ Please choose format to import: =
Enter text = Enter text =
Show HTML source code = Show HTML source code =
or until I log out = or until I log out =
Make smaller =
Original size =
Make larger =
Rotate left =
Rotate right =
Delete attachment =
Cannot create thumbnail, please check ImageMagick installation =

View File

@ -455,3 +455,10 @@ Please choose format to import: =
Enter text = Enter text =
Show HTML source code = Show HTML source code =
or until I log out = or until I log out =
Make smaller =
Original size =
Make larger =
Rotate left =
Rotate right =
Delete attachment =
Cannot create thumbnail, please check ImageMagick installation =

View File

@ -455,3 +455,10 @@ Please choose format to import: =
Enter text = Enter text =
Show HTML source code = Show HTML source code =
or until I log out = or until I log out =
Make smaller =
Original size =
Make larger =
Rotate left =
Rotate right =
Delete attachment =
Cannot create thumbnail, please check ImageMagick installation =

View File

@ -453,3 +453,14 @@ Please choose format to import: = Kies het formaat om te importeren
Enter text = Voer tekst in Enter text = Voer tekst in
Show HTML source code = Toon HTML broncode Show HTML source code = Toon HTML broncode
or until I log out = of tot ik afmeld or until I log out = of tot ik afmeld
#
#---- please translate following items and then remove this comment ----#
#
Make smaller =
Original size =
Make larger =
Rotate left =
Rotate right =
Delete attachment =
Cannot create thumbnail, please check ImageMagick installation =

View File

@ -455,3 +455,10 @@ Please choose format to import: = Veuillez choisir le format d'importation :
Enter text = Saisir le texte Enter text = Saisir le texte
Show HTML source code = Voir le code source HTML Show HTML source code = Voir le code source HTML
or until I log out = ou jusqu'à ce que je me déconnecte or until I log out = ou jusqu'à ce que je me déconnecte
Make smaller =
Original size =
Make larger =
Rotate left =
Rotate right =
Delete attachment =
Cannot create thumbnail, please check ImageMagick installation =

View File

@ -450,3 +450,10 @@ Please choose format to import: = Bitte Importformat ausw
Enter text = Text eingeben Enter text = Text eingeben
Show HTML source code = HTML Quellcode anzeigen Show HTML source code = HTML Quellcode anzeigen
or until I log out = oder bis zum Ausloggen or until I log out = oder bis zum Ausloggen
Make smaller = Verkleinern
Original size = Originalgröße
Make larger = Vergrößern
Rotate left = Links rotieren
Rotate right = Rechts rotieren
Delete attachment = Anhang löschen
Cannot create thumbnail, please check ImageMagick installation = Kann Vorschau nicht erstellen, bitte ImageMagick Installation überprüfen

View File

@ -453,3 +453,10 @@ Please choose format to import: =
Enter text = Enter text =
Show HTML source code = Show HTML source code =
or until I log out = or until I log out =
Make smaller =
Original size =
Make larger =
Rotate left =
Rotate right =
Delete attachment =
Cannot create thumbnail, please check ImageMagick installation =

View File

@ -453,3 +453,10 @@ Please choose format to import: =
Enter text = Enter text =
Show HTML source code = Show HTML source code =
or until I log out = or until I log out =
Make smaller =
Original size =
Make larger =
Rotate left =
Rotate right =
Delete attachment =
Cannot create thumbnail, please check ImageMagick installation =

View File

@ -454,3 +454,14 @@ or until I log out =
Show HTML source code = Показать исходный код HTML Show HTML source code = Показать исходный код HTML
Cannot send email notification to "%s" = Не удается отправить уведомление для "%s" Cannot send email notification to "%s" = Не удается отправить уведомление для "%s"
#
#---- please translate following items and then remove this comment ----#
#
Make smaller =
Original size =
Make larger =
Rotate left =
Rotate right =
Delete attachment =
Cannot create thumbnail, please check ImageMagick installation =

View File

@ -455,3 +455,10 @@ Please choose format to import: =
Enter text = Enter text =
Show HTML source code = Show HTML source code =
or until I log out = or until I log out =
Make smaller =
Original size =
Make larger =
Rotate left =
Rotate right =
Delete attachment =
Cannot create thumbnail, please check ImageMagick installation =

View File

@ -457,3 +457,14 @@ Show HTML source code = Visa HTML k
or until I log out = eller tills jag loggar ut or until I log out = eller tills jag loggar ut
#
#---- please translate following items and then remove this comment ----#
#
Make smaller =
Original size =
Make larger =
Rotate left =
Rotate right =
Delete attachment =
Cannot create thumbnail, please check ImageMagick installation =

View File

@ -457,3 +457,10 @@ Please choose format to import: =
Enter text = Enter text =
Show HTML source code = Show HTML source code =
or until I log out = or until I log out =
Make smaller =
Original size =
Make larger =
Rotate left =
Rotate right =
Delete attachment =
Cannot create thumbnail, please check ImageMagick installation =

View File

@ -456,3 +456,10 @@ Please choose format to import: =
Enter text = Enter text =
Show HTML source code = Show HTML source code =
or until I log out = or until I log out =
Make smaller =
Original size =
Make larger =
Rotate left =
Rotate right =
Delete attachment =
Cannot create thumbnail, please check ImageMagick installation =

View File

@ -456,3 +456,10 @@ Please choose format to import: =
Enter text = Enter text =
Show HTML source code = Show HTML source code =
or until I log out = or until I log out =
Make smaller =
Original size =
Make larger =
Rotate left =
Rotate right =
Delete attachment =
Cannot create thumbnail, please check ImageMagick installation =

View File

@ -9,7 +9,7 @@
\********************************************************************/ \********************************************************************/
#define VERSION "2.7.2" #define VERSION "2.7.3"
char svn_revision[] = "$Id$"; char svn_revision[] = "$Id$";
/* ELOG identification */ /* ELOG identification */
@ -212,7 +212,7 @@ Encode the given string in-place by adding %XX escapes
} }
} }
*pd = '\0'; *pd = '\0';
strlcpy(ps, (char *)str, size); strlcpy(ps, (char *) str, size);
} }
/*------------------------------------------------------------------*/ /*------------------------------------------------------------------*/

View File

@ -10,7 +10,7 @@
\********************************************************************/ \********************************************************************/
/* Version of ELOG */ /* Version of ELOG */
#define VERSION "2.7.2" #define VERSION "2.7.3"
char svn_revision[] = "$Id$"; char svn_revision[] = "$Id$";
/* ELOG identification */ /* ELOG identification */
@ -4451,10 +4451,10 @@ void el_delete_attachment(LOGBOOK * lbs, char *file_name)
remove(str); remove(str);
strlcat(str, ".png", sizeof(str)); strlcat(str, ".png", sizeof(str));
remove(str); remove(str);
for (i=0 ; ; i++) { for (i = 0;; i++) {
strlcpy(str, lbs->data_dir, sizeof(str)); strlcpy(str, lbs->data_dir, sizeof(str));
strlcat(str, file_name, sizeof(str)); strlcat(str, file_name, sizeof(str));
sprintf(str+strlen(str), "-%d.png", i); sprintf(str + strlen(str), "-%d.png", i);
if (file_exist(str)) { if (file_exist(str)) {
remove(str); remove(str);
continue; continue;
@ -4464,7 +4464,7 @@ void el_delete_attachment(LOGBOOK * lbs, char *file_name)
strlcat(str, file_name, sizeof(str)); strlcat(str, file_name, sizeof(str));
if (strrchr(str, '.')) if (strrchr(str, '.'))
*strrchr(str, '.') = 0; *strrchr(str, '.') = 0;
sprintf(str+strlen(str), "-%d.png", i); sprintf(str + strlen(str), "-%d.png", i);
if (file_exist(str)) { if (file_exist(str)) {
remove(str); remove(str);
continue; continue;
@ -5536,7 +5536,7 @@ void insert_breaks(char *str, int n, int size)
/*------------------------------------------------------------------*/ /*------------------------------------------------------------------*/
void replace_inline_img(LOGBOOK *lbs, char *str) void replace_inline_img(LOGBOOK * lbs, char *str)
{ {
char *p, *pn, *pa, old[256], link[256], base_url[256]; char *p, *pn, *pa, old[256], link[256], base_url[256];
int index; int index;
@ -5558,11 +5558,11 @@ void replace_inline_img(LOGBOOK *lbs, char *str)
/* now change href to absolute link */ /* now change href to absolute link */
pa = p - 1; pa = p - 1;
while (pa > str && *pa != '<') // search '<a href=...>' while (pa > str && *pa != '<') // search '<a href=...>'
pa--; pa--;
pn = strstr(pa, "href="); pn = strstr(pa, "href=");
if (pn && pn - pa < 10) { if (pn && pn - pa < 10) {
strlcpy(old, pn+6, sizeof(old)); strlcpy(old, pn + 6, sizeof(old));
if (strchr(old, '\"')) if (strchr(old, '\"'))
*strchr(old, '\"') = 0; *strchr(old, '\"') = 0;
compose_base_url(lbs, base_url, sizeof(base_url), FALSE); compose_base_url(lbs, base_url, sizeof(base_url), FALSE);
@ -5570,7 +5570,7 @@ void replace_inline_img(LOGBOOK *lbs, char *str)
strlcat(link, old, sizeof(link)); strlcat(link, old, sizeof(link));
if (strchr(link, '?')) if (strchr(link, '?'))
*strchr(link, '?') = 0; *strchr(link, '?') = 0;
strsubst(pn+6, TEXT_SIZE, old, link); strsubst(pn + 6, TEXT_SIZE, old, link);
if (strlen(link) > strlen(old)) if (strlen(link) > strlen(old))
p += strlen(link) - strlen(old); p += strlen(link) - strlen(old);
} }
@ -5584,7 +5584,8 @@ void replace_inline_img(LOGBOOK *lbs, char *str)
/*------------------------------------------------------------------*/ /*------------------------------------------------------------------*/
void convert_elog_link(LOGBOOK *lbs, char *link, char *link_text, char *result, int absolute_link, int message_id) void convert_elog_link(LOGBOOK * lbs, char *link, char *link_text, char *result, int absolute_link,
int message_id)
{ {
char str[256], base_url[256]; char str[256], base_url[256];
int i; int i;
@ -5721,7 +5722,7 @@ void rsputs2(LOGBOOK * lbs, int absolute_link, const char *str)
strlcpy(link_text, link, sizeof(link_text)); strlcpy(link_text, link, sizeof(link_text));
if (strcmp(key_list[l], "elog:") == 0) { if (strcmp(key_list[l], "elog:") == 0) {
convert_elog_link(lbs, link, link_text, return_buffer+j, absolute_link, _current_message_id); convert_elog_link(lbs, link, link_text, return_buffer + j, absolute_link, _current_message_id);
} else if (strcmp(key_list[l], "mailto:") == 0) { } else if (strcmp(key_list[l], "mailto:") == 0) {
sprintf(return_buffer + j, "<a href=\"mailto:%s\">%s</a>", link, link_text); sprintf(return_buffer + j, "<a href=\"mailto:%s\">%s</a>", link, link_text);
} else { } else {
@ -6162,7 +6163,7 @@ void rsputs_elcode(LOGBOOK * lbs, BOOL email_notify, const char *str)
else else
sprintf(hattrib, "%s", attrib + 5); sprintf(hattrib, "%s", attrib + 5);
} else if (strstr(attrib, "://") == 0 && attrib[0] != '#') { /* add http:// if missing */ } else if (strstr(attrib, "://") == 0 && attrib[0] != '#') { /* add http:// if missing */
if (_ssl_flag) if (_ssl_flag)
sprintf(hattrib, "https://%s", attrib); sprintf(hattrib, "https://%s", attrib);
else else
@ -8930,8 +8931,9 @@ void attrib_from_param(int n_attr, char attrib[MAX_N_ATTR][NAME_LENGTH])
void ricon(char *name, char *comment, char *onclick) void ricon(char *name, char *comment, char *onclick)
{ {
rsprintf("<img align=\"middle\" name=\"%s\" src=\"icons/elc_%s.png\" alt=\"%s\" title=\"%s\" border=\"0\"\n", rsprintf
name, name, comment, comment); ("<img align=\"middle\" name=\"%s\" src=\"icons/elc_%s.png\" alt=\"%s\" title=\"%s\" border=\"0\"\n",
name, name, comment, comment);
rsprintf(" onclick=\"%s\"", onclick); rsprintf(" onclick=\"%s\"", onclick);
rsprintf(" onmousedown=\"document.images.%s.src='icons/eld_%s.png'\"\n", name, name); rsprintf(" onmousedown=\"document.images.%s.src='icons/eld_%s.png'\"\n", name, name);
rsprintf(" onmouseup=\"document.images.%s.src='icons/elc_%s.png'\"\n", name, name); rsprintf(" onmouseup=\"document.images.%s.src='icons/elc_%s.png'\"\n", name, name);
@ -11100,7 +11102,7 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
if (thumb_status) { if (thumb_status) {
get_thumb_name(file_name, thumb_name, sizeof(thumb_name), 0); get_thumb_name(file_name, thumb_name, sizeof(thumb_name), 0);
if (strrchr(thumb_name, DIR_SEPARATOR)) if (strrchr(thumb_name, DIR_SEPARATOR))
strlcpy(str, strrchr(thumb_name, DIR_SEPARATOR)+1, sizeof(str)); strlcpy(str, strrchr(thumb_name, DIR_SEPARATOR) + 1, sizeof(str));
else else
strlcpy(str, thumb_name, sizeof(str)); strlcpy(str, thumb_name, sizeof(str));
strlcpy(thumb_name, str, sizeof(str)); strlcpy(thumb_name, str, sizeof(str));
@ -11128,20 +11130,20 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
rsprintf("<b>%s</b>&nbsp;\n", att[index] + 14); rsprintf("<b>%s</b>&nbsp;\n", att[index] + 14);
sprintf(cmd, "identify -format '%%wx%%h' '%s'", file_name); sprintf(cmd, "identify -format '%%wx%%h' '%s'", file_name);
#ifdef OS_WINNT #ifdef OS_WINNT
for (i=0 ; i<(int)strlen(cmd) ; i++) for (i = 0; i < (int) strlen(cmd); i++)
if (cmd[i] == '\'') if (cmd[i] == '\'')
cmd[i] = '\"'; cmd[i] = '\"';
#endif #endif
my_shell(cmd, str, sizeof(str)); my_shell(cmd, str, sizeof(str));
if (atoi(str) > 0) if (atoi(str) > 0)
rsprintf("<span class=\"bytes\">%s: %s</span>\n", loc("Original size"), str); rsprintf("<span class=\"bytes\">%s: %s</span>\n", loc("Original size"), str);
rsprintf("</td></tr>\n"); rsprintf("</td></tr>\n");
rsprintf("<tr><td align=center>"); rsprintf("<tr><td align=center>");
} else { } else {
rsprintf("%s\n", att[index] + 14); rsprintf("%s\n", att[index] + 14);
rsprintf("&nbsp;&nbsp;<input type=\"submit\" name=\"delatt%d\" value=\"%s\" ", rsprintf("&nbsp;&nbsp;<input type=\"submit\" name=\"delatt%d\" value=\"%s\" ",
index, loc("Delete")); index, loc("Delete"));
rsprintf("onClick=\"return mark_submit();\">"); rsprintf("onClick=\"return mark_submit();\">");
rsprintf("<br>\n"); rsprintf("<br>\n");
} }
@ -11154,28 +11156,30 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
strlcpy(str, att[index], sizeof(str)); strlcpy(str, att[index], sizeof(str));
str[13] = 0; str[13] = 0;
if (strrchr(thumb_name, DIR_SEPARATOR)) if (strrchr(thumb_name, DIR_SEPARATOR))
strlcpy(file_enc, strrchr(thumb_name, DIR_SEPARATOR)+1+14, sizeof(file_enc)); strlcpy(file_enc, strrchr(thumb_name, DIR_SEPARATOR) + 1 + 14,
sizeof(file_enc));
else else
strlcpy(file_enc, thumb_name + 14, sizeof(file_enc)); strlcpy(file_enc, thumb_name + 14, sizeof(file_enc));
url_encode(file_enc, sizeof(file_enc)); /* for file names with special characters like "+" */ url_encode(file_enc, sizeof(file_enc)); /* for file names with special characters like "+" */
sprintf(ref, "%s/%s?thumb=1", str, file_enc); sprintf(ref, "%s/%s?thumb=1", str, file_enc);
rsprintf("<img src=\"%s\" alt=\"%s\" title=\"%s\" name=\"att%d\">\n", rsprintf("<img src=\"%s\" alt=\"%s\" title=\"%s\" name=\"att%d\">\n",
ref, att[index] + 14, att[index] + 14, index); ref, att[index] + 14, att[index] + 14, index);
} else if (thumb_status == 2) { } else if (thumb_status == 2) {
for (i=0 ; ; i++) { for (i = 0;; i++) {
get_thumb_name(file_name, thumb_name, sizeof(thumb_name), i); get_thumb_name(file_name, thumb_name, sizeof(thumb_name), i);
if (thumb_name[0]) { if (thumb_name[0]) {
strlcpy(str, att[index], sizeof(str)); strlcpy(str, att[index], sizeof(str));
str[13] = 0; str[13] = 0;
if (strrchr(thumb_name, DIR_SEPARATOR)) if (strrchr(thumb_name, DIR_SEPARATOR))
strlcpy(file_enc, strrchr(thumb_name, DIR_SEPARATOR)+1+14, sizeof(file_enc)); strlcpy(file_enc, strrchr(thumb_name, DIR_SEPARATOR) + 1 + 14,
sizeof(file_enc));
else else
strlcpy(file_enc, thumb_name + 14, sizeof(file_enc)); strlcpy(file_enc, thumb_name + 14, sizeof(file_enc));
url_encode(file_enc, sizeof(file_enc)); /* for file names with special characters like "+" */ url_encode(file_enc, sizeof(file_enc)); /* for file names with special characters like "+" */
sprintf(ref, "%s/%s?thumb=1", str, file_enc); sprintf(ref, "%s/%s?thumb=1", str, file_enc);
rsprintf("<img src=\"%s\" alt=\"%s\" title=\"%s\" name=\"att%d_%d\">\n", rsprintf("<img src=\"%s\" alt=\"%s\" title=\"%s\" name=\"att%d_%d\">\n",
ref, att[index] + 14, att[index] + 14, index, i); ref, att[index] + 14, att[index] + 14, index, i);
} else } else
break; break;
@ -11185,10 +11189,10 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
strlcpy(str, att[index], sizeof(str)); strlcpy(str, att[index], sizeof(str));
str[13] = 0; str[13] = 0;
strcpy(file_enc, att[index] + 14); strcpy(file_enc, att[index] + 14);
url_encode(file_enc, sizeof(file_enc)); /* for file names with special characters like "+" */ url_encode(file_enc, sizeof(file_enc)); /* for file names with special characters like "+" */
sprintf(ref, "%s/%s", str, file_enc); sprintf(ref, "%s/%s", str, file_enc);
rsprintf("<img src=\"%s\" alt=\"%s\" title=\"%s\" name=\"att%d\">\n", rsprintf("<img src=\"%s\" alt=\"%s\" title=\"%s\" name=\"att%d\">\n",
ref, att[index] + 14, att[index] + 14, index); ref, att[index] + 14, att[index] + 14, index);
} }
} else { } else {
@ -13930,7 +13934,7 @@ void csv_import(LOGBOOK * lbs, const char *csv, const char *csvfile)
/* interprete date entries correctly */ /* interprete date entries correctly */
if (!(first && isparam("head"))) { if (!(first && isparam("head"))) {
for (i = attr_offset; i < n; i++) { for (i = attr_offset; i < n; i++) {
if (attr_flags[i-attr_offset] & AF_DATE) { if (attr_flags[i - attr_offset] & AF_DATE) {
/* convert to seconds in Unix format */ /* convert to seconds in Unix format */
ltime = convert_date(list + i * NAME_LENGTH); ltime = convert_date(list + i * NAME_LENGTH);
if (ltime == 0) { if (ltime == 0) {
@ -13939,7 +13943,7 @@ void csv_import(LOGBOOK * lbs, const char *csv, const char *csvfile)
} }
sprintf(list + i * NAME_LENGTH, "%d", (int) ltime); sprintf(list + i * NAME_LENGTH, "%d", (int) ltime);
} }
if (attr_flags[i-attr_offset] & AF_DATETIME) { if (attr_flags[i - attr_offset] & AF_DATETIME) {
/* convert to seconds in Unix format */ /* convert to seconds in Unix format */
ltime = convert_datetime(list + i * NAME_LENGTH); ltime = convert_datetime(list + i * NAME_LENGTH);
if (ltime == 0) { if (ltime == 0) {
@ -13966,9 +13970,8 @@ void csv_import(LOGBOOK * lbs, const char *csv, const char *csvfile)
/* skip message ID and date attributes */ /* skip message ID and date attributes */
for (i = attr_offset = 0; i < n; i++) for (i = attr_offset = 0; i < n; i++)
if (strieq(list + i * NAME_LENGTH, "Message ID") || if (strieq(list + i * NAME_LENGTH, "Message ID") || strieq(list + i * NAME_LENGTH, "Date"))
strieq(list + i * NAME_LENGTH, "Date")) attr_offset++;
attr_offset++;
if (isparam("preview")) { if (isparam("preview")) {
rsprintf("<tr>\n"); rsprintf("<tr>\n");
@ -13988,7 +13991,7 @@ void csv_import(LOGBOOK * lbs, const char *csv, const char *csvfile)
} else { } else {
for (i = j = attr_offset; i < n; i++) for (i = j = attr_offset; i < n; i++)
if (i != textcol) if (i != textcol)
strlcpy(attr_list[j++ - attr_offset], list + i * NAME_LENGTH, NAME_LENGTH); strlcpy(attr_list[j++ - attr_offset], list + i * NAME_LENGTH, NAME_LENGTH);
if (filltext) { if (filltext) {
@ -14042,7 +14045,7 @@ void csv_import(LOGBOOK * lbs, const char *csv, const char *csvfile)
if (!filltext) { if (!filltext) {
/* submit entry */ /* submit entry */
date[0] = 0; date[0] = 0;
if (el_submit(lbs, 0, FALSE, date, attr_list, if (el_submit(lbs, 0, FALSE, date, attr_list,
(char (*)[NAME_LENGTH]) (list + attr_offset * NAME_LENGTH), (char (*)[NAME_LENGTH]) (list + attr_offset * NAME_LENGTH),
n_attr, "", "", "", "plain", NULL, TRUE, NULL)) n_attr, "", "", "", "plain", NULL, TRUE, NULL))
n_imported++; n_imported++;
@ -14055,8 +14058,8 @@ void csv_import(LOGBOOK * lbs, const char *csv, const char *csvfile)
/* submit entry */ /* submit entry */
date[0] = 0; date[0] = 0;
if (el_submit(lbs, 0, FALSE, date, attr_list, if (el_submit(lbs, 0, FALSE, date, attr_list,
(char (*)[NAME_LENGTH]) (list + attr_offset * NAME_LENGTH), (char (*)[NAME_LENGTH]) (list + attr_offset * NAME_LENGTH),
n_attr, line, "", "", "plain", NULL, TRUE, NULL)) n_attr, line, "", "", "plain", NULL, TRUE, NULL))
n_imported++; n_imported++;
} }
@ -16445,8 +16448,7 @@ void display_line(LOGBOOK * lbs, int message_id, int number, char *mode,
char str[NAME_LENGTH], ref[256], *nowrap, sclass[80], format[256], char str[NAME_LENGTH], ref[256], *nowrap, sclass[80], format[256],
file_name[MAX_PATH_LENGTH], *slist, *svalue, comment[256]; file_name[MAX_PATH_LENGTH], *slist, *svalue, comment[256];
char display[NAME_LENGTH], attr_icon[80]; char display[NAME_LENGTH], attr_icon[80];
int i, j, i_line, index, colspan, n_attachments, line_len, thumb_status, int i, j, i_line, index, colspan, n_attachments, line_len, thumb_status, max_line_len;
max_line_len;
BOOL skip_comma; BOOL skip_comma;
FILE *f; FILE *f;
struct tm *pts; struct tm *pts;
@ -16912,7 +16914,7 @@ void display_line(LOGBOOK * lbs, int message_id, int number, char *mode,
i_line++; i_line++;
line_len = 0; line_len = 0;
} else } else
/* limit line length to 150 characters */ /* limit line length to 150 characters */
if (line_len > 150 && text[i] == ' ') { if (line_len > 150 && text[i] == ' ') {
str[i] = '\n'; str[i] = '\n';
i_line++; i_line++;
@ -16960,7 +16962,7 @@ void display_line(LOGBOOK * lbs, int message_id, int number, char *mode,
i_line++; i_line++;
line_len = 0; line_len = 0;
} else } else
/* limit line length to max_line_len characters */ /* limit line length to max_line_len characters */
if (line_len > max_line_len && text[i] == ' ') { if (line_len > max_line_len && text[i] == ' ') {
str[i] = '\n'; str[i] = '\n';
i_line++; i_line++;
@ -17044,24 +17046,25 @@ void display_line(LOGBOOK * lbs, int message_id, int number, char *mode,
} else { } else {
if (thumb_status) { if (thumb_status) {
rsprintf("<tr><td colspan=%d class=\"attachment\">%s %d: <a href=\"%s\" target=\"_blank\">%s</a>\n", rsprintf
("<tr><td colspan=%d class=\"attachment\">%s %d: <a href=\"%s\" target=\"_blank\">%s</a>\n",
colspan, loc("Attachment"), index + 1, ref, attachment[index] + 14); colspan, loc("Attachment"), index + 1, ref, attachment[index] + 14);
if (show_attachments) { if (show_attachments) {
rsprintf("<tr><td colspan=%d class=\"attachmentframe\">\n", colspan); rsprintf("<tr><td colspan=%d class=\"attachmentframe\">\n", colspan);
if (thumb_status == 2) { if (thumb_status == 2) {
for (i=0 ; ; i++) { for (i = 0;; i++) {
strlcpy(str, file_name, sizeof(str)); strlcpy(str, file_name, sizeof(str));
if (chkext(str, ".pdf") || chkext(str, ".ps")) if (chkext(str, ".pdf") || chkext(str, ".ps"))
if (strrchr(str, '.')) if (strrchr(str, '.'))
*strrchr(str, '.') = 0; *strrchr(str, '.') = 0;
sprintf(str+strlen(str), "-%d.png", i); sprintf(str + strlen(str), "-%d.png", i);
if (file_exist(str)) { if (file_exist(str)) {
strlcpy(str, ref, sizeof(str)); strlcpy(str, ref, sizeof(str));
if (chkext(file_name, ".pdf") || chkext(file_name, ".ps")) if (chkext(file_name, ".pdf") || chkext(file_name, ".ps"))
if (strrchr(str, '.')) if (strrchr(str, '.'))
*strrchr(str, '.') = 0; *strrchr(str, '.') = 0;
sprintf(str+strlen(str), "-%d.png", i); sprintf(str + strlen(str), "-%d.png", i);
rsprintf("<a name=\"att%d\" href=\"%s\">\n", index + 1, ref); rsprintf("<a name=\"att%d\" href=\"%s\">\n", index + 1, ref);
rsprintf("<img src=\"%s\" alt=\"%s\" title=\"%s\"></a>\n", str, rsprintf("<img src=\"%s\" alt=\"%s\" title=\"%s\"></a>\n", str,
attachment[index] + 14, attachment[index] + 14); attachment[index] + 14, attachment[index] + 14);
@ -17515,8 +17518,7 @@ BOOL is_command_allowed(LOGBOOK * lbs, char *command)
/* exclude other non-localized commands */ /* exclude other non-localized commands */
else if (command[0] && strieq(command, "GetMD5")) { else if (command[0] && strieq(command, "GetMD5")) {
return TRUE; return TRUE;
} } else if (command[0] && strieq(command, "IM")) {
else if (command[0] && strieq(command, "IM")) {
return TRUE; return TRUE;
} }
/* check if command is present in the menu list */ /* check if command is present in the menu list */
@ -18329,8 +18331,8 @@ time_t convert_datetime(char *date_string)
tms.tm_mon = month - 1; tms.tm_mon = month - 1;
tms.tm_mday = day; tms.tm_mday = day;
tms.tm_hour = hour; tms.tm_hour = hour;
tms.tm_min = min; tms.tm_min = min;
tms.tm_sec = sec; tms.tm_sec = sec;
ltime = mktime(&tms); ltime = mktime(&tms);
@ -21793,10 +21795,10 @@ void submit_elog(LOGBOOK * lbs)
if (strieq(encoding, "HTML") && stristr(getparam("text"), "elog:")) { if (strieq(encoding, "HTML") && stristr(getparam("text"), "elog:")) {
p = stristr(getparam("text"), "elog:"); p = stristr(getparam("text"), "elog:");
while (p) { while (p) {
for (i=0 ; i<5 || (p[i] == '/' || isalnum(p[i])) ; i++) for (i = 0; i < 5 || (p[i] == '/' || isalnum(p[i])); i++)
str[i] = p[i]; str[i] = p[i];
str[i] = 0; str[i] = 0;
convert_elog_link(lbs, str+5, str+5, str2, 0, message_id); convert_elog_link(lbs, str + 5, str + 5, str2, 0, message_id);
strsubst(p, TEXT_SIZE, str, str2); strsubst(p, TEXT_SIZE, str, str2);
p += strlen(str2); p += strlen(str2);
p = stristr(p, "elog:"); p = stristr(p, "elog:");
@ -22276,7 +22278,7 @@ int is_inline_attachment(char *encoding, int message_id, char *text, int i, char
int create_thumbnail(LOGBOOK * lbs, char *file_name) int create_thumbnail(LOGBOOK * lbs, char *file_name)
{ {
char str[MAX_PATH_LENGTH], cmd[2*MAX_PATH_LENGTH], thumb_size[256]; char str[MAX_PATH_LENGTH], cmd[2 * MAX_PATH_LENGTH], thumb_size[256];
int i; int i;
if (!image_magick_exist) if (!image_magick_exist)
@ -22290,7 +22292,7 @@ int create_thumbnail(LOGBOOK * lbs, char *file_name)
if (!chkext(file_name, ".ps") && !chkext(file_name, ".pdf") && !chkext(file_name, ".eps") && if (!chkext(file_name, ".ps") && !chkext(file_name, ".pdf") && !chkext(file_name, ".eps") &&
!chkext(file_name, ".gif") && !chkext(file_name, ".jpg") && !chkext(file_name, ".jpeg") && !chkext(file_name, ".gif") && !chkext(file_name, ".jpg") && !chkext(file_name, ".jpeg") &&
!chkext(file_name, ".png") && !chkext(file_name, ".ico") && !chkext(file_name, ".tif")) !chkext(file_name, ".png") && !chkext(file_name, ".ico") && !chkext(file_name, ".tif"))
return 0; return 0;
i = get_thumb_name(file_name, str, sizeof(str), 0); i = get_thumb_name(file_name, str, sizeof(str), 0);
if (i) if (i)
@ -22309,7 +22311,7 @@ int create_thumbnail(LOGBOOK * lbs, char *file_name)
sprintf(cmd, "convert '%s'%s '%s'", file_name, thumb_size, str); sprintf(cmd, "convert '%s'%s '%s'", file_name, thumb_size, str);
#ifdef OS_WINNT #ifdef OS_WINNT
for (i=0 ; i<(int)strlen(cmd) ; i++) for (i = 0; i < (int) strlen(cmd); i++)
if (cmd[i] == '\'') if (cmd[i] == '\'')
cmd[i] = '\"'; cmd[i] = '\"';
#endif #endif
@ -22343,7 +22345,7 @@ int get_thumb_name(const char *file_name, char *thumb_name, int size, int index)
strlcpy(str, file_name, sizeof(str)); strlcpy(str, file_name, sizeof(str));
if (strrchr(str, '.')) if (strrchr(str, '.'))
*strrchr(str, '.') = 0; *strrchr(str, '.') = 0;
sprintf(str+strlen(str), "-%d.png", index); sprintf(str + strlen(str), "-%d.png", index);
if (file_exist(str)) { if (file_exist(str)) {
strlcpy(thumb_name, str, size); strlcpy(thumb_name, str, size);
return 2; return 2;
@ -22362,7 +22364,7 @@ int get_thumb_name(const char *file_name, char *thumb_name, int size, int index)
} }
} else { } else {
strlcpy(str, file_name, sizeof(str)); strlcpy(str, file_name, sizeof(str));
sprintf(str+strlen(str), "-%d.png", index); sprintf(str + strlen(str), "-%d.png", index);
if (file_exist(str)) { if (file_exist(str)) {
strlcpy(thumb_name, str, size); strlcpy(thumb_name, str, size);
return 2; return 2;
@ -22384,7 +22386,7 @@ int get_thumb_name(const char *file_name, char *thumb_name, int size, int index)
/*------------------------------------------------------------------*/ /*------------------------------------------------------------------*/
void call_image_magick(LOGBOOK *lbs) void call_image_magick(LOGBOOK * lbs)
{ {
char str[256], cmd[256], file_name[256], thumb_name[256]; char str[256], cmd[256], file_name[256], thumb_name[256];
int cur_width, cur_height, new_size, cur_rot, new_rot, i, thumb_status; int cur_width, cur_height, new_size, cur_rot, new_rot, i, thumb_status;
@ -22393,14 +22395,14 @@ void call_image_magick(LOGBOOK *lbs)
show_error("Unknown IM request received"); show_error("Unknown IM request received");
return; return;
} }
strlcpy(file_name, lbs->data_dir, sizeof(file_name)); strlcpy(file_name, lbs->data_dir, sizeof(file_name));
strlcat(file_name, getparam("img"), sizeof(file_name)); strlcat(file_name, getparam("img"), sizeof(file_name));
thumb_status = get_thumb_name(file_name, thumb_name, sizeof(thumb_name), 0); thumb_status = get_thumb_name(file_name, thumb_name, sizeof(thumb_name), 0);
sprintf(cmd, "identify -format '%%wx%%h %%c' '%s'", thumb_name); sprintf(cmd, "identify -format '%%wx%%h %%c' '%s'", thumb_name);
#ifdef OS_WINNT #ifdef OS_WINNT
for (i=0 ; i<(int)strlen(cmd) ; i++) for (i = 0; i < (int) strlen(cmd); i++)
if (cmd[i] == '\'') if (cmd[i] == '\'')
cmd[i] = '\"'; cmd[i] = '\"';
#endif #endif
@ -22409,11 +22411,11 @@ void call_image_magick(LOGBOOK *lbs)
if (atoi(str) > 0) { if (atoi(str) > 0) {
cur_width = atoi(str); cur_width = atoi(str);
if (strchr(str, 'x')) { if (strchr(str, 'x')) {
cur_height = atoi(strchr(str, 'x')+1); cur_height = atoi(strchr(str, 'x') + 1);
} else } else
cur_height = cur_width; cur_height = cur_width;
if (strchr(str, ' ')) { if (strchr(str, ' ')) {
cur_rot = atoi(strchr(str, ' ')+1); cur_rot = atoi(strchr(str, ' ') + 1);
} else } else
cur_rot = 0; cur_rot = 0;
} else { } else {
@ -22428,37 +22430,36 @@ void call_image_magick(LOGBOOK *lbs)
i = cmd[0] = 0; i = cmd[0] = 0;
if (strieq(getparam("req"), "rotleft")) { if (strieq(getparam("req"), "rotleft")) {
new_rot = (cur_rot + 360 - 90) % 360; new_rot = (cur_rot + 360 - 90) % 360;
sprintf(cmd, "convert '%s' -rotate %d -thumbnail %d -set comment ' %d' '%s'", sprintf(cmd, "convert '%s' -rotate %d -thumbnail %d -set comment ' %d' '%s'",
file_name, new_rot, cur_height, new_rot, thumb_name); file_name, new_rot, cur_height, new_rot, thumb_name);
} }
if (strieq(getparam("req"), "rotright")) { if (strieq(getparam("req"), "rotright")) {
new_rot = (cur_rot + 90) % 360; new_rot = (cur_rot + 90) % 360;
sprintf(cmd, "convert '%s' -rotate %d -thumbnail %d -set comment ' %d' '%s'", sprintf(cmd, "convert '%s' -rotate %d -thumbnail %d -set comment ' %d' '%s'",
file_name, new_rot, cur_height, new_rot, thumb_name); file_name, new_rot, cur_height, new_rot, thumb_name);
} }
if (strieq(getparam("req"), "original")) { if (strieq(getparam("req"), "original")) {
new_size = (int) (cur_width/1.5); new_size = (int) (cur_width / 1.5);
sprintf(cmd, "convert '%s' '%s'", sprintf(cmd, "convert '%s' '%s'", file_name, thumb_name);
file_name, thumb_name);
} }
if (strieq(getparam("req"), "smaller")) { if (strieq(getparam("req"), "smaller")) {
new_size = (int) (cur_width/1.5); new_size = (int) (cur_width / 1.5);
sprintf(cmd, "convert '%s' -rotate %d -thumbnail %d -set comment ' %d' '%s'", sprintf(cmd, "convert '%s' -rotate %d -thumbnail %d -set comment ' %d' '%s'",
file_name, cur_rot, new_size, cur_rot, thumb_name); file_name, cur_rot, new_size, cur_rot, thumb_name);
} }
if (strieq(getparam("req"), "larger")) { if (strieq(getparam("req"), "larger")) {
new_size = (int) (cur_width*1.5); new_size = (int) (cur_width * 1.5);
sprintf(cmd, "convert '%s' -rotate %d -thumbnail %d -set comment ' %d' '%s'", sprintf(cmd, "convert '%s' -rotate %d -thumbnail %d -set comment ' %d' '%s'",
file_name, cur_rot, new_size, cur_rot, thumb_name); file_name, cur_rot, new_size, cur_rot, thumb_name);
} }
if (cmd[0]) { if (cmd[0]) {
#ifdef OS_WINNT #ifdef OS_WINNT
for (i=0 ; i<(int)strlen(cmd) ; i++) for (i = 0; i < (int) strlen(cmd); i++)
if (cmd[i] == '\'') if (cmd[i] == '\'')
cmd[i] = '\"'; cmd[i] = '\"';
#endif #endif
@ -22475,8 +22476,7 @@ void show_elog_entry(LOGBOOK * lbs, char *dec_path, char *command)
{ {
int size, i, j, k, n, n_log, status, fh, length, message_error, index, n_hidden, int size, i, j, k, n, n_log, status, fh, length, message_error, index, n_hidden,
message_id, orig_message_id, format_flags[MAX_N_ATTR], att_hide[MAX_ATTACHMENTS], message_id, orig_message_id, format_flags[MAX_N_ATTR], att_hide[MAX_ATTACHMENTS],
att_inline[MAX_ATTACHMENTS], n_attachments, n_lines, n_disp_attr, attr_index[MAX_N_ATTR], att_inline[MAX_ATTACHMENTS], n_attachments, n_lines, n_disp_attr, attr_index[MAX_N_ATTR], thumb_status;
thumb_status;
char str[2 * NAME_LENGTH], ref[256], file_enc[256], attrib[MAX_N_ATTR][NAME_LENGTH]; char str[2 * NAME_LENGTH], ref[256], file_enc[256], attrib[MAX_N_ATTR][NAME_LENGTH];
char date[80], text[TEXT_SIZE], menu_str[1000], cmd[256], script[256], char date[80], text[TEXT_SIZE], menu_str[1000], cmd[256], script[256],
orig_tag[80], reply_tag[MAX_REPLY_TO * 10], display[NAME_LENGTH], orig_tag[80], reply_tag[MAX_REPLY_TO * 10], display[NAME_LENGTH],
@ -23426,22 +23426,22 @@ void show_elog_entry(LOGBOOK * lbs, char *dec_path, char *command)
rsprintf("<tr><td class=\"attachmentframe\">\n"); rsprintf("<tr><td class=\"attachmentframe\">\n");
if (thumb_status == 3) { if (thumb_status == 3) {
rsprintf("<font color=red><b>%s</b></font>\n", rsprintf("<font color=red><b>%s</b></font>\n",
loc("Cannot create thumbnail, please check ImageMagick installation")); loc("Cannot create thumbnail, please check ImageMagick installation"));
} else { } else {
if (thumb_status == 2 && !email) { if (thumb_status == 2 && !email) {
for (i=0 ; ; i++) { for (i = 0;; i++) {
strlcpy(str, file_name, sizeof(str)); strlcpy(str, file_name, sizeof(str));
if (chkext(file_name, ".pdf") || chkext(file_name, ".ps")) if (chkext(file_name, ".pdf") || chkext(file_name, ".ps"))
if (strrchr(str, '.')) if (strrchr(str, '.'))
*strrchr(str, '.') = 0; *strrchr(str, '.') = 0;
sprintf(str+strlen(str), "-%d.png", i); sprintf(str + strlen(str), "-%d.png", i);
if (file_exist(str)) { if (file_exist(str)) {
strlcpy(str, ref, sizeof(str)); strlcpy(str, ref, sizeof(str));
if (chkext(file_name, ".pdf") || chkext(file_name, ".ps")) if (chkext(file_name, ".pdf") || chkext(file_name, ".ps"))
if (strrchr(str, '.')) if (strrchr(str, '.'))
*strrchr(str, '.') = 0; *strrchr(str, '.') = 0;
sprintf(str+strlen(str), "-%d.png", i); sprintf(str + strlen(str), "-%d.png", i);
rsprintf("<a name=\"att%d\" href=\"%s\">\n", index + 1, ref); rsprintf("<a name=\"att%d\" href=\"%s\">\n", index + 1, ref);
rsprintf("<img src=\"%s\" alt=\"%s\" title=\"%s\"></a>\n", str, rsprintf("<img src=\"%s\" alt=\"%s\" title=\"%s\"></a>\n", str,
attachment[index] + 14, attachment[index] + 14); attachment[index] + 14, attachment[index] + 14);
@ -23466,7 +23466,7 @@ void show_elog_entry(LOGBOOK * lbs, char *dec_path, char *command)
if (!email) { if (!email) {
rsprintf("<tr><td class=\"attachmentframe\">\n"); rsprintf("<tr><td class=\"attachmentframe\">\n");
rsprintf("<a name=\"att%d\"></a>\n", index + 1); rsprintf("<a name=\"att%d\"></a>\n", index + 1);
rsprintf("<img src=\"%s\" alt=\"%s\" title=\"%s\">\n", ref, rsprintf("<img src=\"%s\" alt=\"%s\" title=\"%s\">\n", ref,
attachment[index] + 14, attachment[index] + 14); attachment[index] + 14, attachment[index] + 14);
rsprintf("</td></tr>\n\n"); rsprintf("</td></tr>\n\n");
} }
@ -24894,8 +24894,9 @@ void show_uploader_finished(LOGBOOK * lbs)
rsprintf(" if (opener.document.title == \"FCKeditor\") {\n"); rsprintf(" if (opener.document.title == \"FCKeditor\") {\n");
rsprintf(" i = opener.parent.next_attachment;\n"); rsprintf(" i = opener.parent.next_attachment;\n");
rsprintf(" opener.FCKeditorAPI.GetInstance('Text').\n"); rsprintf(" opener.FCKeditorAPI.GetInstance('Text').\n");
rsprintf("InsertHtml('<a href=\"%s\"><img border=0 alt=\"%s\" src=\"%s\" name=\"att'+(i-1)+'\" id=\"att'+(i-1)+'\"></a>');\n", rsprintf
ref, att + 14, ref_thumb); ("InsertHtml('<a href=\"%s\"><img border=0 alt=\"%s\" src=\"%s\" name=\"att'+(i-1)+'\" id=\"att'+(i-1)+'\"></a>');\n",
ref, att + 14, ref_thumb);
rsprintf(" opener.parent.document.form1.inlineatt.value = '%s';\n", att); rsprintf(" opener.parent.document.form1.inlineatt.value = '%s';\n", att);
rsprintf(" opener.parent.document.form1.jcmd.value = 'Upload';\n"); rsprintf(" opener.parent.document.form1.jcmd.value = 'Upload';\n");
rsprintf(" opener.parent.document.form1.submit();\n"); rsprintf(" opener.parent.document.form1.submit();\n");
@ -26229,7 +26230,7 @@ void decode_post(char *logbook, LOGBOOK * lbs, const char *string, const char *b
int ka_sock[N_MAX_CONNECTION]; int ka_sock[N_MAX_CONNECTION];
int ka_time[N_MAX_CONNECTION]; int ka_time[N_MAX_CONNECTION];
#ifdef HAVE_SSL #ifdef HAVE_SSL
SSL* ka_ssl_con[N_MAX_CONNECTION]; SSL *ka_ssl_con[N_MAX_CONNECTION];
#endif #endif
struct in_addr remote_addr[N_MAX_CONNECTION]; struct in_addr remote_addr[N_MAX_CONNECTION];
char remote_host[N_MAX_CONNECTION][256]; char remote_host[N_MAX_CONNECTION][256];
@ -26480,7 +26481,7 @@ int process_http_request(const char *request, int i_conn)
/* redirect image request from inside FCKeditor */ /* redirect image request from inside FCKeditor */
if (strieq(logbook, "fckeditor")) { if (strieq(logbook, "fckeditor")) {
if (strstr(url, "?lb=")) { if (strstr(url, "?lb=")) {
strlcpy(logbook, strstr(url, "?lb=")+4, sizeof(logbook)); strlcpy(logbook, strstr(url, "?lb=") + 4, sizeof(logbook));
if (strchr(logbook, '&')) if (strchr(logbook, '&'))
*strchr(logbook, '&') = 0; *strchr(logbook, '&') = 0;
url_decode(logbook); url_decode(logbook);
@ -26729,7 +26730,7 @@ int process_http_request(const char *request, int i_conn)
for (i = 0; *p && *p != '/' && *p != '?'; p++); for (i = 0; *p && *p != '/' && *p != '?'; p++);
while (*p && *p == '/') while (*p && *p == '/')
p++; p++;
if (strncmp(p, "editor/", 7) == 0) // fix for image request inside FCKeditor if (strncmp(p, "editor/", 7) == 0) // fix for image request inside FCKeditor
p += 7; p += 7;
/* decode command and return answer */ /* decode command and return answer */
decode_get(logbook, p); decode_get(logbook, p);
@ -26780,7 +26781,7 @@ int process_http_request(const char *request, int i_conn)
/*------------------------------------------------------------------*/ /*------------------------------------------------------------------*/
#ifdef HAVE_SSL #ifdef HAVE_SSL
void send_return(int _sock, SSL *ssl_con, const char *net_buffer) void send_return(int _sock, SSL * ssl_con, const char *net_buffer)
#else #else
void send_return(int _sock, const char *net_buffer) void send_return(int _sock, const char *net_buffer)
#endif #endif
@ -26837,7 +26838,7 @@ void send_return(int _sock, const char *net_buffer)
|| chkext(net_buffer, ".pdf") || return_length > 10000) || chkext(net_buffer, ".pdf") || return_length > 10000)
eprintf("\n<%d bytes of %s>\n\n", length, str); eprintf("\n<%d bytes of %s>\n\n", length, str);
else else
eputs(p+4); eputs(p + 4);
eprintf("\n"); eprintf("\n");
} }
} else { } else {
@ -26854,7 +26855,7 @@ void send_return(int _sock, const char *net_buffer)
send(_sock, return_buffer, return_length, 0); send(_sock, return_buffer, return_length, 0);
#endif #endif
if (verbose == 1) { if (verbose == 1) {
eprintf("Returned %d bytes\n", return_length); eprintf("Returned %d bytes\n", return_length);
} else if (verbose == 2) { } else if (verbose == 2) {
if (strrchr(net_buffer, '/')) if (strrchr(net_buffer, '/'))
strlcpy(str, strrchr(net_buffer, '/') + 1, sizeof(str)); strlcpy(str, strrchr(net_buffer, '/') + 1, sizeof(str));
@ -26999,7 +27000,7 @@ void hup_handler(int sig)
#ifdef HAVE_SSL #ifdef HAVE_SSL
SSL_CTX* init_ssl(void) SSL_CTX *init_ssl(void)
{ {
char str[256]; char str[256];
SSL_METHOD *meth; SSL_METHOD *meth;
@ -27019,7 +27020,7 @@ SSL_CTX* init_ssl(void)
} }
if (SSL_CTX_use_certificate_file(ctx, str, SSL_FILETYPE_PEM) < 0) if (SSL_CTX_use_certificate_file(ctx, str, SSL_FILETYPE_PEM) < 0)
return NULL; return NULL;
strlcpy(str, resource_dir, sizeof(str)); strlcpy(str, resource_dir, sizeof(str));
strlcat(str, "ssl/server.key", sizeof(str)); strlcat(str, "ssl/server.key", sizeof(str));
if (!file_exist(str)) { if (!file_exist(str)) {
@ -27039,7 +27040,7 @@ SSL_CTX* init_ssl(void)
return ctx; return ctx;
} }
#endif // HAVE_SSL #endif // HAVE_SSL
/*------------------------------------------------------------------*/ /*------------------------------------------------------------------*/
@ -27075,8 +27076,7 @@ void server_loop(void)
/* initialize SSL if requested */ /* initialize SSL if requested */
_ssl_flag = 0; _ssl_flag = 0;
if (getcfg("global", "SSL", str, sizeof(str)) && if (getcfg("global", "SSL", str, sizeof(str)) && atoi(str) == 1) {
atoi(str) == 1) {
#ifdef HAVE_SSL #ifdef HAVE_SSL
ssl_ctx = init_ssl(); ssl_ctx = init_ssl();
if (ssl_ctx == NULL) { if (ssl_ctx == NULL) {
@ -27333,7 +27333,7 @@ void server_loop(void)
ka_sock[i_conn] = 0; ka_sock[i_conn] = 0;
ka_ssl_con[i_conn] = ssl_con; ka_ssl_con[i_conn] = ssl_con;
continue; continue;
} }
} }
#endif #endif
@ -27348,7 +27348,6 @@ void server_loop(void)
min = ka_time[i]; min = ka_time[i];
i_min = i; i_min = i;
} }
#ifdef HAVE_SSL #ifdef HAVE_SSL
if (_ssl_flag) { if (_ssl_flag) {
SSL_set_fd(ssl_con, ka_sock[i_min]); SSL_set_fd(ssl_con, ka_sock[i_min]);
@ -27521,7 +27520,7 @@ void server_loop(void)
i = SSL_read(ssl_con, net_buffer, net_buffer_size); i = SSL_read(ssl_con, net_buffer, net_buffer_size);
else else
#endif #endif
i = recv(_sock, net_buffer, net_buffer_size, 0); i = recv(_sock, net_buffer, net_buffer_size, 0);
} else } else
break; break;
} while (i > 0); } while (i > 0);