fix: nav
This commit is contained in:
@@ -52,12 +52,15 @@ class IndexController extends Controller
|
||||
$dbsecurity = true;
|
||||
// 如果是sqlite数据库,并且路径为默认的,则标记为不安全
|
||||
if (get_db_type() == 'sqlite') {
|
||||
// 数据库配置含有默认名字则进行修改
|
||||
if (strpos($this->config('database.dbname'), 'pbootcms') !== false) {
|
||||
if (get_user_ip() != '127.0.0.1' && $this->modDB()) { // 非本地测试时尝试自动修改数据库名称
|
||||
$dbsecurity = true;
|
||||
} else {
|
||||
$dbsecurity = false;
|
||||
}
|
||||
} elseif (file_exists(ROOT_PATH . '/data/pbootcms.db')) { // 存在多余的默认数据库文件则改名
|
||||
rename(ROOT_PATH . '/data/pbootcms.db', ROOT_PATH . '/data/' . get_uniqid() . '.db');
|
||||
}
|
||||
} elseif (file_exists(ROOT_PATH . '/data/pbootcms.db')) {
|
||||
rename(ROOT_PATH . '/data/pbootcms.db', ROOT_PATH . '/data/' . get_uniqid() . '.db');
|
||||
@@ -256,30 +259,34 @@ class IndexController extends Controller
|
||||
} else {
|
||||
$rs = (path_delete(RUN_PATH . '/cache') && path_delete(RUN_PATH . '/complile') && path_delete(RUN_PATH . '/config') && path_delete(RUN_PATH . '/upgrade') && path_delete(RUN_PATH . '/image'));
|
||||
}
|
||||
cache_config(); // 清理缓存后立即生成新的配置
|
||||
if ($rs) {
|
||||
if (extension_loaded('Zend OPcache')) {
|
||||
opcache_reset(); // 在启用了OPcache加速器时同时清理
|
||||
}
|
||||
$this->log('清理缓存成功!');
|
||||
alert_back('清理缓存成功!');
|
||||
alert_back('清理缓存成功!', 1);
|
||||
} else {
|
||||
$this->log('清理缓存失败!');
|
||||
alert_back('清理缓存失败!');
|
||||
alert_back('清理缓存失败!', 0);
|
||||
}
|
||||
}
|
||||
|
||||
// 清理会话
|
||||
public function clearSession()
|
||||
{
|
||||
$rs = path_delete(RUN_PATH . '/session');
|
||||
|
||||
if ($rs) {
|
||||
$this->log('清理会话成功!');
|
||||
alert_back('清理会话成功!');
|
||||
} else {
|
||||
$this->log('清理会话失败!');
|
||||
alert_back('清理会话失败!');
|
||||
}
|
||||
ignore_user_abort(true); // 后台运行
|
||||
set_time_limit(7200);
|
||||
ob_start();
|
||||
$output['code'] = 1;
|
||||
$output['data'] = '执行成功,后台自动清理中!';
|
||||
$output['tourl'] = '';
|
||||
echo json_encode($output);
|
||||
ob_end_flush();
|
||||
flush();
|
||||
$rs = path_delete(RUN_PATH . '/session', false, array(
|
||||
'sess_' . session_id()
|
||||
));
|
||||
}
|
||||
|
||||
// 文件上传方法
|
||||
|
||||
@@ -41,6 +41,8 @@ class ContentController extends Controller
|
||||
} else {
|
||||
$result = $this->model->findContentAll($mcode, get('keyword', 'vars'));
|
||||
}
|
||||
} elseif (! ! $scode = get('scode', 'int')) {
|
||||
$result = $this->model->findContent($mcode, $scode, '');
|
||||
} else {
|
||||
$result = $this->model->getList($mcode);
|
||||
}
|
||||
@@ -120,7 +122,7 @@ class ContentController extends Controller
|
||||
alert_back('文章标题不能为空!');
|
||||
}
|
||||
|
||||
if ($filename && ! preg_match('/^[a-zA-Z0-9\-]+$/', $filename)) {
|
||||
if ($filename && ! preg_match('/^[a-zA-Z0-9\-\/]+$/', $filename)) {
|
||||
alert_back('内容URL名称只允许字母、数字、横线组成!');
|
||||
}
|
||||
|
||||
@@ -129,6 +131,11 @@ class ContentController extends Controller
|
||||
$description = escape_string(clear_html_blank(substr_both(strip_tags($_POST['content']), 0, 150)));
|
||||
}
|
||||
|
||||
// 无缩略图时,自动提取文章第一张图为缩略图
|
||||
if (! $ico && preg_match('/<img\s+.*?src=\s?[\'|\"](.*?(\.gif|\.jpg|\.png|\.jpeg))[\'|\"].*?[\/]?>/i', decode_string($content), $srcs) && isset($srcs[1])) {
|
||||
$ico = $srcs[1];
|
||||
}
|
||||
|
||||
// 缩放缩略图
|
||||
if ($ico) {
|
||||
resize_img(ROOT_PATH . $ico, '', $this->config('ico.max_width'), $this->config('ico.max_height'));
|
||||
@@ -437,7 +444,7 @@ class ContentController extends Controller
|
||||
alert_back('文章标题不能为空!');
|
||||
}
|
||||
|
||||
if ($filename && ! preg_match('/^[a-zA-Z0-9\-]+$/', $filename)) {
|
||||
if ($filename && ! preg_match('/^[a-zA-Z0-9\-\/]+$/', $filename)) {
|
||||
alert_back('内容URL名称只允许字母、数字、横线组成!');
|
||||
}
|
||||
|
||||
@@ -446,6 +453,11 @@ class ContentController extends Controller
|
||||
$description = escape_string(clear_html_blank(substr_both(strip_tags($_POST['content']), 0, 150)));
|
||||
}
|
||||
|
||||
// 无缩略图时,自动提取文章第一张图为缩略图
|
||||
if (! $ico && preg_match('/<img\s+.*?src=\s?[\'|\"](.*?(\.gif|\.jpg|\.png|\.jpeg))[\'|\"].*?[\/]?>/i', decode_string($content), $srcs) && isset($srcs[1])) {
|
||||
$ico = $srcs[1];
|
||||
}
|
||||
|
||||
// 缩放缩略图
|
||||
if ($ico) {
|
||||
resize_img(ROOT_PATH . $ico, '', $this->config('ico.max_width'), $this->config('ico.max_height'));
|
||||
|
||||
@@ -66,29 +66,9 @@ class ContentSortController extends Controller
|
||||
foreach ($tree as $value) {
|
||||
$this->count ++;
|
||||
$this->outData[$this->count] = new \stdClass();
|
||||
$this->outData[$this->count]->id = $value->id;
|
||||
$this->outData[$this->count]->blank = $this->blank;
|
||||
$this->outData[$this->count]->name = $value->name;
|
||||
$this->outData[$this->count]->subname = $value->subname;
|
||||
$this->outData[$this->count]->scode = $value->scode;
|
||||
$this->outData[$this->count]->pcode = $value->pcode;
|
||||
$this->outData[$this->count]->mcode = $value->mcode;
|
||||
$this->outData[$this->count]->listtpl = $value->listtpl;
|
||||
$this->outData[$this->count]->contenttpl = $value->contenttpl;
|
||||
$this->outData[$this->count]->ico = $value->ico;
|
||||
$this->outData[$this->count]->pic = $value->pic;
|
||||
$this->outData[$this->count]->keywords = $value->keywords;
|
||||
$this->outData[$this->count]->description = $value->description;
|
||||
$this->outData[$this->count]->outlink = $value->outlink;
|
||||
$this->outData[$this->count]->sorting = $value->sorting;
|
||||
$this->outData[$this->count]->status = $value->status;
|
||||
$this->outData[$this->count]->filename = $value->filename;
|
||||
$this->outData[$this->count]->type = $value->type;
|
||||
$this->outData[$this->count]->urlname = $value->urlname;
|
||||
$this->outData[$this->count]->create_user = $value->create_user;
|
||||
$this->outData[$this->count]->update_user = $value->update_user;
|
||||
$this->outData[$this->count]->create_time = $value->create_time;
|
||||
$this->outData[$this->count]->update_time = $value->update_time;
|
||||
foreach ($value as $k => $v) {
|
||||
$this->outData[$this->count]->$k = $v;
|
||||
}
|
||||
|
||||
if ($value->son) {
|
||||
$this->outData[$this->count]->son = true;
|
||||
|
||||
@@ -101,6 +101,10 @@ class ExtFieldController extends Controller
|
||||
$mysql = 'TEXT';
|
||||
$sqlite = 'TEXT(10000)';
|
||||
break;
|
||||
case '10': // 多图
|
||||
$mysql = 'varchar(1000)';
|
||||
$sqlite = 'TEXT(1000)';
|
||||
break;
|
||||
default:
|
||||
$mysql = 'varchar(200)';
|
||||
$sqlite = 'TEXT(200)';
|
||||
|
||||
@@ -188,6 +188,11 @@ class SingleController extends Controller
|
||||
$description = escape_string(clear_html_blank(substr_both(strip_tags($_POST['content']), 0, 150)));
|
||||
}
|
||||
|
||||
// 无缩略图时,自动提取文章第一张图为缩略图
|
||||
if (! $ico && preg_match('/<img\s+.*?src=\s?[\'|\"](.*?(\.gif|\.jpg|\.png|\.jpeg))[\'|\"].*?[\/]?>/i', decode_string($content), $srcs) && isset($srcs[1])) {
|
||||
$ico = $srcs[1];
|
||||
}
|
||||
|
||||
// 缩放缩略图
|
||||
if ($ico) {
|
||||
resize_img(ROOT_PATH . $ico, '', $this->config('ico.max_width'), $this->config('ico.max_height'));
|
||||
|
||||
@@ -28,7 +28,7 @@ class ConfigController extends Controller
|
||||
if (! ! $action = get('action')) {
|
||||
switch ($action) {
|
||||
case 'sendemail':
|
||||
$rs = sendmail($this->config(), get('to'), '【PbootCMS】测试邮件', '欢迎您使用PbootCMS网站开发管理系统!');
|
||||
$rs = sendmail($this->config(), get('to'), '【' . CMSNAME . '】测试邮件', '欢迎您使用' . CMSNAME . '网站开发管理系统!');
|
||||
if ($rs === true) {
|
||||
alert_back('测试邮件发送成功!');
|
||||
} else {
|
||||
@@ -41,14 +41,17 @@ class ConfigController extends Controller
|
||||
// 修改参数配置
|
||||
if ($_POST) {
|
||||
unset($_POST['upload']); // 去除上传组件
|
||||
if (isset($_POST['sn'])) {
|
||||
$_POST['licensecode'] = base64_encode(post('sn') . '/' . post('sn_user')) . substr(post('sn'), 1, 1);
|
||||
}
|
||||
foreach ($_POST as $key => $value) {
|
||||
if (! preg_match('/^[\w\-]+$/', $key)) {
|
||||
continue;
|
||||
}
|
||||
$config = array(
|
||||
'debug',
|
||||
'sn',
|
||||
'sn_user',
|
||||
// 'sn',
|
||||
// 'sn_user',
|
||||
'pagenum',
|
||||
'tpl_html_cache',
|
||||
'tpl_html_cache_time',
|
||||
@@ -103,8 +106,10 @@ class ConfigController extends Controller
|
||||
}
|
||||
$configs = $this->model->getList();
|
||||
$configs['debug']['value'] = $this->config('debug');
|
||||
$configs['sn']['value'] = $this->config('sn');
|
||||
$configs['sn_user']['value'] = $this->config('sn_user');
|
||||
if (! $configs['sn']['value']) {
|
||||
$configs['sn']['value'] = $this->config('sn');
|
||||
$configs['sn_user']['value'] = $this->config('sn_user');
|
||||
}
|
||||
$configs['session_in_sitepath']['value'] = $this->config('session_in_sitepath');
|
||||
$configs['pagenum']['value'] = $this->config('pagenum');
|
||||
$configs['url_type']['value'] = $this->config('url_type');
|
||||
|
||||
@@ -214,7 +214,7 @@ class DatabaseController extends Controller
|
||||
$sql .= $brackets;
|
||||
$comma = "";
|
||||
for ($i = 0; $i < $fieldNnum; $i ++) {
|
||||
$sql .= ($comma . "'" . decode_string($value[$i]) . "'");
|
||||
$sql .= ($comma . "'" . addslashes(decode_string($value[$i])) . "'");
|
||||
$comma = ",";
|
||||
}
|
||||
$sql .= ")";
|
||||
|
||||
Reference in New Issue
Block a user