Revision 1785
Added by Luisehahne about 13 years ago
| uninstall.php | ||
|---|---|---|
| 16 | 16 |
* |
| 17 | 17 |
*/ |
| 18 | 18 |
|
| 19 |
// Setup admin object |
|
| 20 |
require('../../config.php');
|
|
| 21 |
require_once(WB_PATH.'/framework/class.admin.php'); |
|
| 19 |
// Include config file |
|
| 20 |
$config_file = realpath('../../config.php');
|
|
| 21 |
if(file_exists($config_file) && !defined('WB_URL'))
|
|
| 22 |
{
|
|
| 23 |
require($config_file); |
|
| 24 |
} |
|
| 25 |
|
|
| 26 |
if(!class_exists('admin', false)){ include(WB_PATH.'/framework/class.admin.php'); }
|
|
| 27 |
|
|
| 22 | 28 |
$admin = new admin('Addons', 'languages_uninstall', false);
|
| 23 | 29 |
if( !$admin->checkFTAN() ) |
| 24 | 30 |
{
|
| ... | ... | |
| 51 | 57 |
$admin->print_error($MESSAGE['ADMIN_INSUFFICIENT_PRIVELLIGES']); |
| 52 | 58 |
} |
| 53 | 59 |
|
| 54 |
/* |
|
| 55 |
// Check if user selected language |
|
| 56 |
if(!isset($_POST['code']) OR $_POST['code'] == "") {
|
|
| 57 |
header("Location: index.php");
|
|
| 58 |
exit(0); |
|
| 59 |
} |
|
| 60 |
|
|
| 61 |
// Extra protection |
|
| 62 |
if(trim($_POST['code']) == '') {
|
|
| 63 |
header("Location: index.php");
|
|
| 64 |
exit(0); |
|
| 65 |
} |
|
| 66 |
|
|
| 67 |
// Check if the language exists |
|
| 68 |
if(!file_exists(WB_PATH.'/languages/'.$_POST['code'].'.php')) {
|
|
| 69 |
$admin->print_error($MESSAGE['GENERIC_NOT_INSTALLED']); |
|
| 70 |
} |
|
| 71 |
*/ |
|
| 72 | 60 |
// Include the WB functions file |
| 73 | 61 |
require_once(WB_PATH.'/framework/functions.php'); |
| 74 | 62 |
|
| ... | ... | |
| 76 | 64 |
if($code == DEFAULT_LANGUAGE OR $code == LANGUAGE) {
|
| 77 | 65 |
$admin->print_error($MESSAGE['GENERIC_CANNOT_UNINSTALL_IN_USE']); |
| 78 | 66 |
} else {
|
| 79 |
$query_users = $database->query("SELECT user_id FROM ".TABLE_PREFIX."users WHERE language = '".$admin->add_slashes($code)."' LIMIT 1");
|
|
| 80 |
if($query_users->numRows() > 0) {
|
|
| 67 |
$sql = 'SELECT COUNT(*) FROM `'.TABLE_PREFIX.'users` '; |
|
| 68 |
$sql .= 'WHERE`language`=\''.mysql_real_escape_string($code).'\''; |
|
| 69 |
if( $database->get_one($sql) ) {
|
|
| 81 | 70 |
$admin->print_error($MESSAGE['GENERIC_CANNOT_UNINSTALL_IN_USE']); |
| 82 | 71 |
} |
| 83 | 72 |
} |
| ... | ... | |
| 87 | 76 |
$admin->print_error($MESSAGE['GENERIC_CANNOT_UNINSTALL']); |
| 88 | 77 |
} else {
|
| 89 | 78 |
// Remove entry from DB |
| 90 |
$database->query("DELETE FROM ".TABLE_PREFIX."addons WHERE directory = \'".$code."\' AND type = 'language'");
|
|
| 79 |
$sql = 'DELETE FROM `'.TABLE_PREFIX.'addons` '; |
|
| 80 |
$sql .= 'WHERE `directory`=\''.mysql_real_escape_string($code).'\' '; |
|
| 81 |
$sql .= 'AND `type`=`type`=\'language\' '; |
|
| 82 |
if( $database->query($sql) ) {
|
|
| 83 |
// Print success message |
|
| 84 |
$admin->print_success($MESSAGE['GENERIC_UNINSTALLED']); |
|
| 85 |
} else {
|
|
| 86 |
$admin->print_error($MESSAGE['GENERIC_CANNOT_UNINSTALL'].'<br />'.$database->get_error()); |
|
| 87 |
} |
|
| 91 | 88 |
} |
| 92 | 89 |
|
| 93 |
// Print success message |
|
| 94 |
$admin->print_success($MESSAGE['GENERIC_UNINSTALLED']); |
|
| 95 |
|
|
| 96 | 90 |
// Print admin footer |
| 97 | 91 |
$admin->print_footer(); |
Also available in: Unified diff
! secure fix for search update in settings, search_footer now can be empty
! change ->fetchRow() to ->fetchRow(MYSQL_ASSOC) in frontend.functions.php