找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 329|回复: 3

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

[复制链接]
发表于 2023-2-3 21:46 | 显示全部楼层 |阅读模式

后台修改代码加快加载速度:

5、管理员登录界面“安全提问”直接显示出来,不需要点击
    source\admincp\admincp_login.php

146:    <p tabindex="2" onclick="document.querySelectorAll('.loginqa').forEach(vf=>{vf.className=''});this.style.display='none';"><span></span>{$lang['security_question']}</p>
147:   <select id="questionid" name="admin_questionid" class="loginqa"  tabindex="3" >
157:   <input tabindex="4"  type="text" name="admin_answer" class="loginqa" placeholder="{$lang['security_answer']}" autocomplete="off">

找到对应位置,将删除线的代码删掉即可。


4、去掉”新闻动态“  

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

3、去掉”DiscuzX 开发团队“

 source/admincp/admincp_index.php第457行找到 show_forever_thanks() 函数,直接返回 return;
 

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

$newversion = (CHARSET == 'utf-8') ? dunserialize($_G['setting']['cloudaddons_newversion']) : json_decode($_G['setting']['cloudaddons_newversion'], true);

if(empty($newversion['newversion']) || !is_array($newversion['newversion']) || abs($_G['timestamp'] - $newversion['updatetime']) > 86400 || (isset($_GET['checknewversion']) && $_G['formhash'] == $_GET['formhash'])) {

 $newversion = json_decode(cloudaddons_open('&mod=app&ac=upgrade'), true);

 if(!empty($newversion['newversion'])) {

   $newversion['updatetime'] = $_G['timestamp'];

   C::t('common_setting')->update_setting('cloudaddons_newversion', ((CHARSET == 'utf-8') ? $newversion : json_encode($newversion)));

   updatecache('setting');

 } else {

  $newversion = array();

 }

}

改为: $newversion = array();

 

1、修改后台首页“管理团队留言”中30天

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

 $note['expiration'] = ceil(($note['expiration'] - $note['dateline']) / 86400);

或者直接让此函数 return;

 楼主| 发表于 2024-3-12 16:16 | 显示全部楼层

DZ禁止上传图片木马

1、修改官方源代码,source\class\discuz\discuz_upload.php
     方法名:save
    function save($ignore = 0) {
        $tmpbody = file_get_contents($this->attach['tmp_name']);
        if(stripos($tmpbody, 'eval(') !== false   || stripos($tmpbody, '<?php ') !== false) {
            $this->errorcode = -103;
            return false;
        }

        if($ignore) {
     

2、加固:直接用nginx禁止图片目录中的php运行
    location ~*  ^/data/.*\.(php)$
    {
        return 404;
    }
 

点评

第2条要放在解析php之上,否则不生效。  发表于 2024-3-12 16:18
 楼主| 发表于 2024-3-21 10:33 | 显示全部楼层

使用dz内置函数

require_once libfile('function/cache'); //加载缓存类
savecache($cachename, $data); //写缓存
loadcache($cachename); //读缓存,将缓存写到$_G变量中,通过读取$_G['cache']['myname']来获取缓存数据。

注:如果config_global.php文件中没有配置缓存的话,将会存到数据库common_syscache表中,$cachename值长度最长为32位。

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|学习笔记

GMT+8, 2024-4-28 21:48 , Processed in 0.028264 second(s), 14 queries , APCu On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表