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

/* 审核发布 */
/* 162100源码 - 162100.com */


function get_admin_area_id($area_id_arr) {
  return preg_match('/^(\(\d+\-\d+\))+$/', $area_id_arr) ? '('.trim(preg_replace('/\((\d+\-\d+)\)/', 'area_id="$1" OR area_id LIKE "$1\_%" OR ', $area_id_arr), ' OR').')' : '';

}

if (POWER == 2 || POWER == 3) {
  $out = '您所辖版区的';
  $key = ' '.get_admin_area_id($session[4]).' AND';
} else {
  $out = '全部';
}


if (isset($_GET['act']) && $_GET['act'] == 'check_warning') {
  $where_eval = '2';
  $list_title = '"<a href=\"?get=check\">'.$out.'待审核文章记录</a><a class=\"list_title_in\">'.$out.'审核未通过的文章记录<span>（".$n."）</span></a>"';
  $run_bar = '"<a href=\"?post=unity_run&dataname=listdata&id[]=".$row["id"]."&limit=check&m=1\" class=\"run_bar\" target=\"lastFrame\">过</a><a href=\"?post=unity_run&dataname=listdata&id[]=".$row["id"]."&limit=del_check&m=1\" class=\"run_bar\" target=\"lastFrame\">删</a>".(strstr($row["author_ip"], ".") ? "<a href=\"?post=ip&ips=".$row["author_ip"]."&m=1\" class=\"run_bar\" target=\"lastFrame\">屏蔽此IP</a>" : "<a href=\"?get=member&username=".urlencode($row["author_ip"])."\" class=\"run_bar\" target=\"_blank\">管理作者</a><a href=\"?post=unity_run&dataname=member&id[]=".urlencode($row["author_ip"])."&limit=del\" class=\"run_bar\" title=\"直接删除作者\">×</a>").""';
} else {
  $where_eval = '1';
  $list_title = '"<a class=\"list_title_in\">'.$out.'待审核文章记录<span>（".$n."）</span></a><a href=\"?get=check&act=check_warning\">'.$out.'审核未通过的文章记录</a>"';
  $run_bar = '"<a href=\"?post=unity_run&dataname=listdata&id[]=".$row["id"]."&limit=check&m=1\" class=\"run_bar\" target=\"lastFrame\">过</a><a href=\"?post=unity_run&dataname=listdata&id[]=".$row["id"]."&limit=check_warning&m=1\" class=\"run_bar\" target=\"lastFrame\" onclick=\"return why_this(this)\" title=\"在弹出的对话框中填写原因（IE8可能会屏蔽弹窗，请注意）\">否</a><a href=\"?post=unity_run&dataname=listdata&id[]=".$row["id"]."&limit=del_check&m=1\" class=\"run_bar\" target=\"lastFrame\">删</a>".(strstr($row["author_ip"], ".") ? "<a href=\"?post=ip&ips=".$row["author_ip"]."&m=1\" class=\"run_bar\" target=\"lastFrame\">屏蔽此IP</a>" : "<a href=\"?get=member&username=".urlencode($row["author_ip"])."\" class=\"run_bar\" target=\"_blank\">管理作者</a><a href=\"?post=unity_run&dataname=member&id[]=".urlencode($row["author_ip"])."&limit=del\" class=\"run_bar\" title=\"直接删除作者\">×</a>").""';

}

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

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

  $result = @mysql_query('SELECT COUNT(id) AS total FROM '.$sql['pref'].''.$sql['data']['承载主题文章的表名'].' WHERE'.$key.' area_check="'.$where_eval.'"', $db);
  $row = @mysql_fetch_assoc($result);
  $n = abs($row['total']);
  @mysql_free_result($result);
  unset($row);

  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 * FROM '.$sql['pref'].''.$sql['data']['承载主题文章的表名'].' WHERE'.$key.' area_check="'.$where_eval.'" ORDER BY topdate DESC LIMIT '.$seek.','.$web['pagesize'].'', $db);
    $area_postion = array();
    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="inc/require/z_other_getcheck.php?id='.$row['id'].'" onclick="showMenu(this);" target="lastFrame" class="li_a">'.$row['title'].'</a> <span class="ar" id="area_name_'.$row['id'].'"></span>
     <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']).'）
     '.eval('return '.$run_bar.';').'
     </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=check&act='.$_GET['act'].'&pn='.$_GET['pn'].'&p=');
