char EscapeAs = ' ';
if ((FormatTypeIndex < TP->Tokens->nParameters) &&
+ (TP->Tokens->Params[FormatTypeIndex] != NULL) &&
(TP->Tokens->Params[FormatTypeIndex]->Type == TYPE_STR) &&
(TP->Tokens->Params[FormatTypeIndex]->len >= 1)) {
pFmt = TP->Tokens->Params[FormatTypeIndex]->Start;
break;
case 'J':
StrECMAEscAppend(Target, Source, NULL);
- break;
+ break;
case 'K':
StrHtmlEcmaEscAppend(Target, Source, NULL, 0, 0);
- break;
+ break;
case 'U':
StrBufUrlescAppend(Target, Source, NULL);
break;
char *MinorPtr;
#ifdef _DIRENT_HAVE_D_NAMLEN
- d_namelen = filedir_entry->d_namelen;
-
+ d_namelen = filedir_entry->d_namlen;
#else
d_namelen = strlen(filedir_entry->d_name);
#endif
}
+
+StrBuf *textPlainType;
/**
* \brief Display a variable-substituted template
* \param templatename template file to load
{
syslog(LOG_WARNING, "Can't to load a template with empty name!\n");
StrBufAppendPrintf(Target, "<pre>\nCan't to load a template with empty name!\n</pre>");
- 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, "<pre>\ndidn't find Template [%s] %ld %ld\n</pre>",
- 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);
}
RetrieveHashlistFunc GetHash;
HashDestructorFunc Destructor;
SubTemplFunc DoSubTemplate;
+ FilterByParamFunc Filter;
} HashIterator;
void RegisterITERATOR(const char *Name, long len,
RetrieveHashlistFunc GetHash,
SubTemplFunc DoSubTempl,
HashDestructorFunc Destructor,
+ FilterByParamFunc Filter,
CtxType ContextType,
CtxType XPectContextType,
int Flags)
It->GetHash = GetHash;
It->DoSubTemplate = DoSubTempl;
It->Destructor = Destructor;
+ It->Filter = Filter;
It->ContextType = ContextType;
It->XPectContextType = XPectContextType;
It->Flags = Flags;
}
while (GetNextHashPos(List, it, &Status.KeyLen, &Status.Key, &vContext)) {
if ((Status.n >= StartAt) && (Status.n <= StopAt)) {
+
+ if ((It->Filter != NULL) &&
+ !It->Filter(Status.Key, Status.KeyLen, vContext, Target, TP))
+ {
+ continue;
+ }
+
if (DetectGroupChange && Status.n > 0) {
Status.GroupChange = SortBy->GroupChange(vContext, vLastContext);
}
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);
ServerShutdownModule_SUBST
(void)
{
+ FreeStrBuf(&textPlainType);
+
DeleteHash(&TemplateCache);
DeleteHash(&LocalTemplateCache);
-
+
DeleteHash(&GlobalNS);
DeleteHash(&Iterators);
DeleteHash(&Conditionals);