private function _init_env() { error_reporting(E_ERROR); define('MAGIC_QUOTES_GPC', function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()); // ' " \ NULL 等字符转义 当magic_quotes_gpc=On的时候,函数get_magic_quotes_gpc()就会返回1 define('GZIP', function_exists('ob_gzhandler')); // ob 缓存压缩输出 if (function_exists('date_default_timezone_set')) { @date_default_timezone_set('Etc/GMT-8'); //东八区 北京时间 } define('TIMESTAMP', time()); if (!defined('BLOG_FUNCTION') && !@(include BLOG_ROOT . '/source/functions.php')) { exit('functions.php is missing'); } define('IS_ROBOT', checkrobot()); global $_B; $_B = array('uid' => 0, 'username' => '', 'groupid' => 0, 'timestamp' => TIMESTAMP, 'clientip' => $this->_get_client_ip(), 'mobile' => '', 'agent' => '', 'admin' => 0); checkmobile(); $_B['PHP_SELF'] = bhtmlspecialchars($this->_get_script_url()); $_B['basefilename'] = basename($_B['PHP_SELF']); $sitepath = substr($_B['PHP_SELF'], 0, strrpos($_B['PHP_SELF'], '/')); $_B['siteurl'] = bhtmlspecialchars('http://' . $_SERVER['HTTP_HOST'] . $sitepath . '/'); getReferer(); $url = parse_url($_B['siteurl']); $_B['siteroot'] = isset($url['path']) ? $url['path'] : ''; $_B['siteport'] = empty($_SERVER['SERVER_PORT']) || $_SERVER['SERVER_PORT'] == '80' ? '' : ':' . $_SERVER['SERVER_PORT']; $this->b =& $_B; }
function _init_env() { error_reporting(E_ERROR); if (PHP_VERSION < '5.3.0') { set_magic_quotes_runtime(0); } /*vot*/ if (!defined('DISCUZ_ROOT')) { /*vot*/ define('DISCUZ_ROOT', preg_replace("/^\\w\\:/i", '', str_replace("\\", '/', substr(dirname(__FILE__), 0, -12)))); /*vot*/ } define('MAGIC_QUOTES_GPC', function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()); define('ICONV_ENABLE', function_exists('iconv')); define('MB_ENABLE', function_exists('mb_convert_encoding')); define('EXT_OBGZIP', function_exists('ob_gzhandler')); define('TIMESTAMP', time()); $this->timezone_set(); /*vot*/ if (!defined('DISCUZ_CORE_FUNCTION') && !@(include_once DISCUZ_ROOT . './source/function/function_core.php')) { exit('function_core.php is missing'); } if (function_exists('ini_get')) { $memorylimit = @ini_get('memory_limit'); if ($memorylimit && return_bytes($memorylimit) < 33554432 && function_exists('ini_set')) { ini_set('memory_limit', '128m'); } } define('IS_ROBOT', checkrobot()); foreach ($GLOBALS as $key => $value) { if (!isset($this->superglobal[$key])) { $GLOBALS[$key] = null; unset($GLOBALS[$key]); } } global $_G; $_G = array('uid' => 0, 'username' => '', 'adminid' => 0, 'groupid' => 1, 'sid' => '', 'formhash' => '', 'timestamp' => TIMESTAMP, 'starttime' => dmicrotime(), 'clientip' => $this->_get_client_ip(), 'referer' => '', 'charset' => '', 'gzipcompress' => '', 'authkey' => '', 'timenow' => array(), 'PHP_SELF' => '', 'siteurl' => '', 'siteroot' => '', 'siteport' => '', 'config' => array(), 'setting' => array(), 'member' => array(), 'group' => array(), 'cookie' => array(), 'style' => array(), 'cache' => array(), 'session' => array(), 'lang' => array(), 'my_app' => array(), 'my_userapp' => array(), 'fid' => 0, 'tid' => 0, 'forum' => array(), 'thread' => array(), 'rssauth' => '', 'home' => array(), 'space' => array(), 'block' => array(), 'article' => array(), 'action' => array('action' => APPTYPEID, 'fid' => 0, 'tid' => 0), 'mobile' => ''); $_G['PHP_SELF'] = htmlspecialchars($this->_get_script_url()); $_G['basescript'] = CURSCRIPT; $_G['basefilename'] = basename($_G['PHP_SELF']); $sitepath = substr($_G['PHP_SELF'], 0, strrpos($_G['PHP_SELF'], '/')); if (defined('IN_API')) { $sitepath = preg_replace("/\\/api\\/?.*?\$/i", '', $sitepath); } elseif (defined('IN_ARCHIVER')) { $sitepath = preg_replace("/\\/archiver/i", '', $sitepath); } $_G['siteurl'] = htmlspecialchars('http://' . $_SERVER['HTTP_HOST'] . $sitepath . '/'); $url = parse_url($_G['siteurl']); $_G['siteroot'] = isset($url['path']) ? $url['path'] : ''; $_G['siteport'] = empty($_SERVER['SERVER_PORT']) || $_SERVER['SERVER_PORT'] == '80' ? '' : ':' . $_SERVER['SERVER_PORT']; if (defined('SUB_DIR')) { $_G['siteurl'] = str_replace(SUB_DIR, '/', $_G['siteurl']); $_G['siteroot'] = str_replace(SUB_DIR, '/', $_G['siteroot']); } /*vot*/ $_G['siteurl'] = str_replace("\\", '/', $_G['siteurl']); /*vot*/ $_G['siteroot'] = str_replace("\\", '/', $_G['siteroot']); $this->var =& $_G; }
function _init_env() { error_reporting(E_ERROR); if (phpversion() < '5.3.0') { set_magic_quotes_runtime(0); } define('DISCUZ_ROOT', substr(dirname(__FILE__), 0, -12)); define('MAGIC_QUOTES_GPC', function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()); define('ICONV_ENABLE', function_exists('iconv')); define('MB_ENABLE', function_exists('mb_convert_encoding')); define('EXT_OBGZIP', function_exists('ob_gzhandler')); define('TIMESTAMP', time()); discuz_core::timezone_set(); if (!defined('DISCUZ_CORE_FUNCTION') && !@(include DISCUZ_ROOT . './source/function/function_core.php')) { $this->error('function_core.php is missing'); } define('IS_ROBOT', checkrobot()); foreach ($GLOBALS as $key => $value) { if (!isset($this->superglobal[$key])) { $GLOBALS[$key] = null; unset($GLOBALS[$key]); } } global $_G; $_G = array('uid' => 0, 'username' => '', 'adminid' => 0, 'groupid' => 1, 'sid' => '', 'formhash' => '', 'timestamp' => TIMESTAMP, 'starttime' => dmicrotime(), 'clientip' => $this->_get_client_ip(), 'referer' => '', 'charset' => '', 'gzipcompress' => '', 'authkey' => '', 'timenow' => array(), 'PHP_SELF' => '', 'siteurl' => '', 'siteroot' => '', 'config' => array(), 'setting' => array(), 'member' => array(), 'group' => array(), 'cookie' => array(), 'style' => array(), 'cache' => array(), 'session' => array(), 'lang' => array(), 'my_app' => array(), 'my_userapp' => array(), 'fid' => 0, 'tid' => 0, 'forum' => array(), 'rssauth' => '', 'home' => array(), 'space' => array(), 'block' => array(), 'article' => array(), 'action' => array('action' => APPTYPEID, 'fid' => 0, 'tid' => 0)); $_G['PHP_SELF'] = htmlspecialchars($_SERVER['SCRIPT_NAME'] ? $_SERVER['SCRIPT_NAME'] : $_SERVER['PHP_SELF']); $_G['basescript'] = CURSCRIPT; $_G['siteurl'] = htmlspecialchars('http://' . $_SERVER['HTTP_HOST'] . preg_replace("/\\/+(api)?\\/*\$/i", '', substr($_G['PHP_SELF'], 0, strrpos($_G['PHP_SELF'], '/'))) . '/'); $uri = $_SERVER['REQUEST_URI'] ? $_SERVER['REQUEST_URI'] : ($_SERVER['PHP_SELF'] ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME']); $_G['siteroot'] = substr($_G['PHP_SELF'], 0, -strlen(basename($_G['PHP_SELF']))); $this->var =& $_G; }
private function _init_env() { error_reporting(E_ERROR); if (PHP_VERSION < '5.3.0') { set_magic_quotes_runtime(0); } define('MAGIC_QUOTES_GPC', function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()); define('ICONV_ENABLE', function_exists('iconv')); define('MB_ENABLE', function_exists('mb_convert_encoding')); define('EXT_OBGZIP', function_exists('ob_gzhandler')); define('TIMESTAMP', time()); $this->timezone_set(); if (!defined('DZZ_CORE_FUNCTION') && !@(include DZZ_ROOT . './core/function/function_core.php')) { exit('function_core.php is missing'); } if (function_exists('ini_get')) { $memorylimit = @ini_get('memory_limit'); if ($memorylimit && return_bytes($memorylimit) < 33554432 && function_exists('ini_set')) { ini_set('memory_limit', '128m'); } } define('IS_ROBOT', checkrobot()); foreach ($GLOBALS as $key => $value) { if (!isset($this->superglobal[$key])) { $GLOBALS[$key] = null; unset($GLOBALS[$key]); } } global $_G; $_G = array('uid' => 0, 'username' => '', 'adminid' => 0, 'groupid' => 1, 'sid' => '', 'formhash' => '', 'connectguest' => 0, 'timestamp' => TIMESTAMP, 'starttime' => microtime(true), 'clientip' => $this->_get_client_ip(), 'referer' => '', 'charset' => '', 'gzipcompress' => '', 'authkey' => '', 'timenow' => array(), 'PHP_SELF' => '', 'siteurl' => '', 'siteroot' => '', 'siteport' => '', 'config' => array(), 'setting' => array(), 'member' => array(), 'group' => array(), 'cookie' => array(), 'style' => array(), 'cache' => array(), 'session' => array(), 'lang' => array(), 'rssauth' => ''); $_G['PHP_SELF'] = dhtmlspecialchars($this->_get_script_url()); $_G['basescript'] = CURSCRIPT . 'php'; $_G['basefilename'] = basename($_G['PHP_SELF']); $sitepath = substr($_G['PHP_SELF'], 0, strrpos($_G['PHP_SELF'], '/')); if (defined('IN_API')) { $sitepath = preg_replace("/\\/api\\/?.*?\$/i", '', $sitepath); } elseif (defined('IN_ARCHIVER')) { $sitepath = preg_replace("/\\/archiver/i", '', $sitepath); } $_G['isHTTPS'] = $_SERVER['HTTPS'] && strtolower($_SERVER['HTTPS']) != 'off' ? true : false; $_G['siteurl'] = dhtmlspecialchars('http' . ($_G['isHTTPS'] ? 's' : '') . '://' . $_SERVER['HTTP_HOST'] . $sitepath . '/'); $url = parse_url($_G['siteurl']); $_G['siteroot'] = isset($url['path']) ? $url['path'] : ''; $_G['siteport'] = empty($_SERVER['SERVER_PORT']) || $_SERVER['SERVER_PORT'] == '80' || $_SERVER['SERVER_PORT'] == '443' ? '' : ':' . $_SERVER['SERVER_PORT']; if (defined('SUB_DIR')) { $_G['siteurl'] = str_replace(SUB_DIR, '/', $_G['siteurl']); $_G['siteroot'] = str_replace(SUB_DIR, '/', $_G['siteroot']); } $_G['browser'] = helper_browser::getbrowser(); $_G['platform'] = helper_browser::getplatform(); $this->var =& $_G; }
private function _init_env() { error_reporting(E_ERROR); if (PHP_VERSION < '5.3.0') { set_magic_quotes_runtime(0); } define('MAGIC_QUOTES_GPC', function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()); define('ICONV_ENABLE', function_exists('iconv')); define('MB_ENABLE', function_exists('mb_convert_encoding')); define('EXT_OBGZIP', function_exists('ob_gzhandler')); define('TIMESTAMP', time()); $this->timezone_set(); if (!defined('DISCUZ_CORE_FUNCTION') && !@(include DISCUZ_ROOT . './source/function/function_core.php')) { exit('function_core.php is missing'); } if (function_exists('ini_get')) { $memorylimit = @ini_get('memory_limit'); if ($memorylimit && return_bytes($memorylimit) < 33554432 && function_exists('ini_set')) { ini_set('memory_limit', '128m'); } } define('IS_ROBOT', checkrobot()); foreach ($GLOBALS as $key => $value) { if (!isset($this->superglobal[$key])) { $GLOBALS[$key] = null; unset($GLOBALS[$key]); } } global $_G; $_G = array('uid' => 0, 'username' => '', 'adminid' => 0, 'groupid' => 1, 'sid' => '', 'formhash' => '', 'connectguest' => 0, 'timestamp' => TIMESTAMP, 'starttime' => microtime(true), 'clientip' => $this->_get_client_ip(), 'remoteport' => $_SERVER['REMOTE_PORT'], 'referer' => '', 'charset' => '', 'gzipcompress' => '', 'authkey' => '', 'timenow' => array(), 'widthauto' => 0, 'disabledwidthauto' => 0, 'PHP_SELF' => '', 'siteurl' => '', 'siteroot' => '', 'siteport' => '', 'pluginrunlist' => !defined('PLUGINRUNLIST') ? array() : explode(',', PLUGINRUNLIST), 'config' => array(), 'setting' => array(), 'member' => array(), 'group' => array(), 'cookie' => array(), 'style' => array(), 'cache' => array(), 'session' => array(), 'lang' => array(), 'my_app' => array(), 'my_userapp' => array(), 'fid' => 0, 'tid' => 0, 'forum' => array(), 'thread' => array(), 'rssauth' => '', 'home' => array(), 'space' => array(), 'block' => array(), 'article' => array(), 'action' => array('action' => APPTYPEID, 'fid' => 0, 'tid' => 0), 'mobile' => '', 'notice_structure' => array('mypost' => array('post', 'pcomment', 'activity', 'reward', 'goods', 'at'), 'interactive' => array('poke', 'friend', 'wall', 'comment', 'click', 'sharenotice'), 'system' => array('system', 'myapp', 'credit', 'group', 'verify', 'magic', 'task', 'show', 'group', 'pusearticle', 'mod_member', 'blog', 'article'), 'manage' => array('mod_member', 'report', 'pmreport'), 'app' => array()), 'mobiletpl' => array('1' => 'mobile', '2' => 'touch', '3' => 'wml', 'yes' => 'mobile')); $_G['PHP_SELF'] = dhtmlspecialchars($this->_get_script_url()); $_G['basescript'] = CURSCRIPT; $_G['basefilename'] = basename($_G['PHP_SELF']); $sitepath = substr($_G['PHP_SELF'], 0, strrpos($_G['PHP_SELF'], '/')); if (defined('IN_API')) { $sitepath = preg_replace("/\\/api\\/?.*?\$/i", '', $sitepath); } elseif (defined('IN_ARCHIVER')) { $sitepath = preg_replace("/\\/archiver/i", '', $sitepath); } $_G['isHTTPS'] = $_SERVER['HTTPS'] && strtolower($_SERVER['HTTPS']) != 'off' ? true : false; $_G['siteurl'] = dhtmlspecialchars('http' . ($_G['isHTTPS'] ? 's' : '') . '://' . $_SERVER['HTTP_HOST'] . $sitepath . '/'); $url = parse_url($_G['siteurl']); $_G['siteroot'] = isset($url['path']) ? $url['path'] : ''; $_G['siteport'] = empty($_SERVER['SERVER_PORT']) || $_SERVER['SERVER_PORT'] == '80' || $_SERVER['SERVER_PORT'] == '443' ? '' : ':' . $_SERVER['SERVER_PORT']; if (defined('SUB_DIR')) { $_G['siteurl'] = str_replace(SUB_DIR, '/', $_G['siteurl']); $_G['siteroot'] = str_replace(SUB_DIR, '/', $_G['siteroot']); } $this->var =& $_G; }
static function init($init = true) { if (is_file(ROOT_PATH . 'index.html')) { echo file_get_contents(ROOT_PATH . 'index.html'); exit; } $method = strtolower($_SERVER['REQUEST_METHOD']); if ($method != 'get' && $method != 'post') { exit; } define('CHARSET', 'UTF-8'); define('TIMESTAMP', time()); define('URL', '/' . CURSCRIPT . '.php?'); include ROOT_PATH . 'inc/class/app.class.php'; include_once ROOT_PATH . 'inc/function/core.function.php'; include_once ROOT_PATH . 'inc/function/extends.function.php'; include_once ROOT_PATH . 'inc/function/tae.function.php'; self::_init_tae(); self::_init_rewrite(); define('DEBUG', $_GET['debug'] ? true : false); set_error_handler('error_handler'); _xss_check(); if ($_SERVER['REQUEST_METHOD'] == 'POST' && !empty($_POST)) { foreach ($_POST as $k => $v) { if (!isset($_GET[$k])) { $_GET[$k] = $v; } } } foreach ($_GET as $k => $v) { $k1 = trim_html($k, 1); $v1 = safe_filter($v); $_GET[$k1] = $v1; } define('ROBOT', checkrobot()); if ($init) { ob_start(); self::_init_global(); self::_init_web(); self::_init_db(); self::_init_cache(); self::_init_mobile(); self::_init_tpl(); self::_init_user(); } }