diff --git a/libraries/common.lib.php3 b/libraries/common.lib.php3
index c4bea502f..3b1c4988b 100644
--- a/libraries/common.lib.php3
+++ b/libraries/common.lib.php3
@@ -927,21 +927,23 @@ if (typeof(document.getElementById) != 'undefined'
" and not " ")
- // if we want to show some sql code it is easiest to create it here
+ // If we want to show some sql code it is easiest to create it here
$sqlnr = 1;
- if(isset($GLOBALS['showasphp'])){$showasphp = &$GLOBALS['showasphp'];}
- if(isset($showasphp) and ($showasphp=='true')){
- $new_line = '"; ' . "\n" . ' $sql .= "';
- }else{
- $new_line = ' ' . "\n" . ' ';
+ if (!empty($GLOBALS['show_as_php'])) {
+ $new_line = '"; ' . "\n" . ' $sql .= "';
+ } else {
+ $new_line = ' ' . "\n" . ' ';
}
- $query_base = htmlspecialchars($GLOBALS['sql_query']);
- $query_base = ereg_replace("((\015\012)|(\015)|(\012))+", $new_line, $query_base);
- if(isset($showasphp) and ($showasphp=='true')){
- $query_base = '$sql = "'.$query_base;
+ $query_base = htmlspecialchars($GLOBALS['sql_query']);
+ $query_base = ereg_replace("((\015\012)|(\015)|(\012))+", $new_line, $query_base);
+ if (!empty($GLOBALS['show_as_php'])) {
+ $query_base = '$sql = "' . $query_base;
}
+
+ // Prepares links that may be displayed to edit/explain the query
if (!isset($GLOBALS['show_query']) || $GLOBALS['show_query'] != 'y') {
if (!isset($GLOBALS['goto'])) {
$edit_target = (isset($GLOBALS['table'])) ? 'tbl_properties.php3' : 'db_details.php3';
@@ -951,29 +953,32 @@ if (typeof(document.getElementById) != 'undefined'
$edit_target = '';
}
if ($edit_target == 'tbl_properties.php3') {
- $edit_link = '' . $GLOBALS['strEdit'] . '';
+ $edit_link = '' . $GLOBALS['strEdit'] . '';
} else if ($edit_target != '') {
- $edit_link = '' . $GLOBALS['strEdit'] . '';
+ $edit_link = '' . $GLOBALS['strEdit'] . '';
}
- // want to have the query explained (Mike Beck 2002-05-22)
+ // Want to have the query explained (Mike Beck 2002-05-22)
// but do not explain an explain (lem9)
- //
- if (!ereg('EXPLAIN',$GLOBALS['sql_query'])) {;
- $explain_link='[' . $GLOBALS['strExplain'] . '] ';
+ if (!eregi('^EXPLAIN[[:space:]]+', $GLOBALS['sql_query'])) {
+ $explain_link = '[' . $GLOBALS['strExplain'] . '] ';
} else {
- $explain_link='';
+ $explain_link = '';
}
- // Also i would like to get the SQL formed in some nice php-code (Mike Beck 2002-05-22)
- if(isset($showasphp) and ($showasphp=='true')){
- $php_link ='' . $GLOBALS['strNoPhp'] . '';
- }else{
- $php_link ='' . $GLOBALS['strPhp'] . '';
+ // Also we would like to get the SQL formed in some nice
+ // php-code (Mike Beck 2002-05-22)
+ if (!empty($GLOBALS['show_as_php'])) {
+ $php_link = '' . $GLOBALS['strNoPhp'] . '';
+ } else {
+ $php_link = '' . $GLOBALS['strPhp'] . '';
}
}
+
+ // Displays the message
+ echo ' ' . $GLOBALS['strSQLQuery'] . ' :';
if (!empty($edit_target)) {
- echo ' ' . $GLOBALS['strSQLQuery'] . ' : [' . $edit_link . '] ' . $explain_link . '[' . $php_link . '] ' . "\n";
+ echo ' [' . $edit_link . '] ' . $explain_link . '[' . $php_link . '] ' . "\n";
} else {
- echo ' ' . $GLOBALS['strSQLQuery'] . ' : ' . "\n";
+ echo ' ' . "\n";
}
echo ' ' . $query_base;
// If a 'LIMIT' clause has been programatically added to the query
@@ -981,9 +986,9 @@ if (typeof(document.getElementById) != 'undefined'
if (!empty($GLOBALS['sql_limit_to_append'])) {
echo $GLOBALS['sql_limit_to_append'];
}
+ if (!empty($GLOBALS['show_as_php'])) {
+ echo '";';
}
- if(isset($showasphp) and ($showasphp=='true')){
- echo '";';
echo "\n";
?>
|