home *** CD-ROM | disk | FTP | other *** search
/ Enter 2004 June / ENTER.ISO / files / xampp-win32-1.4.5-installer.exe / xampp / db_details.php < prev    next >
Encoding:
PHP Script  |  2003-12-12  |  9.3 KB  |  208 lines

  1. <?php
  2. /* $Id: db_details.php,v 2.5 2003/12/12 16:51:13 lem9 Exp $ */
  3. // vim: expandtab sw=4 ts=4 sts=4:
  4.  
  5.  
  6. /**
  7.  * Runs common work
  8.  */
  9. require('./db_details_common.php');
  10. $url_query .= '&goto=db_details.php';
  11.  
  12.  
  13. /**
  14.  * Database work
  15.  */
  16. if (isset($show_query) && $show_query == '1') {
  17.     // This script has been called by read_dump.php
  18.     if (isset($sql_query_cpy)) {
  19.         $query_to_display = $sql_query_cpy;
  20.     }
  21.     // Other cases
  22.     else {
  23.         $query_to_display = $sql_query;
  24.     }
  25. } else {
  26.     $query_to_display     = '';
  27. }
  28.  
  29.  
  30. /**
  31.  * Gets informations about the database and, if it is empty, move to the
  32.  * "db_details_structure.php" script where table can be created
  33.  */
  34. $sub_part    = '';
  35. require('./db_details_db_info.php');
  36. if ($num_tables == 0 && empty($db_query_force)) {
  37.     $is_info = TRUE;
  38.     require('./db_details_structure.php');
  39.     exit();
  40. }
  41.  
  42. // loic1: defines wether file upload is available or not
  43. // (now defined in common.lib.php)
  44.  
  45. $auto_sel  = ($cfg['TextareaAutoSelect']
  46.                // 2003-02-05 rabus: This causes big trouble with Opera 7 for
  47.                // Windows, so let's disable it there...
  48.                && !(PMA_USR_OS == 'Win' && PMA_USR_BROWSER_AGENT == 'OPERA' && PMA_USR_BROWSER_VER >= 7))
  49.            ? "\n" . '             onfocus="if (typeof(document.layers) == \'undefined\' || typeof(textarea_selected) == \'undefined\') {textarea_selected = 1; this.form.elements[\'sql_query\'].select();}"'
  50.            : '';
  51. ?>
  52. <!-- Query box, sql file loader and bookmark support -->
  53. <a name="querybox"></a>
  54. <form method="post" action="read_dump.php"<?php if ($is_upload) echo ' enctype="multipart/form-data"'; echo "\n"; ?>
  55.     onsubmit="return checkSqlQuery(this)">
  56.     <input type="hidden" name="is_js_confirmed" value="0" />
  57.     <?php echo PMA_generate_common_hidden_inputs($db); ?>
  58.     <input type="hidden" name="pos" value="0" />
  59.     <input type="hidden" name="goto" value="db_details.php" />
  60.     <input type="hidden" name="zero_rows" value="<?php echo htmlspecialchars($strSuccess); ?>" />
  61.     <input type="hidden" name="prev_sql_query" value="<?php echo ((!empty($query_to_display)) ? htmlspecialchars($query_to_display) : ''); ?>" />
  62.     <?php echo sprintf($strRunSQLQuery, htmlspecialchars($db)) . ' ' . PMA_showMySQLDocu('Reference', 'SELECT'); ?> :<br />
  63.     <div style="margin-bottom: 5px">
  64. <textarea name="sql_query" cols="<?php echo $cfg['TextareaCols'] * 2; ?>" rows="<?php echo $cfg['TextareaRows']; ?>" wrap="virtual" dir="<?php echo $text_dir; ?>"<?php echo $auto_sel; ?>>
  65. <?php
  66. if (!empty($query_to_display)) {
  67.     echo htmlspecialchars($query_to_display);
  68. } else {
  69.     echo htmlspecialchars(str_replace('%d', PMA_backquote($db), $cfg['DefaultQueryDatabase']));
  70. }
  71. ?></textarea><br />
  72.         <input type="checkbox" name="show_query" value="1" id="checkbox_show_query" checked="checked" /> 
  73.         <label for="checkbox_show_query"><?php echo $strShowThisQuery; ?></label><br />
  74.     </div>
  75. <?php
  76. // loic1: displays import dump feature only if file upload available
  77. if ($is_upload) {
  78.     echo '    <i>' . $strOr . '</i> ' . $strLocationTextfile . ' :<br />' . "\n";
  79.     ?>
  80.     <div style="margin-bottom: 5px">
  81.         <input type="file" name="sql_file" class="textfield" /> <?php echo PMA_displayMaximumUploadSize($max_upload_size);?><br />
  82.     <?php
  83.     // some browsers should respect this :)
  84.     echo '    ' . PMA_generateHiddenMaxFileSize($max_upload_size) . "\n";
  85.  
  86.     $is_gzip = ($cfg['GZipDump'] && @function_exists('gzopen'));
  87.     $is_bzip = ($cfg['BZipDump'] && @function_exists('bzdecompress'));
  88.     if ($is_bzip || $is_gzip) {
  89.         echo '        ' . $strCompression . ':' . "\n"
  90.            . '            <input type="radio" id="radio_sql_file_compression_auto" name="sql_file_compression" value="" checked="checked" />' . "\n"
  91.            . '            <label for="radio_sql_file_compression_auto">' . $strAutodetect . '</label>   ' . "\n"
  92.            . '            <input type="radio" id="radio_sql_file_compression_plain" name="sql_file_compression" value="text/plain" />' . "\n"
  93.            . '            <label for="radio_sql_file_compression_plain">' . $strNone . '</label>   ' . "\n";
  94.         if ($is_gzip) {
  95.             echo '            <input type="radio" id="radio_sql_file_compression_gzip" name="sql_file_compression" value="application/x-gzip" />' . "\n"
  96.                . '            <label for="radio_sql_file_compression_gzip">' . $strGzip . '</label>   ' . "\n";
  97.         }
  98.         if ($is_bzip) {
  99.             echo '            <input type="radio" id="radio_sql_file_compression_bzip" name="sql_file_compression" value="application/x-bzip" />' . "\n"
  100.                . '            <label for="radio_sql_file_compression_bzip">' . $strBzip . '</label>   ' . "\n";
  101.         }
  102.     } else {
  103.         echo '        <input type="hidden" name="sql_file_compression" value="text/plain" />' . "\n";
  104.     }
  105.     ?>
  106.     </div>
  107.     <?php
  108. } // end if (is upload)
  109. echo "\n";
  110.  
  111. // web-server upload directory
  112.  
  113. $is_upload_dir = false;
  114. if (!empty($cfg['UploadDir'])) {
  115.     if (substr($cfg['UploadDir'], -1) != '/') {
  116.         $cfg['UploadDir'] .= '/';
  117.     }
  118.     if ($handle = @opendir($cfg['UploadDir'])) {
  119.         $is_first = 0;
  120.         while ($file = @readdir($handle)) {
  121.             if (is_file($cfg['UploadDir'] . $file) && PMA_checkFileExtensions($file, '.sql')) {
  122.                 if ($is_first == 0) {
  123.                     $is_upload_dir = true;
  124.                     echo "\n";
  125.                     echo '    <i>' . $strOr . '</i> ' . $strWebServerUploadDirectory . ' :<br />' . "\n";
  126.                     echo '    <div style="margin-bottom: 5px">' . "\n";
  127.                     echo '        <select size="1" name="sql_localfile">' . "\n";
  128.                     echo '            <option value="" selected="selected"></option>' . "\n";
  129.                 } // end if (is_first)
  130.                 echo '            <option value="' . htmlspecialchars($file) . '">' . htmlspecialchars($file) . '</option>' . "\n";
  131.                 $is_first++;
  132.             } // end if (is_file)
  133.         } // end while
  134.         if ($is_first > 0) {
  135.             echo '        </select>' . "\n"
  136.                  . '    </div>' . "\n\n";
  137.         } // end if (isfirst > 0)
  138.         @closedir($handle);
  139.     }
  140.     else {
  141.         echo '    <div style="margin-bottom: 5px">' . "\n";
  142.         echo '        <font color="red">' . $strError . '</font><br />' . "\n";
  143.         echo '        ' . $strWebServerUploadDirectoryError . "\n";
  144.         echo '    </div>' . "\n";
  145.     }
  146. } // end if (web-server upload directory)
  147.  
  148. // Charset conversion options
  149. if ($is_upload || $is_upload_dir) {
  150.     if ($cfg['AllowAnywhereRecoding'] && $allow_recoding) {
  151.         echo '    <div style="margin-bottom: 5px">' . "\n";
  152.         $temp_charset = reset($cfg['AvailableCharsets']);
  153.         echo $strCharsetOfFile . "\n"
  154.              . '    <select name="charset_of_file" size="1">' . "\n"
  155.              . '            <option value="' . $temp_charset . '"';
  156.         if ($temp_charset == $charset) {
  157.             echo ' selected="selected"';
  158.         }
  159.         echo '>' . $temp_charset . '</option>' . "\n";
  160.         while ($temp_charset = next($cfg['AvailableCharsets'])) {
  161.             echo '            <option value="' . $temp_charset . '"';
  162.             if ($temp_charset == $charset) {
  163.                 echo ' selected="selected"';
  164.             }
  165.             echo '>' . $temp_charset . '</option>' . "\n";
  166.         }
  167.         echo '        </select><br />' . "\n" . '    ';
  168.         echo '    </div>' . "\n";
  169.     } // end if (recoding)
  170. }
  171.  
  172. // Bookmark Support
  173. if ($cfg['Bookmark']['db'] && $cfg['Bookmark']['table']) {
  174.     if (($bookmark_list = PMA_listBookmarks($db, $cfg['Bookmark'])) && count($bookmark_list) > 0) {
  175.         echo "    <i>$strOr</i> $strBookmarkQuery :<br />\n";
  176.         echo '    <div style="margin-bottom: 5px">' . "\n";
  177.         echo '        <select name="id_bookmark">' . "\n";
  178.         echo '            <option value=""></option>' . "\n";
  179.         foreach($bookmark_list AS $key => $value) {
  180.             echo '            <option value="' . htmlspecialchars($value) . '">' . htmlspecialchars($key) . '</option>' . "\n";
  181.         }
  182.         echo '        </select>' . "<br />\n";
  183.         echo '            ' . $strVar . ' (<a href="./Documentation.html#faqbookmark" target="documentation">' . $strDocu . '</a>): <input type="text" name="bookmark_variable" class="textfield" size="10" />' . "\n";
  184.         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";
  185.         echo '         <input type="radio" name="action_bookmark" value="1" id="radio_bookmark1" style="vertical-align: middle" /><label for="radio_bookmark1">' . $strBookmarkView . '</label>' . "\n";
  186.         echo '         <input type="radio" name="action_bookmark" value="2" id="radio_bookmark2" style="vertical-align: middle" /><label for="radio_bookmark2">' . $strDelete . '</label>' . "\n";
  187.         echo '        <br />' . "\n";
  188.         echo '    </div>' . "\n";
  189.     }
  190. }
  191.  
  192. // Encoding setting form appended by Y.Kawada
  193. if (function_exists('PMA_set_enc_form')) {
  194.     echo PMA_set_enc_form('    ');
  195. }
  196. ?>
  197.     <input type="submit" name="SQL" value="<?php echo $strGo; ?>" />
  198. </form>
  199.  
  200.  
  201. <?php
  202. /**
  203.  * Displays the footer
  204.  */
  205. echo "\n";
  206. require_once('./footer.inc.php');
  207. ?>
  208.