<?php
require ('authentication_member.php');
?>
<?php

/* 取：我的收藏 */
/* 162100源码 - 162100.com */


function get_list_collect_list($row) {
  global $article_url_list, $area_mode;
          return  '
<table width="100%" class="li_face" id="check_'.$row['id'].'" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="20"><input name="id[]" id="id['.$row['id'].']" type="checkbox" class="checkbox" value="'.$row['id'].'" /></td>
    <td class="li_subject">
      '.$row['title_mark'].'<a href="'.eval('return '.$article_url_list.';').'" title="'.$row['title'].'" class="li_a" target="_blank" name="li_a[]"'.$row['title_style'].'>'.$row['title'].'</a>
    <div class="li_">
	  发表 '.(strstr((string)$row['author_ip'], '.') ? '<span title="匿名用户">'.$row['author_ip'].'</span>' : '<a href="user.php?get=card&username='.urlencode($row['author_ip']).'" target="_blank" title="点击查看发布人名片"><img src="inc/images/card.gif" />'.$row['author_ip'].'</a>').'（'.get_date_c($row['date']).'）
      <span class="li_update_mark" title="更新"></span> '.(!empty($row['other']) ? (strstr((string)$row['other'], '.') ? $row['other'] : '<a href="user.php?get=card&username='.urlencode($row['other']).'" target="_blank" title="'.$row['other'].'
点击查看回复人名片">'.$row['other'].'</a>') : '<span title="'.$row['author_ip'].'">'.$row['author_ip'].'</span>').'（'.get_date_c($row['topdate']).'）
    收藏时间（<span class="redword">'.$row['d'].'</span>）
     </div>
    </td>
    <td class="li_views_reply">回复/阅览<br />'.$row['reply'].'/'.$row['views'].'</td>
  </tr>
</table>

  
';

}

function get_list_collect_reply($row) {
  global $article_url_reply, $article_url_reply_base, $area_mode;
        return  '
<table width="100%" class="li" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="20"><input name="id[]" id="id[]" type="checkbox" class="checkbox" value="'.$row['id'].'" /></td>
    <td>
    <div><span class="column_">在主题文章<a href="'.eval('return '.$article_url_reply_base.';').'" target="_blank"><b>《'.$row['title'].'》</b></a>中</span></div>
    <div class="text">'.$row['text'].'</div>
    <div class="li_">
      回复时间（'.get_date_c($row['date']).'）
      收藏时间（<span class="redword">'.$row['d'].'</span>）
    <a href="'.eval('return '.$article_url_reply.';').'" target="_blank">详细&raquo;</a>
     </div>
    </td>
  </tr>
</table>
';

}

$text = $err = '';
$_GET['act'] =@$_GET['act'];
if ($_GET['act'] == 'reply') {
  $B_data = $B_description = $sql['data']['承载回复评论的表名'];
  $B_sql1 = 'A.date AS d,B.*,C.area_id,C.title';
  $B_sql2 = '('.$sql['pref'].''.$B_data.' AS B,'.$sql['pref'].''.$sql['data']['承载主题文章的表名'].' AS C) ON B.id=ABS(A.money) WHERE A.username="'.$session[0].'" AND A.type="2" AND A.description="'.$B_description.'" AND C.id=B.r_id';
  $function_get_list = 'get_list_collect_reply';
  $list_title = '"<a href=\"?get=collect\">我收藏的文章</a><a class=\"list_title_in\">我收藏的回复<span>（".$n."）</span></a>"';

} else {
  $B_data = $sql['data']['承载主题文章的表名'];
  $B_description = '';
  $B_sql1 = 'A.date AS d,B.*';
  $B_sql2 = ''.$sql['pref'].''.$B_data.' AS B ON B.id=ABS(A.money) WHERE A.username="'.$session[0].'" AND A.type="2" AND A.description="'.$B_description.'"';
  $function_get_list = 'get_list_collect_list';
  $list_title = '"<a class=\"list_title_in\">我收藏的文章<span>（".$n."）</span></a><a href=\"?get=collect&act=reply\">我收藏的回复</a>"';
}

