/** * 创建新的栏目 * @param $name * @param $link * @param $key * @param $description * @return [bool] [description] */ public function create() { $me = parent::require_login(); $params = parent::get_params('POST', array("name", "link", "key", "description")); if (empty($params)) { return; } extract($params); if (json_decode($key, true) == NULL) { parent::finish(false, $this->error_msg['Admin_column_create_error_0001']); } parent::is_length(array(array("name" => "栏目名称", "value" => $name, "min" => 3, "max" => 200), array("name" => "自定地址", "value" => $link, "min" => 2, "max" => 30), array("name" => "栏目描述", "value" => $description, "min" => 10, "max" => 600))); if ($this->Column_model->is_exist(array("link" => $link))) { parent::finish(false, $this->error_msg['Admin_column_create_error_0002']); } if ($this->Column_model->create(array("name" => $name, "link" => $link, "keyword" => $key, "description" => $description, "time" => time(), "from_user" => $me['id'])) > 0) { parent::finish(true); } else { parent::finish(false, $this->server_error); } }
function create_article() { $me = parent::require_login(); $params = parent::get_params('POST', array("title", "from_tag", "from_class", "article_photo_name", "article_tag", "article_type")); parent::is_length(array(array("name" => "文章标题", "value" => $title, "max" => 40, "min" => 10), array("name" => "文章标题", "value" => $title, "max" => 40, "min" => 10))); }