<?php
if( !defined('ISDVBBS') ){
	header('HTTP/1.0 404 Not Found');
	exit;
}
print <<<EOT
		<!-- 页主体部分开始 -->
		<div class="magpage">
			<div class="LeftContainer">
EOT;
require printout('spacemanage.nav_left');
if (empty($s) OR $s <= 0) {
	$s = 1;
}
print <<<EOT
			</div>
			<div class="RightContainer">		
				<div class="magright">
					<div class="magmenu_right">
EOT;
if (1 == $s) {			//	文章/收藏/链接/音乐/交易/相册	管理
	ArticleUI();
} elseif (2 == $s) {	//	评论管理
	Page_UserInput_mPost();
} elseif (3 == $s) {	//	文件管理
	Page_UserFile();
} elseif (4 == $s) {	//	模板管理
	Page_SkinSetting();
} elseif (5 == $s) {	//	配置管理
	Page_UserSetting();
} elseif (6 == $s) {	//	频道及我的空间索引更新
} elseif (7 == $s) {	//	我的空间站点数据统计和更新
	spaceSiteUpdate_UI();
} elseif (8 == $s) {	//	申请今日之星
	applyTodayStar_UI();
}
print <<<EOT
					</div>
				</div>
			</div>
		 </div>
		<!-- 页主体部分结束 -->
EOT;

