Revision 1818
Added by Dietmar about 12 years ago
delete.php | ||
---|---|---|
3 | 3 |
* |
4 | 4 |
* @category admin |
5 | 5 |
* @package admintools |
6 |
* @author WebsiteBaker Project |
|
7 |
* @copyright 2004-2009, Ryan Djurovich |
|
8 |
* @copyright 2009-2011, Website Baker Org. e.V. |
|
6 |
* @author Ryan Djurovich (2004-2009), WebsiteBaker Project |
|
7 |
* @copyright 2009-2012, WebsiteBaker Org. e.V. |
|
9 | 8 |
* @link http://www.websitebaker2.org/ |
10 | 9 |
* @license http://www.gnu.org/licenses/gpl.html |
11 | 10 |
* @platform WebsiteBaker 2.8.x |
12 | 11 |
* @requirements PHP 5.2.2 and higher |
13 | 12 |
* @version $Id$ |
14 |
* @filesource $HeadURL: $
|
|
15 |
* @lastmodified $Date: $
|
|
13 |
* @filesource $HeadURL$ |
|
14 |
* @lastmodified $Date$ |
|
16 | 15 |
* |
17 | 16 |
*/ |
18 | 17 |
|
19 |
// Create admin object |
|
20 |
require('../../config.php'); |
|
21 |
require_once(WB_PATH.'/framework/class.admin.php'); |
|
22 |
$admin = new admin('Media', 'media_delete', false); |
|
18 |
if(!defined('WB_URL')) |
|
19 |
{ |
|
20 |
$config_file = realpath('../../config.php'); |
|
21 |
if(file_exists($config_file) && !defined('WB_URL')) |
|
22 |
{ |
|
23 |
require($config_file); |
|
24 |
} |
|
25 |
} |
|
26 |
if(!class_exists('admin', false)){ include(WB_PATH.'/framework/class.admin.php'); } |
|
23 | 27 |
|
28 |
$admin = new admin('Media', 'media', false); |
|
29 |
|
|
24 | 30 |
// Include the WB functions file |
25 | 31 |
require_once(WB_PATH.'/framework/functions.php'); |
26 | 32 |
|
... | ... | |
31 | 37 |
$dirlink = 'browse.php?dir='.$directory; |
32 | 38 |
$rootlink = 'browse.php?dir='; |
33 | 39 |
|
40 |
// Get the current dir |
|
41 |
$currentHome = $admin->get_home_folder(); |
|
42 |
// check for correct directory |
|
43 |
if ($currentHome && stripos(WB_PATH.MEDIA_DIRECTORY.$rootlink,WB_PATH.MEDIA_DIRECTORY.$currentHome)===false) { |
|
44 |
$rootlink = $currentHome; |
|
45 |
} |
|
46 |
|
|
34 | 47 |
// Check to see if it contains .. |
35 | 48 |
if (!check_media_path($directory)) { |
36 | 49 |
// $admin->print_header(); |
37 |
$admin->print_error($MESSAGE['MEDIA']['DIR_DOT_DOT_SLASH'],$rootlink,false );
|
|
50 |
$admin->print_error($MESSAGE['MEDIA_DIR_DOT_DOT_SLASH'],$rootlink,false );
|
|
38 | 51 |
} |
39 | 52 |
|
40 | 53 |
// Get the file id |
... | ... | |
93 | 106 |
|
94 | 107 |
// Check to see if we could find an id to match |
95 | 108 |
if(!isset($delete_file)) { |
96 |
$admin->print_error($MESSAGE['MEDIA']['FILE_NOT_FOUND'], $dirlink, false);
|
|
109 |
$admin->print_error($MESSAGE['MEDIA_FILE_NOT_FOUND'], $dirlink, false);
|
|
97 | 110 |
} |
98 | 111 |
$relative_path = WB_PATH.MEDIA_DIRECTORY.'/'.$directory.'/'.$delete_file; |
99 | 112 |
// Check if the file/folder exists |
100 | 113 |
if(!file_exists($relative_path)) { |
101 |
$admin->print_error($MESSAGE['MEDIA']['FILE_NOT_FOUND'], $dirlink, false);
|
|
114 |
$admin->print_error($MESSAGE['MEDIA_FILE_NOT_FOUND'], $dirlink, false);
|
|
102 | 115 |
} |
103 | 116 |
|
104 | 117 |
// Find out whether its a file or folder |
105 | 118 |
if($type == 'folder') { |
106 | 119 |
// Try and delete the directory |
107 | 120 |
if(rm_full_dir($relative_path)) { |
108 |
$admin->print_success($MESSAGE['MEDIA']['DELETED_DIR'], $dirlink);
|
|
121 |
$admin->print_success($MESSAGE['MEDIA_DELETED_DIR'], $dirlink);
|
|
109 | 122 |
} else { |
110 |
$admin->print_error($MESSAGE['MEDIA']['CANNOT_DELETE_DIR'], $dirlink, false);
|
|
123 |
$admin->print_error($MESSAGE['MEDIA_CANNOT_DELETE_DIR'], $dirlink, false);
|
|
111 | 124 |
} |
112 | 125 |
} else { |
113 | 126 |
// Try and delete the file |
114 | 127 |
if(unlink($relative_path)) { |
115 |
$admin->print_success($MESSAGE['MEDIA']['DELETED_FILE'], $dirlink);
|
|
128 |
$admin->print_success($MESSAGE['MEDIA_DELETED_FILE'], $dirlink);
|
|
116 | 129 |
} else { |
117 |
$admin->print_error($MESSAGE['MEDIA']['CANNOT_DELETE_FILE'], $dirlink, false);
|
|
130 |
$admin->print_error($MESSAGE['MEDIA_CANNOT_DELETE_FILE'], $dirlink, false);
|
|
118 | 131 |
} |
119 | 132 |
} |
120 |
|
|
121 |
?> |
|
122 | 133 |
Also available in: Unified diff
! update users, create username homefolder in media/homefolders