Files can be specified with absolute path

SVN revision: 279
This commit is contained in:
Stefan Ritt 2002-11-06 08:59:19 +00:00
parent 362fe3041c
commit 88fdcd3c65
3 changed files with 80 additions and 19 deletions

View File

@ -9,6 +9,8 @@ Version 2.2.2, released Nobember xxth, 2002
- Made "Allow <command> = <user>" work in localized versions - Made "Allow <command> = <user>" work in localized versions
- Move whole thread when individual message is re-submitted - Move whole thread when individual message is re-submitted
- Do not display commands which are not allowed for the current user - Do not display commands which are not allowed for the current user
- All text files (preset text, welcome page, ...) can specified with an
absolute path if they start with "/" (or "\" under Windows)
Version 2.2.1, released October 15th, 2002 Version 2.2.1, released October 15th, 2002
========================================== ==========================================

View File

@ -128,7 +128,11 @@ contents of the tab.
<br> <br>
This optional HTML code gets displayed in the title of the logbook selection This optional HTML code gets displayed in the title of the logbook selection
page. It can contain images via <b><code>&lt;img src="welcome.gif"&gt;</code></b>. page. It can contain images via <b><code>&lt;img src="welcome.gif"&gt;</code></b>.
These images must be in the same directory as the elodg.cfg file. These images must be in the same directory as the <b><code>elodg.cfg</b></code> file.
Alternatively, an absolute path can be used if the file name starts with a
<b><code>"/"</code></b> (Unix) or <b><code>"\"</code></b> or <b><code>"x:"</code></b>
(Windows).<br><br>
The following line is an example Welcome Title:<br> The following line is an example Welcome Title:<br>
<br> <br>
<pre>Welcome title = &lt;img src="welcome.jpg"&gt;&lt;p&gt;&lt;font size=5 color=white&gt;Welcome to our Elog&lt;/font&gt;</pre> <pre>Welcome title = &lt;img src="welcome.jpg"&gt;&lt;p&gt;&lt;font size=5 color=white&gt;Welcome to our Elog&lt;/font&gt;</pre>
@ -145,8 +149,12 @@ used by most browsers for bookmark names.
<LI><b><code>Selection page = &lt;file&gt;</code></b> <LI><b><code>Selection page = &lt;file&gt;</code></b>
<br> <br>
When this option is present, a user defined file is displayed instead of the logbook When this option is present, a user defined file is displayed instead of the logbook
selection page. This file must be in the same directory as the <code><b>elogd</b></code> selection page. This file must be in the same directory as the <code><b>elogd.cfg</b></code>
file. It can be completely customized in order to contain logos etc. As a template, file. Alternatively, an absolute path can be used if the file name starts with a
<b><code>"/"</code></b> (Unix) or <b><code>"\"</code></b> or <b><code>"x:"</code></b>
(Windows).<br><br>
It can be completely customized in order to contain logos etc. As a template,
the standard selection page produced by <code><b>elogd</b></code> can be used. the standard selection page produced by <code><b>elogd</b></code> can be used.
<p> <p>
@ -251,6 +259,9 @@ messages of for logbook queries. Here is a simple example of such a file:
</pre> </pre>
The file must be present in the same directory as the <code><b>elogd</b></code> file. The file must be present in the same directory as the <code><b>elogd</b></code> file.
Alternatively, an absolute path can be used if the file name starts with a
<b><code>"/"</code></b> (Unix) or <b><code>"\"</code></b> or <b><code>"x:"</code></b>
(Windows).
<p> <p>
<LI><b><code>Start page = &lt;command&gt;</code></b> <LI><b><code>Start page = &lt;command&gt;</code></b>
@ -279,6 +290,9 @@ Here is an example:
</pre> </pre>
The file must be present in the same directory as the <code><b>elogd</b></code> file. The file must be present in the same directory as the <code><b>elogd</b></code> file.
Alternatively, an absolute path can be used if the file name starts with a
<b><code>"/"</code></b> (Unix) or <b><code>"\"</code></b> or <b><code>"x:"</code></b>
(Windows).
<p> <p>
<li><b><code>Message comment = &lt;comment&gt;</code></b> <li><b><code>Message comment = &lt;comment&gt;</code></b>
@ -371,8 +385,11 @@ example a link back to the main logbook selection page like:
&lt;center&gt;&lt;a href="/"&gt;Main page&lt;/a&gt;&lt;/center&gt; &lt;center&gt;&lt;a href="/"&gt;Main page&lt;/a&gt;&lt;/center&gt;
</pre> </pre>
Or it can contain other useful links. The file must be present in the same directory Or it can contain other useful links. The file must be present in the same directory as the
as the <code><b>elogd</b></code> file. <code><b>elogd.cfg</b></code> file. Alternatively, an absolute path can be used if the file
name starts with a <b><code>"/"</code></b> (Unix) or <b><code>"\"</code></b> or <b><code>
"x:"</code></b> (Windows).
<p> <p>
<li><b><code>Help URL = &lt;URL&gt;</code></b> <li><b><code>Help URL = &lt;URL&gt;</code></b>
@ -491,6 +508,9 @@ down box by default.
<br> <br>
This preset value is used for the main body text. It can be a string or a file, This preset value is used for the main body text. It can be a string or a file,
which must be present in the same directory as the <code><b>elogd.cfg</b></code> file. which must be present in the same directory as the <code><b>elogd.cfg</b></code> file.
Alternatively, an absolute path can be used if the file name starts with a
<b><code>"/"</code></b> (Unix) or <b><code>"\"</code></b> or <b><code>"x:"</code></b>
(Windows).
<p> <p>
<LI><b><code>Locked Attributes = &lt;list&gt;</code></b> <LI><b><code>Locked Attributes = &lt;list&gt;</code></b>

65
elogd.c
View File

@ -6,6 +6,9 @@
Contents: Web server program for Electronic Logbook ELOG Contents: Web server program for Electronic Logbook ELOG
$Log$ $Log$
Revision 2.95 2002/11/06 08:59:18 midas
Files can be specified with absolute path
Revision 2.94 2002/11/05 15:40:58 midas Revision 2.94 2002/11/05 15:40:58 midas
Hide non-allowed commands Hide non-allowed commands
@ -4678,10 +4681,16 @@ time_t now;
if (!message_id && getcfg(lbs->name, "Preset text", str)) if (!message_id && getcfg(lbs->name, "Preset text", str))
{ {
/* check if file */ /* check if file starts with an absolute directory */
strcpy(file_name, cfg_dir); if (str[0] == DIR_SEPARATOR || str[1] == ':')
strcat(file_name, str); strcpy(file_name, str);
else
{
strcpy(file_name, cfg_dir);
strcat(file_name, str);
}
/* check if file exists */
fh = open(file_name, O_RDONLY | O_BINARY); fh = open(file_name, O_RDONLY | O_BINARY);
if (fh > 0) if (fh > 0)
{ {
@ -7671,8 +7680,14 @@ MSG_LIST *msg_list;
FILE *f; FILE *f;
char file_name[256], *buf; char file_name[256], *buf;
strcpy(file_name, cfg_dir); /* check if file starts with an absolute directory */
strcat(file_name, str); if (str[0] == DIR_SEPARATOR || str[1] == ':')
strcpy(file_name, str);
else
{
strcpy(file_name, cfg_dir);
strcat(file_name, str);
}
f = fopen(file_name, "r"); f = fopen(file_name, "r");
if (f != NULL) if (f != NULL)
@ -8048,8 +8063,14 @@ int i, j, n, missing, first, index, n_mail, suppress, message_id, resubmit_or
if (getcfg(lbs->name, "Submit page", str)) if (getcfg(lbs->name, "Submit page", str))
{ {
strcpy(file_name, cfg_dir); /* check if file starts with an absolute directory */
strcat(file_name, str); if (str[0] == DIR_SEPARATOR || str[1] == ':')
strcpy(file_name, str);
else
{
strcpy(file_name, cfg_dir);
strcat(file_name, str);
}
send_file(file_name); send_file(file_name);
return; return;
} }
@ -8992,8 +9013,14 @@ BOOL first;
FILE *f; FILE *f;
char file_name[256], *buf; char file_name[256], *buf;
strcpy(file_name, cfg_dir); /* check if file starts with an absolute directory */
strcat(file_name, str); if (str[0] == DIR_SEPARATOR || str[1] == ':')
strcpy(file_name, str);
else
{
strcpy(file_name, cfg_dir);
strcat(file_name, str);
}
f = fopen(file_name, "r"); f = fopen(file_name, "r");
if (f != NULL) if (f != NULL)
@ -9482,8 +9509,14 @@ FILE *f;
/* check for global selection page if no logbook given */ /* check for global selection page if no logbook given */
if (!logbook[0] && getcfg("global", "Selection page", str)) if (!logbook[0] && getcfg("global", "Selection page", str))
{ {
strcpy(file_name, cfg_dir); /* check if file starts with an absolute directory */
strcat(file_name, str); if (str[0] == DIR_SEPARATOR || str[1] == ':')
strcpy(file_name, str);
else
{
strcpy(file_name, cfg_dir);
strcat(file_name, str);
}
send_file(file_name); send_file(file_name);
return; return;
} }
@ -10096,8 +10129,14 @@ FILE *f;
/* check for welcome page */ /* check for welcome page */
if (!_cmdline[0] && getcfg(lbs->name, "Welcome page", str) && str[0]) if (!_cmdline[0] && getcfg(lbs->name, "Welcome page", str) && str[0])
{ {
strcpy(file_name, cfg_dir); /* check if file starts with an absolute directory */
strcat(file_name, str); if (str[0] == DIR_SEPARATOR || str[1] == ':')
strcpy(file_name, str);
else
{
strcpy(file_name, cfg_dir);
strcat(file_name, str);
}
send_file(file_name); send_file(file_name);
return; return;
} }