function ArticleUI()
{
	global $s, $t, $m, $skinpath, $lang, $keyword, $spaceUserCat, $_tpl_spaceUrl, $_tpl_spaceName, $bbstitle, $bbscontent;
	if( empty($t) ){
		$t = 1;
		$_sTypeID = 0;
	} else{
		$_sTypeID = $t - 1;
	}
	if (!isset($m) OR $m <= 0) {
		$m = 3;
	}
	$_tStr = $lang['tpl.navlink'][$t];
	$_tStr_1 = "?s=1&t={$t}";
	print <<<EOT
						<h1><img src="{$skinpath}images/icon_quote.gif" />{$_tStr}{$lang['tpl.str12']}  →  <a class="menu" href="{$_tStr_1}&m=1">{$lang['tpl.str13']}{$_tStr}</a>  |  <a class="menu" href="{$_tStr_1}&m=2">{$_tStr}{$lang['tpl.str14']}</a>  |  <a class="menu" href="{$_tStr_1}&m=3">{$_tStr}{$lang['tpl.str15']}</a></h1>
EOT;
	if (1 == $m) {	//	添加文章
		$_sType = $t - 1;
		$_arrTmp =& getspaceUserCat4($GLOBALS['spaceUserID'],$_sType);
		$_intUCatID = $_arrTmp['ucatid'];
		spacepostform(
			array(
				 'Action' => "?s={$s}&t={$t}&m={$m}&action=savepost"
				,'EditMode' => 'Default'
				,'Show_Upload' => 1
				,'IsTopic' => 1
				,'sType' => $_sType
				,'PostUserName' => $GLOBALS['spaceUserName']
				,'JoinTime' => TIME_NOW
        ,'Title' => $bbstitle
				,'Content' => $bbscontent
			)
		);
	} elseif (2 == $m) {	//	文章栏目管理
		$_arrspaceUserCat = false;
		$_tpl_uCatID = 0;
		$_tpl_uCatTitle = '';
		$_tpl_uCatNote = '';
		$_tpl_IsView = '';
		$_tpl_uType = '';
		if( is_numeric($GLOBALS['ucatid']) ){
			$_arrspaceUserCat =& getspaceUserCat3($GLOBALS['ucatid'],$_sTypeID,$GLOBALS['userid']);
			if( $_arrspaceUserCat !== false ){
				$_tpl_uCatID = $_arrspaceUserCat['ucatid'];
				$_tpl_uCatTitle = $_arrspaceUserCat['ucattitle'];
				$_tpl_uCatNote = $_arrspaceUserCat['ucatnote'];
				$_tpl_uType = $_arrspaceUserCat['utype'];
				if( $_arrspaceUserCat['isview'] == 1 ){
					$_tpl_IsView = ' checked ';
				}
			}
		}
		$_strSTypeSelected[$t-1] = ' selected ';
		print <<<EOT
						<div class="topic">
							{$_tStr}{$lang['tpl.str14']}
						</div>
						<div class="system_table">
							<form method="post" action="{$_tStr_1}&m=2&action=Save">
								<input type="hidden" value="{$_tpl_uCatID}" name="ucatid" />
								<h1><div>栏目类别：</div>
									<Select Name="stype" Size="1">
										<option value="0" {$_strSTypeSelected[0]}>{$lang['tpl.str42']}</option>
										<option value="1" {$_strSTypeSelected[1]}>{$lang['tpl.str43']}</option>
										<option value="2" {$_strSTypeSelected[2]}>{$lang['tpl.str44']}</option>
										<option value="3" {$_strSTypeSelected[3]}>{$lang['tpl.str45']}</option>
										<option value="4" {$_strSTypeSelected[4]}>{$lang['tpl.str46']}</option>
										<option value="5" {$_strSTypeSelected[5]}>{$lang['tpl.str46_1']}</option>
									</Select>
								</h1>
								<h1>
									<div>栏目名称：</div>
										<input type="text" name="ucattitle" value="{$_tpl_uCatTitle}"/>
										<input type="checkbox" class="chkbox" name="isview" value="1" {$_tpl_IsView}>
									是否开放
								</h1>
								<h1>
									<div>栏目说明：</div>
									<input type="text" name="ucatnote" value="{$_tpl_uCatNote}" />
									<input type="submit" name="submit" value="提交栏目设置">
								</h1>
							</form>
						</div>
						<div id="mainlist">
							<h1>
								<div class="Set3">栏目</div>
								<div class="Set5">说明</div>
								<div class="Set3">管理操作</div>
							</h1>
EOT;
		$_arrspaceUserCat2 =& getspaceUserCat4($GLOBALS['userid'],$_sTypeID);
		$lang['tpl.str54']=str_replace('{$_val["ucattitle"]}',$_val['ucattitle'],$lang['tpl.str54']);
		if( $_arrspaceUserCat2 !== false ){
			foreach( $_arrspaceUserCat2 as $_val ){
				$_val['ucatnote'] = substr($_val['ucatnote'],0,35);
				print <<<EOT
							<h2>
								<div class="Set3">{$_val['ucattitle']}</div>
								<div class="Set5">{$_val['ucatnote']}</div>
								<div class="Set3"><a href="{$_tStr_1}&m=2&ucatid={$_val['ucatid']}">{$lang['tpl.str34']}</a>&nbsp;&nbsp;<a href="#" onclick="alertreadme('{$lang['tpl.str54']}','{$_tStr_1}&m=2&action=del&ucatid={$_val['ucatid']}')">{$lang['tpl.str35']}</a></div>
							</h2>
EOT;
			}
		}
		print <<<EOT
						</div>
EOT;
	} elseif (3 == $m) {	//	文章信息管理
		$_arrspacePost =& getspacePost($GLOBALS['userid'],$GLOBALS['_sTypeID'],$keyword);
		print <<<EOT
						<script language="javascript" src="space/script/dv_main.js" type="text/javascript"></script>
						<div class="magtable">
							<h1><img src="{$skinpath}images/green_arrow.gif">{$_tStr}管理</h1>
							<h2>
								<form method="post" action="?s=1&t={$_sTypeID}&m=3" style="display: inline;">
									关键字： <input size="25" name="keyword" value="{$keyword}" class="INPUT3" />　
									<button name="loginsubmit" type="submit" value="true" style="width:60px">查 询</button>
								</form>
							</h2>
						</div>
						
						<form method="post" action="?s=1&t={$_sTypeID}&m=3&action=Del" style="display: inline;">
						<div class="magtable">
							<ul>
								<li>
									<span style="width:10%; background:#eeeeee;" class="magline">选项</span>
									<span style="width:40%; background:#eeeeee;" class="magline">标题</span>
									<span style="width:20%; background:#eeeeee;" class="magline">类别</span>
									<span style="width:19%; background:#eeeeee;" class="magline">时间</span>
									<span style="width:10%; background:#eeeeee;" class="magline2">操作</span>
								</li>
EOT;
		if (!empty($_arrspacePost['ResultSet']) AND is_array($_arrspacePost['ResultSet'])) {
			print <<<EOT
EOT;
			if( empty($objenc) ){
				$objenc =& DV_Encoding::GetEncoding($GLOBALS['charset']);
			}
			foreach ($_arrspacePost['ResultSet'] AS $dbinfo) {
				if( $objenc->StrLength($dbinfo['title']) > 24 ){
					$dbinfo['title'] = $objenc->SubString($dbinfo['title'],0,24).'...';
				}
				if ($dbinfo['catid'] <= 0){
					$_tpl_cat = $lang['tpl.str33'];
				} else{
					if (!empty($spaceUserCat['result_set']) AND is_array($spaceUserCat['result_set'])) {
						foreach( $spaceUserCat['result_set'] as $val ){
							if( $val['ucatid'] == $dbinfo['catid'] ){
								$_tpl_cat = $val['ucattitle'];
								break;
							}
						}
					}
				}
				$_tpl_PostDate = gmdate('Y-m-d', $dbinfo['jointime']+getUserTimeZoneOffset());
				print <<<EOT
								<li>
									<span style="width:10%; background:#f9f9f9;" class="magline">
									<input type="checkbox" value="{$dbinfo['rootid']}" name="topicid[]" class="chkbox" /></span>
									<span style="width:40%;" class="magline"><a href="{$_tpl_spaceUrl}{$_tpl_spaceName}.showtopic.{$dbinfo['rootid']}.html" target="_blank">{$dbinfo['title']}</a></span>
									<span style="width:20%; background:#f9f9f9;" class="magline">{$_tpl_cat}</span>
									<span style="width:19%;" class="magline">{$_tpl_PostDate}</span>
									<span style="width:10%; background:#f9f9f9;" class="magline2"><a href="spacepostings.php?user={$_tpl_spaceName}&action=edit&rootid={$dbinfo['rootid']}&postid={$dbinfo['postid']}">{$lang['tpl.str34']}</a> | <a href="?s=1&t={$_sTypeID}&m=3&action=Del&topicid[]={$dbinfo['rootid']}&itopic=0">{$lang['tpl.str35']}</a></span>
								</li>
EOT;
			}//end foreach
			print <<<EOT
EOT;
		} else {
			print <<<EOT
								<li>
									<span style="width:100%; background:#f9f9f9;" class="magline2">没有找到数据！</span>
								</li>
EOT;
		}
		print <<<EOT
							</ul>
						</div>
EOT;
		if (!empty($_arrspacePost['ResultSet']) AND is_array($_arrspacePost['ResultSet'])) {
			print <<<EOT
							<div class="magtable" style="background:#f6f6f6; padding:4px;">
								<input onclick="CheckAll(this.form);" type="checkbox" value="on" name="chkall" class="chkbox" />全选
								<input type="radio" class="radio" checked="checked" value="0" name="itopic" class="INPUT3" />删除
								<input type="radio" class="radio" value="1" name="itopic" class="INPUT3" />移动到
								<select size="1" name="ucatid">
									<option value="-1">请选择栏目</Option>
									<option value="0">未归类</Option>
EOT;
			$arrspaceusercat =& getspaceUserCat();
			if( $arrspaceusercat !== false ){
				foreach( $arrspaceusercat as $val ){
					$val['ucattitle'] = htmlspecialchars($val['ucattitle']);
					print <<<EOT
									<option value="{$val['ucatid']}">{$val['ucattitle']}</option>
EOT;
				}
			}
			$_tpl_PageSearch = "keyword=".urlencode($keyword)."&s=1&t={$_sTypeID}&m=3";
			print <<<EOT
								</select>
								<button name="loginsubmit" type="submit" value="true" style="width:80px" onclick="return confirm('确定执行选定的操作吗?');">执行操作</button>
							</div>
						</form>
						<script type="text/javascript" src="space/script/pagination.js"></script>
						<script type="text/javascript">						PageList('{$_arrspacePost['AbsolutePage']}',3,'{$_arrspacePost['PageSize']}','{$_arrspacePost['RecordCount']}','{$_tpl_PageSearch}',1);
						</script>
EOT;
		}
	}
}//end function ArticleUI

