Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 328 lines (275 sloc) 17.073 kB
dd6345c Display a (javascript) based query window as a new frame below the left
Garvin Hicking authored
1 <?php
2 /* $Id$ */
3 // vim: expandtab sw=4 ts=4 sts=4:
4
5
6 /**
7 * Gets the variables sent to this script, retains the db name that may have
8 * been defined as startup option and include a core library
9 */
37d50c1 @derrabus Huge set of optimizations, please test!
derrabus authored
10 require_once('./libraries/grab_globals.lib.php');
dd6345c Display a (javascript) based query window as a new frame below the left
Garvin Hicking authored
11 if (!empty($db)) {
12 $db_start = $db;
13 }
14
15
16 /**
17 * Gets a core script and starts output buffering work
18 */
37d50c1 @derrabus Huge set of optimizations, please test!
derrabus authored
19 require_once('./libraries/common.lib.php');
b874154 moved all code for queryboxes into libraries/sql_query_form.lib.php, …
Sebastian Mendel authored
20 require_once './libraries/sql_query_form.lib.php';
37d50c1 @derrabus Huge set of optimizations, please test!
derrabus authored
21 require_once('./libraries/ob.lib.php');
dd6345c Display a (javascript) based query window as a new frame below the left
Garvin Hicking authored
22 if ($cfg['OBGzip']) {
23 $ob_mode = PMA_outBufferModeGet();
24 if ($ob_mode) {
25 PMA_outBufferPre($ob_mode);
26 }
27 }
28
37d50c1 @derrabus Huge set of optimizations, please test!
derrabus authored
29 require_once('./libraries/relation.lib.php');
dd6345c Display a (javascript) based query window as a new frame below the left
Garvin Hicking authored
30 $cfgRelation = PMA_getRelationsParam();
31
32 /**
33 * Get the list and number of available databases.
34 * Skipped if no server selected: in this case no database should be displayed
35 * before the user choose among available ones at the welcome screen.
36 */
37 if ($server > 0) {
6884f97 @nijel no more support for php3
nijel authored
38 PMA_availableDatabases(); // this function is defined in "common.lib.php"
dd6345c Display a (javascript) based query window as a new frame below the left
Garvin Hicking authored
39 } else {
40 $num_dbs = 0;
41 }
42
35702c9 Hooray for stylesheets.
Garvin Hicking authored
43 // garvin: For re-usability, moved http-headers and stylesheets
6884f97 @nijel no more support for php3
nijel authored
44 // to a seperate file. It can now be included by header.inc.php,
45 // queryframe.php, querywindow.php.
dd6345c Display a (javascript) based query window as a new frame below the left
Garvin Hicking authored
46
37d50c1 @derrabus Huge set of optimizations, please test!
derrabus authored
47 require_once('./libraries/header_http.inc.php');
48 require_once('./libraries/header_meta_style.inc.php');
dd6345c Display a (javascript) based query window as a new frame below the left
Garvin Hicking authored
49 ?>
50
37d50c1 @derrabus Huge set of optimizations, please test!
derrabus authored
51 <script type="text/javascript" language="javascript">
f1cbd50 @nijel Fix javascript error (bug #946823).
nijel authored
52 <!--
dd6345c Display a (javascript) based query window as a new frame below the left
Garvin Hicking authored
53 function query_auto_commit() {
54 document.sqlform.submit();
55 }
56
4d878ae See Changelog: Lightweight tabs, DB-based SQL history, tabbed querywi…
Garvin Hicking authored
57 function query_tab_commit(tab) {
58 document.querywindow.querydisplay_tab.value = tab;
59 document.querywindow.submit();
60 return false;
61 }
62
dd6345c Display a (javascript) based query window as a new frame below the left
Garvin Hicking authored
63 // js form validation stuff
d9a2161 @lem9 redesign part 3
lem9 authored
64 /**/
dd6345c Display a (javascript) based query window as a new frame below the left
Garvin Hicking authored
65 var errorMsg0 = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strFormEmpty']); ?>';
66 var errorMsg1 = '<?php echo str_replace('\'', '\\\'', $GLOBALS['strNotNumber']); ?>';
67 var noDropDbMsg = '<?php echo((!$GLOBALS['cfg']['AllowUserDropDatabase']) ? str_replace('\'', '\\\'', $GLOBALS['strNoDropDatabases']) : ''); ?>';
68 var confirmMsg = '<?php echo(($GLOBALS['cfg']['Confirm']) ? str_replace('\'', '\\\'', $GLOBALS['strDoYouReally']) : ''); ?>';
d9a2161 @lem9 redesign part 3
lem9 authored
69 /**/
64bd56d @nijel Support for browsing selected columns (RFE #1275909).
nijel authored
70
71 <?php
b874154 moved all code for queryboxes into libraries/sql_query_form.lib.php, …
Sebastian Mendel authored
72 if ( empty( $querydisplay_tab ) ) {
64bd56d @nijel Support for browsing selected columns (RFE #1275909).
nijel authored
73 ?>
74 function resize() {
b874154 moved all code for queryboxes into libraries/sql_query_form.lib.php, …
Sebastian Mendel authored
75
76 // for Gecko
77 if ( typeof( self.sizeToContent ) == 'function' ) {
64bd56d @nijel Support for browsing selected columns (RFE #1275909).
nijel authored
78 self.sizeToContent();
b874154 moved all code for queryboxes into libraries/sql_query_form.lib.php, …
Sebastian Mendel authored
79 //self.scrollbars.visible = false;
80 // give some more space ... to prevent 'fli(pp/ck)ing'
81 self.resizeBy( 10, 50 );
64bd56d @nijel Support for browsing selected columns (RFE #1275909).
nijel authored
82 return;
83 }
84
b874154 moved all code for queryboxes into libraries/sql_query_form.lib.php, …
Sebastian Mendel authored
85 // for IE, Opera
64bd56d @nijel Support for browsing selected columns (RFE #1275909).
nijel authored
86 if (document.getElementById && typeof(document.getElementById('querywindowcontainer')) != 'undefined' ) {
87
88 // get content size
89 var newWidth = document.getElementById('querywindowcontainer').offsetWidth;
90 var newHeight = document.getElementById('querywindowcontainer').offsetHeight;
91
b874154 moved all code for queryboxes into libraries/sql_query_form.lib.php, …
Sebastian Mendel authored
92 // set size to contentsize
93 // plus some offset for scrollbars, borders, statusbar, menus ...
94 self.resizeTo( newWidth + 45, newHeight + 75 );
64bd56d @nijel Support for browsing selected columns (RFE #1275909).
nijel authored
95 }
96 }
97 <?php
98 }
99 ?>
dd6345c Display a (javascript) based query window as a new frame below the left
Garvin Hicking authored
100 //-->
101 </script>
102 <script src="libraries/functions.js" type="text/javascript" language="javascript"></script>
103 </head>
104
64bd56d @nijel Support for browsing selected columns (RFE #1275909).
nijel authored
105 <body id="bodyquerywindow" onload="resize();" bgcolor="<?php echo ($cfg['QueryFrameJS'] ? $cfg['LeftBgColor'] : $cfg['RightBgColor']); ?>">
106 <div id="querywindowcontainer">
dd6345c Display a (javascript) based query window as a new frame below the left
Garvin Hicking authored
107 <?php
b874154 moved all code for queryboxes into libraries/sql_query_form.lib.php, …
Sebastian Mendel authored
108 if ( $cfg['QueryFrameJS'] && !isset($no_js) ) {
210576b Fixed Bug #723955, 723736, 723713 (Query Frame)
Garvin Hicking authored
109 $querydisplay_tab = (isset($querydisplay_tab) ? $querydisplay_tab : $cfg['QueryWindowDefTab']);
37d50c1 @derrabus Huge set of optimizations, please test!
derrabus authored
110
5de17e7 @lem9 patch #1252031, CSS for navigation tabs
lem9 authored
111 $tabs = array();
112 $tabs['sql']['icon'] = 'b_sql.png';
113 $tabs['sql']['text'] = $strSQL;
114 $tabs['sql']['link'] = '#';
115 $tabs['sql']['attr'] = 'onclick="javascript:query_tab_commit(\'sql\');return false;"';
b874154 moved all code for queryboxes into libraries/sql_query_form.lib.php, …
Sebastian Mendel authored
116 $tabs['sql']['active'] = (bool) ( $querydisplay_tab == 'sql' );
5de17e7 @lem9 patch #1252031, CSS for navigation tabs
lem9 authored
117 $tabs['import']['icon'] = 'b_import.png';
118 $tabs['import']['text'] = $strImportFiles;
119 $tabs['import']['link'] = '#';
120 $tabs['import']['attr'] = 'onclick="javascript:query_tab_commit(\'files\');return false;"';
b874154 moved all code for queryboxes into libraries/sql_query_form.lib.php, …
Sebastian Mendel authored
121 $tabs['import']['active'] = (bool) ( $querydisplay_tab == 'files' );
5de17e7 @lem9 patch #1252031, CSS for navigation tabs
lem9 authored
122 $tabs['history']['text'] = $strQuerySQLHistory;
123 $tabs['history']['link'] = '#';
124 $tabs['history']['attr'] = 'onclick="javascript:query_tab_commit(\'history\');return false;"';
b874154 moved all code for queryboxes into libraries/sql_query_form.lib.php, …
Sebastian Mendel authored
125 $tabs['history']['active'] = (bool) ( $querydisplay_tab == 'history' );
4d878ae See Changelog: Lightweight tabs, DB-based SQL history, tabbed querywi…
Garvin Hicking authored
126
b874154 moved all code for queryboxes into libraries/sql_query_form.lib.php, …
Sebastian Mendel authored
127 if ( $cfg['QueryWindowDefTab'] == 'full' ) {
5de17e7 @lem9 patch #1252031, CSS for navigation tabs
lem9 authored
128 $tabs['all']['text'] = $strAll;
129 $tabs['all']['link'] = '#';
130 $tabs['all']['attr'] = 'onclick="javascript:query_tab_commit(\'full\');return false;"';
b874154 moved all code for queryboxes into libraries/sql_query_form.lib.php, …
Sebastian Mendel authored
131 $tabs['all']['active'] = (bool) ( $querydisplay_tab == 'full' );
210576b Fixed Bug #723955, 723736, 723713 (Query Frame)
Garvin Hicking authored
132 }
4d878ae See Changelog: Lightweight tabs, DB-based SQL history, tabbed querywi…
Garvin Hicking authored
133
5de17e7 @lem9 patch #1252031, CSS for navigation tabs
lem9 authored
134 echo PMA_getTabs( $tabs );
135 unset( $tabs );
4d878ae See Changelog: Lightweight tabs, DB-based SQL history, tabbed querywi…
Garvin Hicking authored
136 } else {
210576b Fixed Bug #723955, 723736, 723713 (Query Frame)
Garvin Hicking authored
137 $querydisplay_tab = 'full';
4d878ae See Changelog: Lightweight tabs, DB-based SQL history, tabbed querywi…
Garvin Hicking authored
138 }
139
a199e51 @lem9 clarification
lem9 authored
140 if ($cfg['PropertiesIconic'] == true) {
141 // We need to copy the value or else the == 'both' check will always return true
142 $propicon = (string)$cfg['PropertiesIconic'];
143
144 if ($propicon == 'both') {
04229e9 @nijel Be valid XHTML.
nijel authored
145 $iconic_spacer = '<div class="nowrap">';
a199e51 @lem9 clarification
lem9 authored
146 } else {
147 $iconic_spacer = '';
148 }
149
d9a2161 @lem9 redesign part 3
lem9 authored
150 $titles['Change'] = $iconic_spacer . '<img hspace="2" width="16" height="16" src="' . $pmaThemeImage . 'b_edit.png" alt="' . $strChange . '" title="' . $strChange . '" border="0" />';
a199e51 @lem9 clarification
lem9 authored
151
152 if ($propicon == 'both') {
04229e9 @nijel Be valid XHTML.
nijel authored
153 $titles['Change'] .= '&nbsp;' . $strChange . '&nbsp;</div>';
a199e51 @lem9 clarification
lem9 authored
154 }
155 } else {
156 $titles['Change'] = $strChange;
157 }
158
dd6345c Display a (javascript) based query window as a new frame below the left
Garvin Hicking authored
159 // Hidden forms and query frame interaction stuff
160 if ($cfg['QueryFrame'] && $cfg['QueryFrameJS']) {
161
162 $input_query_history = array();
163 $sql_history = array();
164 $dup_sql = array();
165
166 if (isset($query_history_latest) && isset($query_history_latest_db) && $query_history_latest != '' && $query_history_latest_db != '') {
4d878ae See Changelog: Lightweight tabs, DB-based SQL history, tabbed querywi…
Garvin Hicking authored
167 if ($cfg['QueryHistoryDB'] && $cfgRelation['historywork']) {
168 PMA_setHistory((isset($query_history_latest_db) ? $query_history_latest_db : ''), (isset($query_history_latest_table) ? $query_history_latest_table : ''), $cfg['Server']['user'], $query_history_latest);
169 }
37d50c1 @derrabus Huge set of optimizations, please test!
derrabus authored
170
dd6345c Display a (javascript) based query window as a new frame below the left
Garvin Hicking authored
171 $input_query_history[] = '<input type="hidden" name="query_history[]" value="' . $query_history_latest . '" />';
172 $input_query_history[] = '<input type="hidden" name="query_history_db[]" value="' . htmlspecialchars($query_history_latest_db) . '" />';
173 $input_query_history[] = '<input type="hidden" name="query_history_table[]" value="' . (isset($query_history_latest_table) ? htmlspecialchars($query_history_latest_table) : '') . '" />';
174
a199e51 @lem9 clarification
lem9 authored
175 $sql_history[] = '<li>'
b3d3595 @nijel A bit more XHTML validity.
nijel authored
176 . '<a href="#" onclick="document.querywindow.querydisplay_tab.value = \'' . (isset($querydisplay_tab) && $querydisplay_tab != 'full' ? 'sql' : 'full') . '\'; document.querywindow.query_history_latest.value = \'' . preg_replace('/(\n)/i', ' ', addslashes(htmlspecialchars($query_history_latest))) . '\'; document.querywindow.auto_commit.value = \'false\'; document.querywindow.db.value = \'' . htmlspecialchars($query_history_latest_db) . '\'; document.querywindow.query_history_latest_db.value = \'' . htmlspecialchars($query_history_latest_db) . '\'; document.querywindow.table.value = \'' . (isset($query_history_latest_table) ? htmlspecialchars($query_history_latest_table) : '') . '\'; document.querywindow.query_history_latest_table.value = \'' . (isset($query_history_latest_table) ? htmlspecialchars($query_history_latest_table) : '') . '\'; document.querywindow.submit(); return false;">' . $titles['Change'] . '</a>'
177 . '&nbsp;<a href="#" onclick="document.querywindow.querydisplay_tab.value = \'' . (isset($querydisplay_tab) && $querydisplay_tab != 'full' ? 'sql' : 'full') . '\'; document.querywindow.query_history_latest.value = \'' . preg_replace('/(\n)/i', ' ', addslashes(htmlspecialchars($query_history_latest))) . '\'; document.querywindow.auto_commit.value = \'true\'; document.querywindow.db.value = \'' . htmlspecialchars($query_history_latest_db) . '\'; document.querywindow.query_history_latest_db.value = \'' . htmlspecialchars($query_history_latest_db) . '\'; document.querywindow.table.value = \'' . (isset($query_history_latest_table) ? htmlspecialchars($query_history_latest_table) : '') . '\'; document.querywindow.query_history_latest_table.value = \'' . (isset($query_history_latest_table) ? htmlspecialchars($query_history_latest_table) : '') . '\'; document.querywindow.submit(); return false;">[' . htmlspecialchars($query_history_latest_db) . '] ' . urldecode($query_history_latest) . '</a>'
a199e51 @lem9 clarification
lem9 authored
178 . '</li>' . "\n";
dd6345c Display a (javascript) based query window as a new frame below the left
Garvin Hicking authored
179
180 $sql_query = urldecode($query_history_latest);
181 $db = $query_history_latest_db;
182 $table = $query_history_latest_table;
183 $dup_sql[$query_history_latest] = true;
65e4406 Bug #736197 (EDIT link for query window)
Garvin Hicking authored
184 } elseif (isset($query_history_latest) && $query_history_latest != '') {
185 $sql_query = urldecode($query_history_latest);
dd6345c Display a (javascript) based query window as a new frame below the left
Garvin Hicking authored
186 }
37d50c1 @derrabus Huge set of optimizations, please test!
derrabus authored
187
22c8c1d Bugfix for querywindow: Didn't show the latest queries.
Garvin Hicking authored
188 if (isset($sql_query)) {
189 $show_query = 1;
190 }
dd6345c Display a (javascript) based query window as a new frame below the left
Garvin Hicking authored
191
4d878ae See Changelog: Lightweight tabs, DB-based SQL history, tabbed querywi…
Garvin Hicking authored
192 if ($cfg['QueryHistoryDB'] && $cfgRelation['historywork']) {
dd6345c Display a (javascript) based query window as a new frame below the left
Garvin Hicking authored
193
4d878ae See Changelog: Lightweight tabs, DB-based SQL history, tabbed querywi…
Garvin Hicking authored
194 $temp_history = PMA_getHistory($cfg['Server']['user']);
195 if (is_array($temp_history) && count($temp_history) > 0) {
1aaa89f @nijel Little code reorganistaion (RFE #957308), removed some remaining php3…
nijel authored
196 foreach ($temp_history AS $history_nr => $history_array) {
4d878ae See Changelog: Lightweight tabs, DB-based SQL history, tabbed querywi…
Garvin Hicking authored
197 if (!isset($dup_sql[$history_array['sqlquery']])) {
a199e51 @lem9 clarification
lem9 authored
198 $sql_history[] = '<li>'
b3d3595 @nijel A bit more XHTML validity.
nijel authored
199 . '<a href="#" onclick="document.querywindow.querydisplay_tab.value = \'' . (isset($querydisplay_tab) && $querydisplay_tab != 'full' ? 'sql' : 'full') . '\'; document.querywindow.query_history_latest.value = \'' . preg_replace('/(\n)/i', ' ', addslashes(htmlspecialchars($history_array['sqlquery']))) . '\'; document.querywindow.auto_commit.value = \'false\'; document.querywindow.db.value = \'' . htmlspecialchars($history_array['db']) . '\'; document.querywindow.query_history_latest_db.value = \'' . htmlspecialchars($history_array['db']) . '\'; document.querywindow.table.value = \'' . (isset($history_array['table']) ? htmlspecialchars($history_array['table']) : '') . '\'; document.querywindow.query_history_latest_table.value = \'' . (isset($history_array['table']) ? htmlspecialchars($history_array['table']) : '') . '\'; document.querywindow.submit(); return false;">' . $titles['Change'] . '</a>'
200 . '<a href="#" onclick="document.querywindow.querydisplay_tab.value = \'' . (isset($querydisplay_tab) && $querydisplay_tab != 'full' ? 'sql' : 'full') . '\'; document.querywindow.query_history_latest.value = \'' . preg_replace('/(\n)/i', ' ', addslashes(htmlspecialchars($history_array['sqlquery']))) . '\'; document.querywindow.auto_commit.value = \'true\'; document.querywindow.db.value = \'' . htmlspecialchars($history_array['db']) . '\'; document.querywindow.query_history_latest_db.value = \'' . htmlspecialchars($history_array['db']) . '\'; document.querywindow.table.value = \'' . (isset($history_array['table']) ? htmlspecialchars($history_array['table']) : '') . '\'; document.querywindow.query_history_latest_table.value = \'' . (isset($history_array['table']) ? htmlspecialchars($history_array['table']) : '') . '\'; document.querywindow.submit(); return false;">[' . htmlspecialchars($history_array['db']) . '] ' . urldecode($history_array['sqlquery']) . '</a>'
a199e51 @lem9 clarification
lem9 authored
201 . '</li>' . "\n";
4d878ae See Changelog: Lightweight tabs, DB-based SQL history, tabbed querywi…
Garvin Hicking authored
202 $dup_sql[$history_array['sqlquery']] = true;
203 }
dd6345c Display a (javascript) based query window as a new frame below the left
Garvin Hicking authored
204 }
205 }
4d878ae See Changelog: Lightweight tabs, DB-based SQL history, tabbed querywi…
Garvin Hicking authored
206
207 } else {
37d50c1 @derrabus Huge set of optimizations, please test!
derrabus authored
208
4d878ae See Changelog: Lightweight tabs, DB-based SQL history, tabbed querywi…
Garvin Hicking authored
209 if (isset($query_history) && is_array($query_history)) {
210 $current_index = count($query_history);
1aaa89f @nijel Little code reorganistaion (RFE #957308), removed some remaining php3…
nijel authored
211 foreach ($query_history AS $query_no => $query_sql) {
4d878ae See Changelog: Lightweight tabs, DB-based SQL history, tabbed querywi…
Garvin Hicking authored
212 if (!isset($dup_sql[$query_sql])) {
37d50c1 @derrabus Huge set of optimizations, please test!
derrabus authored
213
4d878ae See Changelog: Lightweight tabs, DB-based SQL history, tabbed querywi…
Garvin Hicking authored
214 $input_query_history[] = '<input type="hidden" name="query_history[]" value="' . $query_sql . '" />';
215 $input_query_history[] = '<input type="hidden" name="query_history_db[]" value="' . htmlspecialchars($query_history_db[$query_no]) . '" />';
216 $input_query_history[] = '<input type="hidden" name="query_history_table[]" value="' . (isset($query_history_table[$query_no]) ? htmlspecialchars($query_history_table[$query_no]) : '') . '" />';
37d50c1 @derrabus Huge set of optimizations, please test!
derrabus authored
217
a199e51 @lem9 clarification
lem9 authored
218 $sql_history[] = '<li>'
b3d3595 @nijel A bit more XHTML validity.
nijel authored
219 . '<a href="#" onclick="document.querywindow.querydisplay_tab.value = \'' . (isset($querydisplay_tab) && $querydisplay_tab != 'full' ? 'sql' : 'full') . '\'; document.querywindow.query_history_latest.value = \'' . htmlspecialchars($query_sql) . '\'; document.querywindow.auto_commit.value = \'false\'; document.querywindow.db.value = \'' . htmlspecialchars($query_history_db[$query_no]) . '\'; document.querywindow.query_history_latest_db.value = \'' . htmlspecialchars($query_history_db[$query_no]) . '\'; document.querywindow.table.value = \'' . (isset($query_history_table[$query_no]) ? htmlspecialchars($query_history_table[$query_no]) : '') . '\'; document.querywindow.query_history_latest_table.value = \'' . (isset($query_history_table[$query_no]) ? htmlspecialchars($query_history_table[$query_no]) : '') . '\'; document.querywindow.submit(); return false;">' . $titles['Change'] . '</a>'
220 . '<a href="#" onclick="document.querywindow.querydisplay_tab.value = \'' . (isset($querydisplay_tab) && $querydisplay_tab != 'full' ? 'sql' : 'full') . '\'; document.querywindow.query_history_latest.value = \'' . htmlspecialchars($query_sql) . '\'; document.querywindow.auto_commit.value = \'true\'; document.querywindow.db.value = \'' . htmlspecialchars($query_history_db[$query_no]) . '\'; document.querywindow.query_history_latest_db.value = \'' . htmlspecialchars($query_history_db[$query_no]) . '\'; document.querywindow.table.value = \'' . (isset($query_history_table[$query_no]) ? htmlspecialchars($query_history_table[$query_no]) : '') . '\'; document.querywindow.query_history_latest_table.value = \'' . (isset($query_history_table[$query_no]) ? htmlspecialchars($query_history_table[$query_no]) : '') . '\'; document.querywindow.submit(); return false;">[' . htmlspecialchars($query_history_db[$query_no]) . '] ' . urldecode($query_sql) . '</a>'
a199e51 @lem9 clarification
lem9 authored
221 . '</li>' . "\n";
4d878ae See Changelog: Lightweight tabs, DB-based SQL history, tabbed querywi…
Garvin Hicking authored
222 $dup_sql[$query_sql] = true;
223 } // end if check if this item exists
224 } // end while print history
225 } // end if history exists
37d50c1 @derrabus Huge set of optimizations, please test!
derrabus authored
226
4d878ae See Changelog: Lightweight tabs, DB-based SQL history, tabbed querywi…
Garvin Hicking authored
227 } // end if DB-based history
dd6345c Display a (javascript) based query window as a new frame below the left
Garvin Hicking authored
228 }
229
230 $url_query = PMA_generate_common_url(isset($db) ? $db : '', isset($table) ? $table : '');
231 if (!isset($goto)) {
232 $goto = '';
233 }
234
37d50c1 @derrabus Huge set of optimizations, please test!
derrabus authored
235 require_once './libraries/bookmark.lib.php';
b874154 moved all code for queryboxes into libraries/sql_query_form.lib.php, …
Sebastian Mendel authored
236
237 // in case of javascript disabled in queryframe ...
238 if ( $GLOBALS['cfg']['QueryFrame'] && ! $GLOBALS['cfg']['QueryFrameJS'] ) {
239 // ... we redirect to appropriate query sql page
240 // works only full if $db and $table is also stored/grabbed from $_COOKIE
241 if ( ! empty( $table ) ) {
242 require 'tbl_properties.php';
243 }
244 elseif ( ! empty( $db ) ) {
245 require 'db_details.php';
246 }
247 else {
248 require 'server_sql.php';
249 }
250 exit;
251 }
252
253 /**
254 * Defines the query to be displayed in the query textarea
255 */
256 if ( ! empty( $show_query ) ) {
257 $query_to_display = $sql_query;
258 } else {
259 $query_to_display = '';
260 }
261 unset( $sql_query );
262
263 PMA_sqlQueryForm( $query_to_display, $querydisplay_tab );
dd6345c Display a (javascript) based query window as a new frame below the left
Garvin Hicking authored
264
265 // Hidden forms and query frame interaction stuff
266 if ($cfg['QueryFrame'] && $cfg['QueryFrameJS']) {
267 if (isset($auto_commit) && $auto_commit == 'true') {
268 ?>
269 <script type="text/javascript" language="javascript">
270 query_auto_commit();
271 </script>
272 <?php
273 }
37d50c1 @derrabus Huge set of optimizations, please test!
derrabus authored
274
4d878ae See Changelog: Lightweight tabs, DB-based SQL history, tabbed querywi…
Garvin Hicking authored
275 if (isset($sql_history) && isset($querydisplay_tab) && ($querydisplay_tab == 'history' || $querydisplay_tab == 'full') && is_array($sql_history) && count($sql_history) > 0) {
dd6345c Display a (javascript) based query window as a new frame below the left
Garvin Hicking authored
276 ?>
0d5e5dd @nijel drop unneeded margins
nijel authored
277 <?php echo $strQuerySQLHistory . ':<br /><ul>' . implode('', $sql_history) . '</ul>'; ?>
dd6345c Display a (javascript) based query window as a new frame below the left
Garvin Hicking authored
278 <?php
279 }
280 ?>
6884f97 @nijel no more support for php3
nijel authored
281 <form action="querywindow.php" method="post" name="querywindow">
37d50c1 @derrabus Huge set of optimizations, please test!
derrabus authored
282 <?php
dd6345c Display a (javascript) based query window as a new frame below the left
Garvin Hicking authored
283 echo PMA_generate_common_hidden_inputs('', '');
284 if (count($input_query_history) > 0) {
285 echo implode("\n", $input_query_history);
286 }
287 ?>
0261636 @nijel HTML entities fix
nijel authored
288 <input type="hidden" name="db" value="<?php echo (empty($db) ? '' : htmlspecialchars($db)); ?>" />
289 <input type="hidden" name="table" value="<?php echo (empty($table) ? '' : htmlspecialchars($table)); ?>" />
dd6345c Display a (javascript) based query window as a new frame below the left
Garvin Hicking authored
290
291 <input type="hidden" name="query_history_latest" value="" />
292 <input type="hidden" name="query_history_latest_db" value="" />
293 <input type="hidden" name="query_history_latest_table" value="" />
37d50c1 @derrabus Huge set of optimizations, please test!
derrabus authored
294
dd6345c Display a (javascript) based query window as a new frame below the left
Garvin Hicking authored
295 <input type="hidden" name="previous_db" value="<?php echo htmlspecialchars($db); ?>" />
296
297 <input type="hidden" name="auto_commit" value="false" />
4d878ae See Changelog: Lightweight tabs, DB-based SQL history, tabbed querywi…
Garvin Hicking authored
298 <input type="hidden" name="querydisplay_tab" value="<?php echo $querydisplay_tab; ?>" />
dd6345c Display a (javascript) based query window as a new frame below the left
Garvin Hicking authored
299 </form>
53f051d increased values for QueryWindow Size, bug: querywindow to small
Michael Keck authored
300 <?php
301 }
302 ?>
64bd56d @nijel Support for browsing selected columns (RFE #1275909).
nijel authored
303 </div>
dd6345c Display a (javascript) based query window as a new frame below the left
Garvin Hicking authored
304 </body>
305 </html>
306
307 <?php
64bd56d @nijel Support for browsing selected columns (RFE #1275909).
nijel authored
308
dd6345c Display a (javascript) based query window as a new frame below the left
Garvin Hicking authored
309 /**
310 * Close MySql connections
311 */
312 if (isset($dbh) && $dbh) {
0af2b97 @lem9 typo
lem9 authored
313 PMA_DBI_close($dbh);
dd6345c Display a (javascript) based query window as a new frame below the left
Garvin Hicking authored
314 }
315 if (isset($userlink) && $userlink) {
0af2b97 @lem9 typo
lem9 authored
316 PMA_DBI_close($userlink);
dd6345c Display a (javascript) based query window as a new frame below the left
Garvin Hicking authored
317 }
318
319
320 /**
321 * Sends bufferized data
322 */
323 if (isset($cfg['OBGzip']) && $cfg['OBGzip']
324 && isset($ob_mode) && $ob_mode) {
325 PMA_outBufferPost($ob_mode);
326 }
37d50c1 @derrabus Huge set of optimizations, please test!
derrabus authored
327 ?>
Something went wrong with that request. Please try again.