<?php



/* 管理员控制台 */

/*
* 程序名称：162100网址导航3号
* 作者：162100.com
* 邮箱：162100.com@163.com
* 网址：http://www.162100.com，http://www.2dh.cn
* ＱＱ：184830962
* 声明：禁止侵犯版权或程序转发的行为，否则我方将追究法律责任
*/

@ require ('writable/set/set.php');
@ require ('writable/set/set_sql.php');




$post = !empty($_POST['post']) ? $_POST['post'] : (!empty($_GET['post']) ? $_GET['post'] : false);
$post = preg_replace('/[\.\/]+/', '', $post);
if (!empty($post)) {
  @ require ('readonly/function/reset_indexhtml.php');

  //输出信息
  function alert($text = '', $href) {
    global $web;
    echo '
    <div class="output"><p><img src="readonly/images/ok.gif" /> '.$text.'</p>
        <p>或点击以下链接进入...<a href="'.$href.'">'.$href.'</a></p></div>
    </td>
  </tr>
</table>
<style type="text/css">
<!--
#transition { /*background:#FFFFFF;*/ }
-->
</style>
<script language="javascript" type="text/javascript">
<!--
setTimeout("location.href=\''.$href.'\';", 5000);
-->
</script>
</body>
</html>';
    die;
  }

  //输出错误
  function err($text = '', $src = 'i') {
    global $web;
    echo '
    <div class="output"><p><img src="readonly/images/'.$src.'.gif" /> '.$text.'</p>
    <p>点此可<a href="javascript:window.history.back();">返回</a></p></div>
    </td>
  </tr>
</table>
<style type="text/css">
<!--
#transition { /*background:#FFFFFF;*/ }
-->
</style>
</body>
</html>';
    die;
  }

  echo '<!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>程序执行</title>
<link href="writable/css/'.$web['cssfile'].'/style.css" rel="stylesheet" type="text/css" id="my_style">
<style type="text/css">
<!--
html { width:100%; height:100%; text-align:center; background:none; border:none;  padding:0; }
body { width:720px; height:100%; margin:0 auto; padding:0; border-top:none; margin-top:0; background:url(readonly/images/loading.gif) 50% 50% no-repeat; border:none; }
#transition { text-align:center; margin:auto; }
.wherego { margin:10px auto; background-color:#FFFFFF; }
.wherego td { width:50%; font-size:12px; word-wrap:break-word; word-break:break-all; }
.wherego td.whereyou { text-align:right; }
-->
</style>
<script type="text/javascript" language="javaScript" src="readonly/js/main.js"></script>
</head>
<body>';

  //echo str_repeat(' ', 4096);
  //@ob_flush();
  //@flush();

  echo '
<table id="transition" width="720" height="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td>';
  if ($post != false && file_exists('readonly/run/post_'.$post.'.php')) {
    @ require ('readonly/run/post_'.$post.'.php');
  } else {
    err('命令错误或功能尚未开通！');
  }
  echo '
<style type="text/css">
<!--
#transition { /*background:#FFFFFF;*/ }
-->
</style>
    </td>
  </tr>
</table>
</body>
</html>';


  //echo str_repeat(' ', 4096);
  //@ob_flush();
  //@flush();

  die;
}


























$web['pagesize'] = 30; //页码数
$arr_page = array(10, 20, 30, 50, 100);
if (isset($_GET['pn'])) {
  $_GET['pn'] = abs($_GET['pn']);
  if (in_array($_GET['pn'], $arr_page)) {
    $web['pagesize'] = $_GET['pn']; //分页记录数
  }
}

$power_url = array(
  'upgrade'         => '在线升级',
  'chadu'           => '查木马',
  'set'             => '基本参数管理',
  'sql'             => '数据库参数管理',
  'area'            => '栏目分类管理',
  'mail'            => '邮箱参数',
  'logo'            => '上传图片（LOGO）',
  'style'           => '自助创建风格',
  'http'            => '网址管理',
  'search'          => '编辑搜索引擎',
  'search_hot'      => '搜索框下关键字广告',
  'modify'          => '在线修改文件',
  'foot'            => '编辑页脚',
  'newsite'         => '网址收录审核',
  'modify'          => '在线修改文件',
  'manager_html_open'            => '一键生成全站静态',
  'manager_access_del'           => '一键清除过期天气数据',
  'manager_browse_boin'          => '建立客户端脱机缓存',
  'manager_browse_reload'        => '强制客户端刷新缓存',
  'member'                       => '成员管理',
  'member_check_reg'             => '用户注册审批及违规成员',
  'member_funds'                 => '用户收支',
  'member_bulk_mail'             => '群发邮件',
);

if (@ $_GET['get'] == 'sql') {
  header('Cache-Control:no-cache,must-revalidate');
  header('Pragma:no-cache');
}

?><!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

if (@ array_key_exists($_GET['get'], $power_url)) {
  echo ' - '.$power_url[$_GET['get']];
  $nav = '<a href="webmaster_central.php">管理员控制台</a><a id="top_title_is">'.$power_url[$_GET['get']].'</a>';

} else {
  $_GET['get'] = 'door';
  $nav = '<a id="top_title_is">管理员控制台</a>';
}

echo ' - '.$web['sitename2'], $web['code_author'];
?></title>
<link href="writable/css/<?php echo $web['cssfile']; ?>/style.css" rel="stylesheet" type="text/css" id="my_style">
<style type="text/css">
<!--
#ad_table { background-color:#D8D8D8; }
#ad_table th { background-color:#EEEEEE; text-align:center; }
#ad_table td { background-color:#FFFFFF; text-align:left; }
#ad_table th, #ad_table td { padding:5px 10px; font-size:12px; line-height:normal; word-wrap:break-word; word-break:break-all; }

h5 { margin:0; margin-bottom:10px; }
h5 a { padding:2px 6px; text-align:center; text-decoration:none; }
h5 a.list_title_in { background-color:#FF9966; color:#FFFFFF; border-radius:3px; -moz-border-radius:3px; -webkit-border-radius:3px; }
.note { margin-bottom:10px; padding:3px 6px; font-size:12px; border:1px #EEEEEE solid; overflow:hidden; clear:both; }

.menu_title { color:#057BD2; }
-->
</style>
<script type="text/javascript" language="javaScript" src="readonly/js/main.js"></script>
<script language="javascript" type="text/javascript">
<!--
// 只允许输入数字
function isDigit(obj, starVal, s, t) { //s：0要求大于0，1不必大于0；t：小数点代表货币型数字
  var ye = false;
  var d = r1 = r2 = '';
  if (typeof(s) != 'undefined') {
    if (s == 0) {
    } else {
      ye = true;
      if (obj.value == '0' || obj.value == '') {
        obj.value = '0';
        return;
      }
    }
  }
  if (ye == false) {
    d = '大于0的';
    r1 = ' || obj.value <= 0';
    r2 = '\-?';
  }

  if (typeof(t) != 'undefined' && t == '.') {
    var t = 'isNaN(obj.value)'+r1;
    var b = ''+d+'货币类型数值';
  } else {
    var t = '!/^'+r2+'([1-9]|[1-9][0-9]+)$/.test(obj.value)';
    var b = ''+d+'整数';
  }
  if (eval(t)) {
    alert('你输入的值不对，只允许输入'+b+'！');
    obj.value = starVal;
    obj.focus();
  }
}

function allChoose(o, v1, v2) {
  var a = document.getElementsByName(o);
    for (var i = 0; i < a.length; i++){
      if (a[i].checked == false) a[i].checked = v1;
      else a[i].checked = v2;
  }
}

function get_checkbox(id) {
  var article = 0;
  var allCheckBox = document.getElementsByName(id);
  if (allCheckBox != null && allCheckBox.length > 0) {
    for (var i = 0; i < allCheckBox.length; i++) {
      if (allCheckBox[i].checked == true && allCheckBox[i].disabled == false) {
        article++;
        //break;
      }
    }
  }
  return article;
}

function chk(form, input, manageType) {
  if (get_checkbox('id[]') == 0) {
    alert('数据为空或尚未点选！');
    return false;
  }
  if (confirm('确定'+input.innerHTML+'吗？')) {
    form.limit.value = manageType;
    addSubmitSafe();
    form.submit();
  }
  return false;
}

-->
</script>
</head>
<body>
<?php @ include ('readonly/require/head.php'); ?>
<div id="top_title"><a href="./">首页</a><?php echo $nav; ?></div>


    <?php
@ require ('readonly/function/confirm_power.php');
define('POWER', confirm_power());
/*
if (POWER > 0) {
  echo '欢迎您：<img src="readonly/images/'.($session[4] ? $session[4] : '162100').'.png" width="16" height="16" /> <b>'.$session[0].'</b>'.($session[0] == $web['manager'] ? ' <a href="webmaster_central.php" title="管理员，点击进入管理后台"><img id="manager" src="readonly/images/manager.gif" alt="管理员，点击进入管理后台"></a>' : '').' | <a href="member.php">用户中心</a> | <a href="?post=login&act=logout" target="_self">退出</a> | 上次登陆'.$session[1].'';
} else {
  echo '欢迎您！<b>访客</b>。您可以 <a href="login_current.php" class="redword" target="_self">登陆帐号</a> | <a href="reg_current.php" class="redword" target="_self">注册</a>';
}
*/

if (POWER == 5) {
  echo '<div class="output">欢迎您：<a href="webmaster_central.php" title="管理员，点击进入管理后台">管理员<img id="manager" src="readonly/images/manager.gif" alt="管理员，点击进入管理后台"></a> | 上次登陆'.$session[1].'</div>';
}
echo @ $GLOBALS['session_err'];


?>


<div class="body">
  <table width="100%" border="0" cellspacing="10" cellpadding="0" class="menu">
    <tr valign="top">
<?php
if (POWER == 5) :

function get_en_url($d) {
  //$arr = @explode('/', $d);
  //$arr = array_map('urlencode', $arr);
  //return @implode('%2F', $arr);
  return urlencode(base64_encode($d));
}

?>
      <td class="menu_left" valign="top">
          <div class="menu_title">在线升级</div>
          <ul>
            <li><a id="bar-upgrade" href="?get=upgrade">在线升级</a></li>
          </ul>
          <div class="menu_title">系统设置</div>
          <ul>
            <li><a id="bar-set" href="?get=set">基本参数管理</a></li>
            <li><a id="bar-sql" href="?get=sql">数据库管理</a></li>
            <li><a id="bar-mail" href="?get=mail">邮箱参数</a></li>
            <li><a id="bar-logo" href="?get=logo">上载LOGO</a></li>
          </ul>
          <div class="menu_title">网址管理</div>
          <ul>
            <li><a id="bar-area" href="?get=area">频道、栏目管理</a></li>
            <li><a id="bar-http" href="?get=http" title="包含首页邮箱登陆、团购频道等">分类、网址管理</a></li>
            <li><a id="bar-http_homepage_0" href="?get=http&column_id=homepage&class_id=0">首页名站导航</a></li>
            <li><a id="bar-http_homepage_4" href="?get=http&column_id=homepage&class_id=4">首页友情链接</a></li>
          </ul>
          <div class="menu_title">系统功能</div>
          <ul>
            <li><a id="bar-writable/require/about.txt" href="?get=modify&otherfile=<?php echo get_en_url('writable/require/about.txt'); ?>">编辑关于我们</a></li>
            <li><a id="bar-style" href="?get=style">自助创建风格</a></li>
            <li><a id="bar-search" href="?get=search">自助搜索引擎</a></li>
            <li><a href="?post=manager_chadu">查木马</a></li>
            <li><a id="bar-writable/require/badword.txt" href="?get=modify&otherfile=<?php echo get_en_url('writable/require/badword.txt'); ?>">设置过滤词汇</a></li>
          </ul>
        <div class="menu_title">编辑广告</div>
        <ul>
          <li><a id="bar-writable/ad/ad_top.js" href="?get=modify&otherfile=<?php echo get_en_url('writable/ad/ad_top.js'); ?>">首页头部广告</a></li>
          <li><a id="bar-writable/ad/ad_central.js" href="?get=modify&otherfile=<?php echo get_en_url('writable/ad/ad_central.js'); ?>">首页腰部广告</a></li>
          <li><a id="bar-writable/ad/ad_side.js" href="?get=modify&otherfile=<?php echo get_en_url('writable/ad/ad_side.js'); ?>">首页边部广告</a></li>
          <li><a id="bar-writable/ad/ad_bottom_index.js" href="?get=modify&otherfile=<?php echo get_en_url('writable/ad/ad_bottom_index.js'); ?>">首页底部广告</a></li>
          <li><a id="bar-writable/ad/ad_bottom.js" href="?get=modify&otherfile=<?php echo get_en_url('writable/ad/ad_bottom.js'); ?>">页面底部广告</a></li>
          <li><a id="bar-search_hot" href="?get=search_hot">搜索框下（旁）广告</a></li>
          </li>
        </ul>
        <div class="menu_title">编辑页脚[代码]</div>
        <ul>
          <li><a id="bar-foot_index" href="?get=foot&act=foot_index">首页页脚</a></li>
          <li><a id="bar-foot" href="?get=foot&act=foot">公用页脚</a></li>
          <li><a id="bar-writable/require/icp.txt" href="?get=modify&otherfile=<?php echo get_en_url('writable/require/icp.txt'); ?>">ICP备案号</a></li>
          <li title="可将淘宝客或掘金链代码加入此处"><a id="bar-writable/require/statistics.txt" href="?get=modify&otherfile=<?php echo get_en_url('writable/require/statistics.txt'); ?>">加入统计代码</a><br />
          </li>
        </ul>
        <div class="menu_title">网址申录</div>
        <ul>
          <li><a id="bar-newsite" href="?get=newsite">网址收录审核(<span class="redword"><?php
$n_n = 0;
if ($n_arr = @file('writable/__temp__/newsite_list.txt')) {
  $n_n = count($n_arr);
}
echo $n_n;
unset($n_n, $n_arr);
?></span>)</a><br />
          </li>
        </ul>
        <div class="menu_title">静态生成</div>
        <ul>
          <li><a href="?post=manager_html_open" onclick="return confirm('确定生成全站静态么？该命令可能需要较长时间')">一键生成全静态</a>
            <?php

if (!isset($web['html'])) {
	  @ require ('writable/set/set_html.php');
}
if ($web['html'] == true) {
  echo '(<span class="redword">已生成</span>)<br />';
  echo '<li><a href="?post=manager_html_close" onclick="return confirm(\'确定关闭静态么？\')"><span class="redword">关闭静态</span></a></li>';
}


?>
          </li>
        </ul>
        <div class="menu_title">天气预报数据</div>
        <ul>
          <li><a href="readonly/run/get_manager_access.php" target="_blank">天气今日城市</a>(<?php

if($arr=@glob('writable/__temp__/weather_*.txt')){
    $d_ = gmdate('Ymd', time() + floatval($web['time_pos']) * 3600);
    $arrw =array();
    foreach($arr as $v){
      if(gmdate('Ymd',filemtime($v) + floatval($web['time_pos']) * 3600)==$d_){
	    $a = preg_replace('/(%\w{2})2?$/iU', '$1', basename($v,'.txt'));
	    $a = substr($a, 8);
	    $arrw[$a] = urldecode($a).' - '.gmdate('Y/m/d H:i:s',filemtime($v) + floatval($web['time_pos']) * 3600);
	    unset($a);
	  } else {
	    @unlink($v);
	  }
    }
}
$n = count($arrw);
echo '<span class="redword">'.$n.'</span>';

?>)</li>
        </ul>
        <div class="menu_title">缓存技术</div>
        <ul>
          <li><a href="?post=manager_browse_boin">建立客户脱机缓存</a></li>
          <li><a href="?post=manager_browse_reload">刷新客户端缓存</a><br />
          </li>
        </ul>
        <div class="menu_title">用户管理</div>
        <ul>
          <li><a id="bar-member" href="?get=member">成员管理</a></li>
          <li><a id="bar-member_check_reg" href="?get=member_check_reg">注册审批及违规成员</a></li>
          <li><a id="bar-member_funds" href="?get=member_funds">用户收支</a></li>
          <li><a id="bar-member_bulk_mail" href="?get=member_bulk_mail">群发邮件</a><br />
          </li>
        </ul>
        <!--div class="menu_title">修改文件[代码]</div>
        <ul>
          <li><a id="bar-modify" href="?get=modify">在线修改文件</a></li>
          <li><a id="bar-.htaccess" href="?get=modify&otherfile=<?php echo get_en_url('.htaccess'); ?>">修改.htaccess</a> </li>
        </ul--></td>
      <td class="menu_right"><?php
  if (file_exists('readonly/run/get_manager_'.$_GET['get'].'.php')) {
    @ require ('readonly/run/get_manager_'.$_GET['get'].'.php');
    @ $_GET['otherfile'] = base64_decode($_GET['otherfile']);

    if ($_GET['get'] == 'modify') {
      $bar_id = !empty($_GET['otherfile']) ? $_GET['otherfile'] : 'modify';
    } elseif ($_GET['get'] == 'http') {
      if (@ $_GET['column_id'] == 'mingz') {
        if ((string)$_GET['class_id'] == '1') {
          $bar_id = 'http_mingz_1';
        } else {
          $bar_id = 'http';
        }
      } elseif (@ $_GET['column_id'] == 'homepage') {
        if ($_GET['class_id'] == 0 || (string)$_GET['class_id'] == '1' || $_GET['class_id'] == 4) {
          $bar_id = 'http_homepage_'.$_GET['class_id'].'';
        } else {
          $bar_id = 'http';
        }
      } else {
        $bar_id = 'http';
      }
    } elseif ($_GET['get'] == 'foot') {
      $bar_id = $_GET['act'];
    } else {
      $bar_id = $_GET['get'];
    }
    echo '<script> try { if ($("bar_id_") != null) { $("bar_id_").id = ""; } $("bar-'.$bar_id.'").parentNode.id = "bar_id_"; } catch (err) {} </script>';

  } else {
    echo '<img src="readonly/images/i.gif" /> 文件readonly/run/get_manager_'.$_GET['get'].'.php不见了！请检查。点此<a href="webmaster_central.php">回到管理员中心</a>。';
  }

?>

      </td>
<?php
else :
?>
<td><div class="output"><img src="readonly/images/i.gif" /> 请以基本管理员身份<a href="login.php">登陆</a>，以获得管理权限。</div>      </td>
<?php
endif;
?>
    </tr>
  </table>
</div>
<?php @ include ('writable/require/foot.php'); ?>

</body>
</html>