Documentation TYPO3 par Ameos |
00001 <?php 00002 /* $Id: ldi_table.php,v 2.10 2004/10/21 10:18:12 nijel Exp $ */ 00003 // vim: expandtab sw=4 ts=4 sts=4: 00004 00005 00010 require_once('./libraries/grab_globals.lib.php'); 00011 00012 // Check parameters 00013 require_once('./libraries/common.lib.php'); 00014 PMA_checkParameters(array('db', 'table')); 00015 00016 00020 require('./tbl_properties_common.php'); 00021 $err_url = 'ldi_table.php' . $err_url; 00022 $url_query .= '&goto=ldi_table.php&back=ldi_table.php'; 00023 require('./tbl_properties_table_info.php'); 00024 require('./tbl_properties_links.php'); 00025 00029 ?> 00030 <form action="ldi_check.php" method="post" enctype="multipart/form-data"> 00031 <table cellpadding="5" border="2"> 00032 <tr> 00033 <td><?php echo $strLocationTextfile; ?></td> 00034 <td colspan="2"><input type="file" name="textfile" /> 00035 <?php 00036 echo PMA_displayMaximumUploadSize($max_upload_size); 00037 // some browsers should respect this :) 00038 echo ' ' . PMA_generateHiddenMaxFileSize($max_upload_size) . "\n"; 00039 00040 if (!empty($cfg['UploadDir'])) { 00041 if (substr($cfg['UploadDir'], -1) != '/') { 00042 $cfg['UploadDir'] .= '/'; 00043 } 00044 if ($handle = @opendir($cfg['UploadDir'])) { 00045 $is_first = 0; 00046 while ($file = @readdir($handle)) { 00047 if (is_file($cfg['UploadDir'] . $file) && substr($file, -4) == '.csv') { 00048 if ($is_first == 0) { 00049 $is_upload_dir = true; 00050 echo "<br />\n"; 00051 echo ' <i>' . $strOr . '</i> ' . $strWebServerUploadDirectory . ': ' . "\n"; 00052 echo ' <div style="margin-bottom: 5px">' . "\n"; 00053 echo ' <select size="1" name="local_textfile">' . "\n"; 00054 echo ' <option value="" selected="selected"></option>' . "\n"; 00055 } // end if (is_first) 00056 echo ' <option value="' . htmlspecialchars($file) . '">' . htmlspecialchars($file) . '</option>' . "\n"; 00057 $is_first++; 00058 } // end if (is_file) 00059 } // end while 00060 if ($is_first > 0) { 00061 echo ' </select>' . "\n" 00062 . ' </div>' . "\n\n"; 00063 } // end if (isfirst > 0) 00064 @closedir($handle); 00065 } else { 00066 echo ' <div style="margin-bottom: 5px">' . "\n"; 00067 echo ' <font color="red">' . $strError . '</font><br />' . "\n"; 00068 echo ' ' . $strWebServerUploadDirectoryError . "\n"; 00069 echo ' </div>' . "\n"; 00070 } 00071 } // end if (web-server upload directory) 00072 echo "\n"; 00073 ?> 00074 </td> 00075 </tr> 00076 00077 <?php 00078 if ($cfg['AllowAnywhereRecoding'] && $allow_recoding) { 00079 $temp_charset = reset($cfg['AvailableCharsets']); 00080 echo ' <tr>' . "\n" 00081 . ' <td>' . $strCharsetOfFile . '</td>' . "\n" 00082 . ' <td colspan="2">' . "\n" 00083 . ' <select name="charset_of_file" size="1">' . "\n" 00084 . ' <option value="' . $temp_charset . '"'; 00085 if ($temp_charset == $charset) { 00086 echo ' selected="selected"'; 00087 } 00088 echo '>' . $temp_charset . '</option>' . "\n"; 00089 while ($temp_charset = next($cfg['AvailableCharsets'])) { 00090 echo ' <option value="' . $temp_charset . '"'; 00091 if ($temp_charset == $charset) { 00092 echo ' selected="selected"'; 00093 } 00094 echo '>' . $temp_charset . '</option>' . "\n"; 00095 } // end while 00096 echo ' </select>' . "\n"; 00097 echo ' </td>' . "\n"; 00098 echo ' </tr>'; 00099 } // end if 00100 echo "\n"; 00101 ?> 00102 <tr> 00103 <td><?php echo $strReplaceTable; ?></td> 00104 <td><input type="checkbox" name="replace" value="REPLACE" id="checkbox_replace" /><label for="checkbox_replace"><?php echo $strReplace; ?></label></td> 00105 <td><?php echo $strTheContents; ?></td> 00106 </tr> 00107 <tr> 00108 <td><?php echo $strFieldsTerminatedBy; ?></td> 00109 <td><input type="text" name="field_terminater" size="4" maxlength="4" value=";" /></td> 00110 <td><?php echo $strTheTerminator; ?></td> 00111 </tr> 00112 <tr> 00113 <td><?php echo $strFieldsEnclosedBy; ?></td> 00114 <td> 00115 <input type="text" name="enclosed" size="1" maxlength="1" value=""" /> 00116 <input type="checkbox" name="enclose_option" value="OPTIONALLY" id="checkbox_enclose_option" /><label for="checkbox_enclose_option"><?php echo $strOptionally; ?></label> 00117 </td> 00118 <td><?php echo $strOftenQuotation; ?></td> 00119 </tr> 00120 <tr> 00121 <td><?php echo $strFieldsEscapedBy; ?></td> 00122 <td><input type="text" name="escaped" size="2" maxlength="2" value="\" /></td> 00123 <td><?php echo $strOptionalControls; ?></td> 00124 </tr> 00125 <tr> 00126 <td><?php echo $strLinesTerminatedBy; ?></td> 00127 <td><input type="text" name="line_terminator" size="8" maxlength="8" value="<?php echo ((PMA_whichCrlf() == "\n") ? '\n' : '\r\n'); ?>" /></td> 00128 <td><?php echo $strCarriage; ?><br /><?php echo $strLineFeed; ?></td> 00129 </tr> 00130 <tr> 00131 <td><?php echo $strColumnNames; ?></td> 00132 <td><input type="text" name="column_name" /></td> 00133 <td><?php echo $strIfYouWish; ?></td> 00134 </tr> 00135 <?php 00136 // 2002/2/22 appended by Y.Kawada: Kanji encoding convert controls 00137 if (function_exists('PMA_set_enc_form')) { 00138 echo ' <tr>' . "\n" 00139 . ' <td>' . $strKanjiEncodConvert . '</td>' . "\n" 00140 . ' <td colspan=2>' . "\n" 00141 . PMA_set_enc_form(' ') 00142 . ' </td>' . "\n" 00143 . ' </tr>' . "\n"; 00144 } // end if 00145 00146 00147 // Check if we should check the LOCAL radio button by default 00148 $local_option_selected = FALSE; 00149 00150 if (PMA_MYSQL_INT_VERSION < 32349) { 00151 $local_option_selected = TRUE; 00152 } 00153 00154 if (PMA_MYSQL_INT_VERSION > 40003) { 00155 $result = PMA_DBI_try_query('SHOW VARIABLES LIKE \'local\\_infile\';'); 00156 if ($result != FALSE && PMA_DBI_num_rows($result) > 0) { 00157 $tmp = PMA_DBI_fetch_row($result); 00158 if ($tmp[1] == 'ON') { 00159 $local_option_selected = TRUE; 00160 } 00161 } 00162 PMA_DBI_free_result($result); 00163 unset($result); 00164 } 00165 00166 ?> 00167 <tr> 00168 <td><?php echo $strLoadMethod; ?> 00169 </td> 00170 <td> 00171 <input type="radio" id="radio_local_option_0" name="local_option" value="0" <?php echo (!$local_option_selected ? ' checked="checked" ' : ''); ?>/><label for="radio_local_option_0">...DATA</label><br /> 00172 <input type="radio" id="radio_local_option_1" name="local_option" value="1" <?php echo ($local_option_selected ? ' checked="checked" ' : ''); ?>/><label for="radio_local_option_1">...DATA LOCAL</label> 00173 </td> 00174 <td><?php echo $strLoadExplanation; ?> 00175 </td> 00176 </tr> 00177 <tr> 00178 <td colspan="3" align="center"><?php print PMA_showMySQLDocu('Reference', 'LOAD_DATA'); ?></td> 00179 </tr> 00180 <tr> 00181 <td colspan="3" align="center"> 00182 <?php echo PMA_generate_common_hidden_inputs($db, $table); ?> 00183 <input type="hidden" name="zero_rows" value="<?php echo $strTheContent; ?>" /> 00184 <input type="hidden" name="goto" value="tbl_properties.php" /> 00185 <input type="hidden" name="back" value="ldi_table.php" /> 00186 <input type="hidden" name="into_table" value="<?php echo htmlspecialchars($table); ?>" /> 00187 <input type="submit" name="btnLDI" value="<?php echo $strSubmit; ?>" /> 00188 <input type="reset" value="<?php echo $strReset; ?>" /> 00189 </td> 00190 </tr> 00191 </table> 00192 </form> 00193 00194 00195 <?php 00199 require_once('./footer.inc.php'); 00200 ?>