------------------------------------------------------------ revno: 1152 committer: Roger Martin <rg1...@gmail.com> branch nick: aikiframework timestamp: Wed 2012-03-28 19:11:07 +0200 message: correct get and post markup of engine2 modified: libs/Engine_v2.php
-- lp:aikiframework https://code.launchpad.net/~aikiframework-devel/aikiframework/trunk Your team Aiki Framework Developers is subscribed to branch lp:aikiframework. To unsubscribe from this branch go to https://code.launchpad.net/~aikiframework-devel/aikiframework/trunk/+edit-subscription
=== modified file 'libs/Engine_v2.php' --- libs/Engine_v2.php 2012-03-28 15:22:43 +0000 +++ libs/Engine_v2.php 2012-03-28 17:11:07 +0000 @@ -94,6 +94,8 @@ "t" => "parse_t", "nl2p" => "parse_nl2p", "nl2br" => "parse_nl2br", + "get" => "parse_get", + "post" => "parse_post", "repeat" => "parse_repeat", "control" => "parse_controls", "print" => "parse_print", @@ -220,15 +222,43 @@ } - function parse_get( $matchs){ - $token= $matchs[0]; - return $token && isset($_GET[ $token]) ? $_GET[$token] : ""; - } - - function parse_post( $matchs){ - $token= $matchs[0]; - return $token && isset($_POST[$token]) ? $_POST[$token] : ""; - } + function parse_get( $arg, $trueblock, $elseblock){ + return $this->_parse_get ( $arg, true ); + } + + function parse_post( $arg, $trueblock, $elseblock){ + return $this->_parse_get ( $arg, false ); + } + + + private function _parse_get_encode($key, $get,$mode){ + if ( $get) { + $value = ( isset($_GET[$key]) ? $_GET[$key]: NULL); + } else { + $value = ( isset($_POST[$key]) ? $_POST[$key]: NULL); + } + + if ( is_null($value) ){ + return ""; + } + + switch ( strtolower($mode) ){ + case "raw": return $value; + case "urlencode": return urlencode($value); + case "querystring": return $arg[0]."=" .urlencode($value); + default: return strip_tags($value); + } + } + + private function _parse_get( &$arg, $get){ + $nArg= count($arg); + if ( !$nArg ) { + return ""; + } + return $this->_parse_get_encode($arg[0],$get,($nArg==1 ? "clean": $arg[1])); + } + + /*
_______________________________________________ Mailing list: https://launchpad.net/~aikiframework-devel Post to : aikiframework-devel@lists.launchpad.net Unsubscribe : https://launchpad.net/~aikiframework-devel More help : https://help.launchpad.net/ListHelp