1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
| diff --git a/include/controller/api_controller.php b/include/controller/api_controller.php old mode 100644 new mode 100755 index 8a6bb1e8..349d205f --- a/include/controller/api_controller.php +++ b/include/controller/api_controller.php @@ -132,8 +132,8 @@ class Api_Controller 'hide' => $draft === 'y' ? 'y' : 'n', 'checked' => $checked, 'alias' => $alias, - 'top ' => $top, - 'sortop ' => $sortop, + 'top' => $top, + 'sortop' => $sortop, 'allow_remark' => $allow_remark, 'password' => $password, 'link' => $link, @@ -164,6 +164,13 @@ class Api_Controller $tags = strip_tags(Input::postStrVar('tags')); $author_uid = Input::postIntVar('author_uid', 1); $draft = Input::postStrVar('draft', 'n'); + $alias = Input::postStrVar('alias'); + $top = Input::postStrVar('top', 'n'); + $sortop = Input::postStrVar('sortop', 'n'); + $allow_remark = Input::postStrVar('allow_remark', 'n'); + $password = Input::postStrVar('password'); + $link = Input::postStrVar('link'); + $template = Input::postStrVar('template'); $field_keys = Input::postStrArray('field_keys'); $field_values = Input::postStrArray('field_values'); @@ -173,19 +180,35 @@ class Api_Controller Output::error('parameter error'); } + // 检查文章别名 + if (!preg_match('/^[a-zA-Z0-9_-]+$/', $alias)) { + $alias = ''; + } + if (!empty($alias)) { + $logalias_cache = $this->Cache->readCache('logalias'); + $alias = $this->Log_Model->checkAlias($alias, $logalias_cache, $id); + } + if ($this->curUid) { $author_uid = $this->curUid; } $logData = [ - 'title' => $title, - 'content' => $content, - 'excerpt' => $excerpt, - 'sortid' => $sort_id, - 'cover' => $cover, - 'author' => $author_uid, - 'date' => strtotime($post_date ?: date('Y-m-d H:i:s')), - 'hide' => $draft === 'y' ? 'y' : 'n', + 'title' => $title, + 'content' => $content, + 'excerpt' => $excerpt, + 'sortid' => $sort_id, + 'cover' => $cover, + 'author' => $author_uid, + 'date' => strtotime($post_date ?: date('Y-m-d H:i:s')), + 'hide' => $draft === 'y' ? 'y' : 'n', + 'alias' => $alias, + 'top' => $top, + 'sortop' => $sortop, + 'allow_remark' => $allow_remark, + 'password' => $password, + 'link' => $link, + 'template' => $template, ]; $this->Log_Model->updateLog($logData, $id, $author_uid);
|