patch #1250935, interface improvements
[phpmyadmin/crack.git] / tbl_query_box.php
blobcf6a16c5fa15b22a70f74d9a79666d57ac813aa2
1 <?php
2 /* $Id$ */
3 // vim: expandtab sw=4 ts=4 sts=4:
5 // Check parameters
7 require_once('./libraries/common.lib.php');
8 require_once('./libraries/bookmark.lib.php');
10 $upload_dir_error='';
12 // I don't see the purpose of the first 2 conditions
13 //if (!($cfg['QueryFrame'] && $cfg['QueryFrameJS'] && isset($is_inside_querywindow) && $is_inside_querywindow == TRUE && isset($querydisplay_tab) && ($querydisplay_tab == 'sql' || $querydisplay_tab == 'full'))) {
15 if (!(isset($is_inside_querywindow) && $is_inside_querywindow == TRUE && isset($querydisplay_tab) && ($querydisplay_tab == 'sql' || $querydisplay_tab == 'full'))) {
16 PMA_checkParameters(array('db','table','url_query'));
19 /**
20 * Defines the query to be displayed in the query textarea
22 if (isset($show_query) && $show_query == '1') {
23 // This script has been called by read_dump.php
24 if (isset($sql_query_cpy)) {
25 $query_to_display = $sql_query_cpy;
27 // Other cases
28 else {
29 $query_to_display = $sql_query;
31 } else {
32 $query_to_display = '';
34 unset($sql_query);
36 /**
37 * Get the list and number of fields
39 $fields_cnt = 0;
40 if (isset($db) && isset($table) && $table != '' && $db != '') {
41 // we do a try_query here, because we could be in the query window,
42 // trying to synchonize and the table has not yet been created
43 $result = PMA_DBI_try_query('SHOW FIELDS FROM ' . PMA_backquote($table) . ' FROM ' . PMA_backquote($db) . ';', NULL, PMA_DBI_QUERY_STORE);
44 if ($result) {
45 $fields_cnt = PMA_DBI_num_rows($result);
46 while ($row = PMA_DBI_fetch_assoc($result)) {
47 $fields_list[] = $row['Field'];
48 } // end while
49 PMA_DBI_free_result($result);
50 } // end if
53 /**
54 * Work on the table
57 if ($cfg['QueryFrame'] && $cfg['QueryFrameJS'] && isset($is_inside_querywindow) && $is_inside_querywindow == TRUE && isset($querydisplay_tab) && ($querydisplay_tab == 'sql' || $querydisplay_tab == 'full')) {
58 $locking = 'onkeypress="document.sqlform.elements[\'LockFromUpdate\'].checked = true;"';
59 } else {
60 $locking = '';
63 $auto_sel = ($cfg['TextareaAutoSelect']
64 // 2003-02-05 rabus: This causes big trouble with Opera 7 for
65 // Windows, so let's disable it there...
66 && !(PMA_USR_OS == 'Win' && PMA_USR_BROWSER_AGENT == 'OPERA' && PMA_USR_BROWSER_VER >= 7))
67 ? "\n" . ' onfocus="if (typeof(document.layers) == \'undefined\' || typeof(textarea_selected) == \'undefined\') {textarea_selected = 1; document.sqlform.elements[\'sql_query\'].select();}"'
68 : '';
69 $auto_sel .= ' ' . $locking;
71 // garvin: If non-JS query window is embedded, display a list of databases to choose from.
72 // Apart from that, a non-js query window sucks badly.
73 /**
74 * Get the list and number of available databases.
76 if ($server > 0) {
77 PMA_availableDatabases(); // this function is defined in "common.lib.php"
78 } else {
79 $num_dbs = 0;
81 if ($cfg['QueryFrame'] && (!$cfg['QueryFrameJS'] && !$db || ($cfg['QueryFrameJS'] && !$db))) {
82 if ($num_dbs > 0) {
83 $queryframe_db_list = '<select size=1 name="db" style="vertical-align: middle;">';
84 for ($i = 0; $i < $num_dbs; $i++) {
85 $t_db = $dblist[$i];
86 $queryframe_db_list .= '<option value="' . htmlspecialchars($t_db) . '">' . htmlspecialchars($t_db) . '</option>';
88 $queryframe_db_list .= '</select>&nbsp;';
89 $queryframe_thcolspan = ' colspan="2"';
90 $queryframe_tdcolspan = '';
91 } else {
92 $queryframe_db_list = '';
93 $queryframe_thcolspan = ' colspan="3"';
94 $queryframe_tdcolspan = ' colspan="2"';
96 } else {
97 $queryframe_db_list = '';
98 if ($num_dbs > 0) {
99 $queryframe_thcolspan = ' colspan="3"';
100 $queryframe_tdcolspan = ' colspan="2"';
101 } else {
102 $queryframe_thcolspan = ' colspan="2"';
103 $queryframe_tdcolspan = '';
106 $form_items = 0;
107 // ($is_upload defined in common.lib.php)
109 if ($cfg['QueryFrame'] && $cfg['QueryFrameJS'] && isset($is_inside_querywindow) && $is_inside_querywindow) {
111 <script type="text/javascript">
112 <!--
113 document.writeln('<form method="post" target="phpmain' + <?php echo ((isset($is_inside_querywindow) && $is_inside_querywindow == TRUE) ? 'opener.' : '');?>parent.frames.queryframe.document.hashform.hash.value + '" action="read_dump.php"<?php if ($is_upload) echo ' enctype="multipart/form-data"'; ?> onsubmit="return checkSqlQuery(this)" name="sqlform">');
114 //-->
115 </script>
116 <?php
117 echo ' <noscript>' . "\n"
118 . ' <form method="post" target="phpmain' . md5($cfg['PmaAbsoluteUri']) . '" ' . "\n"
119 . ' action="read_dump.php"' . ($is_upload ? ' enctype="multipart/form-data"' : '' ) . ' name="sqlform">' . "\n"
120 . ' </noscript>';
121 } else {
123 <form method="post" action="read_dump.php"<?php if ($is_upload) echo ' enctype="multipart/form-data"'; ?> onsubmit="return checkSqlQuery(this)" name="sqlform" style="padding: 0px; magin: 0px;">
124 <?php
127 <table border="0" cellpadding="2" cellspacing="0" id="sqlcontainer" name="sqlcontainer">
128 <?php
129 // for better administration
130 $querybox_hidden_fields = ' <input type="hidden" name="is_js_confirmed" value="0" />' . "\n"
131 . ' ' . PMA_generate_common_hidden_inputs($db, $table) . "\n"
132 . ' <input type="hidden" name="pos" value="0" />'. "\n"
133 . ' <input type="hidden" name="goto" value="' . $goto . '" />'. "\n"
134 . ' <input type="hidden" name="zero_rows" value="' . $strSuccess . '" />'. "\n"
135 . ' <input type="hidden" name="prev_sql_query" value="' . ((!empty($query_to_display)) ? urlencode($query_to_display) : '') . '" />'. "\n";
136 if (!isset($is_inside_querywindow) ||
137 (isset($is_inside_querywindow) && $is_inside_querywindow == TRUE && isset($querydisplay_tab) && ($querydisplay_tab == 'sql' || $querydisplay_tab == 'full'))) {
139 <!-- Query box and bookmark support -->
140 <?php
141 if (isset($is_inside_querywindow) && $is_inside_querywindow == TRUE) {
142 $querybox_hidden_fields .= ' <input type="hidden" name="focus_querywindow" value="true" />' . "\n";
145 <tr class="tblHeaders">
146 <td nowrap="nowrap"<?php if ($queryframe_tdcolspan == '') { echo ' colspan="2"'; } ?>>
147 <a name="querybox"></a>
148 <?php echo sprintf($strRunSQLQuery, htmlspecialchars($db) . $queryframe_db_list) . PMA_showMySQLDocu('Reference', 'SELECT'); ?>
149 </td>
150 <?php
151 if (isset($table) && $fields_cnt > 0) { ?>
152 <td nowrap="nowrap">&nbsp;&nbsp;&nbsp;</td>
153 <td nowrap="nowrap"><?php echo $strFields; ?>:&nbsp;</td>
154 <?php
157 </tr>
158 <tr bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
159 <td valign="top"<?php if ($queryframe_tdcolspan == '') { echo ' colspan="2"'; } ?>>
160 <textarea name="sql_query" rows="<?php echo $cfg['TextareaRows']; ?>" cols="<?php echo ((isset($is_inside_querywindow) && $is_inside_querywindow == TRUE && $queryframe_tdcolspan != '') ? ceil($cfg['TextareaCols'] * 1.25) : $cfg['TextareaCols'] * 2); ?>" dir="<?php echo $text_dir; ?>"<?php echo $auto_sel; ?>><?php
161 if (!empty($query_to_display)) {
162 echo htmlspecialchars($query_to_display);
163 } elseif (isset($table) && !empty($table) && isset($fields_list)) {
164 echo htmlspecialchars(
165 str_replace('%d', PMA_backquote($db),
166 str_replace('%t', PMA_backquote($table),
167 str_replace('%f', implode(', ', PMA_backquote($fields_list)),
168 $cfg['DefaultQueryTable']))));
169 } else {
170 echo htmlspecialchars(str_replace('%d', PMA_backquote($db), $cfg['DefaultQueryDatabase']));
172 ?></textarea>
173 </td>
174 <?php
175 if (isset($table) && $fields_cnt > 0) {
177 <td valign="middle">
178 <?php
179 if ($cfg['PropertiesIconic']) {
180 echo '<input type="button" name="insert" value="&lt;&lt;" onclick="insertValueQuery()" title="' . $strInsert. '" />';
181 } else {
182 echo '<input type="button" name="insert" value="' . $strInsert . '" onclick="insertValueQuery()" />';
185 </td>
186 <td valign="top">
187 <select name="dummy" size="<?php echo $cfg['TextareaRows']; ?>" multiple="multiple" class="textfield">
188 <?php
189 echo "\n";
190 for ($i = 0 ; $i < $fields_cnt; $i++) {
191 echo ' '
192 . '<option value="' . PMA_backquote(htmlspecialchars($fields_list[$i])) . '">' . htmlspecialchars($fields_list[$i]) . '</option>' . "\n";
195 </select>
196 </td>
197 <?php
200 </tr>
201 <tr class="tblFooters">
202 <td<?php if ($queryframe_tdcolspan != '') { echo ' colspan="2"'; } //echo $queryframe_tdcolspan; ?>>
203 <input type="checkbox" name="show_query" value="1" id="checkbox_show_query" checked="checked" /><label for="checkbox_show_query"><?php echo $strShowThisQuery; ?></label>
204 <?php
205 if (isset($is_inside_querywindow) && $is_inside_querywindow == TRUE) {
207 <br />
208 <script type="text/javascript">
209 document.writeln('<input type="checkbox" name="LockFromUpdate" value="1" id="checkbox_lock" /><label for="checkbox_lock"><?php echo $strQueryWindowLock; ?></label><br />');
210 </script>
211 <?php
214 $form_items++;
216 </td>
217 <td align="right" valign="bottom"><input type="submit" name="SQL" value="<?php echo $strGo; ?>" /></td>
218 </tr>
219 <?php
220 } else {
221 $querybox_hidden_fields .= ' <input type="hidden" name="sql_query" value="" />' . "\n";
222 $querybox_hidden_fields .= ' <input type="hidden" name="show_query" value="1" />' . "\n";
225 // loic1: displays import dump feature only if file upload available
226 if ($is_upload && (!isset($is_inside_querywindow) ||
227 (isset($is_inside_querywindow) && $is_inside_querywindow == TRUE && isset($querydisplay_tab) && ($querydisplay_tab == 'files' || $querydisplay_tab == 'full')))) {
228 $form_items++;
230 <tr>
231 <td<?php echo $queryframe_thcolspan; ?>><img src="<?php echo $GLOBALS['pmaThemeImage'] . 'spacer.png'; ?>" width="1" height="1" border="0" alt="" /></td>
232 </tr>
233 <tr>
234 <td class="tblHeaders"<?php echo $queryframe_thcolspan; ?>>
235 <?php
236 echo ' '
237 . ((isset($is_inside_querywindow) && $is_inside_querywindow == TRUE && isset($querydisplay_tab) && $querydisplay_tab == 'full') || !isset($is_inside_querywindow) ? '<i>' . $strOr . '</i>' : '')
238 . ' ' . $strLocationTextfile . ':&nbsp;' . "\n";
240 </td>
241 </tr>
242 <tr bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
243 <td<?php echo $queryframe_thcolspan; ?>>
244 &nbsp;&nbsp;<input type="file" name="sql_file" class="textfield" />&nbsp;<?php echo PMA_displayMaximumUploadSize($max_upload_size);?><br />
245 <?php
246 // some browsers should respect this :)
247 echo ' ' . PMA_generateHiddenMaxFileSize($max_upload_size) . "\n";
249 if (isset($is_inside_querywindow) && $is_inside_querywindow == TRUE) {
250 $querybox_hidden_fields .= ' <input type="hidden" name="focus_querywindow" value="true" />' . "\n";
253 $is_gzip = ($cfg['GZipDump'] && @function_exists('gzopen'));
254 $is_bzip = ($cfg['BZipDump'] && @function_exists('bzdecompress'));
255 if ($is_bzip || $is_gzip) {
256 echo ' </td>' . "\n"
257 . ' </tr>' . "\n"
258 . ' <tr bgcolor="' . $cfg['BgcolorOne'] .'">' . "\n"
259 . ' <td' . $queryframe_thcolspan . '>' . "\n"
260 . ' &nbsp;&nbsp;'. $strCompression . ':<br />&nbsp;&nbsp;' . "\n"
261 . ' &nbsp;&nbsp;<input type="radio" id="radio_sql_file_compression_auto" name="sql_file_compression" value="" checked="checked" />'
262 . '<label for="radio_sql_file_compression_auto">' . $strAutodetect . '</label>&nbsp;&nbsp;' . "\n"
263 . ' <input type="radio" id="radio_sql_file_compression_plain" name="sql_file_compression" value="text/plain" />'
264 . '<label for="radio_sql_file_compression_plain">' . $strNone . '</label>&nbsp;&nbsp;' . "\n";
265 if ($is_gzip) {
266 echo ' <input type="radio" id="radio_sql_file_compression_gzip" name="sql_file_compression" value="application/x-gzip" />'
267 . '<label for="radio_sql_file_compression_gzip">' . $strGzip . '</label>&nbsp;&nbsp;' . "\n";
269 if ($is_bzip) {
270 echo ' <input type="radio" id="radio_sql_file_compression_bzip" name="sql_file_compression" value="application/x-bzip" />'
271 . '<label for="radio_sql_file_compression_bzip">' . $strBzip . '</label>&nbsp;&nbsp;' . "\n";
273 } else {
274 $querybox_hidden_fields .= ' <input type="hidden" name="sql_file_compression" value="text/plain" />' . "\n";
277 </td>
278 </tr>
279 <?php
280 } // end if
281 echo "\n";
283 // web-server upload directory
284 $is_upload_dir = false;
285 if (!empty($cfg['UploadDir']) && !isset($is_inside_querywindow) ||
286 (!empty($cfg['UploadDir']) && isset($is_inside_querywindow) && $is_inside_querywindow == TRUE && isset($querydisplay_tab) && ($querydisplay_tab == 'files' || $querydisplay_tab == 'full'))) {
288 if (substr($cfg['UploadDir'], -1) != '/') {
289 $cfg['UploadDir'] .= '/';
291 if ($handle = @opendir($cfg['UploadDir'])) {
292 if (isset($is_inside_querywindow) && $is_inside_querywindow == TRUE) {
293 $querybox_hidden_fields .= ' <input type="hidden" name="focus_querywindow" value="true" />' . "\n";
296 $is_first = 0;
297 while ($file = @readdir($handle)) {
298 if (is_file($cfg['UploadDir'] . $file) && PMA_checkFileExtensions($file, '.sql')) {
299 if ($is_first == 0) {
300 $is_upload_dir = true;
301 echo "\n";
302 echo ' ' . "\n"
303 . ' <tr bgcolor="' .$cfg['BgcolorTwo'].'"><td' . $queryframe_thcolspan . '>';
304 echo ' <b>&nbsp;' . $strWebServerUploadDirectory . ':&nbsp;</b>' . "\n";
305 echo ' </td></tr>' . "\n"
306 . ' <tr bgcolor="' . $cfg['BgcolorOne'] . '"><td' . $queryframe_thcolspan . '>';
307 // add 2004-05-08 by mkkeck
308 // todo: building a php script for indexing files in UploadDir
309 //if ($cfg['UploadDirIndex']) {
310 // echo '&nbsp;&nbsp;<a href="' . $cfg['UploadDir'] . '" target="_blank">' . $cfg['UploadDir'] . '</a>&nbsp;';
312 // end indexing
313 echo ' &nbsp;&nbsp;<select size="1" name="sql_localfile">' . "\n";
314 echo ' <option value="" selected="selected"></option>' . "\n";
315 $form_items++;
316 } // end if (is_first)
317 echo ' <option value="' . htmlspecialchars($file) . '">' . htmlspecialchars($file) . '</option>' . "\n";
318 $is_first++;
319 } // end if (is_file)
320 } // end while
321 if ($is_first > 0) {
322 echo ' </select>' . "\n"
323 . ' </td></tr>' . "\n";
324 } // end if (isfirst > 0)
325 @closedir($handle);
326 $upload_dir_error=''; // please see 'else {' below ;)
328 else {
329 // modified by mkkeck 2004-05-08
330 // showing UploadDir Error at the end of all option for SQL-Queries
331 $upload_dir_error.= ' <tr><td' . $queryframe_thcolspan . '><img src="' . $GLOBALS['pmaThemeImage'] . 'spacer.png' . '" width="1" height="1" border="0" alt="" /></td></tr>' . "\n"
332 . ' <tr>' . "\n"
333 . ' <th' . $queryframe_thcolspan . ' class="tblHeadError"><div class="errorhead">' . $strError . '</div></th>' . "\n"
334 . ' </tr>' . "\n"
335 . ' <tr>' . "\n"
336 . ' <td' . $queryframe_thcolspan . ' class="tblError">' . wordwrap($strWebServerUploadDirectoryError,80,'<br />&nbsp;') . '</td>' . "\n"
337 . ' </tr>' . "\n"
338 . ' <tr><td' . $queryframe_thcolspan . '><img src="' . $GLOBALS['pmaThemeImage'] . 'spacer.png' . '" width="1" height="1" border="0" alt="" /></td></tr>' . "\n";
340 } // end if (web-server upload directory)
341 echo "\n";
343 // Encoding setting form appended by Y.Kawada
344 if (function_exists('PMA_set_enc_form')) {
345 echo PMA_set_enc_form(' ');
346 $form_items++;
349 // Charset conversion options and submit button
350 if (($is_upload || $is_upload_dir) &&
351 (!isset($is_inside_querywindow) ||
352 (isset($is_inside_querywindow) && $is_inside_querywindow == TRUE && isset($querydisplay_tab) && ($querydisplay_tab == 'files' || $querydisplay_tab == 'full')))
353 // It's possible that $db is empty: no db was selected on the left
354 // panel and the user wants to execute a .sql file to create one)
355 // && isset($db) && $db != ''){
358 if ($cfg['AllowAnywhereRecoding'] && $allow_recoding) {
359 $form_items++;
360 echo ' <div style="margin-bottom: 5px">' . "\n";
361 $temp_charset = reset($cfg['AvailableCharsets']);
362 echo $strCharsetOfFile . "\n"
363 . ' <select name="charset_of_file" size="1">' . "\n"
364 . ' <option value="' . $temp_charset . '"';
365 if ($temp_charset == $charset) {
366 echo ' selected="selected"';
368 echo '>' . $temp_charset . '</option>' . "\n";
369 while ($temp_charset = next($cfg['AvailableCharsets'])) {
370 echo ' <option value="' . $temp_charset . '"';
371 if ($temp_charset == $charset) {
372 echo ' selected="selected"';
374 echo '>' . $temp_charset . '</option>' . "\n";
376 echo ' </select><br />' . "\n" . ' ';
377 echo ' </div>' . "\n";
378 } // end if (recoding)
380 echo ' <tr class="tblFooters"><td' . $queryframe_tdcolspan . '>' . "\n";
381 if (PMA_MYSQL_INT_VERSION < 40100 && $cfg['AllowAnywhereRecoding'] && $allow_recoding) {
382 $temp_charset = reset($cfg['AvailableCharsets']);
383 echo '&nbsp;' . $strCharsetOfFile
384 . '&nbsp;<select name="charset_of_file" size="1">' . "\n"
385 . ' <option value="' . $temp_charset . '"';
386 if ($temp_charset == $charset) {
387 echo ' selected="selected"';
389 echo '>' . $temp_charset . '</option>' . "\n";
390 while ($temp_charset = next($cfg['AvailableCharsets'])) {
391 echo ' <option value="' . $temp_charset . '"';
392 if ($temp_charset == $charset) {
393 echo ' selected="selected"';
395 echo '>' . $temp_charset . '</option>' . "\n";
397 echo ' </select>' . "\n" . ' ';
398 } // end if (recoding)
399 else if (PMA_MYSQL_INT_VERSION >= 40100) {
400 echo $strCharsetOfFile . "\n"
401 . PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_CHARSET, 'charset_of_file', NULL, 'utf8', FALSE);
403 echo ' </td>' . "\n"
404 . ' <td align="right"' . $queryframe_thcolspan . '><input type="submit" name="SQL" value="' . $strGo . '" /></td>' . "\n"
405 . ' </tr>' . "\n\n";
408 // Bookmark Support
409 $bookmark_go = FALSE;
410 if (!isset($is_inside_querywindow) ||
411 (isset($is_inside_querywindow) && $is_inside_querywindow == TRUE && isset($querydisplay_tab) && ($querydisplay_tab == 'history' || $querydisplay_tab == 'full'))) {
412 if ($cfg['Bookmark']['db'] && $cfg['Bookmark']['table']) {
413 if (($bookmark_list = PMA_listBookmarks($db, $cfg['Bookmark'])) && count($bookmark_list) > 0) {
414 $form_items++;
415 echo ' <tr><td' . $queryframe_thcolspan . '><img src="' . $GLOBALS['pmaThemeImage'] . 'spacer.png' . '" width="1" height="1" border="0" alt="" /></td></tr>' . "\n";
416 echo ' <tr><td' . $queryframe_thcolspan . ' class="tblHeaders">' . "\n";
417 echo " " . ((isset($is_inside_querywindow) && $is_inside_querywindow == TRUE && isset($querydisplay_tab) && $querydisplay_tab == 'full') || !isset($is_inside_querywindow) ? "<i>$strOr</i>" : '') . " $strBookmarkQuery:&nbsp;\n";
418 echo ' </td></tr>' . "\n";
419 if (isset($is_inside_querywindow) && $is_inside_querywindow == TRUE) {
420 $querybox_hidden_fields .= ' <input type="hidden" name="focus_querywindow" value="true" />' . "\n";
423 echo ' <tr bgcolor="' .$cfg['BgcolorOne'] . '"><td' . $queryframe_tdcolspan . '>' . "\n";
424 echo ' <select name="id_bookmark" style="vertical-align: middle">' . "\n";
425 echo ' <option value=""></option>' . "\n";
426 foreach($bookmark_list AS $key => $value) {
427 echo ' <option value="' . htmlspecialchars($key) . '">' . htmlspecialchars($value) . '</option>' . "\n";
429 echo ' </select>' . "&nbsp;&nbsp;&nbsp;\n";
430 echo ' ' . $strVar;
431 echo ' ' . $cfg['ReplaceHelpImg'] ? '<a href="./Documentation.html#faqbookmark" target="documentation"><img src="' . $pmaThemeImage . 'b_help.png" width="11" height="11" align="middle" alt="' . $strDocu . '" hspace="2" border="0" /></a>' : '(<a href="./Documentation.html#faqbookmark" target="documentation">' . $strDocu . '</a>)';
432 echo ': <input type="text" name="bookmark_variable" class="textfield" size="10" style="vertical-align: middle" /><br />' . "\n";
433 echo ' <input type="radio" name="action_bookmark" value="0" id="radio_bookmark0" checked="checked" style="vertical-align: middle" /><label for="radio_bookmark0">' . $strSubmit . '</label>' . "\n";
434 echo ' &nbsp;<input type="radio" name="action_bookmark" value="1" id="radio_bookmark1" style="vertical-align: middle" /><label for="radio_bookmark1">' . $strBookmarkView . '</label>' . "\n";
435 echo ' &nbsp;<input type="radio" name="action_bookmark" value="2" id="radio_bookmark2" style="vertical-align: middle" /><label for="radio_bookmark2">' . $strDelete . '</label>' . "\n";
436 echo ' <br />' . "\n";
437 echo ' </td>' . "\n";
438 echo ' <td valign="bottom" align="right">' . "\n";
439 echo ' <input type="submit" name="SQL" value="' . $strGo . '" />';
440 echo ' </td></tr>' . "\n";
441 $bookmark_go = TRUE;
446 if (!isset($is_inside_querywindow) || (isset($is_inside_querywindow) && $is_inside_querywindow == TRUE && isset($querydisplay_tab) && (($querydisplay_tab == 'files') || $querydisplay_tab == 'sql' || $querydisplay_tab == 'full' || ($querydisplay_tab == 'history' && $bookmark_go)))) {
447 if ($form_items > 0) {
448 if ( $cfg['Bookmark']['db']
449 && $cfg['Bookmark']['table']
450 && (!isset($is_inside_querywindow)
451 || ( isset($is_inside_querywindow)
452 && $is_inside_querywindow == TRUE
453 && isset($querydisplay_tab)
454 //&& $querydisplay_tab != 'history'))) {
455 && $querydisplay_tab == 'sql'))) {
457 <tr><td<?php echo $queryframe_thcolspan; ?>><img src="<?php echo $GLOBALS['pmaThemeImage'] . 'spacer.png'; ?>" border="0" width="1" height="1" alt="" /></td></tr>
458 <tr><th<?php echo $queryframe_thcolspan; ?> align="left"><?php echo $strBookmarkThis; ?>:</th></tr>
459 <tr bgcolor="<?php echo $cfg['BgcolorTwo']; ?>">
460 <td<?php echo $queryframe_thcolspan; ?>>
461 <b><?php echo $strBookmarkOptions; ?>:</b>
462 </td>
463 </tr>
464 <tr bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
465 <td<?php echo $queryframe_thcolspan; ?>>
466 &nbsp;&nbsp;<?php echo $strBookmarkLabel; ?>: <input type="text" name="bkm_label" value="" /><br />
467 &nbsp;&nbsp;<input type="checkbox" name="bkm_all_users" id="id_bkm_all_users" value="true" /><label for="id_bkm_all_users"><?php echo $strBookmarkAllUsers; ?></label>
468 </td>
469 </tr>
470 <tr bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
471 <td align="right"<?php echo $queryframe_thcolspan; ?>>
472 <input type="submit" name="SQLbookmark" value="<?php echo $strGo . ' &amp; ' . $strBookmarkThis; ?>" onclick="if(document.forms['sqlform'].elements['bkm_label'].value==''){ alert('<?php echo addslashes($strInsertBookmarkTitle); ?>');forms['sqlform'].elements['bkm_label'].focus();return false; }"/>
473 </td>
474 </tr>
475 <?php
477 } else {
478 echo ' <tr><td' . $queryframe_thcolspan . '>' . "\n";
479 // TODO: Add a more complete warning that no items (like for file import) where found.
480 // (After 2.5.2 release!)
481 echo $strWebServerUploadDirectoryError;
482 echo ' </td></tr>' . "\n";
485 echo ' <tr><td' . $queryframe_thcolspan . ' height="1">' . "\n";
486 echo $querybox_hidden_fields;
487 echo ' </td></tr>';
488 if ($upload_dir_error!='') {
489 echo $upload_dir_error;
492 </table>
493 </form>
495 <?php
496 //if (!isset($is_inside_querywindow) || !$is_inside_querywindow) echo "</li>\n";
497 if (!isset($is_inside_querywindow) ||
498 (isset($is_inside_querywindow) && $is_inside_querywindow == TRUE && isset($querydisplay_tab) && ($querydisplay_tab == 'files' || $querydisplay_tab == 'full')) && isset($db) && $db != '') {
500 // loic1: displays import dump feature only if file upload available
501 $ldi_target = 'ldi_table.php?' . $url_query . (isset($is_inside_querywindow) && $is_inside_querywindow == TRUE ? '&amp;focus_querywindow=true' : '');
503 if ($is_upload && isset($db) && isset($table)) {
504 //if (!isset($is_inside_querywindow) || !$is_inside_querywindow) echo "<li>\n";
505 if ($cfg['PropertiesIconic']) {
506 $imgInsertTextfiles = '<img src="' . $pmaThemeImage. 'b_tblimport.png" '
507 . 'width="16" height="16" hspace="2" border="0" align="middle" alt="' . $strInsertTextfiles. '" />';
508 }else{
509 $imgInsertTextfiles = '';
512 <!-- Insert a text file -->
513 <?php
514 if ($cfg['QueryFrame'] && $cfg['QueryFrameJS']) {
517 <script type="text/javascript">
518 <!--
519 document.writeln('<a href="<?php echo (isset($is_inside_querywindow) && $is_inside_querywindow == TRUE ? '#' : $ldi_target); ?>" <?php echo (isset($is_inside_querywindow) && $is_inside_querywindow == TRUE ? 'onclick="opener.parent.frames.phpmain\' + opener.parent.frames.queryframe.document.hashform.hash.value + \'.location.href = \\\'' . $ldi_target . '\\\'; return false;"' : ''); ?>><?php echo addslashes($imgInsertTextfiles . $strInsertTextfiles); ?></a>');
520 //-->
521 </script>
523 <?php
524 } else {
527 <script type="text/javascript">
528 <!--
529 document.writeln('<a href="<?php echo (isset($is_inside_querywindow) && $is_inside_querywindow == TRUE ? '#' : $ldi_target); ?>" <?php echo (isset($is_inside_querywindow) && $is_inside_querywindow == TRUE ? 'onclick="opener.parent.frames.phpmain' . md5($cfg['PmaAbsoluteUri']) . '.location.href = \\\'' . $ldi_target . '\\\'; return false;"' : ''); ?>><?php echo addslashes($imgInsertTextfiles . $strInsertTextfiles); ?></a>');
530 //-->
531 </script>
533 <?php
537 <noscript>
538 <a href="<?php echo $ldi_target; ?>"><?php
539 echo $imgInsertTextfiles . $strInsertTextfiles;
540 ?></a>
541 </noscript>
542 <?php
543 //if (!isset($is_inside_querywindow) || !$is_inside_querywindow) echo "</li>\n";
546 echo "\n";