From fc2b6993042a1d3a2ef6cb31f4c791b01e86db01 Mon Sep 17 00:00:00 2001 From: Piotr Przybylski Date: Fri, 17 Jun 2011 20:06:54 +0200 Subject: [PATCH 1/2] Data dictionary could fail due to incorrect db name escaping --- db_datadict.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/db_datadict.php b/db_datadict.php index 102724d3ac..acd96dcbf2 100644 --- a/db_datadict.php +++ b/db_datadict.php @@ -58,9 +58,8 @@ PMA_DBI_select_db($db); $rowset = PMA_DBI_query('SHOW TABLES FROM ' . PMA_backquote($db) . ';', null, PMA_DBI_QUERY_STORE); $count = 0; -while ($row = PMA_DBI_fetch_assoc($rowset)) { - $myfieldname = 'Tables_in_' . htmlspecialchars($db); - $table = $row[$myfieldname]; +while ($row = PMA_DBI_fetch_row($rowset)) { + $table = $row[0]; $comments = PMA_getComments($db, $table); echo '
' . "\n"; From c4ae361ecb6f50e61bc477891802ce7cf2da11ae Mon Sep 17 00:00:00 2001 From: Piotr Przybylski Date: Fri, 17 Jun 2011 20:47:40 +0200 Subject: [PATCH 2/2] Formatting --- server_status.php | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/server_status.php b/server_status.php index 7321ce1102..fd3eb08d0f 100644 --- a/server_status.php +++ b/server_status.php @@ -25,7 +25,7 @@ require_once './libraries/common.inc.php'; */ function PMA_choose_refresh_rate() { echo ''; - foreach(array(1, 2, 5, 1, 20, 40, 60, 120, 300, 600) as $key => $rate) { + foreach (array(1, 2, 5, 20, 40, 60, 120, 300, 600) as $rate) { if ($rate % 60 == 0) { $minrate = $rate / 60; echo ''; @@ -44,7 +44,7 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) { header('Content-Type: text/html; charset=UTF-8'); // real-time charting data - if(isset($_REQUEST['chart_data'])) { + if (isset($_REQUEST['chart_data'])) { switch($_REQUEST['type']) { case 'proc': $c = PMA_DBI_fetch_result('SHOW GLOBAL STATUS WHERE Variable_name="Connections"', 0, 1); @@ -64,7 +64,7 @@ if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) { // admin commands are not queries unset($queries['Com_admin_commands']); - $sum=array_sum($queries); + $sum = array_sum($queries); $ret = array( 'x' => microtime(true)*1000, 'y' => $sum, @@ -332,9 +332,9 @@ $allocationMap = array(); // sort vars into arrays foreach ($server_status as $name => $value) { foreach ($allocations as $filter => $section) { - if (strpos($name, $filter) !== FALSE) { + if (strpos($name, $filter) !== false) { $allocationMap[$name] = $section; - if($section == 'com' && $value > 0) $used_queries[$name] = $value; + if ($section == 'com' && $value > 0) $used_queries[$name] = $value; break; // Only exits inner loop } } @@ -344,7 +344,7 @@ foreach ($server_status as $name => $value) { unset($used_queries['Com_admin_commands']); /* Ajax request refresh */ -if(isset($_REQUEST['show']) && isset($_REQUEST['ajax_request'])) { +if (isset($_REQUEST['show']) && isset($_REQUEST['ajax_request'])) { switch($_REQUEST['show']) { case 'query_statistics': printQueryStatistics(); @@ -389,8 +389,9 @@ pma_theme_image = ''; /** * Displays the sub-page heading */ -if($GLOBALS['cfg']['MainPageIconic']) +if ($GLOBALS['cfg']['MainPageIconic']) { echo ''; +} echo __('Runtime Information'); @@ -480,7 +481,7 @@ echo __('Runtime Information'); echo ' '; $i=0; foreach ($section_links as $link_name => $link_url) { - if($i > 0) echo ', '; + if ($i > 0) echo ', '; if ('doc' == $link_name) { echo PMA_showMySQLDocu($link_url, $link_url); } else { @@ -526,7 +527,7 @@ function printQueryStatistics() { echo PMA_formatNumber( $total_queries * 60 / $server_status['Uptime'], 0); echo '
'; - if($total_queries / $server_status['Uptime'] >= 1) { + if ($total_queries / $server_status['Uptime'] >= 1) { echo 'ø'.__('per second').':'; echo PMA_formatNumber( $total_queries / $server_status['Uptime'], 0); ?> @@ -569,9 +570,9 @@ function printQueryStatistics() { // For the percentage column, use Questions - Connections, because // the number of connections is not an item of the Query types // but is included in Questions. Then the total of the percentages is 100. - $name = str_replace(Array('Com_', '_'), Array('', ' '), $name); + $name = str_replace(array('Com_', '_'), array('', ' '), $name); - if($value < $query_sum * 0.02) + if ($value < $query_sum * 0.02) $other_sum += $value; else $chart_json[$name] = $value; ?> @@ -591,7 +592,7 @@ function printQueryStatistics() {
0) + if ($other_sum > 0) $chart_json[__('Other')] = $other_sum; echo json_encode($chart_json); @@ -807,12 +808,12 @@ function printServerTraffic() { $v) { $k = $k !== 'DB' - ? $k = ucfirst(strtolower($k)) + ? ucfirst(strtolower($k)) : 'db'; $process[$k] = $v; }