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 getListResForList() { $model = $this->getModelForList(); $type = Http::getGET('type', 0); $state = Http::getGET('state', 0); $p_id = Http::getGET('p_id', 0); $extra = ''; if ($type) { $extra .= " `type`='{$type}' "; } if ($state) { if (!empty($extra)) { $extra .= ' AND '; } $extra .= " `state`='{$state}' "; } if ($p_id) { if (!empty($extra)) { $extra .= ' AND '; } $extra .= " `p_id`='{$p_id}' "; } if (!empty($extra)) { if (!empty($extra)) { $extra .= ' AND '; } } $extra = ' WHERE ' . $extra . " `deleted`='n' "; $res = $model->getList(array(), $extra); return $res; }
function execute() { $id = Http::getGET('id', 0); if ($id) { $model = new User(); $info = $model->getRowById($id); $this->setRenderValues('info', $info); $this->render('index/user_info.php'); } }
function getListResForList() { $model = $this->getModelForList(); $type = Http::getGET('type', 0); $res = array(); if ($type != 0) { $res = $model->getList(array(), " WHERE `type`='{$type}' AND `deleted`='n'"); } else { $res = $model->getList(); } return $res; }
function execute() { /* if(5 != $_SESSION['_USER_INFO']['type']){ } */ if ($this->isPost) { } else { $id = Http::getGET('id'); $user = new User(); $userInfo = $user->getRowById($id); $this->setRenderValues('postData', $userInfo); $this->addToken(); $this->render('index/user_add.php'); } }
function execute() { $case = Http::getGET('case'); if ('top' == $case) { $this->render('index/frame_top.php'); } else { if ('left' == $case) { $this->render('index/frame_top.php'); } else { if ('footer' == $case) { $this->render('index/frame_top.php'); } else { $this->render('index/frame_top.php'); } } } }