"; $field=""; $cr=$empire->fetch1("select newsclassid,tbname from {$dbtbpre}enewsinfoclass where classid='$add[classid]'"); $r=$empire->fetch1("select cj from {$dbtbpre}enewsmod where mid='".$class_r[$cr[newsclassid]][modid]."'"); $cjr=explode($record,$r[cj]); $count=count($cjr); $update=""; for($i=0;$i<$count-1;$i++) { $cjr1=explode($field,$cjr[$i]); $dofield=$cjr1[1]; //图片集 if($dofield=="morepic") { $add[$dofield]=ReturnMorepicpath($add['msmallpic'],$add['mbigpic'],$add['mpicname'],$add['mdelpicid'],$add['mpicid'],$add,$add['mpicurl_qz'],1,0,$public_r['filedeftb']); } //下载地址 if($dofield=="downpath") { $add[$dofield]=ReturnDownpath($add['downname'],$add['downpath'],$add['delpathid'],$add['pathid'],$add['downuser'],$add['fen'],$add['thedownqz'],$add,$add['foruser'],$add['downurl'],0); } //在线地址 if($dofield=="onlinepath") { $add[$dofield]=ReturnDownpath($add['odownname'],$add['odownpath'],$add['odelpathid'],$add['opathid'],$add['odownuser'],$add['ofen'],$add['othedownqz'],$add,$add['oforuser'],$add['onlineurl_qz'],1); } //发布时间 if($dofield=="newstime") {continue;} $update.=",".$dofield."='".eaddslashes2($add[$dofield])."'"; } $sql=$empire->query("update {$dbtbpre}ecms_infotmp_".$cr[tbname]." set keyboard='".eaddslashes2($add[keyboard])."',newstime='$add[newstime]'".$update." where id='$add[id]'"); if($sql) { //操作日志 insert_dolog("id=".$add[id]."
title=".$add[title]); printerror("EditCjNewsSuccess","CheckCj.php?classid=$add[classid]&from=".ehtmlspecialchars($_POST[from]).hReturnEcmsHashStrHref2(0)); } else {printerror("DbError","history.go(-1)");} } //删除采集信息 function DelCjNews($classid,$id,$userid,$username){ global $empire,$dbtbpre; $classid=(int)$classid; $id=(int)$id; if(empty($classid)||empty($id)) {printerror("NotDelCjNewsid","history.go(-1)");} //验证权限 CheckLevel($userid,$username,$classid,"cj"); $cr=$empire->fetch1("select newsclassid,tbname from {$dbtbpre}enewsinfoclass where classid='$classid'"); $r=$empire->fetch1("select title from {$dbtbpre}ecms_infotmp_".$cr[tbname]." where id='$id'"); $sql=$empire->query("delete from {$dbtbpre}ecms_infotmp_".$cr[tbname]." where id='$id'"); if($sql) { //操作日志 insert_dolog("id=".$id."
title=".$r[title]); printerror("DelCjNewsSuccess","CheckCj.php?classid=$classid&from=".ehtmlspecialchars($_GET[from]).hReturnEcmsHashStrHref2(0)); } else {printerror("DbError","history.go(-1)");} } //批量删除采集信息 function DelCjNews_all($classid,$id,$userid,$username){ global $empire,$dbtbpre; //操作权限 CheckLevel($userid,$username,$classid,"cj"); $count=count($id); if(!$count) {printerror("NotDelCjNewsid","history.go(-1)");} $cr=$empire->fetch1("select newsclassid,tbname,classname from {$dbtbpre}enewsinfoclass where classid='$classid'"); for($i=0;$iquery("delete from {$dbtbpre}ecms_infotmp_".$cr[tbname]." where ".$add); if($sql) { //操作日志 insert_dolog("classid=".$classid."
classname=".$cr[classname]); printerror("DelCjNewsAllSuccess",EcmsGetReturnUrl()); } else { printerror("DbError","history.go(-1)"); } } //清除简介字符 function DoClearSmalltextVal($value){ $value=str_replace(array("\r\n","
","
"," ","[!--empirenews.page--]","[/!--empirenews.page--]"),array("","\r\n","\r\n"," ","",""),$value); $value=strip_tags($value); $value=trim($value,"\r\n"); return $value; } //采集入库 function CjNewsIn($classid,$id,$checked,$uptime,$userid,$username){ global $class_r,$empire,$public_r,$dbtbpre,$emod_r,$lur; $checked=(int)$checked; $classid=(int)$classid; if(empty($classid)) { printerror("ErrorUrl","history.go(-1)"); } CheckLevel($userid,$username,$classid,"cj");//操作权限 $count=count($id); if(empty($count)) { printerror("NotCjNewsIn","history.go(-1)"); } $cr=$empire->fetch1("select * from {$dbtbpre}enewsinfoclass where classid='$classid'"); //副表 $cra=$empire->fetch1("select * from {$dbtbpre}ecms_infoclass_".$cr[tbname]." where classid='$classid'"); //组合两数组 $cr=TogTwoArray($cr,$cra); //导入gd处理文件 if($cr['mark']||$cr['getfirstspic']) { @include_once("gd.php"); } $userisqf=EcmsReturnDoIsqf($userid,$username,$lur['groupid'],0); $mid=$class_r[$cr[newsclassid]][modid]; $savetxtf=$emod_r[$mid]['savetxtf']; $stb=$emod_r[$mid]['deftb']; //取得采集字段 $record=""; $field=""; $mr=$empire->fetch1("select cj from {$dbtbpre}enewsmod where mid='".$class_r[$cr[newsclassid]][modid]."'"); $cjr=explode($record,$mr[cj]); $ccount=count($cjr); //取得优化字段 for($ci=0;$ci<$ccount-1;$ci++) { $cir=explode($field,$cjr[$ci]); $cifield=$cir[1]; if($cifield=="title") { continue; } $updatefield.=",".$cifield."=''"; } for($i=0;$iquery("select * from {$dbtbpre}ecms_infotmp_".$cr[tbname]." where ".$a." and checked=0 order by id desc"); $todaytime=time(); $filetime=$todaytime; while($r=$empire->fetch($sql)) { $ivalue=''; $ifield=''; $dataivalue=''; $dataifield=''; $titlepicnoval=0; for($j=0;$j<$ccount-1;$j++) { $cjr1=explode($field,$cjr[$j]); $dofield=$cjr1[1]; $var="zz_".$dofield; $var1="z_".$dofield; $var2="qz_".$dofield; $var3="save_".$dofield; $value=$r[$dofield]; //自身链接 if($dofield=="empireselfurl") { $value=$r['oldurl']; } //内容 if($dofield=="newstext") { if($cr[copyimg]||$cr[copyflash]) { $GLOBALS['cjnewsurl']=$r[oldurl]; $value=addslashes(CopyImg(stripSlashes($value),$cr[copyimg],$cr[copyflash],$cr[newsclassid],$cr[imgurl],$username,0,$r['id'],$cr['mark'],$public_r['filedeftb'])); } //替换关键字和字符 $value=DoReplaceKeyAndWord($value,1,$cr[newsclassid]); } //简介 if($dofield=="smalltext") { if(empty($value)) { $value=SubSmalltextVal($r[newstext],$cr[smalltextlen]); } else { $value=DoClearSmalltextVal($value); } } //图片集 if($dofield=="morepic") { if($cr[$var3]==" checked") { $msavepic=1; $r['filepass']=$r['id']; $value=LoadInSaveMorepicFile($value,$msavepic,$cr[newsclassid],0,$r,0,$public_r['filedeftb']); } } //信息时间 if($dofield=="newstime") {continue;} //图片标题 if($dofield=="titlepic"&&$cr[zz_titlepicl]) { $cr[$var]=$cr[zz_titlepicl]; $cr[$var1]=$cr[z_titlepicl]; $cr[$var2]=$cr[qz_titlepicl]; $cr[$var3]=$cr[save_titlepicl]; } if($dofield=="titlepic"&&empty($value)) { $titlepicnoval=1; } //是否远程保存 if($value&&!$cr[$var1]&&$cr[$var3]==" checked"&&$dofield!="morepic") { $tranr=DoTranUrl($value,$cr[newsclassid]); if($tranr[tran]) { $tranr[filesize]=(int)$tranr[filesize]; $tranr[type]=(int)$tranr[type]; $r[id]=(int)$r[id]; //记录数据库 eInsertFileTable($tranr[filename],$tranr[filesize],$tranr[filepath],$username,$cr[newsclassid],'[URL]'.$tranr[filename],$tranr[type],0,$r[id],$public_r[fpath],0,0,$public_r['filedeftb']); $value=$tranr[url]; } } //存放文本 if($savetxtf==$dofield) { //建立目录 $thetxtfile=GetFileMd5(); $truevalue=MkDirTxtFile(date("Y/md"),$thetxtfile); //写放文件 EditTxtFieldText($truevalue,$value); $value=$truevalue; } $value=addslashes($value); if(strstr($emod_r[$mid]['tbdataf'],','.$dofield.','))//副表 { $dataifield.=",".$dofield; $dataivalue.=",'".$value."'"; } else { $ifield.=",".$dofield; $ivalue.=",'".$value."'"; } } $r[keyboard]=addslashes($r[keyboard]); //时间 if($uptime)//当前时间 { $r[newstime]=$todaytime; $r[truetime]=$todaytime; } else { if($r[newstime]=="0000-00-00 00:00:00") { $r[newstime]=$todaytime; } else { $r[newstime]=to_time($r[newstime]); } } //查看目录是否存在,不存在则建立 $newspath=FormatPath($cr[newsclassid],"",0); //强制签发 if($class_r[$cr[newsclassid]][wfid]) { if($userisqf) { $checked=$checked; $isqf=0; } else { $checked=0; $isqf=1; } } else { $checked=$checked; $isqf=0; } //变量处理 $newstempid=0; $ispic=$r[titlepic]?1:0; //取得返回关键字 $keyid=GetKeyid($r[keyboard],$cr[newsclassid],0,$class_r[$cr[newsclassid]][link_num]); //索引表 $havehtml=0; $indexsql=$empire->query("insert into {$dbtbpre}ecms_".$class_r[$cr[newsclassid]][tbname]."_index(classid,checked,newstime,truetime,lastdotime,havehtml) values('$cr[newsclassid]','$checked','$r[newstime]','$r[truetime]','$r[truetime]','$havehtml');"); $id=$empire->lastid(); $infotbr=ReturnInfoTbname($class_r[$cr[newsclassid]][tbname],$checked,$stb); //主表 $isurl=$r['titleurl']?1:0; $isql=$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,newstime".$ifield.") values('$id','$cr[newsclassid]',0,0,0,0,'$newspath','$filename','$r[userid]','$r[username]',0,0,'$ispic',0,'$isqf',0,'$isurl','$r[truetime]','$r[truetime]','$havehtml',0,0,'$r[titlefont]','$r[titleurl]','$stb','$public_r[filedeftb]','$public_r[pldeftb]','$r[keyboard]','$r[newstime]'".$ivalue.");"); //副表 $fisql=$empire->query("insert into ".$infotbr['datatbname']."(id,classid,keyid,dokey,newstempid,closepl,haveaddfen,infotags".$dataifield.") values('$id','$cr[newsclassid]','$keyid',1,'$newstempid',0,0,''".$dataivalue.");"); //更新栏目信息数 AddClassInfos($cr['newsclassid'],'+1','+1',$checked); //更新新信息数 DoUpdateAddDataNum('info',$class_r[$cr['newsclassid']]['tid'],1); //签发 if($isqf==1) { InfoInsertToWorkflow($id,$cr[newsclassid],$class_r[$cr[newsclassid]][wfid],$userid,$username); } //更新附件 UpdateTheFile($id,$r['id'],$cr['newsclassid'],$public_r['filedeftb']); //取第一张图片为标题图片 $addtitlepic=""; if($cr['getfirstpic']&&$titlepicnoval) { $firsttitlepic=GetFpicToTpic($cr[newsclassid],$id,$cr['getfirstpic'],$cr['getfirstspic'],$cr['getfirstspicw'],$cr['getfirstspich'],$public_r['filedeftb']); if($firsttitlepic) { $addtitlepic=",titlepic='".addslashes($firsttitlepic)."',ispic=1"; } } //文件命名 $filename=ReturnInfoFilename($cr[newsclassid],$id,$r[filenameqz]); //信息地址 $updateinfourl=''; if(!$isurl) { $infourl=GotoGetTitleUrl($cr['newsclassid'],$id,$newspath,$filename,0,$isurl,''); $updateinfourl=",titleurl='$infourl'"; } $usql=$empire->query("update ".$infotbr['tbname']." set filename='$filename'".$updateinfourl.$addtitlepic." where id='$id'"); } //状态原记录 if($cr['delloadinfo'])//删除 { $del=$empire->query("delete from {$dbtbpre}ecms_infotmp_".$cr[tbname]." where ".$a); } else { $del=$empire->query("update {$dbtbpre}ecms_infotmp_".$cr[tbname]." set checked=1,keyboard=''".$updatefield." where ".$a); } //操作日志 insert_dolog("classid=".$classid); printerror("CjLoadDbSuccess","CheckCj.php?classid=$classid&from=".ehtmlspecialchars($_POST[from]).hReturnEcmsHashStrHref2(0)); } //全部采集入库 function CjNewsIn_all($classid,$checked,$uptime,$start,$userid,$username){ global $class_r,$empire,$public_r,$dbtbpre,$fun_r,$emod_r,$lur; $checked=(int)$checked; $classid=(int)$classid; $start=(int)$start; if(empty($classid)) { printerror("ErrorUrl","history.go(-1)"); } //操作权限 CheckLevel($userid,$username,$classid,"cj"); $cr=$empire->fetch1("select * from {$dbtbpre}enewsinfoclass where classid='$classid'"); //副表 $cra=$empire->fetch1("select * from {$dbtbpre}ecms_infoclass_".$cr[tbname]." where classid='$classid'"); //组合两数组 $cr=TogTwoArray($cr,$cra); //导入gd处理文件 if($cr['mark']||$cr['getfirstspic']) { @include_once("gd.php"); } $userisqf=EcmsReturnDoIsqf($userid,$username,$lur['groupid'],0); if(empty($cr[insertnum])) {$cr[insertnum]=10;} $mid=$class_r[$cr[newsclassid]][modid]; $savetxtf=$emod_r[$mid]['savetxtf']; $stb=$emod_r[$mid]['deftb']; //取得采集字段 $record=""; $field=""; $mr=$empire->fetch1("select cj from {$dbtbpre}enewsmod where mid='".$class_r[$cr[newsclassid]][modid]."'"); $cjr=explode($record,$mr[cj]); $ccount=count($cjr); $sql=$empire->query("select * from {$dbtbpre}ecms_infotmp_".$cr[tbname]." where classid='$classid' and checked=0 and id>$start order by id limit ".$cr[insertnum]); $todaytime=time(); $filetime=$todaytime; $b=0; while($r=$empire->fetch($sql)) { $b=1; $newstart=$r[id]; $ivalue=''; $ifield=''; $dataivalue=''; $dataifield=''; $titlepicnoval=0; for($j=0;$j<$ccount-1;$j++) { $cjr1=explode($field,$cjr[$j]); $dofield=$cjr1[1]; $var="zz_".$dofield; $var1="z_".$dofield; $var2="qz_".$dofield; $var3="save_".$dofield; $value=$r[$dofield]; //自身链接 if($dofield=="empireselfurl") { $value=$r['oldurl']; } //内容 if($dofield=="newstext") { if($cr[copyimg]||$cr[copyflash]) { $GLOBALS['cjnewsurl']=$r[oldurl]; $value=addslashes(CopyImg(stripSlashes($value),$cr[copyimg],$cr[copyflash],$cr[newsclassid],$cr[imgurl],$username,0,$r['id'],$cr['mark'],$public_r['filedeftb'])); } //替换关键字和字符 $value=DoReplaceKeyAndWord($value,1,$cr[newsclassid]); } //简介 if($dofield=="smalltext") { if(empty($value)) { $value=SubSmalltextVal($r[newstext],$cr[smalltextlen]); } else { $value=DoClearSmalltextVal($value); } } //图片集 if($dofield=="morepic") { if($cr[$var3]==" checked") { $msavepic=1; $r['filepass']=$r['id']; $value=LoadInSaveMorepicFile($value,$msavepic,$cr[newsclassid],0,$r,0,$public_r['filedeftb']); } } //时间 if($dofield=="newstime") {continue;} //图片标题 if($dofield=="titlepic"&&$cr[zz_titlepicl]) { $cr[$var]=$cr[zz_titlepicl]; $cr[$var1]=$cr[z_titlepicl]; $cr[$var2]=$cr[qz_titlepicl]; $cr[$var3]=$cr[save_titlepicl]; } if($dofield=="titlepic"&&empty($value)) { $titlepicnoval=1; } //是否远程保存 if($value&&!$cr[$var1]&&$cr[$var3]==" checked"&&$dofield!="morepic") { $tranr=DoTranUrl($value,$cr[newsclassid]); if($tranr[tran]) { $tranr[filesize]=(int)$tranr[filesize]; $tranr[type]=(int)$tranr[type]; $r[id]=(int)$r[id]; //记录数据库 eInsertFileTable($tranr[filename],$tranr[filesize],$tranr[filepath],$username,$cr[newsclassid],'[URL]'.$tranr[filename],$tranr[type],0,$r[id],$public_r[fpath],0,0,$public_r['filedeftb']); $value=$tranr[url]; } } //存放文本 if($savetxtf==$dofield) { //建立目录 $thetxtfile=GetFileMd5(); $truevalue=MkDirTxtFile(date("Y/md"),$thetxtfile); //写放文件 EditTxtFieldText($truevalue,$value); $value=$truevalue; } $value=addslashes($value); if(strstr($emod_r[$mid]['tbdataf'],','.$dofield.','))//副表 { $dataifield.=",".$dofield; $dataivalue.=",'".$value."'"; } else { $ifield.=",".$dofield; $ivalue.=",'".$value."'"; } } $r[keyboard]=addslashes($r[keyboard]); //时间 if($uptime)//当前时间 { $r[newstime]=$todaytime; $r[truetime]=$todaytime; } else { if($r[newstime]=="0000-00-00 00:00:00") { $r[newstime]=$todaytime; } else { $r[newstime]=to_time($r[newstime]); } } //查看目录是否存在,不存在则建立 $newspath=FormatPath($cr[newsclassid],"",0); //强制签发 if($class_r[$cr[newsclassid]][wfid]) { if($userisqf) { $checked=$checked; $isqf=0; } else { $checked=0; $isqf=1; } } else { $checked=$checked; $isqf=0; } //变量处理 $newstempid=0; $ispic=$r[titlepic]?1:0; //返回关键字 $keyid=GetKeyid($r[keyboard],$cr[newsclassid],0,$class_r[$cr[newsclassid]][link_num]); //索引表 $havehtml=0; $indexsql=$empire->query("insert into {$dbtbpre}ecms_".$class_r[$cr[newsclassid]][tbname]."_index(classid,checked,newstime,truetime,lastdotime,havehtml) values('$cr[newsclassid]','$checked','$r[newstime]','$r[truetime]','$r[truetime]','$havehtml');"); $id=$empire->lastid(); $infotbr=ReturnInfoTbname($class_r[$cr[newsclassid]][tbname],$checked,$stb); //主表 $isurl=$r['titleurl']?1:0; $isql=$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,newstime".$ifield.") values('$id','$cr[newsclassid]',0,0,0,0,'$newspath','$filename','$r[userid]','$r[username]',0,0,'$ispic',0,'$isqf',0,'$isurl','$r[truetime]','$r[truetime]','$havehtml',0,0,'$r[titlefont]','$r[titleurl]','$stb','$public_r[filedeftb]','$public_r[pldeftb]','$r[keyboard]','$r[newstime]'".$ivalue.");"); //副表 $fisql=$empire->query("insert into ".$infotbr['datatbname']."(id,classid,keyid,dokey,newstempid,closepl,haveaddfen,infotags".$dataifield.") values('$id','$cr[newsclassid]','$keyid',1,'$newstempid',0,0,''".$dataivalue.");"); //更新栏目信息数 AddClassInfos($cr['newsclassid'],'+1','+1',$checked); //更新新信息数 DoUpdateAddDataNum('info',$class_r[$cr['newsclassid']]['tid'],1); //签发 if($isqf==1) { InfoInsertToWorkflow($id,$cr[newsclassid],$class_r[$cr[newsclassid]][wfid],$userid,$username); } //更新附件 UpdateTheFile($id,$r['id'],$cr[newsclassid],$public_r['filedeftb']); //取第一张图片为标题图片 $addtitlepic=""; if($cr['getfirstpic']&&$titlepicnoval) { $firsttitlepic=GetFpicToTpic($cr[newsclassid],$id,$cr['getfirstpic'],$cr['getfirstspic'],$cr['getfirstspicw'],$cr['getfirstspich'],$public_r['filedeftb']); if($firsttitlepic) { $addtitlepic=",titlepic='".addslashes($firsttitlepic)."',ispic=1"; } } //文件命名 $filename=ReturnInfoFilename($cr[newsclassid],$id,$r[filenameqz]); //信息地址 $updateinfourl=''; if(!$isurl) { $infourl=GotoGetTitleUrl($cr['newsclassid'],$id,$newspath,$filename,0,$isurl,''); $updateinfourl=",titleurl='$infourl'"; } $usql=$empire->query("update ".$infotbr['tbname']." set filename='$filename'".$updateinfourl.$addtitlepic." where id='$id'"); } $fm=ehtmlspecialchars($_GET['fm']); //全部入库完毕 if(empty($b)) { //取得忧化字段 for($ci=0;$ci<$ccount-1;$ci++) { $cir=explode($field,$cjr[$ci]); $cifield=$cir[1]; if($cifield=="title") { continue; } $updatefield.=",".$cifield."=''"; } //状态原记录 if($cr['delloadinfo'])//删除 { $del=$empire->query("delete from {$dbtbpre}ecms_infotmp_".$cr[tbname]." where classid='$classid'"); } else { $del=$empire->query("update {$dbtbpre}ecms_infotmp_".$cr[tbname]." set checked=1,keyboard=''".$updatefield." where classid='$classid'"); } if($fm) { echo"".$cr[classname]." ".$fun_r['CjLoadInInfosSuccess'].", "; exit(); } else { printerror("CjLoadDbSuccess","CheckCj.php?classid=$classid&from=".ehtmlspecialchars($_GET[from]).hReturnEcmsHashStrHref2(0)); } } //echo "$cr[classname]  ".$fun_r['OneCjLoadDbSuccess']."(ID:".$newstart.")"; echo"".$cr['classname']."  ".$fun_r['OneCjLoadDbSuccess']."(ID:".$newstart.")"; exit(); } //##############################采集功能开始############################### //替换回车 function ReplaceFc($text){ $text=str_replace("\n","",$text); $text=str_replace("\r","",$text); return $text; } //返回字符正则 function GetInfoStr($text,$exp,$enews=0){ $e1="[phome-".$exp."]"; $e2="[/phome-".$exp."]"; $rep="[!--".$exp."--]"; $mode="*"; //匹配多个 if($enews==1) { $cr=explode($rep,$text); $cer=explode($mode,$cr[0]); $num=count($cer)-1; } //转换字符 $text=str_replace($rep,$mode,$text); $er=explode($mode,$text); $newtext=""; for($i=0;$iGB2312 { $str=DoIconvVal("UTF8","GB2312",$str); } elseif($phome==2)//UTF8->BIG5 { $str=DoIconvVal("UTF8","BIG5",$str); } elseif($phome==3)//BIG5->GB2312 { $str=DoIconvVal("BIG5","GB2312",$str); } elseif($phome==4)//GB2312->BIG5 { $str=DoIconvVal("GB2312","BIG5",$str); } elseif($phome==5)//UNICODE->GB2312 { $str=DoIconvVal("UNICODE","GB2312",$str); } elseif($phome==6)//UNICODE->BIG5 { $str=DoIconvVal("UNICODE","BIG5",$str); } elseif($phome==7)//GB2312->UTF8 { $str=DoIconvVal("GB2312","UTF8",$str); } elseif($phome==8)//BIG5->UTF8 { $str=DoIconvVal("BIG5","UTF8",$str); } elseif($phome==9)//UNICODE->UTF8 { $str=DoIconvVal("UNICODE","UTF8",$str); } else {} return $str; } //替换采集页面内容 function RepCjPagetextStr($text,$r){ $text=str_replace("\\","/",$text); //编码转换 $text=doCjUtfAndGbk($text,$r['enpagecode']); //替换 $text=RepInfoWord($text,$r['oldpagerep'],$r['newpagerep']); //替换页面过滤正则 $text=RepPageAd($r['pagerepad'],$text); return $text; } //取得地址 function EchoUrl($text,$exp,$exp1,$dr,$url,$classid,$num,$checkrnd){ global $empire,$fun_r,$dbtbpre; $e1="[phome-".$exp."]"; $e2="[/phome-".$exp."]"; $ep1="[phome-".$exp1."]"; $ep2="[/phome-".$exp1."]"; $r=explode($e1,$text); //图片链接 if(!$dr[z_titlepicl]&&$dr[zz_titlepicl]) { $rp=explode($ep1,$text); } else { $titlepic=$dr[z_titlepicl]; } for($i=1;$igettotal("select count(*) as total from {$dbtbpre}ecms_infotmp_".$dr[tbname]." where oldurl='$dourl' limit 1"); if($dbnum) {continue;} } //图片链接 if(!$dr[z_titlepicl]&&$dr[zz_titlepicl]) { $rp1=explode($ep2,$rp[$i]); $titlepic=trim($rp1[0]); //是否有http if(strstr($titlepic,"http://")||strstr($titlepic,"https://")) {} else {$titlepic=$dr[qz_titlepicl].$titlepic;} //替换地址 $titlepic=RepCjUrlStr($titlepic); $titlepic=addslashes($titlepic); } //将地址写入数据库 $sql=$empire->query("insert into {$dbtbpre}enewslinktmp(newsurl,checkrnd,titlepic) values('$dourl','$checkrnd','$titlepic');"); echo $dourl."
"; } } //采集直接内容页地址 function PageEchoUrl($classid,$cr,$userid,$username){ global $empire,$fun_r,$dbtbpre; //取得条数 if(empty($cr[num])) {$cr[num]=10000;} //生成检测值 $checkrnd=md5(uniqid(microtime()).EcmsRandInt()); $url_r=explode("\r\n",$cr[infourl]); $count=count($url_r); if($count>$cr[num]) { $count=$cr[num]; } for($i=0;$i<$count;$i++) { $dourl=trim($url_r[$i]); if(empty($dourl)) { continue; } //是否有http if(strstr($dourl,"http://")||strstr($dourl,"https://")) {} else { $dourl=$cr[httpurl].$dourl; } //替换地址 $dourl=RepCjUrlStr($dourl); if(empty($dourl)) {continue;} $dourl=addslashes($dourl); //---------------检查数据库是否有记录 if(empty($cr[recjtheurl]))//重复采集 { $dbnum=$empire->gettotal("select count(*) as total from {$dbtbpre}ecms_infotmp_".$cr[tbname]." where oldurl='$dourl' limit 1"); if($dbnum) {continue;} } //将地址写入数据库 $sql=$empire->query("insert into {$dbtbpre}enewslinktmp(newsurl,checkrnd,titlepic) values('$dourl','$checkrnd','');"); echo $dourl."
"; } echo $fun_r['GetUrlOver'].""; exit(); } //开始采集远程地址 function CJUrl($classid,$start,$checkrnd,$userid,$username){ global $empire,$fun_r,$dbtbpre; $classid=(int)$classid; if(empty($classid)) {printerror("NotChangeCjid","history.go(-1)");} //验证权限 CheckLevel($userid,$username,$classid,"cj"); $r=$empire->fetch1("select endday,num,zz_smallurl,zz_newsurl,httpurl,infourl,newsclassid,relistnum,zz_titlepicl,z_titlepicl,qz_titlepicl,save_titlepicl,tbname,recjtheurl,enpagecode,pagerepad,oldpagerep,newpagerep,keeptime,infourlispage from {$dbtbpre}enewsinfoclass where classid='$classid'"); if(empty($r[newsclassid])) {printerror("NotCjid","history.go(-1)");} //直接内容页链接列表 if($r['infourlispage']) { PageEchoUrl($classid,$r,$userid,$username); } //导入编码文件 if($r['enpagecode']) { @include_once("doiconv.php"); } //取得条数 if(empty($r[num])) {$r[num]=10000;} if(empty($r[relistnum])) {$r[relistnum]=1;} if(empty($start)) { $start=0; //生成检测值 $checkrnd=md5(uniqid(microtime()).EcmsRandInt()); } $exp="newsurl"; $exp1="titlepic"; //查看是否过期 $b=0; $p=0; $url_r=explode("\r\n",$r[infourl]); $j=count($url_r); for($i=$start;$i<$j&&$p<$r[relistnum];$i++) { $p++; $b=1; $dourl=trim($url_r[$i]); if(empty($dourl)||!eCheckCjUrl($dourl,1)) {continue;} //读取页面 for($readnum=0;$readnum<3;$readnum++) { $text1=ReadFiletext($dourl); if(!empty($text1)) {break;} } if(empty($text1)) {continue;} //替换回车 $text1=ReplaceFc($text1); //替换网页变量 $text1=RepCjPagetextStr($text1,$r); //区域块 if($r[zz_smallurl]) { $text1=ReturnCJ_str($r[zz_smallurl],"smallurl",$text1); if(empty($text1)) { continue; } } //替换内容链接 $text=stripSlashes(stripSlashes($r[zz_newsurl])); //替换回车 $text=ReplaceFc($text); $zztext=RepInfoZZ($text,$exp,0); $strtext=GetInfoStr($text,$exp,1); if($text) { $text1=stripSlashes(preg_replace($zztext,$strtext,$text1)); } //替换标题图片地址 if($r[zz_titlepicl]&&!$r[z_titlepicl]) { $text=stripSlashes(stripSlashes($r[zz_titlepicl])); //替换回车 $text=ReplaceFc($text); $zztext=RepInfoZZ($text,$exp1,0); $strtext=GetInfoStr($text,$exp1,1); if($text) { $text1=stripSlashes(preg_replace($zztext,$strtext,$text1)); } } //链接写入数据库 EchoUrl($text1,$exp,$exp1,$r,$r[httpurl],$classid,$r[num],$checkrnd); } $newstart=$i; //采集链接完毕 if(empty($b)) { echo $fun_r['GetUrlOver'].""; exit(); } //echo $fun_r['GetOneListUrl'].""; echo"".$fun_r['GetOneListUrl']; exit(); } //###################采集页面列表################## function ViewCjList($classid,$userid,$username){ global $empire,$fun_r,$dbtbpre; $classid=(int)$classid; if(empty($classid)) {printerror("NotChangeCjid","history.go(-1)");} //验证权限 CheckLevel($userid,$username,$classid,"cj"); $r=$empire->fetch1("select endday,num,zz_smallurl,zz_newsurl,httpurl,infourl,newsclassid,relistnum,zz_titlepicl,z_titlepicl,qz_titlepicl,save_titlepicl,infourlispage from {$dbtbpre}enewsinfoclass where classid='$classid'"); if(empty($r[newsclassid])) {printerror("NotCjid","history.go(-1)");} //直接内容页列表 if($r[infourlispage]) { PageViewCjList($classid,$r,$userid,$username); } $url_r=explode("\r\n",$r[infourl]); $j=count($url_r); $ecmshashhref=hReturnEcmsHashStrHref(0); for($i=0;$i<$j;$i++) { if(empty($url_r[$i])) {continue;} $dourl=urlencode($url_r[$i]); $data.="".$url_r[$i]."[".$fun_r['view']."]"; } $data="

