コード例 #1
0
ファイル: __auth.php プロジェクト: lianren/doophp.cms
 public function beforeRun($resource, $action)
 {
     $this->dir = ADMIN_ROOT . '/moban/';
     $this->img = '/' . ADMIN_ROOT . '/static/';
     $session = Doo::session('Lua');
     $auth = $session->get('auth');
     if (empty($auth)) {
         $sets = Doo::cache('php')->get('loginset');
         if ($sets && $sets['cardit'] == 1) {
             $xxxx = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J');
             $nums = range(1, 9);
             shuffle($xxxx);
             shuffle($nums);
             $aaaa = $xxxx[0] . $nums[0];
             $bbbb = $xxxx[1] . $nums[1];
             $session->cardcode = $aaaa . '@' . $bbbb;
         }
         include Lua::display('login', $this->dir);
         exit;
     }
     $auth = empty($auth) ? array(0, '') : Lua::clean(explode("\t", Lua::authcode($auth, 'DECODE')), 1);
     $user = Lua::get_one("select * from lua_admin where uid='" . intval($auth[0]) . "' and password='******' and gid='1'");
     if (empty($user) || $user && $this->clientIP() != $user['loginip']) {
         $session->auth = '';
         Lua::admin_msg('操作提示', '请先登录', '/' . ADMIN_ROOT);
     }
     $rs = $this->acl()->process($user['perm'], $resource, $action);
     if ($rs) {
         return $rs;
     }
     $this->user = $user;
     $this->page = Lua::get_post('p') ? intval(Lua::get_post('p')) : 1;
     // 图片识别码, 借鉴自 supesite
     define('FILE_HASH', substr(md5($user['uid'] . '/' . time() . Lua::random(6)), 8, 16));
 }
コード例 #2
0
ファイル: __home.php プロジェクト: lianren/doophp.cms
 public function index()
 {
     if ($this->user['perm'] != SUPER_MAN && SYSNAME != $this->user['channel']) {
         header("Location:/" . $this->user['channel'] . '/admin/');
         exit;
     }
     $list = Lua::get_more("select * from lua_channel where status='1'");
     $cssname = 'nav_list';
     if (SYSNAME != ADMIN_ROOT) {
         $session = Doo::session('Lua');
         $change_id = $session->get('change_id');
         $set = Lua::get('set');
         if ($set) {
             $session->change_id = empty($change_id) || $change_id == 0 ? 1 : 0;
             header("Location:/" . SYSNAME . "/" . ADMIN_ROOT . "/");
             exit;
         }
         $set_id = $change_id || $change_id == 1 ? 1 : 0;
         if ($set_id == 0) {
             Doo::cache('php')->hashing = false;
             $tree = Doo::cache('php')->get('category');
             $cssname = 'tree_list';
             $html = '';
             if ($tree) {
                 $html = $this->_tree($tree, 0);
             }
         }
     }
     include Lua::display('frame', $this->dir);
 }
コード例 #3
0
ファイル: __login.php プロジェクト: lianren/doophp.cms
 public function logout()
 {
     $session = Doo::session('Lua');
     $auth = $session->get('auth');
     $auth = empty($auth) ? array(0, '') : Lua::clean(explode("\t", Lua::authcode($auth, 'DECODE')), 1);
     $user = Lua::get_one("select * from lua_admin where uid='" . intval($auth[0]) . "' and password='******' and gid='1'");
     if ($user) {
         Lua::write_log($user, '退出系统', '---', $user['channel']);
     }
     $session->auth = '';
     Lua::admin_msg('操作提示', '成功退出系统', '/' . ADMIN_ROOT);
 }
コード例 #4
0
ファイル: DooAuth.php プロジェクト: no2key/DooPHP
 /**
  * Start auth component
  */
 public function start()
 {
     $this->appSession = Doo::session($this->getApplicationName());
     $this->validate();
 }
