1 |
4
|
ryan
|
<?php
|
2 |
1467
|
Luisehahne
|
/**
|
3 |
|
|
*
|
4 |
|
|
* @category admin
|
5 |
|
|
* @package languages
|
6 |
|
|
* @author WebsiteBaker Project
|
7 |
|
|
* @copyright 2004-2009, Ryan Djurovich
|
8 |
|
|
* @copyright 2009-2011, Website Baker Org. e.V.
|
9 |
|
|
* @link http://www.websitebaker2.org/
|
10 |
|
|
* @license http://www.gnu.org/licenses/gpl.html
|
11 |
|
|
* @platform WebsiteBaker 2.8.x
|
12 |
|
|
* @requirements PHP 5.2.2 and higher
|
13 |
|
|
* @version $Id$
|
14 |
|
|
* @filesource $HeadURL$
|
15 |
|
|
* @lastmodified $Date$
|
16 |
|
|
* @description
|
17 |
|
|
*
|
18 |
|
|
*/
|
19 |
4
|
ryan
|
|
20 |
1457
|
Luisehahne
|
// Setup admin object
|
21 |
|
|
require('../../config.php');
|
22 |
|
|
require_once(WB_PATH.'/framework/class.admin.php');
|
23 |
|
|
$admin = new admin('Addons', 'languages_uninstall', false);
|
24 |
|
|
if( !$admin->checkFTAN() )
|
25 |
|
|
{
|
26 |
1467
|
Luisehahne
|
$admin->print_header();
|
27 |
1457
|
Luisehahne
|
$admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS']);
|
28 |
|
|
}
|
29 |
|
|
// After check print the header
|
30 |
|
|
$admin->print_header();
|
31 |
|
|
|
32 |
4
|
ryan
|
// Check if user selected language
|
33 |
|
|
if(!isset($_POST['code']) OR $_POST['code'] == "") {
|
34 |
|
|
header("Location: index.php");
|
35 |
286
|
stefan
|
exit(0);
|
36 |
4
|
ryan
|
}
|
37 |
|
|
|
38 |
268
|
ryan
|
// Extra protection
|
39 |
|
|
if(trim($_POST['code']) == '') {
|
40 |
|
|
header("Location: index.php");
|
41 |
286
|
stefan
|
exit(0);
|
42 |
268
|
ryan
|
}
|
43 |
|
|
|
44 |
4
|
ryan
|
// Include the WB functions file
|
45 |
|
|
require_once(WB_PATH.'/framework/functions.php');
|
46 |
|
|
|
47 |
|
|
// Check if the language exists
|
48 |
|
|
if(!file_exists(WB_PATH.'/languages/'.$_POST['code'].'.php')) {
|
49 |
|
|
$admin->print_error($MESSAGE['GENERIC']['NOT_INSTALLED']);
|
50 |
|
|
}
|
51 |
|
|
|
52 |
|
|
// 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']);
|
55 |
|
|
} else {
|
56 |
40
|
stefan
|
$query_users = $database->query("SELECT user_id FROM ".TABLE_PREFIX."users WHERE language = '".$admin->add_slashes($_POST['code'])."' LIMIT 1");
|
57 |
4
|
ryan
|
if($query_users->numRows() > 0) {
|
58 |
|
|
$admin->print_error($MESSAGE['GENERIC']['CANNOT_UNINSTALL_IN_USE']);
|
59 |
|
|
}
|
60 |
|
|
}
|
61 |
|
|
|
62 |
|
|
// Try to delete the language code
|
63 |
|
|
if(!unlink(WB_PATH.'/languages/'.$_POST['code'].'.php')) {
|
64 |
|
|
$admin->print_error($MESSAGE['GENERIC']['CANNOT_UNINSTALL']);
|
65 |
170
|
ryan
|
} else {
|
66 |
|
|
// Remove entry from DB
|
67 |
211
|
stefan
|
$database->query("DELETE FROM ".TABLE_PREFIX."addons WHERE directory = '".$_POST['code']."' AND type = 'language'");
|
68 |
4
|
ryan
|
}
|
69 |
|
|
|
70 |
|
|
// Print success message
|
71 |
|
|
$admin->print_success($MESSAGE['GENERIC']['UNINSTALLED']);
|
72 |
|
|
|
73 |
|
|
// Print admin footer
|
74 |
|
|
$admin->print_footer();
|
75 |
|
|
|
76 |
|
|
?>
|