<?php

/*
	[SupeSite/X-Space] (C)2001-2006 Comsenz Inc.
	頁面工具欄

	$RCSfile: batch.toolbar.php,v $
	$Revision: 1.30 $
	$Date: 2006/10/10 19:44:18 $
*/


include_once('./include/main.inc.php');
getcookie();

if(!empty($headercharset)) {
	@header('Content-Type: text/html; charset='.$charset);
}

$showarr = array(
	'news' => 1,
	'blog' => 1,
	'image' => 1,
	'goods' => 1,
	'file' => 1,
	'link' => 1
);
foreach ($showarr as $skey => $svalue) {
	if(!usetype($skey)) {
		$showarr[$skey] = 0;
	}
}

$uid = 0;
$uid = intval($_SGLOBAL['supe_uid']);
$refer = $_SERVER['HTTP_REFERER'];

?>
<!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=<?=$charset?>" />
<title>Tool Bar</title>
<link href="css/toolbar.css" rel="stylesheet" type="text/css" />
<script language="javascript" type="text/javascript" src="include/js/common.js"></script>
</head>
<body>

<div id="toolbar">
<?php
if(empty($uid)) {
?>
	<div class="right">
		<ul>
			<li class="noborder"><a href="javascript:;" onclick="hidetoolbar();" class="close">關閉</a></li>
		</ul>
	</div>
	<div class="menus">
		<ul>
			<li class="noborder">
			<form id="tblogin" action="batch.login.php?action=login" method="post" target="_parent">
			用戶名 <input type="text" id="tbusername" name="username" />
			密碼 <input type="password" id="tbpassword" name="password" />
			<button type="submit" class="login" name="loginsubmit" value="true">登錄</button>
			<input type="hidden" name="refer" value="<?=$refer?>">
			</form>
			</li>
			<li><a href="<?=$bbsurl?>/register.php?referer=<?php echo $siteurl.'/index.php?action/login';?>" class="register" target="_blank">註冊</a></li>
			<li><a href="<?=$bbsurl?>/member.php?action=lostpasswd" class="getpass" target="_blank">找回密碼</a></li>
		</ul>
	</div>
<?php
} else {
	$spaceurl = 'index.php?'.$uid;
?>
	<div class="right">
		<ul>
			<li class="noborder"><a href="javascript:;" onclick="hidetoolbar();" class="close">關閉</a></li>
		</ul>
	</div>
	<div id="quickguide">
		<ul id="menu">
			<li class="noborder">快速導航</li>
			<li><a href="<?=$spaceurl?>" class="myspace" target="_parent">我的空間</a></li>
			<li><a href="spacecp.php?docp=1" class="manage" target="_parent">空間管理</a></li>
			<?php if($showarr['blog']) {?><li><a href="spacecp.php?docp=1&action=spaceblogs&op=add&openwindow=1" class="post" target="_blank">日誌</a></li><?php }?>
			<?php if($showarr['image']) {?><li><a href="spacecp.php?docp=1&action=spaceimages&op=add&openwindow=1" class="postimg" target="_blank">圖片</a></li><?php }?>
			<?php if($showarr['goods']) {?><li><a href="spacecp.php?docp=1&action=spacegoods&op=add&openwindow=1" class="goods" target="_blank">商品</a></li><?php }?>
			<?php if($showarr['file']) {?><li><a href="spacecp.php?docp=1&action=spacefiles&op=add&openwindow=1" class="download" target="_blank">文件</a></li><?php }?>
			<?php if($showarr['link']) {?><li><a href="spacecp.php?docp=1&action=spacelinks&op=add&openwindow=1" class="link" target="_blank">書籤</a></li><?php }?>
			<li><a href="javascript:;" onclick="mngLink(this);" class="hidemnglink">隱藏編輯按鈕</a></li>
			<li><a href="batch.login.php?action=logout&refer=<?echo rawurlencode($refer);?>" class="logout" target="_parent">退出</a></li>
		</ul>
	</div>
<?php
}
?>

</body>
</html>

<?php

function usetype($type) {
	global $_SCONFIG;
	if(empty($_SCONFIG['usetype'])) {
		return true;
	} else {
		if(strpos($_SCONFIG['usetype'], $type) === false) {
			return false;
		} else {
			return true;
		}
	}
}
?>