function Page_UserInput_mPost()	//	评论管理
{
	global $skinpath, $_tStr,$_tStr_1,$lang,$s,$t,$_sTypeID,$m,$keyword,$_tpl_skinPath,$_tpl_spaceName,$_tpl_spaceUrl,$objenc;
	$_arrspacePost =& getspacePost2($GLOBALS['userid'],$GLOBALS['keyword']);
	print <<<EOT
						<h1><img src="{$skinpath}images/icon_quote.gif" />{$lang['tpl.str55']}</h1>
						<script language="javascript" src="space/script/dv_main.js" type="text/javascript"></script>
						<div class="magtable">
							<h2>
								<form method="post" action="?s=2" style="display:inline;padding:10px;">
									关键字： <input size="25" name="keyword" value="{$GLOBALS['keyword']}" class="INPUT3" />　
									<button name="loginsubmit" type="submit" value="true" style="width:60px">查 询</button>
								</form>
							</h2>
						</div>
						<div class="magtable">
EOT;
	if ($_arrspacePost['ResultSet'] === false) {
		print <<<EOT
								<ul>
									<li>
										<span style="width:10%; background:#eeeeee;" class="magline">选项</span>
										<span style="width:40%; background:#eeeeee;" class="magline">内容</span>
										<span style="width:20%; background:#eeeeee;" class="magline">作者</span>
										<span style="width:19%; background:#eeeeee;" class="magline">时间</span>
										<span style="width:10%; background:#eeeeee;" class="magline2">操作</span>
									</li>
									<li>
										<span style="width:100%; background:#f9f9f9;" class="magline2">本栏目尚未添加信息！</span>
									</li>
								</ul>
EOT;
	} else {
		print <<<EOT
							<form method="post" action="?s=2&action=Del" style="display:inline;">
								<ul>
									<li>
										<span style="width:10%; background:#eeeeee;" class="magline">选项</span>
										<span style="width:40%; background:#eeeeee;" class="magline">内容</span>
										<span style="width:20%; background:#eeeeee;" class="magline">作者</span>
										<span style="width:19%; background:#eeeeee;" class="magline">时间</span>
										<span style="width:10%; background:#eeeeee;" class="magline2">操作</span>
									</li>
EOT;
		if( empty($objenc) ){
			$objenc =& DV_Encoding::GetEncoding($GLOBALS['charset']);
		}
		foreach ($_arrspacePost['ResultSet'] AS $val) {
			if( $val['title'].'' === '' ){
				$val['title'] =& $val['content'];
			}
			if( $objenc->StrLength($val['title']) > 24 ){
				$val['title'] =& $objenc->SubString($val['title'],0,24).'...';
			}
			$val['title'] = htmlspecialchars($val['title']);
			print <<<EOT
									<li>
										<span style="width:10%; background:#f9f9f9;" class="magline"><input type="checkbox" class="chkbox" name="topicid[]" value="{$val['postid']}" /></span>
										<span style="width:40%;" class="magline"><a href="{$_tpl_spaceUrl}{$_tpl_spaceName}.showtopic.{$val['rootid']}.{$val['postid']}.html" target="_blank">{$val['title']}</a></span>
										<span style="width:20%; background:#f9f9f9;" class="magline">{$val['username']}</span>
										<span style="width:19%;" class="magline">{$val['jointime']}</span>
										<span style="width:10%; background:#f9f9f9;" class="magline2"><a href="spacepostings.php?user={$_tpl_spaceName}&action=edit&rootid={$val['rootid']}&postid={$val['postid']}">{$lang['tpl.str34']}</a> | <a href="?s=2&action=Del&topicid={$val['postid']}&itopic=0">{$lang['tpl.str35']}</a></span>
									</li>
EOT;
		}
		$_tpl_PageSearch = urlencode("keyword={$GLOBALS['keyword']}&s=2");
		print <<<EOT
								</ul>
								<div class="magtable" style="background:#f6f6f6; padding:4px;">
									<input onclick="CheckAll(this.form);" type="checkbox" value="on" name="chkall" class="chkbox" />全选
									<input type="radio" class="radio" value="0" name="itopic" checked="checked"  />删除&nbsp;&nbsp;<button name="loginsubmit" type="submit" value="true" style="width:80px" onclick="return confirm('确定执行选定的操作吗?');">执行操作</button>
								</div>
							</form>
							<script type="text/javascript" src="space/script/pagination.js"></script>
							<script type="text/javascript">							PageList('{$_arrspacePost['AbsolutePage']}',3,'{$_arrspacePost['PageSize']}','{$_arrspacePost['RecordCount']}',"{$_tpl_PageSearch}",1);
							</script>
EOT;
	}
	print <<<EOT
						</div>
EOT;
}//end function Page_UserInput_mPost

