Support for user specific upload and save directories (RFE #1260039).
This commit is contained in:
@@ -12,6 +12,11 @@ $Source$
|
|||||||
Allow to limit list of shown languages (RFE #1328003).
|
Allow to limit list of shown languages (RFE #1328003).
|
||||||
* libraries/common.lib.php: Fix URL detection when not called from top
|
* libraries/common.lib.php: Fix URL detection when not called from top
|
||||||
level directory (eg. transformations overview).
|
level directory (eg. transformations overview).
|
||||||
|
* Documentation.html, config.default.php, export.php, import.php,
|
||||||
|
tbl_change.php, tbl_replace_fields.php, libraries/common.lib.php,
|
||||||
|
libraries/display_export.lib.php, libraries/display_import.lib.php,
|
||||||
|
libraries/sql_query_form.lib.php: Support for user specific upload and
|
||||||
|
save directories (RFE #1260039).
|
||||||
|
|
||||||
2005-10-18 Sebastian Mendel <cybot_tm@users.sourceforge.net>
|
2005-10-18 Sebastian Mendel <cybot_tm@users.sourceforge.net>
|
||||||
* querywindow.php: wrong handling of linebreaks in query: bug #1243888
|
* querywindow.php: wrong handling of linebreaks in query: bug #1243888
|
||||||
|
@@ -1661,6 +1661,9 @@ Defaults to FALSE (drop-down). <br />
|
|||||||
under a drop-down box when you click the database name, then the SQL
|
under a drop-down box when you click the database name, then the SQL
|
||||||
tab.
|
tab.
|
||||||
<br /><br />
|
<br /><br />
|
||||||
|
If you want different directory for each user, %u will be replaced
|
||||||
|
with username.
|
||||||
|
<br /><br />
|
||||||
Please note that the file names must have the suffix ".sql"
|
Please note that the file names must have the suffix ".sql"
|
||||||
(or ".sql.bz2" or ".sql.gz" if support for
|
(or ".sql.bz2" or ".sql.gz" if support for
|
||||||
compressed formats is enabled).
|
compressed formats is enabled).
|
||||||
@@ -1689,6 +1692,9 @@ Defaults to FALSE (drop-down). <br />
|
|||||||
<dd>
|
<dd>
|
||||||
The name of the directory, where dumps can be saved.
|
The name of the directory, where dumps can be saved.
|
||||||
<br /><br />
|
<br /><br />
|
||||||
|
If you want different directory for each user, %u will be replaced
|
||||||
|
with username.
|
||||||
|
<br /><br />
|
||||||
Please note that the directory has to be writable for user running
|
Please note that the directory has to be writable for user running
|
||||||
webserver.
|
webserver.
|
||||||
<br /><br />
|
<br /><br />
|
||||||
|
@@ -620,10 +620,11 @@ $cfg['SQLQuery']['Refresh'] = TRUE; // Refresh the results page
|
|||||||
*/
|
*/
|
||||||
$cfg['UploadDir'] = ''; // Directory for uploaded files that can be executed by
|
$cfg['UploadDir'] = ''; // Directory for uploaded files that can be executed by
|
||||||
// phpMyAdmin. For example './upload'. Leave empty for
|
// phpMyAdmin. For example './upload'. Leave empty for
|
||||||
// no upload directory support
|
// no upload directory support. Use %u for username
|
||||||
|
// inclusion.
|
||||||
$cfg['SaveDir'] = ''; // Directory where phpMyAdmin can save exported data on
|
$cfg['SaveDir'] = ''; // Directory where phpMyAdmin can save exported data on
|
||||||
// server. For example './save'. Leave empty for no save
|
// server. For example './save'. Leave empty for no save
|
||||||
// directory support.
|
// directory support. Use %u for username inclusion.
|
||||||
$cfg['docSQLDir'] = ''; // Directory for docSQL imports, phpMyAdmin can import
|
$cfg['docSQLDir'] = ''; // Directory for docSQL imports, phpMyAdmin can import
|
||||||
// docSQL files from that directory. For example
|
// docSQL files from that directory. For example
|
||||||
// './docSQL'. Leave empty for no docSQL import support.
|
// './docSQL'. Leave empty for no docSQL import support.
|
||||||
|
@@ -265,10 +265,7 @@ if ($asfile) {
|
|||||||
|
|
||||||
// Open file on server if needed
|
// Open file on server if needed
|
||||||
if ($save_on_server) {
|
if ($save_on_server) {
|
||||||
if (substr($cfg['SaveDir'], -1) != '/') {
|
$save_filename = PMA_userDir($cfg['SaveDir']) . preg_replace('@[/\\\\]@','_',$filename);
|
||||||
$cfg['SaveDir'] .= '/';
|
|
||||||
}
|
|
||||||
$save_filename = $cfg['SaveDir'] . preg_replace('@[/\\\\]@','_',$filename);
|
|
||||||
unset($message);
|
unset($message);
|
||||||
if (file_exists($save_filename) && empty($onserverover)) {
|
if (file_exists($save_filename) && empty($onserverover)) {
|
||||||
$message = sprintf($strFileAlreadyExists, htmlspecialchars($save_filename));
|
$message = sprintf($strFileAlreadyExists, htmlspecialchars($save_filename));
|
||||||
|
@@ -184,11 +184,7 @@ if (!empty($local_import_file) && !empty($cfg['UploadDir'])) {
|
|||||||
// sanitize $local_import_file as it comes from a POST
|
// sanitize $local_import_file as it comes from a POST
|
||||||
$local_import_file = PMA_securePath($local_import_file);
|
$local_import_file = PMA_securePath($local_import_file);
|
||||||
|
|
||||||
if (substr($cfg['UploadDir'], -1) != '/') {
|
$import_file = PMA_userDir($cfg['UploadDir']) . $local_import_file;
|
||||||
$cfg['UploadDir'] .= '/';
|
|
||||||
}
|
|
||||||
|
|
||||||
$import_file = $cfg['UploadDir'] . $local_import_file;
|
|
||||||
} else if (empty($import_file) || !is_uploaded_file($import_file)) {
|
} else if (empty($import_file) || !is_uploaded_file($import_file)) {
|
||||||
$import_file = 'none';
|
$import_file = 'none';
|
||||||
}
|
}
|
||||||
|
@@ -2933,6 +2933,16 @@ window.parent.updateTableTitle( '<?php echo $uni_tbl; ?>', '<?php echo PMA_jsFor
|
|||||||
return PMA_backquote($oldcol) . ' ' . PMA_generateFieldSpec($newcol, $type, $length, $attribute, $collation, $null, $default, $default_current_timestamp, $extra, $comment, $empty_a, -1, $default_orig);
|
return PMA_backquote($oldcol) . ' ' . PMA_generateFieldSpec($newcol, $type, $length, $attribute, $collation, $null, $default, $default_current_timestamp, $extra, $comment, $empty_a, -1, $default_orig);
|
||||||
} // end function
|
} // end function
|
||||||
|
|
||||||
|
function PMA_userDir($dir) {
|
||||||
|
global $cfg;
|
||||||
|
|
||||||
|
if (substr($dir, -1) != '/') {
|
||||||
|
$dir .= '/';
|
||||||
|
}
|
||||||
|
|
||||||
|
return str_replace('%u', $cfg['Server']['user'], $dir);
|
||||||
|
}
|
||||||
|
|
||||||
} // end if: minimal common.lib needed?
|
} // end if: minimal common.lib needed?
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@@ -754,7 +754,7 @@ function show_checked_option() {
|
|||||||
onclick="document.getElementById('checkbox_dump_asfile').checked = true;"
|
onclick="document.getElementById('checkbox_dump_asfile').checked = true;"
|
||||||
<?php PMA_exportCheckboxCheck('onserver'); ?> />
|
<?php PMA_exportCheckboxCheck('onserver'); ?> />
|
||||||
<label for="checkbox_dump_onserver">
|
<label for="checkbox_dump_onserver">
|
||||||
<?php echo sprintf($strSaveOnServer, htmlspecialchars($cfg['SaveDir'])); ?>
|
<?php echo sprintf($strSaveOnServer, htmlspecialchars(PMA_userDir($cfg['SaveDir']))); ?>
|
||||||
</label>,<br />
|
</label>,<br />
|
||||||
<input type="checkbox" name="onserverover" value="saveitover"
|
<input type="checkbox" name="onserverover" value="saveitover"
|
||||||
id="checkbox_dump_onserverover"
|
id="checkbox_dump_onserverover"
|
||||||
|
@@ -149,7 +149,7 @@ if (!empty($cfg['UploadDir'])) {
|
|||||||
}
|
}
|
||||||
$matcher = '@\.(' . $extensions . ')(\.(' . PMA_supportedDecompressions() . '))?$@';
|
$matcher = '@\.(' . $extensions . ')(\.(' . PMA_supportedDecompressions() . '))?$@';
|
||||||
|
|
||||||
$files = PMA_getFileSelectOptions($cfg['UploadDir'], $matcher, (isset($timeout_passed) && $timeout_passed && isset($local_import_file)) ? $local_import_file : '');
|
$files = PMA_getFileSelectOptions(PMA_userDir($cfg['UploadDir']), $matcher, (isset($timeout_passed) && $timeout_passed && isset($local_import_file)) ? $local_import_file : '');
|
||||||
echo '<div class="formelementrow">' . "\n";
|
echo '<div class="formelementrow">' . "\n";
|
||||||
if ($files === FALSE) {
|
if ($files === FALSE) {
|
||||||
echo ' <div class="warning">' . "\n";
|
echo ' <div class="warning">' . "\n";
|
||||||
|
@@ -469,7 +469,7 @@ function PMA_sqlQueryFormUpload() {
|
|||||||
$matcher = '@\.sql(\.(' . PMA_supportedDecompressions() . '))?$@'; // we allow only SQL here
|
$matcher = '@\.sql(\.(' . PMA_supportedDecompressions() . '))?$@'; // we allow only SQL here
|
||||||
|
|
||||||
if (!empty($GLOBALS['cfg']['UploadDir'])) {
|
if (!empty($GLOBALS['cfg']['UploadDir'])) {
|
||||||
$files = PMA_getFileSelectOptions($GLOBALS['cfg']['UploadDir'], $matcher, (isset($timeout_passed) && $timeout_passed && isset($local_import_file)) ? $local_import_file : '');
|
$files = PMA_getFileSelectOptions(PMA_userDir($GLOBALS['cfg']['UploadDir']), $matcher, (isset($timeout_passed) && $timeout_passed && isset($local_import_file)) ? $local_import_file : '');
|
||||||
} else {
|
} else {
|
||||||
$files = '';
|
$files = '';
|
||||||
}
|
}
|
||||||
|
@@ -768,7 +768,7 @@ foreach ($loop_array AS $vrowcount => $vrow) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($cfg['UploadDir'])) {
|
if (!empty($cfg['UploadDir'])) {
|
||||||
$files = PMA_getFileSelectOptions($cfg['UploadDir']);
|
$files = PMA_getFileSelectOptions(PMA_userDir($cfg['UploadDir']));
|
||||||
if ($files === FALSE) {
|
if ($files === FALSE) {
|
||||||
echo ' <font color="red">' . $strError . '</font><br />' . "\n";
|
echo ' <font color="red">' . $strError . '</font><br />' . "\n";
|
||||||
echo ' ' . $strWebServerUploadDirectoryError . "\n";
|
echo ' ' . $strWebServerUploadDirectoryError . "\n";
|
||||||
|
@@ -62,10 +62,7 @@ if (isset(${'me_fields_upload_' . $encoded_key}) && ${'me_fields_upload_' . $enc
|
|||||||
}
|
}
|
||||||
|
|
||||||
} elseif (!empty(${'me_fields_uploadlocal_' . $encoded_key})) {
|
} elseif (!empty(${'me_fields_uploadlocal_' . $encoded_key})) {
|
||||||
if (substr($cfg['UploadDir'], -1) != '/') {
|
$file_to_upload = PMA_userDir($cfg['UploadDir']) . preg_replace('@\.\.*@', '.', ${'me_fields_uploadlocal_' . $encoded_key});
|
||||||
$cfg['UploadDir'] .= '/';
|
|
||||||
}
|
|
||||||
$file_to_upload = $cfg['UploadDir'] . preg_replace('@\.\.*@', '.', ${'me_fields_uploadlocal_' . $encoded_key});
|
|
||||||
|
|
||||||
// A local file will be uploaded.
|
// A local file will be uploaded.
|
||||||
$open_basedir = @ini_get('open_basedir');
|
$open_basedir = @ini_get('open_basedir');
|
||||||
|
Reference in New Issue
Block a user