diff --git a/module/common/control.php b/module/common/control.php index b65f2b75c9..422e55e192 100644 --- a/module/common/control.php +++ b/module/common/control.php @@ -299,13 +299,16 @@ EOT; { if(isset($_SESSION['company']) and $_SESSION['company']->pms == $_SERVER['HTTP_HOST']) { - $this->app->setSessionCompany($_SESSION['company']); + $this->app->company = $_SESSION['company']; + } + else + { + $company = $this->company->getByDomain(); + if(!$company) $company = $this->company->getByDomain($this->config->default->domain); + if(!$company) $this->app->error(sprintf($this->lang->error->companyNotFound, $_SERVER['HTTP_HOST']), __FILE__, __LINE__, $exit = true); + $_SESSION['company'] = $company; + $this->app->company = $company; } - $company = $this->company->getByDomain(); - if(!$company) $company = $this->company->getByDomain($this->config->default->domain); - if(!$company) $this->app->error(sprintf($this->lang->error->companyNotFound, $_SERVER['HTTP_HOST']), __FILE__, __LINE__, $exit = true); - $_SESSION['company'] = $company; - $this->app->setSessionCompany($company); } /** @@ -318,17 +321,16 @@ EOT; { if(isset($_SESSION['user'])) { - $this->app->setSessionUser($_SESSION['user']); + $this->app->user = $_SESSION['user']; } elseif($this->app->company->guest) { - $user = new stdClass(); - $user->account = 'guest'; - $user->realname = 'guest'; - $this->loadModel('user'); - $user->rights = $this->user->authorize('guest'); + $user = new stdClass(); + $user->account = 'guest'; + $user->realname = 'guest'; + $user->rights = $this->loadModel('user')->authorize('guest'); $_SESSION['user'] = $user; - $this->app->setSessionUser($_SESSION['user']); + $this->app->user = $_SESSION['user']; } } diff --git a/module/user/control.php b/module/user/control.php index 33a6c0533f..51f099eefd 100644 --- a/module/user/control.php +++ b/module/user/control.php @@ -280,7 +280,7 @@ class user extends control { $user->rights = $this->user->authorize($_POST['account']); $_SESSION['user'] = $user; - $this->app->setSessionUser($user); + $this->app->user = $_SESSION['user']; /* POST变量中设置了referer信息,且非user/login.html, 非user/deny.html,并且包含当前系统的域名。*/ if(isset($_POST['referer']) and diff --git a/www/index.php b/www/index.php index 9e20d310c6..298842d3d2 100644 --- a/www/index.php +++ b/www/index.php @@ -31,10 +31,9 @@ include '../../../framework/router.class.php'; include '../../../framework/control.class.php'; include '../../../framework/model.class.php'; include '../../../framework/helper.class.php'; -include './myrouter.class.php'; /* 实例化路由对象,加载配置,连接到数据库。*/ -$app = router::createApp('pms', '', 'myRouter'); +$app = router::createApp('pms'); $config = $app->loadConfig('common'); /* 检查是否已经安装。*/ diff --git a/www/myrouter.class.php b/www/myrouter.class.php deleted file mode 100644 index 7100a6cada..0000000000 --- a/www/myrouter.class.php +++ /dev/null @@ -1,45 +0,0 @@ -. - * - * @copyright Copyright: 2009 Chunsheng Wang - * @author Chunsheng Wang - * @package ZenTaoMS - * @version $Id$ - * @link http://www.zentao.cn - */ -/** - * 浠巖outer绫讳腑缁ф壙锛屽鍔犱簡鑻ュ共鍜宲ms搴旂敤鐩稿叧鐨勬柟娉曘 - * - * @package ZenTaoMS - */ -class myRouter extends router -{ - private $configCached = false; - private $langCached = false; - - /* 璁剧疆浼氳瘽鏈熼棿鐨刢ompany淇℃伅銆*/ - public function setSessionCompany($company) - { - $this->company = $company; - } - - /* 璁剧疆浼氳瘽鏈熼棿鐨勭敤鎴蜂俊鎭*/ - public function setSessionUser($user) - { - $this->user = $user; - } -}