/** * 跳转方法 * * @param $url */ public static function redirect($url = '') { $userInfo = Sp_Admin_User::getUser(); $adminUserModel = new Sp_Admin_User(); $default = $adminUserModel->adminuser_getAdminDefault($userInfo['id']); if ($url) { header("HTTP/1.1 301 Moved Permanently"); header("Location: /" . $url); exit; } if (is_array($default) && count($default) > 0) { header("HTTP/1.1 301 Moved Permanently"); header("Location: /" . $default['url']); exit; } header("HTTP/1.1 301 Moved Permanently"); header("Location: /" . self::defaultUrl); exit; }
function __construct() { parent::__construct(); $tpl_dir = isset($_SERVER["DOCUMENT_ROOT"]) ? $_SERVER["DOCUMENT_ROOT"] . '/templates/' : ''; if (!empty($tpl_dir) && is_dir($tpl_dir)) { $this->template_dir = $tpl_dir; } $this->assign('tpl_header', $this->template_dir . 'header.html'); $this->assign('tpl_footer', $this->template_dir . 'footer.html'); $this->assign('user', Sp_Admin_User::getUser()); $request = Request::current(); $this->assign('ancient_browser', preg_match("#MSIE [1-8]\\.#", $request->getAgent())); }
public function __construct() { if (Sp_Admin_User::isLogin() === FALSE) { header("Location: " . SP_URL_CDGN . "login/index.html"); exit; } $userArr = Sp_Admin_User::getUser(); $user_id = $userArr['id']; //单点登录验证 $session_id = $_COOKIE['session_id']; $cache = Cache_Memcache::getInstance(); $SSO_memcache_key = 'SSO_admin_user_' . $user_id; $SSO_memcache_data = $cache->get($SSO_memcache_key); if ($session_id != $SSO_memcache_data && !empty($SSO_memcache_data) && $user_id != 1) { echo "<script type='text/javascript'>"; echo "alert('您的账号在其他地方登录,已被踢下线!');"; echo "location.href = '" . SP_URL_DESK . "login/signout.html'"; echo "</script>"; exit; } $spAdminUser = new Sp_Admin_User(); $userInfo = $spAdminUser->adminuser_getUserAndRole($user_id, DATA_TYPE); if ($userInfo['groupid'] > 0 && $userInfo['cdgn_del'] >= 0 || $userInfo['groupid'] == 1) { define('CDGN_GROUP', '1'); } if ($userInfo['custom_groupid'] > 0 && $userInfo['custom_del'] >= 0 || $userInfo['groupid'] == 1) { define('CUSTOM_GROUP', '1'); } if ($userInfo['ad_groupid'] > 0 && $userInfo['ad_del'] >= 0 || $userInfo['groupid'] == 1) { define('AD_GROUP', '1'); } if ($userInfo['cs_groupid'] > 0 && $userInfo['cs_del'] >= 0 || $userInfo['groupid'] == 1) { define('CS_GROUP', '1'); } if ($userInfo['groupid'] == 1) { define('CS_SYSTEM', '1'); } if ($userInfo[STATUS_DEL] != 0) { echo "<script type='text/javascript'>"; echo "alert('您在该管理系统没有权限,或者是被移除!')"; echo "</script>"; exit; } if ($userInfo['groupid'] == 1) { $this->_isAdmin = TRUE; } if ($userInfo['groupid'] != 1) { $spAdminRole = new Sp_Admin_Role(); $spGroupInfo = $spAdminRole->adminuser_getGroupRole($userInfo[GROUP_NAME]); $spAdminGroupRole = is_array($spGroupInfo['rolelist']) && count($spGroupInfo['rolelist']) > 0 ? $spGroupInfo['rolelist'] : array(); $spUserRole = is_array($userInfo['rolelist']) && count($userInfo['rolelist']) > 0 ? $userInfo['rolelist'] : array(); $spRoleList = array_merge($spAdminGroupRole, $spUserRole); $this->_roleList = $spRoleList; $spFormatRoleList = array(); foreach ($spRoleList as $val) { $spFormatRoleList[] = $val['m'] . DIRECTORY_SEPARATOR . $val['c']; } $requestUriArr = str_replace("/custom", "", $_SERVER['REQUEST_URI']); $requestUriArr = explode('.', $requestUriArr); $userPath = str_replace('/', DIRECTORY_SEPARATOR, ltrim(ltrim($requestUriArr[0], '/'), '\\')); $userPath = str_replace('\\', DIRECTORY_SEPARATOR, $userPath); $checkList = explode(DIRECTORY_SEPARATOR, $userPath); if ($userPath != '' && !in_array($userPath, $spFormatRoleList) && !Sp_Admin_Menu::checkWhiteList($checkList[0], $checkList[1])) { echo "<script type='text/javascript'>"; echo "alert('您没有获得该权限!');"; echo "location.href = '" . SP_URL_DESK . "';"; echo "</script>"; exit; } } }
/** * 发送邮件添加邮件记录 * @param $condition */ public function sendEmailAndInsertSmsReport($condition) { $spAdminUser = new Sp_Admin_User(); $spAdminUser->adminuser_insertSmsReport($condition); $this->sendEmail($condition); }