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

📄 common.lib.php

📁 架設ROSE私服必備之物 ROSE數據庫
💻 PHP
📖 第 1 页 / 共 5 页
字号:
     * enclosed by <![CDATA[ ... ]]>     * this requires only to escape ' with \' and end of script block     *     * @uses    strtr()     * @param   string  $string the string to be escaped     * @return  string  the escaped string     */    function PMA_escapeJsString($string)    {        return strtr($string, array(                            '\\' => '\\\\',                            '\'' => '\\\'',                            "\n" => '\n',                            "\r" => '\r',                            '</script' => '<\' + \'script'));    }    /**     * Defines the <CR><LF> value depending on the user OS.     *     * @return  string   the <CR><LF> value to use     *     * @access  public     */    function PMA_whichCrlf()    {        $the_crlf = "\n";        // The 'PMA_USR_OS' constant is defined in "./libraries/defines.lib.php"        // Win case        if (PMA_USR_OS == 'Win') {            $the_crlf = "\r\n";        }        // Mac case        elseif (PMA_USR_OS == 'Mac') {            $the_crlf = "\r";        }        // Others        else {            $the_crlf = "\n";        }        return $the_crlf;    } // end of the 'PMA_whichCrlf()' function    /**     * Reloads navigation if needed.     *     * @global  mixed   configuration     * @global  bool    whether to reload     *     * @access  public     */    function PMA_reloadNavigation()    {        global $cfg;        // Reloads the navigation frame via JavaScript if required        if (isset($GLOBALS['reload']) && $GLOBALS['reload']) {            echo "\n";            $reload_url = './left.php?' . PMA_generate_common_url((isset($GLOBALS['db']) ? $GLOBALS['db'] : ''), '', '&');            ?><script type="text/javascript" language="javascript">//<![CDATA[if (typeof(window.parent) != 'undefined'    && typeof(window.parent.frame_navigation) != 'undefined') {    window.parent.goTo('<?php echo $reload_url; ?>');}//]]></script>            <?php            unset($GLOBALS['reload']);        }    }    /**     * Displays a message at the top of the "main" (right) frame     *     * @param   string  the message to display     *     * @global  array   the configuration array     *     * @access  public     */    function PMA_showMessage($message)    {        global $cfg;        // Sanitizes $message        $message = PMA_sanitize($message);        // Corrects the tooltip text via JS if required        if ( isset($GLOBALS['table']) && strlen($GLOBALS['table']) && $cfg['ShowTooltip']) {            $result = PMA_DBI_try_query('SHOW TABLE STATUS FROM ' . PMA_backquote($GLOBALS['db']) . ' LIKE \'' . PMA_sqlAddslashes($GLOBALS['table'], true) . '\'');            if ($result) {                $tbl_status = PMA_DBI_fetch_assoc($result);                $tooltip    = (empty($tbl_status['Comment']))                            ? ''                            : $tbl_status['Comment'] . ' ';                $tooltip .= '(' . PMA_formatNumber($tbl_status['Rows'], 0) . ' ' . $GLOBALS['strRows'] . ')';                PMA_DBI_free_result($result);                $uni_tbl = PMA_jsFormat($GLOBALS['db'] . '.' . $GLOBALS['table'], false);                echo "\n";                ?><script type="text/javascript" language="javascript">//<![CDATA[window.parent.updateTableTitle('<?php echo $uni_tbl; ?>', '<?php echo PMA_jsFormat($tooltip, false); ?>');//]]></script>                <?php            } // end if        } // end if ... elseif        // Checks if the table needs to be repaired after a TRUNCATE query.        if (isset($GLOBALS['table']) && isset($GLOBALS['sql_query'])            && $GLOBALS['sql_query'] == 'TRUNCATE TABLE ' . PMA_backquote($GLOBALS['table'])) {            if (!isset($tbl_status)) {                $result = @PMA_DBI_try_query('SHOW TABLE STATUS FROM ' . PMA_backquote($GLOBALS['db']) . ' LIKE \'' . PMA_sqlAddslashes($GLOBALS['table'], true) . '\'');                if ($result) {                    $tbl_status = PMA_DBI_fetch_assoc($result);                    PMA_DBI_free_result($result);                }            }            if (isset($tbl_status) && (int) $tbl_status['Index_length'] > 1024) {                PMA_DBI_try_query('REPAIR TABLE ' . PMA_backquote($GLOBALS['table']));            }        }        unset($tbl_status);        ?><br /><div align="<?php echo $GLOBALS['cell_align_left']; ?>">        <?php        if (!empty($GLOBALS['show_error_header'])) {            ?>    <div class="error">        <h1><?php echo $GLOBALS['strError']; ?></h1>            <?php        }        echo $message;        if (isset($GLOBALS['special_message'])) {            echo PMA_sanitize($GLOBALS['special_message']);            unset($GLOBALS['special_message']);        }        if (!empty($GLOBALS['show_error_header'])) {            echo '</div>';        }        if ($cfg['ShowSQL'] == true          && (!empty($GLOBALS['sql_query']) || !empty($GLOBALS['display_query']))) {            if (!empty($GLOBALS['display_query'])) {                $local_query = $GLOBALS['display_query'];            } else {                if ($cfg['SQP']['fmtType'] == 'none' && !empty($GLOBALS['unparsed_sql'])) {                    $local_query = $GLOBALS['unparsed_sql'];                } else {                    $local_query = $GLOBALS['sql_query'];                }            }            // Basic url query part            $url_qpart = '?' . PMA_generate_common_url(isset($GLOBALS['db']) ? $GLOBALS['db'] : '', isset($GLOBALS['table']) ? $GLOBALS['table'] : '');            // Html format the query to be displayed            // The nl2br function isn't used because its result isn't a valid            // xhtml1.0 statement before php4.0.5 ("<br>" and not "<br />")            // If we want to show some sql code it is easiest to create it here             /* SQL-Parser-Analyzer */            if (!empty($GLOBALS['show_as_php'])) {                $new_line = '\'<br />' . "\n" . '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;. \' ';            }            if (isset($new_line)) {                 /* SQL-Parser-Analyzer */                $query_base = PMA_sqlAddslashes(htmlspecialchars($local_query), false, false, true);                 /* SQL-Parser-Analyzer */                $query_base = preg_replace("@((\015\012)|(\015)|(\012))+@", $new_line, $query_base);            } else {                $query_base = htmlspecialchars($local_query);            }            // Parse SQL if needed            if (isset($GLOBALS['parsed_sql']) && $query_base == $GLOBALS['parsed_sql']['raw']) {                $parsed_sql = $GLOBALS['parsed_sql'];            } else {                // when the query is large (for example an INSERT of binary                // data), the parser chokes; so avoid parsing the query                if (strlen($query_base) < 1000) {                    $parsed_sql = PMA_SQP_parse($query_base);                }            }            // Analyze it            if (isset($parsed_sql)) {                $analyzed_display_query = PMA_SQP_analyze($parsed_sql);            }            // Here we append the LIMIT added for navigation, to            // enable its display. Adding it higher in the code            // to $local_query would create a problem when            // using the Refresh or Edit links.            // Only append it on SELECTs.            // FIXME: what would be the best to do when someone            // hits Refresh: use the current LIMITs ?            if (isset($analyzed_display_query[0]['queryflags']['select_from'])             && isset($GLOBALS['sql_limit_to_append'])) {                $query_base  = $analyzed_display_query[0]['section_before_limit'] . "\n" . $GLOBALS['sql_limit_to_append'] . $analyzed_display_query[0]['section_after_limit'];                // Need to reparse query                $parsed_sql = PMA_SQP_parse($query_base);            }            if (!empty($GLOBALS['show_as_php'])) {                $query_base = '$sql  = \'' . $query_base;            } elseif (!empty($GLOBALS['validatequery'])) {                $query_base = PMA_validateSQL($query_base);            } else {                if (isset($parsed_sql)) {                    $query_base = PMA_formatSql($parsed_sql, $query_base);                }            }            // Prepares links that may be displayed to edit/explain the query            // (don't go to default pages, we must go to the page            // where the query box is available)            // (also, I don't see why we should check the goto variable)            //if (!isset($GLOBALS['goto'])) {                //$edit_target = (isset($GLOBALS['table'])) ? $cfg['DefaultTabTable'] : $cfg['DefaultTabDatabase'];            $edit_target = isset($GLOBALS['db']) ? (isset($GLOBALS['table']) ? 'tbl_properties.php' : 'db_details.php') : 'server_sql.php';            //} elseif ($GLOBALS['goto'] != 'main.php') {            //    $edit_target = $GLOBALS['goto'];            //} else {            //    $edit_target = '';            //}            if (isset($cfg['SQLQuery']['Edit'])                && ($cfg['SQLQuery']['Edit'] == true)                && (!empty($edit_target))) {                if ($cfg['EditInWindow'] == true) {                    $onclick = 'window.parent.focus_querywindow(\'' . PMA_jsFormat($local_query, false) . '\'); return false;';                } else {                    $onclick = '';                }                $edit_link = $edit_target                           . $url_qpart                           . '&amp;sql_query=' . urlencode($local_query)                           . '&amp;show_query=1#querybox';                $edit_link = ' [' . PMA_linkOrButton($edit_link, $GLOBALS['strEdit'], array('onclick' => $onclick)) . ']';            } else {                $edit_link = '';            }            // Want to have the query explained (Mike Beck 2002-05-22)            // but only explain a SELECT (that has not been explained)            /* SQL-Parser-Analyzer */            if (isset($cfg['SQLQuery']['Explain'])                && $cfg['SQLQuery']['Explain'] == true) {                // Detect if we are validating as well                // To preserve the validate uRL data                if (!empty($GLOBALS['validatequery'])) {                    $explain_link_validate = '&amp;validatequery=1';                } else {                    $explain_link_validate = '';                }                $explain_link = 'import.php'                              . $url_qpart                              . $explain_link_validate                              . '&amp;sql_query=';                if (preg_match('@^SELECT[[:space:]]+@i', $local_query)) {                    $explain_link .= urlencode('EXPLAIN ' . $local_query);                    $message = $GLOBALS['strExplain'];                } elseif (preg_match('@^EXPLAIN[[:space:]]+SELECT[[:space:]]+@i', $local_query)) {                    $explain_link .= urlencode(substr($local_query, 8));                    $message = $GLOBALS['strNoExplain'];                } else {                    $explain_link = '';                }                if (!empty($explain_link)) {                    $explain_link = ' [' . PMA_linkOrButton($explain_link, $message) . ']';                }            } else {                $explain_link = '';            } //show explain            // Also we would like to get the SQL formed in some nice            // php-code (Mike Beck 2002-05-22)            if (isset($cfg['SQLQuery']['ShowAsPHP'])                && $cfg['SQLQuery']['ShowAsPHP'] == true) {                $php_link = 'import.php'                          . $url_qpart                          . '&amp;show_query=1'                          . '&amp;sql_query=' . urlencode($local_query)                          . '&amp;show_as_php=';                if (!empty($GLOBALS['show_as_php'])) {                    $php_link .= '0';                    $message = $GLOBALS['strNoPhp'];                } else {                    $php_link .= '1';                    $message = $GLOBALS['strPhp'];                }                $php_link = ' [' . PMA_linkOrButton($php_link, $message) . ']';                if (isset($GLOBALS['show_as_php']) && $GLOBALS['show_as_php'] == '1') {                    $runquery_link                         = 'import.php'                         . $url_qpart                         . '&amp;show_query=1'                         . '&amp;sql_query=' . urlencode($local_query);                    $php_link .= ' [' . PMA_linkOrButton($runquery_link, $GLOBALS['strRunQuery']) . ']';                }            } else {                $php_link = '';            } //show as php            // Refresh query            if (isset($cfg['SQLQuery']['Refresh'])                && $cfg['SQLQuery']['Refresh']                && preg_match('@^(SELECT|SHOW)[[:space:]]+@i', $local_query)) {                $refresh_link = 'import.php'                          . $url_qpart                          . '&amp;show_query=1'                          . (isset($_GET['pos']) ? '&amp;pos=' . $_GET['pos'] : '')                          . '&amp;sql_query=' . urlencode($local_query);                $refresh_link = ' [' . PMA_linkOrButton($refresh_link, $GLOBALS['strRefresh']) . ']';            } else {                $refresh_link = '';            } //show as php            if (isset($cfg['SQLValidator']['use'])                && $cfg['SQLValidator']['use'] == true                && isset($cfg['SQLQuery']['Validate'])                && $cfg['SQLQuery']['Validate'] == true) {                $validate_link = 'import.php'                               . $url_qpart                               . '&amp;show_query=1'                    

⌨️ 快捷键说明

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