fix: nav
This commit is contained in:
@@ -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'));
|
||||
|
||||
Reference in New Issue
Block a user