From b3c4f44e038635a22da50604446f9ab3740f57ed Mon Sep 17 00:00:00 2001 From: unset Date: Wed, 13 Jul 2016 10:37:14 +0800 Subject: [PATCH 01/19] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=85=B3=E9=97=AD?= =?UTF-8?q?=E7=AB=99=E7=82=B9=E6=8F=90=E7=A4=BA=E8=AF=AD=E4=B8=8D=E5=90=8C?= =?UTF-8?q?=E6=AD=A5=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ThinkPHP/Library/Think/Controller.class.php | 832 ++++++++++---------- 1 file changed, 416 insertions(+), 416 deletions(-) diff --git a/ThinkPHP/Library/Think/Controller.class.php b/ThinkPHP/Library/Think/Controller.class.php index e1f31a1..759be55 100644 --- a/ThinkPHP/Library/Think/Controller.class.php +++ b/ThinkPHP/Library/Think/Controller.class.php @@ -1,417 +1,417 @@ - -// +---------------------------------------------------------------------- -namespace Think; -/** - * ThinkPHP 控制器基类 抽象类 - */ -abstract class Controller -{ - - /** - * 视图实例对象 - * @var view - * @access protected - */ - protected $view = null; - - /** - * 控制器参数 - * @var config - * @access protected - */ - protected $config = array(); - - /*OpenSNS新增部分*/ - /**seo参数 陈一枭 OpenSNS - * @var array - */ - public $_seo = array(); - - public function setTitle($title) - { - $this->_seo['title'] = $title; - $this->assign('seo', $this->_seo); - } - - public function setKeywords($keywords) - { - $this->_seo['keywords'] = $keywords; - $this->assign('seo', $this->_seo); - } - - public function setDescription($description) - { - $this->_seo['description'] = $description; - $this->assign('seo', $this->_seo); - } - - - - - /*OpenSNS新增部分end*/ - - - /** - * 架构函数 取得模板对象实例 - * @access public - */ - public function __construct() - { - if (is_file('./Conf/user.php')) {//已经安装了 - - $moduleModel = D('Common/Module'); - /*读取站点配置*/ - $config = api('Config/lists'); - C($config); //添加配置 - $module =$moduleModel->getModule(MODULE_NAME); - - - if (strtolower(MODULE_NAME) != 'install' && strtolower(MODULE_NAME) != 'admin') { - if (!C('WEB_SITE_CLOSE')) { - header("Content-Type: text/html; charset=utf-8"); - exit('站点已经关闭,请稍后访问~'); - } - - if (strtolower(MODULE_NAME) != 'install' && strtolower(MODULE_NAME) != 'admin') { - $moduleModel->checkCanVisit(MODULE_NAME); - } - } - } - - - Hook::listen('action_begin', $this->config); - //实例化视图类 - $this->view = Think::instance('Think\View'); - if(!empty($module)){ - $this->view->assign('MODULE_INFO', $module); - $this->view->assign('MODULE_ALIAS', $module['alias']); - } - - //控制器初始化 - if (method_exists($this, '_initialize')) - $this->_initialize(); - } - - /** - * 模板显示 调用内置的模板引擎显示方法, - * @access protected - * @param string $templateFile 指定要调用的模板文件 - * 默认为空 由系统自动定位模板文件 - * @param string $charset 输出编码 - * @param string $contentType 输出类型 - * @param string $content 输出内容 - * @param string $prefix 模板缓存前缀 - * @return void - */ - protected function display($templateFile = '', $charset = '', $contentType = '', $content = '', $prefix = '') - { - - $this->view->display($templateFile, $charset, $contentType, $content, $prefix); - } - - /** - * 输出内容文本可以包括Html 并支持内容解析 - * @access protected - * @param string $content 输出内容 - * @param string $charset 模板输出字符集 - * @param string $contentType 输出类型 - * @param string $prefix 模板缓存前缀 - * @return mixed - */ - protected function show($content, $charset = '', $contentType = '', $prefix = '') - { - $this->view->display('', $charset, $contentType, $content, $prefix); - } - - /** - * 获取输出页面内容 - * 调用内置的模板引擎fetch方法, - * @access protected - * @param string $templateFile 指定要调用的模板文件 - * 默认为空 由系统自动定位模板文件 - * @param string $content 模板输出内容 - * @param string $prefix 模板缓存前缀* - * @return string - */ - protected function fetch($templateFile = '', $content = '', $prefix = '') - { - return $this->view->fetch($templateFile, $content, $prefix); - } - - /** - * 创建静态页面 - * @access protected - * @htmlfile 生成的静态文件名称 - * @htmlpath 生成的静态文件路径 - * @param string $templateFile 指定要调用的模板文件 - * 默认为空 由系统自动定位模板文件 - * @return string - */ - protected function buildHtml($htmlfile = '', $htmlpath = '', $templateFile = '') - { - $content = $this->fetch($templateFile); - $htmlpath = !empty($htmlpath) ? $htmlpath : HTML_PATH; - $htmlfile = $htmlpath . $htmlfile . C('HTML_FILE_SUFFIX'); - Storage::put($htmlfile, $content, 'html'); - return $content; - } - - /** - * 模板主题设置 - * @access protected - * @param string $theme 模版主题 - * @return Action - */ - protected function theme($theme) - { - $this->view->theme($theme); - return $this; - } - - /** - * 模板变量赋值 - * @access protected - * @param mixed $name 要显示的模板变量 - * @param mixed $value 变量的值 - * @return Action - */ - protected function assign($name, $value = '') - { - $this->view->assign($name, $value); - return $this; - } - - public function __set($name, $value) - { - $this->assign($name, $value); - } - - /** - * 取得模板显示变量的值 - * @access protected - * @param string $name 模板显示变量 - * @return mixed - */ - public function get($name = '') - { - return $this->view->get($name); - } - - public function __get($name) - { - return $this->get($name); - } - - /** - * 检测模板变量的值 - * @access public - * @param string $name 名称 - * @return boolean - */ - public function __isset($name) - { - return $this->get($name); - } - - /** - * 魔术方法 有不存在的操作的时候执行 - * @access public - * @param string $method 方法名 - * @param array $args 参数 - * @return mixed - */ - public function __call($method, $args) - { - if (0 === strcasecmp($method, ACTION_NAME . C('ACTION_SUFFIX'))) { - if (method_exists($this, '_empty')) { - // 如果定义了_empty操作 则调用 - $this->_empty($method, $args); - } elseif (file_exists_case($this->view->parseTemplate())) { - // 检查是否存在默认模版 如果有直接输出模版 - $this->display(); - } else { - E(L('_ERROR_ACTION_') . ':' . ACTION_NAME,815); - } - } else { - E(__CLASS__ . ':' . $method . L('_METHOD_NOT_EXIST_')); - return; - } - } - - /** - * 操作错误跳转的快捷方法 - * @access protected - * @param string $message 错误信息 - * @param string $jumpUrl 页面跳转地址 - * @param mixed $ajax 是否为Ajax方式 当数字时指定跳转时间 - * @return void - */ - protected function error($message = '', $jumpUrl = '', $ajax = false) - { - $this->dispatchJump($message, 0, $jumpUrl, $ajax); - } - - /** - * 操作成功跳转的快捷方法 - * @access protected - * @param string $message 提示信息 - * @param string $jumpUrl 页面跳转地址 - * @param mixed $ajax 是否为Ajax方式 当数字时指定跳转时间 - * @return void - */ - protected function success($message = '', $jumpUrl = '', $ajax = false) - { - $this->dispatchJump($message, 1, $jumpUrl, $ajax); - } - - /** - * Ajax方式返回数据到客户端 - * @access protected - * @param mixed $data 要返回的数据 - * @param String $type AJAX返回数据格式 - * @return void - */ - protected function ajaxReturn($data, $type = '') - { - if (empty($type)) $type = C('DEFAULT_AJAX_RETURN'); - switch (strtoupper($type)) { - case 'JSON' : - // 返回JSON数据格式到客户端 包含状态信息 - header('Content-Type:application/json; charset=utf-8'); - exit(json_encode($data)); - case 'XML' : - // 返回xml格式数据 - header('Content-Type:text/xml; charset=utf-8'); - exit(xml_encode($data)); - case 'JSONP': - // 返回JSON数据格式到客户端 包含状态信息 - header('Content-Type:application/json; charset=utf-8'); - $handler = isset($_GET[C('VAR_JSONP_HANDLER')]) ? $_GET[C('VAR_JSONP_HANDLER')] : C('DEFAULT_JSONP_HANDLER'); - exit($handler . '(' . json_encode($data) . ');'); - case 'EVAL' : - // 返回可执行的js脚本 - header('Content-Type:text/html; charset=utf-8'); - exit($data); - default : - // 用于扩展其他返回格式数据 - Hook::listen('ajax_return', $data); - } - } - - /** - * Action跳转(URL重定向) 支持指定模块和延时跳转 - * @access protected - * @param string $url 跳转的URL表达式 - * @param array $params 其它URL参数 - * @param integer $delay 延时跳转的时间 单位为秒 - * @param string $msg 跳转提示信息 - * @return void - */ - protected function redirect($url, $params = array(), $delay = 0, $msg = '') - { - $url = U($url, $params); - redirect($url, $delay, $msg); - } - - /** - * 默认跳转操作 支持错误导向和正确跳转 - * 调用模板显示 默认为public目录下面的success页面 - * 提示页面为可配置 支持模板标签 - * @param string $message 提示信息 - * @param Boolean $status 状态 - * @param string $jumpUrl 页面跳转地址 - * @param mixed $ajax 是否为Ajax方式 当数字时指定跳转时间 - * @access private - * @return void - */ - private function dispatchJump($message, $status = 1, $jumpUrl = '', $ajax = false) - { - if (true === $ajax || IS_AJAX) {// AJAX提交 - $data = is_array($ajax) ? $ajax : array(); - $data['info'] = $message; - $data['status'] = $status; - $data['url'] = $jumpUrl; - $this->ajaxReturn($data); - } - if (is_int($ajax)) $this->assign('waitSecond', $ajax); - if (!empty($jumpUrl)) $this->assign('jumpUrl', $jumpUrl); - // 提示标题 - $this->assign('msgTitle', $status ? L('_OPERATION_SUCCESS_') : L('_OPERATION_FAIL_')); - //如果设置了关闭窗口,则提示完毕后自动关闭窗口 - if ($this->get('closeWin')) $this->assign('jumpUrl', 'javascript:window.close();'); - $this->assign('status', $status); // 状态 - //保证输出不受静态缓存影响 - C('HTML_CACHE_ON', false); - if ($status) { //发送成功信息 - $this->assign('success_message', $message);// 提示信息 - // 成功操作后默认停留1秒 - if (!isset($this->waitSecond)) $this->assign('waitSecond', modC('SUCCESS_WAIT_TIME','2','config')); - // 默认操作成功自动返回操作前页面 - if (!isset($this->jumpUrl)) $this->assign("jumpUrl", $_SERVER["HTTP_REFERER"]); - $this->display(C('TMPL_ACTION_SUCCESS')); - exit; - } else { - $this->assign('error_message', $message);// 提示信息 - //发生错误时候默认停留3秒 - if (!isset($this->waitSecond)) $this->assign('waitSecond', modC('ERROR_WAIT_TIME','10','config')); - // 默认发生错误的话自动返回上页 - if (!isset($this->jumpUrl)) $this->assign('jumpUrl', "javascript:history.back(-1);"); - $this->display(C('TMPL_ACTION_ERROR')); - // 中止执行 避免出错后继续执行 - exit; - } - } - - /** - * 析构方法 - * @access public - */ - public function __destruct() - { - // 执行后续操作 - Hook::listen('action_end'); - } - - /** - * checkRule 检查权限 - * @author:xjw129xjt(肖骏涛) xjt@ourstu.com - */ - public function checkAuth($rule ='',$except_uid =-1,$msg = ''){ - if (!check_auth($rule,$except_uid)) { - $this->error(empty($msg)?'您无操作权限。':$msg); - } - } - - /** - * check_action_limit 行为限制 - * @param null $action - * @param null $model - * @param null $record_id - * @param null $user_id - * @param bool $ip - * @author 郑钟良 - */ - public function checkActionLimit($action = null, $model = null, $record_id = null, $user_id = null, $ip = false,$url = false){ - $return = check_action_limit($action, $model, $record_id, $user_id, $ip); - if ($return && !$return['state']) { - if($url === true){ - $url = $return['url']; - }elseif($url === false){ - $url = ''; - } - $this->error($return['info'],$url); - } - } - -} - -// 设置控制器别名 便于升级 + +// +---------------------------------------------------------------------- +namespace Think; +/** + * ThinkPHP 控制器基类 抽象类 + */ +abstract class Controller +{ + + /** + * 视图实例对象 + * @var view + * @access protected + */ + protected $view = null; + + /** + * 控制器参数 + * @var config + * @access protected + */ + protected $config = array(); + + /*OpenSNS新增部分*/ + /**seo参数 陈一枭 OpenSNS + * @var array + */ + public $_seo = array(); + + public function setTitle($title) + { + $this->_seo['title'] = $title; + $this->assign('seo', $this->_seo); + } + + public function setKeywords($keywords) + { + $this->_seo['keywords'] = $keywords; + $this->assign('seo', $this->_seo); + } + + public function setDescription($description) + { + $this->_seo['description'] = $description; + $this->assign('seo', $this->_seo); + } + + + + + /*OpenSNS新增部分end*/ + + + /** + * 架构函数 取得模板对象实例 + * @access public + */ + public function __construct() + { + if (is_file('./Conf/user.php')) {//已经安装了 + + $moduleModel = D('Common/Module'); + /*读取站点配置*/ + $config = api('Config/lists'); + C($config); //添加配置 + $module =$moduleModel->getModule(MODULE_NAME); + + + if (strtolower(MODULE_NAME) != 'install' && strtolower(MODULE_NAME) != 'admin') { + if (!C('WEB_SITE_CLOSE')) { + header("Content-Type: text/html; charset=utf-8"); + exit(C('WEB_SITE_CLOSE_HINT')); + } + + if (strtolower(MODULE_NAME) != 'install' && strtolower(MODULE_NAME) != 'admin') { + $moduleModel->checkCanVisit(MODULE_NAME); + } + } + } + + + Hook::listen('action_begin', $this->config); + //实例化视图类 + $this->view = Think::instance('Think\View'); + if(!empty($module)){ + $this->view->assign('MODULE_INFO', $module); + $this->view->assign('MODULE_ALIAS', $module['alias']); + } + + //控制器初始化 + if (method_exists($this, '_initialize')) + $this->_initialize(); + } + + /** + * 模板显示 调用内置的模板引擎显示方法, + * @access protected + * @param string $templateFile 指定要调用的模板文件 + * 默认为空 由系统自动定位模板文件 + * @param string $charset 输出编码 + * @param string $contentType 输出类型 + * @param string $content 输出内容 + * @param string $prefix 模板缓存前缀 + * @return void + */ + protected function display($templateFile = '', $charset = '', $contentType = '', $content = '', $prefix = '') + { + + $this->view->display($templateFile, $charset, $contentType, $content, $prefix); + } + + /** + * 输出内容文本可以包括Html 并支持内容解析 + * @access protected + * @param string $content 输出内容 + * @param string $charset 模板输出字符集 + * @param string $contentType 输出类型 + * @param string $prefix 模板缓存前缀 + * @return mixed + */ + protected function show($content, $charset = '', $contentType = '', $prefix = '') + { + $this->view->display('', $charset, $contentType, $content, $prefix); + } + + /** + * 获取输出页面内容 + * 调用内置的模板引擎fetch方法, + * @access protected + * @param string $templateFile 指定要调用的模板文件 + * 默认为空 由系统自动定位模板文件 + * @param string $content 模板输出内容 + * @param string $prefix 模板缓存前缀* + * @return string + */ + protected function fetch($templateFile = '', $content = '', $prefix = '') + { + return $this->view->fetch($templateFile, $content, $prefix); + } + + /** + * 创建静态页面 + * @access protected + * @htmlfile 生成的静态文件名称 + * @htmlpath 生成的静态文件路径 + * @param string $templateFile 指定要调用的模板文件 + * 默认为空 由系统自动定位模板文件 + * @return string + */ + protected function buildHtml($htmlfile = '', $htmlpath = '', $templateFile = '') + { + $content = $this->fetch($templateFile); + $htmlpath = !empty($htmlpath) ? $htmlpath : HTML_PATH; + $htmlfile = $htmlpath . $htmlfile . C('HTML_FILE_SUFFIX'); + Storage::put($htmlfile, $content, 'html'); + return $content; + } + + /** + * 模板主题设置 + * @access protected + * @param string $theme 模版主题 + * @return Action + */ + protected function theme($theme) + { + $this->view->theme($theme); + return $this; + } + + /** + * 模板变量赋值 + * @access protected + * @param mixed $name 要显示的模板变量 + * @param mixed $value 变量的值 + * @return Action + */ + protected function assign($name, $value = '') + { + $this->view->assign($name, $value); + return $this; + } + + public function __set($name, $value) + { + $this->assign($name, $value); + } + + /** + * 取得模板显示变量的值 + * @access protected + * @param string $name 模板显示变量 + * @return mixed + */ + public function get($name = '') + { + return $this->view->get($name); + } + + public function __get($name) + { + return $this->get($name); + } + + /** + * 检测模板变量的值 + * @access public + * @param string $name 名称 + * @return boolean + */ + public function __isset($name) + { + return $this->get($name); + } + + /** + * 魔术方法 有不存在的操作的时候执行 + * @access public + * @param string $method 方法名 + * @param array $args 参数 + * @return mixed + */ + public function __call($method, $args) + { + if (0 === strcasecmp($method, ACTION_NAME . C('ACTION_SUFFIX'))) { + if (method_exists($this, '_empty')) { + // 如果定义了_empty操作 则调用 + $this->_empty($method, $args); + } elseif (file_exists_case($this->view->parseTemplate())) { + // 检查是否存在默认模版 如果有直接输出模版 + $this->display(); + } else { + E(L('_ERROR_ACTION_') . ':' . ACTION_NAME,815); + } + } else { + E(__CLASS__ . ':' . $method . L('_METHOD_NOT_EXIST_')); + return; + } + } + + /** + * 操作错误跳转的快捷方法 + * @access protected + * @param string $message 错误信息 + * @param string $jumpUrl 页面跳转地址 + * @param mixed $ajax 是否为Ajax方式 当数字时指定跳转时间 + * @return void + */ + protected function error($message = '', $jumpUrl = '', $ajax = false) + { + $this->dispatchJump($message, 0, $jumpUrl, $ajax); + } + + /** + * 操作成功跳转的快捷方法 + * @access protected + * @param string $message 提示信息 + * @param string $jumpUrl 页面跳转地址 + * @param mixed $ajax 是否为Ajax方式 当数字时指定跳转时间 + * @return void + */ + protected function success($message = '', $jumpUrl = '', $ajax = false) + { + $this->dispatchJump($message, 1, $jumpUrl, $ajax); + } + + /** + * Ajax方式返回数据到客户端 + * @access protected + * @param mixed $data 要返回的数据 + * @param String $type AJAX返回数据格式 + * @return void + */ + protected function ajaxReturn($data, $type = '') + { + if (empty($type)) $type = C('DEFAULT_AJAX_RETURN'); + switch (strtoupper($type)) { + case 'JSON' : + // 返回JSON数据格式到客户端 包含状态信息 + header('Content-Type:application/json; charset=utf-8'); + exit(json_encode($data)); + case 'XML' : + // 返回xml格式数据 + header('Content-Type:text/xml; charset=utf-8'); + exit(xml_encode($data)); + case 'JSONP': + // 返回JSON数据格式到客户端 包含状态信息 + header('Content-Type:application/json; charset=utf-8'); + $handler = isset($_GET[C('VAR_JSONP_HANDLER')]) ? $_GET[C('VAR_JSONP_HANDLER')] : C('DEFAULT_JSONP_HANDLER'); + exit($handler . '(' . json_encode($data) . ');'); + case 'EVAL' : + // 返回可执行的js脚本 + header('Content-Type:text/html; charset=utf-8'); + exit($data); + default : + // 用于扩展其他返回格式数据 + Hook::listen('ajax_return', $data); + } + } + + /** + * Action跳转(URL重定向) 支持指定模块和延时跳转 + * @access protected + * @param string $url 跳转的URL表达式 + * @param array $params 其它URL参数 + * @param integer $delay 延时跳转的时间 单位为秒 + * @param string $msg 跳转提示信息 + * @return void + */ + protected function redirect($url, $params = array(), $delay = 0, $msg = '') + { + $url = U($url, $params); + redirect($url, $delay, $msg); + } + + /** + * 默认跳转操作 支持错误导向和正确跳转 + * 调用模板显示 默认为public目录下面的success页面 + * 提示页面为可配置 支持模板标签 + * @param string $message 提示信息 + * @param Boolean $status 状态 + * @param string $jumpUrl 页面跳转地址 + * @param mixed $ajax 是否为Ajax方式 当数字时指定跳转时间 + * @access private + * @return void + */ + private function dispatchJump($message, $status = 1, $jumpUrl = '', $ajax = false) + { + if (true === $ajax || IS_AJAX) {// AJAX提交 + $data = is_array($ajax) ? $ajax : array(); + $data['info'] = $message; + $data['status'] = $status; + $data['url'] = $jumpUrl; + $this->ajaxReturn($data); + } + if (is_int($ajax)) $this->assign('waitSecond', $ajax); + if (!empty($jumpUrl)) $this->assign('jumpUrl', $jumpUrl); + // 提示标题 + $this->assign('msgTitle', $status ? L('_OPERATION_SUCCESS_') : L('_OPERATION_FAIL_')); + //如果设置了关闭窗口,则提示完毕后自动关闭窗口 + if ($this->get('closeWin')) $this->assign('jumpUrl', 'javascript:window.close();'); + $this->assign('status', $status); // 状态 + //保证输出不受静态缓存影响 + C('HTML_CACHE_ON', false); + if ($status) { //发送成功信息 + $this->assign('success_message', $message);// 提示信息 + // 成功操作后默认停留1秒 + if (!isset($this->waitSecond)) $this->assign('waitSecond', modC('SUCCESS_WAIT_TIME','2','config')); + // 默认操作成功自动返回操作前页面 + if (!isset($this->jumpUrl)) $this->assign("jumpUrl", $_SERVER["HTTP_REFERER"]); + $this->display(C('TMPL_ACTION_SUCCESS')); + exit; + } else { + $this->assign('error_message', $message);// 提示信息 + //发生错误时候默认停留3秒 + if (!isset($this->waitSecond)) $this->assign('waitSecond', modC('ERROR_WAIT_TIME','10','config')); + // 默认发生错误的话自动返回上页 + if (!isset($this->jumpUrl)) $this->assign('jumpUrl', "javascript:history.back(-1);"); + $this->display(C('TMPL_ACTION_ERROR')); + // 中止执行 避免出错后继续执行 + exit; + } + } + + /** + * 析构方法 + * @access public + */ + public function __destruct() + { + // 执行后续操作 + Hook::listen('action_end'); + } + + /** + * checkRule 检查权限 + * @author:xjw129xjt(肖骏涛) xjt@ourstu.com + */ + public function checkAuth($rule ='',$except_uid =-1,$msg = ''){ + if (!check_auth($rule,$except_uid)) { + $this->error(empty($msg)?'您无操作权限。':$msg); + } + } + + /** + * check_action_limit 行为限制 + * @param null $action + * @param null $model + * @param null $record_id + * @param null $user_id + * @param bool $ip + * @author 郑钟良 + */ + public function checkActionLimit($action = null, $model = null, $record_id = null, $user_id = null, $ip = false,$url = false){ + $return = check_action_limit($action, $model, $record_id, $user_id, $ip); + if ($return && !$return['state']) { + if($url === true){ + $url = $return['url']; + }elseif($url === false){ + $url = ''; + } + $this->error($return['info'],$url); + } + } + +} + +// 设置控制器别名 便于升级 class_alias('Think\Controller', 'Think\Action'); \ No newline at end of file -- Gitee From a096b6a0b4cc383f3d02566cf83bf6fe11b5f71f Mon Sep 17 00:00:00 2001 From: unset Date: Tue, 26 Jul 2016 16:08:40 +0800 Subject: [PATCH 02/19] =?UTF-8?q?=E3=80=90bug=E3=80=91=E4=BF=AE=E5=A4=8Dke?= =?UTF-8?q?yselect=E6=97=A0=E6=B3=95=E8=AF=86=E5=88=AB=E5=B7=B2=E8=A2=AB?= =?UTF-8?q?=E9=80=89=E4=B8=AD=E7=9A=84=E9=97=AE=E9=A2=98=EF=BC=8C=E6=9C=89?= =?UTF-8?q?=E5=BE=88=E5=A4=9A=E6=97=B6=E5=80=99=E7=BC=96=E8=BE=91=E5=86=85?= =?UTF-8?q?=E5=AE=B9=E9=9C=80=E8=A6=81=E7=94=A8=E5=88=B0keyselect=EF=BC=8C?= =?UTF-8?q?=E4=BD=86=E6=98=AF=EF=BC=8C=E9=9C=80=E8=A6=81=E4=BB=8E=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=BA=93=E9=87=8C=E8=AF=BB=E5=8F=96=E5=93=AA=E4=B8=AA?= =?UTF-8?q?option=E5=B7=B2=E7=BB=8F=E8=A2=AB=E9=80=89=E4=B8=AD=E4=BA=86?= =?UTF-8?q?=E7=84=B6=E5=90=8E=E6=98=BE=E7=A4=BA=E5=87=BA=E6=9D=A5=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Admin/Builder/AdminConfigBuilder.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Application/Admin/Builder/AdminConfigBuilder.class.php b/Application/Admin/Builder/AdminConfigBuilder.class.php index e44edcb..f115f4d 100644 --- a/Application/Admin/Builder/AdminConfigBuilder.class.php +++ b/Application/Admin/Builder/AdminConfigBuilder.class.php @@ -53,9 +53,9 @@ class AdminConfigBuilder extends AdminBuilder * @return $this * @auth 陈一枭 */ - public function key($name, $title, $subtitle = null, $type, $opt = null) + public function key($name, $title, $subtitle = null, $type, $opt = null, $selected = null) { - $key = array('name' => $name, 'title' => $title, 'subtitle' => $subtitle, 'type' => $type, 'opt' => $opt); + $key = array('name' => $name, 'title' => $title, 'subtitle' => $subtitle, 'type' => $type, 'opt' => $opt, $selected); $this->_keyList[] = $key; return $this; } @@ -139,9 +139,9 @@ class AdminConfigBuilder extends AdminBuilder return $this->keySelect($name, $title, $subtitle, $map); } - public function keySelect($name, $title, $subtitle = null, $options) + public function keySelect($name, $title, $subtitle = null, $options, $selected = null) { - return $this->key($name, $title, $subtitle, 'select', $options); + return $this->key($name, $title, $subtitle, 'select', $options, $selected); } public function keyRadio($name, $title, $subtitle = null, $options) -- Gitee From b9a5c673e72ae7352ab74051f160270f753f09c2 Mon Sep 17 00:00:00 2001 From: unset Date: Tue, 26 Jul 2016 16:09:36 +0800 Subject: [PATCH 03/19] =?UTF-8?q?=E3=80=90bug=E3=80=91=E4=BF=AE=E5=A4=8Dke?= =?UTF-8?q?yselect=E6=97=A0=E6=B3=95=E8=AF=86=E5=88=AB=E5=B7=B2=E8=A2=AB?= =?UTF-8?q?=E9=80=89=E4=B8=AD=E7=9A=84=E9=97=AE=E9=A2=98=EF=BC=8C=E6=9C=89?= =?UTF-8?q?=E5=BE=88=E5=A4=9A=E6=97=B6=E5=80=99=E7=BC=96=E8=BE=91=E5=86=85?= =?UTF-8?q?=E5=AE=B9=E9=9C=80=E8=A6=81=E7=94=A8=E5=88=B0keyselect=EF=BC=8C?= =?UTF-8?q?=E4=BD=86=E6=98=AF=EF=BC=8C=E9=9C=80=E8=A6=81=E4=BB=8E=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=BA=93=E9=87=8C=E8=AF=BB=E5=8F=96=E5=93=AA=E4=B8=AA?= =?UTF-8?q?option=E5=B7=B2=E7=BB=8F=E8=A2=AB=E9=80=89=E4=B8=AD=E4=BA=86?= =?UTF-8?q?=E7=84=B6=E5=90=8E=E6=98=BE=E7=A4=BA=E5=87=BA=E6=9D=A5=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Admin/View/default/Builder/_key.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Application/Admin/View/default/Builder/_key.html b/Application/Admin/View/default/Builder/_key.html index 96f8342..52cb6ac 100644 --- a/Application/Admin/View/default/Builder/_key.html +++ b/Application/Admin/View/default/Builder/_key.html @@ -38,7 +38,7 @@ - $selected = $field['selected']==$key ? 'selected' : ''; + $selected = $field['value']==$key ? 'selected' : ''; + {$selected} >{$option|htmlspecialchars} -- Gitee From 8c71fa3f7d8f955ac1a01f0109cb874998d7fd50 Mon Sep 17 00:00:00 2001 From: unset Date: Thu, 25 Aug 2016 22:58:24 +0800 Subject: [PATCH 07/19] new file --- Application/Common/Common/heatfly.php | 47 +++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 Application/Common/Common/heatfly.php diff --git a/Application/Common/Common/heatfly.php b/Application/Common/Common/heatfly.php new file mode 100644 index 0000000..ee8818b --- /dev/null +++ b/Application/Common/Common/heatfly.php @@ -0,0 +1,47 @@ + Date: Thu, 25 Aug 2016 22:59:48 +0800 Subject: [PATCH 08/19] Update function.php --- Application/Common/Common/function.php | 1 + 1 file changed, 1 insertion(+) diff --git a/Application/Common/Common/function.php b/Application/Common/Common/function.php index ac34b09..5a221d2 100644 --- a/Application/Common/Common/function.php +++ b/Application/Common/Common/function.php @@ -29,6 +29,7 @@ require_once(APP_PATH . '/Common/Common/limit.php'); require_once(APP_PATH . '/Common/Common/role.php'); require_once(APP_PATH . '/Common/Common/ext_parse.php'); require_once(APP_PATH . '/Common/Common/collect.php'); +require_once(APP_PATH . '/Common/Common/heatfly.php'); /*require_once(APP_PATH . '/Common/Common/extend.php');*/ -- Gitee From cbbbef29acc4de8ded3c4454aeb33eba2eda643d Mon Sep 17 00:00:00 2001 From: unset Date: Tue, 13 Sep 2016 23:09:14 +0800 Subject: [PATCH 09/19] Update index.php --- index.php | 166 +++++++++++++++++++++++++++--------------------------- 1 file changed, 83 insertions(+), 83 deletions(-) diff --git a/index.php b/index.php index fa28e55..736a895 100644 --- a/index.php +++ b/index.php @@ -1,83 +1,83 @@ - -// +---------------------------------------------------------------------- - -function reset_session_path() -{ - $root = str_replace("\\", '/', dirname(__FILE__)); - $savePath = $root . "/tmp/"; - if (!file_exists($savePath)) - @mkdir($savePath, 0777); - session_save_path($savePath); -} - -//reset_session_path(); //如果您的服务器无法安装或者无法登陆,又或者后台验证码无限错误,请尝试取消本行起始两条左斜杠,让本行代码生效,以修改session存储的路径 - - -if (version_compare(PHP_VERSION, '5.3.0', '<')) die('require PHP > 5.3.0 !'); - -/*移除magic_quotes_gpc参数影响*/ -if (get_magic_quotes_gpc()) { - function stripslashes_deep($value) - { - $value = is_array($value) ? array_map('stripslashes_deep', $value) : stripslashes($value); - return $value; - } - - $_POST = array_map('stripslashes_deep', $_POST); - $_GET = array_map('stripslashes_deep', $_GET); - $_COOKIE = array_map('stripslashes_deep', $_COOKIE); - $_REQUEST = array_map('stripslashes_deep', $_REQUEST); -} -/*移除magic_quotes_gpc参数影响end*/ - - - - -/** - * 系统调试设置 - * 项目正式部署后请设置为false - */ -define ('APP_DEBUG', true); - -define ('APP_PATH', './Application/'); - -/** - * 主题目录 OpenCenter模板地址 (与ThinkPHP中的THEME_PATH不同) - * @author 郑钟良 - */ -define ('OS_THEME_PATH', './Theme/'); - -if (!is_file( 'Conf/user.php')) { - header('Location: ./install.php'); - exit; -} - -/** - * 缓存目录设置 - * 此目录必须可写,建议移动到非WEB目录 - */ -define ('RUNTIME_PATH', './Runtime/'); - -/** - * 引入核心入口 - * ThinkPHP亦可移动到WEB以外的目录 - */ -try{ - require './ThinkPHP/ThinkPHP.php'; -}catch (\Exception $exception){ - if($exception->getCode()==815){ - send_http_status(404); - $string=file_get_contents('./404.html'); - $string=str_replace('$ERROR_MESSAGE',$exception->getMessage(),$string); - $string=str_replace('HTTP_HOST','http://'.$_SERVER['HTTP_HOST'],$string); - echo $string; - }else{ - E($exception->getMessage(),$exception->getCode()); - } -} + +// +---------------------------------------------------------------------- + +function reset_session_path() +{ + $root = str_replace("\\", '/', dirname(__FILE__)); + $savePath = $root . "/tmp/"; + if (!file_exists($savePath)) + @mkdir($savePath, 0777); + session_save_path($savePath); +} + +//reset_session_path(); //如果您的服务器无法安装或者无法登陆,又或者后台验证码无限错误,请尝试取消本行起始两条左斜杠,让本行代码生效,以修改session存储的路径 + + +if (version_compare(PHP_VERSION, '5.3.0', '<')) die('require PHP > 5.3.0 !'); + +/*移除magic_quotes_gpc参数影响*/ +if (get_magic_quotes_gpc()) { + function stripslashes_deep($value) + { + $value = is_array($value) ? array_map('stripslashes_deep', $value) : stripslashes($value); + return $value; + } + + $_POST = array_map('stripslashes_deep', $_POST); + $_GET = array_map('stripslashes_deep', $_GET); + $_COOKIE = array_map('stripslashes_deep', $_COOKIE); + $_REQUEST = array_map('stripslashes_deep', $_REQUEST); +} +/*移除magic_quotes_gpc参数影响end*/ + + + + +/** + * 系统调试设置 + * 项目正式部署后请设置为false + */ +define ('APP_DEBUG', true); + +define ('APP_PATH', './Application/'); +define ('ADMIN_NAME','XX后台管理系统');//命名后台管理系统名称 +/** + * 主题目录 OpenCenter模板地址 (与ThinkPHP中的THEME_PATH不同) + * @author 郑钟良 + */ +define ('OS_THEME_PATH', './Theme/'); + +if (!is_file( 'Conf/user.php')) { + header('Location: ./install.php'); + exit; +} + +/** + * 缓存目录设置 + * 此目录必须可写,建议移动到非WEB目录 + */ +define ('RUNTIME_PATH', './Runtime/'); + +/** + * 引入核心入口 + * ThinkPHP亦可移动到WEB以外的目录 + */ +try{ + require './ThinkPHP/ThinkPHP.php'; +}catch (\Exception $exception){ + if($exception->getCode()==815){ + send_http_status(404); + $string=file_get_contents('./404.html'); + $string=str_replace('$ERROR_MESSAGE',$exception->getMessage(),$string); + $string=str_replace('HTTP_HOST','http://'.$_SERVER['HTTP_HOST'],$string); + echo $string; + }else{ + E($exception->getMessage(),$exception->getCode()); + } +} \ No newline at end of file -- Gitee From 372e129ee6bfe6dbaa7bb29af912e0a56e05aad4 Mon Sep 17 00:00:00 2001 From: unset Date: Tue, 13 Sep 2016 23:10:15 +0800 Subject: [PATCH 10/19] Update base.html --- .../Admin/View/default/Public/base.html | 744 +++++++++--------- 1 file changed, 372 insertions(+), 372 deletions(-) diff --git a/Application/Admin/View/default/Public/base.html b/Application/Admin/View/default/Public/base.html index 256a92d..6e8b393 100644 --- a/Application/Admin/View/default/Public/base.html +++ b/Application/Admin/View/default/Public/base.html @@ -1,372 +1,372 @@ - - - - - {$meta_title}|{:L('_SNS_BACKSTAGE_MANAGE_')} - - - - - - - - - - - - - - - - - - - - - - -
- - -
- -
- -
-
- - -
- -
- -
- - -
- - - - - - - $col=10; - - $col=12; - -
- -
-    {:L('_VERSION_UPDATE_',array('href'=> '' ))} - -
-
- -
- - - - - - - - -
- -
- -
-
-
-
-
- - - -if($report){ -
-
- 1 -
- - - - - - - - -} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + {$meta_title}|{:L('_SNS_BACKSTAGE_MANAGE_')} + + + + + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+ +
+
+ + +
+ +
+ +
+ + +
+ + + + + + + $col=10; + + $col=12; + +
+ +
+    {:L('_VERSION_UPDATE_',array('href'=> '' ))} + +
+
+ +
+ + + + + + + + +
+ +
+ +
+
+
+
+
+ + + +if($report){ +
+
+ 1 +
+ + + + + + + + +} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file -- Gitee From d05abe7cd5f1aad78718c795f717ed6f17126518 Mon Sep 17 00:00:00 2001 From: unset Date: Tue, 13 Sep 2016 23:15:48 +0800 Subject: [PATCH 11/19] Update base.html --- Application/Admin/View/default/Public/base.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Application/Admin/View/default/Public/base.html b/Application/Admin/View/default/Public/base.html index 6e8b393..2fa602c 100644 --- a/Application/Admin/View/default/Public/base.html +++ b/Application/Admin/View/default/Public/base.html @@ -2,7 +2,7 @@ - {$meta_title}|{:L('_SNS_BACKSTAGE_MANAGE_')} + {$meta_title} -- Gitee From e63d7ddbe920675d6963c2f9e06a1f97bbe186fd Mon Sep 17 00:00:00 2001 From: unset Date: Wed, 14 Sep 2016 03:30:36 +0800 Subject: [PATCH 12/19] Update exception.html --- .../Admin/View/default/Public/exception.html | 101 +++++++++--------- 1 file changed, 49 insertions(+), 52 deletions(-) diff --git a/Application/Admin/View/default/Public/exception.html b/Application/Admin/View/default/Public/exception.html index 5907145..88c6e92 100644 --- a/Application/Admin/View/default/Public/exception.html +++ b/Application/Admin/View/default/Public/exception.html @@ -1,53 +1,50 @@ - - - -系统发生错误 - - - -
-

