discuz广告调用修改:
修改文件source/function/function_core.php 的adshow函数,增加了广告调用数量的控制
function adshow($parameter) { global $_G; if($_G['inajax'] || $_G['group']['closead']) { return; } if(isset($_G['config']['plugindeveloper']) && $_G['config']['plugindeveloper'] == 2) { return '<hook>[ad '.$parameter.']</hook>'; } $params = explode('/', $parameter); $customid = 0; $customc = explode('_', $params[0]); if($customc[0] == 'custom') { $params[0] = $customc[0]; $customid = $customc[1]; } // 增加调用数量 if ($customc[2]) { $num = $customc[2]; } $adcontent = null; if(empty($_G['setting']['advtype']) || !in_array($params[0], $_G['setting']['advtype'])) { $adcontent = ''; } if($adcontent === null) { loadcache('advs'); $adids = array(); $evalcode = &$_G['cache']['advs']['evalcode'][$params[0]]; $parameters = &$_G['cache']['advs']['parameters'][$params[0]]; $codes = &$_G['cache']['advs']['code'][$_G['basescript']][$params[0]]; if(!empty($codes)) { foreach($codes as $adid => $code) { $parameter = &$parameters[$adid]; $checked = true; @eval($evalcode['check']); if($checked) { $adids[] = $adid; } } if(!empty($adids)) { $adcode = $extra = ''; @eval($evalcode['create']); if(empty($notag)) { // $adcontent = '<div'.($params[1] != '' ? ' class="'.$params[1].'"' : '').$extra.'>'.$adcode.'</div>'; discuz默认代码 // 修改为以下代码,增加了广告数量控制和随机显示 if($num>1){ $adcontent =''; shuffle($adids); foreach($adids as $adKey => $adID) { if($adKey == $num) break; $adcode=$codes[$adID]; $adcontent .= '<div'.($params[1] != '' ? ' class="'.$params[1].'"' : '').$extra.'>'.$adcode.'</div>'; } }else{ $adcontent = '<div'.($params[1] != '' ? ' class="'.$params[1].'"' : '').$extra.'>'.$adcode.'</div>'; } } else { $adcontent = $adcode; } } } } $adfunc = 'ad_'.$params[0]; $_G['setting']['pluginhooks'][$adfunc] = null; hookscript('ad', 'global', 'funcs', array('params' => $params, 'content' => $adcontent), $adfunc); if(!$_G['setting']['hookscript']['global']['ad']['funcs'][$adfunc]) { hookscript('ad', $_G['basescript'], 'funcs', array('params' => $params, 'content' => $adcontent), $adfunc); } return $_G['setting']['pluginhooks'][$adfunc] === null ? $adcontent : $_G['setting']['pluginhooks'][$adfunc]; }
模板调用代码:
discuz默认调用代码为 <!--{ad/custom_2}-->
新的控制广告显示数量代码为 <!--{ad/custom_2_3}--> 红色为调用数量
小云APP调用视频出现程序错误修改记录
修改文件/mobcent/app/components/web/ForumUtils.php的_transPostMessage()函数,注释掉小云的音视频转换代码937-976行,现函数如下
private static function _transPostMessage($post) { /*天乐注释 2021-04-03 if ($post['bbcodeoff'] != 1) { // 转换视音频,为了不走 discuz 原先的流程 $post['message'] = preg_replace_callback( '/\[(audio|media|flash|code)(.*?)\](.*?)\[\/\1\]/s', create_function('$matches', ' global $_G; $string = ""; switch ($matches[1]) { case "audio": $string = "[mobcent_audio={$matches[3]}]"; break; case "media": if($matches[2]){ $poster = explode(",",$matches[2]); if(!empty($poster)) { if(trim($poster[0],"=") == "aid" && $poster[1]) { $data = DbUtils::createDbUtils(true)->queryRow("SELECT * FROM %t WHERE aid=%d",array("forum_attachment_0",$poster[1])); if(!empty($data)) { $forum = $data["remote"] ? "/" : "/forum/"; $attach_url = ImageUtils::getAttachUrl($data["remote"]).$forum.$data["attachment"]; } } } } case "flash": $videoUrl = ForumUtils::transVideoUrl($matches[3]); $string = "[mobcent_video={$videoUrl} mobcent_picurl={$attach_url}]"; break; default: break; } return "[mobcent_br]\r\n" . $string . "\r\n"; '), $post['message'] ); }*/ // 转换超链接 $post['message'] = preg_replace_callback('/\[url=?(.*?)\](.*?)\[\\/url\]/', create_function('$matches', ' $matches[1] || $matches[1] = $matches[2]; $matches[1] = WebUtils::getHttpFileName($matches[1]); return "[mobcent_br]\r\n[mobcent_url={$matches[1]}(title={$matches[2]})]\r\n"; '), $post['message'] ); return DzForumPost::transPostContentToHtml($post); }
首页跳转导读修改:index.php
require './'.$parse['path']; //注释掉这行,添加下两行 header("HTTP/1.1 301 Moved Permanently"); header("location: $url");
导读添加收藏榜和点赞榜:
删除帖子404显示:
修改文件 source/module/forum/forum_viewthread.php
if(!$_G['forum_thread'] || !$_G['forum']) { //header("HTTP/1.1 404 Not Found"); 注释掉此行 showmessage('thread_nonexistence'); }
电脑访问不跳转手机:
修改文件:source/class/discuz/discuz_application.php
注释掉 //dheader("Location:misc.php?mod=mobile");
腾讯文本内容安全开启XSS过滤出现"非法字符,已经被系统拒绝"修改:
修改文件source/plugin/tencentcloud_tms/template/ajax_examine_js.htm ,添加过滤函数过滤标题和内容中的<>\()等字符
function filter(text) { var reg = /[<>\()"]/g; //1、全局匹配g肯定忘记写,2、<>标签中不能包含标签实现过滤HTML标签 text = text.replace(reg, '');//替换HTML标签 return text; };
咨询电话
400-888-9999