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

📄 config.class.php

📁 WEBGAME源码,有架设说明,只是非常简单
💻 PHP
📖 第 1 页 / 共 3 页
字号:
                    . $pma_absolute_uri;            }        }        $this->set('PmaAbsoluteUri', $pma_absolute_uri);    }    /**     * check selected collation_connection     * @todo check validity of $_REQUEST['collation_connection']     */    function checkCollationConnection()    {        // (could be improved by executing it after the MySQL connection only if        //  PMA_MYSQL_INT_VERSION >= 40100)        if (! empty($_REQUEST['collation_connection'])) {            $this->set('collation_connection',                strip_tags($_REQUEST['collation_connection']));        }    }    /**     * checks for font size configuration, and sets font size as requested by user     *     * @uses    $_GET     * @uses    $_POST     * @uses    $_COOKIE     * @uses    preg_match()     * @uses    function_exists()     * @uses    PMA_Config::set()     * @uses    PMA_Config::get()     * @uses    PMA_setCookie()     */    function checkFontsize()    {        $new_fontsize = '';        if (isset($_GET['fontsize'])) {            $new_fontsize = $_GET['fontsize'];        } elseif (isset($_POST['fontsize'])) {            $new_fontsize = $_POST['fontsize'];        } elseif (isset($_COOKIE['pma_fontsize'])) {            $new_fontsize = $_COOKIE['pma_fontsize'];        }        if (preg_match('/^[0-9.]+(px|em|pt|\%)$/', $new_fontsize)) {            $this->set('fontsize', $new_fontsize);        } elseif (! $this->get('fontsize')) {            $this->set('fontsize', '100%');        }        if (function_exists('PMA_setCookie')) {            PMA_setCookie('pma_fontsize', $this->get('fontsize'), '100%');        }    }    /**     * checks if upload is enabled     *     */    function checkUpload()    {        $this->set('enable_upload', true);        if (strtolower(@ini_get('file_uploads')) == 'off'          || @ini_get('file_uploads') == 0) {            $this->set('enable_upload', false);        }    }    /**     * Maximum upload size as limited by PHP     * Used with permission from Moodle (http://moodle.org) by Martin Dougiamas     *     * this section generates $max_upload_size in bytes     */    function checkUploadSize()    {        if (! $filesize = ini_get('upload_max_filesize')) {            $filesize = "5M";        }        if ($postsize = ini_get('post_max_size')) {            $this->set('max_upload_size',                min(PMA_get_real_size($filesize), PMA_get_real_size($postsize)));        } else {            $this->set('max_upload_size', PMA_get_real_size($filesize));        }    }    /**     * check for https     */    function checkIsHttps()    {        $this->set('is_https', PMA_Config::isHttps());    }    /**     * @static     */    function isHttps()    {        $is_https = false;        $url = array();        // At first we try to parse REQUEST_URI, it might contain full URL,        if (PMA_getenv('REQUEST_URI')) {            $url = @parse_url(PMA_getenv('REQUEST_URI')); // produces E_WARNING if it cannot get parsed, e.g. '/foobar:/'            if($url === false) {                $url = array();            }        }        // If we don't have scheme, we didn't have full URL so we need to        // dig deeper        if (empty($url['scheme'])) {            // Scheme            if (PMA_getenv('HTTP_SCHEME')) {                $url['scheme'] = PMA_getenv('HTTP_SCHEME');            } else {                $url['scheme'] =                    PMA_getenv('HTTPS') && strtolower(PMA_getenv('HTTPS')) != 'off'                        ? 'https'                        : 'http';            }        }        if (isset($url['scheme'])          && $url['scheme'] == 'https') {            $is_https = true;        } else {            $is_https = false;        }        return $is_https;    }    /**     * detect correct cookie path     */    function checkCookiePath()    {        $this->set('cookie_path', PMA_Config::getCookiePath());    }    /**     * @static     */    function getCookiePath()    {        static $cookie_path = null;        if (null !== $cookie_path) {            return $cookie_path;        }        $url = '';        if (PMA_getenv('REQUEST_URI')) {            $url = PMA_getenv('REQUEST_URI');        }        // If we don't have path        if (empty($url)) {            if (PMA_getenv('PATH_INFO')) {                $url = PMA_getenv('PATH_INFO');            } elseif (PMA_getenv('PHP_SELF')) {                // PHP_SELF in CGI often points to cgi executable, so use it                // as last choice                $url = PMA_getenv('PHP_SELF');            } elseif (PMA_getenv('SCRIPT_NAME')) {                $url = PMA_getenv('PHP_SELF');            }        }        $parsed_url = @parse_url($_SERVER['REQUEST_URI']); // produces E_WARNING if it cannot get parsed, e.g. '/foobar:/'        if ($parsed_url === false) {            $parsed_url = array('path' => $url);        }        $cookie_path   = substr($parsed_url['path'], 0, strrpos($parsed_url['path'], '/'))  . '/';        return $cookie_path;    }    /**     * enables backward compatibility     */    function enableBc()    {        $GLOBALS['cfg']             =& $this->settings;        $GLOBALS['default_server']  =& $this->default_server;        $GLOBALS['collation_connection'] = $this->get('collation_connection');        $GLOBALS['is_upload']       = $this->get('enable_upload');        $GLOBALS['max_upload_size'] = $this->get('max_upload_size');        $GLOBALS['cookie_path']     = $this->get('cookie_path');        $GLOBALS['is_https']        = $this->get('is_https');        $defines = array(            'PMA_VERSION',            'PMA_THEME_VERSION',            'PMA_THEME_GENERATION',            'PMA_PHP_STR_VERSION',            'PMA_PHP_INT_VERSION',            'PMA_IS_WINDOWS',            'PMA_IS_IIS',            'PMA_IS_GD2',            'PMA_USR_OS',            'PMA_USR_BROWSER_VER',            'PMA_USR_BROWSER_AGENT',            );        foreach ($defines as $define) {            if (! defined($define)) {                define($define, $this->get($define));            }        }    }    /**     * @todo finish     */    function save() {}    /**     * returns options for font size selection     *     * @uses    preg_replace()     * @uses    ksort()     * @static     * @param   string  $current_size   current selected font size with unit     * @return  array   selectable font sizes     */    function getFontsizeOptions($current_size = '100%')    {        $unit = preg_replace('/[0-9.]*/', '', $current_size);        $value = preg_replace('/[^0-9.]*/', '', $current_size);        $factors = array();        $options = array();        $options["$value"] = $value . $unit;        if ($unit === '%') {            $factors[] = 1;            $factors[] = 5;            $factors[] = 10;        } elseif ($unit === 'em') {            $factors[] = 0.05;            $factors[] = 0.2;            $factors[] = 1;        } elseif ($unit === 'pt') {            $factors[] = 0.5;            $factors[] = 2;        } elseif ($unit === 'px') {            $factors[] = 1;            $factors[] = 5;            $factors[] = 10;        } else {            //unknown font size unit            $factors[] = 0.05;            $factors[] = 0.2;            $factors[] = 1;            $factors[] = 5;            $factors[] = 10;        }        foreach ($factors as $key => $factor) {            $option_inc = $value + $factor;            $option_dec = $value - $factor;            while (count($options) < 21) {                $options["$option_inc"] = $option_inc . $unit;                if ($option_dec > $factors[0]) {                    $options["$option_dec"] = $option_dec . $unit;                }                $option_inc += $factor;                $option_dec -= $factor;                if (isset($factors[$key + 1])                 && $option_inc >= $value + $factors[$key + 1]) {                    break;                }            }        }        ksort($options);        return $options;    }    /**     * returns html selectbox for font sizes     *     * @uses    $_SESSION['PMA_Config']     * @uses    PMA_Config::get()     * @uses    PMA_Config::getFontsizeOptions()     * @uses    $GLOBALS['strFontSize']     * @static     * @param   string  $current_size   currently slected font size with unit     * @return  string  html selectbox     */    function getFontsizeSelection()    {        $current_size = $_SESSION['PMA_Config']->get('fontsize');        $options = PMA_Config::getFontsizeOptions($current_size);        $return = '<label for="select_fontsize">' . $GLOBALS['strFontSize'] . ':</label>' . "\n";        $return .= '<select name="fontsize" id="select_fontsize" onchange="this.form.submit();">' . "\n";        foreach ($options as $option) {            $return .= '<option value="' . $option . '"';            if ($option == $current_size) {                $return .= ' selected="selected"';            }            $return .= '>' . $option . '</option>' . "\n";        }        $return .= '</select>';        return $return;    }    /**     * return complete font size selection form     *     * @uses    PMA_generate_common_hidden_inputs()     * @uses    PMA_Config::getFontsizeSelection()     * @uses    $GLOBALS['strGo']     * @static     * @param   string  $current_size   currently slected font size with unit     * @return  string  html selectbox     */    function getFontsizeForm()    {        return '<form name="form_fontsize_selection" id="form_fontsize_selection"'            . ' method="post" action="index.php" target="_parent">' . "\n"            . PMA_generate_common_hidden_inputs() . "\n"            . PMA_Config::getFontsizeSelection() . "\n"            . '<noscript>' . "\n"            . '<input type="submit" value="' . $GLOBALS['strGo'] . '" />' . "\n"            . '</noscript>' . "\n"            . '</form>';    }}?>

⌨️ 快捷键说明

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