X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=webcit%2Fsubst.c;h=f1a01cf55807ce286e726afdbe55b60223d5e3bd;hb=8c2d12e026dd60a3fa22112e739880b402f2b3f4;hp=9a0be445f4f495be998a9a105fc09bb801fbcfb8;hpb=8f51718ae84400812262403e4065ff4e1a6d5f0b;p=citadel.git diff --git a/webcit/subst.c b/webcit/subst.c index 9a0be445f..f1a01cf55 100644 --- a/webcit/subst.c +++ b/webcit/subst.c @@ -71,7 +71,7 @@ typedef struct _HashHandler { WCHandlerFunc HandlerFunc; }HashHandler; -void *load_template(WCTemplate *NewTemplate); +void *load_template(StrBuf *Target, WCTemplate *NewTemplate); int EvaluateConditional(StrBuf *Target, int Neg, int state, WCTemplputParams *TP); @@ -758,8 +758,10 @@ int GetNextParameter(StrBuf *Buf, else { StrBufPeek(Buf, pch, -1, '\0'); if (LoadTemplates > 1) { - syslog(1, "DBG: got param [%s] %ld %ld\n", - pchs, pche - pchs, strlen(pchs)); + syslog(1, + "DBG: got param [%s] %d %d\n", + pchs, pche - pchs, strlen(pchs) + ); } Parm->Start = pchs; Parm->len = pche - pchs; @@ -1194,7 +1196,7 @@ void *duplicate_template(WCTemplate *OldTemplate) } -void SanityCheckTemplate(WCTemplate *CheckMe) +void SanityCheckTemplate(StrBuf *Target, WCTemplate *CheckMe) { int i = 0; int j; @@ -1224,10 +1226,17 @@ void SanityCheckTemplate(WCTemplate *CheckMe) } if (!FoundConditionalEnd) { - syslog(1, "ERROR: Conditional without Endconditional: '%s'\n", - ChrPtr(CheckMe->Tokens[i]->FlatToken)); + WCTemplputParams TP; + memset(&TP, 0, sizeof(WCTemplputParams)); + TP.Tokens = CheckMe->Tokens[i]; + LogTemplateError( + Target, "Token", ERR_PARM1, &TP, + "Conditional without Endconditional" + ); } break; + default: + break; } } } @@ -1236,7 +1245,7 @@ void SanityCheckTemplate(WCTemplate *CheckMe) * \brief Display a variable-substituted template * \param templatename template file to load */ -void *load_template(WCTemplate *NewTemplate) +void *load_template(StrBuf *Target, WCTemplate *NewTemplate) { int fd; struct stat statbuf; @@ -1322,7 +1331,7 @@ void *load_template(WCTemplate *NewTemplate) } } - SanityCheckTemplate(NewTemplate); + SanityCheckTemplate(NULL, NewTemplate); return NewTemplate; } @@ -1521,7 +1530,7 @@ void InitTemplateCache(void) &vTemplate) && (vTemplate != NULL)) { - load_template((WCTemplate *)vTemplate); + load_template(NULL, (WCTemplate *)vTemplate); } DeleteHashPos(&At); } @@ -1640,7 +1649,7 @@ const StrBuf *ProcessTemplate(WCTemplate *Tmpl, StrBuf *Target, WCTemplputParams syslog(1, "DBG: ----- loading: [%s] ------ \n", ChrPtr(Tmpl->FileName)); pTmpl = duplicate_template(Tmpl); - if(load_template(pTmpl) == NULL) { + if(load_template(Target, pTmpl) == NULL) { StrBufAppendPrintf( Target, "
\nError loading Template [%s]\n See Logfile for details\n
\n",