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:

uninstall.php
17 17

  
18 18
// Setup admin object
19 19
require('../../config.php');
20
require_once(WB_PATH.'/framework/class.admin.php');
20
//require_once(WB_PATH.'/framework/class.admin.php');
21
$oTrans = Translate::getInstance();
22
$oTrans->enableAddon('admin\\modules');
23

  
21 24
$admin = new admin('Addons', 'modules_uninstall', false);
22 25
if( !$admin->checkFTAN() )
23 26
{
24 27
	$admin->print_header();
25
	$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS']);
28
	$admin->print_error($oTrans->MESSAGE_GENERIC_SECURITY_ACCESS);
26 29
}
27 30
// After check print the header
28 31
$admin->print_header();
29 32
if(!isset($_POST['file']) OR $_POST['file'] == "") {
30
	$admin->print_error($MESSAGE['GENERIC_FORGOT_OPTIONS']);
33
	$admin->print_error($oTrans->MESSAGE_GENERIC_FORGOT_OPTIONS);
31 34
} else {
32 35
	$file = preg_replace('/[^a-z0-9_-]/i', "", $_POST['file']);  // fix secunia 2010-92-2
33 36
}
34 37

  
35 38
// Check if the template exists
36 39
if(!is_dir(WB_PATH.'/modules/'.$file)) {
37
	$admin->print_error($MESSAGE['GENERIC_NOT_INSTALLED']);
40
	$admin->print_error($oTrans->MESSAGE_GENERIC_NOT_INSTALLED);
38 41
}
39 42

  
40 43
// Check if the template exists
41 44
if(!is_readable(WB_PATH.'/modules/'.$file)) {
42
	$admin->print_error($MESSAGE['ADMIN_INSUFFICIENT_PRIVELLIGES']);
45
	$admin->print_error($oTrans->MESSAGE_ADMIN_INSUFFICIENT_PRIVELLIGES);
43 46
}
44 47

  
45 48
/*
......
80 83
	/**
81 84
	*	Modul is in use, so we have to warn the user
82 85
	*/
83
	if (!array_key_exists("CANNOT_UNINSTALL_IN_USE_TMPL", $MESSAGE['GENERIC'])) {
86
    if (!isset($oTrans->MESSAGE_GENERIC_CANNOT_UNINSTALL_IN_USE_TMPL)) {
84 87
		$add = $info->numRows() == 1 ? "this page" : "these pages";
85 88
		$msg_template_str  = "<br /><br />{{type}} <b>{{type_name}}</b> could not be uninstalled because it is still in use on {{pages}}";
86 89
		$msg_template_str .= ":<br /><i>click for editing.</i><br /><br />";
87 90
	} else {
88
		$msg_template_str = $MESSAGE['GENERIC_CANNOT_UNINSTALL_IN_USE_TMPL'];
89
		$temp = explode(";",$MESSAGE['GENERIC_CANNOT_UNINSTALL_IN_USE_TMPL_PAGES']);
91
		$msg_template_str = $oTrans->MESSAGE_GENERIC_CANNOT_UNINSTALL_IN_USE_TMPL;
92
		$temp = explode(";",$oTrans->MESSAGE_GENERIC_CANNOT_UNINSTALL_IN_USE_TMPL_PAGES);
90 93
		$add = $info->numRows() == 1 ? $temp[0] : $temp[1];
91 94
	}
92 95
	/**
......
115 118
	/**
116 119
	*	Printing out the error-message and die().
117 120
	*/
118
	$admin->print_error(str_replace ($TEXT['FILE'], "Modul", $MESSAGE['GENERIC_CANNOT_UNINSTALL_IN_USE']).$msg.$page_names);
121
	$admin->print_error(str_replace ($TEXT['FILE'], "Modul", $oTrans->MESSAGE_GENERIC_CANNOT_UNINSTALL_IN_USE).$msg.$page_names);
119 122
}
120 123

  
121 124
// Check if we have permissions on the directory
122 125
if(!is_writable(WB_PATH.'/modules/'.$file)) {
123
	$admin->print_error($MESSAGE['GENERIC_CANNOT_UNINSTALL']);
126
	$admin->print_error($oTrans->MESSAGE_GENERIC_CANNOT_UNINSTALL);
124 127
}
125 128

  
126 129
// Run the modules uninstall script if there is one
......
130 133

  
131 134
// Try to delete the module dir
132 135
if(!rm_full_dir(WB_PATH.'/modules/'.$file)) {
133
	$admin->print_error($MESSAGE['GENERIC_CANNOT_UNINSTALL']);
136
	$admin->print_error($oTrans->MESSAGE_GENERIC_CANNOT_UNINSTALL);
134 137
} else {
135 138
	// Remove entry from DB
136 139
	$database->query("DELETE FROM ".TABLE_PREFIX."addons WHERE directory = '".$file."' AND type = 'module'");
137 140
}
138 141

  
139 142
// Print success message
140
$admin->print_success($MESSAGE['GENERIC_UNINSTALLED']);
143
$admin->print_success($oTrans->MESSAGE_GENERIC_UNINSTALLED);
141 144

  
142 145
// Print admin footer
143 146
$admin->print_footer();

Also available in: Unified diff