修改e/class/function.php
//更新替换图片下一页链接内容 function UpdateImgNexturl($classid,$id){ global $empire,$dbtbpre,$class_r,$public_r,$emod_r; $mid=$class_r[$classid][modid]; $tbname=$class_r[$classid][tbname]; $pf=$emod_r[$mid]['pagef']; $stf=$emod_r[$mid]['savetxtf']; if(!$pf){ return ''; } //分页字段 $tbdataf=strstr($emod_r[$mid]['tbdataf'],','.$pf.',')?1:0; if($tbdataf){ //获取栏目最后一片文章ID $next_r=$empire->fetch1("select titleurl,groupid,classid,newspath,filename,id,title from {$dbtbpre}ecms_".$tbname." where id<'{$id}' and classid='$classid' and checked=1 order by id desc limit 1"); $r=$empire->fetch1("select id,classid,titleurl,groupid,newspath,filename,stb from {$dbtbpre}ecms_".$tbname." where id='$id'"); $finfor=$empire->fetch1("select ".$pf." from {$dbtbpre}ecms_".$tbname."_data_".$r[stb]." where id='$id'"); $r[$pf]=$finfor[$pf]; }else{ $r=$empire->fetch1("select id,classid,titleurl,groupid,newspath,filename,".$pf." from {$dbtbpre}ecms_".$tbname." where id='$id'"); } //存文本 if($stf&&$stf==$pf) { $newstextfile=$r[$stf]; $r[$stf]=GetTxtFieldText($r[$stf]); } if(!$r[$pf]) { return ''; } $newstext=RepNewstextImgLink($r[$pf],$r,$next_r); if(empty($newstext)) { return ''; } //存文本 if($stf&&$stf==$pf) { EditTxtFieldText($newstextfile,$newstext); return ''; } if($tbdataf) { $empire->query("update {$dbtbpre}ecms_".$tbname."_data_".$r[stb]." set ".$pf."='$newstext' where id='$id'"); } else { $empire->query("update {$dbtbpre}ecms_".$tbname." set ".$pf."='$newstext' where id='$id'"); } }
//给图片加下一页链接 function RepNewstextImgLink($newstext,$add,$next_r){ global $public_r; $classurl=sys_ReturnBqClassname($add,9);//最后一页链接地址 $expage='[!--empirenews.page--]';//分页符 $newstext=stripSlashes($newstext); $repurl='[!--empirecms.rep.nextpageurl--]'; $newstext=DoRepImgLink($newstext,$repurl); if(!stristr($newstext,$expage)){ if(stristr($newstext,'<img ')){ if(empty($next_r)){ $newurl=$classurl; }else{ $nexttitleurl=sys_ReturnBqTitleLink($next_r);//获取下一篇已连接地址 $newurl=$nexttitleurl; } $newstext =$newstext."<p style="text-align:center"><a href='http://www.heiying.cc'>黑鹰</a><p>"); $new_newstext=str_replace($repurl,$newurl,$newstext); } return addslashes($new_newstext); }else{ $nr=explode($expage,$newstext); $count=count($nr); //页面地址 $urlqzr=ReturnInfoPageQz($add); //$lastpageurl=$public_r['newsurl'].'e/public/ClassUrl/?classid='.$add['classid']; //最后一页链接地址 $new_newstext=''; $addexpage=''; for($i=0;$i<$count;$i++){ $thispagetext=$nr[$i]; if(stristr($thispagetext,'<img ')){ if($i==$count-1){ if(empty($next_r)){ $newurl=$classurl; }else{ $nexttitleurl=sys_ReturnBqTitleLink($next_r);//获取下一篇已连接地址 $newurl=$nexttitleurl; } }else{ //下一页链接 if($urlqzr['nametype']==1){ $newurl=$urlqzr['titleurl'].'&page='.($i+1); }else{ $newurl=$urlqzr['titleurl'].'_'.($i+2).$urlqzr['filetype']; } } $thispagetext=str_replace($repurl,$newurl,$thispagetext); } $new_newstext.=$addexpage.$thispagetext."<p style="text-align:center"><a href='http://www.heiying.cc'>黑鹰</a><p>"; $addexpage=$expage; } } return addslashes($new_newstext); }
主要修改了两个function,原理很简单,利用下帝国的sys_ReturnBqClassname 在下网站:http://www.heiying.cc
|