From: Wilfried Goesgens Date: Sun, 11 Oct 2015 11:57:27 +0000 (+0200) Subject: Merge branch 'master' of ssh://git.citadel.org/appl/gitroot/citadel X-Git-Tag: Release_902~156 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=7c94d5bb68f1c448770d31205ec5ae12bd8a02ed;hp=-c Merge branch 'master' of ssh://git.citadel.org/appl/gitroot/citadel --- 7c94d5bb68f1c448770d31205ec5ae12bd8a02ed diff --combined webcit/subst.c index fd72242b2,7964ab4c2..688299b23 --- a/webcit/subst.c +++ b/webcit/subst.c @@@ -1907,6 -1907,8 +1907,8 @@@ const StrBuf *ProcessTemplate(WCTemplat } + + StrBuf *textPlainType; /** * \brief Display a variable-substituted template * \param templatename template file to load @@@ -1933,23 -1935,28 +1935,28 @@@ const StrBuf *DoTemplate(const char *te { syslog(LOG_WARNING, "Can't to load a template with empty name!\n"); StrBufAppendPrintf(Target, "
\nCan't to load a template with empty name!\n
"); - return NULL; + return textPlainType; } if (!GetHash(StaticLocal, templatename, len, &vTmpl) && !GetHash(Static, templatename, len, &vTmpl)) { - syslog(LOG_WARNING, "didn't find Template [%s] %ld %ld\n", templatename, len , (long)strlen(templatename)); + StrBuf *escapedString = NewStrBufPlain(NULL, len); + + StrHtmlEcmaEscAppend(escapedString, NULL, templatename, 1, 1); + syslog(LOG_WARNING, "didn't find Template [%s] %ld %ld\n", ChrPtr(escapedString), len , (long)strlen(templatename)); StrBufAppendPrintf(Target, "
\ndidn't find Template [%s] %ld %ld\n
", - templatename, len, + ChrPtr(escapedString), len, (long)strlen(templatename)); + WC->isFailure = 1; #if 0 dbg_PrintHash(Static, PrintTemplate, NULL); PrintHash(Static, VarPrintTransition, PrintTemplate); #endif - return NULL; + FreeStrBuf(&escapedString); + return textPlainType; } if (vTmpl == NULL) - return NULL; + return textPlainType; return ProcessTemplate(vTmpl, Target, TP); } @@@ -2163,7 -2170,7 +2170,7 @@@ void tmpl_iterate_subtmpl(StrBuf *Targe if ((Status.n >= StartAt) && (Status.n <= StopAt)) { if ((It->Filter != NULL) && - It->Filter(Status.Key, Status.KeyLen, vContext, Target, TP)) + !It->Filter(Status.Key, Status.KeyLen, vContext, Target, TP)) { continue; } @@@ -2988,9 -2995,9 +2995,9 @@@ voi ServerStartModule_SUBST (void) { + textPlainType = NewStrBufPlain(HKEY("text/plain")); LocalTemplateCache = NewHash(1, NULL); TemplateCache = NewHash(1, NULL); - GlobalNS = NewHash(1, NULL); Iterators = NewHash(1, NULL); Conditionals = NewHash(1, NULL); @@@ -3016,9 -3023,11 +3023,11 @@@ voi ServerShutdownModule_SUBST (void) { + FreeStrBuf(&textPlainType); + DeleteHash(&TemplateCache); DeleteHash(&LocalTemplateCache); - + DeleteHash(&GlobalNS); DeleteHash(&Iterators); DeleteHash(&Conditionals);