aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes
diff options
context:
space:
mode:
authorMeik Sievertsen <acydburn@phpbb.com>2006-04-23 14:23:22 +0000
committerMeik Sievertsen <acydburn@phpbb.com>2006-04-23 14:23:22 +0000
commitde4299c81c010c6382a3d017cde8f2c3c957b91f (patch)
tree0435da41b52907e1b6c0739773a12dc980a35017 /phpBB/includes
parentd6af193b53ac4a3b9dff78254f4da9f4cd5f9337 (diff)
downloadforums-de4299c81c010c6382a3d017cde8f2c3c957b91f.tar
forums-de4299c81c010c6382a3d017cde8f2c3c957b91f.tar.gz
forums-de4299c81c010c6382a3d017cde8f2c3c957b91f.tar.bz2
forums-de4299c81c010c6382a3d017cde8f2c3c957b91f.tar.xz
forums-de4299c81c010c6382a3d017cde8f2c3c957b91f.zip
- build explain links a bit different...
- fix btn_ip reference (it is btn_info now) - removed sql_report.css (we use the acp css) - updated the sql report layout git-svn-id: file:///svn/phpbb/trunk@5838 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes')
-rw-r--r--phpBB/includes/acp/acp_styles.php2
-rw-r--r--phpBB/includes/db/dbal.php100
-rw-r--r--phpBB/includes/functions.php6
3 files changed, 59 insertions, 49 deletions
diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php
index 5b2a8fdfc9..036df4d8b7 100644
--- a/phpBB/includes/acp/acp_styles.php
+++ b/phpBB/includes/acp/acp_styles.php
@@ -454,7 +454,7 @@ pagination_sep = \'{PAGINATION_SEP}\'
'site_logo',
),
'buttons' => array(
- 'btn_post', 'btn_reply', 'btn_locked', 'btn_quote', 'btn_edit', 'btn_delete', 'btn_report', 'btn_post_pm', 'btn_reply_pm', 'btn_profile', 'btn_pm', 'btn_ip', 'btn_search', 'btn_email', 'btn_www', 'btn_icq', 'btn_aim', 'btn_yim', 'btn_msnm', 'btn_jabber', 'btn_online', 'btn_offline',
+ 'btn_post', 'btn_reply', 'btn_locked', 'btn_quote', 'btn_edit', 'btn_delete', 'btn_report', 'btn_post_pm', 'btn_reply_pm', 'btn_profile', 'btn_pm', 'btn_info', 'btn_search', 'btn_email', 'btn_www', 'btn_icq', 'btn_aim', 'btn_yim', 'btn_msnm', 'btn_jabber', 'btn_online', 'btn_offline',
),
'icons' => array(
'icon_unapproved', 'icon_reported', 'icon_attach', 'icon_post', 'icon_post_new', 'icon_post_latest', 'icon_post_newest',),
diff --git a/phpBB/includes/db/dbal.php b/phpBB/includes/db/dbal.php
index 1a6b6f25a4..acc64da799 100644
--- a/phpBB/includes/db/dbal.php
+++ b/phpBB/includes/db/dbal.php
@@ -277,43 +277,42 @@ class dbal
$mtime = explode(' ', microtime());
$totaltime = $mtime[0] + $mtime[1] - $starttime;
- echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
- echo '<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr">';
- echo '<head>';
- echo '<meta http-equiv="content-type" content="text/html; charset=utf-8" />';
- echo '<title>SQL Report</title>';
- echo '<link href="' . $phpbb_root_path . 'adm/style/admin.css" rel="stylesheet" type="text/css" media="screen" />';
- echo '<link href="' . $phpbb_root_path . 'adm/style/sql_report.css" rel="stylesheet" type="text/css" media="screen" />';
- echo '</head>';
- echo '<body id="errorpage">';
- echo '<div id="wrap">';
- echo ' <div id="page-header">';
- echo ' <a href="' . htmlspecialchars(preg_replace('/&explain=([^&]*)/', '', $_SERVER['REQUEST_URI'])) . '">Return to previous page</a>';
- echo ' </div>';
- echo ' <div id="page-body">';
- echo ' <div class="panel">';
- echo ' <span class="corners-top"><span></span></span>';
- echo ' <div id="content">';
- echo ' <h1>SQL Report</h1>';
- echo ' <table width="95%" cellspacing="1" cellpadding="4" border="0" align="center"><tr>
- <td height="40" align="center" valign="middle"><b>Page generated in ' . round($totaltime, 4) . " seconds with {$this->num_queries} queries" . (($this->cache_num_queries) ? " + {$this->cache_num_queries} " . (($this->cache_num_queries == 1) ? 'query' : 'queries') . ' returning data from cache' : '') . '</b></td>
- </tr><tr>
- <td align="center" nowrap="nowrap">Time spent on MySQL queries: <b>' . round($this->sql_time, 5) . 's</b> | Time spent on PHP: <b>' . round($totaltime - $this->sql_time, 5) . 's</b></td>
- </tr></table>
- <table width="95%" cellspacing="1" cellpadding="4" border="0" align="center"><tr>
- <td>' . $this->sql_report . '</td>
- </tr></table>';
- echo ' </div>';
- echo ' <span class="corners-bottom"><span></span></span>';
- echo ' </div>';
- echo ' </div>';
- echo ' <div id="page-footer">';
- echo ' Powered by phpBB &copy; ' . date('Y') . ' <a href="http://www.phpbb.com/">phpBB Group</a>';
- echo ' </div>';
- echo '</div>';
- echo '</body>';
- echo '</html>';
-
+ echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+ <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr">
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="Content-Style-Type" content="text/css" />
+ <meta http-equiv="imagetoolbar" content="no" />
+ <title>SQL Report</title>
+ <link href="' . $phpbb_root_path . 'adm/style/admin.css" rel="stylesheet" type="text/css" media="screen" />
+ </head>
+ <body id="errorpage">
+ <div id="wrap">
+ <div id="page-header">
+ <a href="' . htmlspecialchars(preg_replace('/&explain=([^&]*)/', '', $_SERVER['REQUEST_URI'])) . '">Return to previous page</a>
+ </div>
+ <div id="page-body">
+ <div class="panel">
+ <span class="corners-top"><span></span></span>
+ <div id="content">
+ <h1>SQL Report</h1>
+ <br />
+ <p><b>Page generated in ' . round($totaltime, 4) . " seconds with {$this->num_queries} queries" . (($this->cache_num_queries) ? " + {$this->cache_num_queries} " . (($this->cache_num_queries == 1) ? 'query' : 'queries') . ' returning data from cache' : '') . '</b></p>
+
+ <p>Time spent on MySQL queries: <b>' . round($this->sql_time, 5) . 's</b> | Time spent on PHP: <b>' . round($totaltime - $this->sql_time, 5) . 's</b></p>
+
+ <br /><br />
+ ' . $this->sql_report . '
+ </div>
+ <span class="corners-bottom"><span></span></span>
+ </div>
+ </div>
+ <div id="page-footer">
+ Powered by phpBB &copy; ' . date('Y') . ' <a href="http://www.phpbb.com/">phpBB Group</a>
+ </div>
+ </div>
+ </body>
+ </html>';
exit;
break;
@@ -322,17 +321,22 @@ class dbal
$endtime = $endtime[0] + $endtime[1];
$this->sql_report .= '
- <hr width="100%"/><br />
- <table class="bg" width="100%" cellspacing="1" cellpadding="4" border="0">
+ <table cellspacing="1">
+ <thead>
<tr>
<th>Query #' . $this->num_queries . '</th>
</tr>
+ </thead>
+ <tbody>
<tr>
- <td class="row1"><textarea style="font-family:\'Courier New\',monospace;width:100%" rows="5">' . preg_replace('/\t(AND|OR)(\W)/', "\$1\$2", htmlspecialchars(preg_replace('/[\s]*[\n\r\t]+[\n\r\s\t]*/', "\n", $query))) . '</textarea></td>
+ <td class="row3"><textarea style="font-family:\'Courier New\',monospace;width:99%" rows="5" cols="10">' . preg_replace('/\t(AND|OR)(\W)/', "\$1\$2", htmlspecialchars(preg_replace('/[\s]*[\n\r\t]+[\n\r\s\t]*/', "\n", $query))) . '</textarea></td>
</tr>
- </table> ' . $this->html_hold . '
- <p align="center">
+ </table>
+
+ ' . $this->html_hold . '
+
+ <p style="text-align: center;">
';
if ($this->query_result)
@@ -349,7 +353,7 @@ class dbal
$this->sql_report .= '<b style="color: red">FAILED</b> - ' . SQL_LAYER . ' Error ' . $error['code'] . ': ' . htmlspecialchars($error['message']);
}
- $this->sql_report .= '</p>';
+ $this->sql_report .= '</p><br /><br />';
$this->sql_time += $endtime - $this->curtime;
break;
@@ -373,11 +377,11 @@ class dbal
if (!$html_table && sizeof($row))
{
$html_table = true;
- $this->html_hold .= '<table class="bg" width="100%" cellspacing="1" cellpadding="4" border="0" align="center"><tr>';
+ $this->html_hold .= '<table cellspacing="1"><tr>';
foreach (array_keys($row) as $val)
{
- $this->html_hold .= '<th nowrap="nowrap">' . (($val) ? ucwords(str_replace('_', ' ', $val)) : '&nbsp;') . '</th>';
+ $this->html_hold .= '<th>' . (($val) ? ucwords(str_replace('_', ' ', $val)) : '&nbsp;') . '</th>';
}
$this->html_hold .= '</tr>';
}
@@ -412,8 +416,10 @@ class dbal
$time_db = $splittime - $endtime;
$color = ($time_db > $time_cache) ? 'green' : 'red';
- $this->sql_report .= '<hr width="100%"/><br /><table class="bg" width="100%" cellspacing="1" cellpadding="4" border="0"><tr><th>Query results obtained from the cache</th></tr><tr><td class="row1"><textarea style="font-family:\'Courier New\',monospace;width:100%" rows="5">' . preg_replace('/\t(AND|OR)(\W)/', "\$1\$2", htmlspecialchars(preg_replace('/[\s]*[\n\r\t]+[\n\r\s\t]*/', "\n", $query))) . '</textarea></td></tr></table><p align="center">';
- $this->sql_report .= 'Before: ' . sprintf('%.5f', $this->curtime - $starttime) . 's | After: ' . sprintf('%.5f', $endtime - $starttime) . 's | Elapsed [cache]: <b style="color: ' . $color . '">' . sprintf('%.5f', ($time_cache)) . 's</b> | Elapsed [db]: <b>' . sprintf('%.5f', $time_db) . 's</b></p>';
+ $this->sql_report .= '<table cellspacing="1"><thead><tr><th>Query results obtained from the cache</th></tr></thead><tbody><tr>';
+ $this->sql_report .= '<td class="row3"><textarea style="font-family:\'Courier New\',monospace;width:99%" rows="5" cols="10">' . preg_replace('/\t(AND|OR)(\W)/', "\$1\$2", htmlspecialchars(preg_replace('/[\s]*[\n\r\t]+[\n\r\s\t]*/', "\n", $query))) . '</textarea></td></tr></tbody></table>';
+ $this->sql_report .= '<p style="text-align: center;">';
+ $this->sql_report .= 'Before: ' . sprintf('%.5f', $this->curtime - $starttime) . 's | After: ' . sprintf('%.5f', $endtime - $starttime) . 's | Elapsed [cache]: <b style="color: ' . $color . '">' . sprintf('%.5f', ($time_cache)) . 's</b> | Elapsed [db]: <b>' . sprintf('%.5f', $time_db) . 's</b></p><br /><br />';
// Pad the start time to not interfere with page timing
$starttime += $time_db;
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index 1fe1082ea5..699dd4c9f5 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -2612,7 +2612,11 @@ function page_footer()
}
}
- $debug_output .= ' | <a href="' . (($_SERVER['REQUEST_URI']) ? htmlspecialchars($_SERVER['REQUEST_URI']) : "index.$phpEx$SID") . ((strpos($_SERVER['REQUEST_URI'], '?') !== false) ? '&amp;' : '?') . 'explain=1">Explain</a>';
+ $explain_url = $phpbb_root_path . str_replace('&', '&amp;', $user->page['page']);
+ $explain_url = (strpos($explain_url, '?') !== false) ? str_replace('?', $SID . '&amp;', $explain_url) : $explain_url . '?' . str_replace('?', '', $SID);
+ $explain_url .= ((strpos($explain_url, '?') === false) ? '?' : '&amp;') . 'explain=1';
+
+ $debug_output .= ' | <a href="' . $explain_url . '>Explain</a>';
}
}