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

📄 common.lib.php

📁 phpMyAdmin图形界面化操作,我已经配置好了,只要把解要压缩后的文件放到站点下就可以用了
💻 PHP
📖 第 1 页 / 共 5 页
字号:
<?php/* vim: set expandtab sw=4 ts=4 sts=4: *//** * Misc functions used all over the scripts. * * @version $Id: common.lib.php 12163 2009-01-01 21:39:21Z lem9 $ *//** * Exponential expression / raise number into power * * @uses    function_exists() * @uses    bcpow() * @uses    gmp_pow() * @uses    gmp_strval() * @uses    pow() * @param   number  $base * @param   number  $exp * @param   string  pow function use, or false for auto-detect * @return  mixed  string or float */function PMA_pow($base, $exp, $use_function = false){    static $pow_function = null;    if ($exp < 0) {        return false;    }    if (null == $pow_function) {        if (function_exists('bcpow')) {            // BCMath Arbitrary Precision Mathematics Function            $pow_function = 'bcpow';        } elseif (function_exists('gmp_pow')) {            // GMP Function            $pow_function = 'gmp_pow';        } else {            // PHP function            $pow_function = 'pow';        }    }    if (! $use_function) {        $use_function = $pow_function;    }    switch ($use_function) {        case 'bcpow' :            //bcscale(10);            $pow = bcpow($base, $exp);            break;        case 'gmp_pow' :             $pow = gmp_strval(gmp_pow($base, $exp));            break;        case 'pow' :            $base = (float) $base;            $exp = (int) $exp;            $pow = pow($base, $exp);            break;        default:            $pow = $use_function($base, $exp);    }    return $pow;}/** * string PMA_getIcon(string $icon) * * @uses    $GLOBALS['pmaThemeImage'] * @uses    $GLOBALS['cfg']['PropertiesIconic'] * @uses    htmlspecialchars() * @param   string  $icon   name of icon file * @param   string  $alternate alternate text * @param   boolean $container include in container * @param   boolean $$force_text whether to force alternate text to be displayed * @return          html img tag */function PMA_getIcon($icon, $alternate = '', $container = false, $force_text = false){    $include_icon = false;    $include_text = false;    $include_box  = false;    $alternate    = htmlspecialchars($alternate);    $button       = '';    if ($GLOBALS['cfg']['PropertiesIconic']) {         $include_icon = true;    }    if ($force_text     || ! (true === $GLOBALS['cfg']['PropertiesIconic'])     || ! $include_icon) {        // $cfg['PropertiesIconic'] is false or both        // OR we have no $include_icon        $include_text = true;    }    if ($include_text && $include_icon && $container) {        // we have icon, text and request for container        $include_box = true;    }    if ($include_box) {        $button .= '<div class="nowrap">';    }    if ($include_icon) {        $button .= '<img src="' . $GLOBALS['pmaThemeImage'] . $icon . '"'            . ' title="' . $alternate . '" alt="' . $alternate . '"'            . ' class="icon" width="16" height="16" />';    }    if ($include_icon && $include_text) {        $button .= ' ';    }    if ($include_text) {        $button .= $alternate;    }    if ($include_box) {        $button .= '</div>';    }    return $button;}/** * Displays the maximum size for an upload * * @uses    $GLOBALS['strMaximumSize'] * @uses    PMA_formatByteDown() * @uses    sprintf() * @param   integer  the size * * @return  string   the message * * @access  public */function PMA_displayMaximumUploadSize($max_upload_size){    list($max_size, $max_unit) = PMA_formatByteDown($max_upload_size);    return '(' . sprintf($GLOBALS['strMaximumSize'], $max_size, $max_unit) . ')';}/** * Generates a hidden field which should indicate to the browser * the maximum size for upload * * @param   integer  the size * * @return  string   the INPUT field * * @access  public */ function PMA_generateHiddenMaxFileSize($max_size) {     return '<input type="hidden" name="MAX_FILE_SIZE" value="' .$max_size . '" />'; }/** * Add slashes before "'" and "\" characters so a value containing them can * be used in a sql comparison. * * @uses    str_replace() * @param   string   the string to slash * @param   boolean  whether the string will be used in a 'LIKE' clause *                   (it then requires two more escaped sequences) or not * @param   boolean  whether to treat cr/lfs as escape-worthy entities *                   (converts \n to \\n, \r to \\r) * * @param   boolean  whether this function is used as part of the *                   "Create PHP code" dialog * * @return  string   the slashed string * * @access  public */function PMA_sqlAddslashes($a_string = '', $is_like = false, $crlf = false, $php_code = false){    if ($is_like) {        $a_string = str_replace('\\', '\\\\\\\\', $a_string);    } else {        $a_string = str_replace('\\', '\\\\', $a_string);    }    if ($crlf) {        $a_string = str_replace("\n", '\n', $a_string);        $a_string = str_replace("\r", '\r', $a_string);        $a_string = str_replace("\t", '\t', $a_string);    }    if ($php_code) {        $a_string = str_replace('\'', '\\\'', $a_string);    } else {        $a_string = str_replace('\'', '\'\'', $a_string);    }    return $a_string;} // end of the 'PMA_sqlAddslashes()' function/** * Add slashes before "_" and "%" characters for using them in MySQL * database, table and field names. * Note: This function does not escape backslashes! * * @uses    str_replace() * @param   string   the string to escape * * @return  string   the escaped string * * @access  public */function PMA_escape_mysql_wildcards($name){    $name = str_replace('_', '\\_', $name);    $name = str_replace('%', '\\%', $name);    return $name;} // end of the 'PMA_escape_mysql_wildcards()' function/** * removes slashes before "_" and "%" characters * Note: This function does not unescape backslashes! * * @uses    str_replace() * @param   string   $name  the string to escape * @return  string   the escaped string * @access  public */function PMA_unescape_mysql_wildcards($name){    $name = str_replace('\\_', '_', $name);    $name = str_replace('\\%', '%', $name);    return $name;} // end of the 'PMA_unescape_mysql_wildcards()' function/** * removes quotes (',",`) from a quoted string * * checks if the sting is quoted and removes this quotes * * @uses    str_replace() * @uses    substr() * @param   string  $quoted_string  string to remove quotes from * @param   string  $quote          type of quote to remove * @return  string  unqoted string */function PMA_unQuote($quoted_string, $quote = null){    $quotes = array();    if (null === $quote) {        $quotes[] = '`';        $quotes[] = '"';        $quotes[] = "'";    } else {        $quotes[] = $quote;    }    foreach ($quotes as $quote) {        if (substr($quoted_string, 0, 1) === $quote         && substr($quoted_string, -1, 1) === $quote) {             $unquoted_string = substr($quoted_string, 1, -1);             // replace escaped quotes             $unquoted_string = str_replace($quote . $quote, $quote, $unquoted_string);             return $unquoted_string;         }    }    return $quoted_string;}/** * format sql strings * * @todo    move into PMA_Sql * @uses    PMA_SQP_isError() * @uses    PMA_SQP_formatHtml() * @uses    PMA_SQP_formatNone() * @uses    is_array() * @param   mixed    pre-parsed SQL structure * * @return  string   the formatted sql * * @global  array    the configuration array * @global  boolean  whether the current statement is a multiple one or not * * @access  public * * @author  Robin Johnson <robbat2@users.sourceforge.net> */function PMA_formatSql($parsed_sql, $unparsed_sql = ''){    global $cfg;    // Check that we actually have a valid set of parsed data    // well, not quite    // first check for the SQL parser having hit an error    if (PMA_SQP_isError()) {        return $parsed_sql;    }    // then check for an array    if (!is_array($parsed_sql)) {        // We don't so just return the input directly        // This is intended to be used for when the SQL Parser is turned off        $formatted_sql = '<pre>' . "\n"                        . (($cfg['SQP']['fmtType'] == 'none' && $unparsed_sql != '') ? $unparsed_sql : $parsed_sql) . "\n"                        . '</pre>';        return $formatted_sql;    }    $formatted_sql        = '';    switch ($cfg['SQP']['fmtType']) {        case 'none':            if ($unparsed_sql != '') {                $formatted_sql = "<pre>\n" . PMA_SQP_formatNone(array('raw' => $unparsed_sql)) . "\n</pre>";            } else {                $formatted_sql = PMA_SQP_formatNone($parsed_sql);            }            break;        case 'html':            $formatted_sql = PMA_SQP_formatHtml($parsed_sql, 'color');            break;        case 'text':            //$formatted_sql = PMA_SQP_formatText($parsed_sql);            $formatted_sql = PMA_SQP_formatHtml($parsed_sql, 'text');            break;        default:            break;    } // end switch    return $formatted_sql;} // end of the "PMA_formatSql()" function/** * Displays a link to the official MySQL documentation * * @uses    $cfg['MySQLManualType'] * @uses    $cfg['MySQLManualBase'] * @uses    $cfg['ReplaceHelpImg'] * @uses    $GLOBALS['mysql_4_1_doc_lang'] * @uses    $GLOBALS['mysql_5_1_doc_lang'] * @uses    $GLOBALS['mysql_5_0_doc_lang'] * @uses    $GLOBALS['strDocu'] * @uses    $GLOBALS['pmaThemeImage'] * @uses    PMA_MYSQL_INT_VERSION * @uses    strtolower() * @uses    str_replace() * @param string  chapter of "HTML, one page per chapter" documentation * @param string  contains name of page/anchor that is being linked * @param bool    whether to use big icon (like in left frame) * @param string  anchor to page part * * @return  string  the html link * * @access  public */function PMA_showMySQLDocu($chapter, $link, $big_icon = false, $anchor = ''){    global $cfg;    if ($cfg['MySQLManualType'] == 'none' || empty($cfg['MySQLManualBase'])) {        return '';    }    // Fixup for newly used names:    $chapter = str_replace('_', '-', strtolower($chapter));    $link = str_replace('_', '-', strtolower($link));    switch ($cfg['MySQLManualType']) {        case 'chapters':            if (empty($chapter)) {                $chapter = 'index';            }            if (empty($anchor)) {                $anchor = $link;            }            $url = $cfg['MySQLManualBase'] . '/' . $chapter . '.html#' . $anchor;            break;        case 'big':            if (empty($anchor)) {                $anchor = $link;            }

⌨️ 快捷键说明

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