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