final function __construct() { $this->view = new PhpEngine(); //用htmlspecialchars('',ENT_QUOTES) 处理参数(get和post的) $filterFunc = function ($s) { if (is_string($s)) { return htmlspecialchars($s, ENT_QUOTES); } else { return $s; } }; if ('POST' == $_SERVER['REQUEST_METHOD']) { $this->isPost = true; $this->posts = array_map($filterFunc, $_POST); $this->verifyToken(Http::getPOST('_token')); } else { if ('GET' == $_SERVER['REQUEST_METHOD']) { $this->isGet = true; $this->gets = array_map($filterFunc, $_GET); $this->addToken(); } else { $this->isGet = false; $this->isPost = false; } } $controllerName = Http::getGET('c'); $actionName = Http::getGET('a'); $this->setRenderValues('controllerName', $controllerName); $this->setRenderValues('actionName', $actionName); $this->setRenderValues('errMsg', array()); $this->init(); }
function getConditionsForDeleted() { $id = intval(Http::getPOST('id', 0)); if ($id <= 0) { $this->responseMsg(1, 'Wrong Argument!'); } $conditions = array(array('field' => 'id', 'sign' => '=', 'value' => $id)); return $conditions; }
private function validatePassword() { $username = Http::getPOST('username'); $password = md5(Http::getPOST('password')); $user = new User(); if (!$user->validatePassword($username, $password)) { Http::redirect(GAPP_PASSWORD_VERIFY_FAILED); } }