目录结构更新,增加composer支持
This commit is contained in:
@@ -1,23 +1,14 @@
|
||||
<?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\common\controller;
|
||||
|
||||
class Base extends \think\Controller {
|
||||
use think\Controller;
|
||||
|
||||
protected $url;
|
||||
protected $request;
|
||||
protected $module;
|
||||
protected $controller;
|
||||
protected $action;
|
||||
class Base extends Controller{
|
||||
|
||||
public function _initialize() {
|
||||
protected $url_path = ""; //当前完全访问路径
|
||||
|
||||
public function _initialize(){
|
||||
$this->url_path = strtolower($this->request->module() . '/' . $this->request->controller() . '/' . $this->request->action());
|
||||
if (!is_file(APP_PATH . 'database.php') || !is_file(APP_PATH . 'install.lock')) {
|
||||
return $this->redirect('install/index/index');
|
||||
}
|
||||
@@ -28,8 +19,6 @@ class Base extends \think\Controller {
|
||||
cache('db_config_data', $config);
|
||||
}
|
||||
config($config);
|
||||
//获取request信息
|
||||
$this->requestInfo();
|
||||
}
|
||||
|
||||
public function execute($mc = null, $op = '', $ac = null) {
|
||||
@@ -110,34 +99,6 @@ class Base extends \think\Controller {
|
||||
$this->assign($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证码
|
||||
* @param integer $id 验证码ID
|
||||
* @author 郭平平 <molong@tensent.cn>
|
||||
*/
|
||||
public function verify($id = 1) {
|
||||
$verify = new \org\Verify(array('length' => 4));
|
||||
$verify->entry($id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测验证码
|
||||
* @param integer $id 验证码ID
|
||||
* @return boolean 检测结果
|
||||
* @author 麦当苗儿 <zuojiazi@vip.qq.com>
|
||||
*/
|
||||
public function checkVerify($code, $id = 1) {
|
||||
if ($code) {
|
||||
$verify = new \org\Verify();
|
||||
$result = $verify->check($code, $id);
|
||||
if (!$result) {
|
||||
return $this->error("验证码错误!", "");
|
||||
}
|
||||
} else {
|
||||
return $this->error("验证码为空!", "");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 后台设置title
|
||||
* @description 设置后台页面的title
|
||||
@@ -149,29 +110,6 @@ class Base extends \think\Controller {
|
||||
$this->assign('meta_title', $title);
|
||||
}
|
||||
|
||||
//request信息
|
||||
protected function requestInfo() {
|
||||
$this->param = $this->request->param();
|
||||
defined('MODULE_NAME') or define('MODULE_NAME', $this->request->module());
|
||||
defined('CONTROLLER_NAME') or define('CONTROLLER_NAME', $this->request->controller());
|
||||
defined('ACTION_NAME') or define('ACTION_NAME', $this->request->action());
|
||||
defined('IS_POST') or define('IS_POST', $this->request->isPost());
|
||||
defined('IS_GET') or define('IS_GET', $this->request->isGet());
|
||||
$this->url = strtolower($this->request->module() . '/' . $this->request->controller() . '/' . $this->request->action());
|
||||
$this->assign('request', $this->request);
|
||||
$this->assign('param', $this->param);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取单个参数的数组形式
|
||||
*/
|
||||
protected function getArrayParam($param) {
|
||||
if (isset($this->param['id'])) {
|
||||
return array_unique((array) $this->param[$param]);
|
||||
} else {
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否为手机访问
|
||||
@@ -214,4 +152,4 @@ class Base extends \think\Controller {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user