写帝国cms的插件,很多时候需要找到切入点。今天给大家介绍php的一个函数:deug_backtrace()
他可以返回被调用函数的调用序列。在帝国的/e/class/connect.php中的函数WriteFiletext插入代码: //写文件
function WriteFiletext($filepath,$string){
global $public_r;
$string=stripSlashes($string);
$fp=@fopen($filepath,"w");
@fputs($fp,$string);
@fclose($fp);
if(empty($public_r[filechmod]))
{
@chmod($filepath,0777);
}
// add by jiuhecai begin
$a=debug_backtrace();
$callfn='';
foreach($a as $v){
$callfn.=$v['function'].',';
}
insert_dolog($callfn);
//add by jiuhecai end
}
就可以在操作日记中,看到后台动作导致写文件的文件调用序列。
修改信息 调用两次WriteFiletext
WriteFiletext,GetInfoNewsBq,GetHtml,EditNews //解析标签,写了个临时文件
WriteFiletext,GetHtml,EditNews //生成html文件
2. 添加信息 WriteFiletext,GetHtml,AddNews, WriteFiletext,GetInfoNewsBq,GetHtml,AddNews,
3.移动信息
倒叙 WriteFiletext,ListHtml,ReListHtml,MoveNews_all, //刷新列表 WriteFiletext,InfoNewsBq,GetListTemp,ListHtml,ReListHtml,MoveNews_all, // 解析标签 WriteFiletext,ListHtml,ReListHtml,MoveNews_all, //刷新列表 WriteFiletext,InfoNewsBq,GetListTemp,ListHtml,ReListHtml,MoveNews_all, //刷新标签
可见,移动信息,并没有重新生成新文件。需要你刷新才行。
4. 复制信息
WriteFiletext,ListHtml,ReListHtml,CopyNews_all, WriteFiletext,InfoNewsBq,GetListTemp,ListHtml,ReListHtml,CopyNews_all, WriteFiletext,GetHtml,CopyNews_all, WriteFiletext,GetInfoNewsBq,GetHtml,CopyNews_all,
5. 刷新信息
WriteFiletext,GetHtml,ReSingleInfo, WriteFiletext,GetInfoNewsBq,GetHtml,ReSingleInfo,
WriteFiletext,GetHtml,ReNewsHtml, WriteFiletext,GetInfoNewsBq,GetHtml,ReNewsHtml,
|