diff --git a/querywindow.php b/querywindow.php
index b6b24fd2e..7402fbe56 100644
--- a/querywindow.php
+++ b/querywindow.php
@@ -1,7 +1,44 @@
';
+
+ if ('both' === $GLOBALS['cfg']['PropertiesIconic']) {
+ $titles['Change'] .= $GLOBALS['strChange'];
+ }
+} else {
+ $titles['Change'] = $GLOBALS['strChange'];
+}
+
+
+// Hidden forms and query frame interaction stuff
+if (PMA_isValid($_REQUEST['query_history_latest'])) {
+ $sql_query = $_REQUEST['query_history_latest'];
+ $db = PMA_ifSetOr($_REQUEST['query_history_latest_db'], '');
+ $table = PMA_ifSetOr($_REQUEST['query_history_latest_table'], '');
+}
+
+$url_query = PMA_generate_common_url($db, $table);
+
+if (PMA_isValid($sql_query)) {
+ $show_query = 1;
+}
+
+if ($no_js) {
+ // ... we redirect to appropriate query sql page
+ // works only full if $db and $table is also stored/grabbed from $_COOKIE
+ if (strlen($table)) {
+ require './tbl_sql.php';
+ } elseif (strlen($db)) {
+ require './db_sql.php';
+ } else {
+ require './server_sql.php';
+ }
+ exit;
+}
+
+/**
+ * Defines the query to be displayed in the query textarea
+ */
+if (! empty($show_query)) {
+ $query_to_display = $sql_query;
+} else {
+ $query_to_display = '';
+}
+unset($sql_query);
+
+/**
+ * start HTML output
+ */
require_once './libraries/header_http.inc.php';
require_once './libraries/header_meta_style.inc.php';
?>
-
-
+
-
>
+
';
-
- if ('both' === $GLOBALS['cfg']['PropertiesIconic']) {
- $titles['Change'] .= $strChange;
- }
-} else {
- $titles['Change'] = $strChange;
-}
-
-// Hidden forms and query frame interaction stuff
-
-if (! empty($query_history_latest) && ! empty($query_history_latest_db)) {
- if ($GLOBALS['cfg']['QueryHistoryDB'] && $cfgRelation['historywork']) {
- PMA_setHistory((isset($query_history_latest_db) ? $query_history_latest_db : ''),
- (isset($query_history_latest_table) ? $query_history_latest_table : ''),
- $GLOBALS['cfg']['Server']['user'],
- $query_history_latest);
- }
-
- $_input_query_history[$query_history_latest] = array(
- 'db' => $query_history_latest_db,
- 'table' => isset($query_history_latest_table) ? $query_history_latest_table : '',
- );
-
- $_sql_history[$query_history_latest] = array(
- 'db' => $query_history_latest_db,
- 'table' => isset($query_history_latest_table) ? $query_history_latest_table : '',
- );
-
- $sql_query = $query_history_latest;
- $db = $query_history_latest_db;
- $table = $query_history_latest_table;
-} elseif (! empty($query_history_latest)) {
- $sql_query = $query_history_latest;
-}
-
-if (isset($sql_query)) {
- $show_query = 1;
-}
-
-if ($GLOBALS['cfg']['QueryHistoryDB'] && $cfgRelation['historywork']) {
-
- $temp_history = PMA_getHistory($GLOBALS['cfg']['Server']['user']);
- if (is_array($temp_history) && count($temp_history) > 0) {
- foreach ($temp_history AS $history_nr => $history_array) {
- if (! isset($_sql_history[$history_array['sqlquery']])) {
- $_sql_history[$history_array['sqlquery']] = array(
- 'db' => $history_array['db'],
- 'table' => isset($history_array['table']) ? $history_array['table'] : '',
- );
- }
- }
- }
-
-} else {
-
- if (isset($query_history) && is_array($query_history)) {
- $current_index = count($query_history);
- foreach ($query_history AS $query_no => $query_sql) {
- if (! isset($_input_query_history[$query_sql])) {
- $_input_query_history[$query_sql] = array(
- 'db' => $query_history_db[$query_no],
- 'table' => isset($query_history_table[$query_no]) ? $query_history_table[$query_no] : '',
- );
- $_sql_history[$query_sql] = array(
- 'db' => $query_history_db[$query_no],
- 'table' => isset($query_history_table[$query_no]) ? $query_history_table[$query_no] : '',
- );
- } // end if check if this item exists
- } // end while print history
- } // end if history exists
-} // end if DB-based history
-
-$url_query = PMA_generate_common_url(isset($db) ? $db : '', isset($table) ? $table : '');
-if (!isset($goto)) {
- $goto = '';
-}
-
-require_once './libraries/bookmark.lib.php';
-
-if (isset($no_js) && $no_js) {
- // ... we redirect to appropriate query sql page
- // works only full if $db and $table is also stored/grabbed from $_COOKIE
- if (isset($table) && strlen($table)) {
- require './tbl_sql.php';
- } elseif (isset($db) && strlen($db)) {
- require './db_sql.php';
- } else {
- require './server_sql.php';
- }
- exit;
-}
-
-/**
- * Defines the query to be displayed in the query textarea
- */
-if (! empty($show_query)) {
- $query_to_display = $sql_query;
-} else {
- $query_to_display = '';
-}
-unset($sql_query);
-
PMA_sqlQueryForm($query_to_display, $querydisplay_tab);
// Hidden forms and query frame interaction stuff
-if (isset($auto_commit) && $auto_commit == 'true') {
-?>
-
- 0
- && ($querydisplay_tab == 'history' || $querydisplay_tab == 'full')) {
- $tab = isset($querydisplay_tab) && $querydisplay_tab != 'full' ? 'sql' : 'full';
- echo $strQuerySQLHistory . ':
' . "\n"
+$_sql_history = PMA_getHistory($GLOBALS['cfg']['Server']['user']);
+if (! empty($_sql_history)
+ && ($querydisplay_tab == 'history' || $querydisplay_tab == 'full')) {
+ $tab = $querydisplay_tab != 'full' ? 'sql' : 'full';
+ echo $GLOBALS['strQuerySQLHistory'] . ':
' . "\n"
.'
';
- foreach ($_sql_history as $sql => $query) {
+ foreach ($_sql_history as $query) {
echo '- ' . "\n";
// edit link
echo '' . $titles['Change'] . '';
- // execute link
+ // execute link
echo '[' . htmlspecialchars($query['db']) . '] '
- . htmlspecialchars($sql) . '' . "\n";
-
+ .' return false;">';
+ if (! empty($query['db'])) {
+ echo '[';
+ echo htmlspecialchars(PMA_backquote($query['db']));
+ if (! empty($query['table'])) {
+ echo '.' . htmlspecialchars(PMA_backquote($query['table']));
+ }
+ echo '] ';
+ }
+ if (strlen($query['sqlquery']) > 120) {
+ echo '';
+ echo htmlspecialchars(substr($query['sqlquery'], 0, 50)) . ' [...] ';
+ echo htmlspecialchars(substr($query['sqlquery'], -50));
+ echo '';
+ } else {
+ echo htmlspecialchars($query['sqlquery']);
+ }
+ echo '' . "\n";
echo '
' . "\n";
}
- unset($tab, $_sql_history, $sql, $query);
+ unset($tab, $_sql_history, $query);
echo '
' . "\n";
}
?>
-
-