问答

appnode 配置后Discuz报错

作者:admin 2021-04-22 我要评论

index.php ?php/** * [Discuz!] (C)2001-2099 Comsenz Inc. * This is NOT a freeware, use is subject to license terms * * $Id: index.php 34524 2014-05-15 ...

在说正事之前,我要推荐一个福利:你还在原价购买阿里云、腾讯云、华为云服务器吗?那太亏啦!来这里,新购、升级、续费都打折,能够为您省60%的钱呢!2核4G企业级云服务器低至69元/年,点击进去看看吧>>>)

image.png
index.php

<?php

/**
 *      [Discuz!] (C)2001-2099 Comsenz Inc.
 *      This is NOT a freeware, use is subject to license terms
 *
 *      $Id: index.php 34524 2014-05-15 04:42:23Z nemohou $
 */

if(!empty($_SERVER['QUERY_STRING']) && is_numeric($_SERVER['QUERY_STRING'])) {
    $_ENV['curapp'] = 'home';
    $_GET = array('mod'=>'space', 'uid'=>$_SERVER['QUERY_STRING']);
} else {

    $url = '';
    $domain = $_ENV = array();
    $jump = false;
    @include_once './data/sysdata/cache_domain.php';
    $_ENV['domain'] = $domain;
    if(empty($_ENV['domain'])) {
        $_ENV['curapp'] = 'forum';
    } else {
        $_ENV['defaultapp'] = array('portal.php' => 'portal', 'forum.php' => 'forum', 'group.php' => 'group', 'home.php' => 'home');
        $_ENV['hostarr'] = explode('.', $_SERVER['HTTP_HOST']);
        $_ENV['domainroot'] = substr($_SERVER['HTTP_HOST'], strpos($_SERVER['HTTP_HOST'], '.')+1);
        if(!empty($_ENV['domain']['app']) && is_array($_ENV['domain']['app']) && in_array($_SERVER['HTTP_HOST'], $_ENV['domain']['app'])) {
            $_ENV['curapp'] = array_search($_SERVER['HTTP_HOST'], $_ENV['domain']['app']);
            if($_ENV['curapp'] == 'mobile') {
                $_ENV['curapp'] = 'forum';
                if(!isset($_GET['mobile'])) {
                    @$_GET['mobile'] = '2';
                }
            }
            if($_ENV['curapp'] == 'default' || !isset($_ENV['defaultapp'][$_ENV['curapp'].'.php'])) {
                $_ENV['curapp'] = '';
            }
        } elseif(!empty($_ENV['domain']['root']) && is_array($_ENV['domain']['root']) && in_array($_ENV['domainroot'], $_ENV['domain']['root'])) {

            $_G['setting']['holddomain'] = $_ENV['domain']['holddomain'] ? $_ENV['domain']['holddomain'] : array('www');
            $list = $_ENV['domain']['list'];
            if(isset($list[$_SERVER['HTTP_HOST']])) {
                $domain = $list[$_SERVER['HTTP_HOST']];
                switch($domain['idtype']) {
                    case 'subarea':
                        $_ENV['curapp'] = 'forum';
                        $_GET['gid'] = intval($domain['id']);
                        break;
                    case 'forum':
                        $_ENV['curapp'] = 'forum';
                        $_GET['mod'] = 'forumdisplay';
                        $_GET['fid'] = intval($domain['id']);
                        break;
                    case 'topic':
                        $_ENV['curapp'] = 'portal';
                        $_GET['mod'] = 'topic';
                        $_GET['topicid'] = intval($domain['id']);
                        break;
                    case 'channel':
                        $_ENV['curapp'] = 'portal';
                        $_GET['mod'] = 'list';
                        $_GET['catid'] = intval($domain['id']);
                        break;
                    case 'plugin':
                        $_ENV['curapp'] = 'plugin';
                        $_GET['id'] = $domain['id'];
                        $_GET['fromapp'] = 'index';
                        break;
                }
            } elseif(count($_ENV['hostarr']) > 2 && $_ENV['hostarr'][0] != 'www' && !checkholddomain($_ENV['hostarr'][0])) {
                $_ENV['prefixdomain'] = addslashes($_ENV['hostarr'][0]);
                $_ENV['domainroot'] = addslashes($_ENV['domainroot']);
                require_once './source/class/class_core.php';
                C::app()->init_setting = true;
                C::app()->init_user = false;
                C::app()->init_session = false;
                C::app()->init_cron = false;
                C::app()->init_misc = false;
                C::app()->init();
                $jump = true;
                $domain = C::t('common_domain')->fetch_by_domain_domainroot($_ENV['prefixdomain'], $_ENV['domainroot']);
                $apphost = $_ENV['domain']['app'][$domain['idtype']] ? $_ENV['domain']['app'][$domain['idtype']] : $_ENV['domain']['app']['default'];
                $apphost = $apphost ? $_G['scheme'].'://'.$apphost.'/' : '';
                switch($domain['idtype']) {
                    case 'home':
                        if($_G['setting']['rewritestatus'] && in_array('home_space', $_G['setting']['rewritestatus'])) {
                            $url = rewriteoutput('home_space', 1, $apphost, $domain['id']);
                        } else {
                            $url = $apphost.'home.php?mod=space&uid='.$domain['id'];
                        }
                        break;
                    case 'group':
                        if($_G['setting']['rewritestatus'] && in_array('group_group', $_G['setting']['rewritestatus'])) {
                            $url = rewriteoutput('group_group', 1, $apphost, $domain['id']);
                        } else {
                            $url = $apphost.'forum.php?mod=group&fid='.$domain['id'].'&page=1';
                        }
                        break;
                }
            }
        } else {
            $jump = true;
        }
        if(empty($url) && empty($_ENV['curapp'])) {
            if(!empty($_ENV['domain']['defaultindex']) && !$jump) {
                if($_ENV['defaultapp'][$_ENV['domain']['defaultindex']]) {
                    $_ENV['curapp'] = $_ENV['defaultapp'][$_ENV['domain']['defaultindex']];
                } else {
                    $url = $_ENV['domain']['defaultindex'];
                }
            } else {
                if($jump) {
                    $url = empty($_ENV['domain']['app']['default']) ? (!empty($_ENV['domain']['defaultindex']) ? $_ENV['domain']['defaultindex'] : 'forum.php') : ($_SERVER['HTTPS'] == 'on' ? 'https' : 'http').'://'.$_ENV['domain']['app']['default'];
                } else {
                    $_ENV['curapp'] = 'forum';
                }
            }
        }
    }
}
if(!empty($url)) {
    $delimiter = strrpos($url, '?') ? '&' : '?';
    if(isset($_GET['fromuid']) && $_GET['fromuid']) {
        $url .= sprintf('%sfromuid=%d', $delimiter, $_GET['fromuid']);
    } elseif(isset($_GET['fromuser']) && $_GET['fromuser']) {
        $url .= sprintf('%sfromuser=%s', $delimiter, rawurlencode($_GET['fromuser']));
    }
    $parse = parse_url($url);
    if(!isset($parse['host']) && file_exists($parse['path'])) {
        if(!empty($parse['query'])) {
            parse_str($parse['query'], $_GET);
        }
        require './'.$parse['path'];
    } else {
        header("location: $url");
    }
} else {
    require './'.$_ENV['curapp'].'.php';
}

