Example #1
0
 /**
  * 构造函数
  *
  * @param Application &$app 应用程序类
  */
 function __construct(&$app)
 {
     $this->app = $app;
     //是否为系统管理状态下的访问
     if (defined('SYS') && $_SESSION['admin'] !== true && $_GET['c'] != 'login' && $_GET['c'] != 'code') {
         $smarty = $this->app->page();
         $smarty->params['template'] = $this->app->cfg['smarty']['template_dir'] . '/system/login.tpl';
         $smarty->output();
         unset($_SESSION);
         exit;
     }
     //是否有权限访问
     if (defined('AUTH') && in_array(AUTH, $_SESSION['Auth']) === FALSE && $_GET['c'] != 'login') {
         exit('当前你没有访问权限,请与管理员联系!');
     }
 }
Example #2
0
 /**
  * 统一消息提示
  *
  * @param string $msg
  * @param string $url
  * @param string $pic
  */
 function showMsg($msg, $url = '', $target = '_self', $pic = 'ok.gif')
 {
     $url = empty($url) ? $_SERVER['HTTP_REFERER'] : $url;
     if ($url == '') {
         $url = '/index.php';
     }
     $smarty = $this->app->page();
     $smarty->value('msg', $msg);
     $smarty->value('url', $url);
     $smarty->value('pic', $pic);
     $smarty->value('target', $target);
     $smarty->params['template'] = 'msg.tpl';
     $smarty->output();
     exit;
 }