".$fun_r['CjListUrl']."

".$data."
URLVIEW
"; echo $data; exit(); } //###################采集内容页面列表################## function PageViewCjList($classid,$cr,$userid,$username){ global $empire,$fun_r,$dbtbpre; //取得条数 if(empty($cr[num])) {$cr[num]=10000;} $url_r=explode("\r\n",$cr[infourl]); $count=count($url_r); if($count>$cr[num]) { $count=$cr[num]; } $ecmshashhref=hReturnEcmsHashStrHref(0); for($i=0;$i<$count;$i++) { $dourl=trim($url_r[$i]); if(empty($dourl)) { continue; } //是否有http if(strstr($dourl,"http://")||strstr($dourl,"https://")) {} else { $dourl=$cr[httpurl].$dourl; } //替换地址 $dourl=RepCjUrlStr($dourl); if(empty($dourl)) {continue;} $dourl=urlencode($dourl); $data.="".$url_r[$i]."[".$fun_r['view']."]"; } $data="

".$fun_r['CjListUrl']."

".$data."
URLVIEW
"; echo $data; exit(); } //#################预览采集列表 function ViewCjUrl($classid,$listpage,$userid,$username){ global $empire,$fun_r,$dbtbpre; $classid=(int)$classid; if(empty($classid)||empty($listpage)) {printerror("NotChangeCjid","history.go(-1)");} //验证权限 CheckLevel($userid,$username,$classid,"cj"); $r=$empire->fetch1("select endday,num,zz_smallurl,zz_newsurl,httpurl,infourl,newsclassid,relistnum,zz_titlepicl,z_titlepicl,qz_titlepicl,save_titlepicl,tbname,recjtheurl,enpagecode,pagerepad,oldpagerep,newpagerep from {$dbtbpre}enewsinfoclass where classid='$classid'"); if(empty($r[newsclassid])) {printerror("NotCjid","history.go(-1)");} //导入编码文件 if($r['enpagecode']) { @include_once("doiconv.php"); } //取得条数 if(empty($r[num])) {$r[num]=10000;} $exp="newsurl"; $exp1="titlepic"; $dourl=$listpage; eCheckCjUrl($dourl,0); //读取页面 for($readnum=0;$readnum<3;$readnum++) { $text1=ReadFiletext($dourl); if(!empty($text1)) {break;} } if(empty($text1)) { printerror("FailCjUrl","history.go(-1)"); } //替换回车 $text1=ReplaceFc($text1); //替换网页变量 $text1=RepCjPagetextStr($text1,$r); //区域块 if($r[zz_smallurl]) { $text1=ReturnCJ_str($r[zz_smallurl],"smallurl",$text1); if(empty($text1)) { printerror("EmptyCjSmallUrl","history.go(-1)"); } } //替换内容链接 $text=stripSlashes(stripSlashes($r[zz_newsurl])); //替换回车 $text=ReplaceFc($text); $zztext=RepInfoZZ($text,$exp,0); $strtext=GetInfoStr($text,$exp,1); if($text) { $text1=stripSlashes(preg_replace($zztext,$strtext,$text1)); } //替换标题图片地址 if($r[zz_titlepicl]&&!$r[z_titlepicl]) { $text=stripSlashes(stripSlashes($r[zz_titlepicl])); //替换回车 $text=ReplaceFc($text); $zztext=RepInfoZZ($text,$exp1,0); $strtext=GetInfoStr($text,$exp1,1); if($text) { $text1=stripSlashes(preg_replace($zztext,$strtext,$text1)); } } //输出地址 echo"

