<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php

/* 发表编辑器 */
/* 162100源码 - 162100.com - download.162100.com */
function get_li_mode($area_index) {
  global $web;
  if (!isset($area_index) || empty($area_index)) {
    return $web['sitemode'];
  } elseif (strstr($area_index, $web['sitemode'])) {
    return $web['sitemode'];
  } else {
    $sitemode = false;
    foreach (@explode('|', $area_index) as $mode) {
      if (file_exists('inc/css/'.$mode.'/index.php') && file_exists('inc/css/'.$mode.'/list.php') && file_exists('inc/css/'.$mode.'/article.php')) {
        $sitemode = $mode == $web['sitemode'] ? $web['sitemode'] : $mode;
        break;
      }
    }
    return $sitemode ? $sitemode : $web['sitemode'];
  }
}

@ require ('inc/set/set.php');
@ require ('inc/set/set_sql.php');
@ require ('inc/set/set_userface.php');
@ require ('inc/function/confirm_power.php');

//身份验证
define('POWER', confirm_power());
$userface = user_class(POWER, $session[3]);

if (POWER < 1) {
  $imcode = '<u><b><span class="redword">*</span> 匿名发表请填验证码：</b></u><br /><table border="0" cellspacing="0" cellpadding="0"><tr><td style="width:130px"><input class="large" name="imcode" type="text" style="width:120px" maxlength="6" /></td><td><iframe src="inc/js/imcode.html" id="imFrame" name="imFrame" width="95" height="18" frameborder="0" marginwidth="0" marginheight="0" scrolling="No" allowtransparency="true"></iframe></td></tr></table><br />';
}
$err = $err_ = '';
?><?php
$total_credit = $total_funds = 0;
if (!isset($sql['db_err'])) {
  db_conn();
}
if ($sql['db_err'] == '') {
	
  if (isset($_GET['mode']) && $_GET['mode'] && file_exists('inc/css/'.$_GET['mode'].'/index.php') && file_exists('inc/css/'.$_GET['mode'].'/list.php') && file_exists('inc/css/'.$_GET['mode'].'/article.php')) {
    $GLOBALS['this_mode'] = $_GET['mode'];

    $arr_area_title = $arr_area_child = $arr_area_power = array();
    if (preg_match('/^(\d+\-\d+)(\_\d+)*$/', @ $_GET['area_id'], $area_m)) {
    $column = @file_get_contents('inc/css/'.$GLOBALS['this_mode'].'/title2.txt');
    $area_id_root = $area_m[1];
    //栏目
    $base_title = $_GET['area_id'];
    $eval_title = 'area_id="'.$_GET['area_id'].'"';
    $area_title = 'strip_tags($arr_area_title[\''.$_GET['area_id'].'\'])';
    while (strpos($base_title, '_') !== false) {
      $base_title = preg_replace('/\_\d+$/', '', $base_title);
      $eval_title .= ' OR area_id="'.$base_title.'"';
      $area_title = '$arr_area_title[\''.$base_title.'\'].\' &gt; \'.'.$area_title.'';}

    $result = @mysql_query('SELECT * FROM '.$sql['pref'].''.$sql['data']['承载版区分类的表名'].' WHERE '.$eval_title.' OR area_id REGEXP "^'.$_GET['area_id'].'_[0-9]+$"', $db);
    if (mysql_num_rows($result) > 0) {
      $q_l = strlen($_GET['area_id']);
      while ($row = @mysql_fetch_assoc($result)) {
        if ($row['area_id'] == $area_id_root) {
          $AREA_MARK = $row['area_mark'];
          if (!empty($row['area_index']) && !strstr($row['area_index'], $GLOBALS['this_mode'])) {
            $sitemode = false;
            if (strstr($row['area_index'], $web['sitemode'])) {
              $sitemode = $web['sitemode'];
            } else {
              foreach (@explode('|', $row['area_index']) as $mode) {
                if (file_exists('inc/css/'.$mode.'/index.php') && file_exists('inc/css/'.$mode.'/list.php') && file_exists('inc/css/'.$mode.'/article.php')) {
                  $sitemode = $mode == $web['sitemode'] ? $web['sitemode'] : $mode;
                  break;
                }
              }
              if ($sitemode ==false) {
                $err .= '<div class="red_err">以下内容所属栏目分类并没有分配至当前模板！但是可以借此模板正常显示</div>';
              } else {
                $GLOBALS['this_mode'] = $sitemode;
              }
              unset($sitemode, $mode);
            }
          }
        }
        if ($q_l >= strlen($row['area_id'])) {
          $arr_area_title[$row['area_id']] = '<a href="?mode='.$GLOBALS['this_mode'].'&area_id='.$row['area_id'].'"'.$row['area_style'].'>'.$row['area_name'].'</a> ';
        } else/*if (strrpos($row['area_id'], '_') == $q_l)*/ {
          $arr_area_child[$row['area_id']] = '<a href="?mode='.$GLOBALS['this_mode'].'&area_id='.$row['area_id'].'" style="white-space:nowrap;"'.$row['area_style'].'>'.$row['area_name'].'</a> ';
        }
        unset($row);
      }
    }
    @mysql_free_result($result);
    @uksort($arr_area_child, 'strnatcmp');
    eval('$title1 = \'<a href="?mode='.$GLOBALS['this_mode'].'">全部根目</a> &gt; \'.'.$area_title.';');

    if (empty($arr_area_title[$_GET['area_id']])) {
      $childs = '（栏目分类不存在！）';
    } else {
      if (count($arr_area_child) > 0) {
        $mark_child = '<span class="redword">该标签仍可细分：</span>';
      } else {
        $mark_child = '';
        /**************** 此处可删除，但需要列表页部分代码的配合 **************
        if (is_numeric($_GET['area_id'])) {
          $err_ .= '此大类没有创建二级分类，不能发表。';
        }
        **************** 此处可删除，但需要列表页部分代码的配合 **************/
        $yes = '现在可以发表了';
      }
      $childs = $AREA_MARK.'<br />'.$mark_child.''.@implode('', $arr_area_child);
    }

    } else {

    $title1 = '<a href="write.php">更上一級</a> &gt; 全部根目'; //分类
    $column = @file_get_contents('inc/css/'.$GLOBALS['this_mode'].'/title2.txt');
    $result = @mysql_query('SELECT * FROM '.$sql['pref'].''.$sql['data']['承载版区分类的表名'].' WHERE area_id REGEXP "^[0-9]+\-[0-9]+$" AND area_index LIKE "%'.$GLOBALS['this_mode'].'%"', $db);
    if (@mysql_num_rows($result) > 0) {
      while ($row = @mysql_fetch_assoc($result)) {
        $arr_area_child[$row['area_id']] = '
<div style="clear:both;"><span style="width:55px;display:inline-block !important; display:inline; zoom:1;vertical-align:middle;">'.preg_replace('/<del id="read_mark".+$/i', '', $row['area_mark']).'</span><a href="?mode='.$GLOBALS['this_mode'].'&area_id='.$row['area_id'].'" style=" white-space: normal;">'.$row['area_name'].'</a></div>';
        unset($row);
      }
    }
    @mysql_free_result($result);
    @uksort($arr_area_child, 'strnatcmp');
    $childs = @implode('', $arr_area_child);

    }
  } else {
    $GLOBALS['this_mode'] = $web['sitemode'];
    $column = '未指定正确的模板！显示系统所有模板下的版区分类';
    $title1 = '';
    $result = @mysql_query('SELECT * FROM '.$sql['pref'].''.$sql['data']['承载版区分类的表名'].' WHERE area_id REGEXP "^[0-9]+\-[0-9]+$"', $db);
    if (@mysql_num_rows($result) > 0) {
      while ($row = @mysql_fetch_assoc($result)) {
        list($li_title_mode, ) = @explode('|', $row['area_index']);
        $arr_area_child[$row['area_id']] = '
<div style="clear:both;"><span style="width:60px;display:inline-block !important; display:inline; zoom:1;vertical-align:middle;">'.preg_replace('/<del id="read_mark".+$/i', '', $row['area_mark']).'</span><a href="?mode='.get_li_mode($row['area_index']).'&area_id='.$row['area_id'].'" title="所属：'.(@file_get_contents('inc/css/'.$li_title_mode.'/title2.txt')).'">'.$row['area_name'].'</a></div>';
        unset($row);
      }
    }
    @mysql_free_result($result);
    @uksort($arr_area_child, 'strnatcmp');
    $childs = @implode('', $arr_area_child);


  }

  if (POWER >= 1) {
    if (is_numeric($web['reg_to_send']) && $web['reg_to_send'] > 0) {
      $date_diff = ',TIMESTAMPDIFF(SECOND,regdate,DATE_ADD(UTC_TIMESTAMP(), INTERVAL '.floatval($web['time_pos']).' HOUR)) AS t_diff';
      $date_eval = '
      if ($row_member["t_diff"] < $web["reg_to_send"]) {
        $err_ .= "系统设定：新注册成员".$web["reg_to_send"]."秒（".round($web["reg_to_send"] / 3600, 2)."小时）之后才能发表。你还要等".round(($web["reg_to_send"] - $row_member["t_diff"])/ 3600, 2)."小时";
      }';
    }
    if ($web['send_face'] == 1) {
      if (!(@mysql_num_rows(@mysql_query('SELECT id FROM `'.$sql['pref'].''.$sql['data']['承载上传数据的表名'].'` WHERE title LIKE "face-'.$session[0].'.%"', $db)) > 0)) {
        $err_ .= '提交被拒绝！注册成员必须<a href="member.php" target="_blank">上传</a>了头像才允许发表。';
      }
    }

    $result = @mysql_query('SELECT power,point,check_reg'.$date_diff.' FROM '.$sql['pref'].''.$sql['data']['承载成员档案的表名'].' WHERE username="'.$session[0].'"', $db);
    $row_member = @mysql_fetch_assoc($result);
    @mysql_free_result($result);
    if (!(is_array($row_member) && count($row_member) > 0)) {
      $err_ .= '查无您的档案！您不是合法的注册成员。';
    } else {
      eval($date_eval);
      if ($row_member['check_reg'] == '1') {
        $err_ .= '您的注册尚在审核中！无法发表';
      } elseif ($row_member['check_reg'] == '2') {
        $err_ .= '您的帐户已被管理员移除至<a href="list_member.php?act=punished" target="_blank">黑名单</a>。';
      } else {
        if (POWER == 1 && $row_member['point'] < floatval($area_power['area_power_write'])) {
          $err_ .= '系统设置该分类发表需要成员积分达到'.$area_power['area_power_write'].'';
        } else {
          //求和信誉值
          $result = @mysql_query('SELECT SUM(money) AS total FROM '.$sql['pref'].''.$sql['data']['承载财务数据的表名'].' WHERE username="'.$session[0].'" AND type="1"', $db);
          $row = @mysql_fetch_assoc($result);
          $total_credit = floatval($row['total']);
          unset($row);
          @mysql_free_result($result);
          //求和货币值
          $result = @mysql_query('SELECT SUM(money) AS total FROM '.$sql['pref'].''.$sql['data']['承载财务数据的表名'].' WHERE username="'.$session[0].'" AND type="0"', $db);
          $row = @mysql_fetch_assoc($result);
          $total_funds = floatval($row['total']);
          unset($row);
          @mysql_free_result($result);

        }
      }
    }
  } else {
    if (!empty($area_power['area_power_write'])) {
      $err_ .= '系统设置该分类不允许过客发表';
    }
  }


} else {
  $err .= $sql['db_err'];
}
echo $title = '发布信息', $web['code_author'];

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

