<?php
require("session_check.php");
//语言包引入
$t_langpackage=new toollp;
$tool_id=get_argg('id');
$client_url="toolsBox/tool.xml";
if($tool_id==''){
	echo '工具编号发生错误！';exit;
}
$tool_list_xml=file_get_contents($client_url);
preg_match_all("/<programList>[\w\.]+<\/programList>/",$tool_list_xml,$match_array);
foreach($match_array[0] as $rs){
	$file_url=str_replace("</programList>","",$rs);
	$file_url=str_replace("<programList>","",$file_url);
	unlink('toolsBox/'.$tool_id."/".$file_url);
}
rmdir('toolsBox/'.$tool_id);
$result_xml=preg_replace("/<tool_item id=\"$tool_id\">([\s\S]*)<\/tool_item>/","",$tool_list_xml);
$xml_f=fopen($client_url,"w+");
$write_num=fwrite($xml_f,$result_xml);
if($write_num>0){
	echo '<script type="text/javascript">alert("卸载成功！");window.history.go(-1);</script>';
}else{
	echo '<script type="text/javascript">alert("卸载失败！请检查工具箱xml列表");window.history.go(-1);</script>';
}
?>