".$fun_r['CjListPageUrl']."

"; ViewEchoUrl($text1,$exp,$exp1,$r,$r[httpurl],$classid,$r[num],$checkrnd); echo"
URLVIEW
"; exit(); } //################输入采集页面 function ViewEchoUrl($text,$exp,$exp1,$dr,$url,$classid,$num,$checkrnd){ global $empire,$fun_r,$dbtbpre; $e1="[phome-".$exp."]"; $e2="[/phome-".$exp."]"; $ep1="[phome-".$exp1."]"; $ep2="[/phome-".$exp1."]"; $r=explode($e1,$text); //图片链接 if(!$dr[z_titlepicl]&&$dr[zz_titlepicl]) { $rp=explode($ep1,$text); } else { $titlepic=$dr[z_titlepicl]; } $ecmshashhref=hReturnEcmsHashStrHref(0); for($i=1;$igettotal("select count(*) as total from {$dbtbpre}ecms_infotmp_".$dr[tbname]." where oldurl='$dourl' limit 1"); if($dbnum) {continue;} } //图片链接 if(!$dr[z_titlepicl]&&$dr[zz_titlepicl]) { $rp1=explode($ep2,$rp[$i]); $titlepic=trim($rp1[0]); //是否有http if(strstr($titlepic,"http://")||strstr($titlepic,"https://")) {} else {$titlepic=$dr[qz_titlepicl].$titlepic;} //替换地址 $titlepic=RepCjUrlStr($titlepic); $titlepic=addslashes($titlepic); } if($titlepic) {$a="
(PIC:".$titlepic.")";} echo "".$dourl."".$a."[".$fun_r['view']."]"; } } //################################# //取得下载地址 function GetCjDownpath($text,$text1,$exp,$exp1,$url,$online=0){ global $empire,$fun_r; if($online) { $fun_r[DownPath]=""; } $e1="[phome-".$exp."]"; $e2="[/phome-".$exp."]"; $ep1="[phome-".$exp1."]"; $ep2="[/phome-".$exp1."]"; $r=explode($e1,$text); //名称 if($text1) { $rp=explode($ep1,$text1); } $p=0; for($i=1;$ifetch1("select * from {$dbtbpre}enewsinfoclass where classid='$classid'"); //副表 $ra=$empire->fetch1("select * from {$dbtbpre}ecms_infoclass_".$r[tbname]." where classid='$classid'"); //组合两数组 $r=TogTwoArray($r,$ra); //导入编码文件 if($r['enpagecode']) { @include_once(ECMS_PATH."e/class/doiconv.php"); } //取得模型 $record=""; $field=""; $mr=$empire->fetch1("select cj,tid,tbname from {$dbtbpre}enewsmod where mid='".$class_r[$r[newsclassid]][modid]."'"); $cjr=explode($record,$mr[cj]); $count=count($cjr); if(empty($start)) {$start=0;} $b=0; $sql=$empire->query("select linkid,newsurl,titlepic from {$dbtbpre}enewslinktmp where checkrnd='$checkrnd' and linkid>".$start." order by linkid limit ".$r[renum]); //采集时间 $newstime=date("Y-m-d H:i:s"); $truetime=time(); $tmptime=$newstime; while($nr=$empire->fetch($sql)) { $b=1; $newstart=$nr[linkid]; if(!eCheckCjUrl($nr[newsurl],1)) { continue; } //入库数据库是否有记录 if(empty($r[recjtheurl])) { $tmpnum=$empire->gettotal("select count(*) as total from {$dbtbpre}ecms_infotmp_".$r[tbname]." where oldurl='$nr[newsurl]' limit 1"); if($tmpnum) {continue;} } //取得远程页面,三次取不到值的将不取值 for($i=1;$i<=3;$i++) { $info=ReadFiletext($nr[newsurl]); if(!empty($info)) { break; } } if(empty($info)) {continue;} //替换网页变量 $info=RepCjPagetextStr($info,$r); //替换回车 $info=ReplaceFc($info); //----------------- $ifield=""; $ivalue=""; $next=0; for($c=0;$c<$count-1;$c++) { $zzvalue=""; $cjr1=explode($field,$cjr[$c]); $dofield=$cjr1[1]; $var="zz_".$dofield; $var1="z_".$dofield; $var2="qz_".$dofield; $var3="save_".$dofield; //标题图片 if($dofield=="titlepic") { if($nr[titlepic]) { $zzvalue=$nr[titlepic]; $ifield.=",".$dofield; $ivalue.=",'".addslashes($zzvalue)."'"; continue; } } //图片集 if($dofield=="morepic"&&$r[$var]) { //替换下载链接 $text=$r[$var]; //替换回车 $text=ReplaceFc($text); $down=explode("[!empirecms!]",$text); //小图 $zztext=RepInfoZZ($down[0],"ecmsspicurl",0); $strtext=GetInfoStr($down[0],"ecmsspicurl",1); $text1=stripSlashes(preg_replace($zztext,$strtext,$info)); //大图 if($down[1]) { $zztext=RepInfoZZ($down[1],"ecmsbpicurl",0); $strtext=GetInfoStr($down[1],"ecmsbpicurl",1); $text2=stripSlashes(preg_replace($zztext,$strtext,$info)); } //名称 if($down[2]) { $zztext=RepInfoZZ($down[2],"ecmspicname",0); $strtext=GetInfoStr($down[2],"ecmspicname",1); $text3=stripSlashes(preg_replace($zztext,$strtext,$info)); } $zzvalue=GetCjMorepicpath($text1,$text2,$text3,"ecmsspicurl","ecmsbpicurl","ecmspicname",$r[$var2]); $ifield.=",".$dofield; $ivalue.=",'".addslashes($zzvalue)."'"; continue; } //下载地址 if($dofield=="downpath"&&$r[$var]) { //替换下载链接 $text=$r[$var]; //替换回车 $text=ReplaceFc($text); $down=explode("[!empirecms!]",$text); //地址 $zztext=RepInfoZZ($down[0],"ecmsdownpathurl",0); $strtext=GetInfoStr($down[0],"ecmsdownpathurl",1); $text1=stripSlashes(preg_replace($zztext,$strtext,$info)); //名称 if($down[1]) { $zztext=RepInfoZZ($down[1],"ecmsdownpathname",0); $strtext=GetInfoStr($down[1],"ecmsdownpathname",1); $text2=stripSlashes(preg_replace($zztext,$strtext,$info)); } $zzvalue=GetCjDownpath($text1,$text2,"ecmsdownpathurl","ecmsdownpathname",$r[$var2],0); $ifield.=",".$dofield; $ivalue.=",'".addslashes($zzvalue)."'"; continue; } //在线地址 if($dofield=="onlinepath"&&$r[$var]) { //替换下载链接 $text=$r[$var]; //替换回车 $text=ReplaceFc($text); $down=explode("[!empirecms!]",$text); //地址 $zztext=RepInfoZZ($down[0],"ecmsonlinepathurl",0); $strtext=GetInfoStr($down[0],"ecmsonlinepathurl",1); $text1=stripSlashes(preg_replace($zztext,$strtext,$info)); //名称 if($down[1]) { $zztext=RepInfoZZ($down[1],"ecmsonlinepathname",0); $strtext=GetInfoStr($down[1],"ecmsonlinepathname",1); $text2=stripSlashes(preg_replace($zztext,$strtext,$info)); } $zzvalue=GetCjDownpath($text1,$text2,"ecmsonlinepathurl","ecmsonlinepathname",$r[$var2],1); $ifield.=",".$dofield; $ivalue.=",'".addslashes($zzvalue)."'"; continue; } if(empty($r[$var1])) { if($r[$var]) { $zzvalue=ReturnCJ_str($r[$var],$dofield,$info); if($zzvalue) { $zzvalue=$r[$var2].$zzvalue; } } } else {$zzvalue=$r[$var1];} //------------------------------信息时间 if($dofield=="newstime") { $newstime=$zzvalue; if(empty($newstime)) { $newstime=$tmptime; } else { $newstime=CjFormatNewstime($newstime);//时间转换 } continue; } //------------------------------信息来源 if($dofield=="befrom"||$dofield=="writer") { //标题去除html代码 $zzvalue=strip_tags(str_replace("\r\n","",$zzvalue)); } //------------------------------标题 if($dofield=="title") { //标题去除html代码 $zzvalue=ehtmlspecialchars(strip_tags(str_replace("\r\n","",$zzvalue))); if(empty($zzvalue)) { $next=1; break; } $keyboard=sub($zzvalue,0,$r[keynum],false); //标题是否包含关键字 if($r[keyboard]) { $t=HaveKeyboard($zzvalue,$r[keyboard]); if(empty($t)) { $next=1; break; } } if($r[retitlewriter])//标题完全一样 { //入库比较 $onum=$empire->gettotal("select count(*) as total from {$dbtbpre}ecms_".$class_r[$r[newsclassid]][tbname]." where title='".addslashes($zzvalue)."' and classid='$r[newsclassid]' limit 1"); if($onum) { $next=1; break; } /*采集库比较 $onum=$empire->num("select id from {$dbtbpre}ecms_infotmp_".$r[tbname]." where title='".addslashes($zzvalue)."' limit 1"); if($onum) { $next=1; break; } */ } if($r[titlelen])//标题相似 { //入库比较 $c_title=addslashes(sub($zzvalue,0,$r[titlelen],false)); $onum=$empire->gettotal("select count(*) as total from {$dbtbpre}ecms_".$class_r[$r[newsclassid]][tbname]." where title like '%$c_title%' and classid='$r[newsclassid]' limit 1"); if($onum) { $next=1; break; } /*采集比较 $onum=$empire->num("select id from {$dbtbpre}ecms_infotmp_".$r[tbname]." where title like '%$c_title%' limit 1"); if($onum) { $next=1; break; } */ } } //新闻内容分页 if($dofield=="newstext") { //是否有分页 if($r[pagezz]||$r[pageallzz]) { //上下页式 if(empty($r[pagetype])) { $zzvalue.=GetMoreCjPagetext($nr[newsurl],$r[$var],$r[smallpagezz],$r[pagezz],$r[pagetype],$info,$r); } //全部列表式 else { $zzvalue.=GetMoreCjPagetextall($nr[newsurl],$r[$var],$r[smallpageallzz],$r[pageallzz],$r[pagetype],$info,$r); } } } //替换关键字 if(stristr($r['repf'],','.$dofield.',')) { $zzvalue=RepInfoWord($zzvalue,$r[oldword],$r[newword]); } //广告过滤 if(stristr($r['repadf'],','.$dofield.',')) { $zzvalue=RepAd($r[repad],$zzvalue); } //新闻内容 if(stristr($r['isnullf'],','.$dofield.',')) { $ckzzvalue=trim($zzvalue); if($r['newstextisnull']==1&&empty($ckzzvalue)) { $next=1; break; } } $ifield.=",".$dofield; $ivalue.=",'".addslashes($zzvalue)."'"; } if($next) {continue;} //入临时库 $isql=$empire->query("insert into {$dbtbpre}ecms_infotmp_".$r[tbname]."(classid,oldurl,checked,keyboard,newstime,truetime,tmptime,userid,username".$ifield.") values($classid,'$nr[newsurl]',0,'".addslashes($keyboard)."','$newstime',$truetime,'$tmptime',$userid,'".addslashes($username)."'".$ivalue.");"); } //采集结束 if(empty($b)) { //删除记录 $del=$empire->query("delete from {$dbtbpre}enewslinktmp where checkrnd='$checkrnd'"); //更新最后时间 $ucjsql=$empire->query("update {$dbtbpre}enewsinfoclass set lasttime='".time()."' where classid='$classid'"); //自动入库 if($r['justloadin']) { echo $fun_r['cjLoadInInfos'].""; exit(); } //单个节点 if(getcvar('recjnum',1)==1) { echo"".$fun_r['CjSuccess'].""; } else { echo"".$r[classname]." ".$fun_r['CjSuccess'].", "; echo""; } exit(); } //echo"(ID:".$newstart.")"; echo"".$r[classname]." (ID:".$newstart.")"; exit(); } //#################单个采集文件预览################ function ViewGetNewsInfo($classid,$newspage,$userid,$username){ global $empire,$class_r,$fun_r,$dbtbpre; $classid=(int)$classid; if(empty($classid)||empty($newspage)) {printerror("FailCX","history.go(-1)");} //验证权限 CheckLevel($userid,$username,$classid,"cj"); $r=$empire->fetch1("select * from {$dbtbpre}enewsinfoclass where classid='$classid'"); if(empty($r[classid])) {printerror("FailCX","history.go(-1)");} //副表 $ra=$empire->fetch1("select * from {$dbtbpre}ecms_infoclass_".$r[tbname]." where classid='$classid'"); //组合两数组 $r=TogTwoArray($r,$ra); //导入编码文件 if($r['enpagecode']) { @include_once("doiconv.php"); } //取得模型 $record=""; $field=""; $mr=$empire->fetch1("select cj from {$dbtbpre}enewsmod where mid='".$class_r[$r[newsclassid]][modid]."'"); $cjr=explode($record,$mr[cj]); $count=count($cjr); //采集时间 $newstime=date("Y-m-d H:i:s"); eCheckCjUrl($newspage,0); //入库数据库是否有记录 if(empty($r[recjtheurl])) { $tmpnum=$empire->gettotal("select count(*) as total from {$dbtbpre}ecms_infotmp_".$r[tbname]." where oldurl='$newspage' limit 1"); if($tmpnum) { echo $fun_r['ReCj']; exit(); } } //取得远程页面,三次取不到值的将不取值 for($i=1;$i<=3;$i++) { $info=ReadFiletext($newspage); if(!empty($info)) { break; } } if(empty($info)) { echo $fun_r['CanNotOpenUrl']; exit(); } //替换网页变量 $info=RepCjPagetextStr($info,$r); //替换回车 $info=ReplaceFc($info); //----------------- $ifield=""; $ivalue=""; $next=0; for($c=0;$c<$count-1;$c++) { $zzvalue=""; $cjr1=explode($field,$cjr[$c]); $dofield=$cjr1[1]; $dofieldname=$cjr1[0]; $var="zz_".$dofield; $var1="z_".$dofield; $var2="qz_".$dofield; $var3="save_".$dofield; //图片集 if($dofield=="morepic"&&$r[$var]) { //替换下载链接 $text=stripSlashes(stripSlashes($r[$var])); //替换回车 $text=ReplaceFc($text); $down=explode("[!empirecms!]",$text); //小图 $zztext=RepInfoZZ($down[0],"ecmsspicurl",0); $strtext=GetInfoStr($down[0],"ecmsspicurl",1); $text1=stripSlashes(preg_replace($zztext,$strtext,$info)); //大图 if($down[1]) { $zztext=RepInfoZZ($down[1],"ecmsbpicurl",0); $strtext=GetInfoStr($down[1],"ecmsbpicurl",1); $text2=stripSlashes(preg_replace($zztext,$strtext,$info)); } //名称 if($down[2]) { $zztext=RepInfoZZ($down[2],"ecmspicname",0); $strtext=GetInfoStr($down[2],"ecmspicname",1); $text3=stripSlashes(preg_replace($zztext,$strtext,$info)); } $zzvalue=GetCjMorepicpath($text1,$text2,$text3,"ecmsspicurl","ecmsbpicurl","ecmspicname",$r[$var2]); $data.="".$dofieldname."
(".$dofield.")
".$zzvalue.""; continue; } //下载地址 if($dofield=="downpath"&&$r[$var]) { //替换下载链接 $text=stripSlashes(stripSlashes($r[$var])); //替换回车 $text=ReplaceFc($text); $down=explode("[!empirecms!]",$text); //地址 $zztext=RepInfoZZ($down[0],"ecmsdownpathurl",0); $strtext=GetInfoStr($down[0],"ecmsdownpathurl",1); $text1=stripSlashes(preg_replace($zztext,$strtext,$info)); //名称 if($down[1]) { $zztext=RepInfoZZ($down[1],"ecmsdownpathname",0); $strtext=GetInfoStr($down[1],"ecmsdownpathname",1); $text2=stripSlashes(preg_replace($zztext,$strtext,$info)); } $zzvalue=GetCjDownpath($text1,$text2,"ecmsdownpathurl","ecmsdownpathname",$r[$var2],0); $data.="".$dofieldname."
(".$dofield.")
".$zzvalue.""; continue; } //在线地址 if($dofield=="onlinepath"&&$r[$var]) { //替换下载链接 $text=stripSlashes(stripSlashes($r[$var])); //替换回车 $text=ReplaceFc($text); $down=explode("[!empirecms!]",$text); //地址 $zztext=RepInfoZZ($down[0],"ecmsonlinepathurl",0); $strtext=GetInfoStr($down[0],"ecmsonlinepathurl",1); $text1=stripSlashes(preg_replace($zztext,$strtext,$info)); //名称 if($down[1]) { $zztext=RepInfoZZ($down[1],"ecmsonlinepathname",0); $strtext=GetInfoStr($down[1],"ecmsonlinepathname",1); $text2=stripSlashes(preg_replace($zztext,$strtext,$info)); } $zzvalue=GetCjDownpath($text1,$text2,"ecmsonlinepathurl","ecmsonlinepathname",$r[$var2],1); $data.="".$dofieldname."
(".$dofield.")
".$zzvalue.""; continue; } if(empty($r[$var1])) { if($r[$var]) { $zzvalue=ReturnCJ_str($r[$var],$dofield,$info); if($zzvalue) { $zzvalue=$r[$var2].$zzvalue; } } } else {$zzvalue=$r[$var1];} //------------------------------信息来源 if($dofield=="befrom"||$dofield=="writer") { //标题去除html代码 $zzvalue=strip_tags(str_replace("\r\n","",$zzvalue)); } //------------------------------标题 if($dofield=="title") { //标题去除html代码 $zzvalue=ehtmlspecialchars(strip_tags(str_replace("\r\n","",$zzvalue))); if(empty($zzvalue)) { echo $fun_r['CjEmptyTitle']; exit(); } //标题是否包含关键字 if($r[keyboard]) { $t=HaveKeyboard($zzvalue,$r[keyboard]); if(empty($t)) { echo $fun_r['CjTitleKey']; exit(); } } if($r[retitlewriter])//标题完全一样 { //入库比较 $onum=$empire->gettotal("select count(*) as total from {$dbtbpre}ecms_".$class_r[$r[newsclassid]][tbname]." where title='".addslashes($zzvalue)."' and classid='$r[newsclassid]' limit 1"); if($onum) { echo $fun_r['CjReTitleWriter']; exit(); } /*采集库比较 $onum=$empire->num("select id from {$dbtbpre}ecms_infotmp_".$r[tbname]." where title='".addslashes($zzvalue)."' limit 1"); if($onum) { echo $fun_r['CjReTitleWriter']; exit(); } */ } if($r[titlelen])//标题相似 { //入库比较 $c_title=addslashes(sub($zzvalue,0,$r[titlelen],false)); $onum=$empire->gettotal("select count(*) as total from {$dbtbpre}ecms_".$class_r[$r[newsclassid]][tbname]." where title like '%$c_title%' and classid='$r[newsclassid]' limit 1"); if($onum) { echo $fun_r['CjSingTitlelen'].$r[titlelen].$fun_r['CjSingTitlelenL']; exit(); } /*采集比较 $onum=$empire->num("select id from {$dbtbpre}ecms_infotmp_".$r[tbname]." where title like '%$c_title%' limit 1"); if($onum) { echo $fun_r['CjSingTitlelen'].$r[titlelen].$fun_r['CjSingTitlelenL']; exit(); } */ } } //新闻内容分页 if($dofield=="newstext") { //是否有分页 if($r[pagezz]||$r[pageallzz]) { //上下页式 if(empty($r[pagetype])) { $zzvalue.=GetMoreCjPagetext($newspage,$r[$var],$r[smallpagezz],$r[pagezz],$r[pagetype],$info,$r); } //全部列表式 else { $zzvalue.=GetMoreCjPagetextall($newspage,$r[$var],$r[smallpageallzz],$r[pageallzz],$r[pagetype],$info,$r); } } } //替换关键字 if(stristr($r['repf'],','.$dofield.',')) { $zzvalue=RepInfoWord($zzvalue,$r[oldword],$r[newword]); } //替换广告 if(stristr($r['repadf'],','.$dofield.',')) { $zzvalue=RepAd($r[repad],$zzvalue); } //新闻内容 if(stristr($r['isnullf'],','.$dofield.',')) { $ckzzvalue=trim($zzvalue); if($r['newstextisnull']==1&&empty($ckzzvalue)) { echo $dofield.$fun_r['CjEmptyNewstext']; exit(); } } $data.="".$dofieldname."
(".$dofield.")
".$zzvalue.""; } //输出数据 $data="".$data."
VARGET
".$fun_r['ViewCjPage']."".$newspage."
"; echo $data; exit(); } //是否有关键字 function HaveKeyboard($title,$keyboard) { $r=explode(",",$keyboard); $b=0; for($i=0;$i1) { $b=1; break; } } return $b; } //替换关键字 function RepInfoWord($title,$oldword,$newword){ if(empty($oldword)) { return $title; } $oldword=stripSlashes($oldword); $newword=stripSlashes($newword); //替换回车 $oldword=ReplaceFc($oldword); $newword=ReplaceFc($newword); $repmore=0; if(strstr($newword,",")) { $repmore=1; $nr=explode(",",$newword); } $r=explode(",",$oldword); for($i=0;$ifetch1("select * from {$dbtbpre}enewsinfoclass where classid='$classid'"); if(!$cr['classid']) { printerror('LoadOutCjEmptyClassid',''); } if(!$cr['newsclassid'])//非采集节点 { printerror('LoadOutCjMustNewsclassid',''); } //主表 $mainfield=LoadOutCjMainField(); $mainstr=LoadOutCjMainstr($cr,$mainfield,$fieldexp,$sfieldexp); //副表 $infocr=$empire->fetch1("select * from {$dbtbpre}ecms_infoclass_".$cr[tbname]." where classid='$classid'"); $datafield=LoadOutCjDataField($cr['tid'],$cr['tbname']); $datastr=LoadOutCjDatastr($infocr,$datafield,$fieldexp,$sfieldexp); @include('../class/EmpireCMS_version.php'); $cjstr=EmpireCMS_VERSION.$recordexp.$mainstr.$recordexp.$datafield.$recordexp.$datastr; $file=$cr['tbname'].time().".cj"; $filepath=ECMS_PATH."e/data/tmp/cj/".$file; WriteFiletext_n($filepath,$cjstr); DownLoadFile($file,$filepath,1); //操作日志 insert_dolog("classid=$classid&classname=$cr[classname]"); exit(); } //返回主表字段列表 function LoadOutCjMainField(){ $field='classname,infourl,bz,num,copyimg,renum,keyboard,oldword,newword,titlelen,retitlewriter,smalltextlen,zz_smallurl,zz_newsurl,httpurl,repad,imgurl,relistnum,zz_titlepicl,z_titlepicl,qz_titlepicl,save_titlepicl,keynum,insertnum,copyflash,pagetype,smallpagezz,pagezz,smallpageallzz,pageallzz,mark,enpagecode,recjtheurl,hiddenload,justloadin,justloadcheck,delloadinfo,pagerepad,getfirstpic,oldpagerep,newpagerep,keeptime,newstextisnull,getfirstspic,getfirstspicw,getfirstspich,doaddtextpage,infourlispage,repf,repadf,loadkeeptime,isnullf'; return $field; } //返回主表组合 function LoadOutCjMainstr($r,$field,$fieldexp,$sfieldexp){ $mainstr=''; $addexp=''; $fr=explode(',',$field); $fcount=count($fr); for($i=0;$i<$fcount;$i++) { $f=$fr[$i]; $mainstr.=$addexp.$r[$f]; $addexp=$fieldexp; } return $mainstr; } //返回副表字段列表 function LoadOutCjDataField($tid,$tbname){ global $empire,$dbtbpre; $field=''; $dh=''; $fsql=$empire->query("select f from {$dbtbpre}enewsf where tid='$tid' and iscj=1"); while($fr=$empire->fetch($fsql)) { $field.=$dh.$fr['f']; $dh=','; } return $field; } //返回副表组合 function LoadOutCjDatastr($r,$field,$fieldexp,$sfieldexp){ if(empty($field)) { return ''; } $datastr=''; $addexp=''; $fr=explode(',',$field); $fcount=count($fr); for($i=0;$i<$fcount;$i++) { $f=$fr[$i]; $zzf='zz_'.$f; $zf='z_'.$f; $qzf='qz_'.$f; $savef='save_'.$f; $datastr.=$addexp.$r[$zzf].$sfieldexp.$r[$zf].$sfieldexp.$r[$qzf].$sfieldexp.$r[$savef]; $addexp=$fieldexp; } return $datastr; } //导入采集规则 function LoadInCj($add,$file,$file_name,$file_type,$file_size,$userid,$username){ global $empire,$dbtbpre; $lineexp=''; $recordexp=''; $fieldexp=''; $sfieldexp=''; //验证权限 CheckLevel($userid,$username,$classid,"loadcj"); $classid=(int)$add['classid']; if(!$classid) { printerror("EmptyLoadInCjFile","history.go(-1)"); } $cr=$empire->fetch1("select classid,islast,tid,tbname from {$dbtbpre}enewsclass where classid='$classid' and islast=1"); if(!$cr['classid']) { printerror("LoadInCjMustLastClass","history.go(-1)"); } if(!$file_name||!$file_size) { printerror("EmptyLoadInCjFile","history.go(-1)"); } //扩展名 $filetype=GetFiletype($file_name); if($filetype!=".cj") { printerror("LoadInCjErrorfiletype","history.go(-1)"); } $path=ECMS_PATH.'e/data/tmp/cj/uploadcj'.time().'.cj'; //上传文件 $cp=@move_uploaded_file($file,$path); DoChmodFile($path); $data=ReadFiletext($path); DelFiletext($path); $r=explode($recordexp,$data); $empirecmsver=$r[0]; $mainstr=$r[1]; $datafield=$r[2]; $datastr=$r[3]; if(empty($mainstr)) { printerror("EmptyLoadInCjFile","history.go(-1)"); } //主表 $infoclassid=LoadInCjInsertMainstr($classid,$cr['tid'],$cr['tbname'],$mainstr,$fieldexp,$sfieldexp); //副表 LoadInCjInsertDatastr($classid,$cr['tid'],$cr['tbname'],$infoclassid,$datafield,$datastr,$fieldexp,$sfieldexp); $cjr=$empire->fetch1("select classname from {$dbtbpre}enewsinfoclass where classid='$infoclassid'"); //操作日志 insert_dolog("classid=".$infoclassid."
classname=".$cjr[classname]); printerror("LoadInCjSuccess","cj/LoadInCj.php?from=".ehtmlspecialchars($_POST[from]).hReturnEcmsHashStrHref2(0)); } //写入主表组合 function LoadInCjInsertMainstr($classid,$tid,$tbname,$mainstr,$fieldexp,$sfieldexp){ global $empire,$dbtbpre; $mainfield=LoadOutCjMainField(); $mainfieldr=explode(',',$mainfield); $fcount=count($mainfieldr); $mainr=explode($fieldexp,$mainstr); $mainvalues=''; $count=count($mainr); if($fcount<$count) { $count=$fcount; } for($i=0;$i<$count;$i++) { if($i==0) { $mainr[$i]=ehtmlspecialchars($mainr[$i],ENT_QUOTES); } $mainvalues.=",'".addslashes($mainr[$i])."'"; } //字段不一致 if($fcount>$count) { $addcount=$fcount-$count; for($addi=0;$addi<$addcount;$addi++) { if($addi==0) { $addval=',title,newstext,'; } elseif($addi==1) { $addval=',newstext,'; } elseif($addi==2) { $addval='0'; } elseif($addi==3) { $addval=',newstext,'; } else { $addval=''; } $mainvalues.=",'$addval'"; } } $empire->query("insert into {$dbtbpre}enewsinfoclass(classid,bclassid,newsclassid,tid,tbname,".$mainfield.") values(NULL,'0','$classid','$tid','$tbname'".$mainvalues.");"); $lastid=$empire->lastid(); return $lastid; } //写入副表组合 function LoadInCjInsertDatastr($classid,$tid,$tbname,$infoclassid,$dataf,$datastr,$fieldexp,$sfieldexp){ global $empire,$dbtbpre; if(empty($dataf)) { $empire->query("insert into {$dbtbpre}ecms_infoclass_".$tbname."(classid) values('$infoclassid');"); return ''; } //返回表字段 $tbfield=LoadOutCjDataField($tid,$tbname); $datafr=explode(',',$dataf); $datar=explode($fieldexp,$datastr); $datafield=''; $datavalues=''; $count=count($datafr); for($i=0;$i<$count;$i++) { $f=$datafr[$i]; if(!stristr(','.$tbfield.',',','.$f.',')) { continue; } $zzf='zz_'.$f; $zf='z_'.$f; $qzf='qz_'.$f; $savef='save_'.$f; $zzr=explode($sfieldexp,$datar[$i]); $datafield.=",$zzf,$zf,$qzf,$savef"; $datavalues.=",'".addslashes($zzr[0])."','".addslashes($zzr[1])."','".addslashes($zzr[2])."','".addslashes($zzr[3])."'"; } $empire->query("insert into {$dbtbpre}ecms_infoclass_".$tbname."(classid".$datafield.") values('$infoclassid'".$datavalues.");"); } ?>