[discuzX3.5] dzx PHP源代码相关
<h3>后台修改代码加快加载速度:</h3><p>5、管理员登录界面“安全提问”直接显示出来,不需要点击<br />
source\admincp\admincp_login.php</p>
<div style="background:#eeeeee; border:1px solid #cccccc; padding:5px 10px">146: <s><p tabindex="2" onclick="document.querySelectorAll('.loginqa').forEach(vf=>{vf.className=''});this.style.display='none';"><span></span>{$lang['security_question']}</p></s><br />
147: <select id="questionid" name="admin_questionid" class="<s>loginqa</s>" tabindex="3" ><br />
157: <input tabindex="4" type="text" name="admin_answer" class="<s>loginqa</s>" placeholder="{$lang['security_answer']}" autocomplete="off"></div>
<p>找到对应位置,将删除线的代码删掉即可。<br />
<br />
<br />
4、去掉”新闻动态“ </p>
<p> source/admincp/admincp_index.php第404行找到 function show_news()函数,直接返回 return;<br />
</p>
<p>3、去掉”DiscuzX 开发团队“</p>
<p> source/admincp/admincp_index.php第457行找到 show_forever_thanks() 函数,直接返回 return;<br />
</p>
<p>2、去掉版本检测 source/admincp/admincp_index.php第50-60行</p>
<p>$newversion = (CHARSET == 'utf-8') ? dunserialize($_G['setting']['cloudaddons_newversion']) : json_decode($_G['setting']['cloudaddons_newversion'], true);</p>
<p>if(empty($newversion['newversion']) || !is_array($newversion['newversion']) || abs($_G['timestamp'] - $newversion['updatetime']) > 86400 || (isset($_GET['checknewversion']) && $_G['formhash'] == $_GET['formhash'])) {</p>
<p> $newversion = json_decode(cloudaddons_open('&mod=app&ac=upgrade'), true);</p>
<p> if(!empty($newversion['newversion'])) {</p>
<p> $newversion['updatetime'] = $_G['timestamp'];</p>
<p> C::t('common_setting')->update_setting('cloudaddons_newversion', ((CHARSET == 'utf-8') ? $newversion : json_encode($newversion)));</p>
<p> updatecache('setting');</p>
<p> } else {</p>
<p> $newversion = array();</p>
<p> }</p>
<p>}</p>
<p>改为: $newversion = array();</p>
<p> </p>
<p>1、修改后台首页“管理团队留言”中30天</p>
<p> source/admincp/admincp_index.php第267行函数 function show_note()方法:</p>
<p> $note['expiration'] = ceil(($note['expiration'] - $note['dateline']) / 86400);</p>
<p>或者直接让此函数 return;</p>
<h3>DZ禁止上传图片木马</h3>
1、修改官方源代码,source\class\discuz\discuz_upload.php<br />
方法名:save<br />
function save($ignore = 0) {<br />
<span style="color:#e74c3c">$tmpbody = file_get_contents($this->attach['tmp_name']);<br />
if(stripos($tmpbody, 'eval(') !== false || stripos($tmpbody, '<?php ') !== false) {<br />
$this->errorcode = -103;<br />
return false;<br />
}</span><br />
if($ignore) {<br />
<br />
<br />
2、加固:直接用nginx禁止图片目录中的php运行<br />
location ~* ^/data/.*\.(php)$<br />
{<br />
return 404;<br />
}<br />
<h2>使用dz内置函数</h2>
<p>require_once libfile('function/cache'); //加载缓存类<br />
savecache($cachename, $data); //写缓存<br />
loadcache($cachename); //读缓存,将缓存写到$_G变量中,通过读取$_G['cache']['myname']来获取缓存数据。<br />
<br />
注:如果config_global.php文件中没有配置缓存的话,将会存到数据库common_syscache表中,$cachename值长度最长为32位。</p>
页:
[1]