/*
    $result = @mysql_query('SELECT area_id,area_index FROM '.$sql['pref'].''.$sql['data']['承载版区分类的表名'].' WHERE area_id REGEXP "^[0-9]+\-[0-9]+$"', $db);
    while ($row = @mysql_fetch_assoc($result)) {
      //$area_id_root = get_arearoot($row['area_id']);
      $area_mode[$row['area_id']] = get_li_mode($row['area_index']);
      unset($row);
    }
    @mysql_free_result($result);
*/
    $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>]";</sc'.'r'.'ipt>';
          $text .= '<script>$("area_name_'.$v.'").innerHTML="[…/'.addslashes($row['area_name']).']";</sc'.'r'.'ipt>';
        }
        unset($row);
      }
    }
    @mysql_free_result($result);


  else :
    $err .= '暂无记录';
  endif;

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

@mysql_close();


?>
<style type="text/css">
<!--
.menu { border:#CCCCCC 5px solid; width:630px; height:500px; }
a.run_bar { font-size:12px; margin-left:1px; margin-right:1px; padding:1px; background-color: #999966; font-weight:normal; color: #FFF; }

-->
</style>
<script language="javascript" type="text/javascript">
<!--
//调出用户信息弹窗
function showMenu(obj){
  var win=$("lastFrame");
  if(win!=null){
    //var h=obj.offsetHeight;
    var t=obj.offsetTop;
    var l=obj.offsetLeft;
    while(obj=obj.offsetParent){
	  //if(obj==document.body) break;
      t+=obj.offsetTop;
      l+=obj.offsetLeft;
    }
    win.style.display="block";
    win.style.position="absolute";
    win.style.left=(l)+"px";
    win.style.top=(t+14)+"px";
    win.style.zIndex="10";
    win.className="menu";
    win.onmouseout=function(){
      win.style.display="none";
    }
  }
}

function why_this(obj) {
  var str_n=prompt('填写原因：','');
  if(str_n){
    obj.href=obj.href.replace(/&why=[^=&]+/,'')+'&why='+encodeURIComponent(str_n)+'';
  }
  return true;
}
function why_all(theForm) {
  var str_n=prompt('填写原因：','');
  if(str_n){
    theForm.why.value=''+str_n+'';
  }
}
//-->
</script>
<iframe id="lastFrame" name="lastFrame" frameborder="0" marginheight="0" marginwidth="0" style="display:none;"></iframe>
<div class="list_title"><?php echo eval('return '.$list_title.';'); ?></div>
<form method="post" id="manageform" action="?post=unity_run&dataname=listdata">
  <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;&nbsp;
      <button type="button" name="act" onclick="chk(this.form,this,'edit')"><b>编辑</b></button>
    <button type="button" name="act2" onclick="chk(this.form,this,'check')"><b>审核通过</b></button>
    <input type="checkbox" class="checkbox" name="checksendmess" id="checksendmess" value="1" checked="checked" />
    <?php echo @ $_GET['act'] == 'check_warning' ? '' : '
      <button type="button" name="act2" onclick="why_all(this.form);chk(this.form,this,\'check_warning\')"><b>审核不通过</b></button>'; ?> |
    <button type="button" name="act2" onclick="chk(this.form,this,'del_check')"><b>删除</b></button>
    <input type="checkbox" class="checkbox" name="delsendmess" id="delsendmess" value="1" />  同时发信 
    <!--a href="?post=unity_run&dataname=listdata&act=del_check_all&id=1&area_check=<?php echo $where_eval; ?>"><b>一键全部删除</b></a-->
  </div>
  <?php
echo $text, $err;
?>
  <input type="hidden" name="why" />
  <input type="hidden" name="limit" />
</form>
