<?php
error_reporting(0);
include "../../include/cctvai.conn.php";
include "../function_common.php";
admincheck(6);
$action=SafeRequest("action", "get");
function deldir($dir) {
  //先删除目录下的文件：
  $dh=opendir($dir);
  while ($file=readdir($dh)) {
    if($file!="." && $file!="..") {
      $fullpath=$dir."/".$file;
      if(!is_dir($fullpath)) {
          unlink($fullpath);
      } else {
          deldir($fullpath);
      }
    }
  }
 
  closedir($dh);
  //删除当前文件夹：
  if(rmdir($dir)) {
    return true;
  } else {
    return false;
  }
}
if($action=="del"){
	$path=SafeRequest("path", "get");
	//禁止名单
	$array=array('up','userSign','userSlot','baidu_linksubmit');
	if(in_array($path, $array)) {
		showmessage("删除失败,系统自带不允许删除！", "index.php", 0);
	}
	//删除插件目录
	include "".$path."/config.php";
	if($plug_gpath){deldir('../../plug/'.$plug_gpath);}
	if($plug_apath){deldir('../plug/'.$plug_apath);}
	showmessage("应用已装卸删除！", 'index.php', 0);
	
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
 <head> 
  <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> 
  <meta name="renderer" content="webkit" /> 
  <title>管理后台</title> 
  <link rel="stylesheet" href="../css/add.css" type="text/css" media="screen" /> 
<style type="text/css">
.table2 {
width: 100%;
max-width: 100%;
border-collapse: collapse;
border-spacing: 0;
}
.table2 td {
font-size: 12px;
border-top: 1px solid #ddd;
padding: 8px;
vertical-align: top;
}
.table2 tr:hover {
	text-decoration: none;
	background-color: #e6f2fb;
}
.table2 th {
border-bottom: 2px solid #ddd;
vertical-align: bottom;
padding: 2px;
text-align: left;
}
.table3 {
width: 100%;
max-width: 100%;
border-collapse: collapse;
border-spacing: 0;
}
.table3 tr:hover {
	text-decoration: none;
	background-color: #e6f2fb;
}
.table3 td {
font-size: 12px;
line-height:25px;
border-top: 1px solid #ddd;
padding: 5px;
vertical-align: top;
border-right: solid 1px #ddd;
}
.table3 th {
border-bottom: 2px solid #ddd;
vertical-align: bottom;
padding: 2px;
text-align: left;
}
</style>
 </head> 
 <body> 
  <div class="contents"> 
   <div class="panel"> 
    <div class="panel-head">
     <strong>定制插件 请联系QQ：1542367792</strong>
    </div> 
    <table class="table2" id="dellist"> 
     <tbody>
      <tr bgcolor="#FAFBF7">
       <td align="left">插件名称</td>
       <td align="left">版本</td>
	   <td align="left">开发者</td>
	   <td align="left">联系QQ</td>
	   <td align="left">更新时间</td>
	   <td width="100" align="left">操作</td>
      </tr> 
<?php
$directory='./';
$files=array();
if(is_dir($directory)) {
	if($dh=opendir($directory)) {
		while(($file=readdir($dh))!==false) {
			if($file!='.' && $file!='..' && $file!='index.php') {
				include "".$file."/config.php";
					echo '      <tr>
       <td align="left">'.$plug_name.'</td>
       <td align="left">'.$plug_version.'</td>
	   <td align="left"><a href="http://www.cctvai.com/url.php/'.$plug_weburl.'" target="_blank">'.$plug_by.'</a></td>
	   <td align="left"><a href="http://wpa.qq.com/msgrd?v=3&uin='.$plug_qq.'&site=qq&menu=yes" target="_blank">'.$plug_qq.'</a></td>
	   <td align="left">'.$plug_time.'</td>
	   <td width="100" align="left"><a href="'.$plug_url.'" class="btn">设置</a> <a href="?action=del&path='.$file.'" class="btn" onclick="return confirm(\'确定卸载？不可恢复！\');">卸载</a></td>
      </tr> ';
			}
		}
		closedir($dh);
	}
}
?>

     </tbody>
    </table>  
   </div> 
  </div>  
 </body>
</html>