diff --git a/functions/functions.cpp b/functions/functions.cpp index 8a40d47..5dc636c 100755 --- a/functions/functions.cpp +++ b/functions/functions.cpp @@ -148,10 +148,15 @@ void Functions::SetObjects(FunctionBase * fun) void Functions::Add(FunctionBase * fun) { + if( fun->fun.url.empty() ) + { + log << log1 << "Functions: skipping a function with an empty url" << logend; + return; + } + if( Find(fun->fun.url) ) { - log << log1 << "Functions: function " << fun->fun.url - << " already exists (skipped)" << logend; + log << log1 << "Functions: function " << fun->fun.url << " already exists (skipped)" << logend; return; } diff --git a/templates/man.cpp b/templates/man.cpp index 2e0f67e..8d05c59 100755 --- a/templates/man.cpp +++ b/templates/man.cpp @@ -17,19 +17,33 @@ namespace TemplatesFunctions { static Functions::Iterator winixfun_iter; -static bool winixfun_iter_valid = false; +static size_t winixfun_curreq = 0; + + + +bool man_winixfun_tabcheck() +{ + if( winixfun_curreq != cur->request->id ) + { + winixfun_curreq = cur->request->id; + winixfun_iter = functions->Begin(); + } + +return winixfun_iter != functions->End(); +} void man_winixfun_tab(Info & i) { + man_winixfun_tabcheck(); + if( i.iter == 0 ) winixfun_iter = functions->Begin(); else if( winixfun_iter != functions->End() ) ++winixfun_iter; - - i.res = (winixfun_iter != functions->End()); - winixfun_iter_valid = i.res; + + i.res = winixfun_iter != functions->End(); } @@ -41,27 +55,41 @@ void man_winixfun_tab_index(Info & i) void man_winixfun_tab_name(Info & i) { - if( winixfun_iter_valid ) + if( man_winixfun_tabcheck() ) i.out << winixfun_iter->first; } -static EzcFun::Iterator ezcfun_iter; -static bool ezcfun_valid = false; +static EzcFun::Iterator ezcfun_iter; +static size_t ezcfun_curreq = 0; + + +bool man_ezcfun_tabcheck() +{ + if( ezcfun_curreq != cur->request->id ) + { + ezcfun_curreq = cur->request->id; + ezcfun_iter = ezc_functions.Begin(); + } + +return ezcfun_iter != ezc_functions.End(); +} + void man_ezcfun_tab(Info & i) { + man_ezcfun_tabcheck(); + if( i.iter == 0 ) ezcfun_iter = ezc_functions.Begin(); else if( ezcfun_iter != ezc_functions.End() ) ++ezcfun_iter; - i.res = (ezcfun_iter != ezc_functions.End()); - ezcfun_valid = i.res; + i.res = ezcfun_iter != ezc_functions.End(); } @@ -73,7 +101,7 @@ void man_ezcfun_tab_index(Info & i) void man_ezcfun_tab_name(Info & i) { - if( ezcfun_valid ) + if( man_ezcfun_tabcheck() ) i.out << ezcfun_iter->first; }