<!--<?php
require_once(uTemplate::printEot('header'));
require_once(uTemplate::printEot('space_appleft'));
print <<<EOT
-->
<div class="sideD">
<!--
EOT;
if($winduid != $space['uid'] &&(!$photosRight && ($photosValue == 1 && $indexValue != 2 || $indexValue == 1 && $photosValue < 2))){print <<<EOT
-->
<div class="boxA">
	<table width="100%">
		<tr><td height="400">
			<div class="space_msg"><img src="u/images/space/report.png" align="absmiddle" />由于對方的隱私設置，容許好友可見！立即 <a href="$db_bbsurl/pw_ajax.php?action=addfriend&touid={$space['uid']}" onclick="return ajaxurl(this);">加為好友</a></div>
		</td></tr>
	</table>
</div>
<!--
EOT;
}elseif(!$photosRight && $photosValue =='2' || $indexRight && !$photosRight){print <<<EOT
-->
<div class="boxA">
	<table width="100%">
		<tr><td height="400">
			<div class="space_msg"><img src="u/images/space/report.png" align="absmiddle" />對方設置了隱私，您沒有權限查看</div>
		</td></tr>
	</table>
</div>
<!--
EOT;
}else{print <<<EOT
-->
	<div class="boxA cc">
		<h2>
<!--
EOT;
if ($uid ==$winduid) {print <<<EOT
-->	
		<span class="fr" style="padding-top:2px;"><span class="btn_add"><span><button type="button" onClick="location.href='apps.php?q=photos&a=create';">創建相冊</button></span></span></span>
<!--
EOT;
}print <<<EOT
-->
			<span class="mr10">相冊</span>
		</h2>
			<div style="min-height:480px;_height:480px;">
<!--
EOT;
if ($a == 'own' || empty($a)) {print <<<EOT
-->
	<div id="list-box">
<!--
EOT;
if (!empty($albumdb)) {
foreach ($albumdb as $key => $value) {
$prviteimg = !$value['private']?'key':'lock';
if (!$value['private']) {
	$prviteimg = "";
} elseif ($value['private'] == 1) {
	$prviteimg = "<img src=\"u/images/lock.png\" title=\"僅好友可見\" align=\"absmiddle\"/>";
} elseif ($value['private'] == 2) {
	$prviteimg = "<img src=\"u/images/lock.png\" title=\"僅自己可見\" align=\"absmiddle\"/>";
} elseif ($value['private'] == 3) {
	$prviteimg = "<img src=\"u/images/key.png\" title=\"需要密碼訪問\" align=\"absmiddle\"/>";
}
if ((!$isown || $a == 'friend') && $value['private'] == 3 && !$isGM) {
	$cookiename = 'albumview_'.$value['aid'];
	if ($value['albumpwd'] && PwdCode($value['albumpwd']) != GetCookie($cookiename)) {
		$viewurl = "{$basename}a=viewalbum&aid=$value[aid]";
		$ajaxclick = "onclick=\"return ajaxurl(this,focusInp);\"";
	} else {
		$viewurl = "{$basename}a=album&aid=$value[aid]";
		$ajaxclick = "";
	}
} else {
	$viewurl = "{$basename}a=album&aid=$value[aid]";
	$ajaxclick = "";
}
print <<<EOT
-->
<div class="Albumbox cc">
<dl class="r_admininfo">
<dt class="Album"><a href="$viewurl" $ajaxclick><img src="$value[lastphoto]" onload="if(this.width>100){this.width = 100;} else if(this.height>100){this.height=100;}" /></a></dt>
<dd>
	<div class="c mb10">&nbsp;</div>
<p class="f16 b"><a href="$viewurl" $ajaxclick title="{$value[aname]}">{$value[sub_aname]}</a></p>
<p>共{$value[photonum]}張照片 $prviteimg</p>
<p>$value[lasttime]更新</p>
<span>
<!--
EOT;
if ($value['ownerid'] == $winduid || $groupid == 3) {print <<<EOT
--><a href="{$basename}a=editalbum&aid=$value[aid]" onclick="return ajaxurl(this);">編輯相冊</a>
<!--
EOT;
}else{print <<<EOT
--><a href="{$db_userurl}$uid">$value[owner]</a><!--
EOT;
}if ($value['ownerid'] == $winduid || $SYSTEM['delalbum']) {print <<<EOT
-->|&nbsp;&nbsp;<a href="{$basename}a=delalbum&aid=$value[aid]" onclick="return ajaxurl(this)">刪除相冊</a>
<!--
EOT;
}print <<<EOT
-->
</span>
</dd>
</dl>    
</div>
<!--
EOT;
}} else {print <<<EOT
-->
		<div class="p10 f14 tac">暫無照片！</div>
<!--
EOT;
}print <<<EOT
-->
	<div class="cc p20">$pages</div>
</div>
<!--
EOT;
} elseif ($a == 'album') {
print <<<EOT
-->
		<div class="p10 bdB">
<!--
EOT;
if ($isown) {print <<<EOT
-->
		<div class="fr">
			<a href="apps.php?q=collection&a=favor&type=photo&ajax=1&id={$aid}" onclick="return ajaxurl(this)" class="mr10 allCollect">收藏</a>     
<!--
EOT;
	if ($weiboPriv) {print <<<EOT
-->
			<a href="javascript:;" onclick="sendmsg('operate.php?action=toweibo&ajax=1&type=album&id={$aid}','',this.id);" class="allForward mr20">新鮮事</a>
<!--
EOT;
	}print <<<EOT
-->
			<a href="apps.php?q=photos&a=upload&job=flash&aid=$aid">上傳</a>&nbsp;　&nbsp;
            <a href="{$basename}a=delalbum&aid=$aid" onclick="return ajaxurl(this)" title="刪除相冊">刪除</a>
		</div>
		<a class="b" href="{$basename}q=$q">$album[owner]的相冊</a> &raquo; <span class="s5 b">$album[aname] ($album[photonum])</span>
<!--
EOT;
}else{print <<<EOT
-->
		<div class="fr">
			<a href="apps.php?q=collection&a=favor&type=photo&ajax=1&id={$aid}" onclick="return ajaxurl(this)" class="mr10 allCollect">收藏</a>
<!--
EOT;
	if ($weiboPriv) {print <<<EOT
-->
<a href="javascript:;" onclick="sendmsg('operate.php?action=toweibo&ajax=1&type=album&id={$aid}','',this.id);" class="allForward mr20">新鮮事</a>
<!--
EOT;
	}print <<<EOT
-->
		</div>
		<a class="b" href="apps.php?q=photos&uid=$space[uid]">$album[owner]的相冊</a> &raquo; <span class="s5 b">$album[aname] ($album[photonum])</span>
<!--
EOT;
}print <<<EOT
-->
    </div>
		<div class="g_listA g_listAB" style="padding-left:5px">
		<ul class="cc">
<!--
EOT;
if ($cnpho) {
foreach ($cnpho as $key => $value) {print <<<EOT
-->
			<li><div class="aimg"><a href="{$basename}a=view&pid=$value[pid]"><img onload="resizeImg(this)" src="$value[path]" /></a></div><p>
<!--
EOT;
if ($isown || $photoService->isDelRight()) {print <<<EOT
-->
<a href="javascript:;" class="adel" onclick="pwConfirm('是否確認刪除此照片？',this,function(){ajaxdel('$value[pid]')});" title="刪除">刪除</a>
<!--
EOT;
}print <<<EOT
-->共{$value[c_num]}條評論</p>
				<p>$value[uptime]</p>
			</li>
<!--
EOT;
}print <<<EOT
-->
		</ul>
<!--
EOT;
}else{print <<<EOT
-->
			<div class="tac p10 f14">暫無照片！</div>
<!--
EOT;
}print <<<EOT
-->
		</div>
		<div class="cc p20">$pages</div>
		
<!--
EOT;
} elseif ($a == 'view') {
print <<<EOT
-->
		<div class="p10">
			<div class="fr">
				<a href="apps.php?q=collection&a=favor&type=photo&ajax=1&id=$photo[pid]&ptype=photo" onclick="return ajaxurl(this)" class="mr10 allCollect">收藏</a>
<!--
EOT;
	if ($weiboPriv) {print <<<EOT
-->
                <a href="javascript:;" onclick="sendmsg('operate.php?action=toweibo&ajax=1&type=photo&id={$photo[pid]}','',this.id);" class="allForward mr20">新鮮事</a>
<!--
EOT;
	}print <<<EOT
-->
<!--
EOT;
if ($isown) {print <<<EOT
-->
				<a href="apps.php?q=photos&a=upload&job=flash&aid=$aid">上傳</a>&nbsp;　&nbsp;
<!--
EOT;
}if ($isown || $photoService->isDelRight()) {print <<<EOT
-->
				<a onclick="pwConfirm('是否確認刪除此照片？',this,function(){ajaxdel('$photo[pid]')});" href="javascript:;">刪除</a>
<!--
EOT;
}print <<<EOT
-->
			</div>

		<a class="b" href="apps.php?q=photos&uid=$space[uid]">$photo[owner]的相冊</a> &raquo; <a href="{$basename}a=album&aid=$photo[aid]" class="b">$photo[aname]</a> <span class="s5 b">($photo[photonum])</span>
</div>
			<div class="sidePhoto">
				<div class="p_lr_10">
				<div class="galbum_photo" id="imgtop">
					<div id="img_list">
<!--
EOT;
if($photo[photonum]>5){print<<<EOT
-->
						<div class="prePhoto mb5"><a onclick="return ajaxpage('{$basename}a=next&pid=$photo[pid]{$friendurl}','pre');">上一張</a></div>
<!--
EOT;
}print<<<EOT
-->
<!--
EOT;
if($photo[photonum]>5){print<<<EOT
-->
							<div class="nextPhoto"><a onclick="return ajaxpage('{$basename}a=pre&pid=$photo[pid]{$friendurl}','next');">下一張</a></div>
<!--
EOT;
}print <<<EOT
-->
					<ul class="g_listA cc">
<!--
EOT;
foreach($nearphoto as $value){
$ifsel = ($pid == $value[pid]) ? 'class="current"' : '';
print <<<EOT
-->
					<li id="imglist_{$value[pid]}" $ifsel>
<!--
EOT;
if($value[pid]=='begin'||$value[pid]=='end'){
print <<<EOT
-->
					<div class="aimg"><a href="javascript:;"><img src="$value[path]" /></a></div>
<!--
EOT;
} else {print <<<EOT
-->
					<div class="aimg"><a href="{$basename}a=view&pid=$value[pid]#imgtop"><img src="$value[path]" onload="if(this.width>100){this.width = 100;} else if(this.height>100){this.height=100;}" /></a></div>
<!--
EOT;
}print <<<EOT
-->
					</li>
<!--
EOT;
}print <<<EOT
-->
				</ul>
		
					</div>
				</div>
				</div>
			</div>
			<div class="contPhoto" style="width:745px;">
			<div class="p_lr_10">
				<div class="galbum_photo_con mb10">
					<div class="pr">
					<a id="next" onclick="return ajaxpage('{$basename}a=next&pid=$photo[pid]','pre');" class="aPre" style="cursor:url(u/images/pre.cur),auto;" title="上一張"></a>
					<a id="pre" onclick="return ajaxpage('{$basename}a=pre&pid=$photo[pid]','next');" class="aNext" style="cursor:url(u/images/next.cur),auto;" title="下一張"></a>
					<table cellpadding="0" cellspacing="0" width="100%" style="table-layout:fixed;">
						<tr>
							<td class="prePhoto">
								<div class="p15">
<!--
EOT;
if($photo[photonum]>5){print<<<EOT
-->
								<a href="javascipt:;" class="fl">上一張</a>
<!--
EOT;
}print<<<EOT
-->
								</div>
							</td>
							<td height="400" style="vertical-align:middle">
								<div class="tac p20" id="img-width"><img id="imgview" src="$photo[path]" w="$photo[w]" h="$photo[h]" /></div>
							</td>
							<td class="nextPhoto">
								<div class="p15">
<!--
EOT;
if($photo[photonum]>5){print<<<EOT
-->
								<a href="javascipt:;" class="fr">下一張</a>
<!--
EOT;
}print <<<EOT
-->
								</div>
							</td>
						</tr>
					</table>
					</div>
					<div class="onePhototip">
						<div class="fr s7" style="z-index:1200"><a href="javascript:;" onclick="ImgClick();" class="s7">原圖</a>&nbsp;　&nbsp;<a href="javascript:;" onclick="sendmsg('pw_ajax.php?action=report&type=photo&tid=$pid&pid=$uid','',this.id);" id="report_photo" class="s7">舉報</a>
						</div>
						<div><span class="mr20">$photo[pintro]</span><span class="mr20">上傳于{$photo[uptime]}</span><span class="mr20">瀏覽($photo[hits])</span><span class="mr20">評論($photo[c_num])</span></div>
					</div>
				</div>
<!-- 
EOT;
$rateSets = unserialize($db_ratepower);
if($rateSets[3] && isset($db_hackdb['rate'])){
print <<<EOT
-->
<link rel="stylesheet" type="text/css" href="hack/rate/images/rate.css" />
<script type="text/javascript" src="js/rate_ajax.js"></script>
<script>
window.onload = function() {
rate.getVote("vote_box","{$db_bbsurl}/hack.php?H_name=rate&action=ajax","elementid=vote_box&typeid=3&objectid={$pid}&authorid={$u}");
};
</script>
<div id="vote_box" class="mb10"></div>
<!-- 
EOT;
}
print <<<EOT
-->	
<script type="text/javascript" src="js/pw_photolist.js"></script>
<script>
var photolist = new photoList('img_list','$pid','$aid');
</script>
<div class="c"></div>
<script>
var imgMaxWidth=600;
var content = document.getElementById("img-width");
ImgLoad(content);

function ImgClick()
{
	var url = getObj('imgview');
	if (url.parentElement){
		if (url.parentElement.tagName!="A"){
			window.open(url.src);
		}
	}else{
		window.open(url.src);
	}
}

function ajaxpage(url,type) {
	var tourl = '{$basename}a=view';
	ajax.send(url,'',function() {
		var rText = ajax.request.responseText.split('\\t');
		if (rText[0] == 'ok') {
			if (rText[1]) {
				window.location.href = tourl + '&pid=' + rText[1]+'#imgtop';
			} else {
				var message = type == 'next' ? '已經是最後一張照片' : '已經是第一張照片';
                showDialog('warning',message,2);
			}
		} else {
			ajax.guide();
		}
	});
	return false;
}

function bbimg()
{
	if (event.ctrlKey){
		var zoom=parseInt(this.style.zoom, 10)||100;
		zoom+=event.wheelDelta/12;
		if (zoom>0) this.style.zoom=zoom+'%';
		return false;
	}else{
		return true;
	}
}
function ImgLoad(obj){
	for(var i=0;i<obj.getElementsByTagName("img").length;i++){
		var o=obj.getElementsByTagName("img")[i];
		if (o.getAttribute('w')>imgMaxWidth){
			if (o.style.width){
				o.style.width="";
			}
			o.width=imgMaxWidth;
			o.removeAttribute("height");
			o.style.cursor="hand";
			o.vspace=5;
			o.resized=1;
		}else{
			o.width=o.getAttribute('w');
		}
		setTimeout(function(){
			getElementsByClassName('aPre')[0].style.height=getElementsByClassName('aNext')[0].style.height=Math.max(o.height,400)+'px';
		},400);
	}
}
</script>
<script type="text/javascript" src="js/app_comment.js"></script>
<div>
<!--
EOT;
require_once PrintEot('m_comment');print <<<EOT
-->
</div>
			</div>
		</div>
<!--
EOT;
}}print <<<EOT
-->
		</div>
	</div>
</div>
<script>
function ajaxdel(pid) {
	var u = '$u';
	ajax.send('{$basename}a=delphoto&pid='+pid,'',function() {
		var rText = ajax.request.responseText.split('\t');
		if (rText[0] == 'ok') {
			window.location = '{$basename}a=album&aid='+rText[1];
		} else {
			ajax.guide();
		}
	});
	return false;
}
function ajaxurl(o,callback) {
	read.obj = o;
	ajax.send(o.href,'',function(){
		ajax.get();
		callback&&callback();
	});
	return false;
}
function focusInp(){
	if(getObj("pwdvalue")){
		setTimeout(function(){
			getObj("pwdvalue").focus();
		},100)
	}
}
</script>
<!--
EOT;
require_once(uTemplate::printEot('footer'));
?>-->