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

/* 取：我的文章 */
/* 162100源码 - 162100.com */


$row_area_check = $row_area_expires = $area_postion = array();
$credit_total = $funds_total = $n = $n_ = $mess = $writecount = 0;

$list_url = $web['url_html_list'] == 1 ? '"list.".$area_mode[get_arearoot($row["area_id"])].".".$row["area_id"]."..1.html"' : '"list.php?mode=".$area_mode[get_arearoot($row["area_id"])]."&area_id=".$row["area_id"].""';
$article_url = $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"].""';

$_GET['act']=@$_GET['act'];
if ($_GET['act'] == 'over') {
  $where_eval = ' AND reward REGEXP "（已兑现）"';
  $list_title = '"<a href=\"?get=reward\">所有含悬赏的记录</a><a class=\"list_title_in\">已兑现的记录<span>（".$n."）</span></a><a href=\"?get=reward&act=runing\">未兑现的记录</a>"';

} elseif ($_GET['act'] == 'runing') {
  $where_eval = ' AND reward REGEXP "^[0-9\.]+$"';
  $list_title = '"<a href=\"?get=reward\">所有含悬赏的记录</a><a href=\"?get=reward&act=over\">已兑现的记录</a><a class=\"list_title_in\">未兑现的记录<span>（".$n."）</span></a>"';
  $area_name = '"<span class=\"ar ar2\">[ <a href=\"member.php?get=list_edit&id=".$row["id"]."\" target=\"_blank\">编辑</a> | <a href=\"member.php?get=reward_cash&id=".$row["id"]."\">兑赏</a> ]</span>"';

} else {
  $where_eval = ' AND reward<>""';
  $list_title = '"<a class=\"list_title_in\">所有含悬赏的记录<span>（".$n."）</span></a><a href=\"?get=reward&act=over\">已兑现的记录</a><a href=\"?get=reward&act=runing\">未兑现的记录</a>"';
  $area_name = 'li_eval($row)';
}
$text=$err = '';

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

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

  $result = @mysql_query('SELECT mess_num,ABS(writecount) AS wc,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>';
    }
    $writecount = $row['wc'];
    unset($row);
  } else {
    $err = '帐号不存在！';
  }
  @mysql_free_result($result);

  if (empty($err)) {
    $result = @mysql_query('SELECT area_id,area_check,area_expires,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);

    if (isset($where_eval)) {
      $result = @mysql_query('SELECT COUNT(id) AS total FROM '.$sql['pref'].''.$sql['data']['承载主题文章的表名'].' WHERE author_ip="'.$session[0].'"'.$where_eval.'', $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'); //时间
      if ($n > 0) {
        $p = get_page($n); //页数
        $seek = $web['pagesize'] * ($p-1);
        $result = @mysql_query('SELECT *,(topdate-DATE_ADD(UTC_TIMESTAMP(), INTERVAL '.floatval($web['time_pos']).' HOUR)) AS t FROM '.$sql['pref'].''.$sql['data']['承载主题文章的表名'].' WHERE author_ip="'.$session[0].'"'.$where_eval.' ORDER BY topdate DESC LIMIT '.$seek.','.$web['pagesize'].'', $db);
        while ($row = @mysql_fetch_assoc($result)) {
          $area_postion[$row['area_id']][] = $row['id'];
          //$row['title'] = preg_replace('/(\|.*)?/', '', $row['title']);
          $text .= '
<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'].'" /><input name="area_id['.$row['id'].']" id="area_id['.$row['id'].']" type="hidden" value="'.$row['area_id'].'" /></td>
    <td class="li_subject">
      '.$row['title_mark'].'<a href="'.eval('return '.$article_url.';').'" title="'.$row['title'].'" class="li_a" target="_blank" name="li_a[]"'.$row['title_style'].'>'.$row['title'].'</a> <span class="ar" id="area_name_'.$row['id'].'"></span>

    '.eval('return '.$area_name.';').'

     <div class="li_">
	    发表 '.$row['author_ip'].'（'.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>') : $row['author_ip']).'（'.get_date_c($row['topdate']).'）
     </div>

    </td>
        <td class="li_views_reply">回复/阅览<br />'.$row['reply'].'/'.$row['views'].'</td>
  </tr>
</table>

  
';

          unset($row);

        }
        @mysql_free_result($result);
        $text .= get_page_foot($n, $web['pagesize'], $p, '?get=list&act='.$_GET['act'].'&p=');

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

    $result = @mysql_query('SELECT area_id,area_name FROM '.$sql['pref'].''.$sql['data']['承载版区分类的表名'].' WHERE area_id="'.@implode('" OR area_id="', array_keys($area_postion)).'"', $db);
    if (@mysql_num_rows($result) > 0) {
      while ($row = @mysql_fetch_assoc($result)) {
        foreach ((array)$area_postion[$row['area_id']] as $v) {
          $text .= '<script>$("area_name_'.$v.'").innerHTML="[…/<a href=\"'.eval('return '.$list_url.';').'\" target=\"_blank\">'.addslashes($row['area_name']).'</a>]";</script>';
        }
        unset($row);
      }
    }
    @mysql_free_result($result);
  }


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

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

function li_eval($row) {
  if (is_numeric($row['reward'])) {
    return '<span class="ar ar2">[ <a href="member.php?get=list_edit&id='.$row['id'].'" target="_blank">编辑</a> | <a href="member.php?get=reward_cash&id='.$row['id'].'">兑赏</a> ]</span>';
  }
}

?>
<style type="text/css">
<!--
.ar2, .ar2 a { color:#99CCFF; }
-->
</style>
<div class="list_title"><?php echo eval('return '.$list_title.';'); ?></div>
<form method="post" id="manageform" action="?post=unity_run&dataname=listdata">
  <?php
    //if (!empty($text)) {
      echo '
    <div class="manager_menu">
    <table border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="120"><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></td>
          <td><button name="act" type="button" onclick="chk(this.form,this,\'edit\')"><b>编辑</b></button>
            <button name="act" type="button" onclick="alert(\'删帖请到“管理已发文章”中进行\')"><b>删除</b></button></td>
        </tr>
      </table>
    </div>';
    //}
?>
  <?php
echo $text, $err;
?>
  <input type="hidden" name="limit" />
</form>
