. * * @copyright Copyright 2009-2010 Chunsheng Wang * @author Chunsheng Wang * @package common * @version $Id$ * @link http://www.zentao.cn */ class common extends control { /** * 构造函数:启动会话,加载公司模块,并设置公司信息。 * * @access public * @return void */ public function __construct() { parent::__construct(); session_start(); $this->sendHeader(); $this->loadModel('company'); $this->setCompany(); $this->setUser(); } /** * 检查用户对当前的请求有没有权限。如果没有权限,则跳转到登陆界面。 * * @access public * @return void */ public function checkPriv() { $module = $this->app->getModuleName(); $method = $this->app->getMethodName(); if($module == 'user') { if($method == 'login' or $method == 'logout' or $method == 'deny') return true; } elseif($module == 'api' and $method == 'getsessionid') { return true; } if(isset($this->app->user)) { if(!common::hasPriv($module, $method)) { $vars = "module=$module&method=$method"; if(isset($_SERVER['HTTP_REFERER'])) { $referer = helper::safe64Encode($_SERVER['HTTP_REFERER']); $vars .= "&referer=$referer"; } $denyLink = $this->createLink('user', 'deny', $vars); /* Fix the bug of IE: use js locate, can't get the referer. */ if(strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false) { echo <<