function checkholddomain($domain) {
    global $_G;

    $domain = strtolower($domain);
    if(preg_match("/^[^a-z]/i", $domain)) return true;
    $holdmainarr = empty($_G['setting']['holddomain']) ? array('www') : explode('|', $_G['setting']['holddomain']);
    $ishold = false;
    foreach ($holdmainarr as $value) {
        if(strpos($value, '*') === false) {
            if(strtolower($value) == $domain) {
                $ishold = true;
                break;
            }
        } else {
            $value = str_replace('*', '.*?', $value);
            if(@preg_match("/$value/i", $domain)) {
                $ishold = true;
                break;
            }
        }
    }
    return $ishold;
}
?>

forum.php

<?php

/**
 *      [Discuz!] (C)2001-2099 Comsenz Inc.
 *      This is NOT a freeware, use is subject to license terms
 *
 *      $Id: forum.php 33828 2013-08-20 02:29:32Z nemohou $
 */


define('APPTYPEID', 2);
define('CURSCRIPT', 'forum');


require './source/class/class_core.php';


require './source/function/function_forum.php';


$modarray = array('ajax','announcement','attachment','forumdisplay',
    'group','image','index','medal','misc','modcp','notice','post','redirect',
    'rss','topicadmin','trade','viewthread','tag','collection','guide'
);

$modcachelist = array(
    'index'        => array('announcements', 'onlinelist', 'forumlinks',
            'heats', 'historyposts', 'onlinerecord', 'userstats', 'diytemplatenameforum'),
    'forumdisplay'    => array('smilies', 'announcements_forum', 'globalstick', 'forums',
            'onlinelist', 'forumstick', 'threadtable_info', 'threadtableids', 'stamps', 'diytemplatenameforum'),
    'viewthread'    => array('smilies', 'smileytypes', 'forums', 'usergroups',
            'stamps', 'bbcodes', 'smilies',    'custominfo', 'groupicon', 'stamps',
            'threadtableids', 'threadtable_info', 'posttable_info', 'diytemplatenameforum'),
    'redirect'    => array('threadtableids', 'threadtable_info', 'posttable_info'),
    'post'        => array('bbcodes_display', 'bbcodes', 'smileycodes', 'smilies', 'smileytypes',
            'domainwhitelist', 'albumcategory'),
    'space'        => array('fields_required', 'fields_optional', 'custominfo'),
    'group'        => array('grouptype', 'diytemplatenamegroup'),
    'topicadmin'    => array('usergroups'),
);

$mod = !in_array(C::app()->var['mod'], $modarray) ? 'index' : C::app()->var['mod'];

define('CURMODULE', $mod);
$cachelist = array();
if(isset($modcachelist[CURMODULE])) {
    $cachelist = $modcachelist[CURMODULE];

    $cachelist[] = 'plugin';
    $cachelist[] = 'pluginlanguage_system';
}
if(C::app()->var['mod'] == 'group') {
    $_G['basescript'] = 'group';
}

C::app()->cachelist = $cachelist;
C::app()->init();

loadforum();

set_rssauth();

runhooks();

$navtitle = str_replace('{bbname}', $_G['setting']['bbname'], $_G['setting']['seotitle']['forum']);
$_G['setting']['threadhidethreshold'] = 1;
require DISCUZ_ROOT.'./source/module/forum/forum_'.$mod.'.php';

?>

感谢。

版权声明:本文转载自网络,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。本站转载出于传播更多优秀技术知识之目的,如有侵权请联系QQ/微信:153890879删除

相关文章
  • 求助!Mysql workbench connections出

    求助!Mysql workbench connections出

  • c++ 的dll 转golang可以调用

    c++ 的dll 转golang可以调用

  • c++的 new int{10}  和 new int(10) 有

    c++的 new int{10} 和 new int(10) 有

  • Grafana MySQL为数据源时, 折线图无法

    Grafana MySQL为数据源时, 折线图无法

腾讯云代理商
海外云服务器