Project

General

Profile

« Previous | Next » 

Revision 2098

Added by darkviper almost 11 years ago

! activate class Translate for all addons in admin/ (except pages/)
! class.admin >> add translation of the current theme to Translate

View differences:

delete.php
23 23
    	require($config_file);
24 24
    }
25 25
}
26
if(!class_exists('admin', false)){ include(WB_PATH.'/framework/class.admin.php'); }
26
//if(!class_exists('admin', false)){ include(WB_PATH.'/framework/class.admin.php'); }
27
$oTrans = Translate::getInstance();
28
$oTrans->enableAddon('admin\\media');
27 29

  
28 30
$admin = new admin('Media', 'media', false);
29 31

  
......
47 49
// Check to see if it contains ..
48 50
if (!check_media_path($directory)) {
49 51
	// $admin->print_header();
50
	$admin->print_error($MESSAGE['MEDIA_DIR_DOT_DOT_SLASH'],$rootlink,false );
52
	$admin->print_error($oTrans->MESSAGE_MEDIA_DIR_DOT_DOT_SLASH, $rootlink, false );
51 53
}
52 54

  
53 55
// Get the file id
54 56
$file_id = $admin->checkIDKEY('id', false, $_SERVER['REQUEST_METHOD']);
55 57
if (!$file_id) {
56
	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], $dirlink,false);
58
	$admin->print_error($oTrans->MESSAGE_GENERIC_SECURITY_ACCESS, $dirlink, false);
57 59
}
58 60

  
59 61
// Get home folder not to show
......
68 70
}
69 71
*/
70 72
// Figure out what folder name the temp id is
71
if($handle = opendir(WB_PATH.MEDIA_DIRECTORY.'/'.$directory)) {
73
if(($handle = opendir(WB_PATH.MEDIA_DIRECTORY.'/'.$directory))) {
72 74
	// Loop through the files and dirs an add to list
73 75
   while (false !== ($file = readdir($handle))) {
74 76
		if(substr($file, 0, 1) != '.' AND $file != '.svn' AND $file != 'index.php') {
......
106 108

  
107 109
// Check to see if we could find an id to match
108 110
if(!isset($delete_file)) {
109
	$admin->print_error($MESSAGE['MEDIA_FILE_NOT_FOUND'], $dirlink, false);
111
	$admin->print_error($oTrans->MESSAGE_MEDIA_FILE_NOT_FOUND, $dirlink, false);
110 112
}
111 113
$relative_path = WB_PATH.MEDIA_DIRECTORY.'/'.$directory.'/'.$delete_file;
112 114
// Check if the file/folder exists
113 115
if(!file_exists($relative_path)) {
114
	$admin->print_error($MESSAGE['MEDIA_FILE_NOT_FOUND'], $dirlink, false);
116
	$admin->print_error($oTrans->MESSAGE_MEDIA_FILE_NOT_FOUND, $dirlink, false);
115 117
}
116 118

  
117 119
// Find out whether its a file or folder
118 120
if($type == 'folder') {
119 121
	// Try and delete the directory
120 122
	if(rm_full_dir($relative_path)) {
121
		$admin->print_success($MESSAGE['MEDIA_DELETED_DIR'], $dirlink);
123
		$admin->print_success($oTrans->MESSAGE_MEDIA_DELETED_DIR, $dirlink);
122 124
	} else {
123
		$admin->print_error($MESSAGE['MEDIA_CANNOT_DELETE_DIR'], $dirlink, false);
125
		$admin->print_error($oTrans->MESSAGE_MEDIA_CANNOT_DELETE_DIR, $dirlink, false);
124 126
	}
125 127
} else {
126 128
	// Try and delete the file
127 129
	if(unlink($relative_path)) {
128
		$admin->print_success($MESSAGE['MEDIA_DELETED_FILE'], $dirlink);
130
		$admin->print_success($oTrans->MESSAGE_MEDIA_DELETED_FILE, $dirlink);
129 131
	} else {
130
		$admin->print_error($MESSAGE['MEDIA_CANNOT_DELETE_FILE'], $dirlink, false);
132
		$admin->print_error($oTrans->MESSAGE_MEDIA_CANNOT_DELETE_FILE, $dirlink, false);
131 133
	}
132 134
}

Also available in: Unified diff