('please_fill_title'); }elseif ( isset($post['content']) && strlen($post['content']) < 5 ){ return lang('please_fill_content_over_5'); }elseif ( $isadd && isset($post['alias'] ) && $post['alias'] && $err_msg = $this->only_alias->check_alias(strtolower($post['alias']), 1) ){ return $err_msg; }elseif ( isset($post['id']) && empty($post['id']) ){ return lang('id_not_exists'); } return ''; } //发布内容,增加了写入指定ID。有$id 用set,没有用create public function xadd($post = array(), $user = array(), $table = 'article'){ //火车头数据过滤 if(isset($post['alias']) && $post['alias'] == '[db:别名]') $post['alias'] = ''; if(isset($post['tags']) && $post['tags'] == '[db:标签]' ) $post['tags'] = ''; if(isset($post['pic']) && $post['pic'] == '[db:缩略图]' ) $post['pic'] = ''; if(isset($post['flag']) && $post['flag'] == '[db:属性]' ) $post['flag'] = array(); if(isset($post['intro']) && $post['intro'] == '[db:摘要]' ) $post['intro'] = ''; if(isset($post['author']) && $post['author'] == '[db:作者]' ) $post['author'] = ''; if(isset($post['source']) && $post['source'] == '[db:来源]' ) $post['source'] = ''; if(isset($post['views']) && $post['views'] == '[db:浏览量]' ) $post['views'] = 0; if(isset($post['seo_title']) && $post['seo_title'] == '[db:SEO标题]' ) $post['seo_title'] = ''; if(isset($post['seo_keywords']) && $post['seo_keywords'] == '[db:SEO关键词]' ) $post['seo_keywords'] = ''; if(isset($post['seo_description']) && $post['seo_description'] == '[db:SEO描述]' ) $post['seo_description'] = ''; if(isset($post['jumpurl']) && $post['jumpurl'] == '[db:跳转URL]' ) $post['jumpurl'] = ''; if(isset($post['isremote']) && $post['isremote'] == '[db:远程图片本地化]' ) $post['isremote'] = 0; if(isset($post['iscomment']) && $post['iscomment'] == '[db:禁止评论]' ) $post['iscomment'] = 0; if(isset($post['content']) && $post['content'] == '[db:内容]' ) $post['content'] = ''; if(isset($post['show_tpl']) && $post['show_tpl'] == '[db:内容模板]' ) $post['show_tpl'] = ''; //处理发布时间 if(isset($post['dateline']) && $post['dateline'] == '[db:发布时间]' ) unset($post['dateline']); //可以传递 2024-07-10 这种格式 if( isset($post['dateline']) && $post['dateline'] && !is_numeric($post['dateline']) ){ $post['dateline'] = strtotime($post['dateline']); if(empty($post['dateline'])){unset($post['dateline']);} } //有没传递ID过来? if( isset($post['id']) ){ if( empty($post['id']) ){ unset($post['id']); $id = 0; }else{ $id = (int)$post['id']; } }else{ $id = 0; } $err = $this->check_post($post); if($err){ return array('err'=>1 ,'msg'=>$err); } $isremote = isset($post['isremote']) ? (int)$post['isremote'] : 0; $cid = isset($post['cid']) ? (int)$post['cid'] : 0; //优先使用传递过来的uid if(isset($post['uid'])){ $uid = max(1, (int)$post['uid']); $user = array(); }elseif (isset($user['uid'])){ $uid = max(1, (int)$user['uid']); }else{ $uid = 1; } $title = isset($post['title']) ? trim(strip_tags($post['title'])) : ''; $contentstr = isset($post['content']) ? trim($post['content']) : ''; $intro = isset($post['intro']) ? trim($post['intro']) : ''; $tagstr = isset($post['tags']) ? trim($post['tags'], ", \t\n\r\0\x0B") : ''; $flags = isset($post['flag']) ? (is_array($post['flag']) ? $post['flag'] : explode(',',$post['flag'])) : array(); $author =isset($post['author']) ? trim($post['author']) : ''; $alias = isset($post['alias']) ? strtolower(trim($post['alias'])) : ''; $auto_pic = isset($this->cfg['auto_pic']) ? (int)$this->cfg['auto_pic'] : 0; //自动提取缩略图 $open_title_check = isset($this->cfg['open_title_check']) ? (int)$this->cfg['open_title_check'] : 0; //是否开启标题重复检查 if($alias && preg_match("/^\d+_\d+$/u",$alias)){ // 数字_数字 会和没有别名的 别名型URL冲突,导致404页面 return array('err'=>1 ,'msg'=>lang('alias_error_number_and_number')); } $intro = auto_intro($intro, $contentstr); empty($user) AND $user = $this->user->get($uid); if( empty($user) ){ return array('err'=>1 ,'msg'=>lang('user_not_exists')); } empty($author) AND $author = empty($user['author'] ) ? $user['username'] : $user['author']; //分类检查 $categorys = $this->category->get($cid); if(empty($categorys)){ return array('err'=>1 ,'msg'=>lang('category_not_exists')); } $mid = (int)$categorys['mid']; $models = $this->models->get($mid); if(empty($models) || $models['tablename'] != $table){ return array('err'=>1 ,'msg'=>lang('cid_error')); } $this->table = 'cms_'.$table; $this->cms_content_data->table = 'cms_'.$table.'_data'; $this->cms_content_views->table = 'cms_'.$table.'_views'; if($open_title_check && $this->find_fetch(array('title'=>$title), array('id' => 1), 0, 1)){ return array('err'=>1 ,'msg'=>lang('title_exists')); } $cms_content = array( 'cid' => $cid, 'title' => $title, 'alias' => $alias, 'tags' => '', 'intro' => $intro, 'pic' => isset($post['pic']) ? trim($post['pic']) : '', 'uid' => $uid, 'author' => $author, 'source' => isset($post['source']) ? trim($post['source']) : '', 'dateline' => isset($post['dateline']) ? $post['dateline'] : $_ENV['_time'], 'lasttime' => isset($post['lasttime']) ? $post['lasttime'] : $_ENV['_time'], 'ip' => isset($post['ip']) ? $post['ip'] : ip2long($_ENV['_ip']), 'imagenum' => 0, 'filenum' => 0, 'iscomment' => isset($post['iscomment']) ? (int)$post['iscomment'] : 0, 'comments' => 0, 'flags' => implode(',', $flags), 'seo_title' => isset($post['seo_title']) ? trim(strip_tags($post['seo_title'])) : '', 'seo_keywords' => isset($post['seo_keywords']) ? trim(strip_tags($post['seo_keywords'])) : '', 'seo_description' => isset($post['seo_description']) ? trim(strip_tags($post['seo_description'])) : '', 'jumpurl' => isset($post['jumpurl']) ? trim($post['jumpurl']) : '', ); if(isset($post['show_tpl']) && $post['show_tpl']){ $cms_content['show_tpl'] = $post['show_tpl']; } $cms_content_data = array( 'content'=>$contentstr, ); //执行添加内容时,处理自定义字段内容 //获取自定义字段的值 $user_defined_field = $this->models_field->user_defined_field($mid); foreach ($user_defined_field as $field=>$field_set){ if(isset($post[$field])){ $val = $post[$field]; if($field_set['inputtype'] == 'checkbox'){ //传递的是数组 $val = implode(',', $val); }elseif (($field_set['inputtype'] == 'images' || $field_set['inputtype'] == 'attachs') && !empty($val)){ //图集和附件集数组转为json存放 $more_files_arr = (array)$val; //附件集排序 if($field_set['inputtype'] == 'attachs'){ _array_multisort($more_files_arr, 'orderby'); } $val = _json_encode($more_files_arr); //同步信息到附件表 Lecms 3.0.3 错误

错误信息

错误位置

基本信息

程序流程

SQL

$_GET

$_POST

$_COOKIE

包含文件

其他信息