/trunk/lightage/website/e/class/hinfofun.php
PHP | 2207 lines | 1970 code | 30 blank | 207 comment | 275 complexity | c790d1de8f90d5009a5813447483cfe8 MD5 | raw file
Large files files are truncated, but you can click here to view the full file
- <?php
- //*************************** ÐÅÏ¢ ***************************
-
- //Ôö¼ÓͶƱ
- function AddInfoVote($classid,$id,$add){
- global $empire,$dbtbpre,$class_r;
- $num=$empire->gettotal("select count(*) as total from {$dbtbpre}enewsinfovote where id='$id' and classid='$classid' limit 1");
- $votename=$add['vote_name'];
- $votenum=$add['vote_num'];
- //ͳ¼Æ×ÜƱÊý
- for($i=0;$i<count($votename);$i++)
- {
- $t_votenum+=$votenum[$i];
- }
- $t_votenum=(int)$t_votenum;
- $voteclass=(int)$add['vote_class'];
- $width=(int)$add['vote_width'];
- $height=(int)$add['vote_height'];
- $doip=(int)$add['dovote_ip'];
- $tempid=(int)$add['vote_tempid'];
- //¸½¼Ó×Ö¶Î
- $diyotherlink=(int)$add['info_diyotherlink'];
- $infouptime=0;
- if($add['info_infouptime'])
- {
- $infouptime=to_time($add['info_infouptime']);
- }
- $infodowntime=0;
- if($add['info_infodowntime'])
- {
- $infodowntime=to_time($add['info_infodowntime']);
- }
- if($num) //ÐÞ¸Ä
- {
- $votetext=ReturnVote($add['vote_name'],$add['vote_num'],$add['delvote_id'],$add['vote_id'],1); //·µ»Ø×éºÏ
- $sql=$empire->query("update {$dbtbpre}enewsinfovote set title='$add[vote_title]',votetext='$votetext',voteclass=$voteclass,doip=$doip,dotime='$add[vote_dotime]',tempid=$tempid,width=$width,height=$height,diyotherlink='$diyotherlink',infouptime='$infouptime',infodowntime='$infodowntime' where id='$id' and classid='$classid' limit 1");
- }
- else //Ôö¼Ó
- {
- $votetext=ReturnVote($add['vote_name'],$add['vote_num'],$add['delvote_id'],$add['vote_id'],0); //·µ»Ø×éºÏ
- if(!($votetext||$diyotherlink||$infouptime||$infodowntime))
- {
- return '';
- }
- $sql=$empire->query("insert into {$dbtbpre}enewsinfovote(id,classid,title,voteip,votetext,voteclass,doip,dotime,tempid,width,height,diyotherlink,infouptime,infodowntime) values('$id','$classid','$add[vote_title]','','$votetext',$voteclass,$doip,'$add[vote_dotime]',$tempid,$width,$height,'$diyotherlink','$infouptime','$infodowntime');");
- }
- $usql=$empire->query("update {$dbtbpre}ecms_".$class_r[$classid][tbname]." set votenum=$t_votenum where id='$id'");
- }
-
- //Ôö¼ÓÐÅÏ¢´¦Àí±äÁ¿
- function DoPostInfoVar($add){
- global $class_r;
- //×éºÏ±êÌâÊôÐÔ
- $add[titlecolor]=RepPhpAspJspcodeText($add[titlecolor]);
- $add['my_titlefont']=TitleFont($add[titlefont],$add[titlecolor]);
- //×éºÏרÌâID
- $add['my_ztid']=ZtId($add[ztid]);
- //ÆäËü±äÁ¿
- $add[keyboard]=RepPhpAspJspcodeText(DoReplaceQjDh($add[keyboard]));
- $add[titleurl]=RepPhpAspJspcodeText($add[titleurl]);
- $add[checked]=(int)$add[checked];
- $add[istop]=(int)$add[istop];
- $add[dokey]=(int)$add[dokey];
- $add[isgood]=(int)$add[isgood];
- $add[groupid]=(int)$add[groupid];
- $add[newstempid]=(int)$add[newstempid];
- $add[firsttitle]=(int)$add[firsttitle];
- $add[userfen]=(int)$add[userfen];
- $add[closepl]=(int)$add[closepl];
- $add[ttid]=(int)$add[ttid];
- $add[onclick]=(int)$add[onclick];
- $add[totaldown]=(int)$add[totaldown];
- $add[infotags]=RepPhpAspJspcodeText(DoReplaceQjDh($add[infotags]));
- $add[ispic]=$add[titlepic]?1:0;
- $add[filename]=RepFilenameQz($add[filename],1);
- $add[newspath]=RepFilenameQz($add[newspath],1);
- return $add;
- }
-
- //Ïà¹ØÁ´½ÓID´¦Àí
- function DoPostDiyOtherlinkID($keyid){
- if(!$keyid||$keyid==',')
- {
- return '';
- }
- $new_keyid='';
- $dh='';
- $r=explode(',',$keyid);
- $count=count($r);
- for($i=0;$i<$count;$i++)
- {
- $r[$i]=(int)$r[$i];
- if(!$r[$i])
- {
- continue;
- }
- $new_keyid.=$dh.$r[$i];
- $dh=',';
- }
- return $new_keyid;
- }
-
- //Ôö¼ÓÐÅÏ¢
- function AddNews($add,$userid,$username){
- global $empire,$class_r,$class_zr,$bclassid,$public_r,$dbtbpre,$emod_r;
- $add[classid]=(int)$add[classid];
- $userid=(int)$userid;
- $ztid=$add[ztid];
- if(!$add[title]||!$add[classid])
- {
- printerror("EmptyTitle","history.go(-1)");
- }
- //²Ù×÷ȨÏÞ
- $doselfinfo=CheckLevel($userid,$username,$add[classid],"news");
- if(!$doselfinfo['doaddinfo'])//Ôö¼ÓȨÏÞ
- {
- printerror("NotAddInfoLevel","history.go(-1)");
- }
- $ccr=$empire->fetch1("select classid,modid,listdt,haddlist,sametitle,addreinfo,wburl,repreinfo from {$dbtbpre}enewsclass where classid='$add[classid]' and islast=1");
- if(!$ccr['classid']||$ccr[wburl])
- {
- printerror("ErrorUrl","history.go(-1)");
- }
- if($ccr['sametitle'])//ÑéÖ¤±êÌâÖظ´
- {
- $num=$empire->gettotal("select count(*) as total from {$dbtbpre}ecms_".$class_r[$add[classid]][tbname]." where title='$add[title]' limit 1");
- if($num)
- {
- printerror("ReInfoTitle","history.go(-1)");
- }
- }
- $add=DoPostInfoVar($add);//·µ»Ø±äÁ¿
- $ret_r=ReturnAddF($add,$class_r[$add[classid]][modid],$userid,$username,0,0,1);//·µ»Ø×Ô¶¨Òå×Ö¶Î
- $newspath=FormatPath($add[classid],$add[newspath],1);//²é¿´Ä¿Â¼ÊÇ·ñ´æÔÚ£¬²»´æÔÚÔò½¨Á¢
- //Ç©·¢
- $isqf=0;
- if($class_r[$add[classid]][wfid])
- {
- $add[checked]=0;
- $isqf=1;
- }
- $truetime=time();
- $lastdotime=$truetime;
- //·µ»Ø¹Ø¼ü×Ö×éºÏ
- if($add['info_diyotherlink'])
- {
- $keyid=DoPostDiyOtherlinkID($add['info_keyid']);
- }
- else
- {
- $keyid=GetKeyid($add[keyboard],$add[classid],0,$class_r[$add[classid]][link_num]);
- }
- //Ö÷±í
- $sql=$empire->query("insert into {$dbtbpre}ecms_".$class_r[$add[classid]][tbname]."(classid,onclick,newspath,keyboard,keyid,userid,username,ztid,checked,istop,truetime,ismember,dokey,isgood,titlefont,titleurl,filename,groupid,newstempid,plnum,firsttitle,isqf,userfen,totaldown,closepl,havehtml,lastdotime,haveaddfen,infopfen,infopfennum,votenum,stb,ttid,infotags,ispic".$ret_r[fields].") values($add[classid],'$add[onclick]','$newspath','".addslashes($add[keyboard])."','$keyid',$userid,'".addslashes($username)."','$add[my_ztid]',$add[checked],'$add[istop]',$truetime,0,$add[dokey],$add[isgood],'".addslashes($add[my_titlefont])."','".addslashes($add[titleurl])."','$filename',$add[groupid],$add[newstempid],0,$add[firsttitle],'$isqf',$add[userfen],'$add[totaldown]',$add[closepl],0,$lastdotime,0,0,0,0,'".$ret_r[tb]."','$add[ttid]','".addslashes($add[infotags])."','$add[ispic]'".$ret_r[values].");");
- $id=$empire->lastid();
- //¸±±í
- $fsql=$empire->query("insert into {$dbtbpre}ecms_".$class_r[$add[classid]][tbname]."_data_".$ret_r['tb']."(id,classid".$ret_r[datafields].") values('$id','$add[classid]'".$ret_r[datavalues].");");
- //Ç©·¢
- if($isqf==1)
- {
- InfoInsertToWorkflow($id,$add[classid],$class_r[$add[classid]][wfid],$userid,$username);
- }
- //¸üи½¼þ±í
- UpdateTheFile($id,$add['filepass']);
- //È¡µÚÒ»ÕÅͼ×÷Ϊ±êÌâͼƬ
- if($add['getfirsttitlepic']&&empty($add['titlepic']))
- {
- $firsttitlepic=GetFpicToTpic($add['classid'],$id,$add['getfirsttitlepic'],$add['getfirsttitlespic'],$add['getfirsttitlespicw'],$add['getfirsttitlespich']);
- if($firsttitlepic)
- {
- $addtitlepic=",titlepic='".addslashes($firsttitlepic)."',ispic=1";
- }
- }
- //ÎļþÃüÃû
- if($add['filename'])
- {
- $filename=$add['filename'];
- }
- else
- {
- $filename=ReturnInfoFilename($add[classid],$id,'');
- }
- $usql=$empire->query("update {$dbtbpre}ecms_".$class_r[$add[classid]][tbname]." set filename='$filename'".$addtitlepic." where id='$id'");
- //Ì滻ͼƬÏÂÒ»Ò³
- if($add['repimgnexturl'])
- {
- UpdateImgNexturl($add[classid],$id);
- }
- //ͶƱ
- AddInfoVote($add['classid'],$id,$add);
- //TAGS
- if($add[infotags]&&$add[infotags]<>$add[oldinfotags])
- {
- $tagtime=empty($add[newstime])?time():to_time($add[newstime]);
- eInsertTags($add[infotags],$add['classid'],$id,$tagtime);
- }
- //Ôö¼ÓÐÅÏ¢ÊÇ·ñÉú³ÉÎļþ
- if($ccr['addreinfo'])
- {
- $ar=$empire->fetch1("select * from {$dbtbpre}ecms_".$class_r[$add[classid]][tbname]." where id='$id'");
- GetHtml($ar,'');
- }
- //Éú³ÉÉÏһƪ
- if($ccr['repreinfo']&&$add[checked])
- {
- $prer=$empire->fetch1("select * from {$dbtbpre}ecms_".$class_r[$add[classid]][tbname]." where id<$id and classid='$add[classid]' and checked=1 order by id desc limit 1");
- GetHtml($prer,'');
- }
- //Éú³ÉÀ¸Ä¿
- if($ccr[haddlist]&&$add[checked])
- {
- hAddListHtml($add[classid],$ccr['modid'],$ccr['haddlist'],$ccr['listdt']);//Éú³ÉÐÅÏ¢Áбí
- for($z=0;$z<count($ztid);$z++)//Éú³ÉרÌâÁбí
- {
- ListHtml(intval($ztid[$z]),'',1);
- }
- }
- //ͬʱ·¢²¼
- $copyclassid=$add[copyclassid];
- $cpcount=count($copyclassid);
- if($cpcount)
- {
- $copyids=AddInfoToCopyInfo($add[classid],$id,$copyclassid,$userid,$username);
- if($copyids)
- {
- $empire->query("update {$dbtbpre}ecms_".$class_r[$add[classid]][tbname]." set copyids='$copyids' where id='$id'");
- }
- }
- 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];
- }
- $GLOBALS['ecmsadderrorurl']=$ecmsfrom;
- insert_dolog("classid=$add[classid]<br>id=".$id."<br>title=".$add[title]);//²Ù×÷ÈÕÖ¾
- printerror("AddNewsSuccess","AddNews.php?enews=AddNews&ecmsnfrom=$add[ecmsnfrom]&bclassid=$add[bclassid]&classid=$add[classid]");
- }
- else
- {
- printerror("DbError","");
- }
- }
-
- //ÐÞ¸ÄÐÅÏ¢
- function EditNews($add,$userid,$username){
- global $empire,$class_r,$class_zr,$bclassid,$public_r,$dbtbpre,$emod_r;
- $add[classid]=(int)$add[classid];
- $userid=(int)$userid;
- $ztid=$add[ztid];
- $add[id]=(int)$add[id];
- if(!$add[id]||!$add[title]||!$add[classid]||!$add[filename])
- {
- printerror("EmptyTitle","history.go(-1)");
- }
- $doselfinfo=CheckLevel($userid,$username,$add[classid],"news");//²Ù×÷ȨÏÞ
- if(!$doselfinfo['doeditinfo'])//±à¼È¨ÏÞ
- {
- printerror("NotEditInfoLevel","history.go(-1)");
- }
- $ccr=$empire->fetch1("select classid,modid,listdt,haddlist,sametitle,addreinfo,wburl,repreinfo from {$dbtbpre}enewsclass where classid='$add[classid]' and islast=1");
- if(!$ccr['classid']||$ccr[wburl])
- {
- printerror("ErrorUrl","history.go(-1)");
- }
- $checkr=$empire->fetch1("select id,userid,username,ismember,stb,copyids,newspath,filename,isqf,checked from {$dbtbpre}ecms_".$class_r[$add[classid]][tbname]." where id='$add[id]' and classid='$add[classid]'");
- if(!$checkr[id])
- {
- printerror("ErrorUrl","history.go(-1)");
- }
- if($doselfinfo['doselfinfo']&&($checkr[userid]<>$userid||$checkr[ismember]))//Ö»Äܱà¼×Ô¼ºµÄÐÅÏ¢
- {
- printerror("NotDoSelfinfo","history.go(-1)");
- }
- if($ccr['sametitle'])//ÑéÖ¤±êÌâÖظ´
- {
- $num=$empire->gettotal("select count(*) as total from {$dbtbpre}ecms_".$class_r[$add[classid]][tbname]." where title='$add[title]' and id<>$add[id] limit 1");
- if($num)
- {
- printerror("ReInfoTitle","history.go(-1)");
- }
- }
- $mid=$class_r[$add[classid]][modid];
- $pf=$emod_r[$mid]['pagef'];
- $add=DoPostInfoVar($add);//·µ»Ø±äÁ¿
- $ret_r=ReturnAddF($add,$class_r[$add[classid]][modid],$userid,$username,1,0,1);//·µ»Ø×Ô¶¨Òå×Ö¶Î
- $deloldfile=0;
- if($add[groupid]<>$add[oldgroupid]||($checkr['checked']&&!$add[checked]))//¸Ä±äÎļþȨÏÞ
- {
- DelNewsFile($checkr[filename],$checkr[newspath],$add[classid],$add[$pf],$add[oldgroupid]);//ɾ³ý¾ÉµÄÎļþ
- $deloldfile=1;
- }
- //Ç©·¢
- $a='';
- if($class_r[$add[classid]][wfid]&&$checkr['isqf'])
- {
- $qfr=$empire->fetch1("select checktno from {$dbtbpre}enewswfinfo where id='$add[id]' and classid='$add[classid]' limit 1");
- if($qfr['checktno']=='100')//ÒÑͨ¹ý
- {
- $aqf=",checked='$add[checked]'";
- }
- else
- {
- if($add[reworkflow])
- {
- InfoUpdateToWorkflow($add[id],$add[classid],$class_r[$add[classid]][wfid],$userid,$username);
- }
- $aqf='';
- }
- }
- else
- {
- $aqf=",checked='$add[checked]'";
- }
- //ÈÕÆÚĿ¼
- $updatefile='';
- if($add['newspath']!=$checkr[newspath])
- {
- $add[newspath]=FormatPath($add[classid],$add[newspath],1);//²é¿´Ä¿Â¼ÊÇ·ñ´æÔÚ£¬²»´æÔÚÔò½¨Á¢
- $updatefile.=",newspath='$add[newspath]'";
- if($deloldfile==0)
- {
- DelNewsFile($checkr[filename],$checkr[newspath],$add[classid],$add[$pf],$add[oldgroupid]);//ɾ³ý¾ÉÎļþ
- $deloldfile=1;
- }
- }
- //ÎļþÃû
- if($add['filename']&&$add['filename']!=$checkr[filename])
- {
- $newfilename=$add['filename'];
- $updatefile.=",filename='$newfilename'";
- if($deloldfile==0)
- {
- DelNewsFile($checkr[filename],$checkr[newspath],$add[classid],$add[$pf],$add[oldgroupid]);//ɾ³ý¾ÉÎļþ
- $deloldfile=1;
- }
- }
- $lastdotime=time();
- //·µ»Ø¹Ø¼ü×Ö×éºÏ
- if($add['info_diyotherlink'])
- {
- $keyid=DoPostDiyOtherlinkID($add['info_keyid']);
- }
- else
- {
- $keyid=GetKeyid($add[keyboard],$add[classid],$add[id],$class_r[$add[classid]][link_num]);
- }
- //Ö÷±í
- $sql=$empire->query("update {$dbtbpre}ecms_".$class_r[$add[classid]][tbname]." set classid='$add[classid]',keyboard='".addslashes($add[keyboard])."',keyid='$keyid',ztid='$add[my_ztid]',istop=$add[istop],dokey=$add[dokey],isgood=$add[isgood],titlefont='".addslashes($add[my_titlefont])."',titleurl='".addslashes($add[titleurl])."',groupid=$add[groupid],newstempid=$add[newstempid],firsttitle=$add[firsttitle],userfen=$add[userfen],closepl=$add[closepl],lastdotime=$lastdotime,ttid='$add[ttid]',onclick='$add[onclick]',totaldown='$add[totaldown]',infotags='".addslashes($add[infotags])."',ispic='$add[ispic]'".$updatefile.$aqf.$ret_r[values]." where id='$add[id]'");
- //¸±±í
- $stb=$checkr['stb'];
- $fsql=$empire->query("update {$dbtbpre}ecms_".$class_r[$add[classid]][tbname]."_data_".$stb." set classid='$add[classid]'".$ret_r[datavalues]." where id='$add[id]'");
- //È¡µÚÒ»ÕÅͼ×÷Ϊ±êÌâͼƬ
- if($add['getfirsttitlepic']&&empty($add['titlepic']))
- {
- $firsttitlepic=GetFpicToTpic($add['classid'],$add['id'],$add['getfirsttitlepic'],$add['getfirsttitlespic'],$add['getfirsttitlespicw'],$add['getfirsttitlespich']);
- if($firsttitlepic)
- {
- $usql=$empire->query("update {$dbtbpre}ecms_".$class_r[$add[classid]][tbname]." set titlepic='".addslashes($firsttitlepic)."',ispic=1 where id='$add[id]'");
- }
- }
- //¸üи½¼þ
- UpdateTheFileEdit($add['classid'],$add['id']);
- //Ì滻ͼƬÏÂÒ»Ò³
- if($add['repimgnexturl'])
- {
- UpdateImgNexturl($add['classid'],$add['id']);
- }
- //ͶƱ
- AddInfoVote($add['classid'],$add['id'],$add);
- //TAGS
- if($add[infotags]&&$add[infotags]<>$add[oldinfotags])
- {
- $tagtime=empty($add[newstime])?time():to_time($add[newstime]);
- eInsertTags($add[infotags],$add['classid'],$add['id'],$tagtime);
- }
- //Éú³ÉÎļþ
- if($ccr['addreinfo'])
- {
- $ar=$empire->fetch1("select * from {$dbtbpre}ecms_".$class_r[$add[classid]][tbname]." where id='$add[id]'");
- GetHtml($ar,'');
- }
- //Éú³ÉÉÏһƪ
- if($ccr['repreinfo']&&($add[checked]||$add[checked]<>$add[oldchecked]))
- {
- $prer=$empire->fetch1("select * from {$dbtbpre}ecms_".$class_r[$add[classid]][tbname]." where id<$add[id] and classid='$add[classid]' and checked=1 order by id desc limit 1");
- GetHtml($prer,'');
- }
- //Éú³ÉÀ¸Ä¿
- if($ccr['haddlist']&&($add[checked]||$add[checked]<>$add[oldchecked]))
- {
- hAddListHtml($add[classid],$ccr['modid'],$ccr['haddlist'],$ccr['listdt']);//Éú³ÉÐÅÏ¢Áбí
- for($z=0;$z<count($ztid);$z++)//Éú³ÉרÌâÁбí
- {
- ListHtml(intval($ztid[$z]),'',1);
- }
- //¸Ä±äרÌâ
- $oldztid=$add[oldztid];
- $myztid=$add['my_ztid'];
- if($oldztid<>$myztid&&$oldztid)
- {
- $o_z=explode("|",$oldztid);
- for($z=1;$z<count($o_z)-1;$z++)
- {
- $cr=explode("|".$o_z[$z]."|",$myztid);
- if($cr==1)
- {
- ListHtml(intval($o_z[$z]),'',1);
- }
- }
- }
- }
- //ͬʱ¸üÐÂ
- if($checkr['copyids']&&$checkr['copyids']<>'1')
- {
- EditInfoToCopyInfo($add[classid],$add[id],$userid,$username);
- }
- else
- {
- $copyclassid=$add[copyclassid];
- $cpcount=count($copyclassid);
- if($cpcount)
- {
- $copyids=AddInfoToCopyInfo($add[classid],$add[id],$copyclassid,$userid,$username);
- if($copyids)
- {
- $empire->query("update {$dbtbpre}ecms_".$class_r[$add[classid]][tbname]." set copyids='$copyids' where id='$add[id]'");
- }
- }
- }
- if($sql)
- {
- //·µ»ØµØÖ·
- if($add['ecmsfrom']&&(stristr($add['ecmsfrom'],'ListNews.php')||stristr($add['ecmsfrom'],'ListAllInfo.php')))
- {
- $ecmsfrom=$add['ecmsfrom'];
- }
- else
- {
- $ecmsfrom="ListNews.php?bclassid=$add[bclassid]&classid=$add[classid]";
- }
- insert_dolog("classid=$add[classid]<br>id=".$add[id]."<br>title=".$add[title]);//²Ù×÷ÈÕÖ¾
- printerror("EditNewsSuccess",$ecmsfrom);
- }
- else
- {
- printerror("DbError","history.go(-1)");
- }
- }
-
- //ÐÞ¸ÄÐÅÏ¢(¿ìËÙ)
- function EditInfoSimple($add,$userid,$username){
- global $empire,$class_r,$class_zr,$bclassid,$public_r,$dbtbpre,$emod_r;
- $add[classid]=(int)$add[classid];
- $userid=(int)$userid;
- $ztid=$add[ztid];
- $add[id]=(int)$add[id];
- $closeurl='info/EditInfoSimple.php?isclose=1&reload=1';
- if(!$add[id]||!$add[title]||!$add[classid])
- {
- printerror("EmptyTitle","history.go(-1)",8);
- }
- $doselfinfo=CheckLevel($userid,$username,$add[classid],"news");//²Ù×÷ȨÏÞ
- if(!$doselfinfo['doeditinfo'])//±à¼È¨ÏÞ
- {
- printerror("NotEditInfoLevel","history.go(-1)",8);
- }
- $ccr=$empire->fetch1("select classid,modid,listdt,haddlist,sametitle,addreinfo,wburl,repreinfo from {$dbtbpre}enewsclass where classid='$add[classid]' and islast=1");
- if(!$ccr['classid']||$ccr[wburl])
- {
- printerror("ErrorUrl","history.go(-1)",8);
- }
- $checkr=$empire->fetch1("select id,userid,username,ismember,stb,copyids,newspath,filename,isqf,checked from {$dbtbpre}ecms_".$class_r[$add[classid]][tbname]." where id='$add[id]' and classid='$add[classid]'");
- if(!$checkr[id])
- {
- printerror("ErrorUrl","history.go(-1)",8);
- }
- if($doselfinfo['doselfinfo']&&($checkr[userid]<>$userid||$checkr[ismember]))//Ö»Äܱà¼×Ô¼ºµÄÐÅÏ¢
- {
- printerror("NotDoSelfinfo","history.go(-1)",8);
- }
- if($ccr['sametitle'])//ÑéÖ¤±êÌâÖظ´
- {
- $num=$empire->gettotal("select count(*) as total from {$dbtbpre}ecms_".$class_r[$add[classid]][tbname]." where title='$add[title]' and id<>$add[id] limit 1");
- if($num)
- {
- printerror("ReInfoTitle","history.go(-1)",8);
- }
- }
- $mid=$class_r[$add[classid]][modid];
- $pf=$emod_r[$mid]['pagef'];
- $add=DoPostInfoVar($add);//·µ»Ø±äÁ¿
- //Ç©·¢
- $a="";
- if($class_r[$add[classid]][wfid]&&$checkr['isqf'])
- {
- $qfr=$empire->fetch1("select checktno from {$dbtbpre}enewswfinfo where id='$add[id]' and classid='$add[classid]' limit 1");
- if($qfr['checktno']=='100')//ÒÑͨ¹ý
- {
- $aqf=",checked='$add[checked]'";
- }
- else
- {
- if($add[reworkflow])
- {
- InfoUpdateToWorkflow($add[id],$add[classid],$class_r[$add[classid]][wfid],$userid,$username);
- }
- $aqf='';
- }
- }
- else
- {
- $aqf=",checked='$add[checked]'";
- }
- $lastdotime=time();
- //·¢²¼Ê±¼ä
- $newstime=empty($add['newstime'])?time():to_time($add['newstime']);
- //Ö÷±í
- $sql=$empire->query("update {$dbtbpre}ecms_".$class_r[$add[classid]][tbname]." set classid='$add[classid]',istop='$add[istop]',isgood='$add[isgood]',titlefont='".addslashes($add[my_titlefont])."',titleurl='".addslashes($add[titleurl])."',firsttitle='$add[firsttitle]',closepl='$add[closepl]',lastdotime='$lastdotime',ttid='$add[ttid]',onclick='$add[onclick]',totaldown='$add[totaldown]',ispic='$add[ispic]',title='".addslashes($add[title])."',titlepic='".addslashes($add[titlepic])."',newstime='$newstime'".$aqf." where id='$add[id]'");
- //¸üи½¼þ
- UpdateTheFileEdit($add['classid'],$add['id']);
- //Éú³ÉÎļþ
- if($ccr['addreinfo'])
- {
- $ar=$empire->fetch1("select * from {$dbtbpre}ecms_".$class_r[$add[classid]][tbname]." where id='$add[id]'");
- GetHtml($ar,'');
- }
- //Éú³ÉÉÏһƪ
- if($ccr['repreinfo']&&($add[checked]||$add[checked]<>$add[oldchecked]))
- {
- $prer=$empire->fetch1("select * from {$dbtbpre}ecms_".$class_r[$add[classid]][tbname]." where id<$add[id] and classid='$add[classid]' and checked=1 order by id desc limit 1");
- GetHtml($prer,'');
- }
- //Éú³ÉÀ¸Ä¿
- if($ccr['haddlist']&&($add[checked]||$add[checked]<>$add[oldchecked]))
- {
- hAddListHtml($add[classid],$ccr['modid'],$ccr['haddlist'],$ccr['listdt']);//Éú³ÉÐÅÏ¢Áбí
- }
- //ͬʱ¸üÐÂ
- if($checkr['copyids']&&$checkr['copyids']<>'1')
- {
- EditInfoToCopyInfo($add[classid],$add[id],$userid,$username);
- }
- if($sql)
- {
- //·µ»ØµØÖ·
- if($add['ecmsfrom']&&(stristr($add['ecmsfrom'],'ListNews.php')||stristr($add['ecmsfrom'],'ListAllInfo.php')))
- {
- $ecmsfrom=$add['ecmsfrom'];
- }
- else
- {
- $ecmsfrom="ListNews.php?bclassid=$add[bclassid]&classid=$add[classid]";
- }
- insert_dolog("classid=$add[classid]<br>id=".$add[id]."<br>title=".$add[title]);//²Ù×÷ÈÕÖ¾
- printerror("EditNewsSuccess",$closeurl,8);
- }
- else
- {
- printerror("DbError","history.go(-1)",8);
- }
- }
-
- //ɾ³ýÐÅÏ¢
- function DelNews($id,$classid,$userid,$username){
- global $empire,$class_r,$class_zr,$bclassid,$public_r,$dbtbpre,$emod_r;
- $id=(int)$id;
- $classid=(int)$classid;
- if(!$id||!$classid)
- {
- printerror("NotDelNewsid","history.go(-1)");
- }
- $doselfinfo=CheckLevel($userid,$username,$classid,"news");//²Ù×÷ȨÏÞ
- if(!$doselfinfo['dodelinfo'])//ɾ³ýȨÏÞ
- {
- printerror("NotDelInfoLevel","history.go(-1)");
- }
- $ccr=$empire->fetch1("select classid,modid,listdt,haddlist,repreinfo from {$dbtbpre}enewsclass where classid='$classid'");
- if(!$ccr['classid'])
- {
- printerror("ErrorUrl","history.go(-1)");
- }
- $r=$empire->fetch1("select * from {$dbtbpre}ecms_".$class_r[$classid][tbname]." where id='$id' and classid='$classid'");
- if(!$r[classid])
- {
- printerror("ErrorUrl","history.go(-1)");
- }
- if($doselfinfo['doselfinfo']&&($r[userid]<>$userid||$r[ismember]))//Ö»Äܱà¼×Ô¼ºµÄÐÅÏ¢
- {
- printerror("NotDoSelfinfo","history.go(-1)");
- }
- $mid=$class_r[$classid][modid];
- $tbname=$class_r[$classid][tbname];
- $pf=$emod_r[$mid]['pagef'];
- $stf=$emod_r[$mid]['savetxtf'];
- //·ÖÒ³×Ö¶Î
- if($pf)
- {
- if(strstr($emod_r[$mid]['tbdataf'],','.$pf.','))
- {
- $finfor=$empire->fetch1("select ".$pf." from {$dbtbpre}ecms_".$tbname."_data_".$r[stb]." where id='$id'");
- $r[$pf]=$finfor[$pf];
- }
- }
- //´æÎı¾
- if($stf)
- {
- $newstextfile=$r[$stf];
- $r[$stf]=GetTxtFieldText($r[$stf]);
- DelTxtFieldText($newstextfile);//ɾ³ýÎļþ
- }
- DelNewsFile($r[filename],$r[newspath],$classid,$r[$pf],$r[groupid]);//ɾ³ýÐÅÏ¢Îļþ
- $sql=$empire->query("delete from {$dbtbpre}ecms_".$tbname." where id='$id'");
- $fsql=$empire->query("delete from {$dbtbpre}ecms_".$tbname."_data_".$r[stb]." where id='$id'");
- //ɾ³ýÆäËü±í¼Ç¼
- $delsql=$empire->query("delete from {$dbtbpre}enewswfinfo where id='$id' and classid='$r[classid]'");
- $delsql=$empire->query("delete from {$dbtbpre}enewswfinfolog where id='$id' and classid='$r[classid]'");
- $delsql=$empire->query("delete from {$dbtbpre}enewsinfovote where id='$id' and classid='$r[classid]'");
- $delsql=$empire->query("delete from {$dbtbpre}enewsdiggips where id='$id' and classid='$r[classid]'");
- DelNewsTheFile($id,$classid);//ɾ³ý¸½¼þ
- if($r['checked'])
- {
- //Éú³ÉÉÏһƪ
- if($ccr['repreinfo'])
- {
- $prer=$empire->fetch1("select * from {$dbtbpre}ecms_".$tbname." where id<$id and classid='$classid' and checked=1 order by id desc limit 1");
- GetHtml($prer,'');
- //ÏÂһƪ
- $nextr=$empire->fetch1("select * from {$dbtbpre}ecms_".$tbname." where id>$id and classid='$classid' and checked=1 order by id limit 1");
- if($nextr['id'])
- {
- GetHtml($nextr,'');
- }
- }
- hAddListHtml($classid,$ccr['modid'],$ccr['haddlist'],$ccr['listdt']);//Éú³ÉÐÅÏ¢Áбí
- if($r[ztid])//Èç¹ûÊÇרÌâ
- {
- $z_r=explode("|".$r[ztid]."|",$r[ztid]);
- for($z=1;$z<count($z_r)-1;$z++)
- {
- ListHtml(intval($z_r[$z]),'',1);
- }
- }
- }
- //ͬ²½É¾³ý
- if($r['copyids']&&$r['copyids']<>'1')
- {
- DelInfoToCopyInfo($classid,$id,$r,$userid,$username);
- }
- if($sql)
- {
- insert_dolog("classid=$classid<br>id=".$id."<br>title=".$r[title]);//²Ù×÷ÈÕÖ¾
- printerror("DelNewsSuccess",$_SERVER['HTTP_REFERER']);
- }
- else
- {
- printerror("ErrorUrl","history.go(-1)");
- }
- }
-
- //ÅúÁ¿É¾³ýÐÅÏ¢
- function DelNews_all($id,$classid,$userid,$username,$ecms=0){
- global $empire,$class_r,$class_zr,$public_r,$dbtbpre,$emod_r;
- $classid=(int)$classid;
- $count=count($id);
- if(!$count)
- {
- printerror("NotDelNewsid","history.go(-1)");
- }
- $doselfinfo=CheckLevel($userid,$username,$classid,"news");//²Ù×÷ȨÏÞ
- if(!$doselfinfo['dodelinfo'])//ɾ³ýȨÏÞ
- {
- printerror("NotDelInfoLevel","history.go(-1)");
- }
- $mid=$class_r[$classid][modid];
- $tbname=$class_r[$classid][tbname];
- $pf=$emod_r[$mid]['pagef'];
- $stf=$emod_r[$mid]['savetxtf'];
- if($ecms==1)
- {
- $doctb="_doc";
- }
- for($i=0;$i<$count;$i++)
- {
- $add.="id='".intval($id[$i])."' or ";
- }
- $add=substr($add,0,strlen($add)-4);
- for($i=0;$i<$count;$i++)//ɾ³ýÐÅÏ¢Îļþ
- {
- $id[$i]=intval($id[$i]);
- $r=$empire->fetch1("select * from {$dbtbpre}ecms_".$tbname.$doctb." where id='$id[$i]'");
- if($doselfinfo['doselfinfo']&&($r[userid]<>$userid||$r[ismember]))//Ö»Äܱà¼×Ô¼ºµÄÐÅÏ¢
- {
- continue;
- }
- //·ÖÒ³×Ö¶Î
- if($pf)
- {
- if(strstr($emod_r[$mid]['tbdataf'],','.$pf.','))
- {
- if($ecms==1)
- {
- $finfor=$empire->fetch1("select ".$pf." from {$dbtbpre}ecms_".$tbname."_doc_data where id='$id[$i]'");
- }
- else
- {
- $finfor=$empire->fetch1("select ".$pf." from {$dbtbpre}ecms_".$tbname."_data_".$r[stb]." where id='$id[$i]'");
- }
- $r[$pf]=$finfor[$pf];
- }
- }
- //´æÎı¾
- if($stf)
- {
- $newstextfile=$r[$stf];
- $r[$stf]=GetTxtFieldText($r[$stf]);
- DelTxtFieldText($newstextfile);//ɾ³ýÎļþ
- }
- DelNewsFile($r[filename],$r[newspath],$r[classid],$r[$pf],$r[groupid]);
- DelNewsTheFile($id[$i],$r[classid]);//ɾ³ý¸½¼þ
- //ɾ³ý¸±±í
- if($ecms==0)
- {
- $empire->query("delete from {$dbtbpre}ecms_".$tbname."_data_".$r[stb]." where id='$id[$i]'");
- }
- //ɾ³ýÆäËü±í¼Ç¼
- $empire->query("delete from {$dbtbpre}enewswfinfo where id='$id[$i]' and classid='$r[classid]'");
- $empire->query("delete from {$dbtbpre}enewswfinfolog where id='$id[$i]' and classid='$r[classid]'");
- $empire->query("delete from {$dbtbpre}enewsinfovote where id='$id[$i]' and classid='$r[classid]'");
- $empire->query("delete from {$dbtbpre}enewsdiggips where id='$id[$i]' and classid='$r[classid]'");
- }
- //ɾ³ýÐÅÏ¢
- $sql=$empire->query("delete from {$dbtbpre}ecms_".$tbname.$doctb." where ".$add);
- if(empty($doctb))
- {
- $ccr=$empire->fetch1("select classid,modid,listdt,haddlist from {$dbtbpre}enewsclass where classid='$classid'");
- hAddListHtml($classid,$ccr['modid'],$ccr['haddlist'],$ccr['listdt']);//Éú³ÉÐÅÏ¢Áбí
- }
- else
- {
- $empire->query("delete from {$dbtbpre}ecms_".$tbname."_doc_data where ".$add);
- }
- if($sql)
- {
- insert_dolog("classid=".$classid."<br>classname=".$class_r[$classid][classname]);//²Ù×÷ÈÕÖ¾
- printerror("DelNewsAllSuccess",$_SERVER['HTTP_REFERER']);
- }
- else
- {
- printerror("DbError","history.go(-1)");
- }
- }
-
- //Ë¢ÐÂÒ³Ãæ
- function AddInfoToReHtml($classid,$dore){
- global $class_r;
- hAddListHtml($classid,$class_r[$classid]['modid'],$dore,$class_r[$classid]['listdt']);//Éú³ÉÐÅÏ¢Áбí
- insert_dolog("classid=".$classid."<br>do=".$dore);//²Ù×÷ÈÕÖ¾
- printerror('AddInfoToReHtmlSuccess','history.go(-1)');
- }
-
- //Ôö¼ÓÐÅÏ¢Éú³ÉÒ³Ãæ
- function hAddListHtml($classid,$mid,$qaddlist,$listdt){
- global $class_r;
- if($qaddlist==0)//²»Éú³É
- {
- return "";
- }
- elseif($qaddlist==1)//Éú³Éµ±Ç°À¸Ä¿
- {
- if(!$listdt)
- {
- $sonclass="|".$classid."|";
- hReClassHtml($sonclass);
- }
- }
- elseif($qaddlist==2)//Éú³ÉÊ×Ò³
- {
- hReIndex();
- }
- elseif($qaddlist==3)//Éú³É¸¸À¸Ä¿
- {
- $featherclass=$class_r[$classid]['featherclass'];
- if($featherclass&&$featherclass!="|")
- {
- hReClassHtml($featherclass);
- }
- }
- elseif($qaddlist==4)//Éú³Éµ±Ç°À¸Ä¿Ó븸À¸Ä¿
- {
- $featherclass=$class_r[$classid]['featherclass'];
- if(empty($featherclass))
- {
- $featherclass="|";
- }
- if(!$listdt)
- {
- $featherclass.=$classid."|";
- }
- hReClassHtml($featherclass);
- }
- elseif($qaddlist==5)//Éú³É¸¸À¸Ä¿ÓëÊ×Ò³
- {
- hReIndex();
- $featherclass=$class_r[$classid]['featherclass'];
- if($featherclass&&$featherclass!="|")
- {
- hReClassHtml($featherclass);
- }
- }
- elseif($qaddlist==6)//Éú³Éµ±Ç°À¸Ä¿¡¢¸¸À¸Ä¿ÓëÊ×Ò³
- {
- hReIndex();
- $featherclass=$class_r[$classid]['featherclass'];
- if(empty($featherclass))
- {
- $featherclass="|";
- }
- if(!$listdt)
- {
- $featherclass.=$classid."|";
- }
- hReClassHtml($featherclass);
- }
- }
-
- //Ôö¼ÓÐÅÏ¢Éú³ÉÀ¸Ä¿
- function hReClassHtml($sonclass){
- global $empire,$dbtbpre,$class_r;
- $r=explode("|",$sonclass);
- $count=count($r);
- for($i=1;$i<$count-1;$i++)
- {
- //ÖÕ¼«À¸Ä¿
- if($class_r[$r[$i]]['islast'])
- {
- if(!$class_r[$r[$i]]['listdt'])
- {
- ListHtml($r[$i],'',0,$userlistr);
- }
- }
- elseif($class_r[$r[$i]]['islist']==1)//Áбíʽ¸¸À¸Ä¿
- {
- if(!$class_r[$r[$i]]['listdt'])
- {
- ListHtml($r[$i],'',3);
- }
- }
- elseif($class_r[$r[$i]]['islist']==3)//À¸Ä¿°ó¶¨ÐÅÏ¢
- {
- ReClassBdInfo($r[$i]);
- }
- else//¸¸À¸Ä¿
- {
- $cr=$empire->fetch1("select classtempid from {$dbtbpre}enewsclass where classid='$r[$i]'");
- $classtemp=$class_r[$r[$i]]['islist']==2?GetClassText($r[$i]):GetClassTemp($cr['classtempid']);
- NewsBq($r[$i],$classtemp,0,0);
- }
- }
- }
-
- //Ôö¼ÓÐÅÏ¢Éú³ÉÊ×Ò³
- function hReIndex(){
- $indextemp=GetIndextemp();
- NewsBq($classid,$indextemp,1,0);
- }
-
- //·¢²¼Í¬Ê±¸´ÖÆ
- function AddInfoToCopyInfo($classid,$id,$to_classid,$userid,$username){
- global $empire,$public_r,$class_r,$dbtbpre,$emod_r;
- $classid=(int)$classid;
- $id=(int)$id;
- $cr=$to_classid;
- $count=count($cr);
- if(empty($classid)||empty($id)||empty($count))
- {
- return '';
- }
- $mid=$class_r[$classid][modid];
- $tbname=$class_r[$classid][tbname];
- $stf=$emod_r[$mid]['savetxtf'];
- //Ö÷±í
- $r=$empire->fetch1("select * from {$dbtbpre}ecms_".$tbname." where id='$id'");
- if(empty($r['id']))
- {
- return '';
- }
- //¸±±í
- if($emod_r[$mid]['tbdataf']&&$emod_r[$mid]['tbdataf']<>',')
- {
- $selectdataf=substr($emod_r[$mid]['tbdataf'],1,-1);
- $fr=$empire->fetch1("select ".$selectdataf." from {$dbtbpre}ecms_".$tbname."_data_".$r[stb]." where id='$id'");
- $r=array_merge($r,$fr);
- }
- if($stf)//´æ·ÅÎı¾
- {
- $r[newstext_url]=$r[$stf];
- $r[$stf]=GetTxtFieldText($r[$stf]);
- }
- $ids=',';
- for($i=0;$i<$count;$i++)
- {
- $newclassid=(int)$cr[$i];
- if(!$newclassid||!$class_r[$newclassid][islast]||$mid<>$class_r[$newclassid][modid]||$newclassid==$classid)
- {
- continue;
- }
- //²é¿´Ä¿Â¼ÊÇ·ñ´æÔÚ£¬²»´æÔÚÔò½¨Á¢
- $newspath=FormatPath($newclassid,"",0);
- $newstempid=0;
- $copyids='1';
- //·µ»Ø×Ô¶¨Òå×Ö¶Î
- $ret_r=ReturnAddF($r,$mid,$userid,$username,9,1,0);
- if($class_r[$newclassid][wfid])
- {
- $checked=0;
- $isqf=1;
- }
- else
- {
- $checked=$class_r[$newclassid][checked];
- $isqf=0;
- }
- $checked=(int)$checked;
- //Ö÷±í
- $empire->query("insert into {$dbtbpre}ecms_".$tbname."(classid,onclick,newspath,keyboard,keyid,userid,username,ztid,checked,truetime,ismember,dokey,isgood,titlefont,titleurl,filename,groupid,newstempid,plnum,firsttitle,isqf,userfen,totaldown,closepl,havehtml,lastdotime,haveaddfen,infopfen,infopfennum,votenum,stb,copyids,ttid,infotags,ispic".$ret_r[fields].") values('$newclassid',0,'$newspath','".StripAddsData($r[keyboard])."','$r[keyid]','$r[userid]','".StripAddsData($r[username])."','',$checked,'$r[truetime]',0,$r[dokey],0,'".StripAddsData($r[titlefont])."','".StripAddsData($r[titleurl])."','$filename',$r[groupid],'".$newstempid."',0,0,'$isqf',$r[userfen],0,$r[closepl],$r[havehtml],$r[truetime],0,0,0,0,'$ret_r[tb]','$copyids','$r[ttid]','','$r[ispic]'".$ret_r[values].");");
- $l_id=$empire->lastid();
- //¸±±í
- $empire->query("insert into {$dbtbpre}ecms_".$tbname."_data_".$ret_r[tb]."(id,classid".$ret_r[datafields].") values('$l_id','$newclassid'".$ret_r[datavalues].");");
- //Ç©·¢
- if($isqf==1)
- {
- InfoInsertToWorkflow($l_id,$newclassid,$class_r[$newclassid][wfid],$userid,$username);
- }
- //ÎļþÃüÃû
- $filename=ReturnInfoFilename($newclassid,$l_id,$r[filenameqz]);
- $empire->query("update {$dbtbpre}ecms_".$tbname." set filename='$filename' where id='$l_id'");
- //Éú³ÉÐÅÏ¢Îļþ
- $addr=$empire->fetch1("select * from {$dbtbpre}ecms_".$tbname." where id='$l_id'");
- GetHtml($addr,'');
- $ids.=$l_id.',';
- }
- if($ids==',')
- {
- $ids='';
- }
- return $ids;
- }
-
- //·¢²¼Í¬²½ÐÞ¸Ä
- function EditInfoToCopyInfo($classid,$id,$userid,$username){
- global $empire,$public_r,$class_r,$dbtbpre,$emod_r;
- $classid=(int)$classid;
- $id=(int)$id;
- if(empty($classid)||empty($id))
- {
- return '';
- }
- $mid=$class_r[$classid][modid];
- $tbname=$class_r[$classid][tbname];
- $stf=$emod_r[$mid]['savetxtf'];
- //Ö÷±í
- $r=$empire->fetch1("select * from {$dbtbpre}ecms_".$tbname." where id='$id'");
- $cr=explode(',',$r[copyids]);
- $count=count($cr);
- if(empty($r['id'])||$count<3)
- {
- return '';
- }
- //¸±±í
- if($emod_r[$mid]['tbdataf']&&$emod_r[$mid]['tbdataf']<>',')
- {
- $selectdataf=substr($emod_r[$mid]['tbdataf'],1,-1);
- $fr=$empire->fetch1("select ".$selectdataf." from {$dbtbpre}ecms_".$tbname."_data_".$r[stb]." where id='$id'");
- $r=array_merge($r,$fr);
- }
- if($stf)//´æ·ÅÎı¾
- {
- $r[newstext_url]=$r[$stf];
- $r[$stf]=GetTxtFieldText($r[$stf]);
- }
- for($i=1;$i<$count-1;$i++)
- {
- $infoid=(int)$cr[$i];
- if(empty($infoid))
- {
- continue;
- }
- if($stf)
- {
- if(strstr($emod_r[$mid]['tbdataf'],','.$stf.','))
- {
- $infor=$empire->fetch1("select stb from {$dbtbpre}ecms_".$tbname." where id='$infoid'");
- if(!$infor[stb])
- {
- continue;
- }
- $infodr=$empire->fetch1("select ".$stf." from {$dbtbpre}ecms_".$tbname."_data_".$infor[stb]." where id='$infoid'");
- $r[newstext_url]=$infodr[$stf];
- }
- else
- {
- $infor=$empire->fetch1("select ".$stf.",stb from {$dbtbpre}ecms_".$tbname." where id='$infoid'");
- if(!$infor[stb])
- {
- continue;
- }
- $r[newstext_url]=$infor[$stf];
- }
- }
- else
- {
- $infor=$empire->fetch1("select stb from {$dbtbpre}ecms_".$tbname." where id='$infoid'");
- if(!$infor[stb])
- {
- continue;
- }
- }
- //·µ»Ø×Ô¶¨Òå×Ö¶Î
- $ret_r=ReturnAddF($r,$mid,$userid,$username,8,1,0);
- //Ö÷±í
- $empire->query("update {$dbtbpre}ecms_".$tbname." set keyboard='".StripAddsData($r[keyboard])."',keyid='$r[keyid]',checked=$r[checked],dokey=$r[dokey],titlefont='".StripAddsData($r[titlefont])."',titleurl='".StripAddsData($r[titleurl])."',groupid=$r[groupid],userfen=$r[userfen],closepl=$r[closepl],lastdotime=$r[lastdotime],ttid='$r[ttid]',ispic='$r[ispic]'".$ret_r[values]." where id='$infoid'");
- //¸±±í
- $empire->query("update {$dbtbpre}ecms_".$tbname."_data_".$ret_r[tb]." set id='$infoid'".$ret_r[datavalues]." where id='$infoid'");
- //Éú³ÉÐÅÏ¢Îļþ
- $addr=$empire->fetch1("select * from {$dbtbpre}ecms_".$tbname." where id='$infoid'");
- GetHtml($addr,'');
- }
- }
-
- //·¢²¼Í¬²½É¾³ý
- function DelInfoToCopyInfo($classid,$id,$r,$userid,$username){
- global $empire,$public_r,$class_r,$dbtbpre,$emod_r;
- $classid=(int)$classid;
- $id=(int)$id;
- if(empty($classid)||empty($id))
- {
- return '';
- }
- $mid=$class_r[$classid][modid];
- $tbname=$class_r[$classid][tbname];
- $stf=$emod_r[$mid]['savetxtf'];
- $cr=explode(',',$r[copyids]);
- $count=count($cr);
- if(empty($r['id'])||$count<3)
- {
- return '';
- }
- $selectdataf='';
- $dh='';
- if($stf&&strstr($emod_r[$mid]['tbdataf'],','.$stf.','))
- {
- $selectdataf.=$stf;
- $dh=',';
- }
- $pf=$emod_r[$mid]['pagef'];
- if($pf&&strstr($emod_r[$mid]['tbdataf'],','.$pf.','))
- {
- $selectdataf.=$dh.$pf;
- }
- for($i=1;$i<$count-1;$i++)
- {
- $infoid=(int)$cr[$i];
- if(empty($infoid))
- {
- continue;
- }
- $infor=$empire->fetch1("select * from {$dbtbpre}ecms_".$tbname." where id='$infoid'");
- if(!$infor[stb])
- {
- continue;
- }
- if($selectdataf)
- {
- $infodr=$empire->fetch1("select ".$selectdataf." from {$dbtbpre}ecms_".$tbname."_data_".$infor[stb]." where id='$infoid'");
- $infor=array_merge($infor,$infodr);
- }
- //´æÎı¾
- if($stf)
- {
- $newstextfile=$infor[$stf];
- $infor[$stf]=GetTxtFieldText($infor[$stf]);
- DelTxtFieldText($newstextfile);//ɾ³ýÎļþ
- }
- DelNewsFile($infor[filename],$infor[newspath],$infor[classid],$infor[$pf],$infor[groupid]);//ɾ³ýÐÅÏ¢Îļþ
- $empire->query("delete from {$dbtbpre}ecms_".$tbname." where id='$infoid'");
- $empire->query("delete from {$dbtbpre}ecms_".$tbname."_data_".$infor[stb]." where id='$infoid'");
- //ɾ³ýÆäËü±í¼Ç¼
- $empire->query("delete from {$dbtbpre}enewswfinfo where id='$infoid' and classid='$infor[classid]'");
- $empire->query("delete from {$dbtbpre}enewswfinfolog where id='$infoid' and classid='$infor[classid]'");
- $empire->query("delete from {$dbtbpre}enewsinfovote where id='$infoid' and classid='$infor[classid]'");
- $empire->query("delete from {$dbtbpre}enewsdiggips where id='$infoid' and classid='$infor[classid]'");
- DelNewsTheFile($infoid,$infor[classid]);//ɾ³ý¸½¼þ
- }
- }
-
- //ÐÅÏ¢Öö¥
- function TopNews_all($classid,$id,$istop,$userid,$username){
- global $empire,$bclassid,$class_r,$dbtbpre;
- $classid=(int)$classid;
- if(empty($classid))
- {
- printerror("ErrorUrl","history.go(-1)");
- }
- $doselfinfo=CheckLevel($userid,$username,$classid,"news");//Ñé֤ȨÏÞ
- if(!$doselfinfo['doeditinfo'])//±à¼È¨ÏÞ
- {
- printerror("NotEditInfoLevel","history.go(-1)");
- }
- $count=count($id);
- if(empty($count))
- {
- printerror("NotTopNewsid","history.go(-1)");
- }
- for($i=0;$i<$count;$i++)
- {
- $add.="id='".intval($id[$i])."' or ";
- }
- $istop=(int)$istop;
- $add=substr($add,0,strlen($add)-4);
- $sql=$empire->query("update {$dbtbpre}ecms_".$class_r[$classid][tbname]." set istop=$istop where ".$add);
- //Ë¢ÐÂÁбí
- ReListHtml($classid,1);
- if($sql)
- {
- insert_dolog("classid=".$classid."<br>classname=".$class_r[$classid][classname]);//²Ù×÷ÈÕÖ¾
- printerror("TopNewsSuccess",$_SERVER['HTTP_REFERER']);
- }
- else
- {printerror("DbError","history.go(-1)");}
- }
-
- //ÉóºËÐÅÏ¢
- function CheckNews_all($classid,$id,$userid,$username){
- global $empire,$class_r,$dbtbpre,$emod_r;
- $classid=(int)$classid;
- if(empty($classid))
- {
- printerror("ErrorUrl","history.go(-1)");
- }
- //Ñé֤ȨÏÞ
- $doselfinfo=CheckLevel($userid,$username,$classid,"news");
- //±à¼È¨ÏÞ
- if(!$doselfinfo['doeditinfo'])
- {
- printerror("NotEditInfoLevel","history.go(-1)");
- }
- $count=count($id);
- if(empty($count))
- {
- printerror("NotCheckNewsid","history.go(-1)");
- }
- for($i=0;$i<$count;$i++)
- {
- $add.="id='".intval($id[$i])."' or ";
- }
- $add=substr($add,0,strlen($add)-4);
- $sql=$empire->query("update {$dbtbpre}ecms_".$class_r[$classid][tbname]." set checked=1 where isqf=0 and (".$add.")");
- $sql=$empire->query("select * from {$dbtbpre}ecms_".$class_r[$classid][tbname]." where ".$add);
- while($r=$empire->fetch($sql))
- {
- //Ͷ¸åÔö¼Ó»ý·Ö
- if($r[ismember]&&$r[userid]&&!$r[haveaddfen])
- {
- $cr=$empire->fetch1("select classid,addinfofen from {$dbtbpre}enewsclass where classid='$r[classid]'");
- if($cr[addinfofen])
- {
- AddInfoFen($cr[addinfofen],$r[userid]);
- if($cr[addinfofen]<0)
- {
- BakDown($r[classid],$r[id],0,$r[userid],$r[username],$r[title],abs($cr[addinfofen]),3);
- }
- }
- $empire->query("update {$dbtbpre}ecms_".$class_r[$classid][tbname]." set haveaddfen=1 where id=$r[id]");
- }
- //Ë¢ÐÂÐÅÏ¢
- GetHtml($r,'');
- }
- //Ë¢ÐÂÁбí
- //ReListHtml($classid,1);
- if($sql)
- {
- //²Ù×÷ÈÕÖ¾
- insert_dolog("classid=".$classid."<br>classname=".$class_r[$classid][classname]);
- printerror("CheckNewsSuccess",$_SERVER['HTTP_REFERER']);
- }
- else
- {printerror("DbError","history.go(-1)");}
- }
-
- //È¡ÏûÉóºËÐÅÏ¢
- function NoCheckNews_all($classid,$id,$userid,$username){
- global $empire,$class_r,$public_r,$dbtbpre,$emod_r;
- $classid=(int)$classid;
- if(empty($classid))
- {
- printerror("ErrorUrl","history.go(-1)");
- }
- //Ñé֤ȨÏÞ
- $doselfinfo=CheckLevel($userid,$username,$classid,"news");
- //±à¼È¨ÏÞ
- if(!$doselfinfo['doeditinfo'])
- {
- printerror("NotEditInfoLevel","history.go(-1)");
- }
- $count=count($id);
- if(empty($count))
- {
- printerror("NotNoCheckNewsid","history.go(-1)");
- }
- $mid=$class_r[$classid][modid];
- $tbname=$class_r[$classid][tbname];
- $pf=$emod_r[$mid]['pagef'];
- $stf=$emod_r[$mid]['savetxtf'];
- for($i=0;$i<$count;$i++)
- {
- $id[$i]=(int)$id[$i];
- //Ö÷±í
- $r=$empire->fetch1("select * from {$dbtbpre}ecms_".$class_r[$classid][tbname]." where id='".$id[$i]."'");
- //·ÖÒ³×Ö¶Î
- if($pf)
- {
- if(strstr($emod_r[$mid]['tbdataf'],','.$pf.','))
- {
- $finfor=$empire->fetch1("select ".$pf." from {$dbtbpre}ecms_".$tbname."_data_".$r[stb]." where id='$id[$i]'");
- $r[$pf]=$finfor[$pf];
- }
- if($stf&&$stf==$pf)//´æ·ÅÎı¾
- {
- $r[$pf]=GetTxtFieldText($r[$pf]);
- }
- }
- DelNewsFile($r[filename],$r[newspath],$r[classid],$r[$pf],$r[groupid]);
- $add.="id='$id[$i]' or ";
- }
- $add=substr($add,0,strlen($add)-4);
- $sql=$empire->query("update {$dbtbpre}ecms_".$class_r[$classid][tbname]." set checked=0,havehtml=0 where isqf=0 and (".$add.")");
- //Ë¢ÐÂÁбí
- ReListHtml($classid,1);
- if($sql)
- {
- //²Ù×÷ÈÕÖ¾
- insert_dolog("classid=".$classid."<br>classname=".$class_r[$classid][classname]);
- printerror("NoCheckNewsSuccess",$_SERVER['HTTP_REFERER']);
- }
- else
- {printerror("DbError","history.go(-1)");}
- }
-
- //Òƶ¯ÐÅÏ¢
- function MoveNews_all($classid,$id,$to_classid,$userid,$username){
- global $empire,$class_r,$dbtbpre,$emod_r;
- $classid=(int)$classid;
- $to_classid=(int)$to_classid;
- if(empty($classid)||empty($to_classid))
- {
- printerror("EmptyMoveClassid","history.go(-1)");
- }
- if(empty($class_r[$classid][islast])||empty($class_r[$to_classid][islast]))
- {
- printerror("EmptyMoveClassid","history.go(-1)");
- }
- if($class_r[$classid][modid]<>$class_r[$to_classid][modid])
- {
- printerror("DefModid","history.go(-1)");
- }
- //Ñé֤ȨÏÞ
- $doselfinfo=CheckLevel($userid,$username,$classid,"news");
- //±à¼È¨ÏÞ
- if(!$doselfinfo['doeditinfo'])
- {
- printerror("NotEditInfoLevel","history.go(-1)");
- }
- $count=count($id);
- if(empty($count))
- {
- printerror("NotMoveNewsid","history.go(-1)");
- }
- $upltbr=$empire->fetch1("select pldatatbs from {$dbtbpre}enewspublic limit 1");//ÆÀÂÛ
- $tbname=$class_r[$classid][tbname];
- for($i=0;$i<$count;$i++)
- {
- $id[$i]=(int)$id[$i];
- $add.="id='$id[$i]' or ";
- $r=$empire->fetch1("select stb,classid from {$dbtbpre}ecms_".$tbname." where id='$id[$i]'");
- //¸±±í
- $empire->query("update {$dbtbpre}ecms_".$tbname."_data_".$r[stb]." set classid='$to_classid' where id='$id[$i]'");
- //ÆÀÂÛת»»
- $empire->query("update {$dbtbpre}enewspl set classid=$to_classid where id='".$id[$i]."' and classid='$r[classid]'");
- if($upltbr['pldatatbs'])
- {
- $pldtbr=explode(',',$upltbr['pldatatbs']);
- $plcount=count($pldtbr)-1;
- for($pli=1;$pli<$plcount;$pli++)
- {
- $empire->query("update {$dbtbpre}enewspl_data_".$pldtbr[$pli]." set classid=$to_classid where id='".$id[$i]."' and classid='$r[classid]'");
- }
- }
- //Ç©·¢×ª»»
- $empire->query("update {$dbtbpre}enewswfinfo set classid=$to_classid where id='".$id[$i]."' and classid='$r[classid]'");
- $empire->query("update {$dbtbpre}enewswfinfolog set classid=$to_classid where id='".$id[$i]."' and classid='$r[classid]'");
- //ͶƱ
- $empire->query("update {$dbtbpre}enewsinfovote set classid=$to_classid where id='".$id[$i]."' and classid='$r[classid]'");
- //digg
- $empire->query("update {$dbtbpre}enewsdiggips set classid=$to_classid where id='".$id[$i]."' and classid='$r[classid]'");
- }
- $add=substr($add,0,strlen($add)-4);
- $sql=$empire->query("update {$dbtbpre}ecms_".$tbname." set classid=$to_classid where ".$add);
- //Ë¢ÐÂÁбí
- ReListHtml($classid,1);
- ReListHtml($to_classid,1);
- if($sql)
- {
- //²Ù×÷ÈÕÖ¾
- insert_dolog("classid=".$classid."<br>classname=".$class_r[$classid][classname]);
- printerror("MoveNewsSuccess",$_SERVER['HTTP_REFERER']);
- }
- else
- {printerror("DbError","history.go(-1)");}
- }
-
- //¸´ÖÆÐÅÏ¢
- function CopyNews_all($classid,$id,$to_classid,$userid,$username){
- global $empire,$public_r,$class_r,$dbtbpre,$emod_r;
- $classid=(int)$classid;
- $to_classid=(int)$to_classid;
- if(empty($classid)||empty($to_classid))
- {
- printerror("EmptyCopyClassid","history.go(-1)");
- }
- if(empty($class_r[$classid][islast])||empty($class_r[$to_classid][islast]))
- {
- printerror("EmptyCopyClassid","history.go(-1)");
- }
- if($class_r[$classid][modid]<>$class_r[$to_classid][modid])
- {
- printerror("DefModid","history.go(-1)");
- }
- $userid=(int)$userid;
- //Ñé֤ȨÏÞ
- $doselfinfo=CheckLevel($userid,$username,$classid,"news");
- //±à¼È¨ÏÞ
- if(!$doselfinfo['doeditinfo'])
- {
- printerror("NotEditInfoLevel","history.go(-1)");
- }
- $count=count($id);
- if(empty($count))
- {
- printerror("NotCopyNewsid","history.go(-1)");
- }
- for($i=0;$i<$count;$i++)
- {
- $add.="id='".intval($id[$i])."' or ";
- }
- $add=substr($add,0,strlen($add)-4);
- $mid=$class_r[$classid][modid];
- $tbname=$class_r[$classid][tbname];
- $stf=$emod_r[$mid]['savetxtf'];
- //²é¿´Ä¿Â¼ÊÇ·ñ´æÔÚ£¬²»´æÔÚÔò½¨Á¢
- $newspath=FormatPath($to_classid,"",0);
- $newstime=time();
- $truetime=$newstime;
- $newstempid=0;
- $dosql=$empire->query("select * from {$dbtbpre}ecms_".$tbname." where ".$add);
- while($r=$empire->fetch($dosql))
- {
- //¸±±í
- if($emod_r[$mid]['tbdataf']&&$emod_r[$mid]['tbdataf']<>',')
- {
- $selectdataf=substr($emod_r[$mid]['tbdataf'],1,-1);
- $finfor=$empire->fetch1("select ".$selectdataf." from {$dbtbpre}ecms_".$tbname."_data_".$r[stb]." where id='$r[id]'");
- $r=array_merge($r,$finfor);
- }
- if($stf)//´æ·ÅÎı¾
- {
- $r[$stf]=GetTxtFieldText($r[$stf]);
- }
- //·µ»Ø×Ô¶¨Òå×Ö¶Î
- $ret_r=ReturnAddF($r,$class_r[$to_classid][modid],$userid,$username,9,1,0);
- if($class_r[$to_classid][wfid])
- {
- $checked=0;
- $isqf=1;
- }
- else
- {
- $checked=$class_r[$to_classid][checked];
- $isqf=0;
- }
- $checked=(int)$checked;
- //Ö÷±í
- $sql=$empire->query("insert into {$dbtbpre}ecms_".$tbname."(classid,onclick,newspath,keyboard,keyid,userid,username,ztid,checked,truetime,ismember,dokey,isgood,titlefont,titleurl,filename,groupid,newstempid,plnum,firsttitle,isqf,userfen,totaldown,closepl,havehtml,lastdotime,haveaddfen,infopfen,infopfennum,votenum,stb,ttid,infotags,ispic".$ret_r[fields].") values($to_classid,0,'$newspath','$r[keyboard]','$r[keyid]',$userid,'$username','',$checked,$truetime,0,$r[dokey],0,'$r[titlefont]','$r[titleurl]','$filename',$r[groupid],'".$newstempid."',0,0,'$isqf',$r[userfen],0,$r[closepl],$r[havehtml],$truetime,0,0,0,0,'$ret_r[tb]','$r[ttid]','$r[infotags]','$r[ispic]'".$ret_r[values].");");
- $l_id=$empire->lastid();
- //¸±±í
- $empire->query("insert into {$dbtbpre}ecms_".$tbname."_data_".$ret_r[tb]."(id,classid".$ret_r[datafields].") values('$l_id','$to_classid'".$ret_r[datavalues].");");
- //Ç©·¢
- if($isqf==1)
- {
- InfoInsertToWorkflow($l_id,$to_classid,$class_r[$to_classid][wfid],$userid,$username);
- }
- //ÎļþÃüÃû
- $filename=ReturnInfoFilename($to_classid,$l_id,$r[filenameqz]);
- $usql=$empire->query("update {$dbtbpre}ecms_".$class_r[$to_classid][tbname]." set filename='$filename' where id='$l_id'");
- //Éú³ÉÐÅÏ¢Îļþ
- $addr=$empire->fetch1("select * from {$dbtbpre}ecms_".$class_r[$to_classid][tbname]." where id='$l_id'");
- GetHtml($addr,'');
- }
- //Ë¢ÐÂÁбí
- ReListHtml($to_classid,1);
- //²Ù×÷ÈÕÖ¾
- insert_dolog("classid=".$classid."<br>classname=".$class_r[$classid][classname]);
- printerror("CopyNewsSuccess",$_SERVER['HTTP_REFERER']);
- }
-
- //ÅúÁ¿×ªÒÆÐÅÏ¢
- function MoveClassNews($add,$userid,$username){
- global $empire,$class_r,$dbtbpre,$emod_r;
- $add[classid]=(int)$add[classid];
- $add[toclassid]=(int)$add[toclassid];
- if(empty($add[classid])||empty($add[toclassid]))
- {
- printerror("EmptyMovetoClassid","history.go(-1)");
- }
- if($class_r[$add[classid]][modid]<>$class_r[$add[toclassid]][modid])
- {
- printerror("DefModid","history.go(-1)");
- }
- //Ñé֤ȨÏÞ
- CheckLevel($userid,$username,$classid,"movenews");
- //ÖÕ¼«À¸Ä¿
- if(!$class_r[$add[classid]][islast]||!$class_r[$add[toclassid]][islast])
- {
- printerror("MovetoClassidMustLastid","history.go(-1)");
- }
- if($add[classid]==$add[toclassid])
- {
- printerror("MoveClassidsame","history.go(-1)");
- }
- $mid=$class_r[$add[classid]][modid];
- $tbname=$class_r[$add[classid]][tbname];
- $sql=$empire->query("update {$dbtbpre}ecms_".$tbname." set classid=$add[toclassid] where classid='$add[classid]'");
- //¸±±í
- $dtbr=explode(',',$emod_r[$mid][datatbs]);
- $tbcount=count($dtbr);
- for($i=1;$i<$tbcount-1;$i++)
- {
- $empire->query("update {$dbtbpre}ecms_".$tbname."_data_".$dtbr[$i]." set classid=$add[toclassid] where classid='$add[classid]'");
- }
- //ÆÀÂÛת»»
- $uplsql=$empire->query("update {$dbtbpre}enewspl set classid=$add[toclassid] where classid='$add[classid]'");
- $upltbr=$empire->fetch1("select pldatatbs from {$dbtbpre}enewspublic limit 1");
- if($upltbr['pldatatbs'])
- {
- $pldtbr=explode(',',$upltbr['pldatatbs']);
- $count=count($pldtbr)-1;
- for($i=1;$i<$count;$i++)
- {
- $empire->query("update {$dbtbpre}enewspl_data_".$pldtbr[$i]." set classid=$add[toclassid] where classid='$add[classid]'");
- }
- }
- //Ç©·¢×ª»»
- $uqfsql=$empire->query("update {$dbtbpre}enewswfinfo set classid=$add[toclassid] where classid='$add[classid]'");
- $uqfsql=$empire->query("update {$dbtbpre}enewswfinfolog set classid=$add[toclassid] where classid='$add[classid]'");
- //ͶƱ
- $uvotesql=$empire->query("update {$dbtbpre}enewsinfovote set classid=$add[toclassid] where classid='$add[classid]'");
- //digg
- $empire->query("update {$dbtbpre}enewsdiggips set classid=$add[toclassid] where classid='$add[classid]'");
- //Éú³ÉÐÅÏ¢Áбí
- ListHtml($add[toclassid],$ret_r,0);
- //Òƶ¯Êý¾Ý
- $opath=ECMS_PATH.$class_r[$add[classid]][classpath];
- DelPath($opath);//ɾ³ý¾ÉµÄÀ¸Ä¿Ä¿Â¼
- $mk=DoMkdir($opath);
- if($sql)
- {
- //²Ù×÷ÈÕÖ¾
- insert_dolog("classid=".$add[classid]." (".$class_r[$add[classid]][classname].")<br>toclassid=".$add[toclassid]."(".$class_r[$add[toclassid]][classname].")");
- prin…
Large files files are truncated, but you can click here to view the full file