杰克工作室 发表于 2023-2-3 21:46

[discuzX3.5] dzx  PHP源代码相关

<h3>后台修改代码加快加载速度:</h3>

<p>5、管理员登录界面&ldquo;安全提问&rdquo;直接显示出来,不需要点击<br />
&nbsp; &nbsp; source\admincp\admincp_login.php</p>

<div style="background:#eeeeee; border:1px solid #cccccc; padding:5px 10px">146: &nbsp; &nbsp;<s>&lt;p tabindex=&quot;2&quot; onclick=&quot;document.querySelectorAll(&#39;.loginqa&#39;).forEach(vf=&gt;{vf.className=&#39;&#39;});this.style.display=&#39;none&#39;;&quot;&gt;&lt;span&gt;&lt;/span&gt;{$lang[&#39;security_question&#39;]}&lt;/p&gt;</s><br />
147: &nbsp; &lt;select id=&quot;questionid&quot; name=&quot;admin_questionid&quot; class=&quot;<s>loginqa</s>&quot; &nbsp;tabindex=&quot;3&quot; &gt;<br />
157: &nbsp; &lt;input tabindex=&quot;4&quot; &nbsp;type=&quot;text&quot; name=&quot;admin_answer&quot; class=&quot;<s>loginqa</s>&quot; placeholder=&quot;{$lang[&#39;security_answer&#39;]}&quot; autocomplete=&quot;off&quot;&gt;</div>

<p>找到对应位置,将删除线的代码删掉即可。<br />
<br />
<br />
4、去掉&rdquo;新闻动态&ldquo;  </p>

<p> source/admincp/admincp_index.php第404行找到 function show_news()函数,直接返回 return;<br />
&nbsp;</p>

<p>3、去掉&rdquo;DiscuzX 开发团队&ldquo;</p>

<p> source/admincp/admincp_index.php第457行找到 show_forever_thanks() 函数,直接返回 return;<br />
&nbsp;</p>

<p>2、去掉版本检测   source/admincp/admincp_index.php第50-60行</p>

<p>$newversion = (CHARSET == &#39;utf-8&#39;) ? dunserialize($_G[&#39;setting&#39;][&#39;cloudaddons_newversion&#39;]) : json_decode($_G[&#39;setting&#39;][&#39;cloudaddons_newversion&#39;], true);</p>

<p>if(empty($newversion[&#39;newversion&#39;]) || !is_array($newversion[&#39;newversion&#39;]) || abs($_G[&#39;timestamp&#39;] - $newversion[&#39;updatetime&#39;]) &gt; 86400 || (isset($_GET[&#39;checknewversion&#39;]) &amp;&amp; $_G[&#39;formhash&#39;] == $_GET[&#39;formhash&#39;])) {</p>

<p> $newversion = json_decode(cloudaddons_open(&#39;&amp;mod=app&amp;ac=upgrade&#39;), true);</p>

<p> if(!empty($newversion[&#39;newversion&#39;])) {</p>

<p>   $newversion[&#39;updatetime&#39;] = $_G[&#39;timestamp&#39;];</p>

<p>   C::t(&#39;common_setting&#39;)-&gt;update_setting(&#39;cloudaddons_newversion&#39;, ((CHARSET == &#39;utf-8&#39;) ? $newversion : json_encode($newversion)));</p>

<p>   updatecache(&#39;setting&#39;);</p>

<p> } else {</p>

<p>  $newversion = array();</p>

<p> }</p>

<p>}</p>

<p>改为: $newversion = array();</p>

<p>&nbsp;</p>

<p>1、修改后台首页&ldquo;管理团队留言&rdquo;中30天</p>

<p> source/admincp/admincp_index.php第267行函数 function show_note()方法:</p>

<p> $note[&#39;expiration&#39;] = ceil(($note[&#39;expiration&#39;] - $note[&#39;dateline&#39;]) / 86400);</p>

<p>或者直接让此函数 return;</p>

杰克工作室 发表于 2024-3-12 16:16

<h3>DZ禁止上传图片木马</h3>
1、修改官方源代码,source\class\discuz\discuz_upload.php<br />
&nbsp; &nbsp; &nbsp;方法名:save<br />
&nbsp;&nbsp; &nbsp;function save($ignore = 0) {<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;<span style="color:#e74c3c">$tmpbody = file_get_contents($this-&gt;attach[&#39;tmp_name&#39;]);<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;if(stripos($tmpbody, &#39;eval(&#39;) !== false &nbsp; || stripos($tmpbody, &#39;&lt;?php &#39;) !== false) {<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;$this-&gt;errorcode = -103;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;return false;<br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;}</span><br />
&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;if($ignore) {<br />
&nbsp; &nbsp; &nbsp;<br />
<br />
2、加固:直接用nginx禁止图片目录中的php运行<br />
&nbsp; &nbsp; location ~* &nbsp;^/data/.*\.(php)$<br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; return 404;<br />
&nbsp; &nbsp; }<br />
&nbsp;

杰克工作室 发表于 2024-3-21 10:33

<h2>使用dz内置函数</h2>

<p>require_once libfile(&#39;function/cache&#39;); //加载缓存类<br />
savecache($cachename, $data); //写缓存<br />
loadcache($cachename); //读缓存,将缓存写到$_G变量中,通过读取$_G[&#39;cache&#39;][&#39;myname&#39;]来获取缓存数据。<br />
<br />
注:如果config_global.php文件中没有配置缓存的话,将会存到数据库common_syscache表中,$cachename值长度最长为32位。</p>
页: [1]
查看完整版本: [discuzX3.5] dzx  PHP源代码相关