<?php
require("../../class/connect.php");
include("../../class/config.php");
include("../../class/q_functions.php");
include("../../class/db_sql.php");
include("../../class/user.php");
include("../../class/class.php");
include "../".LoadLang("pub/fun.php");
$link=db_connect();
$empire=new mysqlquery();
$editor=1;
$user=islogin();
$url="<a href=../../../>首页</a>&nbsp;>&nbsp;<a href=../cp>控制面板</a>&nbsp;>&nbsp;收藏夹";
include("../../data/template/cp_1.php");
$line=25;
$page_line=12;
$start=(int)$_GET['start'];
$page=(int)$_GET['page'];
$cid=(int)$_GET['cid'];
$a="";
if($cid)
{
	$a=" and cid='$cid'";
	$search="&cid=$cid";
}
$offset=$start+$page*$line;
$totalquery="select count(*) as total from {$dbtbpre}enewsfava where userid='$user[userid]'".$a;
$num=$empire->gettotal($totalquery);
$query="select favaid,favatime,id,classid from {$dbtbpre}enewsfava where userid='$user[userid]'".$a;
$query.=" order by favaid desc limit $offset,$line";
$sql=$empire->query($query);
$returnpage=page1($num,$line,$page_line,$start,$page,$search);
//返回分类
$select=ReturnFavaClass($user[userid],$cid,0);
?>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr> 
    <td width="15%" valign="top"> <table width="100%" border="0" cellpadding="3" cellspacing="1" class="tableborder">
        <tr class="header"> 
          <td height="23">收藏夹管理</td>
        </tr>
        <tr> 
          <td height="23" bgcolor="#FFFFFF"><img src="../../data/images/msgnav.gif" width="5" height="5">&nbsp;<a href="FavaClass">分类管理</a></td>
        </tr>
        <tr> 
          <td height="23" bgcolor="#FFFFFF"><img src="../../data/images/msgnav.gif" width="5" height="5">&nbsp;<a href="../fava">收藏夹管理</a></td>
        </tr>
      </table></td>
    <td width="1%" valign="top">&nbsp;</td>
    <td width="84%" valign="top"> <div align="center">
        <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" class="tableborder">
          <form name="form1" method="post" action="">
            <tr> 
              <td height="30" bgcolor="#FFFFFF">选择分类: 
                <select name="cid" id="select" onchange=window.location='../fava?cid='+this.options[this.selectedIndex].value>
                  <option value="0">显示全部</option>
                  <?=$select?>
                </select>
                [<a href="FavaClass">管理分类</a>]</td>
            </tr>
          </form>
        </table>
        <table width="100%" border="0" cellpadding="3" cellspacing="1" class="tableborder">
          <form name=favaform method=post action="../../enews/index.php" onsubmit="return confirm('确认要操作?');">
            <input type=hidden value=DelFava_All name=enews>
            <tr class="header"> 
              <td width="4%"><div align="center"></div></td>
              <td width="57%"><div align="center">标题</div></td>
              <td width="12%"><div align="center">点击</div></td>
              <td width="20%"><div align="center">收藏时间</div></td>
              <td width="7%"><div align="center">选择</div></td>
            </tr>
            <?
  while($fr=$empire->fetch($sql))
  {
	if(empty($class_r[$fr[classid]][tbname]))
	{continue;}
	$r=$empire->fetch1("select title,titleurl,groupid,filename,newspath,onclick,classid,id from {$dbtbpre}ecms_".$class_r[$fr[classid]][tbname]." where id='$fr[id]' and checked=1");
	//标题链接
	$titlelink=sys_ReturnBqTitleLink($r);
	if(!$r['id'])
	{
		$r['title']="此信息已删除";
		$titlelink="#EmpireCMS";
	}
  ?>
            <tr bgcolor="#FFFFFF"> 
              <td> <div align="center"><img src="../../data/images/dir.gif" border=0></div></td>
              <td> <div align="left"><a href="<?=$titlelink?>" target=_blank> 
                  <?=$r[title]?>
                  </a></div></td>
              <td> <div align="center"> 
                  <?=$r[onclick]?>
                </div></td>
              <td> <div align="center"> 
                  <?=$fr[favatime]?>
                </div></td>
              <td> <div align="center"> 
                  <input name="favaid[]" type="checkbox" id="favaid[]2" value="<?=$fr[favaid]?>">
                </div></td>
            </tr>
            <?
  }
  ?>
            <tr bgcolor="#FFFFFF"> 
              <td colspan="5"> &nbsp;&nbsp;&nbsp; 
                <?=$returnpage?>
                &nbsp;&nbsp; <select name="select">
                  <option value="0">请选择要转移的目标分类</option>
                  <?=$select?>
                </select> <input type="submit" name="Submit" value="转移选中" onclick="document.favaform.enews.value='MoveFava_All'"> 
                &nbsp;&nbsp; <input type="submit" name="Submit" value="删除选中" onclick="document.favaform.enews.value='DelFava_All'"></td>
            </tr>
          </form>
        </table>
      </div></td>
  </tr>
</table>
<?
include("../../data/template/cp_2.php");
db_close();
$empire=null;
?>