找回密码
 注册账号

QQ登录

只需一步,快速开始

《泰拉瑞亚下载-1.4.2.3版》 泰拉瑞亚服务器 - MOD模组下载

入驻泰拉战网 新手指引 - 升级 - 师徒

泰拉瑞亚合成表 泰拉卡牌 - 泰拉江湖 - 泰拉刺客

联系泰拉开发组👈进入 积分市场 - 房产交易 - 水晶获取

查看: 2633|回复: 0

Discuz output函数 系统输出

[复制链接]

431

主题

77

回帖

8

广播

论坛版主

积分
214
泰拉
0
水晶
10
铜钥匙
0
银钥匙
0
金钥匙
0

【江湖新秀】【宝剑回鞘】【泰拉达人】【奥运选手】

发表于 2020-10-27 14:46:14 | 显示全部楼层 |阅读模式
本帖最后由 mickeyort 于 2020-10-27 14:54 编辑
  1. /**
  2. * 系统输出
  3. * @return 返回内容
  4. */

  5. function output() {

  6.         global $_G;


  7.         if(defined('DISCUZ_OUTPUTED')) {
  8.                 return;
  9.         } else {
  10.                 define('DISCUZ_OUTPUTED', 1);
  11.         }

  12.         if(!empty($_G['blockupdate'])) {
  13.                 block_updatecache($_G['blockupdate']['bid']);
  14.         }

  15.         if(defined('IN_MOBILE')) {
  16.                 mobileoutput();
  17.         }
  18.         $havedomain = implode('', $_G['setting']['domain']['app']);
  19.         if($_G['setting']['rewritestatus'] || !empty($havedomain)) {
  20.                 $content = ob_get_contents();
  21.                 $content = output_replace($content);


  22.                 ob_end_clean();
  23.                 $_G['gzipcompress'] ? ob_start('ob_gzhandler') : ob_start();

  24.                 echo $content;
  25.         }

  26.         if(isset($_G['makehtml'])) {
  27.                 helper_makehtml::make_html();
  28.         }

  29.         if($_G['setting']['ftp']['connid']) {
  30.                 @ftp_close($_G['setting']['ftp']['connid']);
  31.         }
  32.         $_G['setting']['ftp'] = array();

  33.         if(defined('CACHE_FILE') && CACHE_FILE && !defined('CACHE_FORBIDDEN') && !defined('IN_MOBILE') && !checkmobile()) {
  34.                 if(diskfreespace(DISCUZ_ROOT.'./'.$_G['setting']['cachethreaddir']) > 1000000) {
  35.                         if($fp = @fopen(CACHE_FILE, 'w')) {
  36.                                 flock($fp, LOCK_EX);
  37.                                 $content = empty($content) ? ob_get_contents() : $content;
  38.                                 $temp_formhash = substr(md5(substr($_G['timestamp'], 0, -3).substr($_G['config']['security']['authkey'], 3, -3)), 8, 8);
  39.                                 $content = preg_replace('/(name=[\'|"]formhash[\'|"] value=[\'"]|formhash=)('.constant("FORMHASH").')/ismU', '${1}'.$temp_formhash, $content);
  40.                                 fwrite($fp, empty($content) ? ob_get_contents() : $content);
  41.                         }
  42.                         @fclose($fp);
  43.                         chmod(CACHE_FILE, 0777);
  44.                 }
  45.         }

  46.         if(defined('DISCUZ_DEBUG') && DISCUZ_DEBUG && @include(libfile('function/debug'))) {
  47.                 function_exists('debugmessage') && debugmessage();
  48.         }
  49. }
复制代码



  1. //补充一个处理函数
  2. function output_replace($content) {
  3.         global $_G;
  4.         if(defined('IN_MODCP') || defined('IN_ADMINCP')) return $content;
  5.         if(!empty($_G['setting']['output']['str']['search'])) {
  6.                 if(empty($_G['setting']['domain']['app']['default'])) {
  7.                         $_G['setting']['output']['str']['replace'] = str_replace('{CURHOST}', $_G['siteurl'], $_G['setting']['output']['str']['replace']);
  8.                 }
  9.                 $content = str_replace($_G['setting']['output']['str']['search'], $_G['setting']['output']['str']['replace'], $content);
  10.         }
  11.         if(!empty($_G['setting']['output']['preg']['search'])) {
  12.                 if(empty($_G['setting']['domain']['app']['default'])) {
  13.                         $_G['setting']['output']['preg']['search'] = str_replace('\{CURHOST\}', preg_quote($_G['siteurl'], '/'), $_G['setting']['output']['preg']['search']);
  14.                         $_G['setting']['output']['preg']['replace'] = str_replace('{CURHOST}', $_G['siteurl'], $_G['setting']['output']['preg']['replace']);
  15.                 }

  16.                 $content = preg_replace($_G['setting']['output']['preg']['search'], $_G['setting']['output']['preg']['replace'], $content);
  17.         }

  18.         return $content;
  19. }
复制代码
[发帖际遇]: mickeyort 被钱袋砸中进医院,看病花了 12 泰拉. 幸运榜 / 衰神榜
您需要登录后才可以回帖 登录 | 注册账号

本版积分规则

QQ|友链申请|Archiver|手机版|小黑屋|游芯沙盒 ( 陕ICP备11006283号-1 )

GMT+8, 2024-5-3 01:43 , Processed in 0.113555 second(s), 41 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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