$article_url_list = $web['url_html_article'] == 1 ? '"article.".$area_mode[get_arearoot($row["area_id"])].".".$row["id"].".1.html"' : '"article.php?mode=".$area_mode[get_arearoot($row["area_id"])]."&id=".$row["id"].""';
$article_url_reply_base = $web['url_html_article'] == 1 ? '"article.".$area_mode[get_arearoot($row["area_id"])].".".$row["r_id"].".1.html"' : '"article.php?mode=".$area_mode[get_arearoot($row["area_id"])]."&id=".$row["r_id"].""';
$article_url_reply = $web['url_html_article'] == 1 ? '"article.".$area_mode[get_arearoot($row["area_id"])].".".$row["r_id"].".1.html&reply_id=".$row["id"]."#reply_".$row["id"].""' : '"article.php?mode=".$area_mode[get_arearoot($row["area_id"])]."&id=".$row["r_id"]."&reply_id=".$row["id"]."#reply_".$row["id"].""';


$n = $mess = 0;

if (!isset($sql['db_err'])) {
  db_conn();
}

if ($sql['db_err'] == '') {

  $result = @mysql_query('SELECT mess_num,check_reg FROM '.$sql['pref'].''.$sql['data']['承载成员档案的表名'].' WHERE username="'.$session[0].'" LIMIT 1', $db);
	if ($row = @mysql_fetch_assoc($result)) {
    if ($row['check_reg'] == '1') {
      $err = '帐号注册审核中！';
    } elseif ($row['check_reg'] == '2') {
      $err = '帐号已被移除至<a href="list_member.php?act=punished" target="_blank">黑名单</a>！';
    } else {
      $mess = '<span class="grayword">'.preg_replace('/^\d+/', '<span>$0</span>', $row['mess_num']).'</span>';
    }
    unset($row);
  } else {
    $err = '帐号不存在！';
  }
  @mysql_free_result($result);

  if (empty($err)) {
    $result = @mysql_query('SELECT area_id,area_check_reply,area_index FROM '.$sql['pref'].''.$sql['data']['承载版区分类的表名'].' WHERE area_id REGEXP "^[0-9]+\-[0-9]+$"', $db);
    while ($row = @mysql_fetch_assoc($result)) {
      $area_mode[$row['area_id']] = get_li_mode($row['area_index']);
      unset($row);
    }
    @mysql_free_result($result);

    $result = @mysql_query('SELECT COUNT(A.id) AS total FROM '.$sql['pref'].''.$sql['data']['承载财务数据的表名'].' AS A LEFT JOIN '.$B_sql2.'', $db);
    $row = @mysql_fetch_assoc($result);
    $n = abs($row['total']);
    unset($row);
    @mysql_free_result($result);

    require ('inc/function/get_page.php');
@ require ('inc/function/get_date.php'); //时间
    require ('inc/function/cutstr.php');
    if ($n > 0) {
      $p = get_page($n); //页数
      $seek = $web['pagesize'] * ($p-1);
      $result = @mysql_query('SELECT '.$B_sql1.' FROM '.$sql['pref'].''.$sql['data']['承载财务数据的表名'].' AS A LEFT JOIN '.$B_sql2.' ORDER BY A.id DESC LIMIT '.$seek.','.$web['pagesize'].'', $db);



      while ($row = @mysql_fetch_assoc($result)) {
//print_r($row);
        //$row['title'] = preg_replace('/(\|.*)?/', '', $row['title']);
        $text .= $function_get_list($row);
        unset($row);

      }
      @mysql_free_result($result);

      $text .= get_page_foot($n, $web['pagesize'], $p, '?get=collect&act='.$_GET['act'].'&p=');

    } else {
      $err = '暂无记录';
    }

  }
  require ('inc/function/add_online.php'); //在线

  $sql['sql_version'] = @mysql_get_server_info();
} else {
  $err .= $sql['db_err'];
}

@mysql_close();


?>
<style type="text/css">
<!--
.li .column_ { border-bottom:1px #999966 solid; }
-->
</style>
<div class="list_title"><?php echo eval('return '.$list_title.';'); ?></div>
<form method="post" id="manageform" action="?post=unity_run&dataname=myaccount">
<div class="manager_menu"> <a href="javascript:void(0)" onclick="allChoose(true,true);return false;">全选</a> - <a href="javascript:void(0)" onclick="allChoose(true,false);return false;">反选</a> - <a href="javascript:void(0)" onclick="allChoose(false,false);return false;">不选</a> &nbsp;
    <button name="act" type="button" onclick="chk(this.form,this,'del_collect_<?php echo $B_data; ?>')"><b>删除</b></button>
</div>
<?php
if (isset($sql['sql_version']) && $sql['sql_version'] < '5.0') {
  echo '<div class="red_err">服务器数据库版本（'.$sql['sql_version'].'）太低！数据可能显示不正常。本程序建设基于MySQL版本5.0以上</div>';
}

echo $text, $err;

?>
  <input type="hidden" name="limit" />
</form>
