<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv=Content-Type content="text/html; charset=gbk">
<title>插件管理</title>
<meta http-equiv="X-UA-Compatible" content="IE=7" />
<link href="<?=base_url()?>csdj/admin/images/admin.css" type=text/css id="skincolor" rel="stylesheet" media="all" >
<SCRIPT type=text/javascript src="<?=base_url()?>csdj/admin/js/admin.js"></SCRIPT>
<SCRIPT type=text/javascript src="<?=base_url()?>csdj/admin/js/ajaxrequest.js"></SCRIPT>
<SCRIPT type=text/javascript src="<?=base_url()?>csdj/admin/js/showtitle.js"></SCRIPT>
</head>
<body style="margin:2px">
<table align="center" width="99%" border="1" cellspacing="0" cellpadding="5" bordercolor="#A2DAE7" style="border-collapse: collapse" id="myTable">
<tr><td class=title align="center">本地插件应用 ｜ <a title="官方云平台" href="<?=site_url('admin/plugins/yun/')?>">获取更多插件</a></td></tr>
<tr><td>
		<div class="container">
				<table class="tb tb2 psetting">
<?php
$a=$b=$c=1;
foreach ($show as $value) {
   if(is_dir('./plugins/'.$value['name'])){
       $sql="SELECT CS_ID,CS_SID FROM ".CS_SqlPrefix."plugins where CS_Dir='".$value['name']."'";
       $row=$this->CsdjDB->get_all($sql);
       require_once PLUGINDIR.$value['name'].'/config.php';
       if($row){
           if($row[0]->CS_SID==0){
                      $version=$this->CsdjAdmin->getplubversion($config['mid'],$config['version']);
                      if($version!='no'){
                           $up='<b><a href="'.site_url('admin/plugins/up').'?id='.$config['mid'].'" title="点击在线安装新版"><font color="red">发现新版 '.$version.'</font></a></b>';
                      }else{
                           $up='';
                      }
                      if($a==1){
                           echo '<tr><th colspan="15" class="partition">已启用的插件</th></tr>';
                      }
                      echo '
					<tr class="hover hover">
						<td valign="top" style="width:45px"><img src="'.CS_YPTURL.'index.php/plub/logo?id='.$config['mid'].'" onerror="this.src=\''.Web_Path.'csdj/admin/images/plugin_logo.gif\';this.onerror=null" width="40" height="40" align="left" /></td>
						<td valign="top">
							<span class="bold light">'.$config['name'].' '.$config['version'].'</span>
							<span class="sml">('.$value['name'].')</span>
							'.$up.'
							<a href="javascript:;" onclick="display(\'intro_'.$row[0]->CS_ID.'\')" class="memo">查看说明</a>
							<div id="intro_'.$row[0]->CS_ID.'" class="memo" style="display:none">'.$config['description'].'<br /></div>
							<p><span class="light">作者: '.$config['author'].' | <a href="'.site_url('admin/plugins/pingfen').'?id='.$config['mid'].'" title="在应用中心查看">评分</a></span></p>
							<p><a href="'.Web_Path.'index.php/m/'.$value['name'].'/index/admin">设置</a></p>
						</td>
						<td align="right" valign="bottom" style="width:160px">
							<a href="'.site_url('admin/plugins/disable/').'?id='.$row[0]->CS_ID.'&sid='.$row[0]->CS_SID.'" class="bold">关闭</a>&nbsp;&nbsp;<a href="'.site_url('admin/plugins/del/').'?id='.$row[0]->CS_ID.'&dir='.$value['name'].'" onClick="return confirm(\'卸载该插件后数据将会删除，您确定吗？\');">卸载</a>&nbsp;&nbsp;
						</td>
					</tr>
                            ';
            $a=$a+1;
           }
           if($row[0]->CS_SID==1){
                      $version=$this->CsdjAdmin->getplubversion($config['mid'],$config['version']);
                      if($version!='no'){
                           $up='<b><a href="'.site_url('admin/plugins/up').'?id='.$config['mid'].'" title="点击在线安装新版"><font color="red">发现新版 '.$version.'</font></a></b>';
                      }else{
                           $up='';
                      }
                      if($b==1){
                           echo '<tr><th colspan="15" class="partition">未启用的插件</th></tr>';
                      }
                      echo '
					<tr class="hover hover">
						<td valign="top" style="width:45px"><img src="'.CS_YPTURL.'index.php/plub/logo?id='.$config['mid'].'" onerror="this.src=\''.Web_Path.'csdj/admin/images/plugin_logo.gif\';this.onerror=null" width="40" height="40" align="left" /></td>
						<td valign="top">
							<span class="bold light">'.$config['name'].' '.$config['version'].'</span>
							<span class="sml">('.$value['name'].')</span>
							'.$up.'
							<a href="javascript:;" onclick="display(\'intro_'.$row[0]->CS_ID.'\')" class="memo">查看说明</a>
							<div id="intro_'.$row[0]->CS_ID.'" class="memo" style="display:none">'.$config['description'].'<br /></div>
							<p><span class="light">作者: '.$config['author'].' | <a href="'.site_url('admin/plugins/pingfen').'?id='.$config['mid'].'" title="在应用中心查看">评分</a></span></p>
							<p></p>
						</td>
						<td align="right" valign="bottom" style="width:160px">
							<a href="'.site_url('admin/plugins/disable/').'?id='.$row[0]->CS_ID.'&sid='.$row[0]->CS_SID.'" class="bold">启用</a>&nbsp;&nbsp;<a href="'.site_url('admin/plugins/del/').'?id='.$row[0]->CS_ID.'&dir='.$value['name'].'" onClick="return confirm(\'卸载该插件后数据将会删除，您确定吗？\');">卸载</a>&nbsp;&nbsp;
						</td>
					</tr>
                            ';
            $b=$b+1;
           }
       }else{
                      $version=$this->CsdjAdmin->getplubversion($config['mid'],$config['version']);
                      if($version!='no'){
                           $up='<b><a href="'.site_url('admin/plugins/up').'?id='.$config['mid'].'" title="点击在线安装新版"><font color="red">发现新版 '.$version.'</font></a></b>';
                      }else{
                           $up='';
                      }
                      if($c==1){
                           echo '<tr><th colspan="15" class="partition">未安装的插件</th></tr>';
                      }
                      echo '
					<tr class="hover hover">
						<td valign="top" style="width:45px"><img src="'.CS_YPTURL.'index.php/plub/logo?id='.$config['mid'].'" onerror="this.src=\''.Web_Path.'csdj/admin/images/plugin_logo.gif\';this.onerror=null" width="40" height="40" align="left" /></td>
						<td valign="top">
							<span class="bold light">'.$config['name'].' '.$config['version'].'</span>
							<span class="sml">('.$value['name'].')</span>
							'.$up.'
							<a href="javascript:;" onclick="display(\'intro_d'.$config['mid'].'\')" class="memo">查看说明</a>
							<div id="intro_d'.$config['mid'].'" class="memo" style="display:none">'.$config['description'].'<br /></div>
							<p><span class="light">作者: '.$config['author'].' | <a href="'.site_url('admin/plugins/pingfen').'?id='.$config['mid'].'" title="在应用中心查看">评分</a></span></p>
							<p></p>
						</td>
						<td align="right" valign="bottom" style="width:160px">
							<a href="'.site_url('admin/plugins/add/').'?dir='.$value['name'].'" class="bold">安装</a>&nbsp;&nbsp;<a href="'.site_url('admin/plugins/unlink/').'?dir='.$value['name'].'" onClick="return confirm(\'卸载该插件后数据将会删除，您确定吗？\');">删除</a>&nbsp;&nbsp;
						</td>
					</tr>
                            ';
            $c=$c+1;
       }
   }
}
?>
						<tr>
							<td colspan="15">
								<div class="fixsel">
									<a href="<?=site_url('admin/plugins/yun/')?>">获取更多插件</a>
								</div>
							</td>
						</tr>
					</table>
		</div>
</td></tr>
<tr style="<?php if($pagejs<2) echo 'display:none';?>"><td colspan='6' align="center">
<a href="<?=$url?>&page=1">首 页</a>&nbsp;
<?php
   if($page>1){
        echo '<a href="'.$url.'&page='.($page-1).'">上一页 </a>&nbsp;';
   }else{
        echo '<a href="'.$url.'&page=1">上一页 </a>&nbsp;';
   }

   for ($i=$page-2;$i<=$page+2;$i++){
        if ($i<=0){
               continue;
        }
        if ($i>$pagejs){
            break;
        }
        if ($i==$page){
              $curpage=" style='color:#f00;'";
        }else{
              $curpage="";
        }
        echo "<a href='".$url."&page=".$pagejs."'$curpage>$i</a>&nbsp;";
    }

    if ($page==$pagejs || $pagejs==0){
         echo '<a href="'.$url.'&page='.$pagejs.'">下一页</a>&nbsp;';
    }else{
         echo '<a href="'.$url.'&page='.($page+1).'">下一页</a>&nbsp;';
    }
    echo '<a href="'.$url.'&page='.$pagejs.'">尾 页</a>&nbsp;';
?>
</td></tr>
</table>
</body>
</html>
