示例#1
0
function output()
{
    global $_G;
    if (defined('DISCUZ_OUTPUTED')) {
        return;
    } else {
        define('DISCUZ_OUTPUTED', 1);
    }
    if (!empty($_G['blockupdate'])) {
        block_updatecache($_G['blockupdate']['bid']);
    }
    if (defined('IN_MOBILE')) {
        mobileoutput();
    }
    if (!defined('IN_MOBILE') && !defined('IN_ARCHIVER')) {
        $tipsService = Cloud::loadClass('Service_DiscuzTips');
        $tipsService->show();
    }
    $havedomain = implode('', $_G['setting']['domain']['app']);
    if ($_G['setting']['rewritestatus'] || !empty($havedomain)) {
        $content = ob_get_contents();
        $content = output_replace($content);
        ob_end_clean();
        $_G['gzipcompress'] ? ob_start('ob_gzhandler') : ob_start();
        echo $content;
    }
    if (isset($_G['makehtml'])) {
        helper_makehtml::make_html();
    }
    if ($_G['setting']['ftp']['connid']) {
        @ftp_close($_G['setting']['ftp']['connid']);
    }
    $_G['setting']['ftp'] = array();
    if (defined('CACHE_FILE') && CACHE_FILE && !defined('CACHE_FORBIDDEN') && !defined('IN_MOBILE') && !checkmobile()) {
        if (diskfreespace(DISCUZ_ROOT . './' . $_G['setting']['cachethreaddir']) > 1000000) {
            if ($fp = @fopen(CACHE_FILE, 'w')) {
                flock($fp, LOCK_EX);
                fwrite($fp, empty($content) ? ob_get_contents() : $content);
            }
            @fclose($fp);
            chmod(CACHE_FILE, 0777);
        }
    }
    if (defined('DISCUZ_DEBUG') && DISCUZ_DEBUG && @(include libfile('function/debug'))) {
        function_exists('debugmessage') && debugmessage();
    }
}