1、更换编辑器

2、seo优化功能
3、表单的bug
This commit is contained in:
2016-07-13 15:06:44 +08:00
parent 485690400b
commit 2dbbb20f20
301 changed files with 8380 additions and 129034 deletions

View File

@@ -57,7 +57,7 @@ class Build
foreach ($list as $dir) {
if (!is_dir(APP_PATH . $dir)) {
// 创建目录
mkdir(APP_PATH . $dir, 0777, true);
mkdir(APP_PATH . $dir, 0644, true);
}
}
}
@@ -73,7 +73,7 @@ class Build
foreach ($list as $file) {
if (!is_dir(APP_PATH . dirname($file))) {
// 创建目录
mkdir(APP_PATH . dirname($file), 0777, true);
mkdir(APP_PATH . dirname($file), 0644, true);
}
if (!is_file(APP_PATH . $file)) {
file_put_contents(APP_PATH . $file, 'php' == pathinfo($file, PATHINFO_EXTENSION) ? "<?php\n" : '');
@@ -118,7 +118,7 @@ class Build
foreach ($file as $dir) {
if (!is_dir($modulePath . $dir)) {
// 创建目录
mkdir($modulePath . $dir, 0777, true);
mkdir($modulePath . $dir, 0644, true);
}
}
} elseif ('__file__' == $path) {
@@ -146,7 +146,7 @@ class Build
$filename = $modulePath . $path . DS . $val . '.html';
if (!is_dir(dirname($filename))) {
// 创建目录
mkdir(dirname($filename), 0777, true);
mkdir(dirname($filename), 0644, true);
}
$content = '';
break;
@@ -178,7 +178,7 @@ class Build
$content = file_get_contents(THINK_PATH . 'tpl' . DS . 'default_index.tpl');
$content = str_replace(['{$app}', '{$module}', '{layer}', '{$suffix}'], [$namespace, $module ? $module . '\\' : '', 'controller', $suffix ? 'Controller' : ''], $content);
if (!is_dir(dirname($filename))) {
mkdir(dirname($filename), 0777, true);
mkdir(dirname($filename), 0644, true);
}
file_put_contents($filename, $content);
}

View File

@@ -79,7 +79,7 @@ class File extends SplFileObject
return true;
}
if (mkdir($path, 0777, true)) {
if (mkdir($path, 0644, true)) {
return true;
} else {
$this->error = "目录 {$path} 创建失败!";

View File

@@ -623,7 +623,7 @@ class Request
// 当前请求参数和URL地址中的参数合并
$this->param = array_merge($this->route(false), $this->get(false), $vars);
}
return false === $name ? $this->param : $this->input($this->param, $name, $default, $filter);
return $this->input($this->param, $name, $default, $filter);
}
/**
@@ -639,7 +639,7 @@ class Request
if (is_array($name)) {
return $this->route = array_merge($this->route, $name);
}
return false === $name ? $this->route : $this->input($this->route, $name, $default, $filter);
return $this->input($this->route, $name, $default, $filter);
}
/**
@@ -657,7 +657,7 @@ class Request
} elseif (empty($this->get)) {
$this->get = $_GET;
}
return false === $name ? $this->get : $this->input($this->get, $name, $default, $filter);
return $this->input($this->get, $name, $default, $filter);
}
/**
@@ -675,7 +675,7 @@ class Request
} elseif (empty($this->post)) {
$this->post = $_POST;
}
return false === $name ? $this->post : $this->input($this->post, $name, $default, $filter);
return $this->input($this->post, $name, $default, $filter);
}
/**
@@ -692,9 +692,14 @@ class Request
return $this->put = is_null($this->put) ? $name : array_merge($this->put, $name);
}
if (is_null($this->put)) {
parse_str(file_get_contents('php://input'), $this->put);
$content = file_get_contents('php://input');
if (strpos($content, '":')) {
$this->put = json_decode($content, true);
} else {
parse_str($content, $this->put);
}
}
return false === $name ? $this->put : $this->input($this->put, $name, $default, $filter);
return $this->input($this->put, $name, $default, $filter);
}
/**
@@ -713,7 +718,7 @@ class Request
if (is_null($this->delete)) {
parse_str(file_get_contents('php://input'), $this->delete);
}
return false === $name ? $this->delete : $this->input($this->delete, $name, $default, $filter);
return $this->input($this->delete, $name, $default, $filter);
}
/**
@@ -730,7 +735,7 @@ class Request
} elseif (empty($this->request)) {
$this->request = $_REQUEST;
}
return false === $name ? $this->request : $this->input($this->request ?: $_REQUEST, $name, $default, $filter);
return $this->input($this->request ?: $_REQUEST, $name, $default, $filter);
}
/**
@@ -748,7 +753,7 @@ class Request
} elseif (empty($this->session)) {
$this->session = Session::get();
}
return false === $name ? $this->session : $this->input($this->session, $name, $default, $filter);
return $this->input($this->session, $name, $default, $filter);
}
/**
@@ -766,7 +771,7 @@ class Request
} elseif (empty($this->cookie)) {
$this->cookie = $_COOKIE;
}
return false === $name ? $this->cookie : $this->input($this->cookie, $name, $default, $filter);
return $this->input($this->cookie, $name, $default, $filter);
}
/**
@@ -784,7 +789,7 @@ class Request
} elseif (empty($this->server)) {
$this->server = $_SERVER;
}
return false === $name ? $this->server : $this->input($this->server, $name, $default, $filter);
return $this->input($this->server, false === $name ? false : strtoupper($name), $default, $filter);
}
/**
@@ -804,44 +809,43 @@ class Request
if (!empty($files)) {
// 处理上传文件
$array = [];
$n = 0;
foreach ($files as $key => $file) {
if (is_array($file['name'])) {
$item = [];
$keys = array_keys($file);
$count = count($file['name']);
for ($i = 0; $i < $count; $i++) {
$array[$n]['key'] = $key;
foreach ($keys as $_key) {
$array[$n][$_key] = $file[$_key][$i];
}
$n++;
}
} else {
$array = $files;
break;
}
}
if ('' === $name) {
// 获取全部文件
$item = [];
foreach ($array as $key => $val) {
if ($val instanceof File) {
$item[$key] = $val;
} else {
if (empty($val['tmp_name'])) {
if (empty($file['tmp_name'][$i])) {
continue;
}
$item[$key] = (new File($val['tmp_name']))->setUploadInfo($val);
$temp['key'] = $key;
foreach ($keys as $_key) {
$temp[$_key] = $file[$_key][$i];
}
$item[] = (new File($temp['tmp_name']))->setUploadInfo($temp);
}
$array[$key] = $item;
} else {
if ($file instanceof File) {
$array[$key] = $file;
} else {
if (empty($file['tmp_name'])) {
continue;
}
$array[$key] = (new File($file['tmp_name']))->setUploadInfo($file);
}
}
return $item;
}
if (strpos($name, '.')) {
list($name, $sub) = explode('.', $name);
}
if ('' === $name) {
// 获取全部文件
return $array;
} elseif (isset($sub) && isset($array[$name][$sub])) {
return $array[$name][$sub];
} elseif (isset($array[$name])) {
if ($array[$name] instanceof File) {
return $array[$name];
} elseif (!empty($array[$name]['tmp_name'])) {
return (new File($array[$name]['tmp_name']))->setUploadInfo($array[$name]);
}
return $array[$name];
}
}
return null;
@@ -861,7 +865,7 @@ class Request
} elseif (empty($this->env)) {
$this->env = $_ENV;
}
return false === $name ? $this->env : $this->input($this->env, strtoupper($name), $default, $filter);
return $this->input($this->env, false === $name ? false : strtoupper($name), $default, $filter);
}
/**
@@ -902,13 +906,17 @@ class Request
/**
* 获取变量 支持过滤和默认值
* @param array $data 数据源
* @param string $name 字段名
* @param string|false $name 字段名
* @param mixed $default 默认值
* @param string|array $filter 过滤函数
* @return mixed
*/
public function input($data = [], $name = '', $default = null, $filter = null)
{
if (false === $name) {
// 获取原始数据
return $data;
}
$name = (string) $name;
if ('' != $name) {
// 解析name

View File

@@ -0,0 +1,174 @@
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: weianguo <366958903@qq.com>
// +----------------------------------------------------------------------
namespace think\db\connector;
use PDO;
use think\db\Connection;
use think\Log;
use think\Db;
use think\Exception;
use think\exception\PDOException;
/**
* firebird数据库驱动
*/
class Firebird extends Connection
{
/**
* 解析pdo连接的dsn信息
* @access public
* @param array $config 连接信息
* @return string
*/
protected function parseDsn($config)
{
$dsn = 'firebird:dbname=' . $config['hostname'].'/'.$config['hostport'].':'.$config['database'];
return $dsn;
}
/**
* 取得数据表的字段信息
* @access public
* @param string $tableName
* @return array
*/
public function getFields($tableName)
{
$this->initConnect(true);
list($tableName) = explode(' ', $tableName);
$sql= 'SELECT TRIM(RF.RDB$FIELD_NAME) AS FIELD,RF.RDB$DEFAULT_VALUE AS DEFAULT1,RF.RDB$NULL_FLAG AS NULL1,TRIM(T.RDB$TYPE_NAME) || \'(\' || F.RDB$FIELD_LENGTH || \')\' as TYPE FROM RDB$RELATION_FIELDS RF LEFT JOIN RDB$FIELDS F ON (F.RDB$FIELD_NAME = RF.RDB$FIELD_SOURCE) LEFT JOIN RDB$TYPES T ON (T.RDB$TYPE = F.RDB$FIELD_TYPE) WHERE RDB$RELATION_NAME=UPPER(\'' . $tableName . '\') AND T.RDB$FIELD_NAME = \'RDB$FIELD_TYPE\' ORDER By RDB$FIELD_POSITION';
$result = $this->linkID->query($sql);
$info = [];
if ($result) {
foreach ($result as $key => $val) {
$info[$val[0]] = array(
'name' => $val[0],
'type' => $val[3],
'notnull' => ($val[2]==1),
'default' => $val[1],
'primary' => false,
'autoinc' => false,
);
}
}
//获取主键
$sql = 'select TRIM(b.rdb$field_name) as field_name from rdb$relation_constraints a join rdb$index_segments b on a.rdb$index_name=b.rdb$index_name where a.rdb$constraint_type=\'PRIMARY KEY\' and a.rdb$relation_name=UPPER(\'' . $tableName . '\')';
$rs_temp = $this->linkID->query($sql);
foreach ($rs_temp as $row) {
$info[$row[0]]['primary'] = true;
}
return $this->fieldCase($info);
}
/**
* 取得数据库的表信息
* @access public
* @param string $dbName
* @return array
*/
public function getTables($dbName = '')
{
$sql = 'SELECT DISTINCT RDB$RELATION_NAME FROM RDB$RELATION_FIELDS WHERE RDB$SYSTEM_FLAG=0';
$result = $this->query($sql);
$info = [];
foreach ($result as $key => $val) {
$info[$key] = trim(current($val));
}
return $info;
}
/**
* 执行语句
* @access public
* @param string $sql sql指令
* @param array $bind 参数绑定
* @param boolean $getLastInsID 是否获取自增ID
* @param string $sequence 自增序列名
* @return int
* @throws BindParamException
* @throws PDOException
*/
public function execute($sql, $bind = [], $getLastInsID = false, $sequence = null)
{
$this->initConnect(true);
if (!$this->linkID) {
return false;
}
// 根据参数绑定组装最终的SQL语句
$this->queryStr = $this->getRealSql($sql, $bind);
//释放前次的查询结果
if (!empty($this->PDOStatement)) {
$this->free();
}
$bind=array_map(function($v){
return array_map(function($v2){
return mb_convert_encoding($v2,'gbk','utf-8');},$v);
},$bind);
Db::$executeTimes++;
try {
// 调试开始
$this->debug(true);
// 预处理
$this->PDOStatement = $this->linkID->prepare(mb_convert_encoding($sql,'gbk','utf-8'));
// 参数绑定操作
$this->bindValue($bind);
// 执行语句
$result = $this->PDOStatement->execute();
// 调试结束
$this->debug(false);
$this->numRows = $this->PDOStatement->rowCount();
return $this->numRows;
} catch (\PDOException $e) {
throw new PDOException($e, $this->config, $this->queryStr);
}
}
/**
* 启动事务
* @access public
* @return bool|null
*/
public function startTrans()
{
$this->initConnect(true);
if (!$this->linkID) {
return false;
}
++$this->transTimes;
if (1 == $this->transTimes) {
$this->linkID->setAttribute(\PDO::ATTR_AUTOCOMMIT,false);
$this->linkID->beginTransaction();
} elseif ($this->transTimes > 1 && $this->supportSavepoint()) {
$this->linkID->exec(
$this->parseSavepoint('trans' . $this->transTimes)
);
}
}
/**
* SQL性能分析
* @access protected
* @param string $sql
* @return array
*/
protected function getExplain($sql)
{
return [];
}
}

View File

@@ -26,7 +26,7 @@ class File
// 检测模板目录
$dir = dirname($cacheFile);
if (!is_dir($dir)) {
mkdir($dir, 0777, true);
mkdir($dir, 0644, true);
}
// 生成模板缓存文件
if (false === file_put_contents($cacheFile, $content)) {