内核更新
This commit is contained in:
25
README.md
25
README.md
@@ -1,6 +1,18 @@
|
|||||||
## SentCMS介绍
|
## SentCMS介绍
|
||||||
> SentCMS网站管理系统是南昌腾速科技有限公司倾力打造的一款简单易用的网站管理系统,SentCMS网站管理系统(下文简称SentCMS)继承了thinkphp5.0的优秀品质,秉承“大道至简”的设计理念。SnetCMS为网站建设而生,为网站建设减少90%的代码编写,只需前端设计师就可以设计出完美的网站,而如此完美的系统还是完全开源的。
|
> SentCMS网站管理系统是南昌腾速科技有限公司倾力打造的一款简单易用的网站管理系统,SentCMS网站管理系统(下文简称SentCMS)继承了thinkphp5.0的优秀品质,秉承“大道至简”的设计理念。SnetCMS为网站建设而生,为网站建设减少90%的代码编写,只需前端设计师就可以设计出完美的网站,而如此完美的系统还是完全开源的。
|
||||||
|
|
||||||
|
## 安装
|
||||||
|
|
||||||
|
目前暂无安装文件,可按以下方法安装:
|
||||||
|
|
||||||
|
* 第一步、修改数据库配置文件 application/database.php
|
||||||
|
* 第二步、通过数据库导入工具,比如phpmyadmin导入数据,数据sql文件data/sql.sql
|
||||||
|
* 第三步、登录后台,后台地址 http://域名/admin
|
||||||
|
|
||||||
|
> 系统必须开启伪静态
|
||||||
|
|
||||||
|
初始账号:admin,密码:admin888
|
||||||
|
|
||||||
## SentCMS特性包括:
|
## SentCMS特性包括:
|
||||||
* 全新的路由体系,完美的路由解决方案
|
* 全新的路由体系,完美的路由解决方案
|
||||||
* 全新的系统架构,采用thinkphp5.0内核框架
|
* 全新的系统架构,采用thinkphp5.0内核框架
|
||||||
@@ -48,7 +60,6 @@
|
|||||||
│ ├─ueditor.json 编辑配置文件
|
│ ├─ueditor.json 编辑配置文件
|
||||||
├─core thinkphp框架目录
|
├─core thinkphp框架目录
|
||||||
├─data 缓存以及备份目录
|
├─data 缓存以及备份目录
|
||||||
├─extend 扩展类库目录(后期可能会变更目录)
|
|
||||||
├─public 公共资源库
|
├─public 公共资源库
|
||||||
├─uploads 上传文件目录
|
├─uploads 上传文件目录
|
||||||
├─.htaccess Apache下伪静态文件
|
├─.htaccess Apache下伪静态文件
|
||||||
@@ -56,15 +67,3 @@
|
|||||||
├─index.php 入口文件
|
├─index.php 入口文件
|
||||||
├─README.md 系统介绍文件
|
├─README.md 系统介绍文件
|
||||||
~~~
|
~~~
|
||||||
|
|
||||||
## 安装
|
|
||||||
|
|
||||||
目前暂无安装文件,可按以下方法安装:
|
|
||||||
|
|
||||||
* 第一步、修改数据库配置文件 application/database.php
|
|
||||||
* 第二步、通过数据库导入工具,比如phpmyadmin导入数据,数据sql文件data/sql.sql
|
|
||||||
* 第三步、登录后台,后台地址 http://域名/admin
|
|
||||||
|
|
||||||
> 系统必须开启伪静态
|
|
||||||
|
|
||||||
初始账号:admin,密码:admin888
|
|
||||||
@@ -17,9 +17,9 @@ return array(
|
|||||||
// 数据库名
|
// 数据库名
|
||||||
'database' => 'sentcms_www',
|
'database' => 'sentcms_www',
|
||||||
// 数据库用户名
|
// 数据库用户名
|
||||||
'username' => 'root',
|
'username' => 'sentcms_www',
|
||||||
// 数据库密码
|
// 数据库密码
|
||||||
'password' => 'nitbbs_org',
|
'password' => '',
|
||||||
// 数据库连接端口
|
// 数据库连接端口
|
||||||
'hostport' => '',
|
'hostport' => '',
|
||||||
// 数据库连接参数
|
// 数据库连接参数
|
||||||
|
|||||||
@@ -238,8 +238,9 @@ class App
|
|||||||
foreach ($params as $param) {
|
foreach ($params as $param) {
|
||||||
$name = $param->getName();
|
$name = $param->getName();
|
||||||
$class = $param->getClass();
|
$class = $param->getClass();
|
||||||
if ($class && 'think\Request' == $class->getName()) {
|
if ($class) {
|
||||||
$args[] = Request::instance();
|
$className = $class->getName();
|
||||||
|
$args[] = method_exists($className, 'instance') ? $className::instance() : new $className();
|
||||||
} elseif (1 == $type && !empty($vars)) {
|
} elseif (1 == $type && !empty($vars)) {
|
||||||
$args[] = array_shift($vars);
|
$args[] = array_shift($vars);
|
||||||
} elseif (0 == $type && isset($vars[$name])) {
|
} elseif (0 == $type && isset($vars[$name])) {
|
||||||
@@ -465,7 +466,7 @@ class App
|
|||||||
*/
|
*/
|
||||||
public static function routeCheck($request, array $config)
|
public static function routeCheck($request, array $config)
|
||||||
{
|
{
|
||||||
$path = $request->path();
|
$path = rtrim($request->path(), '/');
|
||||||
$depr = $config['pathinfo_depr'];
|
$depr = $config['pathinfo_depr'];
|
||||||
$result = false;
|
$result = false;
|
||||||
// 路由检测
|
// 路由检测
|
||||||
|
|||||||
@@ -195,12 +195,23 @@ class File extends SplFileObject
|
|||||||
{
|
{
|
||||||
$extension = strtolower(pathinfo($this->getInfo('name'), PATHINFO_EXTENSION));
|
$extension = strtolower(pathinfo($this->getInfo('name'), PATHINFO_EXTENSION));
|
||||||
/* 对图像文件进行严格检测 */
|
/* 对图像文件进行严格检测 */
|
||||||
if (in_array($extension, ['gif', 'jpg', 'jpeg', 'bmp', 'png', 'swf']) && !in_array(exif_imagetype($this->filename), [1, 2, 3, 4, 6])) {
|
if (in_array($extension, ['gif', 'jpg', 'jpeg', 'bmp', 'png', 'swf']) && !in_array($this->getImageType($this->filename), [1, 2, 3, 4, 6])) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 判断图像类型
|
||||||
|
protected function getImageType($image)
|
||||||
|
{
|
||||||
|
if (function_exists('exif_imagetype')) {
|
||||||
|
return exif_imagetype($image);
|
||||||
|
} else {
|
||||||
|
$info = getimagesize($image);
|
||||||
|
return $info[2];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 检测上传文件大小
|
* 检测上传文件大小
|
||||||
* @param integer $size 最大大小
|
* @param integer $size 最大大小
|
||||||
|
|||||||
@@ -187,7 +187,6 @@ class Loader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 添加Psr4空间
|
// 添加Psr4空间
|
||||||
private static function addPsr4($prefix, $paths, $prepend = false)
|
private static function addPsr4($prefix, $paths, $prepend = false)
|
||||||
{
|
{
|
||||||
@@ -227,7 +226,6 @@ class Loader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 注册命名空间别名
|
// 注册命名空间别名
|
||||||
public static function addNamespaceAlias($namespace, $original = '')
|
public static function addNamespaceAlias($namespace, $original = '')
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1093,7 +1093,7 @@ class Route
|
|||||||
foreach ($matches[1] as $name) {
|
foreach ($matches[1] as $name) {
|
||||||
if (strpos($name, '?')) {
|
if (strpos($name, '?')) {
|
||||||
$name = substr($name, 0, -1);
|
$name = substr($name, 0, -1);
|
||||||
$replace[] = '((' . (isset($pattern[$name]) ? $pattern[$name] : '') . ')?)';
|
$replace[] = '(' . (isset($pattern[$name]) ? $pattern[$name] : '') . '?)';
|
||||||
} else {
|
} else {
|
||||||
$replace[] = '(' . (isset($pattern[$name]) ? $pattern[$name] : '') . ')';
|
$replace[] = '(' . (isset($pattern[$name]) ? $pattern[$name] : '') . ')';
|
||||||
}
|
}
|
||||||
@@ -1113,10 +1113,16 @@ class Route
|
|||||||
if (0 === strpos($val, '[:')) {
|
if (0 === strpos($val, '[:')) {
|
||||||
// 可选参数
|
// 可选参数
|
||||||
$val = substr($val, 1, -1);
|
$val = substr($val, 1, -1);
|
||||||
|
$optional = true;
|
||||||
|
} else {
|
||||||
|
$optional = false;
|
||||||
}
|
}
|
||||||
if (0 === strpos($val, ':')) {
|
if (0 === strpos($val, ':')) {
|
||||||
// URL变量
|
// URL变量
|
||||||
$name = substr($val, 1);
|
$name = substr($val, 1);
|
||||||
|
if (!$optional && !isset($m1[$key])) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (isset($m1[$key]) && isset($pattern[$name]) && !preg_match('/^' . $pattern[$name] . '$/', $m1[$key])) {
|
if (isset($m1[$key]) && isset($pattern[$name]) && !preg_match('/^' . $pattern[$name] . '$/', $m1[$key])) {
|
||||||
// 检查变量规则
|
// 检查变量规则
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -19,6 +19,9 @@ use think\Route;
|
|||||||
|
|
||||||
class Url
|
class Url
|
||||||
{
|
{
|
||||||
|
// 生成URL地址的root
|
||||||
|
protected static $root;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* URL生成 支持路由反射
|
* URL生成 支持路由反射
|
||||||
* @param string $url URL表达式,
|
* @param string $url URL表达式,
|
||||||
@@ -113,7 +116,7 @@ class Url
|
|||||||
// 检测域名
|
// 检测域名
|
||||||
$domain = self::parseDomain($url, $domain);
|
$domain = self::parseDomain($url, $domain);
|
||||||
// URL组装
|
// URL组装
|
||||||
$url = $domain . Request::instance()->root() . '/' . ltrim($url, '/');
|
$url = $domain . (self::$root ?: Request::instance()->root()) . '/' . ltrim($url, '/');
|
||||||
return $url;
|
return $url;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -316,4 +319,11 @@ class Url
|
|||||||
{
|
{
|
||||||
Cache::rm('think_route_map');
|
Cache::rm('think_route_map');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 指定当前生成URL地址的root
|
||||||
|
public static function root($root)
|
||||||
|
{
|
||||||
|
self::$root = $root;
|
||||||
|
Request::instance()->root($root);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -561,7 +561,7 @@ class Validate
|
|||||||
$result = $value instanceof \think\File;
|
$result = $value instanceof \think\File;
|
||||||
break;
|
break;
|
||||||
case 'image':
|
case 'image':
|
||||||
$result = $value instanceof \think\File && in_array(exif_imagetype($value->getRealPath()), [1, 2, 3, 6]);
|
$result = $value instanceof \think\File && in_array($this->getImageType($value->getRealPath()), [1, 2, 3, 6]);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (isset(self::$type[$rule])) {
|
if (isset(self::$type[$rule])) {
|
||||||
@@ -575,6 +575,17 @@ class Validate
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 判断图像类型
|
||||||
|
protected function getImageType($image)
|
||||||
|
{
|
||||||
|
if (function_exists('exif_imagetype')) {
|
||||||
|
return exif_imagetype($image);
|
||||||
|
} else {
|
||||||
|
$info = getimagesize($image);
|
||||||
|
return $info[2];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 验证是否为合格的域名或者IP 支持A,MX,NS,SOA,PTR,CNAME,AAAA,A6, SRV,NAPTR,TXT 或者 ANY类型
|
* 验证是否为合格的域名或者IP 支持A,MX,NS,SOA,PTR,CNAME,AAAA,A6, SRV,NAPTR,TXT 或者 ANY类型
|
||||||
* @access protected
|
* @access protected
|
||||||
@@ -699,7 +710,7 @@ class Validate
|
|||||||
if ('jpeg' == $imageType) {
|
if ('jpeg' == $imageType) {
|
||||||
$imageType = 'jpg';
|
$imageType = 'jpg';
|
||||||
}
|
}
|
||||||
if (image_type_to_extension($type) != $imageType) {
|
if (image_type_to_extension($type, false) != $imageType) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -284,7 +284,7 @@ abstract class Connection
|
|||||||
if ($this->linkID) {
|
if ($this->linkID) {
|
||||||
return $this->linkID->getAttribute(PDO::ATTR_DRIVER_NAME);
|
return $this->linkID->getAttribute(PDO::ATTR_DRIVER_NAME);
|
||||||
} else {
|
} else {
|
||||||
return basename(str_replace('\\', '/', $this->config['type']));
|
return $this->config['type'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -359,7 +359,7 @@ class Query
|
|||||||
static $builder = [];
|
static $builder = [];
|
||||||
$driver = $this->driver;
|
$driver = $this->driver;
|
||||||
if (!isset($builder[$driver])) {
|
if (!isset($builder[$driver])) {
|
||||||
$class = '\\think\\db\\builder\\' . ucfirst($driver);
|
$class = false !== strpos($driver, '\\') ? $driver : '\\think\\db\\builder\\' . ucfirst($driver);
|
||||||
$builder[$driver] = new $class($this->connection);
|
$builder[$driver] = new $class($this->connection);
|
||||||
}
|
}
|
||||||
// 设置当前查询对象
|
// 设置当前查询对象
|
||||||
|
|||||||
Reference in New Issue
Block a user