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

/* 取：我的回复 */
/* 162100源码 - 162100.com */



$article_url_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"]."';

$_GET['act']=@$_GET['act'];
      /*
      if ($_GET['act'] == 'show') {
        $where_eval1 = ' AND '.$sql['pref'].''.$sql['data']['承载回复评论的表名'].'.area_check_reply=""';
        $where_eval2 = ' AND A.area_check_reply=""';
        $list_title = '"<a href=\"?get=reply\">全部回复记录</a><a class=\"list_title_in\">显示中的记录<span>（".$n."）</span></a><a href=\"?get=reply&act=check_reply\">审核中的记录</a><a href=\"?get=reply&act=check_reply_warning\">审核未通过的记录</a>"';
      } else*/if ($_GET['act'] == 'check_reply') {
        $input_delk = '_check_reply';
        $where_eval1 = ' AND '.$sql['pref'].''.$sql['data']['承载回复评论的表名'].'.area_check_reply="1"';
        $where_eval2 = ' AND A.area_check_reply="1"';
        $list_title = '"<a href=\"?get=reply\">发布中的记录</a><a class=\"list_title_in\">审核中的记录<span>（".$n."）</span></a><a href=\"?get=reply&act=check_reply_warning\">审核未通过的记录</a><a href=\"?get=reply&act=reward_get\">获得悬赏的记录</a>"';
      } elseif ($_GET['act'] == 'check_reply_warning') {
        $input_delk = '_check_reply';
        $where_eval1 = ' AND '.$sql['pref'].''.$sql['data']['承载回复评论的表名'].'.area_check_reply="2"';
        $where_eval2 = ' AND A.area_check_reply="2"';
        $list_title = '"<a href=\"?get=reply\">发布中的记录</a><a href=\"?get=reply&act=check_reply\">审核中的记录</a><a class=\"list_title_in\">审核未通过的记录<span>（".$n."）</span></a><a href=\"?get=reply&act=reward_get\">获得悬赏的记录</a>"';
      } elseif ($_GET['act'] == 'reward_get') {
        $where_eval1 = ' AND '.$sql['pref'].''.$sql['data']['承载回复评论的表名'].'.reward>0';
        $where_eval2 = ' AND A.reward>0';
        $list_title = '"<a href=\"?get=reply\">发布中的记录</a><a href=\"?get=reply&act=check_reply\">审核中的记录</a><a href=\"?get=reply&act=check_reply_warning\">审核未通过的记录</a><a class=\"list_title_in\">获得悬赏的记录<span>（".$n."）</span></a>"';
      } else {
        $where_eval1 = ' AND '.$sql['pref'].''.$sql['data']['承载回复评论的表名'].'.area_check_reply="0"';
        $where_eval2 = ' AND A.area_check_reply="0"';
        $list_title = '"<a class=\"list_title_in\">发布中的记录<span>（<span title=\"实际库存\">".$n."</span>/<span title=\"总计\" class=\"gray\">".$replycount."</span>）</span></a><a href=\"?get=reply&act=check_reply\">审核中的记录</a><a href=\"?get=reply&act=check_reply_warning\">审核未通过的记录</a><a href=\"?get=reply&act=reward_get\">获得悬赏的记录</a>"';

        /*
        $where_eval1 = $where_eval2 = '';
        $list_title = '"<a class=\"list_title_in\">全部回复记录<span>（<b title=\"实际库存\">".$n."</b>/<span title=\"总计\" class=\"gray\">".$row["replycount"]."</span>）</span></a><a href=\"?get=reply&act=show\">显示中的记录</a><a href=\"?get=reply&act=check_reply\">审核中的记录</a><a href=\"?get=reply&act=check_reply_warning\">审核未通过的记录</a>"';
        */
      }


$row_area_check = $row_area_expires = array();
$mess = 0;
$text=$err = '';
if (!isset($sql['db_err'])) {
  db_conn();
}

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

  $result = @mysql_query('SELECT mess_num,ABS(replycount) AS rc,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>';
    }
    $replycount = $row['rc'];
    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)) {
      if ($row['area_check_reply'] == '1') $row_area_check_reply[$row['area_id']] = 1;
      $area_mode[$row['area_id']] = get_li_mode($row['area_index']);
      unset($row);
    }
    @mysql_free_result($result);

    $result = @mysql_query('SELECT COUNT(id) AS total FROM '.$sql['pref'].''.$sql['data']['承载回复评论的表名'].' WHERE author_ip="'.$session[0].'"'.$where_eval1.'', $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 A.id,A.r_id,A.text,A.date,A.area_check_reply,B.area_id,B.author_ip,B.title,B.date AS d FROM '.$sql['pref'].''.$sql['data']['承载回复评论的表名'].' AS A,'.$sql['pref'].''.$sql['data']['承载主题文章的表名'].' AS B WHERE A.author_ip="'.$session[0].'"'.$where_eval2.' AND B.id=A.r_id ORDER BY id DESC LIMIT '.$seek.','.$web['pagesize'].'', $db);
      while ($row = @mysql_fetch_assoc($result)) {
        /*
        */
        if (@$row_area_check_reply[get_arearoot($row['area_id'])] == 1) {
	        if ($row['area_check_reply'] == '1') {
            $area_name = '<span class="ar">[ 审核中 ]</span>';
          } elseif ($row['area_check_reply'] == '2') {
            $area_name = '<span class="ar">[ 审核未通过 ]</span>';
          }
        }
        $text .= '
<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'].'" /><input name="url['.$row['id'].']" id="url['.$row['id'].']" type="hidden" value="info_'.$row['r_id'].'_'.urlencode($row['author_ip']).'" /></td>
    <td>

  <div><span class="column_">于'.$row['author_ip'].' '.$row['d'].'发表的主题<a href="'.eval('return '.$article_url_base.'";').'" target="_blank"><b>《'.$row['title'].'》</b></a>中</span></div>
  <div class="text">'.cutstr($row['text'], 450).' '.@$area_name.'</div>
  <div class="li_">
    回复时间（'.get_date_c($row['date']).'） <a href="'.eval('return '.$article_url_base.'&reply_id='.$row['id'].'#reply_'.$row['id'].'";').'" target="_blank">查看回复详情&raquo;</a>
  </div>

    </td>
  </tr>
</table>
';
        unset($row, $area_name);
      }
      @mysql_free_result($result);

      $text .= get_page_foot($n, $web['pagesize'], $p, '?get=reply&act='.$_GET['act'].'&p=');
    } else {
      $err = '暂无记录';
    }

  }

} else {
  $err .= $sql['db_err'];
}

@ require ('inc/function/add_online.php'); //在线
@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=reply">
  <?php
//if (!empty($text)) {
  if ($web['re_del'] != 1 && POWER <= 3) {
    $m_key = ' disabled="disabled"';
    $m_kea = '系统设置为：不允许用户删除自己的回复。'.(POWER == 2 || POWER == 3 ? '<b>版主进行删除回复操作请到管理后台</b>' : '').'';
  }
?>
  <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<?php echo @$input_delk; ?>')"<?php echo $m_key; ?>><b>删除</b></button> <span id="re_del_err"><?php echo $m_kea; ?></span>
  </div>
  <?php
//}
?>
<?php echo $text, $err; ?>
  <input type="hidden" name="limit" />
</form>