function Page_UserFile()	// 文件管理
{
	global $spaceSystemUpSetting,$spaceSystemSetting,$s,$t,$m,$_tStr,$_tStr_1,$lang,$s,$t,$_sTypeID,$m,$keyword;
	global $skinpath,$_tpl_skinPath,$_tpl_spaceName,$_tpl_spaceUrl,$_objEnc;
	switch($m){
		case '1':
			$_mStr =$lang['tpl.str58'];
			break;
		case '2':
			$_mStr =$lang['tpl.str59'];
			break;
		case '3':
			$_mStr =$lang['tpl.str60'];
			break;
		case '4':
			$_mStr =$lang['tpl.str61'];
			break;
		case '5':
			$_mStr =$lang['tpl.str62'];
			break;
		default:
			$_mStr =$lang['tpl.str58'];
			break;
	}
	print <<<EOT
						<h1><img src="{$skinpath}images/icon_quote.gif" />{$lang['tpl.str63']}  →  <a class="menu" href="?s=3&m=1">{$lang['tpl.str64']}</a>  |  <a class="menu" href="?s=3&m=2">{$lang['tpl.str59']}</a>  |  <a class="menu" href="?s=3&m=3">{$lang['tpl.str60']}</a>  |  <a class="menu" href="?s=3&m=4">{$lang['tpl.str61']}</a>  |  <a class="menu" href="?s=3&m=5">{$lang['tpl.str62']}</a></h1>
						<script language="javascript" src="space/script/dv_main.js" type="text/javascript"></script>
						<div class="magtable">
							<h1><img src="{$skinpath}images/green_arrow.gif">{$_mStr}{$lang['tpl.str63']}</h1>
							<h2>
								<form method="post" action="?s=3" style="display: inline;">
									关键字： <input size="25" name="keyword" value="{$GLOBALS['keyword']}" class="INPUT3" />　
									<button name="loginsubmit" type="submit" value="true" style="width:60px">查 询</button>
								</form>
							</h2>
						</div>
EOT;
	$action = strtolower($GLOBALS['action']);
	if ('del' === $action) {
		return false;
	}
	$_arrspaceUpFile =& getspaceUpFile($GLOBALS['userid'],$GLOBALS['keyword']);
	if (empty($_arrspaceUpFile['ResultSet']) OR !is_array($_arrspaceUpFile['ResultSet'])) {
		print <<<EOT
							<div class="mytag_photo">
									<span style="width:100%; background:#f9f9f9;" class="magline2">本栏目尚未添加信息！</span>
							</div>
EOT;
		return;
	}
	global $fsetting, $spaceSystemUpSetting, $spaceuploadbasedir;
	$spaceuploadbasedir = basename($fsetting['forumuploadname']).'/'.basename($spaceSystemUpSetting[19]).'/';
	if( !is_numeric($spaceSystemSetting[9]) ){
		$spaceSystemSetting[9] = 3;
	}
	$_tpl_width = $spaceSystemUpSetting[14];
	$_tpl_height = $spaceSystemUpSetting[15];
	if( empty($objenc) ){
		$objenc =& DV_Encoding::GetEncoding($GLOBALS['charset']);
	}
	$_intTmp = $spaceSystemSetting[9];
	global $ModHtmlLinked,$spaceName;
	print <<<EOT
		<form method="post" action="?s=3&action=Del" style="display:inline;">
EOT;
	foreach( $_arrspaceUpFile['ResultSet'] as $_index => $_val ){
		if( $_index % $_intTmp == 0 ){
			if( $_index == 0 ){
				$_str_TR = '<div class="mytag_photo">';
			} else{
				$_str_TR = "</div>\r\n\t\t<div class=\"mytag_photo\">";
			}
		} else{
			$_str_TR = '';
		}
		$_tpl_ViewPhoto = $_val['previewimage'].'';
		if( $_tpl_ViewPhoto === '' ){
			$_tpl_ViewPhoto = $_val['filename'].'';
		}
		if( $_tpl_ViewPhoto !== '' ){
			$_tpl_ViewPhoto = $spaceuploadbasedir.$_tpl_ViewPhoto;
		} else{
			$_tpl_ViewPhoto = 'space/images/info.gif';
		}
		if( $_val['islock'] == 4 ){
			$_tpl_topic =$lang['tpl.str65'];
		} else{
			$_tpl_topic = $_val['title'].'';
			if( $_tpl_topic === '' ){
				if( !empty($_val['sfilename']) ){
					$_tpl_topic = $_val['sfilename'];
				} else{
					list(,,$_tpl_topic) = each(explode('/',$_val['filename']));
				}
			} else{
				if( $objenc->StrLength($_tpl_topic) > 150 ){
					$_tpl_topic = $objenc->SubString($_tpl_topic,0,150).'......';
				}
			}
			if( $_val['istopic'] == 0 ){
				$_tpl_topic = "<a href=\"{$ModHtmlLinked}{$_tpl_spaceName}.showtopic.{$_val['topicid']}.html\" target=\"_blank\">".htmlspecialchars($_tpl_topic)."</a>";
			} elseif( $_val['istopic'] == 1 ){
				$_tpl_topic = "<a href=\"{$ModHtmlLinked}{$_tpl_spaceName}.showtopic.{$_val['topicid']}.{$_val['postid']}.html\" target=\"_blank\">".htmlspecialchars($_tpl_topic)."</a>";
			} else{
				$_tpl_topic = htmlspecialchars($_tpl_topic);
			}
		}
		$currsize = $_val['filesize'];
		$units = 'B';
		if ($currsize > 1024) {
			$currsize = $currsize / 1024;
			$units = 'KB';
		}
		if ($currsize > 1024) {
			$currsize = $currsize / 1024;
			$units = 'MB';
		}
		$_val['dateandtime'] = gmdate('Y-m-d', $_val['dateandtime']+getUserTimeZoneOffset());
print <<<EOT
		{$_str_TR}
				<h1><div style="border:1px solid #fff;background:#fff;margin:auto;width:120px;height:120px;text-align:center;overflow:auto;"><a href="{$_tpl_ViewPhoto}"><img src="{$_tpl_ViewPhoto}" alt="" width="{$_tpl_width}px" height="{$_tpl_height}px" style="vertical-align: middle; "/></a></div><div class="name"><a href="{$_tpl_spaceUrl}{$GLOBALS['spaceName']}.showtopic.{$_val['topicid']}.html">{$_tpl_topic}</a>&nbsp;<input type="checkbox" class="chkbox" name="fileid[]" value="{$_val['id']}" />删除</font></div><div>时间：{$_val['dateandtime']}</div><div>大小：{$currsize}{$units}</div></h1>			
EOT;
	}
	$_tpl_PageSearch = "s=3";
print <<<EOT
		</div><br />
								<div class="magtable" style="background:#f6f6f6; padding:4px;">
									<input onclick="CheckAll(this.form);" type="checkbox" class="chkbox" value="on" name="chkall" />全选
									<input type="radio" class="radio" value="0" name="itopic" checked="checked" class="INPUT3" />删除&nbsp;&nbsp;<button name="loginsubmit" type="submit" value="true" style="width:80px" onclick="return confirm('确定执行选定的操作吗?');">执行操作</button>
								</div>
							</form>
							<div class1="tag_list">
								<script type="text/javascript" src="space/script/pagination.js"></script>
								<h3 style="width: 776px; height: 30px; padding:0px; margin: 0px auto;overflow: hidden;">
									<script type="text/javascript">
									<!--
										PageList('{$_arrspaceUpFile['AbsolutePage']}',3,'{$_arrspaceUpFile['PageSize']}','{$_arrspaceUpFile['RecordCount']}',"{$_tpl_PageSearch}",1);
									//-->
									</script>
								</h3>
							</div><br />
EOT;
}//end function Page_UserFile

function Page_SkinSetting()	//	风格模板列表
{
	global $spaceSystemUpSetting,$spaceSystemSetting,$s,$t,$m,$_tStr,$_tStr_1,$lang,$s,$t,$_sTypeID,$m,$keyword;
	global $_tpl_skinPath,$_tpl_spaceName,$_tpl_spaceUrl,$_objEnc,$spaceUserInfo;
	$_tpl_PageSearch = 's=4';
	print <<<EOT
						<script language="javascript" src="space/script/dv_main.js" type="text/javascript"></script>
<script language="javascript" src="space/script/dv_form.js" type="text/javascript"></script>
<div id="main" style="text-align:left;">
	<form method="post" action="?s=4&action=Saveskin" name="Skinsform">
		<table border="0" cellpadding="3" cellspacing="0" align="center" Style="width:98%">
			<tr><td><input type="submit" value="{$lang['tpl.str67']}"></td></tr>
		</table>
		<hr/>
		<table border="0" cellpadding="3" cellspacing="0" align="center" Style="width:98%">
			<tr>
EOT;
	$_arrspaceSkin =& getspaceSkin();
	if( $_arrspaceSkin['ResultSet'] === false ){
		print <<<EOT
	{$lang['spaceError.str26']}
EOT;
	} else{
		$crtskinid = $spaceUserInfo['skinid'];
		foreach( $_arrspaceSkin['ResultSet'] as $_index => $_val ){
			if( $_index != 0 && $_index % 3 == 0 ) {
				$_str_TR = "</tr>\r\n\t\t\t<tr>";
			} else{
				$_str_TR = '';
			}
			$_tpl_ViewLogo = $_val['s_viewpic'].'';
			if( $_tpl_ViewLogo === '' ){
				$_tpl_ViewLogo = 'space/images/viewskins.png';
			}
			if ($crtskinid == $_val['s_id']) {
				$checked = ' checked="checked" ';
			} else {
				$checked = '';
			}
			print <<<EOT
				<!--{$skin_list}-->
			{$_str_TR}
				<td align="center" width="25%">
				<img src="{$_tpl_ViewLogo}" alt="" border="0px" width="80px" height="60px"/><br/>
				{$_val['s_skinname']}
				<input type="radio" class="radio" name="skinid" value="{$_val['s_id']}" {$checked} />
				</td>
EOT;
		}
	print <<<EOT
			</tr>
		</table>
	</form>
	<script language="JavaScript" src="space/script/pagination.js"></script>
	<script language="JavaScript">
	PageList('{$_arrspaceSkin['AbsolutePage']}',3,'{$_arrspaceSkin['PageSize']}','{$_arrspaceSkin['RecordCount']}',"{$_tpl_PageSearch}",1);
	Dv_Form.Set_Radio("Skinid","{$spaceUserInfo['skinid']}");
	</script>
EOT;
	}
	print <<<EOT
</div>
EOT;
}//end function Page_SkinSetting

function Page_UserSetting()	//	配置管理
{
	global $skinpath,$lang,$s,$t,$m,$_tStr,$_tStr_1,$lang,$s,$t,$_sTypeID,$spaceUserInfo,$spaceSetting;
	print <<<EOT
						<h1><img src="{$skinpath}images/icon_quote.gif" />{$lang['tpl.str68']}  →  <a class="menu" href="?s=5&t=1">{$lang['tpl.str69']}</a>  |  <a class="menu" href="?s=5&t=2">{$lang['tpl.str70']}</a>  |  <a class="menu" href="?s=5&t=3">{$lang['tpl.str71']}</a>  |  <a class="menu" href="?s=5&t=4">{$lang['tpl.str72']}</a></h1>
EOT;
	switch ($t) {
		case '2':
			print <<<EOT
						<div class="topic">我的空间密码修改</div>
						<div class="system_table">
							<form method="post" action="?s=5&t=2&action=Save" style="display:inline;">
								<h1>&nbsp;&nbsp;&nbsp;&nbsp;说明：此处密码为您登录个人博客管理所需密码<br /><br /></h1>
								<h1>
									<div>我的空间密码：</div><input type="password" name="password" />
								</h1>
								<h1>
									<div>新的密码：</div><input type="password" name="npass" />
								</h1>
								<h1>
									<div>重复输入：</div><input type="password" name="rnpass" />&nbsp;&nbsp;<input type="submit" name="submit" value="修改密码">
								</h1>
							</form>
						</div>
EOT;
			break;
		case '3':
			for( $i = 0 ; $i < 50 ; $i++ ){
				${"_tpl_Setting".$i} = $spaceSetting[$i];
			}
			//print '<pre>'.print_r($spaceSetting, true).'</pre>';
			$chk_setting0_0 = '';
			$chk_setting0_1 = ' checked="checked" ';
			if (0 == $spaceSetting[0]) {
				$chk_setting0_0 = ' checked="checked" ';
				$chk_setting0_1 = '';
			}
			$chk_setting4_0 = '';
			$chk_setting4_1 = ' checked="checked" ';
			if (0 == $spaceSetting[4]) {
				$chk_setting4_0 = ' checked="checked" ';
				$chk_setting4_1 = '';
			}
			$chk_setting5_0 = '';
			$chk_setting5_1 = '';
			$chk_setting5_2 = ' checked="checked" ';
			if (0 == $spaceSetting[5]) {
				$chk_setting5_0 = ' checked="checked" ';
				$chk_setting5_1 = '';
				$chk_setting5_2 = '';
			} elseif (1 == $spaceSetting[5]) {
				$chk_setting5_0 = '';
				$chk_setting5_1 = ' checked="checked" ';
				$chk_setting5_2 = '';
			}
			$chk_setting14_0 = '';
			$chk_setting14_1 = ' checked="checked" ';
			if (0 == $spaceSetting[14]) {
				$chk_setting14_0 = ' checked="checked" ';
				$chk_setting14_1 = '';
			}
			print <<<EOT
						<script language="javascript" src="space/script/dv_form.js" type="text/javascript"></script>
						<script language="javascript" src="space/script/dv_main.js" type="text/javascript"></script>
						<div class="topic">我的空间站点设置</div>
						<div class="system_table">
							<form method="post" action="?s=5&t=3&action=Save" name="setting" style="display:inline;">
								<h1>
									<div>站点分类：</div>
									<select Name="syscatid" Size="1">
EOT;
			$_arrspaceSysCat =& getspaceSysCat();
			if( $_arrspaceSysCat !== false ){
				foreach( $_arrspaceSysCat as $_val ){
					$_strSelected = '';
					if( $spaceSetting['syscatid'] == $_val['scatid'] ){
						$_strSelected = ' selected ';
					}
					print <<<EOT
										<option value="{$_val['scatid']}" {$_strSelected}>{$_val['scattitle']}</option>
EOT;
				}
			}
			print <<<EOT
									</select>
								</h1>
								<h1>
									<div>是否允许他人访问：</div><input type="radio" class="radio" name="setting0" value="0" {$chk_setting0_0} /> 否 <input type="radio" class="radio" name="setting0" value="1" {$chk_setting0_1} /> 是
								</h1>
								<h1>
									<div>自动截取段落数：</div><input type="text" size="5" name="setting2" value="{$_tpl_Setting2}"/>字（当摘要内容为空时，自动按设置截取内容作为摘要）
								</h1>
								<h1>
									<div>显示最新评论数：</div><input type="text" size="5" name="setting3" value="{$_tpl_Setting3}"/>条
								</h1>
								<h1>
									<div>是否允许评论：</div><input type="radio" class="radio" name="setting4" value="0" {$chk_setting4_0} /> 否 <input type="radio" class="radio" name="setting4" value="1"  {$chk_setting4_1} /> 是
								</h1>
								<h1>
									<div>用户评论后返回页面：</div><input type="radio" class="radio" name="setting5" value="0" {$chk_setting5_0} /> 我的空间系统首页 <input type="radio" class="radio" name="setting5" value="1" {$chk_setting5_1} /> 我的空间首页 <input type="radio" class="radio" name="setting5" value="2" {$chk_setting5_2} />评论主题
								</h1>
								<h1>
									<div>首页显示文章数：</div><input type="text" size="5" name="setting6" value="{$_tpl_Setting6}"/>条
								</h1>
								<h1>
									<div>列表每页显示文章数：</div><input type="text" size="5" name="setting7" value="{$_tpl_Setting7}"/>条
								</h1>
								<h1>
									<div>文章每页显示评论数：</div><input type="text" size="5" name="setting8" value="{$_tpl_Setting8}"/>条
								</h1>
								<h1>
									<div>字体默认大小：</div><input type="text" size="5" name="setting9" value="{$_tpl_Setting9}"/> px
								</h1>
								<h1>
									<div>文字默认行间距：</div><input type="text" size="5" name="setting10" value="{$_tpl_Setting10}"/> px
								</h1>
								<h1>
									<div>文章显示脚印个数：</div><input type="text" size="5" name="setting11" value="{$_tpl_Setting11}"/> 个
								</h1>
								<h1>
									<div>脚印图片（男）：</div>
									<input type="text" size="20" name="setting12" value="{$_tpl_Setting12}" id="Setting12"/>
									<select onchange="Chang(this.value,'DiaryFootMart1','space/images/sex/','Setting12')">
										<option value="">{$lang['tpl.str104']}
										<option value="sex1.gif" >sex1.gif</option>
										<option value="sex2.gif" >sex2.gif</option>
										<option value="footmark1.gif" >footmark1.gif</option>
										<option value="footmark3.gif" >footmark3.gif</option>
										<option value="footmark5.gif" >footmark5.gif</option>
									</select>
									&nbsp;<img id=DiaryFootMart1 src="{$_tpl_Setting12}" border="0" alt="{$lang['tpl.str105']}">
								</h1>
								<h1>
									<div>脚印图片（女）：</div>
									<input type="text" size="20" name="setting13" value="{$_tpl_Setting13}" id="Setting13">
									<select onchange="Chang(this.value,'DiaryFootMart2','space/images/sex/','Setting13')">
										<option value="">{$lang['tpl.str104']}
										<option value="sex3.gif" >sex3.gif</option>
										<option value="sex4.gif" >sex4.gif</option>
										<option value="footmark2.gif" >footmark2.gif</option>
										<option value="footmark4.gif" >footmark4.gif</option>
										<option value="footmark6.gif" >footmark6.gif</option>
									</select>
									&nbsp;<img id="DiaryFootMart2" src="{$_tpl_Setting13}" border="0" alt="{$lang['tpl.str105']}">
								</h1>
								<h1>
									<div>博客交易功能：</div><input type="radio" class="radio" name="setting14" value="0" {$chk_setting14_0} /> 关闭 <input type="radio" class="radio" name="setting14" value="1" {$chk_setting14_1} /> 开放
								</h1>
								<h1>
									<div>交易模块链接文字：</div><input type="text" size="20" name="setting15" value="{$_tpl_Setting15}"/>* 如Dopod数码专卖
								</h1>
								<h1>
									<div>&nbsp;</div><input type="submit" name="submit" value="修改设置" />
								</h1>
							</form>
						</div>
						<script type="text/javascript">
						<!--
							Dv_Form.Set_Radio('Setting0','{$_tpl_Setting0}');
							Dv_Form.Set_Radio('Setting1','{$_tpl_Setting1}');
							Dv_Form.Set_Radio('Setting4','{$_tpl_Setting4}');
							Dv_Form.Set_Radio('Setting5','{$_tpl_Setting5}');
							Dv_Form.Set_Radio('Setting14','{$_tpl_Setting14}');
							function Chang(picurl,V,S,F)
							{
								var pic=S+picurl
								if (picurl!=''){
								document.getElementById(V).src=pic;
								setting[F].value=pic;
								}
							}
						//-->
						</script>
EOT;
			break;
		case '4':
			$_tpl_KeyID = 0;
			$_intKeyID = trim($GLOBALS['keyid']);
			$_tpl_NewWindows = ' checked ';
			if( $_intKeyID !== '' && is_numeric($_intKeyID) ){
				$_arrTmp =& getspaceKeyWord($_intKeyID);
				if( $_arrTmp !== false ){
					$_arrspaceKeyWord =& $_arrTmp[0];
					$_tpl_KeyID = $_arrspaceKeyWord['keyid'];
					$_tpl_KeyWord = $_arrspaceKeyWord['keyword'];
					$_tpl_nKeyWord = $_arrspaceKeyWord['nkeyword'];
					$_tpl_LinkUrl = $_arrspaceKeyWord['linkurl'];
					$_tpl_LinkTitle = $_arrspaceKeyWord['linktitle'];
					if( $_arrspaceKeyWord['newwindows'] == 1 ){
						$_tpl_NewWindows = ' checked="checked" ';
					} else{
						$_tpl_NewWindows = '';
					}
				}
			}
			print <<<EOT
						<div class="topic">关键字设置</div>
						<div class="system_table">
							<form method="post" action="?s=5&t=4&action=Save" style="display:inline;">
								<input type="hidden" value="{$_tpl_KeyID}" name="keyid" />
								&nbsp;&nbsp;&nbsp;&nbsp;说明：您博客中发表的文章或评论含有您所设置的关键字则会自动进行替换和加上链接，新增的关键字对之前发表的文章无效，您可编辑某篇文章以便其支持您最新设置的关键字<br /><br />
								<h1>
									<div>关  键 字：</div><input type="text" name="keyword" value="{$_tpl_KeyWord}" />
								</h1>
								<h1>
									<div>替换文本：</div><input type="text" name="nkeyword" value="{$_tpl_nKeyWord}" />
								</h1>
								<h1>
									<div>链接地址：</div>
									<input type="text" name="linkurl" value="{$_tpl_LinkUrl}"/>
									<input type="checkbox" class="chkbox" name="newwindows" value="1" {$_tpl_NewWindows}>新窗口打开
								</h1>
								<h1>
									<div>链接标题：</div>
									<input type="text" name="linktitle" value="{$_tpl_LinkTitle}"/>
									<input type="submit" name="submit" value="{$lang['tpl.str120']}">
								</h1>
							</form>
						</div>
						<div class="magtable">
							<ul>
								<li>
									<span style="width:10%; background:#eeeeee;" class="magline"><b>关键字</b></span>
									<span style="width:40%; background:#eeeeee;" class="magline"><b>替换文本</b></span>
									<span style="width:20%; background:#eeeeee;" class="magline"><b>链接地址</b></span>
									<span style="width:19%; background:#eeeeee;" class="magline"><b>管理操作</b></span>
									<span style="width:10%; background:#eeeeee;" class="magline2">&nbsp;</span>
								</li>
EOT;
			$_arrspaceKeyWord =& getspaceKeyWord2($GLOBALS['userid']);
			if (false !== $_arrspaceKeyWord){
				foreach( $_arrspaceKeyWord as $_val ){
					$_val['linktitle'] = htmlspecialchars($_val['linktitle']);
					$_strLinkUrl = substr($_val['linkurl'],0,25);
					$_strJSKeyWord = addslashes($_val['keyword']);
					print <<<EOT
								<li>
									<span style="width:10%; background:#f9f9f9;" class="magline">{$_val['keyword']}</span>
									<span style="width:40%;" class="magline">{$_val['nkeyword']}</span>
									<span style="width:20%; background:#f9f9f9;" class="magline"><a href="{$_val['linkurl']}" target="_blank" title="{$_val['linktitle']}">{$_strLinkUrl}</a></span>
									<span style="width:19%;" class="magline"><a href="?s=5&t=4&keyid={$_val['keyid']}">{$lang['tpl.str34']}</a>&nbsp;&nbsp;<a href="#" onclick="alertreadme('您确定删除关键字{$_strJSKeyWord}吗？','s=5&t=4&action=Del&keyid={$_val['keyid']}')">{$lang['tpl.str35']}</a></span>
								</li>
EOT;
				}
			} else {
				print <<<EOT
								<li>
									<span style="width:100%; background:#f9f9f9;" class="magline2">没有找到数据！</span>
								</li>
EOT;
			}
			print <<<EOT
							</ul>
						</div>
EOT;
			break;
		case '1':
		default:
			$_tpl_spaceName = htmlspecialchars($spaceUserInfo['spacename']);
			$_tpl_NickName = htmlspecialchars($spaceUserInfo['nickname']);
			$_tpl_spaceTitle = htmlspecialchars($spaceUserInfo['spacetitle']);
			$_tpl_spaceCTitle = htmlspecialchars($spaceUserInfo['spacechildtitle']);
			$_tpl_spaceNote = htmlspecialchars($spaceUserInfo['spacenote']);
			global $fsetting, $spaceSystemUpSetting;
			$_tpl_myphoto_path = (!empty($spaceUserInfo['myphoto_preview_path']) ? $spaceUserInfo['myphoto_preview_path'] : $spaceUserInfo['myphoto_path']);
			print <<<EOT
						<div class="topic">个人资料修改</div>
						<div class="system_table">
              <form name="form" method="post" action="?s=5&t=1&action=Save" style="display:inline;" enctype="multipart/form-data">
                <input type="hidden" name="MAX_FILE_SIZE" value="1000000">
								<h1>&nbsp;&nbsp;&nbsp;&nbsp;说明：更多详细资料修改请到 论坛用户资料修改<br /><br /></h1>
								<h1>
									<div>我的空间标识：</div>{$_tpl_spaceName}<span style="display: block !important; display: inline; height: 5px;" />
								</h1>
								<h1>
									<div>我的笔名：</div><input type="text" name="nickname" value="{$_tpl_NickName}" size="15" />
								</h1>
								<h1>
									<div>我的空间标题：</div><input type="text" name="spacetitle" value="{$_tpl_spaceTitle}" size="32" />
								</h1>
EOT;
			if (empty($_tpl_myphoto_path)) {
				print <<<EOT
								<h1>
                  <div>我的相片：</div>&nbsp;本地相片：<input type="file" name="myphoto_path" id="myphoto_path" /><br />&nbsp;相片说明：<input type="text" name="myphoto_desc" />
								</h1>
EOT;
			} else {
				$_tpl_myphoto_path = $fsetting['forumuploadname'].'/'.$spaceSystemUpSetting[19].'/'.$_tpl_myphoto_path;
				print <<<EOT
								<h1>
									<div>我的相片：</div>&nbsp;相片说明：<input type="text" name="myphoto_desc" value="{$spaceUserInfo['myphoto_desc']}" /><br /><div style="border: 1px solid transparent !important; border-width: 0px;"></div>&nbsp;<img src="{$_tpl_myphoto_path}" width="80" height="80" style="border: 1px solid #069;padding: 4px;margin: 7px 2px;" /><span style="vertical-align: bottom;"><input type="checkbox" class="chkbox" name="del_myphoto" value="1" />选择删除</span>
								</h1>
EOT;
			}
			print <<<EOT
								<h1>
									<div>我的空间说明：</div><input type="text" name="spacectitle" value="{$_tpl_spaceCTitle}" size="26" />{$lang['tpl.str132']}
								</h1>
								<h1>
									<div>我的空间公告：</div><textarea name="spacenote" cols="40" rows="5">{$_tpl_spaceNote}</textarea>
								</h1>
								<h1>
									<div>&nbsp;&nbsp;</div><input type="submit" name="submit" value="{$lang['tpl.str134']}">
								</h1>
							</form>
						</div>
EOT;
			break;
	}//end switch
	print '<br />';
}//end function Page_UserSetting

