Project

General

Profile

« Previous | Next » 

Revision 1712

Added by Dietmar about 12 years ago

! update folder admin/addons admin/skel/htt

View differences:

uninstall.php
3 3
 *
4 4
 * @category        admin
5 5
 * @package         languages
6
 * @author          WebsiteBaker Project
7
 * @copyright       2004-2009, Ryan Djurovich
8
 * @copyright       2009-2011, Website Baker Org. e.V.
6
 * @author          Ryan Djurovich, 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
......
29 28
// After check print the header
30 29
$admin->print_header();
31 30

  
31
// Get language name
32
if(!isset($_POST['code']) OR $_POST['code'] == "") {
33
	$code = '';
34
	$file = '';
35
} else {
36
	$code = $_POST['code'];
37
	$file = $_POST['code'].'.php';
38
}
39
// fix secunia 2010-93-2
40
if (!preg_match('/^([A-Z]{2}.php)/', $file)) {
41
	$admin->print_error($MESSAGE['GENERIC_FORGOT_OPTIONS']);
42
}
43

  
44
// Check if the template exists
45
if(!is_file(WB_PATH.'/languages/'.$file)) {
46
	$admin->print_error($MESSAGE['GENERIC_NOT_INSTALLED']);
47
}
48

  
49
// Check if the template exists
50
if(!is_readable(WB_PATH.'/languages/'.$file)) {
51
	$admin->print_error($MESSAGE['ADMIN_INSUFFICIENT_PRIVELLIGES']);
52
}
53

  
54
/*
32 55
// Check if user selected language
33 56
if(!isset($_POST['code']) OR $_POST['code'] == "") {
34 57
	header("Location: index.php");
......
41 64
	exit(0);
42 65
}
43 66

  
44
// Include the WB functions file
45
require_once(WB_PATH.'/framework/functions.php');
46

  
47 67
// Check if the language exists
48 68
if(!file_exists(WB_PATH.'/languages/'.$_POST['code'].'.php')) {
49
	$admin->print_error($MESSAGE['GENERIC']['NOT_INSTALLED']);
69
	$admin->print_error($MESSAGE['GENERIC_NOT_INSTALLED']);
50 70
}
71
*/
72
// Include the WB functions file
73
require_once(WB_PATH.'/framework/functions.php');
51 74

  
52 75
// Check if the language is in use
53
if($_POST['code'] == DEFAULT_LANGUAGE OR $_POST['code'] == LANGUAGE) {
54
	$admin->print_error($MESSAGE['GENERIC']['CANNOT_UNINSTALL_IN_USE']);
76
if($code == DEFAULT_LANGUAGE OR $code == LANGUAGE) {
77
	$admin->print_error($MESSAGE['GENERIC_CANNOT_UNINSTALL_IN_USE']);
55 78
} else {
56
	$query_users = $database->query("SELECT user_id FROM ".TABLE_PREFIX."users WHERE language = '".$admin->add_slashes($_POST['code'])."' LIMIT 1");
79
	$query_users = $database->query("SELECT user_id FROM ".TABLE_PREFIX."users WHERE language = '".$admin->add_slashes($code)."' LIMIT 1");
57 80
	if($query_users->numRows() > 0) {
58
		$admin->print_error($MESSAGE['GENERIC']['CANNOT_UNINSTALL_IN_USE']);
81
		$admin->print_error($MESSAGE['GENERIC_CANNOT_UNINSTALL_IN_USE']);
59 82
	}
60 83
}
61 84

  
62 85
// Try to delete the language code
63
if(!unlink(WB_PATH.'/languages/'.$_POST['code'].'.php')) {
64
	$admin->print_error($MESSAGE['GENERIC']['CANNOT_UNINSTALL']);
86
if(!unlink(WB_PATH.'/languages/'.$file)) {
87
	$admin->print_error($MESSAGE['GENERIC_CANNOT_UNINSTALL']);
65 88
} else {
66 89
	// Remove entry from DB
67
	$database->query("DELETE FROM ".TABLE_PREFIX."addons WHERE directory = '".$_POST['code']."' AND type = 'language'");
90
	$database->query("DELETE FROM ".TABLE_PREFIX."addons WHERE directory = \'".$code."\' AND type = 'language'");
68 91
}
69 92

  
70 93
// Print success message
71
$admin->print_success($MESSAGE['GENERIC']['UNINSTALLED']);
94
$admin->print_success($MESSAGE['GENERIC_UNINSTALLED']);
72 95

  
73 96
// Print admin footer
74 97
$admin->print_footer();
75

  
76
?>

Also available in: Unified diff