diff --git a/src/elogd.c b/src/elogd.c
index 69bc5de4..c9d83837 100755
--- a/src/elogd.c
+++ b/src/elogd.c
@@ -3905,7 +3905,7 @@ int el_index_logbooks()
lb_list[n].el_index = NULL;
if (verbose)
- eprintf("Indexing logbook \"%s\" ... ", logbook);
+ eprintf("Indexing logbook \"%s\" in \"%s\" ... ", logbook, lb_list[n].data_dir);
eflush();
status = el_build_index(&lb_list[n], FALSE);
if (verbose)
@@ -5206,6 +5206,48 @@ int is_html(char *s)
/*------------------------------------------------------------------*/
+char *full_html_tags[] = { "", "
", "", "" };
+
+int is_full_html(char *file_name)
+{
+ char *str, *p;
+ int i, fh, length;
+ unsigned char *buf;
+
+ fh = open(file_name, O_RDONLY | O_BINARY);
+ if (fh < 0)
+ return FALSE;
+ lseek(fh, 0, SEEK_END);
+ length = TELL(fh);
+ lseek(fh, 0, SEEK_SET);
+ if (length > 1000)
+ length = 1000;
+ buf = xmalloc(length);
+ read(fh, buf, length);
+ close(fh);
+
+ str = xstrdup(buf);
+
+ for (i = 0; i < (int) strlen(buf); i++)
+ str[i] = toupper(buf[i]);
+ str[i] = 0;
+
+ xfree(buf);
+
+ for (i = 0; full_html_tags[i][0]; i++) {
+ p = strstr(str, full_html_tags[i]);
+ if (p && strchr(p, '>') && (p == str || (p > str && *(p - 1) != '\\'))) {
+ xfree(str);
+ return TRUE;
+ }
+ }
+
+ xfree(str);
+ return FALSE;
+}
+
+/*------------------------------------------------------------------*/
+
int is_ascii(char *file_name)
{
int i, fh, length;
@@ -7126,7 +7168,7 @@ void add_logbook_to_group(LOGBOOK * lbs, char *new_name)
void show_standard_title(char *logbook, char *text, int printable)
{
- char str[256], ref[256], sclass[32], comment[256];
+ char str[256], ref[256], sclass[32], comment[256], url[256];
int i, j, level;
LBLIST phier, pnode, pnext, flb;
@@ -7150,12 +7192,20 @@ void show_standard_title(char *logbook, char *text, int printable)
rsprintf("| \n");
if (level == 0 && getcfg("global", "main tab", str, sizeof(str))
- && !getcfg_topgroup())
- rsprintf("%s\n", str);
+ && !getcfg_topgroup()) {
+ if (getcfg("global", "main tab url", url, sizeof(url)))
+ rsprintf("%s\n", url, str);
+ else
+ rsprintf("%s\n", str);
+ }
if (level == 1 && getcfg("global", "main tab", str, sizeof(str))
- && getcfg_topgroup())
- rsprintf("%s\n", getcfg_topgroup(), str);
+ && getcfg_topgroup()) {
+ if (getcfg("global", "main tab url", url, sizeof(url)))
+ rsprintf("%s\n", url, str);
+ else
+ rsprintf("%s\n", getcfg_topgroup(), str);
+ }
/* iterate through members of this group */
for (i = 0; i < pnode->n_members; i++) {
@@ -8393,18 +8443,19 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
BOOL bduplicate, BOOL bpreview)
{
int i, j, n, index, aindex, size, width, height, fh, length, input_size, input_maxlen,
- format_flags[MAX_N_ATTR], year, month, day, hour, min, sec, n_attr, n_disp_attr,
- attr_index[MAX_N_ATTR], enc_selected, show_smileys, show_text, n_moptions;
+ format_flags[MAX_N_ATTR], year, month, day, hour, min, sec, n_attr, n_disp_attr, n_lines,
+ attr_index[MAX_N_ATTR], enc_selected, show_smileys, show_text, n_moptions, display_inline;
char str[2 * NAME_LENGTH], preset[2 * NAME_LENGTH], *p, *pend, star[80], comment[10000], reply_string[256],
list[MAX_N_ATTR][NAME_LENGTH], file_name[256], *buffer, format[256], date[80], script[256],
attrib[MAX_N_ATTR][NAME_LENGTH], *text, orig_tag[80], reply_tag[MAX_REPLY_TO * 10],
att[MAX_ATTACHMENTS][256], encoding[80], slist[MAX_N_ATTR + 10][NAME_LENGTH],
svalue[MAX_N_ATTR + 10][NAME_LENGTH], owner[256], locked_by[256], class_value[80], class_name[80],
ua[NAME_LENGTH], mid[80], title[256], login_name[256], cookie[256], orig_author[256],
- attr_moptions[MAX_N_LIST][NAME_LENGTH];
+ attr_moptions[MAX_N_LIST][NAME_LENGTH], ref[256], file_enc[256];
time_t now, ltime;
char fl[8][NAME_LENGTH];
struct tm *pts;
+ FILE *f;
BOOL preset_text, subtable;
for (i = 0; i < MAX_ATTACHMENTS; i++)
@@ -8419,6 +8470,17 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
encoding[0] = 0;
date[0] = 0;
+ /* check for file attachment (mhttpd) */
+ if (isparam("fa")) {
+ strlcpy(att[0], getparam("fa"), 256);
+
+ /* remove any leading directory, to accept only files in the logbook directory ! */
+ if (strchr(att[0], DIR_SEPARATOR)) {
+ strlcpy(str, att[0], sizeof(str));
+ strlcpy(att[0], strrchr(str, DIR_SEPARATOR)+1, 256);
+ }
+ }
+
if (breedit || bupload) {
/* get date from parameter */
if (isparam("entry_date"))
@@ -9976,19 +10038,81 @@ void show_edit_form(LOGBOOK * lbs, int message_id, BOOL breply, BOOL bedit, BOOL
if (!getcfg(lbs->name, "Enable attachments", str, sizeof(str))
|| atoi(str) > 0) {
- i = 0;
- if (bedit || bduplicate) {
+ if (bedit || bduplicate || isparam("fa")) {
/* show existing attachments */
- for (i = 0; i < MAX_ATTACHMENTS; i++)
- if (att[i][0]) {
- rsprintf(" |