1
|
<?php
|
2
|
|
3
|
// $Id: uninstall.php,v 1.2 2005/04/02 06:25:37 rdjurovich Exp $
|
4
|
|
5
|
/*
|
6
|
|
7
|
Website Baker Project <http://www.websitebaker.org/>
|
8
|
Copyright (C) 2004-2005, Ryan Djurovich
|
9
|
|
10
|
Website Baker is free software; you can redistribute it and/or modify
|
11
|
it under the terms of the GNU General Public License as published by
|
12
|
the Free Software Foundation; either version 2 of the License, or
|
13
|
(at your option) any later version.
|
14
|
|
15
|
Website Baker is distributed in the hope that it will be useful,
|
16
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18
|
GNU General Public License for more details.
|
19
|
|
20
|
You should have received a copy of the GNU General Public License
|
21
|
along with Website Baker; if not, write to the Free Software
|
22
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
23
|
|
24
|
*/
|
25
|
|
26
|
// Check if user selected language
|
27
|
if(!isset($_POST['code']) OR $_POST['code'] == "") {
|
28
|
header("Location: index.php");
|
29
|
}
|
30
|
|
31
|
// Setup admin object
|
32
|
require('../../config.php');
|
33
|
require_once(WB_PATH.'/framework/class.admin.php');
|
34
|
$admin = new admin('Addons', 'languages_uninstall');
|
35
|
|
36
|
// Include the WB functions file
|
37
|
require_once(WB_PATH.'/framework/functions.php');
|
38
|
|
39
|
// Check if the language exists
|
40
|
if(!file_exists(WB_PATH.'/languages/'.$_POST['code'].'.php')) {
|
41
|
$admin->print_error($MESSAGE['GENERIC']['NOT_INSTALLED']);
|
42
|
}
|
43
|
|
44
|
// Check if the language is in use
|
45
|
if($_POST['code'] == DEFAULT_LANGUAGE OR $_POST['code'] == LANGUAGE) {
|
46
|
$admin->print_error($MESSAGE['GENERIC']['CANNOT_UNINSTALL_IN_USE']);
|
47
|
} else {
|
48
|
$query_users = $database->query("SELECT user_id FROM ".TABLE_PREFIX."users WHERE language = '".addslashes($_POST['code'])."' LIMIT 1");
|
49
|
if($query_users->numRows() > 0) {
|
50
|
$admin->print_error($MESSAGE['GENERIC']['CANNOT_UNINSTALL_IN_USE']);
|
51
|
}
|
52
|
}
|
53
|
|
54
|
// Try to delete the language code
|
55
|
if(!unlink(WB_PATH.'/languages/'.$_POST['code'].'.php')) {
|
56
|
$admin->print_error($MESSAGE['GENERIC']['CANNOT_UNINSTALL']);
|
57
|
}
|
58
|
|
59
|
// Print success message
|
60
|
$admin->print_success($MESSAGE['GENERIC']['UNINSTALLED']);
|
61
|
|
62
|
// Print admin footer
|
63
|
$admin->print_footer();
|
64
|
|
65
|
?>
|