📄 common.lib.php
字号:
$url = $cfg['MySQLManualBase'] . '#' . $anchor; break; case 'searchable': if (empty($link)) { $link = 'index'; } $url = $cfg['MySQLManualBase'] . '/' . $link . '.html'; if (!empty($anchor)) { $url .= '#' . $anchor; } break; case 'viewable': default: if (empty($link)) { $link = 'index'; } $mysql = '5.0'; $lang = 'en'; if (defined('PMA_MYSQL_INT_VERSION')) { if (PMA_MYSQL_INT_VERSION >= 50100) { $mysql = '5.1'; if (!empty($GLOBALS['mysql_5_1_doc_lang'])) { $lang = $GLOBALS['mysql_5_1_doc_lang']; } } elseif (PMA_MYSQL_INT_VERSION >= 50000) { $mysql = '5.0'; if (!empty($GLOBALS['mysql_5_0_doc_lang'])) { $lang = $GLOBALS['mysql_5_0_doc_lang']; } } } $url = $cfg['MySQLManualBase'] . '/' . $mysql . '/' . $lang . '/' . $link . '.html'; if (!empty($anchor)) { $url .= '#' . $anchor; } break; } if ($big_icon) { return '<a href="' . $url . '" target="mysql_doc"><img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 'b_sqlhelp.png" width="16" height="16" alt="' . $GLOBALS['strDocu'] . '" title="' . $GLOBALS['strDocu'] . '" /></a>'; } elseif ($GLOBALS['cfg']['ReplaceHelpImg']) { return '<a href="' . $url . '" target="mysql_doc"><img class="icon" src="' . $GLOBALS['pmaThemeImage'] . 'b_help.png" width="11" height="11" alt="' . $GLOBALS['strDocu'] . '" title="' . $GLOBALS['strDocu'] . '" /></a>'; } else { return '[<a href="' . $url . '" target="mysql_doc">' . $GLOBALS['strDocu'] . '</a>]'; }} // end of the 'PMA_showMySQLDocu()' function/** * returns HTML for a footnote marker and add the messsage to the footnotes * * @uses $GLOBALS['footnotes'] * @param string the error message * @return string html code for a footnote marker * @access public */function PMA_showHint($message, $bbcode = false, $type = 'notice'){ if ($message instanceof PMA_Message) { $key = $message->getHash(); $type = $message->getLevel(); } else { $key = md5($message); } if (! isset($GLOBALS['footnotes'][$key])) { $nr = count($GLOBALS['footnotes']) + 1; // this is the first instance of this message $instance = 1; $GLOBALS['footnotes'][$key] = array( 'note' => $message, 'type' => $type, 'nr' => $nr, 'instance' => $instance ); } else { $nr = $GLOBALS['footnotes'][$key]['nr']; // another instance of this message (to ensure ids are unique) $instance = ++$GLOBALS['footnotes'][$key]['instance']; } if ($bbcode) { return '[sup]' . $nr . '[/sup]'; } // footnotemarker used in js/tooltip.js return '<sup class="footnotemarker" id="footnote_sup_' . $nr . '_' . $instance . '">' . $nr . '</sup>';}/** * Displays a MySQL error message in the right frame. * * @uses footer.inc.php * @uses header.inc.php * @uses $GLOBALS['sql_query'] * @uses $GLOBALS['strError'] * @uses $GLOBALS['strSQLQuery'] * @uses $GLOBALS['pmaThemeImage'] * @uses $GLOBALS['strEdit'] * @uses $GLOBALS['strMySQLSaid'] * @uses $GLOBALS['cfg']['PropertiesIconic'] * @uses $GLOBALS['cfg']['MaxCharactersInDisplayedSQL'] * @uses PMA_backquote() * @uses PMA_DBI_getError() * @uses PMA_formatSql() * @uses PMA_generate_common_hidden_inputs() * @uses PMA_generate_common_url() * @uses PMA_showMySQLDocu() * @uses PMA_sqlAddslashes() * @uses PMA_SQP_isError() * @uses PMA_SQP_parse() * @uses PMA_SQP_getErrorString() * @uses strtolower() * @uses urlencode() * @uses str_replace() * @uses nl2br() * @uses substr() * @uses preg_replace() * @uses preg_match() * @uses explode() * @uses implode() * @uses is_array() * @uses function_exists() * @uses htmlspecialchars() * @uses trim() * @uses strstr() * @param string the error message * @param string the sql query that failed * @param boolean whether to show a "modify" link or not * @param string the "back" link url (full path is not required) * @param boolean EXIT the page? * * @global string the curent table * @global string the current db * * @access public */function PMA_mysqlDie($error_message = '', $the_query = '', $is_modify_link = true, $back_url = '', $exit = true){ global $table, $db; /** * start http output, display html headers */ require_once './libraries/header.inc.php'; if (!$error_message) { $error_message = PMA_DBI_getError(); } if (!$the_query && !empty($GLOBALS['sql_query'])) { $the_query = $GLOBALS['sql_query']; } // --- Added to solve bug #641765 // Robbat2 - 12 January 2003, 9:46PM // Revised, Robbat2 - 13 January 2003, 2:59PM if (!function_exists('PMA_SQP_isError') || PMA_SQP_isError()) { $formatted_sql = htmlspecialchars($the_query); } elseif (empty($the_query) || trim($the_query) == '') { $formatted_sql = ''; } else { if (strlen($the_query) > $GLOBALS['cfg']['MaxCharactersInDisplayedSQL']) { $formatted_sql = substr($the_query, 0, $GLOBALS['cfg']['MaxCharactersInDisplayedSQL']) . '[...]'; } else { $formatted_sql = PMA_formatSql(PMA_SQP_parse($the_query), $the_query); } } // --- echo "\n" . '<!-- PMA-SQL-ERROR -->' . "\n"; echo ' <div class="error"><h1>' . $GLOBALS['strError'] . '</h1>' . "\n"; // if the config password is wrong, or the MySQL server does not // respond, do not show the query that would reveal the // username/password if (!empty($the_query) && !strstr($the_query, 'connect')) { // --- Added to solve bug #641765 // Robbat2 - 12 January 2003, 9:46PM // Revised, Robbat2 - 13 January 2003, 2:59PM if (function_exists('PMA_SQP_isError') && PMA_SQP_isError()) { echo PMA_SQP_getErrorString() . "\n"; echo '<br />' . "\n"; } // --- // modified to show me the help on sql errors (Michael Keck) echo ' <p><strong>' . $GLOBALS['strSQLQuery'] . ':</strong>' . "\n"; if (strstr(strtolower($formatted_sql), 'select')) { // please show me help to the error on select echo PMA_showMySQLDocu('SQL-Syntax', 'SELECT'); } if ($is_modify_link) { $_url_params = array( 'sql_query' => $the_query, 'show_query' => 1, ); if (strlen($table)) { $_url_params['db'] = $db; $_url_params['table'] = $table; $doedit_goto = '<a href="tbl_sql.php?' . PMA_generate_common_url($_url_params) . '">'; } elseif (strlen($db)) { $_url_params['db'] = $db; $doedit_goto = '<a href="db_sql.php?' . PMA_generate_common_url($_url_params) . '">'; } else { $doedit_goto = '<a href="server_sql.php?' . PMA_generate_common_url($_url_params) . '">'; } echo $doedit_goto . PMA_getIcon('b_edit.png', $GLOBALS['strEdit']) . '</a>'; } // end if echo ' </p>' . "\n" .' <p>' . "\n" .' ' . $formatted_sql . "\n" .' </p>' . "\n"; } // end if $tmp_mysql_error = ''; // for saving the original $error_message if (!empty($error_message)) { $tmp_mysql_error = strtolower($error_message); // save the original $error_message $error_message = htmlspecialchars($error_message); $error_message = preg_replace("@((\015\012)|(\015)|(\012)){3,}@", "\n\n", $error_message); } // modified to show me the help on error-returns (Michael Keck) // (now error-messages-server) echo '<p>' . "\n" . ' <strong>' . $GLOBALS['strMySQLSaid'] . '</strong>' . PMA_showMySQLDocu('Error-messages-server', 'Error-messages-server') . "\n" . '</p>' . "\n"; // The error message will be displayed within a CODE segment. // To preserve original formatting, but allow wordwrapping, we do a couple of replacements // Replace all non-single blanks with their HTML-counterpart $error_message = str_replace(' ', ' ', $error_message); // Replace TAB-characters with their HTML-counterpart $error_message = str_replace("\t", ' ', $error_message); // Replace linebreaks $error_message = nl2br($error_message); echo '<code>' . "\n" . $error_message . "\n" . '</code><br />' . "\n"; echo '</div>'; if ($exit) { if (! empty($back_url)) { if (strstr($back_url, '?')) { $back_url .= '&no_history=true'; } else { $back_url .= '?no_history=true'; } echo '<fieldset class="tblFooters">'; echo '[ <a href="' . $back_url . '">' . $GLOBALS['strBack'] . '</a> ]'; echo '</fieldset>' . "\n\n"; } /** * display footer and exit */ require_once './libraries/footer.inc.php'; }} // end of the 'PMA_mysqlDie()' function/** * Send HTTP header, taking IIS limits into account (600 seems ok) * * @uses PMA_IS_IIS * @uses PMA_COMING_FROM_COOKIE_LOGIN * @uses PMA_get_arg_separator() * @uses SID * @uses strlen() * @uses strpos() * @uses header() * @uses session_write_close() * @uses headers_sent() * @uses function_exists() * @uses debug_print_backtrace() * @uses trigger_error() * @uses defined() * @param string $uri the header to send * @return boolean always true */function PMA_sendHeaderLocation($uri){ if (PMA_IS_IIS && strlen($uri) > 600) { echo '<html><head><title>- - -</title>' . "\n"; echo '<meta http-equiv="expires" content="0">' . "\n"; echo '<meta http-equiv="Pragma" content="no-cache">' . "\n"; echo '<meta http-equiv="Cache-Control" content="no-cache">' . "\n"; echo '<meta http-equiv="Refresh" content="0;url=' .$uri . '">' . "\n"; echo '<script type="text/javascript">' . "\n"; echo '//<![CDATA[' . "\n"; echo 'setTimeout("window.location = unescape(\'"' . $uri . '"\')", 2000);' . "\n"; echo '//]]>' . "\n"; echo '</script>' . "\n"; echo '</head>' . "\n"; echo '<body>' . "\n"; echo '<script type="text/javascript">' . "\n"; echo '//<![CDATA[' . "\n"; echo 'document.write(\'<p><a href="' . $uri . '">' . $GLOBALS['strGo'] . '</a></p>\');' . "\n"; echo '//]]>' . "\n"; echo '</script></body></html>' . "\n"; } else { if (SID) { if (strpos($uri, '?') === false) { header('Location: ' . $uri . '?' . SID); } else { $separator = PMA_get_arg_separator(); header('Location: ' . $uri . $separator . SID); } } else { session_write_close(); if (headers_sent()) { if (function_exists('debug_print_backtrace')) { echo '<pre>'; debug_print_backtrace(); echo '</pre>'; } trigger_error('PMA_sendHeaderLocation called when headers are already sent!', E_USER_ERROR); } // bug #1523784: IE6 does not like 'Refresh: 0', it // results in a blank page // but we need it when coming from the cookie login panel) if (PMA_IS_IIS && defined('PMA_COMING_FROM_COOKIE_LOGIN')) { header('Refresh: 0; ' . $uri); } else { header('Location: ' . $uri); } } }}/** * returns array with tables of given db with extended information and grouped * * @uses $cfg['LeftFrameTableSeparator'] * @uses $cfg['LeftFrameTableLevel'] * @uses $cfg['ShowTooltipAliasTB'] * @uses $cfg['NaturalOrder'] * @uses PMA_backquote() * @uses count() * @uses array_merge * @uses uksort() * @uses strstr() * @uses explode() * @param string $db name of db * @param string $tables name of tables * @param integer $limit_offset list offset * @param integer $limit_count max tables to return * return array (recursive) grouped table list */function PMA_getTableList($db, $tables = null, $limit_offset = 0, $limit_count = false){ $sep = $GLOBALS['cfg']['LeftFrameTableSeparator']; if (null === $tables) { $tables = PMA_DBI_get_tables_full($db, false, false, null, $limit_offset, $limit_count); if ($GLOBALS['cfg']['NaturalOrder']) { uksort($tables, 'strnatcasecmp'); } } if (count($tables) < 1) { return $tables; } $default = array( 'Name' => '', 'Rows' => 0, 'Comment' => '', 'disp_name' => '', ); $table_groups = array(); // for blobstreaming - list of blobstreaming tables - rajk // load PMA configuration $PMA_Config = $_SESSION['PMA_Config']; // if PMA configuration exists if (!empty($PMA_Config)) $session_bs_tables = $_SESSION['PMA_Config']->get('BLOBSTREAMING_TABLES'); foreach ($tables as $table_name => $table) { // if BS tables exist if (isset($session_bs_tables)) // compare table name to tables in list of blobstreaming tables foreach ($session_bs_tables as $table_key=>$table_val) // if table is in list, skip outer foreach loop
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -