<!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>
<script language="javascript" type="text/javascript">
<!--
window.onload=function(){
  try{
    parent.document.getElementById('lastFrame').style.height=(document.body.offsetHeight)+'px';
  }catch(err){
  }
}

function comfirmChaTo(areaId){
  if(parent){
    parent.document.getElementById('to_id').value=areaId;
    //parent.document.getElementById('manageform').limit.value='chanto';
    parent.document.getElementById('manageform').action='webmaster_central.php?post=unity_run&dataname=listdata&limit=chanto';
    parent.document.getElementById('manageform').submit();
  }else{
    alert('执行失败！');
  }
}

function closeW(){
  if(parent){
    parent.document.getElementById('lastFrame').style.display='none';
    parent.document.getElementById('lastFrame').src='about:blank';
  }
}
-->
</script>

<style type="text/css">
<!--
body { background-color:#FFFFCC; margin:0; padding:10px; font-size:12px; border:5px #FF6600 solid; line-height:150%; }
#close { float:right; cursor:pointer; width:16px; height:16px; line-height:18px; overflow:hidden; border:1px #666666 solid; text-align:center; }
-->
</style></head>

<body>

<div><div id="close" onclick="closeW()">×</div>转移至栏目——</div>
<?php

$GLOBALS['WEATHER_DATA'] = '../../';
@ require ('../../inc/set/set.php');
@ require ('../../inc/set/set_sql.php');

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'];
  }
}


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'];
}

$mode_title2 = '';
$GLOBALS['this_mode'] = isset($GLOBALS['this_mode']) ? $GLOBALS['this_mode'] : '';
if ($GLOBALS['this_mode'] != '') {
  $eval_sql = ' AND area_index LIKE "%'.$GLOBALS['this_mode'].'%"';
  $eval_title_root = '<a href="z_other_chanto.php">更上一级</a> &gt; ';
  $mode_eval = '';
} else {
  $eval_sql = '';
  $eval_title_root = '';
  $mode_eval = '
$GLOBALS["this_mode"] = get_li_mode($row["area_index"]);
list($li_title_mode, ) = @explode("|", $row["area_index"]);
$mode_title2 = " title=\"所属：".@file_get_contents("../../inc/css/".$li_title_mode."/title2.txt")."\"";
';
}


if (db_conn()) {
  $arr_area_title = $arr_area_child = array();
  if (isset($_GET['area_id']) && preg_match('/^(\d+\-\d+)(\_\d+)*$/', $_GET['area_id'], $area_m)) {
unset($eval_title_root);
    $area_id_root = $area_m[1];
    $mark_child = '该标签仍可细分：';
    $base_title = $_GET['area_id'];
    $eval_title = 'area_id="'.$_GET['area_id'].'"';
    $area_title = '$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) {
      while ($row = @mysql_fetch_assoc($result)) {
        if (strstr('area'.$_GET['area_id'], 'area'.$row['area_id'])) {
          $arr_area_title[$row['area_id']] = ($_GET['area_id'] == $row['area_id']) ? $row['area_name'] : '<a href="?mode='.$GLOBALS['this_mode'].'&area_id='.$row['area_id'].'">'.$row['area_name'].'</a> ';
        } else {
          $arr_area_child[$row['area_id']] = '<a href="?mode='.$GLOBALS['this_mode'].'&area_id='.$row['area_id'].'">'.$row['area_name'].'</a> ';
        }
        unset($row);
      }
    }
    @mysql_free_result($result);  @uksort($arr_area_child, 'strnatcmp');
eval('$title1 = '.$area_title.';');

    if (empty($arr_area_title[$_GET['area_id']])) {
      die('&#26631;&#31614;&#38169;&#35823;&#65281;&#35831;&#20174;<a href="./">&#39318;&#39029;</a>&#37325;&#26032;&#24320;&#22987;');
    }

  } else {
    $mark_child = ''; //全部根类目
    $title1 = '分类';
    $result = @mysql_query('SELECT area_id,area_name,area_index FROM `'.$sql['pref'].''.$sql['data']['承载版区分类的表名'].'` WHERE area_id REGEXP "^[0-9]+\-[0-9]+$"'.$eval_sql.'', $db);
    if (@mysql_num_rows($result) > 0) {
      while ($row = @mysql_fetch_assoc($result)) {
        eval($mode_eval);
        $arr_area_child[$row['area_id']] = '<a href="?mode='.$GLOBALS['this_mode'].'&area_id='.$row['area_id'].'"'.@$mode_title2.'>'.$row['area_name'].'</a> ';
        unset($row, $mode_title2);
      }
    }
    @mysql_free_result($result);  @uksort($arr_area_child, 'strnatcmp');
  }

  echo '<b>'.@ $eval_title_root.'<a href="?mode='.$GLOBALS['this_mode'].'">全部栏目</a> &gt; '.$title1.'</b><br />';
  echo count($arr_area_child) > 0 ? '<span class="redword">'.$mark_child.'</span>'.@implode('', $arr_area_child).'' : '<br />
	<input type="button" value="转移至上述栏目？确定" onclick="comfirmChaTo(\''.$_GET['area_id'].'\')" />';
} else {
  echo $sql['db_err'];
}
@mysql_close();

?>
</body>
</html>
