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

📄 common.lib.php

📁 WEBGAME源码,有架设说明,只是非常简单
💻 PHP
📖 第 1 页 / 共 5 页
字号:
                            $uva_mydbs[$uva_db] = 0;                        } else if (!isset($dblist[$uva_db])) {                            foreach ($uva_mydbs AS $uva_matchpattern => $uva_value) {                                // loic1: fixed bad regexp                                // TODO: db names may contain characters                                //       that are regexp instructions                                $re        = '(^|(\\\\\\\\)+|[^\])';                                $uva_regex = ereg_replace($re . '%', '\\1.*', ereg_replace($re . '_', '\\1.{1}', $uva_matchpattern));                                // Fixed db name matching                                // 2000-08-28 -- Benjamin Gandon                                if (ereg('^' . $uva_regex . '$', $uva_db)) {                                    $dblist[] = $uva_db;                                    break;                                }                            } // end while                        } // end if ... else if....                    } // end while                } // end else                PMA_DBI_free_result($uva_alldbs);                unset($uva_mydbs);            } // end if            // 2. get allowed dbs from the "mysql.tables_priv" table            $local_query = 'SELECT DISTINCT Db FROM mysql.tables_priv WHERE Table_priv LIKE \'%Select%\' AND User = \'' . PMA_sqlAddslashes($cfg['Server']['user']) . '\'';            $rs          = PMA_DBI_try_query($local_query, $dbh);            if ($rs && @PMA_DBI_num_rows($rs)) {                while ($row = PMA_DBI_fetch_assoc($rs)) {                    if (PMA_isInto($row['Db'], $dblist) == -1) {                        $dblist[] = $row['Db'];                    }                } // end while                PMA_DBI_free_result($rs);            } // end if        } // end if    } // end building available dbs from the "mysql" db    return $dblist;}/** * Determines the font sizes to use depending on the os and browser of the * user. * * This function is based on an article from phpBuilder (see * http://www.phpbuilder.net/columns/tim20000821.php). * * @return  boolean    always true * * @global  string     the standard font size * @global  string     the font size for titles * @global  string     the small font size * @global  string     the smallest font size * * @access  public * * @version 1.1 */function PMA_setFontSizes(){    global $font_size, $font_biggest, $font_bigger, $font_smaller, $font_smallest;    // IE (<7)/Opera (<7) for win case: needs smaller fonts than anyone else    if (PMA_USR_OS == 'Win'        && ((PMA_USR_BROWSER_AGENT == 'IE' && PMA_USR_BROWSER_VER < 7)        || (PMA_USR_BROWSER_AGENT == 'OPERA' && PMA_USR_BROWSER_VER < 7))) {        $font_size     = 'x-small';        $font_biggest  = 'large';        $font_bigger   = 'medium';        $font_smaller  = '90%';        $font_smallest = '7pt';    }    // IE6 and other browsers for win case    else if (PMA_USR_OS == 'Win') {        $font_size     = 'small';        $font_biggest  = 'large';        $font_bigger   = 'medium';        $font_smaller  = (PMA_USR_BROWSER_AGENT == 'IE')                        ? '90%'                        : 'x-small';        $font_smallest = 'x-small';    }    // Some mac browsers need also smaller default fonts size (OmniWeb &    // Opera)...    // and a beta version of Safari did also, but not the final 1.0 version    // so I remove   || PMA_USR_BROWSER_AGENT == 'SAFARI'    // but we got a report that Safari 1.0 build 85.5 needs it!    else if (PMA_USR_OS == 'Mac'                && (PMA_USR_BROWSER_AGENT == 'OMNIWEB' || PMA_USR_BROWSER_AGENT == 'OPERA' || PMA_USR_BROWSER_AGENT == 'SAFARI')) {        $font_size     = 'x-small';        $font_biggest  = 'large';        $font_bigger   = 'medium';        $font_smaller  = '90%';        $font_smallest = '7pt';    }    // ... but most of them (except IE 5+ & NS 6+) need bigger fonts    else if ((PMA_USR_OS == 'Mac'                && ((PMA_USR_BROWSER_AGENT != 'IE' && PMA_USR_BROWSER_AGENT != 'MOZILLA')                    || PMA_USR_BROWSER_VER < 5))            || PMA_USR_BROWSER_AGENT == 'KONQUEROR'            || PMA_USR_BROWSER_AGENT == 'MOZILLA') {        $font_size     = 'medium';        $font_biggest  = 'x-large';        $font_bigger   = 'large';        $font_smaller  = 'small';        $font_smallest = 'x-small';    }    // OS/2 browser    else if (PMA_USR_OS == 'OS/2'                && PMA_USR_BROWSER_AGENT == 'OPERA') {        $font_size     = 'small';        $font_biggest  = 'medium';        $font_bigger   = 'medium';        $font_smaller  = 'x-small';        $font_smallest = 'x-small';    }    else {        $font_size     = 'small';        $font_biggest  = 'large';        $font_bigger   = 'medium';        $font_smaller  = 'x-small';        $font_smallest = 'x-small';    }    return TRUE;} // end of the 'PMA_setFontSizes()' functionif ( ! defined( 'PMA_MINIMUM_COMMON' ) ) {    /**     * $cfg['PmaAbsoluteUri'] is a required directive else cookies won't be     * set properly and, depending on browsers, inserting or updating a     * record might fail     */    // Setup a default value to let the people and lazy syadmins work anyway,    // they'll get an error if the autodetect code doesn't work    if (empty($cfg['PmaAbsoluteUri'])) {        $url = array();        // At first we try to parse REQUEST_URI, it might contain full URI        if (!empty($_SERVER['REQUEST_URI'])) {            $url = parse_url($_SERVER['REQUEST_URI']);        }        // If we don't have scheme, we didn't have full URL so we need to dig deeper        if (empty($url['scheme'])) {            // Scheme            if (!empty($_SERVER['HTTP_SCHEME'])) {                $url['scheme'] = $_SERVER['HTTP_SCHEME'];            } else {                $url['scheme'] = (!empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) != 'off') ? 'https' : 'http';            }            // Host and port            if (!empty($_SERVER['HTTP_HOST'])) {                if (strpos($_SERVER['HTTP_HOST'], ':') > 0) {                    list($url['host'], $url['port']) = explode(':', $_SERVER['HTTP_HOST']);                } else {                    $url['host'] = $_SERVER['HTTP_HOST'];                }            } else if (!empty($_SERVER['SERVER_NAME'])) {                $url['host'] = $_SERVER['SERVER_NAME'];            } else {                // Displays the error message                header( 'Location: error.php'                        . '?lang='  . urlencode( $available_languages[$lang][2] )                        . '&char='  . urlencode( $charset )                        . '&dir='   . urlencode( $text_dir )                        . '&type='  . urlencode( $strError )                        . '&error=' . urlencode(                            strtr( $strPmaUriError,                                array( '<tt>' => '[tt]', '</tt>' => '[/tt]' ) ) )                        . '&' . SID                         );                exit();            }            // If we didn't set port yet...            if (empty($url['port']) && !empty($_SERVER['SERVER_PORT'])) {                $url['port'] = $_SERVER['SERVER_PORT'];            }            // And finally the path could be already set from REQUEST_URI            if (empty($url['path'])) {                if (!empty($_SERVER['PATH_INFO'])) {                    $path = parse_url($_SERVER['PATH_INFO']);                } else {                    // PHP_SELF in CGI often points to cgi executable, so use it as last choice                    $path = parse_url($_SERVER['PHP_SELF']);                }                $url['path'] = $path['path'];                unset($path);            }        }        // Make url from parts we have        $cfg['PmaAbsoluteUri'] = $url['scheme'] . '://';        // Was there user information?        if (!empty($url['user'])) {            $cfg['PmaAbsoluteUri'] .= $url['user'];            if (!empty($url['pass'])) {                $cfg['PmaAbsoluteUri'] .= ':' . $url['pass'];            }            $cfg['PmaAbsoluteUri'] .= '@';        }        // Add hostname        $cfg['PmaAbsoluteUri'] .= $url['host'];        // Add port, if it not the default one        if (!empty($url['port']) && (($url['scheme'] == 'http' && $url['port'] != 80) || ($url['scheme'] == 'https' && $url['port'] != 443))) {            $cfg['PmaAbsoluteUri'] .= ':' . $url['port'];        }        // And finally path, without script name, the 'a' is there not to        // strip our directory, when path is only /pmadir/ without filename        $path = dirname($url['path'] . 'a');        // To work correctly within transformations overview:        if (defined('PMA_PATH_TO_BASEDIR') && PMA_PATH_TO_BASEDIR == '../../') {            $path = dirname(dirname($path));        }        $cfg['PmaAbsoluteUri'] .= $path . '/';        unset($url);        // We used to display a warning if PmaAbsoluteUri wasn't set, but now        // the autodetect code works well enough that we don't display the        // warning at all. The user can still set PmaAbsoluteUri manually.        // See https://sourceforge.net/tracker/index.php?func=detail&aid=1257134&group_id=23067&atid=377411    } else {        // The URI is specified, however users do often specify this        // wrongly, so we try to fix this.        // Adds a trailing slash et the end of the phpMyAdmin uri if it        // does not exist.        if (substr($cfg['PmaAbsoluteUri'], -1) != '/') {            $cfg['PmaAbsoluteUri'] .= '/';        }        // If URI doesn't start with http:// or https://, we will add        // this.        if (substr($cfg['PmaAbsoluteUri'], 0, 7) != 'http://' && substr($cfg['PmaAbsoluteUri'], 0, 8) != 'https://') {            $cfg['PmaAbsoluteUri']          = ((!empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) != 'off') ? 'https' : 'http') . ':'                                            . (substr($cfg['PmaAbsoluteUri'], 0, 2) == '//' ? '' : '//')                                            . $cfg['PmaAbsoluteUri'];        }    }    // some variables used mostly for cookies:    $pma_uri_parts = parse_url($cfg['PmaAbsoluteUri']);    $cookie_path   = substr($pma_uri_parts['path'], 0, strrpos($pma_uri_parts['path'], '/')) . '/';    $is_https      = (isset($pma_uri_parts['scheme']) && $pma_uri_parts['scheme'] == 'https') ? 1 : 0;    //    if ($cfg['ForceSLL'] && !$is_https) {        header(            'Location: ' . preg_replace(                '/^http/', 'https', $cfg['PmaAbsoluteUri'] )            . ( isset( $_SERVER['REQUEST_URI'] )                ? preg_replace( '@' . $pma_uri_parts['path'] . '@',                    '', $_SERVER['REQUEST_URI'] )                : '' )            . '&' . SID );        exit;    }    $dblist       = array();    /**     * Gets the valid servers list and parameters     */    foreach ($cfg['Servers'] AS $key => $val) {        // Don't use servers with no hostname        if ( isset($val['connect_type']) && ($val['connect_type'] == 'tcp') && empty($val['host'])) {            unset($cfg['Servers'][$key]);        }        // Final solution to bug #582890        // If we are using a socket connection        // and there is nothing in the verbose server name        // or the host field, then generate a name for the server        // in the form of "Server 2", localized of course!        if ( isset($val['connect_type']) && $val['connect_type'] == 'socket' && empty($val['host']) && empty($val['verbose']) ) {            $cfg['Servers'][$key]['verbose'] = $GLOBALS['strServer'] . $key;            $val['verbose']                  = $GLOBALS['strServer'] . $key;        }    }    unset( $key, $val );    if (empty($server) || !isset($cfg['Servers'][$server]) || !is_array($cfg['Servers'][$server])) {        $server = $cfg['ServerDefault'];    }    /**     * If no server is selected, make sure that $cfg['Server'] is empty (so     * that nothing will work), and skip server authentication.     * We do NOT exit here, but continue on without logging into any server.     * This way, the welcome page will still come up (with no server info) and     * present a choice of servers in the case that there are multiple servers     * and '$cfg['ServerDefault'] = 0' is set.     */    if ($server == 0) {        $cfg['Server'] = array();    }    /**     * Otherwise, set up $cfg['Server'] and do the usual login stuff.     */    else if (isset($cfg['Servers'][$server])) {        $cfg['Server'] = $cfg['Servers'][$server];        /**         * Loads the proper database interface for this server         */        require_once('./libraries/database_interface.lib.php');        // Gets the authentication library that fits the $cfg['Server'] settings        // and run authentication        // (for a quick check of path disclosure in auth/cookies:)        $coming_from_common = TRUE;        if (!file_exists('./libraries/auth/' . $cfg['Server']['auth_type'] . '.auth.lib.php')) {            header( 'Location: error.php'                    . '?lang='  . urlencode( $available_languages[$lang][2] )                    . '&char='  . urlencode( $charset )                    . '&dir='   . urlencode( $text_dir )                    . '&type='  . urlencode( $strError )                    . '&error=' . urlencode(                        $strInvalidAuthMethod . ' '                        . $cfg['Server']['auth_type'] )                    . '&' . SID                     );            exit();        }        require_once('./libraries/auth/' . $cfg['Server']['auth_type'] . '.auth.lib.php');        if (!PMA_auth_check()) {            PMA_auth();        } else {            PMA_auth_set_user();        }        // Check IP-based Allow/Deny rules as soon as possible to reject the        // user        // Based on mod_access in Apache:        // http://cvs.apache.org/viewcvs.cgi/httpd-2.0/modules/aaa/mod_access.c?rev=1.37&content-type=text/vnd.viewcvs-markup

⌨️ 快捷键说明

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