<?if(!check_bitrix_sessid()) return;?>
<?
$errors = false;
global $DBType;
UnRegisterModule("#part#.#modul#");
DeleteDirFiles($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/#part#.#modul#/install/admin/", $_SERVER["DOCUMENT_ROOT"]."/bitrix/admin/");
\Bitrix\Main\IO\Directory::deleteDirectory($_SERVER["DOCUMENT_ROOT"]."/bitrix/components/#component_prostranstvo#/#component_name#/");
\Bitrix\Main\IO\Directory::deleteDirectory($_SERVER["DOCUMENT_ROOT"]."/bitrix/images/#part#.#modul#");
#unistall_bd#
$pap_compoent = $_SERVER["DOCUMENT_ROOT"]."/bitrix/components/#component_prostranstvo#/";
if(is_dir($pap_compoent)){
    $ostatok = scandir($pap_compoent);
}
$fl=0;
if(isset($ostatok)){
	 if(is_array($ostatok)){
		 if(count($ostatok)>0){
			 foreach($ostatok as $val){
				 if($val == '..' || $val == '.'){
					 
				 }else{
					 $fl=1;
				 }
			 }
		 }
	 }
}
if($fl === 0){
	 \Bitrix\Main\IO\Directory::deleteDirectory($pap_compoent);
}
if ($errors === false){
	echo CAdminMessage::ShowNote(GetMessage("MOD_UNINST_OK"));
}else{
	for($i=0; $i<count($errors); $i++){
		$alErrors .= $errors[$i]."<br>";
	}
	echo CAdminMessage::ShowMessage(Array("TYPE"=>"ERROR", "MESSAGE" =>GetMessage("MOD_UNINST_ERR"), "DETAILS"=>$alErrors, "HTML"=>true));
}
?>
<form action="<?echo $APPLICATION->GetCurPage()?>">
<p>
	<input type="hidden" name="lang" value="<?echo LANG?>" />
	<input type="submit" name="" value="<?echo GetMessage("MOD_BACK");?>" />
</p>
</form>