:(

-

-
- -
-
-

错误地址:

-
-
-

FILE:  LINE:

-
-
- - -
-
-

TRACE

-
-
-

-
-
- -
-
- - + + + +系统发生错误 + + + +
+

:(

+

+
+ +
+
+

错误地址:

+
+
+

FILE:  LINE:

+
+
+ + +
+
+

TRACE

+
+
+

+
+
+ +
+
+ \ No newline at end of file -- Gitee From 1f62ad3fff90395395b203f19b3017323ed511d2 Mon Sep 17 00:00:00 2001 From: unset Date: Wed, 14 Sep 2016 11:50:46 +0800 Subject: [PATCH 13/19] Update AdminConfigBuilder.class.php --- .../Builder/AdminConfigBuilder.class.php | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/Application/Admin/Builder/AdminConfigBuilder.class.php b/Application/Admin/Builder/AdminConfigBuilder.class.php index b658fe8..6806936 100644 --- a/Application/Admin/Builder/AdminConfigBuilder.class.php +++ b/Application/Admin/Builder/AdminConfigBuilder.class.php @@ -71,6 +71,39 @@ class AdminConfigBuilder extends AdminBuilder { return $this->key($name, $title, $subtitle, 'hidden'); } + + /** + + * 级联选择组件 + + * @param string $name 字段名 + + * @param string $title 字段标题 + + * @param string $subtitle 字段子标题 + + * @param string $options 首个下拉框选项数组 + + * @param string $url ajax查询网址 + + * @param array $selects select标签信息(array('select标签id属性值'=>'option选中项的值')) + + * @return AdminConfigBuilder + + * @author swh + + */ + public function keyRelationSelect($name, $title, $subtitle = null, $options, $url = null, $selects = array()) { + if (empty($selects)) { + list($url, $selects) = explode('#', $url, 2); + parse_str($selects, $selects); + } + return $this->key($name, $title, $subtitle, 'relationSelect', array( + 'opt' => $options, + 'url' => $url, + 'selects' => $selects, + )); + } /**只读文本 * @param $name -- Gitee From ed27fbfe4b5f20b4d8e5dfe657061b7c837ba644 Mon Sep 17 00:00:00 2001 From: unset Date: Wed, 14 Sep 2016 11:54:05 +0800 Subject: [PATCH 14/19] Update _key.html --- .../Admin/View/default/Builder/_key.html | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Application/Admin/View/default/Builder/_key.html b/Application/Admin/View/default/Builder/_key.html index 435b0f5..ad13974 100644 --- a/Application/Admin/View/default/Builder/_key.html +++ b/Application/Admin/View/default/Builder/_key.html @@ -26,6 +26,28 @@ style="width: 400px" placeholder={:L("_NO_NEED_TO_FILL_IN_WITH_DOUBLE_")} readonly/>

{$field.value}

+ + + $url=$field['opt']['url']; + $elements=$field['opt']['selects']; + $firstSelectOpts=''; + foreach ($field['opt']['opt'] as $key => $value){ + $selected = $field['value']==$key ? ' selected' : ''; + $firstSelectOpts.=''; + } + + + + + + + -- Gitee From a33690f5adbdcbdff557b5dbced4fd939cf59d34 Mon Sep 17 00:00:00 2001 From: unset Date: Wed, 14 Sep 2016 13:44:08 +0800 Subject: [PATCH 15/19] Update _key.html --- Application/Admin/View/default/Builder/_key.html | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Application/Admin/View/default/Builder/_key.html b/Application/Admin/View/default/Builder/_key.html index ad13974..a535d0d 100644 --- a/Application/Admin/View/default/Builder/_key.html +++ b/Application/Admin/View/default/Builder/_key.html @@ -46,7 +46,12 @@ - + $ids = implode('","',array_keys($elements)); +