Documentation TYPO3 par Ameos

tbl_query_box.php

00001 <?php
00002 /* $Id: tbl_query_box.php,v 2.33 2005/08/04 15:06:06 lem9 Exp $ */
00003 // vim: expandtab sw=4 ts=4 sts=4:
00004 
00005 // Check parameters
00006 
00007 require_once('./libraries/common.lib.php');
00008 require_once('./libraries/bookmark.lib.php');
00009 
00010 $upload_dir_error='';
00011 
00012 // I don't see the purpose of the first 2 conditions
00013 //if (!($cfg['QueryFrame'] && $cfg['QueryFrameJS'] && isset($is_inside_querywindow) && $is_inside_querywindow == TRUE && isset($querydisplay_tab) && ($querydisplay_tab == 'sql' || $querydisplay_tab == 'full'))) {
00014 
00015 if (!(isset($is_inside_querywindow) && $is_inside_querywindow == TRUE && isset($querydisplay_tab) && ($querydisplay_tab == 'sql' || $querydisplay_tab == 'full'))) {
00016     PMA_checkParameters(array('db','table','url_query'));
00017 }
00018 
00022 if (isset($show_query) && $show_query == '1') {
00023     // This script has been called by read_dump.php
00024     if (isset($sql_query_cpy)) {
00025         $query_to_display = $sql_query_cpy;
00026     }
00027     // Other cases
00028     else {
00029         $query_to_display = $sql_query;
00030     }
00031 } else {
00032     $query_to_display     = '';
00033 }
00034 unset($sql_query);
00035 
00039 $fields_cnt = 0;
00040 if (isset($db) && isset($table) && $table != '' && $db != '') {
00041     // we do a try_query here, because we could be in the query window,
00042     // trying to synchonize and the table has not yet been created
00043     $result = PMA_DBI_try_query('SHOW FIELDS FROM ' . PMA_backquote($table) . ' FROM ' . PMA_backquote($db) . ';', NULL, PMA_DBI_QUERY_STORE);
00044     if ($result) {
00045         $fields_cnt = PMA_DBI_num_rows($result);
00046         while ($row = PMA_DBI_fetch_assoc($result)) {
00047             $fields_list[] = $row['Field'];
00048         } // end while
00049         PMA_DBI_free_result($result);
00050     } // end if
00051 }
00052 
00057 if ($cfg['QueryFrame'] && $cfg['QueryFrameJS'] && isset($is_inside_querywindow) && $is_inside_querywindow == TRUE && isset($querydisplay_tab) && ($querydisplay_tab == 'sql' || $querydisplay_tab == 'full')) {
00058     $locking   = 'onkeypress="document.sqlform.elements[\'LockFromUpdate\'].checked = true;"';
00059 } else {
00060     $locking   = '';
00061 }
00062 
00063 $auto_sel  = ($cfg['TextareaAutoSelect']
00064                // 2003-02-05 rabus: This causes big trouble with Opera 7 for
00065                // Windows, so let's disable it there...
00066                && !(PMA_USR_OS == 'Win' && PMA_USR_BROWSER_AGENT == 'OPERA' && PMA_USR_BROWSER_VER >= 7))
00067            ? "\n" . '             onfocus="if (typeof(document.layers) == \'undefined\' || typeof(textarea_selected) == \'undefined\') {textarea_selected = 1; document.sqlform.elements[\'sql_query\'].select();}"'
00068            : '';
00069 $auto_sel .= ' ' . $locking;
00070 
00071 // garvin: If non-JS query window is embedded, display a list of databases to choose from.
00072 //         Apart from that, a non-js query window sucks badly.
00076 if ($server > 0) {
00077     PMA_availableDatabases(); // this function is defined in "common.lib.php"
00078 } else {
00079     $num_dbs = 0;
00080 }
00081 if ($cfg['QueryFrame'] && (!$cfg['QueryFrameJS'] && !$db || ($cfg['QueryFrameJS'] && !$db))) {
00082     if ($num_dbs > 0) {
00083         $queryframe_db_list = '<select size=1 name="db" style="vertical-align: middle;">';
00084         for ($i = 0; $i < $num_dbs; $i++) {
00085             $t_db = $dblist[$i];
00086             $queryframe_db_list .= '<option value="' . htmlspecialchars($t_db) . '">' . htmlspecialchars($t_db) . '</option>';
00087         }
00088         $queryframe_db_list .= '</select>&nbsp;';
00089         $queryframe_thcolspan = ' colspan="2"';
00090         $queryframe_tdcolspan = '';
00091     } else {
00092         $queryframe_db_list = '';
00093         $queryframe_thcolspan = ' colspan="3"';
00094         $queryframe_tdcolspan = ' colspan="2"';
00095     }
00096 } else {
00097     $queryframe_db_list = '';
00098     if ($num_dbs > 0) {
00099         $queryframe_thcolspan = ' colspan="3"';
00100         $queryframe_tdcolspan = ' colspan="2"';
00101     } else {
00102         $queryframe_thcolspan = ' colspan="2"';
00103         $queryframe_tdcolspan = '';
00104     }
00105 }
00106 $form_items = 0;
00107 // ($is_upload defined in common.lib.php)
00108 
00109 if ($cfg['QueryFrame'] && $cfg['QueryFrameJS'] && isset($is_inside_querywindow) && $is_inside_querywindow) {
00110 ?>
00111         <script type="text/javascript">
00112         <!--
00113         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">');
00114         //-->
00115         </script>
00116 <?php
00117     echo '        <noscript>' . "\n"
00118        . '        <form method="post" target="phpmain' . md5($cfg['PmaAbsoluteUri']) . '" ' . "\n"
00119        . '            action="read_dump.php"' . ($is_upload ? ' enctype="multipart/form-data"' : '' ) . ' name="sqlform">' . "\n"
00120        . '        </noscript>';
00121 } else {
00122 ?>
00123         <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;">
00124 <?php
00125 }
00126 ?>
00127             <table border="0" cellpadding="2" cellspacing="0" id="sqlcontainer" name="sqlcontainer">
00128 <?php
00129 // for better administration
00130 $querybox_hidden_fields = '                    <input type="hidden" name="is_js_confirmed" value="0" />' . "\n"
00131                             . '                    ' . PMA_generate_common_hidden_inputs($db, $table) . "\n"
00132                             . '                    <input type="hidden" name="pos" value="0" />'. "\n"
00133                             . '                    <input type="hidden" name="goto" value="' . $goto . '" />'. "\n"
00134                             . '                    <input type="hidden" name="zero_rows" value="' . $strSuccess . '" />'. "\n"
00135                             . '                    <input type="hidden" name="prev_sql_query" value="' . ((!empty($query_to_display)) ? urlencode($query_to_display) : '') . '" />'. "\n";
00136 if (!isset($is_inside_querywindow) ||
00137     (isset($is_inside_querywindow) && $is_inside_querywindow == TRUE && isset($querydisplay_tab) && ($querydisplay_tab == 'sql' || $querydisplay_tab == 'full'))) {
00138 ?>
00139     <!-- Query box and bookmark support -->
00140 <?php
00141     if (isset($is_inside_querywindow) && $is_inside_querywindow == TRUE) {
00142         $querybox_hidden_fields .= '                    <input type="hidden" name="focus_querywindow" value="true" />' . "\n";
00143     }
00144 ?>
00145             <tr class="tblHeaders">
00146                 <td nowrap="nowrap"<?php if ($queryframe_tdcolspan == '') { echo ' colspan="2"'; } ?>>
00147                     <a name="querybox"></a>
00148                     <?php echo sprintf($strRunSQLQuery,  htmlspecialchars($db) . $queryframe_db_list) . PMA_showMySQLDocu('Reference', 'SELECT'); ?>
00149                 </td>
00150                 <?php
00151     if (isset($table) && $fields_cnt > 0) { ?>
00152                 <td nowrap="nowrap">&nbsp;&nbsp;&nbsp;</td>
00153                 <td nowrap="nowrap"><?php echo $strFields; ?>:&nbsp;</td>
00154                 <?php
00155     }
00156                 ?>
00157             </tr>
00158             <tr bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
00159                 <td valign="top"<?php if ($queryframe_tdcolspan == '') { echo ' colspan="2"'; } ?>>
00160                     <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
00161     if (!empty($query_to_display)) {
00162         echo htmlspecialchars($query_to_display);
00163     } elseif (isset($table) && !empty($table) && isset($fields_list)) {
00164         echo htmlspecialchars(
00165             str_replace('%d', PMA_backquote($db),
00166                 str_replace('%t', PMA_backquote($table),
00167                     str_replace('%f', implode(', ', PMA_backquote($fields_list)),
00168                         $cfg['DefaultQueryTable']))));
00169     } else {
00170         echo htmlspecialchars(str_replace('%d', PMA_backquote($db), $cfg['DefaultQueryDatabase']));
00171     }
00172 ?></textarea>
00173                 </td>
00174 <?php
00175     if (isset($table) && $fields_cnt > 0) {
00176 ?>
00177                 <td valign="middle">
00178                     <?php
00179         if ($cfg['PropertiesIconic']) {
00180             echo '<input type="button" name="insert" value="&lt;&lt;" onclick="insertValueQuery()" title="' . $strInsert. '" />';
00181         } else {
00182             echo '<input type="button" name="insert" value="' . $strInsert . '" onclick="insertValueQuery()" />';
00183         }
00184                 ?>
00185                 </td>
00186                 <td valign="top">
00187                     <select name="dummy" size="<?php echo $cfg['TextareaRows']; ?>" multiple="multiple" class="textfield">
00188 <?php
00189         echo "\n";
00190         for ($i = 0 ; $i < $fields_cnt; $i++) {
00191             echo '                        '
00192                . '<option value="' . PMA_backquote(htmlspecialchars($fields_list[$i])) . '">' . htmlspecialchars($fields_list[$i]) . '</option>' . "\n";
00193         }
00194 ?>
00195                     </select>
00196                 </td>
00197 <?php
00198     }
00199 ?>
00200             </tr>
00201             <tr class="tblFooters">
00202                 <td<?php if ($queryframe_tdcolspan != '') { echo ' colspan="2"'; } //echo $queryframe_tdcolspan; ?>>
00203                     <input type="checkbox" name="show_query" value="1" id="checkbox_show_query" checked="checked" /><label for="checkbox_show_query"><?php echo $strShowThisQuery; ?></label>
00204 <?php
00205             if (isset($is_inside_querywindow) && $is_inside_querywindow == TRUE) {
00206             ?>
00207             <br />
00208             <script type="text/javascript">
00209                 document.writeln('<input type="checkbox" name="LockFromUpdate" value="1" id="checkbox_lock" /><label for="checkbox_lock"><?php echo $strQueryWindowLock; ?></label><br />');
00210             </script>
00211             <?php
00212             }
00213 
00214             $form_items++;
00215             ?>
00216                 </td>
00217                 <td align="right" valign="bottom"><input type="submit" name="SQL" value="<?php echo $strGo; ?>" /></td>
00218             </tr>
00219 <?php
00220 } else {
00221     $querybox_hidden_fields .= '                    <input type="hidden" name="sql_query" value="" />' . "\n";
00222     $querybox_hidden_fields .= '                    <input type="hidden" name="show_query" value="1" />' . "\n";
00223 }
00224 
00225 // loic1: displays import dump feature only if file upload available
00226 if ($is_upload && (!isset($is_inside_querywindow) ||
00227     (isset($is_inside_querywindow) && $is_inside_querywindow == TRUE && isset($querydisplay_tab) && ($querydisplay_tab == 'files' || $querydisplay_tab == 'full')))) {
00228     $form_items++;
00229 ?>
00230             <tr>
00231                 <td<?php echo $queryframe_thcolspan; ?>><img src="<?php echo $GLOBALS['pmaThemeImage'] . 'spacer.png'; ?>" width="1" height="1" border="0" alt="" /></td>
00232             </tr>
00233             <tr>
00234                 <td class="tblHeaders"<?php echo $queryframe_thcolspan; ?>>
00235 <?php
00236     echo '            '
00237        . ((isset($is_inside_querywindow) && $is_inside_querywindow == TRUE && isset($querydisplay_tab) && $querydisplay_tab == 'full') || !isset($is_inside_querywindow) ? '<i>' . $strOr . '</i>' : '')
00238        . ' ' . $strLocationTextfile . ':&nbsp;' . "\n";
00239 ?>
00240                 </td>
00241             </tr>
00242             <tr bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
00243                 <td<?php echo $queryframe_thcolspan; ?>>
00244                     &nbsp;&nbsp;<input type="file" name="sql_file" class="textfield" />&nbsp;<?php echo PMA_displayMaximumUploadSize($max_upload_size);?><br />
00245 <?php
00246     // some browsers should respect this :)
00247     echo '        ' . PMA_generateHiddenMaxFileSize($max_upload_size) . "\n";
00248 
00249     if (isset($is_inside_querywindow) && $is_inside_querywindow == TRUE) {
00250         $querybox_hidden_fields .= '                    <input type="hidden" name="focus_querywindow" value="true" />' . "\n";
00251     }
00252 
00253     $is_gzip = ($cfg['GZipDump'] && @function_exists('gzopen'));
00254     $is_bzip = ($cfg['BZipDump'] && @function_exists('bzdecompress'));
00255     if ($is_bzip || $is_gzip) {
00256         echo '                </td>' . "\n"
00257            . '            </tr>' . "\n"
00258            . '            <tr bgcolor="' . $cfg['BgcolorOne'] .'">' . "\n"
00259            . '                <td' . $queryframe_thcolspan . '>' . "\n"
00260            . '                    &nbsp;&nbsp;'. $strCompression . ':<br />&nbsp;&nbsp;' . "\n"
00261            . '                    &nbsp;&nbsp;<input type="radio" id="radio_sql_file_compression_auto" name="sql_file_compression" value="" checked="checked" />'
00262            . '<label for="radio_sql_file_compression_auto">' . $strAutodetect . '</label>&nbsp;&nbsp;' . "\n"
00263            . '                    <input type="radio" id="radio_sql_file_compression_plain" name="sql_file_compression" value="text/plain" />'
00264            . '<label for="radio_sql_file_compression_plain">' . $strNone . '</label>&nbsp;&nbsp;' . "\n";
00265         if ($is_gzip) {
00266             echo '                    <input type="radio" id="radio_sql_file_compression_gzip" name="sql_file_compression" value="application/x-gzip" />'
00267                . '<label for="radio_sql_file_compression_gzip">' . $strGzip . '</label>&nbsp;&nbsp;' . "\n";
00268         }
00269         if ($is_bzip) {
00270             echo '                    <input type="radio" id="radio_sql_file_compression_bzip" name="sql_file_compression" value="application/x-bzip" />'
00271                . '<label for="radio_sql_file_compression_bzip">' . $strBzip . '</label>&nbsp;&nbsp;' . "\n";
00272         }
00273     } else {
00274         $querybox_hidden_fields .= '                    <input type="hidden" name="sql_file_compression" value="text/plain" />' . "\n";
00275     }
00276     ?>
00277                 </td>
00278             </tr>
00279     <?php
00280 } // end if
00281 echo "\n";
00282 
00283 // web-server upload directory
00284 $is_upload_dir = false;
00285 if (!empty($cfg['UploadDir']) && !isset($is_inside_querywindow) ||
00286     (!empty($cfg['UploadDir']) && isset($is_inside_querywindow) && $is_inside_querywindow == TRUE && isset($querydisplay_tab) && ($querydisplay_tab == 'files' || $querydisplay_tab == 'full'))) {
00287 
00288     if (substr($cfg['UploadDir'], -1) != '/') {
00289         $cfg['UploadDir'] .= '/';
00290     }
00291     if ($handle = @opendir($cfg['UploadDir'])) {
00292         if (isset($is_inside_querywindow) && $is_inside_querywindow == TRUE) {
00293             $querybox_hidden_fields .= '            <input type="hidden" name="focus_querywindow" value="true" />' . "\n";
00294         }
00295 
00296         $is_first = 0;
00297         while ($file = @readdir($handle)) {
00298             if (is_file($cfg['UploadDir'] . $file) && PMA_checkFileExtensions($file, '.sql')) {
00299                 if ($is_first == 0) {
00300                     $is_upload_dir = true;
00301                     echo "\n";
00302                     echo '    ' . "\n"
00303                        . '        <tr bgcolor="' .$cfg['BgcolorTwo'].'"><td' . $queryframe_thcolspan . '>';
00304                     echo '        <b>&nbsp;' . $strWebServerUploadDirectory . ':&nbsp;</b>' . "\n";
00305                     echo '       </td></tr>' . "\n"
00306                        . '       <tr bgcolor="' . $cfg['BgcolorOne'] . '"><td' . $queryframe_thcolspan . '>';
00307                     // add 2004-05-08 by mkkeck
00308                     // todo: building a php script for indexing files in UploadDir
00309                     //if ($cfg['UploadDirIndex']) {
00310                     //    echo '&nbsp;&nbsp;<a href="' . $cfg['UploadDir'] . '" target="_blank">' . $cfg['UploadDir'] . '</a>&nbsp;';
00311                     //}
00312                     // end indexing
00313                     echo '        &nbsp;&nbsp;<select size="1" name="sql_localfile">' . "\n";
00314                     echo '            <option value="" selected="selected"></option>' . "\n";
00315                     $form_items++;
00316                 } // end if (is_first)
00317                 echo '            <option value="' . htmlspecialchars($file) . '">' . htmlspecialchars($file) . '</option>' . "\n";
00318                 $is_first++;
00319             } // end if (is_file)
00320         } // end while
00321         if ($is_first > 0) {
00322             echo '        </select>' . "\n"
00323                . '        </td></tr>' . "\n";
00324         } // end if (isfirst > 0)
00325         @closedir($handle);
00326         $upload_dir_error=''; // please see 'else {' below ;)
00327     }
00328     else {
00329         // modified by mkkeck 2004-05-08
00330         //   showing UploadDir Error at the end of all option for SQL-Queries
00331         $upload_dir_error.= '        <tr><td' . $queryframe_thcolspan . '><img src="' . $GLOBALS['pmaThemeImage'] . 'spacer.png' . '" width="1" height="1" border="0" alt="" /></td></tr>' . "\n"
00332                           . '        <tr>' . "\n"
00333                           . '            <th' . $queryframe_thcolspan . ' class="tblHeadError"><div class="errorhead">' . $strError . '</div></th>' . "\n"
00334                           . '        </tr>' . "\n"
00335                           . '        <tr>' . "\n"
00336                           . '            <td' . $queryframe_thcolspan . ' class="tblError">' . wordwrap($strWebServerUploadDirectoryError,80,'<br />&nbsp;') . '</td>' . "\n"
00337                           . '        </tr>' . "\n"
00338                           . '        <tr><td' . $queryframe_thcolspan . '><img src="' . $GLOBALS['pmaThemeImage'] . 'spacer.png' . '" width="1" height="1" border="0" alt="" /></td></tr>' . "\n";
00339     }
00340 } // end if (web-server upload directory)
00341 echo "\n";
00342 
00343 // Encoding setting form appended by Y.Kawada
00344 if (function_exists('PMA_set_enc_form')) {
00345     echo PMA_set_enc_form('            ');
00346     $form_items++;
00347 }
00348 
00349 // Charset conversion options and submit button
00350 if (($is_upload || $is_upload_dir) &&
00351         (!isset($is_inside_querywindow) ||
00352          (isset($is_inside_querywindow) && $is_inside_querywindow == TRUE && isset($querydisplay_tab) && ($querydisplay_tab == 'files' || $querydisplay_tab == 'full')))
00353         // It's possible that $db is empty: no db was selected on the left
00354         // panel and the user wants to execute a .sql file to create one)
00355         // && isset($db) && $db != ''){
00356         ){
00357 /*
00358     if ($cfg['AllowAnywhereRecoding'] && $allow_recoding) {
00359         $form_items++;
00360         echo '    <div style="margin-bottom: 5px">' . "\n";
00361         $temp_charset = reset($cfg['AvailableCharsets']);
00362         echo $strCharsetOfFile . "\n"
00363              . '    <select name="charset_of_file" size="1">' . "\n"
00364              . '            <option value="' . $temp_charset . '"';
00365         if ($temp_charset == $charset) {
00366             echo ' selected="selected"';
00367         }
00368         echo '>' . $temp_charset . '</option>' . "\n";
00369         while ($temp_charset = next($cfg['AvailableCharsets'])) {
00370             echo '            <option value="' . $temp_charset . '"';
00371             if ($temp_charset == $charset) {
00372                 echo ' selected="selected"';
00373             }
00374             echo '>' . $temp_charset . '</option>' . "\n";
00375         }
00376         echo '        </select><br />' . "\n" . '    ';
00377         echo '    </div>' . "\n";
00378     } // end if (recoding)
00379 */
00380     echo '    <tr class="tblFooters"><td' . $queryframe_tdcolspan . '>' . "\n";
00381     if (PMA_MYSQL_INT_VERSION < 40100 && $cfg['AllowAnywhereRecoding'] && $allow_recoding) {
00382         $temp_charset = reset($cfg['AvailableCharsets']);
00383         echo '&nbsp;' . $strCharsetOfFile
00384              . '&nbsp;<select name="charset_of_file" size="1">' . "\n"
00385              . '            <option value="' . $temp_charset . '"';
00386         if ($temp_charset == $charset) {
00387             echo ' selected="selected"';
00388         }
00389         echo '>' . $temp_charset . '</option>' . "\n";
00390         while ($temp_charset = next($cfg['AvailableCharsets'])) {
00391             echo '            <option value="' . $temp_charset . '"';
00392             if ($temp_charset == $charset) {
00393                 echo ' selected="selected"';
00394             }
00395             echo '>' . $temp_charset . '</option>' . "\n";
00396         }
00397         echo '        </select>' . "\n" . '    ';
00398     } // end if (recoding)
00399     else if (PMA_MYSQL_INT_VERSION >= 40100) {
00400         echo $strCharsetOfFile . "\n"
00401            . PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_CHARSET, 'charset_of_file', NULL, 'utf8', FALSE);
00402     }
00403     echo '        </td>' . "\n"
00404        . '        <td align="right"' . $queryframe_thcolspan . '><input type="submit" name="SQL" value="' . $strGo . '" /></td>' . "\n"
00405        . '    </tr>' . "\n\n";
00406 }
00407 
00408 // Bookmark Support
00409 $bookmark_go = FALSE;
00410 if (!isset($is_inside_querywindow) ||
00411     (isset($is_inside_querywindow) && $is_inside_querywindow == TRUE && isset($querydisplay_tab) && ($querydisplay_tab == 'history' || $querydisplay_tab == 'full'))) {
00412     if ($cfg['Bookmark']['db'] && $cfg['Bookmark']['table']) {
00413         if (($bookmark_list = PMA_listBookmarks($db, $cfg['Bookmark'])) && count($bookmark_list) > 0) {
00414             $form_items++;
00415             echo '    <tr><td' . $queryframe_thcolspan . '><img src="' . $GLOBALS['pmaThemeImage'] . 'spacer.png' . '" width="1" height="1" border="0" alt="" /></td></tr>' . "\n";
00416             echo '    <tr><td' . $queryframe_thcolspan . ' class="tblHeaders">' . "\n";
00417             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";
00418             echo '    </td></tr>' . "\n";
00419             if (isset($is_inside_querywindow) && $is_inside_querywindow == TRUE) {
00420                 $querybox_hidden_fields .= '            <input type="hidden" name="focus_querywindow" value="true" />' . "\n";
00421             }
00422 
00423             echo '    <tr bgcolor="' .$cfg['BgcolorOne'] . '"><td' . $queryframe_tdcolspan . '>' . "\n";
00424             echo '            <select name="id_bookmark" style="vertical-align: middle">' . "\n";
00425             echo '                <option value=""></option>' . "\n";
00426             foreach($bookmark_list AS $key => $value) {
00427                 echo '                <option value="' . htmlspecialchars($key) . '">' . htmlspecialchars($value) . '</option>' . "\n";
00428             }
00429             echo '            </select>' . "&nbsp;&nbsp;&nbsp;\n";
00430             echo '            ' . $strVar;
00431             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>)';
00432             echo ': <input type="text" name="bookmark_variable" class="textfield" size="10" style="vertical-align: middle" /><br />' . "\n";
00433             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";
00434             echo '            &nbsp;<input type="radio" name="action_bookmark" value="1" id="radio_bookmark1" style="vertical-align: middle" /><label for="radio_bookmark1">' . $strBookmarkView . '</label>' . "\n";
00435             echo '            &nbsp;<input type="radio" name="action_bookmark" value="2" id="radio_bookmark2" style="vertical-align: middle" /><label for="radio_bookmark2">' . $strDelete . '</label>' . "\n";
00436             echo '            <br />' . "\n";
00437             echo '            </td>' . "\n";
00438             echo '    <td valign="bottom" align="right">' . "\n";
00439             echo '        <input type="submit" name="SQL" value="' . $strGo . '" />';
00440             echo '    </td></tr>' . "\n";
00441             $bookmark_go = TRUE;
00442         }
00443     }
00444 }
00445 
00446 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)))) {
00447     if ($form_items > 0) {
00448         if ( $cfg['Bookmark']['db']
00449           && $cfg['Bookmark']['table']
00450           && (!isset($is_inside_querywindow)
00451             || (  isset($is_inside_querywindow)
00452                && $is_inside_querywindow == TRUE
00453                && isset($querydisplay_tab)
00454                //&& $querydisplay_tab != 'history'))) {
00455                && $querydisplay_tab == 'sql'))) {
00456 ?>
00457                 <tr><td<?php echo $queryframe_thcolspan; ?>><img src="<?php echo $GLOBALS['pmaThemeImage'] . 'spacer.png'; ?>" border="0" width="1" height="1" alt="" /></td></tr>
00458                 <tr><th<?php echo $queryframe_thcolspan; ?> align="left"><?php echo $strBookmarkThis; ?>:</th></tr>
00459                 <tr bgcolor="<?php echo $cfg['BgcolorTwo']; ?>">
00460                     <td<?php echo $queryframe_thcolspan; ?>>
00461                         <b><?php echo $strBookmarkOptions; ?>:</b>
00462                     </td>
00463                 </tr>
00464                 <tr bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
00465                     <td<?php echo $queryframe_thcolspan; ?>>
00466                        &nbsp;&nbsp;<?php echo $strBookmarkLabel; ?>: <input type="text" name="bkm_label" value="" /><br />
00467                        &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>
00468                     </td>
00469                 </tr>
00470                 <tr bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
00471                     <td align="right"<?php echo $queryframe_thcolspan; ?>>
00472                         <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; }"/>
00473                     </td>
00474                 </tr>
00475 <?php
00476         }
00477       } else {
00478             echo '                <tr><td' . $queryframe_thcolspan . '>' . "\n";
00479             // TODO: Add a more complete warning that no items (like for file import) where found.
00480             //       (After 2.5.2 release!)
00481             echo $strWebServerUploadDirectoryError;
00482             echo '                </td></tr>' . "\n";
00483       }
00484 }
00485 echo '                <tr><td' . $queryframe_thcolspan . ' height="1">' . "\n";
00486 echo $querybox_hidden_fields;
00487 echo '                </td></tr>';
00488 if ($upload_dir_error!='') {
00489     echo $upload_dir_error;
00490 }
00491 ?>
00492             </table>
00493         </form>
00494 
00495 <?php
00496 //if (!isset($is_inside_querywindow) || !$is_inside_querywindow) echo "</li>\n";
00497 if (!isset($is_inside_querywindow) ||
00498     (isset($is_inside_querywindow) && $is_inside_querywindow == TRUE && isset($querydisplay_tab) && ($querydisplay_tab == 'files' || $querydisplay_tab == 'full')) && isset($db) && $db != '') {
00499 
00500     // loic1: displays import dump feature only if file upload available
00501     $ldi_target = 'ldi_table.php?' . $url_query . (isset($is_inside_querywindow) && $is_inside_querywindow == TRUE ? '&amp;focus_querywindow=true' : '');
00502 
00503     if ($is_upload && isset($db) && isset($table)) {
00504         //if (!isset($is_inside_querywindow) || !$is_inside_querywindow) echo "<li>\n";
00505         if ($cfg['PropertiesIconic']) {
00506             $imgInsertTextfiles = '<img src="' . $pmaThemeImage. 'b_tblimport.png" '
00507                                 . 'width="16" height="16" hspace="2" border="0" align="middle" alt="' . $strInsertTextfiles. '" />';
00508         }else{
00509             $imgInsertTextfiles = '';
00510         }
00511         ?>
00512         <!-- Insert a text file -->
00513             <?php
00514             if ($cfg['QueryFrame'] && $cfg['QueryFrameJS']) {
00515             ?>
00516 
00517             <script type="text/javascript">
00518                 <!--
00519                 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>');
00520                 //-->
00521             </script>
00522 
00523             <?php
00524             } else {
00525             ?>
00526 
00527             <script type="text/javascript">
00528                 <!--
00529                 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>');
00530                 //-->
00531             </script>
00532 
00533             <?php
00534             }
00535             ?>
00536 
00537             <noscript>
00538                <a href="<?php echo $ldi_target; ?>"><?php
00539                   echo $imgInsertTextfiles . $strInsertTextfiles;
00540                ?></a>
00541             </noscript>
00542         <?php
00543         //if (!isset($is_inside_querywindow) || !$is_inside_querywindow) echo "</li>\n";
00544     }
00545 }
00546 echo "\n";
00547 ?>


Généré par TYPO3 Ameos avec  doxygen 1.4.6