Use file common file listing.
This commit is contained in:
@@ -29,6 +29,7 @@ $Source$
|
||||
* libraries/display_import.lib.php, libraries/file_listing.php: Sort file
|
||||
list on import tab, prepare generic framework to be used elsewhere (RFE
|
||||
#1303145).
|
||||
* tbl_change.php: Use file common file listing.
|
||||
|
||||
2005-09-26 Sebastian Mendel <cybot_tm@users.sourceforge.net>
|
||||
* libraries/database_interface.lib.php: fixed bug in PMA_DBI_fetch_*()
|
||||
|
@@ -10,14 +10,14 @@
|
||||
* @param string regullar expression to match files
|
||||
* @returns array sorted file list on success, FALSE on failure
|
||||
*/
|
||||
function PMA_getDirContent($dir, $expression) {
|
||||
function PMA_getDirContent($dir, $expression = '') {
|
||||
if ($handle = @opendir($dir)) {
|
||||
$result = array();
|
||||
if (substr($dir, -1) != '/') {
|
||||
$dir .= '/';
|
||||
}
|
||||
while ($file = @readdir($handle)) {
|
||||
if (is_file($dir . $file) && preg_match($expression, $file)) {
|
||||
if (is_file($dir . $file) && ($expression == '' || preg_match($expression, $file))) {
|
||||
$result[] = $file;
|
||||
}
|
||||
}
|
||||
@@ -37,7 +37,7 @@ function PMA_getDirContent($dir, $expression) {
|
||||
* @param string currently active choice
|
||||
* @returns array sorted file list on success, FALSE on failure
|
||||
*/
|
||||
function PMA_getFileSelectOptions($dir, $extensions, $active = '') {
|
||||
function PMA_getFileSelectOptions($dir, $extensions = '', $active = '') {
|
||||
$list = PMA_getDirContent($dir, $extensions);
|
||||
if ($list === FALSE) return FALSE;
|
||||
$result = '';
|
||||
|
@@ -9,6 +9,7 @@ require_once('./libraries/grab_globals.lib.php');
|
||||
$js_to_run = 'tbl_change.js';
|
||||
require_once('./header.inc.php');
|
||||
require_once('./libraries/relation.lib.php'); // foreign keys
|
||||
require_once('./libraries/file_listing.php'); // file listing
|
||||
|
||||
|
||||
/**
|
||||
@@ -766,30 +767,17 @@ foreach ($loop_array AS $vrowcount => $vrow) {
|
||||
}
|
||||
|
||||
if (!empty($cfg['UploadDir'])) {
|
||||
if (substr($cfg['UploadDir'], -1) != '/') {
|
||||
$cfg['UploadDir'] .= '/';
|
||||
}
|
||||
if ($handle = @opendir($cfg['UploadDir'])) {
|
||||
$is_first = 0;
|
||||
while ($file = @readdir($handle)) {
|
||||
if (is_file($cfg['UploadDir'] . $file) && !PMA_checkFileExtensions($file, '.sql')) {
|
||||
if ($is_first == 0) {
|
||||
$files = PMA_getFileSelectOptions($cfg['UploadDir']);
|
||||
if ($files === FALSE) {
|
||||
echo ' <font color="red">' . $strError . '</font><br />' . "\n";
|
||||
echo ' ' . $strWebServerUploadDirectoryError . "\n";
|
||||
} elseif (!empty($files)) {
|
||||
echo "<br />\n";
|
||||
echo ' <i>' . $strOr . '</i>' . ' ' . $strWebServerUploadDirectory . ':<br />' . "\n";
|
||||
echo ' <select size="1" name="fields_uploadlocal_' . urlencode($field) . $vkey . '">' . "\n";
|
||||
echo ' <option value="" selected="selected"></option>' . "\n";
|
||||
} // 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 $files;
|
||||
echo ' </select>' . "\n";
|
||||
} // end if (isfirst > 0)
|
||||
@closedir($handle);
|
||||
} else {
|
||||
echo ' <font color="red">' . $strError . '</font><br />' . "\n";
|
||||
echo ' ' . $strWebServerUploadDirectoryError . "\n";
|
||||
}
|
||||
} // end if (web-server upload directory)
|
||||
|
||||
|
Reference in New Issue
Block a user