Documentation TYPO3 par Ameos

db_details.php

00001 <?php
00002 /* $Id: db_details.php,v 2.19 2005/08/11 15:31:27 lem9 Exp $ */
00003 // vim: expandtab sw=4 ts=4 sts=4:
00004 
00005 
00009 require('./db_details_common.php');
00010 $url_query .= '&amp;goto=db_details.php';
00011 
00012 
00016 if (isset($show_query) && $show_query == '1') {
00017     // This script has been called by read_dump.php
00018     if (isset($sql_query_cpy)) {
00019         $query_to_display = $sql_query_cpy;
00020     }
00021     // Other cases
00022     else {
00023         $query_to_display = $sql_query;
00024     }
00025 } else {
00026     $query_to_display     = '';
00027 }
00028 
00029 
00034 $sub_part    = '';
00035 require('./db_details_db_info.php');
00036 if ($num_tables == 0 && empty($db_query_force)) {
00037     $is_info = TRUE;
00038     require('./db_details_structure.php');
00039     exit();
00040 }
00041 
00042 // loic1: defines wether file upload is available or not
00043 // (now defined in common.lib.php)
00044 
00045 $auto_sel  = ($cfg['TextareaAutoSelect']
00046                // 2003-02-05 rabus: This causes big trouble with Opera 7 for
00047                // Windows, so let's disable it there...
00048                && !(PMA_USR_OS == 'Win' && PMA_USR_BROWSER_AGENT == 'OPERA' && PMA_USR_BROWSER_VER >= 7))
00049            ? "\n" . '             onfocus="if (typeof(document.layers) == \'undefined\' || typeof(textarea_selected) == \'undefined\') {textarea_selected = 1; this.form.elements[\'sql_query\'].select();}"'
00050            : '';
00051 
00052 
00053 // for better administration
00054 $strHiddenFields = '        <input type="hidden" name="is_js_confirmed" value="0" />'  ."\n"
00055                  . '        ' .PMA_generate_common_hidden_inputs($db) . "\n"
00056                  . '        <input type="hidden" name="pos" value="0" />' . "\n"
00057                  . '        <input type="hidden" name="goto" value="db_details.php" />' . "\n"
00058                  . '        <input type="hidden" name="zero_rows" value="' . htmlspecialchars($strSuccess) . '" />' . "\n"
00059                  . '        <input type="hidden" name="prev_sql_query" value="' . ((!empty($query_to_display)) ? htmlspecialchars($query_to_display) : '') . '" />' . "\n";
00060 ?>
00061 <!-- Query box, sql file loader and bookmark support -->
00062 <form method="post" action="read_dump.php"<?php if ($is_upload) echo ' enctype="multipart/form-data"'; ?> onsubmit="return checkSqlQuery(this)" name="sqlform">
00063 <?php
00064 echo $strHiddenFields;
00065 ?>
00066 <a name="querybox"></a>
00067 <table border="0" cellpadding="2" cellspacing="0">
00068 <tr><td class="tblHeaders" colspan="2">
00069     <?php
00070            // if you want navigation:
00071            $strDBLink = '<a href="' . $GLOBALS['cfg']['DefaultTabDatabase'] . '?' . PMA_generate_common_url() . '&amp;db=' . urlencode($db) . '">'
00072                       . htmlspecialchars($db) . '</a>';
00073            // else use
00074            // $strDBLink = htmlspecialchars($db);
00075             echo '&nbsp;' . sprintf($strRunSQLQuery, $strDBLink) . ':&nbsp;' . PMA_showMySQLDocu('Reference', 'SELECT');
00076 
00077     ?>
00078 </td></tr>
00079 <tr align="center" bgcolor="<?php echo $cfg['BgcolorOne']; ?>"><td colspan="2">
00080 <textarea name="sql_query" cols="<?php echo $cfg['TextareaCols'] * 2; ?>" rows="<?php echo $cfg['TextareaRows']; ?>" dir="<?php echo $text_dir; ?>"<?php echo $auto_sel; ?>>
00081 <?php
00082 if (!empty($query_to_display)) {
00083     echo htmlspecialchars($query_to_display);
00084 } else {
00085     echo htmlspecialchars(str_replace('%d', PMA_backquote($db), $cfg['DefaultQueryDatabase']));
00086 }
00087 ?></textarea>
00088 </td></tr>
00089 <tr class="tblFooters">
00090     <td>
00091         <input type="checkbox" name="show_query" value="1" id="checkbox_show_query" checked="checked" /><label for="checkbox_show_query"><?php echo $strShowThisQuery; ?></label>
00092     </td>
00093     <td align="right"><input type="submit" name="SQL" value="<?php echo $strGo; ?>" /></td>
00094 </tr>
00095 <?php
00096 // loic1: displays import dump feature only if file upload available
00097 if ($is_upload) {
00098 ?>
00099 <tr><td colspan="2"><img src="<?php echo $GLOBALS['pmaThemeImage'] . 'spacer.png'; ?>" width="1" height="1" border="0" alt="" /></td></tr>
00100 <tr>
00101     <td colspan="2" class="tblHeaders">
00102         <i><?php echo $strOr; ?></i>
00103         <b><?php echo $strLocationTextfile; ?>:</b>
00104     </td>
00105 </tr>
00106 <tr bgcolor="<?php echo $cfg['BgcolorOne']; ?>">
00107   <td colspan="2" align="center">
00108     <input type="file" name="sql_file" class="textfield" />&nbsp;
00109     <?php
00110     echo PMA_displayMaximumUploadSize($max_upload_size) . '<br />';
00111     // some browsers should respect this :)
00112     echo '    ' . PMA_generateHiddenMaxFileSize($max_upload_size) . "\n";
00113     $is_gzip = ($cfg['GZipDump'] && @function_exists('gzopen'));
00114     $is_bzip = ($cfg['BZipDump'] && @function_exists('bzdecompress'));
00115     if ($is_bzip || $is_gzip) {
00116         echo '    </td>' . "\n"
00117            . '</tr>'   . "\n"
00118            . '<tr bgcolor="' . $cfg['BgcolorOne'] . '">' . "\n"
00119            . '    <td colspan="2">' . "\n";
00120         echo '        &nbsp;&nbsp;' . $strCompression . ':<br />&nbsp;&nbsp;&nbsp;' . "\n"
00121            . '            <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>&nbsp;&nbsp;' . "\n"
00122            . '            <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>&nbsp;&nbsp' . "\n";
00123         if ($is_gzip) {
00124             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>&nbsp;&nbsp;' . "\n";
00125         }
00126         if ($is_bzip) {
00127             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>&nbsp;&nbsp;' . "\n";
00128         }
00129     } else {
00130     ?>
00131         <input type="hidden" name="sql_file_compression" value="text/plain" />
00132     </td>
00133 </tr>
00134     <?php
00135     }
00136 } // end if (is upload)
00137 // web-server upload directory
00138 $is_upload_dir = false;
00139 if (!empty($cfg['UploadDir'])) {
00140     if (substr($cfg['UploadDir'], -1) != '/') {
00141         $cfg['UploadDir'] .= '/';
00142     }
00143     if ($handle = @opendir($cfg['UploadDir'])) {
00144         $is_first = 0;
00145         while ($file = @readdir($handle)) {
00146             if (is_file($cfg['UploadDir'] . $file) && PMA_checkFileExtensions($file, '.sql')) {
00147                 if ($is_first == 0) {
00148                     $is_upload_dir = true;
00149                     echo "\n";
00150                     echo '    <tr><td colspan=2" bgcolor="' . $cfg['BgcolorTwo'] . '">' . "\n";
00151                     echo '        &nbsp;<b>' . $strWebServerUploadDirectory . ':</b>&nbsp;' . "\n";
00152                     echo '    </td></tr>' . "\n";
00153                     echo '    <tr bgcolor="' . $cfg['BgcolorOne'] . '"><td colspan="2">' . "\n";
00154                     // add 2004-05-08 by mkkeck
00155                     // todo: building a php script for indexing files in UploadDir
00156                     //if ($cfg['UploadDirIndex']) {
00157                     //    echo '&nbsp;<a href="' . $cfg['UploadDir'] . '" target="_blank">' . $cfg['UploadDir'] . '</a>&nbsp;';
00158                     //}
00159                     // end indexing
00160                     echo '        <select size="1" name="sql_localfile">' . "\n";
00161                     echo '            <option value="" selected="selected"></option>' . "\n";
00162                 } // end if (is_first)
00163                 echo '            <option value="' . htmlspecialchars($file) . '">' . htmlspecialchars($file) . '</option>' . "\n";
00164                 $is_first++;
00165             } // end if (is_file)
00166         } // end while
00167         if ($is_first > 0) {
00168             echo '        </select>' . "\n"
00169                . '    </td>'
00170                . '    </tr>' . "\n\n";
00171         } // end if (isfirst > 0)
00172         @closedir($handle);
00173     }
00174     else {
00175         $upload_dir_error = '<tr><td colspan="2"><img src="' .$GLOBALS['pmaThemeImage'] . 'spacer.png'  . '" width="1" height="1" border="0" alt="" /></td></tr>' . "\n"
00176                           . '<tr><th colspan="2" class="tblHeadError"><div class="errorhead">' . $strError . '</div></th></tr>' . "\n"
00177                           . '<tr><td colspan="2" class="tblError">' . $strWebServerUploadDirectoryError
00178                           . '</td></tr>' . "\n";
00179     }
00180 } // end if (web-server upload directory)
00181 // Charset conversion options
00182 if ($is_upload || $is_upload_dir) {
00183     echo '    <tr class="tblFooters"><td>' . "\n";
00184     if (PMA_MYSQL_INT_VERSION < 40100 && $cfg['AllowAnywhereRecoding'] && $allow_recoding) {
00185         $temp_charset = reset($cfg['AvailableCharsets']);
00186         echo '&nbsp;' . $strCharsetOfFile . "\n"
00187              . '    <select name="charset_of_file" size="1">' . "\n"
00188              . '            <option value="' . $temp_charset . '"';
00189         if ($temp_charset == $charset) {
00190             echo ' selected="selected"';
00191         }
00192         echo '>' . $temp_charset . '</option>' . "\n";
00193         while ($temp_charset = next($cfg['AvailableCharsets'])) {
00194             echo '            <option value="' . $temp_charset . '"';
00195             if ($temp_charset == $charset) {
00196                 echo ' selected="selected"';
00197             }
00198             echo '>' . $temp_charset . '</option>' . "\n";
00199         }
00200         echo '        </select><br />' . "\n" . '    ';
00201     } elseif (PMA_MYSQL_INT_VERSION >= 40100) {
00202         echo $strCharsetOfFile . "\n";
00203         echo PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_CHARSET, 'charset_of_file', NULL, 'utf8', FALSE);
00204     } // end if (recoding)
00205     echo '    </td>' . "\n";
00206     echo '    <td align="right"><input type="submit" name="SQL" value="' . $strGo . '" /></td>' . "\n";
00207     echo '    </tr>' . "\n";
00208 }
00209 // Bookmark Support
00210 if ($cfg['Bookmark']['db'] && $cfg['Bookmark']['table']) {
00211     if (($bookmark_list = PMA_listBookmarks($db, $cfg['Bookmark'])) && count($bookmark_list) > 0) {
00212         echo '    <tr><td colspan="2"><img src="' .$GLOBALS['pmaThemeImage'] . 'spacer.png'  . '" width="1" height="1" border="0" alt="" /></td></tr>' . "\n";
00213         echo '    <tr><td colspan="2" class="tblHeaders">&nbsp;<i>' . $strOr . '</i></td></tr>' . "\n";
00214         echo '    <tr bgcolor="' . $cfg['BgcolorOne'] . '"><td colspan="2">' . "\n";
00215         echo '        <b>' . $strBookmarkQuery . ':</b>&nbsp;' . "\n";
00216         echo '        <select name="id_bookmark">' . "\n";
00217         echo '            <option value=""></option>' . "\n";
00218         foreach ($bookmark_list AS $key => $value) {
00219             echo '            <option value="' . htmlspecialchars($key) . '">' . htmlspecialchars($value) . '</option>' . "\n";
00220         }
00221         echo '        </select>' . "\n";
00222         echo '    </td></tr><tr bgcolor="' . $cfg['BgcolorOne'] . '"><td colspan="2">';
00223         echo '            ' . $strVar . ' ';
00224         if ($cfg['ReplaceHelpImg']){
00225             echo '<a href="./Documentation.html#faqbookmark" target="documentation">'
00226              . '<img src="' .$pmaThemeImage . 'b_help.png" border="0" width="11" height="11" align="middle" alt="' . $strDocu . '" /></a>';
00227         }else{
00228             echo '(<a href="./Documentation.html#faqbookmark" target="documentation">' . $strDocu . '</a>):&nbsp;';
00229         }
00230         echo '        <input type="text" name="bookmark_variable" class="textfield" size="10" />' . "\n";
00231         echo '    </td></tr><tr bgcolor="' . $cfg['BgcolorOne'] . '"><td>';
00232         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";
00233         echo '        &nbsp;<input type="radio" name="action_bookmark" value="1" id="radio_bookmark1" style="vertical-align: middle" /><label for="radio_bookmark1">' . $strBookmarkView . '</label>' . "\n";
00234         echo '        &nbsp;<input type="radio" name="action_bookmark" value="2" id="radio_bookmark2" style="vertical-align: middle" /><label for="radio_bookmark2">' . $strDelete . '</label>' . "\n";
00235         echo '        </td>' . "\n";
00236         echo '        <td align="right"><input type="submit" name="SQL" value="' . $strGo . '" /></td>';
00237         echo '    </tr>' . "\n";
00238    }
00239 }
00240 
00241 // Encoding setting form appended by Y.Kawada
00242 if (function_exists('PMA_set_enc_form')) {
00243     echo PMA_set_enc_form('    ');
00244 }
00245 // modified by mkkeck 2004-05-08
00246 //   showing UploadDir Error at the end of all option for SQL-Queries
00247 if (isset($upload_dir_error)) {
00248     echo $upload_dir_error;
00249 }
00250 ?>
00251 </table>
00252 </form>
00253 <?php
00257 echo "\n";
00258 require_once('./footer.inc.php');
00259 ?>


Généré par L'expert TYPO3 avec  doxygen 1.4.6