$sql['sql_version'] = @mysql_get_server_info();
@mysql_close();


?>
</title>
<link id="my_style" rel="stylesheet" type="text/css" href="inc/css/<?php echo $GLOBALS['this_mode']; ?>/style.css">
<script language="javascript" type="text/javascript" src="inc/js/main.js"></script>
</head>
<body>
<div id="session" class="session">
<?php @ include ('inc/require/head.txt'); ?></div>
<?php
if ($web['siteclose'] > 1) {
  @include ('inc/require/siteclose_why.txt');
}
?>
<div id="logo"><a href="<?php echo $web['path']; ?>"><img src="<?php echo $web['sitelogo']; ?>" /></a></div>
<div id="banner"> <a href="./">首页</a> <a class="column_is">现在发表</a> <a href="list_company.php">商号</a> <a href="list_member.php">成员</a> <a href="list_online.php">在线</a> <a href="help.php">帮助</a>
    <?php @include ('inc/css/'.$web['sitemode'].'/banner.txt'); ?>
</div>
<div class="column"><h5><a href="./">首页</a> &gt; 我要发布 &gt; 选择类目 &gt; <?php echo $column; ?></h5></div>
<table width="100%" height="400" border="0" cellspacing="0" cellpadding="0" id="menu">
  <tr>
    <td valign="top" id="leftmenu" class="leftmenu">