コード例 #5
0
 public function beforeRun($resource, $action)
 {
     self::$session = Doo::session("IDMeasure");
     IDGlobalController::$resource = $resource;
     IDGlobalController::$action = $action;
     IDGlobalController::$start = microtime(true);
     IDGlobalController::$newparams = $this->params;
     /*
     if( $this->userparams['clientKey'] != 'TL27' )	{
     	$data['error'] = array( 'cod' => '401', 'desc' => 'Cliente no autorizado.' );
     	$this->renderc( $data );
     	exit( );
     }
     */
     IDGlobalController::$URI = $_SERVER['REQUEST_URI'];
     /*
     		if( strpos( $_SERVER['REQUEST_URI'], '?' ) !== false )
     			$_SERVER['REQUEST_URI'] = substr( $_SERVER['REQUEST_URI'], 0, strpos( $_SERVER['REQUEST_URI'], '?' ) );
     		$_SERVER['REQUEST_URI'] = str_replace( '/' . $this->params['clientKey'] . '/', '/', $_SERVER['REQUEST_URI'] );
     */
     if (!isset($this->params['format']) || !$this->params['format']) {
         $this->params['format'] = 'json';
     }
     /*
     if( $this->params['format'] == 'json' )	{
         if( isset( $_REQUEST['callback'] ) && $_REQUEST['callback'] )
             header( "Content-type: application/javascript; charset=utf-8" );
         else
             header( "Content-type: application/json; charset=utf-8" );
     }
     else if ( $this->params['format'] == 'xml' )
         header( "Content-type: text/xml; charset=utf-8" );
     */
     if (Doo::conf()->get('APP_MODE') != 'dev') {
         /*
         			$lastModified = time( );
         			$uri = $_SERVER['REQUEST_URI'];
         
         			if( $uri[strlen( $uri ) - 1] == '/' )	{
         				$uri = substr( $uri, 0, strlen( $uri ) - 1 );
         			}
         
         			$cacheFile = Doo::conf()->SITE_PATH . Doo::conf()->PROTECTED_FOLDER . 'cache/frontend/' . str_replace( '/', '-', $uri ) . '.html';
         			if( strncmp( PHP_OS, 'WIN', 3 ) === 0 )	{
         				$cacheFile = str_replace( '?', '_q.', $cacheFile );
         			}
         
         			if ( file_exists( $cacheFile ) ) {
         				$lastModified = filemtime( $cacheFile );
         			}
         			
         			$ts = gmdate("D, d M Y H:i:s", $lastModified ) . " GMT";
         			header("Last-Modified: $ts", true);
         			$ts = gmdate("D, d M Y H:i:s", $lastModified + self::DEFAULT_TIME_CACHE ) . " GMT";
         			header("Expires: $ts", true);
         			header("Pragma: cache", true);
         			//header_remove("Cache-Control");
         			header("Cache-Control: max-age=" . self::DEFAULT_TIME_CACHE, true );
         */
     }
     if (isset($_REQUEST['callback']) && $_REQUEST['callback']) {
         echo $_REQUEST['callback'] . '(';
         register_shutdown_function("IDGlobalController::shutdown_function");
     } else {
         register_shutdown_function("IDGlobalController::shutdown_log_function");
     }
     /*
     if( Doo::conf( )->get( 'APP_MODE' ) != 'dev' && $this->params['clientKey'] != 'NOC21' )	{
     	Doo::cache('front')->get( self::DEFAULT_TIME_CACHE );
     }
     
     
     if( Doo::conf( )->get( 'APP_MODE' ) != 'dev' && $this->params['clientKey'] != 'NOC21' )
     	Doo::cache('front')->start( );
     */
 }
コード例 #6
0
ファイル: UserSession.php プロジェクト: berlianaputri/rps
 public function getAAAToken()
 {
     $sessiondata = Doo::session("ottpcbackend");
     return $sessiondata->aaatoken;
 }