function spaceSiteUpdate_UI()	//我的空间站点数据统计和更新
{
	global $skinpath, $lang;
	print <<<EOT
						<h1><img src="{$skinpath}images/icon_quote.gif" />我的空间站点数据统计和更新</h1>
						<div class="topic">提示：以下操作不需要经常执行！</div>
						<div class="system_table">
								<h1>
									<div><input type="button" name="act" value="{$lang['tpl.str19']}" onclick="location.href='?s=7&t=1'" style="width: 150px;" /></div><span style="margin-left: 30px;">将发表过的信息更新为当前使用的笔名。</span><br /><br />
								</h1>
								<h1>
									<div><input type="button" name="act" value="{$lang['tpl.str21']}" onclick="location.href='?s=7&t=2'" style="width: 150px;" /></div><span style="margin-left: 30px;">重新统计分栏的文章数。</span><br /><br />
								</h1>
								<h1>
									<div><input type="button" name="act" value="{$lang['tpl.str23']}" onclick="location.href='?s=7&t=3'" style="width: 150px;" /></div><span style="margin-left: 30px;">更新我的空间总统计数据</span><br /><br />
								</h1>
						</div>
EOT;
}//end function spaceSiteUpdate_UI

function applyTodayStar_UI()	//	申请今日之星
{
	global $skinpath, $lang;
	print <<<EOT
						<h1><img src="{$skinpath}images/icon_quote.gif" />申请今日之星</h1>
EOT;
	Apply_Today_Star();
}//end function applyTodayStar_UI
?>