<?php
echo $err ? $err : '<h5>'.$title1.'</h5>';
?>
<div class="column_in">
<?php
echo $childs;
?>
</div>
    </td>
    <td valign="top" class="rightmenu">
        <?php @include ('inc/require/siteannounce.txt'); ?>
        <?php
if (isset($sql['sql_version']) && $sql['sql_version'] < '5.0') {
  echo '<div class="red_err">服务器数据库版本（'.$sql['sql_version'].'）太低！数据可能显示不正常。本程序建设基于MySQL版本5.0以上</div>';
}

if (isset($yes) && $yes == true) {
?>
        <div id="ok_edit" style="position:relative; z-index:78;">
          <?php

  if (!empty($err_)) {
    echo '<div id="submit_safe" class="filter" style="position:absolute !important;"><table width="100%" height="100%"><tr><td><div id="submit_safe_in">'.$err_.'</div></td></tr></table></div>';
  } else {
    if ($web['send_mx'] == 1) {
      require ('inc/function/send_mx.php');
      if ($send_mx = send_mx(@ $row_member['point'], $total_credit)) {
        echo '<div style="text-align:center;padding:2px;line-height:normal;background-color:#FFCC00;">提示：当前您的身份为'.(POWER <= 0.5 ? '（'.(POWER==0.5?'第三方登录未绑定的用户':'过客').'）' : '').'每日最大发布限量为 '.$send_mx.' 条'.(POWER == 0 ? '，且发表后不能修改。' : '').'</div>';
		/*
		if (POWER == 0.5) {
		  require('login_key/'.$session[6].'/info.php');
		}
		*/
      }
    }
  }

?>
          <iframe id="lastFrame" name="lastFrame" frameborder="0" style="display:none"></iframe>
          <script language="JavaScript" type="text/javascript">
<!--
function previewContents(){
  try{
    document.mainform162100.action='inc/require/z_other_getpreview.php';
    document.mainform162100.target='lastFrame';
    runSubmit();
  }catch(err){
    alert('预览失败！请稍候再试或放弃。');
  }
}

function runReward(obj) {
  var power = <?php echo POWER; ?>;
  var funds = <?php echo $total_funds; ?>;
  var text = '';
  if (power < 4) {
    if (funds > 0) {
      text = '对此文悬赏 <input name="reward" id="reward" type="text" size="5" onkeyup="isDigit(this,1,1,\'.\')" onblur="chkReward(this)" /> 货币值<span class="grayword">（你货币值余额为'+funds+'）</span>';
    } else {
      text = '你货币值余额为0，无法悬赏<span class="grayword">（<a href="member.php?get=myfunds" target="_blank">充值</a>）</span>';
    }
  } else {
    text = '对此文悬赏 <input name="reward" id="reward" type="text" size="5" onkeyup="isDigit(this,1,1,\'.\')" onblur="chkReward(this)" /> 货币值';
  }
  obj.parentNode.innerHTML = '&nbsp;'+text+'&nbsp;<a href="javascript:void(0)" onclick="runRewardClose(this)" style=" text-decoration:none;">╳</a>&nbsp;';
}
function runRewardClose(obj) {
  obj.parentNode.innerHTML='<img src="inc/images/coin.gif" onclick="runReward(this);" style="cursor:pointer;margin:5px;" title="设置悬赏分，进行悬赏" />';
}
function chkReward(obj) {
  var power = <?php echo POWER; ?>;
  var funds = <?php echo $total_funds; ?>;
  if (power < 4) {
    if (parseFloat(obj.value) > funds) {
      alert('超过余额！你最多只能悬赏'+funds+'货币值');
      obj.value = funds;
    }
  }
}
-->
  </script>
          <script language="JavaScript" type="text/javascript">
<!--
var uploadPower = <?php echo @ $row_member['point'] >= $web['up_start'] || POWER >= 4 ? '"yes"' : $web['up_start']; ?>;
var liMaxCount = <?php echo @ $web['list_wordcount']; ?>;
var eXSize = 588;       //编辑器宽度，最小宽度限588px
var formU='member.php?post=write';
var formT='<input type="hidden" name="m" id="m" value="1" /><input type="hidden" name="mode" id="mode" value="<?php echo $GLOBALS['this_mode']; ?>" /><input type="hidden" name="area_id" id="area_id" value="<?php echo $_GET['area_id']; ?>" /><u><b id="a_subject"><span class="redword">*</span> 题　目：</b></u><br /><table border="0" cellspacing="0" cellpadding="0"><tr><td width="348"><input class="large" name="subject" id="subject" type="text" style="width:330px" maxlength="180" /></td><td><div style="float:left;font-size:13px;background-color:#F2F2F2;height:26px;line-height:24px;border:#DDDDDD 1px solid;overflow:hidden;"><img src="inc/images/coin.gif" onclick="runReward(this);" style="cursor:pointer;margin:5px;" title="设置悬赏分，进行悬赏" /></div></td></tr></table><br /><u><b><span class="redword">*</span> 关键词：</b></u><br /><input name="keyword" id="keyword" type="text" class="large subject_keyword" onfocus="this.className=\'large\';" onblur="if(this.value==\'\'){this.className=\'large subject_keyword\';}else{this.className=\'large\';}" style="width:330px" maxlength="180" /><br /><br /><?php echo @$imcode; ?><u><b id="a_content"><span class="redword">*</span> 内　容：</b></u><br />';
document.write('<'+'sc'+'ript language="javascript" src="inc/js/editor.js?'+new Date().getTime()+'" type="text/javascript"></'+'sc'+'ript>');
-->
  </script>
          <br />
          [ <a href="#" onclick="previewContents();return false;">点此预览文章，以保证没有禁用词，以便审核顺利通过。</a>提示：禁用词表现为：<span title="此处词汇被过滤" style="BACKGROUND-COLOR: #cc9999"> !!!!! </span> ]

</div>
      <?php
} else {
  echo '<div class="output">&lt;&lt; 请在左侧点选符合您发表意向的栏目。[阅读<a href="help.php#write_1" target="_blank">发表帮助</a>]</div>';
}
?>
        <!-- /maintext -->
    </td>
  </tr>
</table>
<script language="JavaScript" type="text/javascript">
<!--
if ($('submit_safe') != null) {
  try{
    $('submit_safe').style.height = ($('ok_edit').offsetHeight)+'px'; //300是padding-top
  } catch(err) {}
}
-->
  </script>
<div id="foot">
  <?php @include ('inc/css/'.$GLOBALS['this_mode'].'/foot.txt'); ?>
</div>

</body>
</html>