function pagerights($inPath) { $url = $this->getUrlParams($inPath); $groupObj = new m_group(); $gid = (int) $url['gid']; $this->params['gid'] = $gid; if (!$gid) { $this->params['group'] = $groupObj->select()->items; return $this->render('system/rights.html', $this->params); } else { if (!$_POST) { if ($gid) { $this->params['rights'] = $groupObj->selectOne("gid = {$gid}"); $this->params['action'] = unserialize($this->params['rights']['action_code']); return $this->render('system/rightsshow.html', $this->params); } $this->ShowMsg("用户组不存在!"); } else { $action_code = $this->creatRights($_POST); $groupObj->update("gid = {$gid}", "action_code = '{$action_code}'"); $cacheName = "action_code_group_" . $gid; $cache = SCache::getCacheEngine('file'); $cache->init(array("dir" => SlightPHP::$appDir . "/cache", "depth" => 3)); $rs = $cache->del($cacheName); $this->ShowMsg("编辑成功!", $this->createUrl('/system/rights'), '', 1); } } }
function pageaddaccount($inPath) { if ($_POST) { $adminObj = new m_admin(); $post = base_Utils::shtmlspecialchars($_POST); $item = array(); $item["admin_name"] = $post['admin_name']; $item["admin_pwd"] = md5($post['pwd']); $item["gid"] = (int) $post['group']; foreach ($item as $k => $v) { if (!$v) { $this->ShowMsg("字段:{$k}不能够为空"); } } if ($adminObj->insert($item)) { $this->ShowMsg('添加成功', $this->createUrl('/account/index'), '', '1'); } $this->ShowMsg('添加出错!原因:' . $adminObj->getError()); } $groupObj = new m_group(); $this->params['group'] = $groupObj->select()->items; return $this->render('account/addaccount.html', $this->params); }