想在下边采集接口中加个 wangpan 字段,使其能发布成功,请大神帮忙看看,谢谢!
<?php define('EmpireCMSAdmin','1'); require("../class/connect.php"); require("../class/db_sql.php"); require("../class/functions.php"); require LoadLang("pub/fun.php"); require LoadLang("pub/message.php"); require("../class/delpath.php"); require("../class/copypath.php"); require("../class/t_functions.php"); require("../data/dbcache/class.php"); require("../data/dbcache/MemberLevel.php"); require("../class/hinfofun.php"); $link=db_connect(); $empire=new mysqlquery(); $enews='AddNews'; $lur[groupid]=1; ini_set('max_file_uploads','1000'); if(isset($_POST['jieling'])) { if ($_POST['jieling']=='GetAllClass') { echo "@@@<br/>"; $Sql2="Select * from {$dbtbpre}enewsclass"; $result=$empire->query($Sql2); while ($row = $empire->fetch($result)) { echo $row[classname]."###".$row[classid]."###".$row[bclassid]."###".$row[sonclass]."<br/>"; } db_close(); $empire=null; exit(); } elseif ($_POST['jieling']=='AddInfo') { DDAddNews($_POST,$_POST['userid'],$_POST['username']); }
}
function upload_single($new_url,$filename,$tmp_name,$filesize,$error,$type,$id,$classid) { global $public_r; //print_r(func_get_args()); if (!$filename) return "上传有误"; //$_type=array('image/gif','image/jpeg','image/pjpeg'); //!in_array($_FILES['upload_file']['type'],$_type) && exit('上传格式有误'); if ($error > 0) return "'Error:'. $error"; $newurl= ltrim(dirname(parse_url($new_url, PHP_URL_PATH)),'/'); $_pnum=explode('/',$newurl); $newurl=''; for ($i=0; $i<count($_pnum); $i++) { $newurl.=$_pnum[$i].'/'; is_dir(ECMS_PATH.$newurl) or DoMkdir(ECMS_PATH.$newurl,0777); } $newurl=='/' && $newurl=''; $truepath=str_replace('\\','/',ECMS_PATH.$newurl.$filename); $pubid=ReturnInfoPubid($classid,$id); $succ=false; (file_exists($truepath) or @copy($tmp_name,$truepath) or @move_uploaded_file($tmp_name, $truepath) ) && $succ=true ; $succ && eInsertFileTable($filename,$filesize,date($public_r['filepath']),'[Member]admin',$classid,'jieling@'.$filename,$type,$id,'0',$public_r[fpath],$pubid,0,$public_r['filedeftb']); if (!$succ) return "fail|"; }
//增加信息 function DDAddNews($add,$userid,$username){ global $empire,$class_r,$class_zr,$bclassid,$public_r,$dbtbpre,$emod_r,$message_r; $add[classid]=(int)$add[classid]; $userid=(int)$userid; if(!$add[title]||!$add[classid]) { exit($message_r["EmptyTitle"]); }
//操作权限 $doselfinfo=CheckLevel($userid,$username,$add[classid],"news"); if(!$doselfinfo['doaddinfo'])//增加权限 { exit($message_r["NotAddInfoLevel"]); } $ccr=$empire->fetch1("select classid,modid,listdt,haddlist,sametitle,addreinfo,wburl,repreinfo from {$dbtbpre}enewsclass where classid='$add[classid]' and islast=1 limit 1"); if(!$ccr['classid']||$ccr['wburl']) { exit($message_r["ErrorUrl"]); } if($ccr['sametitle'])//验证标题重复 { if(ReturnCheckRetitle($add)) { exit($message_r["ReInfoTitle"]); } } $add=DoPostInfoVar($add);//返回变量 $ret_r=ReturnAddF($add,$class_r[$add[classid]][modid],$userid,$username,0,0,1);//返回自定义字段 $newspath=FormatPath($add[classid],$add[newspath],1);//查看目录是否存在,不存在则建立 //审核权限 if(!$doselfinfo['docheckinfo']) { $add['checked']=$class_r[$add[classid]][checked]; } //必须审核 if($doselfinfo['domustcheck']) { $add['checked']=0; } //推荐权限 if(!$doselfinfo['dogoodinfo']) { $add['isgood']=0; $add['firsttitle']=0; $add['istop']=0; } //签发 $isqf=0; if($class_r[$add[classid]][wfid]) { $add[checked]=0; $isqf=1; } $newstime=empty($add['newstime'])?time():to_time($add['newstime']); $truetime=time(); $lastdotime=$truetime; //是否生成 $havehtml=0; if($add['checked']==1&&$ccr['addreinfo']) { $havehtml=1; } //返回关键字组合 if($add['info_diyotherlink']) { $keyid=DoPostDiyOtherlinkID($add['info_keyid']); } else { $keyid=GetKeyid($add[keyboard],$add[classid],0,$class_r[$add[classid]][link_num]); } //附加链接参数 $addecmscheck=empty($add['checked'])?'&ecmscheck=1':''; //索引表 $sql=$empire->query("insert into {$dbtbpre}ecms_".$class_r[$add[classid]][tbname]."_index(classid,checked,newstime,truetime,lastdotime,havehtml) values('$add[classid]','$add[checked]','$newstime','$truetime','$lastdotime','$havehtml');"); $id=$empire->lastid(); $pubid=ReturnInfoPubid($add['classid'],$id); $infotbr=ReturnInfoTbname($class_r[$add[classid]][tbname],$add['checked'],$ret_r['tb']); //主表 $infosql=$empire->query("insert into ".$infotbr['tbname']."(id,classid,ttid,onclick,plnum,totaldown,newspath,filename,userid,username,firsttitle,isgood,ispic,istop,isqf,ismember,isurl,truetime,lastdotime,havehtml,groupid,userfen,titlefont,titleurl,stb,fstb,restb,keyboard".$ret_r['fields'].") values('$id','$add[classid]','$add[ttid]','$add[onclick]',0,'$add[totaldown]','$newspath','$filename','$userid','".addslashes($username)."','$add[firsttitle]','$add[isgood]','$add[ispic]','$add[istop]','$isqf',0,'$add[isurl]','$truetime','$lastdotime','$havehtml','$add[groupid]','$add[userfen]','".addslashes($add[my_titlefont])."','".addslashes($add[titleurl])."','$ret_r[tb]','$public_r[filedeftb]','$public_r[pldeftb]','".addslashes($add[keyboard])."'".$ret_r['values'].");"); //副表 $finfosql=$empire->query("insert into ".$infotbr['datatbname']."(id,classid,keyid,dokey,newstempid,closepl,haveaddfen,infotags".$ret_r['datafields'].") values('$id','$add[classid]','$keyid','$add[dokey]','$add[newstempid]','$add[closepl]',0,'".addslashes($add[infotags])."'".$ret_r['datavalues'].");"); //更新栏目信息数 AddClassInfos($add['classid'],'+1','+1',$add['checked']); //更新新信息数 DoUpdateAddDataNum('info',$class_r[$add['classid']]['tid'],1); //签发 if($isqf==1) { InfoInsertToWorkflow($id,$add[classid],$class_r[$add[classid]][wfid],$userid,$username); } //更新附件表 UpdateTheFile($id,$add['filepass'],$add['classid'],$public_r['filedeftb']); //取第一张图作为标题图片 if($add['getfirsttitlepic']&&empty($add['titlepic'])) { $firsttitlepic=GetFpicToTpic($add['classid'],$id,$add['getfirsttitlepic'],$add['getfirsttitlespic'],$add['getfirsttitlespicw'],$add['getfirsttitlespich'],$public_r['filedeftb']); if($firsttitlepic) { $addtitlepic=",titlepic='".addslashes($firsttitlepic)."',ispic=1"; } } //文件命名 if($add['filename']) { $filename=$add['filename']; } else { $filename=ReturnInfoFilename($add[classid],$id,''); } //信息地址 $updateinfourl=''; if(!$add['isurl']) { $infourl=GotoGetTitleUrl($add['classid'],$id,$newspath,$filename,$add['groupid'],$add['isurl'],$add['titleurl']); $updateinfourl=",titleurl='$infourl'"; } $usql=$empire->query("update ".$infotbr['tbname']." set filename='$filename'".$updateinfourl.$addtitlepic." where id='$id'"); //替换图片下一页 if($add['repimgnexturl']) { UpdateImgNexturl($add[classid],$id,$add['checked']); } //投票 AddInfoVote($add['classid'],$id,$add); //加入专题 InsertZtInfo($add['ztids'],$add['zcids'],$add['oldztids'],$add['oldzcids'],$add['classid'],$id,$newstime); //TAGS if($add[infotags]&&$add[infotags]<>$add[oldinfotags]) { eInsertTags($add[infotags],$add['classid'],$id,$newstime); } //增加信息是否生成文件 if($ccr['addreinfo']&&$add['checked']) { GetHtml($add['classid'],$id,'',0); } //生成上一篇 if($ccr['repreinfo']&&$add['checked']) { $prer=$empire->fetch1("select * from {$dbtbpre}ecms_".$class_r[$add[classid]][tbname]." where id<$id and classid='$add[classid]' order by id desc limit 1"); GetHtml($add['classid'],$prer['id'],$prer,1); } //生成栏目 if($ccr['haddlist']&&$add['checked']) { hAddListHtml($add['classid'],$ccr['modid'],$ccr['haddlist'],$ccr['listdt']);//生成信息列表 if($add['ttid'])//生成标题分类列表 { ListHtml($add['ttid'],'',5); } } //同时发布 $copyclassid=$add[copyclassid]; $cpcount=count($copyclassid); if($cpcount) { $copyids=AddInfoToCopyInfo($add[classid],$id,$copyclassid,$userid,$username,$doselfinfo); if($copyids) { UpdateInfoCopyids($add['classid'],$id,$copyids); } } if($sql) { //返回地址 if($add['ecmsfrom']&&(stristr($add['ecmsfrom'],'ListNews.php')||stristr($add['ecmsfrom'],'ListAllInfo.php'))) { $ecmsfrom=$add['ecmsfrom']; } else { $ecmsfrom=$add['ecmsnfrom']==1?"ListNews.php?bclassid=$add[bclassid]&classid=$add[classid]":"ListAllInfo.php?tbname=".$class_r[$add[classid]][tbname]; $ecmsfrom.=hReturnEcmsHashStrHref2(0); } $GLOBALS['ecmsadderrorurl']=$ecmsfrom.$addecmscheck; insert_dolog("classid=$add[classid]<br>id=".$id."<br>title=".$add[title],$pubid);//操作日志
for($i=0;$i<count($_FILES['upload_file']['name']);$i++) { upload_single($_POST['upload_newurl'][$i],$_POST['upload_name'][$i],$_FILES['upload_file']['tmp_name'][$i],$_FILES['upload_file']['size'][$i],$_FILES['upload_file']['error'][$i],'1',$id,$add['classid']); } echo "succ|"; } else { printerror("DbError",""); } }
db_close(); $empire=null; ?>
|