From 09bfdf9e7721405a7d4298d6be2159a80dcf05a0 Mon Sep 17 00:00:00 2001 From: Tomasz Sowa Date: Wed, 28 Mar 2012 00:09:27 +0000 Subject: [PATCH] added: two ezc functions: void winix_postvar_value_is(Info & i); void winix_postvar_value_is_not(Info & i); git-svn-id: svn://ttmath.org/publicrep/winix/trunk@824 e52654a7-88a9-db11-a3e9-0013d4bc506e --- templates/templates.cpp | 2 ++ templates/templates.h | 2 ++ templates/winix.cpp | 17 +++++++++++++++++ 3 files changed, 21 insertions(+) diff --git a/templates/templates.cpp b/templates/templates.cpp index f2e3cb7..659374f 100755 --- a/templates/templates.cpp +++ b/templates/templates.cpp @@ -560,6 +560,8 @@ void Templates::CreateFunctions() ezc_functions.Insert("true", winix_true); ezc_functions.Insert("winix_has_postvar", winix_has_postvar); ezc_functions.Insert("winix_postvar", winix_postvar); + ezc_functions.Insert("winix_postvar_value_is", winix_postvar_value_is); + ezc_functions.Insert("winix_postvar_value_is_not", winix_postvar_value_is_not); ezc_functions.Insert("str", str); ezc_functions.Insert("strnc", strnc); diff --git a/templates/templates.h b/templates/templates.h index 5f3c5f4..b4e84c8 100755 --- a/templates/templates.h +++ b/templates/templates.h @@ -478,6 +478,8 @@ namespace TemplatesFunctions void winix_true(Info & i); void winix_has_postvar(Info & i); void winix_postvar(Info & i); + void winix_postvar_value_is(Info & i); + void winix_postvar_value_is_not(Info & i); void str(Info & i); void strnc(Info & i); diff --git a/templates/winix.cpp b/templates/winix.cpp index e5a2c91..f3a782d 100755 --- a/templates/winix.cpp +++ b/templates/winix.cpp @@ -266,6 +266,23 @@ void winix_postvar(Info & i) } +// first parameter is param_name +// second parameter is param_value +void winix_postvar_value_is(Info & i) +{ + if( i.params.size() == 2 ) + i.res = (cur->request->PostVar(i.params[0]) == i.params[1]); +} + + +void winix_postvar_value_is_not(Info & i) +{ + if( i.params.size() == 2 ) + i.res = (cur->request->PostVar(i.params[0]) != i.params[1]); +} + + + // these functions are to be used with [is...] statements void str(Info & i)