调试b12307 支付升级优化版帝国cms7.5文库范文自动生成wordPDF文档付费复制下载带支付系统会员中心整站模板源码sitemap百度推送+安装教程 014
帝国cms首页模板保存或者修改,直接进入网站首页,帝国cms首页修改无法保存,并且点击数据更新->生成首页,帝国cms首页无法生成,并且进入网站首页
调试代码发现过程
首先禁用东坡插件,然后搜索mNewsBq发现在e/class/functions.php中的函数
function NewsBq($classid,$indextext,$enews=0,$doing=0)
第2351行
mNewsBq($classid,$indextext,$enews,$doing);
注释掉
// mNewsBq($classid,$indextext,$enews,$doing);
上面的四行也注释掉
// include_once ECMS_PATH."e/dongpo/mob/config.php";
// include_once ECMS_PATH."e/dongpo/mob/dp_funs.php";
// $indextext=stripSlashes($indextext);
// $indextext=ReplaceTempvar($indextext);//替换全局模板变量
修改成下面这样
// include_once ECMS_PATH."e/dongpo/mob/config.php";
// include_once ECMS_PATH."e/dongpo/mob/dp_funs.php";
// $indextext=stripSlashes($indextext);
// $indextext=ReplaceTempvar($indextext);//替换全局模板变量
$classlevel='';
// mNewsBq($classid,$indextext,$enews,$doing);
然后继续调试,注释打断点如下
// echo '[--murl--]';die;
// $indextext=str_replace('[--murl--]',$murl,$indextext);
$indextext=str_replace("[!--page.stats--]",$onclick,$indextext);
//替换标签
$indextext=DoRepEcmsLoopBq($indextext);
$indextext=RepBq($indextext);
//写文件
// echo $indextext;
// echo "<hr/>";
// echo $file;
WriteFiletext($file,AddCheckViewTempCode().$indextext);
$straaa=file_get_contents($file);
echo "<hr/>";
// echo $straaa;die;
//读取文件内容
ob_start();
include($file);
$string=ob_get_contents();
ob_end_clean();
$string=RepExeCode($string);//解析代码
WriteFiletext($truefile,$classlevel.$string);
// echo $string;die;
return $string;
完整代码入下
//标签替换
function NewsBq($classid,$indextext,$enews=0,$doing=0){
global $empire,$dbtbpre,$public_r,$emod_r,$class_r,$class_zr,$fun_r,$navclassid,$navinfor,$class_tr,$level_r,$etable_r,$mob_r;
// include_once ECMS_PATH."e/dongpo/mob/config.php";
// include_once ECMS_PATH."e/dongpo/mob/dp_funs.php";
// $indextext=stripSlashes($indextext);
// $indextext=ReplaceTempvar($indextext);//替换全局模板变量
$classlevel='';
// mNewsBq($classid,$indextext,$enews,$doing);
if($enews==0)//生成大栏目
{
$murl=m_ReturnBqClassname($classid,9);
if($class_r[$classid]['listdt']||$class_r[$classid]['wburl']||strstr($public_r['nreclass'],','.$classid.',')||InfoIsInTable($class_r[$classid]['tbname']))//不生成栏目
{
return '';
}
$GLOBALS['navclassid']=$classid;
$url=ReturnClassLink($classid);//导航
$cf=$doing==1?',classpath,classtype,classname':'';
$cr=$empire->fetch1("select classpagekey,intro,classimg,cgroupid".$cf." from {$dbtbpre}enewsclass where classid='$classid'");
if(!empty($cf))
{
$class_r[$classid][classpath]=$cr[classpath];
$class_r[$classid][classtype]=$cr[classtype];
$class_r[$classid][classname]=$cr[classname];
}
eAutodo_AddDo('ReListHtml',$classid,0,0,0,0);//moreportdo
//权限
if($cr['cgroupid'])
{
$classlevel=AddCheckClassLevel($classid,$cr['cgroupid'],'');
}
//页面
$pagetitle=ehtmlspecialchars($class_r[$classid][classname]);
$pagekey=ehtmlspecialchars($cr['classpagekey']);
$pagedes=ehtmlspecialchars($cr['intro']);
$classimg=$cr['classimg'];
$onclick="<script src=".$public_r[newsurl]."e/public/onclick/?enews=doclass&classid=$classid></script>";
$truefile=eReturnTrueEcmsPath().ReturnSaveClassPath($classid,1);//moreport
$file=eReturnTrueEcmsPath().'e/data/tmp/class'.$classid.'.php';
$indextext=str_replace("[!--newsnav--]",$url,$indextext);//位置导航
$indextext=Class_ReplaceSvars($indextext,$url,$classid,$pagetitle,$pagekey,$pagedes,$classimg,$add,0);
}
elseif($enews==3)//专题
{
$murl=m_ReturnBqZtname($classid);
$GLOBALS['navclassid']=$classid;
$url=ReturnZtLink($classid);//导航
$cf=$doing==1?',ztpath,zttype,ztname':'';
$cr=$empire->fetch1("select ztpagekey,intro,ztimg".$cf." from {$dbtbpre}enewszt where ztid='$classid'");
if(!empty($cf))
{
$class_zr[$classid][ztpath]=$cr[ztpath];
$class_zr[$classid][zttype]=$cr[zttype];
$class_zr[$classid][ztname]=$cr[ztname];
}
eAutodo_AddDo('ReZtListHtml',$classid,0,0,0,0);//moreportdo
$pagetitle=ehtmlspecialchars($class_zr[$classid][ztname]);
$pagekey=ehtmlspecialchars($cr['ztpagekey']);
$pagedes=ehtmlspecialchars($cr['intro']);
$classimg=$cr['ztimg'];
$onclick="<script src=".$public_r[newsurl]."e/public/onclick/?enews=dozt&ztid=$classid></script>";
$truefile=eReturnTrueEcmsPath().ReturnSaveZtPath($classid,1);//moreport
$file=eReturnTrueEcmsPath().'e/data/tmp/zt'.$classid.'.php';
$indextext=str_replace("[!--newsnav--]",$url,$indextext);//位置导航
$indextext=Class_ReplaceSvars($indextext,$url,$classid,$pagetitle,$pagekey,$pagedes,$classimg,$add,1);
}
elseif($enews==4)//专题子类
{
$murl=m_ReturnBqZtname($classid).'type'.$classid.$cr['ttype'];
$cr=$empire->fetch1("select ztid,cname,ttype,tfile from {$dbtbpre}enewszttype where cid='$classid'");
eAutodo_AddDo('ReZtcListHtml',$classid,0,0,0,0);//moreportdo
$GLOBALS['navclassid']=$classid;
$GLOBALS['navinfor']['ecmsbid']=$cr['ztid'];
$url=ReturnZtLink($cr['ztid']);//导航
$pagetitle=ehtmlspecialchars($cr['cname']);
$pagekey=ehtmlspecialchars($cr['cname']);
$pagedes=ehtmlspecialchars($cr['cname']);
$onclick="<script src=".$public_r[newsurl]."e/public/onclick/?enews=dozt&ztid=$cr[ztid]></script>";
$truefile=eReturnTrueEcmsPath().ReturnSaveZtPath($cr['ztid'],0).'/'.$cr['tfile'].$cr['ttype'];//moreport
$file=eReturnTrueEcmsPath().'e/data/tmp/ztc'.$classid.'.php';
$indextext=str_replace("[!--newsnav--]",$url,$indextext);//位置导航
$indextext=Class_ReplaceSvars($indextext,$url,$classid,$pagetitle,$pagekey,$pagedes,$classimg,$add,1);
}
elseif($enews==1)//生成首页文件
{
$murl=$mob_r['msiteurl'];
$murl='http://bbs.78moban.cn/';
$pr=$empire->fetch1("select sitekey,siteintro,indexpagedt from {$dbtbpre}enewspublic limit 1");
if($pr['indexpagedt']||(Moreport_ReturnMustDt()&&!defined('ECMS_SELFPATH')))//moreport
{
return '';
}
eAutodo_AddDo('ReIndex',0,0,0,0,0,'',1);//moreportdo
//页面
$pagetitle=ehtmlspecialchars($public_r['sitename']);
$pagekey=ehtmlspecialchars($pr['sitekey']);
$pagedes=ehtmlspecialchars($pr['siteintro']);
$url="<a href=\"".ReturnSiteIndexUrl()."\">".$fun_r['index']."</a>";//栏目导航
$onclick='';
$truefile=eReturnTrueEcmsPath().ReturnSaveIndexFile();//moreport
$file=eReturnTrueEcmsPath().'e/data/tmp/index.php';
$indextext=ReplaceSvars($indextext,$url,0,$pagetitle,$pagekey,$pagedes,$add,0);
}
// echo '[--murl--]';die;
// $indextext=str_replace('[--murl--]',$murl,$indextext);
$indextext=str_replace("[!--page.stats--]",$onclick,$indextext);
//替换标签
$indextext=DoRepEcmsLoopBq($indextext);
$indextext=RepBq($indextext);
//写文件
// echo $indextext;
// echo "<hr/>";
// echo $file;
WriteFiletext($file,AddCheckViewTempCode().$indextext);
$straaa=file_get_contents($file);
echo "<hr/>";
// echo $straaa;die;
//读取文件内容
ob_start();
include($file);
$string=ob_get_contents();
ob_end_clean();
$string=RepExeCode($string);//解析代码
WriteFiletext($truefile,$classlevel.$string);
// echo $string;die;
return $string;
}
发现 WriteFiletext($file,AddCheckViewTempCode().$indextext);执行后出现错误提示Cannot use object of type mysqli_result as array
发现是热门图文这个地方和下面的两个地方有问题,原来模板调用如下
<?php
$bqno=0;
$ResultG = sys_ReturnEcmsLoopBq($IndexClass[classid],3,0,1,'','onclick DESC');
while($ClassGoods=$empire->fetch($ResultG)){
$bqsr=sys_ReturnEcmsLoopStext($ResultG);$bqsr=sys_ReturnEcmsLoopStext($ClassGoods);
$bqno++;
?>
红色部分有问题,注释掉就可以了。
<?php
$bqno=0;
$ResultG = sys_ReturnEcmsLoopBq($IndexClass[classid],3,0,1,'','onclick DESC');
while($ClassGoods=$empire->fetch($ResultG)){
// $bqsr=sys_ReturnEcmsLoopStext($ResultG);
$bqsr=sys_ReturnEcmsLoopStext($ClassGoods);
$bqno++;
?>