代码格式化
This commit is contained in:
@@ -64,9 +64,11 @@ class Addons extends Base{
|
|||||||
final public function checkInfo() {
|
final public function checkInfo() {
|
||||||
$info_check_keys = array('name', 'title', 'description', 'status', 'author', 'version');
|
$info_check_keys = array('name', 'title', 'description', 'status', 'author', 'version');
|
||||||
foreach ($info_check_keys as $value) {
|
foreach ($info_check_keys as $value) {
|
||||||
if(!array_key_exists($value, $this->info))
|
if (!array_key_exists($value, $this->info)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -103,7 +105,6 @@ class Addons extends Base{
|
|||||||
return $config;
|
return $config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取插件所需的钩子是否存在,没有则新增
|
* 获取插件所需的钩子是否存在,没有则新增
|
||||||
* @param string $str 钩子名称
|
* @param string $str 钩子名称
|
||||||
|
|||||||
@@ -8,8 +8,8 @@
|
|||||||
// +----------------------------------------------------------------------
|
// +----------------------------------------------------------------------
|
||||||
|
|
||||||
namespace app\common\controller;
|
namespace app\common\controller;
|
||||||
use app\common\model\AuthRule;
|
|
||||||
use app\common\model\AuthGroup;
|
use app\common\model\AuthGroup;
|
||||||
|
use app\common\model\AuthRule;
|
||||||
|
|
||||||
class Admin extends Base {
|
class Admin extends Base {
|
||||||
|
|
||||||
@@ -127,7 +127,8 @@ class Admin extends Base{
|
|||||||
$where['pid'] = 0;
|
$where['pid'] = 0;
|
||||||
$where['hide'] = 0;
|
$where['hide'] = 0;
|
||||||
$where['type'] = 'admin';
|
$where['type'] = 'admin';
|
||||||
if(!config('develop_mode')){ // 是否开发者模式
|
if (!config('develop_mode')) {
|
||||||
|
// 是否开发者模式
|
||||||
$where['is_dev'] = 0;
|
$where['is_dev'] = 0;
|
||||||
}
|
}
|
||||||
$row = db('menu')->field('id,title,url,icon,"" as style')->where($where)->select();
|
$row = db('menu')->field('id,title,url,icon,"" as style')->where($where)->select();
|
||||||
@@ -196,7 +197,6 @@ class Admin extends Base{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected function getAddonsMenu() {
|
protected function getAddonsMenu() {
|
||||||
$model = db('Addons');
|
$model = db('Addons');
|
||||||
$list = array();
|
$list = array();
|
||||||
|
|||||||
@@ -55,9 +55,11 @@ class Base extends \think\Controller{
|
|||||||
* @param string $tablepre 自己的前缀
|
* @param string $tablepre 自己的前缀
|
||||||
* @return multitype:string 返回最终需要的sql语句
|
* @return multitype:string 返回最终需要的sql语句
|
||||||
*/
|
*/
|
||||||
public function sql_split($sql, $tablepre) {
|
public function sqlSplit($sql, $tablepre) {
|
||||||
if ($tablepre != "sent_")
|
if ($tablepre != "sent_") {
|
||||||
$sql = str_replace("sent_", $tablepre, $sql);
|
$sql = str_replace("sent_", $tablepre, $sql);
|
||||||
|
}
|
||||||
|
|
||||||
$sql = preg_replace("/TYPE=(InnoDB|MyISAM|MEMORY)( DEFAULT CHARSET=[^; ]+)?/", "ENGINE=\\1 DEFAULT CHARSET=utf8", $sql);
|
$sql = preg_replace("/TYPE=(InnoDB|MyISAM|MEMORY)( DEFAULT CHARSET=[^; ]+)?/", "ENGINE=\\1 DEFAULT CHARSET=utf8", $sql);
|
||||||
|
|
||||||
if ($r_tablepre != $s_tablepre) {
|
if ($r_tablepre != $s_tablepre) {
|
||||||
@@ -73,9 +75,11 @@ class Base extends \think\Controller{
|
|||||||
$queries = array_filter($queries);
|
$queries = array_filter($queries);
|
||||||
foreach ($queries as $query) {
|
foreach ($queries as $query) {
|
||||||
$str1 = substr($query, 0, 1);
|
$str1 = substr($query, 0, 1);
|
||||||
if ($str1 != '#' && $str1 != '-')
|
if ($str1 != '#' && $str1 != '-') {
|
||||||
$ret[$num] .= $query;
|
$ret[$num] .= $query;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
$num++;
|
$num++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -105,8 +109,6 @@ class Base extends \think\Controller{
|
|||||||
$this->assign($data);
|
$this->assign($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 验证码
|
* 验证码
|
||||||
* @param integer $id 验证码ID
|
* @param integer $id 验证码ID
|
||||||
|
|||||||
@@ -11,6 +11,9 @@ namespace app\common\controller;
|
|||||||
|
|
||||||
class Upload {
|
class Upload {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上传控制器
|
||||||
|
*/
|
||||||
public function upload() {
|
public function upload() {
|
||||||
$upload_type = input('get.filename', 'images', 'trim');
|
$upload_type = input('get.filename', 'images', 'trim');
|
||||||
$config = $this->$upload_type();
|
$config = $this->$upload_type();
|
||||||
@@ -61,7 +64,7 @@ class Upload {
|
|||||||
$file = request()->file('upload_file');
|
$file = request()->file('upload_file');
|
||||||
$info = $file->move(config('editor_upload.rootPath'), true, false);
|
$info = $file->move(config('editor_upload.rootPath'), true, false);
|
||||||
if ($info) {
|
if ($info) {
|
||||||
$data = $this->parse_file($info);
|
$data = $this->parseFile($info);
|
||||||
$data['success'] = true;
|
$data['success'] = true;
|
||||||
$data['file_path'] = $data['url'];
|
$data['file_path'] = $data['url'];
|
||||||
} else {
|
} else {
|
||||||
@@ -84,7 +87,7 @@ class Upload {
|
|||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
public function save($config, $type, $file) {
|
public function save($config, $type, $file) {
|
||||||
$file = $this->parse_file($file);
|
$file = $this->parseFile($file);
|
||||||
$file['status'] = 1;
|
$file['status'] = 1;
|
||||||
$dbname = ($type == 'images') ? 'picture' : 'file';
|
$dbname = ($type == 'images') ? 'picture' : 'file';
|
||||||
$id = db($dbname)->insertGetId($file);
|
$id = db($dbname)->insertGetId($file);
|
||||||
@@ -113,7 +116,8 @@ class Upload {
|
|||||||
header("Content-Description: File Transfer");
|
header("Content-Description: File Transfer");
|
||||||
header('Content-type: ' . $file['type']);
|
header('Content-type: ' . $file['type']);
|
||||||
header('Content-Length:' . $file['size']);
|
header('Content-Length:' . $file['size']);
|
||||||
if (preg_match('/MSIE/', $_SERVER['HTTP_USER_AGENT'])) { //for IE
|
if (preg_match('/MSIE/', $_SERVER['HTTP_USER_AGENT'])) {
|
||||||
|
//for IE
|
||||||
header('Content-Disposition: attachment; filename="' . rawurlencode($file['name']) . '"');
|
header('Content-Disposition: attachment; filename="' . rawurlencode($file['name']) . '"');
|
||||||
} else {
|
} else {
|
||||||
header('Content-Disposition: attachment; filename="' . $file['name'] . '"');
|
header('Content-Disposition: attachment; filename="' . $file['name'] . '"');
|
||||||
@@ -126,7 +130,7 @@ class Upload {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function parse_file($info){
|
protected function parseFile($info) {
|
||||||
$data['create_time'] = $info->getATime(); //最后访问时间
|
$data['create_time'] = $info->getATime(); //最后访问时间
|
||||||
$data['savename'] = $info->getBasename(); //获取无路径的basename
|
$data['savename'] = $info->getBasename(); //获取无路径的basename
|
||||||
$data['c_time'] = $info->getCTime(); //获取inode修改时间
|
$data['c_time'] = $info->getCTime(); //获取inode修改时间
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<div id="picker_{$field}" class="picker_button">上传文件</div>
|
<div id="picker_{$field}" class="picker_button">上传文件</div>
|
||||||
<input type="hidden" name="{$field}" id="field_{$field}" value="{$value|default=''}">
|
<input type="hidden" name="{$field}" id="field_{$field}" value="{$value|default=''}">
|
||||||
<div id="fileList_{$field}" class="upload-file-list-info" style="width:280px;">
|
<div id="fileList_{$field}" class="upload-file-list-info" style="width:280px;">
|
||||||
{if isset($value)}
|
{if isset($value) && $value}
|
||||||
<li class="affix-list-item" id="WU_FILE_0">
|
<li class="affix-list-item" id="WU_FILE_0">
|
||||||
<div class="upload-file-info">
|
<div class="upload-file-info">
|
||||||
<span class="webuploader-pick-file-close" data-queued-id="WU_FILE_0" data-id="{$value}" data-fileurl="{$value|get_file=###,"savename"}"><i class="close"></i></span>
|
<span class="webuploader-pick-file-close" data-queued-id="WU_FILE_0" data-id="{$value}" data-fileurl="{$value|get_file=###,"savename"}"><i class="close"></i></span>
|
||||||
|
|||||||
@@ -1,4 +1,12 @@
|
|||||||
<?php
|
<?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\widget;
|
namespace app\common\widget;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,4 +1,12 @@
|
|||||||
<?php
|
<?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\widget;
|
namespace app\common\widget;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -21,7 +29,7 @@ class Form {
|
|||||||
'field' => isset($field['name']) ? $field['name'] : '',
|
'field' => isset($field['name']) ? $field['name'] : '',
|
||||||
'value' => isset($info[$field['name']]) ? $info[$field['name']] : '',
|
'value' => isset($info[$field['name']]) ? $info[$field['name']] : '',
|
||||||
'size' => isset($field['size']) ? $field['size'] : 12,
|
'size' => isset($field['size']) ? $field['size'] : 12,
|
||||||
'option' =>isset($field['option']) ? $field['option'] : ''
|
'option' => isset($field['option']) ? $field['option'] : '',
|
||||||
);
|
);
|
||||||
$no_tem = array('readonly', 'text', 'password', 'textarea', 'select', 'bind', 'checkbox', 'radio', 'num', 'bool', 'decimal');
|
$no_tem = array('readonly', 'text', 'password', 'textarea', 'select', 'bind', 'checkbox', 'radio', 'num', 'bool', 'decimal');
|
||||||
$type = !in_array($type, $no_tem) ? $type : 'show';
|
$type = !in_array($type, $no_tem) ? $type : 'show';
|
||||||
|
|||||||
Reference in New Issue
Block a user