<?php
/************************************************************************/
/* Maximus CMS: Web Portal System                                       */
/* ==============================                                       */
/*                                                                      */
/* Copyright (c) 2002 - 2006                                            */
/* http://www.php-maximus.fr                                            */
/* dev@php-maximus.org                                                  */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/************************************************************************/
/* Based on PHP-NUKE: Web Portal System                                 */
/************************************************************************/
if (!defined('ADMIN_ALLOW') && !defined('ADMIN_MAX')) {
	die ("Access Denied");
}
if ($acces == 1) {
if($admintest && $adminsecu)  {

if ((!is_god($admin)) && (!is_user($user)) && (!is_admin($admin))) { redirect_url("".$admin_file.".php?op=modules"); }
if ($ok == 0) {
incoh();
Max_OpenTable();
echo     "<br /><center><font color='red' size='3'>"._WARNINGDEINSTALLMODULE."</font>";
br('3');
echo "<table width='60%' border='1' align='center'><tr><td width='50%' align='center'>"._DESTALL." --> <b>$moduledeinstall</b></td><td width='50%' align='center'>";
image_dyn( "images/trash1_x.png", "images/trash1.png", "".$admin_file.".php?op=moduledeinstall&amp;mid=$mid&amp;install=0&amp;moduledeinstall=$moduledeinstall&amp;ok=1", ""._DESTALL."", "deinstall");
echo "</td></tr></table>";
br('3');
echo ""._GOBACK."</center>";

Max_CloseTable();
incof();
} elseif ($ok == 1) {
incoh();
Max_OpenTable();
define("DEINSTALL_MODULES", true);
global $db, $prefix;
$db3 = $db;
$prefix_deinstall = $prefix;
if (file_exists("modules/$moduledeinstall/max_sql/$moduledeinstall-deinstall.php")) {
include_once ("modules/$moduledeinstall/max_sql/$moduledeinstall-deinstall.php");
}
unset($db3);
unset($prefix_deinstall);
$result = $db->sql_query("UPDATE `".TABLE_MODULES."` set `install`='0', `active`='0', `inmenu`='0' WHERE `mid`='$mid'");
echo     "<br /><center><font color='blue' size ='3'>"._DEINSTALLMODULE."</font><br /><br /><br />"
	.""._MODULES." <b>$moduledeinstall</b> "._DEINSTALL."<br /><br />"
	."<b>$numbertables</b> "._TABLESDEINSTALL."";
br('4');
echo "<a href=\"".$admin_file.".php?op=modules\"><font size='3'><b>"._GESTIONMODULES."</b></font></a></center>";
br('3');
define("DEINSTALL_MODULES", false);
$db->sql_query("DELETE FROM `".TABLE_BLOCKSMANAGER."` WHERE `title`='$moduledeinstall' ");
$db->sql_query("OPTIMIZE TABLE `".TABLE_BLOCKSMANAGER."`");
$db->sql_query("OPTIMIZE TABLE `".TABLE_MODULES."`");
Max_CloseTable();
incof();
} else {
redirect_url("".$admin_file.".php?op=modules");
}

}
} else {
	echo "Access Denied";
}