Revision 1475
Added by Luisehahne over 14 years ago
| delete.php | ||
|---|---|---|
| 26 | 26 |
|
| 27 | 27 |
// Get the current dir |
| 28 | 28 |
$directory = $admin->get_get('dir');
|
| 29 |
if($directory == '/') {
|
|
| 30 |
$directory = ''; |
|
| 31 |
} |
|
| 29 |
$directory = ($directory == '/') ? '' : $directory; |
|
| 32 | 30 |
|
| 31 |
$dirlink = 'browse.php?dir='.$directory; |
|
| 32 |
$rootlink = 'browse.php?dir='; |
|
| 33 |
|
|
| 33 | 34 |
// Check to see if it contains .. |
| 34 | 35 |
if (!check_media_path($directory)) {
|
| 35 | 36 |
// $admin->print_header(); |
| 36 |
$admin->print_error($MESSAGE['MEDIA']['DIR_DOT_DOT_SLASH'],WB_URL.'/admin/media/browse.php?dir=',false );
|
|
| 37 |
$admin->print_error($MESSAGE['MEDIA']['DIR_DOT_DOT_SLASH'],$rootlink,false );
|
|
| 37 | 38 |
} |
| 38 | 39 |
|
| 39 |
// Get the temp id
|
|
| 40 |
$file_id = $admin->checkIDKEY('id', false, 'GET');
|
|
| 40 |
// Get the file id
|
|
| 41 |
$file_id = $admin->checkIDKEY('id', false, $_SERVER['REQUEST_METHOD']);
|
|
| 41 | 42 |
if (!$file_id) {
|
| 42 |
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], WB_URL.'/admin/media/browse.php?dir=',false);
|
|
| 43 |
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], $dirlink,false);
|
|
| 43 | 44 |
} |
| 44 | 45 |
|
| 45 | 46 |
// Get home folder not to show |
| ... | ... | |
| 52 | 53 |
if(!empty($currentdir)) {
|
| 53 | 54 |
$usedFiles = $Dse->getMatchesFromDir( $directory, DseTwo::RETURN_USED); |
| 54 | 55 |
} |
| 55 |
print '<pre><strong>function '.__FUNCTION__.'();</strong> basename: '.basename(__FILE__).' line: '.__LINE__.' -> <br />'; |
|
| 56 |
print_r( $usedFiles ); print '</pre>'; // flush ();sleep(10); die(); |
|
| 57 | 56 |
*/ |
| 58 | 57 |
// Figure out what folder name the temp id is |
| 59 | 58 |
if($handle = opendir(WB_PATH.MEDIA_DIRECTORY.'/'.$directory)) {
|
| ... | ... | |
| 94 | 93 |
|
| 95 | 94 |
// Check to see if we could find an id to match |
| 96 | 95 |
if(!isset($delete_file)) {
|
| 97 |
$admin->print_error($MESSAGE['MEDIA']['FILE_NOT_FOUND'], "browse.php?dir=$directory", false);
|
|
| 96 |
$admin->print_error($MESSAGE['MEDIA']['FILE_NOT_FOUND'], $dirlink, false);
|
|
| 98 | 97 |
} |
| 99 | 98 |
$relative_path = WB_PATH.MEDIA_DIRECTORY.'/'.$directory.'/'.$delete_file; |
| 100 | 99 |
// Check if the file/folder exists |
| 101 | 100 |
if(!file_exists($relative_path)) {
|
| 102 |
$admin->print_error($MESSAGE['MEDIA']['FILE_NOT_FOUND'], "browse.php?dir=$directory", false);
|
|
| 101 |
$admin->print_error($MESSAGE['MEDIA']['FILE_NOT_FOUND'], $dirlink, false);
|
|
| 103 | 102 |
} |
| 104 | 103 |
|
| 105 | 104 |
// Find out whether its a file or folder |
| 106 | 105 |
if($type == 'folder') {
|
| 107 | 106 |
// Try and delete the directory |
| 108 | 107 |
if(rm_full_dir($relative_path)) {
|
| 109 |
$admin->print_success($MESSAGE['MEDIA']['DELETED_DIR'], "browse.php?dir=$directory");
|
|
| 108 |
$admin->print_success($MESSAGE['MEDIA']['DELETED_DIR'], $dirlink);
|
|
| 110 | 109 |
} else {
|
| 111 |
$admin->print_error($MESSAGE['MEDIA']['CANNOT_DELETE_DIR'], "browse.php?dir=$directory", false);
|
|
| 110 |
$admin->print_error($MESSAGE['MEDIA']['CANNOT_DELETE_DIR'], $dirlink, false);
|
|
| 112 | 111 |
} |
| 113 | 112 |
} else {
|
| 114 | 113 |
// Try and delete the file |
| 115 | 114 |
if(unlink($relative_path)) {
|
| 116 |
$admin->print_success($MESSAGE['MEDIA']['DELETED_FILE'], "browse.php?dir=$directory");
|
|
| 115 |
$admin->print_success($MESSAGE['MEDIA']['DELETED_FILE'], $dirlink);
|
|
| 117 | 116 |
} else {
|
| 118 |
$admin->print_error($MESSAGE['MEDIA']['CANNOT_DELETE_FILE'], "browse.php?dir=$directory", false);
|
|
| 117 |
$admin->print_error($MESSAGE['MEDIA']['CANNOT_DELETE_FILE'], $dirlink, false);
|
|
| 119 | 118 |
} |
| 120 | 119 |
} |
| 121 | 120 |
|
Also available in: Unified diff
! security fixes media, groups, users, sections
! reworked add sections in pages
! fix set empty href in show_menu2
! set show_menu2 version to 4.9.6
! reworked Droplet LoginBox, add redirect query
- remove unneeded folder js
! set Droplet to version 1.1.0
+ add checkboxes to change frontend absolute url to relative urls
! set output_filter version to 0.2