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

📄 common.lib.php

📁 一个用PHP编写的
💻 PHP
📖 第 1 页 / 共 5 页
字号:
                && $cfg['SQLValidator']['use'] == true                && isset($cfg['SQLQuery']['Validate'])                && $cfg['SQLQuery']['Validate'] == true) {                $validate_link = 'import.php'                               . $url_qpart                               . '&amp;show_query=1'                               . '&amp;sql_query=' . urlencode($sql_query)                               . '&amp;validatequery=';                if (!empty($GLOBALS['validatequery'])) {                    $validate_link .= '0';                    $validate_message = $GLOBALS['strNoValidateSQL'] ;                } else {                    $validate_link .= '1';                    $validate_message = $GLOBALS['strValidateSQL'] ;                }                $validate_link = ' [' . PMA_linkOrButton($validate_link, $validate_message) . ']';            } else {                $validate_link = '';            } //validator            unset($sql_query);            // Displays the message            echo '<fieldset class="">' . "\n";            echo '    <legend>' . $GLOBALS['strSQLQuery'] . ':</legend>';            echo '    <div>';            // when uploading a 700 Kio binary file into a LONGBLOB,             // I get a white page, strlen($query_base) is 2 x 700 Kio            // so put a hard limit here (let's say 1000)            if (defined('PMA_QUERY_TOO_BIG')) {                echo '    ' . substr($query_base,0,$max_characters) . '[...]';            } else {                echo '    ' . $query_base;            }            //Clean up the end of the PHP            if (!empty($GLOBALS['show_as_php'])) {                echo '\';';            }            echo '    </div>';            echo '</fieldset>' . "\n";            if (!empty($edit_target)) {                echo '<fieldset class="tblFooters">';                echo $edit_link . $explain_link . $php_link . $refresh_link . $validate_link;                echo '</fieldset>';            }        }        echo '</div><br />' . "\n";    } // end of the 'PMA_showMessage()' function    /**     * Formats $value to byte view     *     * @param    double   the value to format     * @param    integer  the sensitiveness     * @param    integer  the number of decimals to retain     *     * @return   array    the formatted value and its unit     *     * @access  public     *     * @author   staybyte     * @version  1.2 - 18 July 2002     */    function PMA_formatByteDown($value, $limes = 6, $comma = 0)    {        $dh           = pow(10, $comma);        $li           = pow(10, $limes);        $return_value = $value;        $unit         = $GLOBALS['byteUnits'][0];        for ($d = 6, $ex = 15; $d >= 1; $d--, $ex-=3) {            if (isset($GLOBALS['byteUnits'][$d]) && $value >= $li * pow(10, $ex)) {                // use 1024.0 to avoid integer overflow on 64-bit machines                $value = round($value / (pow(1024.0, $d) / $dh)) /$dh;                $unit = $GLOBALS['byteUnits'][$d];                break 1;            } // end if        } // end for        if ($unit != $GLOBALS['byteUnits'][0]) {            $return_value = number_format($value, $comma, $GLOBALS['number_decimal_separator'], $GLOBALS['number_thousands_separator']);        } else {            $return_value = number_format($value, 0, $GLOBALS['number_decimal_separator'], $GLOBALS['number_thousands_separator']);        }        return array($return_value, $unit);    } // end of the 'PMA_formatByteDown' function    /**     * Formats $value to the given length and appends SI prefixes     * $comma is not substracted from the length     * with a $length of 0 no truncation occurs, number is only formated     * to the current locale     * <code>     * echo PMA_formatNumber(123456789, 6);     // 123,457 k     * echo PMA_formatNumber(-123456789, 4, 2); //    -123.46 M     * echo PMA_formatNumber(-0.003, 6);        //      -3 m     * echo PMA_formatNumber(0.003, 3, 3);      //       0.003     * echo PMA_formatNumber(0.00003, 3, 2);    //       0.03 m     * echo PMA_formatNumber(0, 6);             //       0     * </code>     * @param   double   $value     the value to format     * @param   integer  $length    the max length     * @param   integer  $comma     the number of decimals to retain     * @param   boolean  $only_down do not reformat numbers below 1     *     * @return  string   the formatted value and its unit     *     * @access  public     *     * @author  staybyte, sebastian mendel     * @version 1.1.0 - 2005-10-27     */    function PMA_formatNumber($value, $length = 3, $comma = 0, $only_down = false)    {        if ($length === 0) {            return number_format($value,                                $comma,                                $GLOBALS['number_decimal_separator'],                                $GLOBALS['number_thousands_separator']);        }        // this units needs no translation, ISO        $units = array(            -8 => 'y',            -7 => 'z',            -6 => 'a',            -5 => 'f',            -4 => 'p',            -3 => 'n',            -2 => '&micro;',            -1 => 'm',            0 => ' ',            1 => 'k',            2 => 'M',            3 => 'G',            4 => 'T',            5 => 'P',            6 => 'E',            7 => 'Z',            8 => 'Y'       );        // we need at least 3 digits to be displayed        if (3 > $length + $comma) {            $length = 3 - $comma;        }        // check for negativ value to retain sign        if ($value < 0) {            $sign = '-';            $value = abs($value);        } else {            $sign = '';        }        $dh = pow(10, $comma);        $li = pow(10, $length);        $unit = $units[0];        if ($value >= 1) {            for ($d = 8; $d >= 0; $d--) {                if (isset($units[$d]) && $value >= $li * pow(1000.0, $d-1)) {                    $value = round($value / (pow(1000.0, $d) / $dh)) /$dh;                    $unit = $units[$d];                    break 1;                } // end if            } // end for        } elseif (!$only_down && (float) $value !== 0.0) {            for ($d = -8; $d <= 8; $d++) {                if (isset($units[$d]) && $value <= $li * pow(1000.0, $d-1)) {                    $value = round($value / (pow(1000.0, $d) / $dh)) /$dh;                    $unit = $units[$d];                    break 1;                } // end if            } // end for        } // end if ($value >= 1) elseif (!$only_down && (float) $value !== 0.0)        $value = number_format($value,                                $comma,                                $GLOBALS['number_decimal_separator'],                                $GLOBALS['number_thousands_separator']);        return $sign . $value . ' ' . $unit;    } // end of the 'PMA_formatNumber' function    /**     * Extracts ENUM / SET options from a type definition string     *     * @param   string   The column type definition     *     * @return  array    The options or     *          boolean  false in case of an error.     *     * @author  rabus     */    function PMA_getEnumSetOptions($type_def)    {        $open = strpos($type_def, '(');        $close = strrpos($type_def, ')');        if (!$open || !$close) {            return false;        }        $options = substr($type_def, $open + 2, $close - $open - 3);        $options = explode('\',\'', $options);        return $options;    } // end of the 'PMA_getEnumSetOptions' function    /**     * Writes localised date     *     * @param   string   the current timestamp     *     * @return  string   the formatted date     *     * @access  public     */    function PMA_localisedDate($timestamp = -1, $format = '')    {        global $datefmt, $month, $day_of_week;        if ($format == '') {            $format = $datefmt;        }        if ($timestamp == -1) {            $timestamp = time();        }        $date = preg_replace('@%[aA]@', $day_of_week[(int)strftime('%w', $timestamp)], $format);        $date = preg_replace('@%[bB]@', $month[(int)strftime('%m', $timestamp)-1], $date);        return strftime($date, $timestamp);    } // end of the 'PMA_localisedDate()' function    /**     * returns a tab for tabbed navigation.     * If the variables $link and $args ar left empty, an inactive tab is created     *     * @uses    array_merge()     * basename()     * $GLOBALS['strEmpty']     * $GLOBALS['strDrop']     * $GLOBALS['active_page']     * $GLOBALS['PHP_SELF']     * htmlentities()     * PMA_generate_common_url()     * $GLOBALS['url_query']     * urlencode()     * $GLOBALS['cfg']['MainPageIconic']     * $GLOBALS['pmaThemeImage']     * sprintf()     * trigger_error()     * E_USER_NOTICE     * @param   array   $tab    array with all options     * @return  string  html code for one tab, a link if valid otherwise a span     * @access  public     */    function PMA_getTab($tab)    {        // default values        $defaults = array(            'text'      => '',            'class'     => '',            'active'    => false,            'link'      => '',            'sep'       => '?',            'attr'      => '',            'args'      => '',            'warning'   => '',       );        $tab = array_merge($defaults, $tab);        // determine additionnal style-class        if (empty($tab['class'])) {            if ($tab['text'] == $GLOBALS['strEmpty']                || $tab['text'] == $GLOBALS['strDrop']) {                $tab['class'] = 'caution';            } elseif (!empty($tab['active'])              || (isset($GLOBALS['active_page'])                   && $GLOBALS['active_page'] == $tab['link'])              || basename(PMA_getenv('PHP_SELF')) == $tab['link'])            {                $tab['class'] = 'active';            }        }        if (!empty($tab['warning'])) {            $tab['class'] .= ' warning';            $tab['attr'] .= ' title="' . htmlspecialchars($tab['warning']) . '"';        }        // build the link        if (!empty($tab['link'])) {            $tab['link'] = htmlentities($tab['link']);            $tab['link'] = $tab['link'] . $tab['sep']                .(empty($GLOBALS['url_query']) ?                    PMA_generate_common_url() : $GLOBALS['url_query']);            if (!empty($tab['args'])) {                foreach ($tab['args'] as $param => $value) {                    $tab['link'] .= '&amp;' . urlencode($param) . '='                        . urlencode($value);                }            }        }        // display icon, even if iconic is disabled but the link-text is missing        if (($GLOBALS['cfg']['MainPageIconic'] || empty($tab['text']))            && isset($tab['icon'])) {            $image = '<img class="icon" src="' . htmlentities($GLOBALS['pmaThemeImage'])                .'%1$s" width="16" height="16" alt="%2$s" />%2$s';            $tab['text'] = sprintf($image, htmlentities($tab['icon']), $tab['text']);        }        // check to not display an empty link-text        elseif (empty($tab['text'])) {            $tab['text'] = '?';            trigger_error('empty linktext in function ' . __FUNCTION__ . '()',                E_USER_NOTICE);        }        if (!empty($tab['link'])) {            $out = '<a class="tab' . htmlentities($tab['class']) . '"'                .' href="' . $tab['link'] . '" ' . $tab['attr'] . '>'                . $tab['text'] . '</a>';        } else {            $out = '<span class="tab' . htmlentities($tab['class']) . '">'                . $tab['text'] . '</span>';        }        return $out;    } // end of the 'PMA_getTab()' function    /**     * returns html-code for a tab navigation     *     * @uses    PMA_getTab()     * @uses    htmlentities()     * @param   array   $tabs   one element per tab     * @param   string  $tag_id id used for the html-tag     * @return  string  html-code for tab-navigation     */    function PMA_getTabs($tabs, $tag_id = 'topmenu')    {        $tab_navigation =             '<div id="' . htmlentities($tag_id) . 'container">' . "\n"            .'<ul id="' . htmlentities($tag_id) . '">' . "\n";        foreach ($tabs as $tab) {            $tab_navigation .= '<li>' . PMA_getTab($tab) . '</li>' . "\n";        }        $tab_navigation .=             '</ul>' . "\n"            .'<div class="clearfloat"></

⌨️ 快捷键说明

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