Revision 1457
Added by Luisehahne over 14 years ago
| create.php | ||
|---|---|---|
| 17 | 17 |
*/ |
| 18 | 18 |
|
| 19 | 19 |
// Get dir name and target location |
| 20 |
if(!isset($_POST['name']) OR $_POST['name'] == '') {
|
|
| 20 |
$requestMethod = '_'.strtoupper($_SERVER['REQUEST_METHOD']); |
|
| 21 |
$name = (isset(${$requestMethod}['name'])) ? ${$requestMethod}['name'] : '';
|
|
| 22 |
if($name == '') {
|
|
| 21 | 23 |
header("Location: index.php");
|
| 22 | 24 |
exit(0); |
| 23 |
} else {
|
|
| 24 |
$name = $_POST['name']; |
|
| 25 | 25 |
} |
| 26 |
if(!isset($_POST['target']) OR $_POST['target'] == '') {
|
|
| 26 |
|
|
| 27 |
// Target location |
|
| 28 |
$requestMethod = '_'.strtoupper($_SERVER['REQUEST_METHOD']); |
|
| 29 |
$target = (isset(${$requestMethod}['target'])) ? ${$requestMethod}['target'] : '';
|
|
| 30 |
if($target == '') {
|
|
| 27 | 31 |
header("Location: index.php");
|
| 28 | 32 |
exit(0); |
| 29 |
} else {
|
|
| 30 |
$target = $_POST['target']; |
|
| 31 | 33 |
} |
| 32 | 34 |
|
| 33 | 35 |
// Print admin header |
| 34 | 36 |
require('../../config.php');
|
| 35 | 37 |
require_once(WB_PATH.'/framework/class.admin.php'); |
| 36 |
$admin = new admin('Media', 'media_create');
|
|
| 37 |
|
|
| 38 |
// suppress to print the header, so no new FTAN will be set
|
|
| 39 |
$admin = new admin('Media', 'media_create', false);
|
|
| 38 | 40 |
if (!$admin->checkFTAN()) |
| 39 | 41 |
{
|
| 40 |
$admin->print_error('CR5::'.$MESSAGE['GENERIC_SECURITY_ACCESS']);
|
|
| 41 |
exit();
|
|
| 42 |
$admin->print_header();
|
|
| 43 |
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS']);
|
|
| 42 | 44 |
} |
| 45 |
// After check print the header |
|
| 46 |
$admin->print_header(); |
|
| 43 | 47 |
|
| 44 | 48 |
// Include the WB functions file |
| 45 | 49 |
require_once(WB_PATH.'/framework/functions.php'); |
| ... | ... | |
| 57 | 61 |
$name = media_filename($name); |
| 58 | 62 |
|
| 59 | 63 |
// Create relative path of the new dir name |
| 60 |
$relative = WB_PATH.$target.'/'.$name;
|
|
| 64 |
$directory = WB_PATH.$target.'/'.$name;
|
|
| 61 | 65 |
|
| 66 |
/* |
|
| 62 | 67 |
// Check to see if the folder already exists |
| 63 | 68 |
if(file_exists($relative)) {
|
| 64 | 69 |
$admin->print_error($MESSAGE['MEDIA']['DIR_EXISTS']); |
| 65 | 70 |
} |
| 71 |
*/ |
|
| 66 | 72 |
|
| 67 |
// Try and make the dir |
|
| 68 |
if(make_dir($relative)) {
|
|
| 69 |
// Create index.php file |
|
| 70 |
$content = ''. |
|
| 71 |
"<?php |
|
| 72 |
|
|
| 73 |
header('Location: ../');
|
|
| 74 |
|
|
| 75 |
?>"; |
|
| 76 |
$handle = fopen($relative.'/index.php', 'w'); |
|
| 77 |
fwrite($handle, $content); |
|
| 78 |
fclose($handle); |
|
| 79 |
change_mode($relative.'/index.php', 'file'); |
|
| 73 |
if ( sizeof(createFolderProtectFile( $directory )) ) |
|
| 74 |
{
|
|
| 75 |
$admin->print_error($MESSAGE['MEDIA']['DIR_NOT_MADE']); |
|
| 76 |
} else {
|
|
| 77 |
$usedFiles = array(); |
|
| 78 |
// feature freeze |
|
| 79 |
// require_once(ADMIN_PATH.'/media/dse.php'); |
|
| 80 | 80 |
$admin->print_success($MESSAGE['MEDIA']['DIR_MADE']); |
| 81 |
} else {
|
|
| 82 |
$admin->print_error($MESSAGE['MEDIA']['DIR_NOT_MADE']); |
|
| 83 | 81 |
} |
| 84 | 82 |
|
| 85 |
// Print admin
|
|
| 83 |
// Print admin |
|
| 86 | 84 |
$admin->print_footer(); |
| 87 |
|
|
| 88 |
?> |
|
Also available in: Unified diff
Preparing 2.8.2 stable, last tests