40 lines
1.2 KiB
PHP
Executable File
40 lines
1.2 KiB
PHP
Executable File
<?php
|
|
// +----------------------------------------------------------------------
|
|
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
|
|
// +----------------------------------------------------------------------
|
|
// | Copyright (c) 2013 http://www.tensent.cn All rights reserved.
|
|
// +----------------------------------------------------------------------
|
|
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
|
|
// +----------------------------------------------------------------------
|
|
namespace app\controller;
|
|
|
|
use think\facade\Db;
|
|
|
|
/**
|
|
* @title 后端公共模块
|
|
*/
|
|
class Admin extends Base {
|
|
|
|
// 使用内置PHP模板引擎渲染模板输出
|
|
protected $tpl_config = [
|
|
'tpl_replace_string' => [
|
|
'__static__' => '/static',
|
|
'__img__' => '/static/admin/images',
|
|
'__css__' => '/static/admin/css',
|
|
'__js__' => '/static/admin/js',
|
|
'__public__' => '/static/admin',
|
|
],
|
|
];
|
|
|
|
protected $middleware = [
|
|
'\app\http\middleware\Validate',
|
|
'\app\http\middleware\Admin',
|
|
];
|
|
|
|
protected function initialize() {
|
|
Db::name('config')->select();
|
|
if (!is_login() and !in_array($this->request->url, array('admin/index/login', 'admin/index/logout', 'admin/index/verify'))) {
|
|
$this->redirect('admin/index/login');
|
|
}
|
|
}
|
|
} |