⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 config.class.php

📁 架設ROSE私服必備之物 ROSE數據庫
💻 PHP
📖 第 1 页 / 共 3 页
字号:
<?php/* $Id: Config.class.php 9717 2006-11-17 10:05:59Z nijel $ */// vim: expandtab sw=4 ts=4 sts=4:/** * Configuration class * */class PMA_Config{    /**     * @var string  default config source     */    var $default_source = './libraries/config.default.php';    /**     * @var array   configuration settings     */    var $settings = array();    /**     * @var string  config source     */    var $source = '';    /**     * @var int     source modification time     */    var $source_mtime = 0;    var $default_source_mtime = 0;    /**     * @var boolean     */    var $error_config_file = false;    /**     * @var boolean     */    var $error_config_default_file = false;    /**     * @var boolean     */    var $error_pma_uri = false;    /**     * @var array     */    var $default_server = array();    /**     * @var boolean wether init is done or mot     * set this to false to force some initial checks     * like checking for required functions     */    var $done = false;    /**     * constructor     *     * @param   string  source to read config from     */    function __construct($source = null)    {        $this->settings = array();        // functions need to refresh in case of config file changed goes in        // PMA_Config::load()        $this->load($source);        // other settings, independant from config file, comes in        $this->checkSystem();        $this->checkIsHttps();    }    /**     * sets system and application settings     */    function checkSystem()    {        $this->set('PMA_VERSION', '2.9.1.1');        /**         * @deprecated         */        $this->set('PMA_THEME_VERSION', 2);        /**         * @deprecated         */        $this->set('PMA_THEME_GENERATION', 2);        $this->checkPhpVersion();        $this->checkWebServerOs();        $this->checkWebServer();        $this->checkGd2();        $this->checkClient();        $this->checkUpload();        $this->checkUploadSize();        $this->checkOutputCompression();    }    /**     * wether to use gzip output compression or not     */    function checkOutputCompression()    {        // If zlib output compression is set in the php configuration file, no        // output buffering should be run        if (@ini_get('zlib.output_compression')) {            $this->set('OBGzip', false);        }        // disable output-buffering (if set to 'auto') for IE6, else enable it.        if (strtolower($this->get('OBGzip')) == 'auto') {            if ($this->get('PMA_USR_BROWSER_AGENT') == 'IE'              && $this->get('PMA_USR_BROWSER_VER') >= 6              && $this->get('PMA_USR_BROWSER_VER') < 7) {                $this->set('OBGzip', false);            } else {                $this->set('OBGzip', true);            }        }    }    /**     * Determines platform (OS), browser and version of the user     * Based on a phpBuilder article:     * @see http://www.phpbuilder.net/columns/tim20000821.php     */    function checkClient()    {        if (PMA_getenv('HTTP_USER_AGENT')) {            $HTTP_USER_AGENT = PMA_getenv('HTTP_USER_AGENT');        } elseif (!isset($HTTP_USER_AGENT)) {            $HTTP_USER_AGENT = '';        }        // 1. Platform        if (strstr($HTTP_USER_AGENT, 'Win')) {            $this->set('PMA_USR_OS', 'Win');        } elseif (strstr($HTTP_USER_AGENT, 'Mac')) {            $this->set('PMA_USR_OS', 'Mac');        } elseif (strstr($HTTP_USER_AGENT, 'Linux')) {            $this->set('PMA_USR_OS', 'Linux');        } elseif (strstr($HTTP_USER_AGENT, 'Unix')) {            $this->set('PMA_USR_OS', 'Unix');        } elseif (strstr($HTTP_USER_AGENT, 'OS/2')) {            $this->set('PMA_USR_OS', 'OS/2');        } else {            $this->set('PMA_USR_OS', 'Other');        }        // 2. browser and version        // (must check everything else before Mozilla)        if (preg_match('@Opera(/| )([0-9].[0-9]{1,2})@', $HTTP_USER_AGENT, $log_version)) {            $this->set('PMA_USR_BROWSER_VER', $log_version[2]);            $this->set('PMA_USR_BROWSER_AGENT', 'OPERA');        } elseif (preg_match('@MSIE ([0-9].[0-9]{1,2})@', $HTTP_USER_AGENT, $log_version)) {            $this->set('PMA_USR_BROWSER_VER', $log_version[1]);            $this->set('PMA_USR_BROWSER_AGENT', 'IE');        } elseif (preg_match('@OmniWeb/([0-9].[0-9]{1,2})@', $HTTP_USER_AGENT, $log_version)) {            $this->set('PMA_USR_BROWSER_VER', $log_version[1]);            $this->set('PMA_USR_BROWSER_AGENT', 'OMNIWEB');        //} elseif (ereg('Konqueror/([0-9].[0-9]{1,2})', $HTTP_USER_AGENT, $log_version)) {        // Konqueror 2.2.2 says Konqueror/2.2.2        // Konqueror 3.0.3 says Konqueror/3        } elseif (preg_match('@(Konqueror/)(.*)(;)@', $HTTP_USER_AGENT, $log_version)) {            $this->set('PMA_USR_BROWSER_VER', $log_version[2]);            $this->set('PMA_USR_BROWSER_AGENT', 'KONQUEROR');        } elseif (preg_match('@Mozilla/([0-9].[0-9]{1,2})@', $HTTP_USER_AGENT, $log_version)                   && preg_match('@Safari/([0-9]*)@', $HTTP_USER_AGENT, $log_version2)) {            $this->set('PMA_USR_BROWSER_VER', $log_version[1] . '.' . $log_version2[1]);            $this->set('PMA_USR_BROWSER_AGENT', 'SAFARI');        } elseif (preg_match('@Mozilla/([0-9].[0-9]{1,2})@', $HTTP_USER_AGENT, $log_version)) {            $this->set('PMA_USR_BROWSER_VER', $log_version[1]);            $this->set('PMA_USR_BROWSER_AGENT', 'MOZILLA');        } else {            $this->set('PMA_USR_BROWSER_VER', 0);            $this->set('PMA_USR_BROWSER_AGENT', 'OTHER');        }    }    /**     * Whether GD2 is present     */    function checkGd2()    {        if ($this->get('GD2Available') == 'yes') {            $this->set('PMA_IS_GD2', 1);        } elseif ($this->get('GD2Available') == 'no') {            $this->set('PMA_IS_GD2', 0);        } else {            if (!@extension_loaded('gd')) {                PMA_dl('gd');            }            if (!@function_exists('imagecreatetruecolor')) {                $this->set('PMA_IS_GD2', 0);            } else {                if (@function_exists('gd_info')) {                    $gd_nfo = gd_info();                    if (strstr($gd_nfo["GD Version"], '2.')) {                        $this->set('PMA_IS_GD2', 1);                    } else {                        $this->set('PMA_IS_GD2', 0);                    }                } else {                    /* We must do hard way... */                    ob_start();                    phpinfo(INFO_MODULES); /* Only modules */                    $a = strip_tags(ob_get_contents());                    ob_end_clean();                    /* Get GD version string from phpinfo output */                    if (preg_match('@GD Version[[:space:]]*\(.*\)@', $a, $v)) {                        if (strstr($v, '2.')) {                            $this->set('PMA_IS_GD2', 1);                        } else {                            $this->set('PMA_IS_GD2', 0);                        }                    } else {                        $this->set('PMA_IS_GD2', 0);                    }                }            }        }    }    /**     * Whether the Web server php is running on is IIS     */    function checkWebServer()    {        if (PMA_getenv('SERVER_SOFTWARE')          // some versions return Microsoft-IIS, some Microsoft/IIS          // we could use a preg_match() but it's slower          && stristr(PMA_getenv('SERVER_SOFTWARE'), 'Microsoft')          && stristr(PMA_getenv('SERVER_SOFTWARE'), 'IIS')) {            $this->set('PMA_IS_IIS', 1);        } else {            $this->set('PMA_IS_IIS', 0);        }    }    /**     * Whether the os php is running on is windows or not     */    function checkWebServerOs()    {        // Default to Unix or Equiv        $this->set('PMA_IS_WINDOWS', 0);        // If PHP_OS is defined then continue        if (defined('PHP_OS')) {            if (stristr(PHP_OS, 'win') ) {                // Is it some version of Windows                $this->set('PMA_IS_WINDOWS', 1);            } elseif (stristr(PHP_OS, 'OS/2')) {                // Is it OS/2 (No file permissions like Windows)                $this->set('PMA_IS_WINDOWS', 1);            }        }    }    /**     * detects PHP version     */    function checkPhpVersion()    {        $match = array();        if (! preg_match('@([0-9]{1,2}).([0-9]{1,2}).([0-9]{1,2})@',                phpversion(), $match)) {            $result = preg_match('@([0-9]{1,2}).([0-9]{1,2})@',                phpversion(), $match);        }        if (isset($match) && ! empty($match[1])) {            if (! isset($match[2])) {                $match[2] = 0;            }            if (! isset($match[3])) {                $match[3] = 0;            }            $this->set('PMA_PHP_INT_VERSION',                (int) sprintf('%d%02d%02d', $match[1], $match[2], $match[3]));        } else {            $this->set('PMA_PHP_INT_VERSION', 0);        }        $this->set('PMA_PHP_STR_VERSION', phpversion());    }    /**     * re-init object after loading from session file     * checks config file for changes and relaods if neccessary     */    function __wakeup()    {        if (! $this->checkConfigSource()          || $this->source_mtime !== filemtime($this->getSource())          || $this->default_source_mtime !== filemtime($this->default_source)          || $this->error_config_file          || $this->error_config_default_file) {            $this->settings = array();            $this->load();            $this->checkSystem();        }        // check for https needs to be done everytime,        // as https and http uses same session so this info can not be stored        // in session        $this->checkIsHttps();        $this->checkCollationConnection();        $this->checkFontsize();    }    /**     * loads default values from default source     *     * @uses    file_exists()     * @uses    $this->default_source     * @uses    $this->error_config_default_file     * @uses    $this->settings     * @return  boolean     success     */    function loadDefaults()    {        $cfg = array();        if (! file_exists($this->default_source)) {            $this->error_config_default_file = true;            return false;        }        include $this->default_source;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -