<?php
/*
 * 注意：此文件由tpl_engine编译型模板引擎编译生成。
 * 如果您的模板要进行修改，请修改 templates/default/modules/album/photo_list.html
 * 如果您的模型要进行修改，请修改 models/modules/album/photo_list.php
 *
 * 修改完成之后需要您进入后台重新编译，才会重新生成。
 * 如果您开启了debug模式运行，那么您可以省去上面这一步，但是debug模式每次都会判断程序是否更新，debug模式只适合开发调试。
 * 如果您正式运行此程序时，请切换到service模式运行！
 * 
 * 如有您有问题请到官方论坛（http://tech.jooyea.com/bbs/）提问，谢谢您的支持。
 */
?><?php
	//引入语言包
	$a_langpackage=new albumlp;
	$mn_langpackage=new menulp;

	//变量取得
	$album_id = short_check(get_argg('album_id'));
	$url_uid= short_check(get_argg('user_id'));
	$ses_uid=get_sess_userid();
	
	//引入模块公共权限过程文件
	$is_login_mode='';
	$is_self_mode='partLimit';
	require("foundation/auser_validate.php");
	require("foundation/module_users.php");
	require("foundation/module_mypals.php");
	require("foundation/fcontent_format.php");
	require("foundation/module_restore.php");
	require("foundation/fpages_bar.php");

	//数据表定义区
	$t_album = $tablePreStr."album";
	$t_photo = $tablePreStr."photo";
	$t_album_comment = $tablePreStr."album_comment";
	$t_users = $tablePreStr."users";
	$t_holerpals = $tablePreStr."pals_mine";

	$dbo=new dbex;

	//读写分离定义函数
	dbtarget('r',$dbServs);
	$holder_name=get_hodler_name($dbo,$t_users,$url_uid);
	$holder_pals=getHodlerpals($dbo,$t_holerpals,$url_uid);
	$p=strstr($holder_pals,",".$ses_uid.",");
	$album_row=array();
	
	//缓存区
	function alb_im($dbo,$t_album,$album_id){
		$sql = "select * from $t_album where album_id='$album_id'";
		return $dbo->getRow($sql);
	}	

	function db_pht($dbo,$t_photo,$album_id,$p){
		global $album_row;
		global $ses_uid;
		if($album_row['user_id']==$ses_uid){
			$sql="select * from $t_photo where album_id='$album_id' order by add_time desc";
		}else{
			if($p && $ses_uid!=''){
				$sql="select * from $t_photo where album_id='$album_id' and album_secret<=1 order by add_time desc";
			}else{
				$sql="select * from $t_photo where album_id='$album_id' and album_secret=0 order by add_time desc";
			}
		}
		return $dbo->getRs($sql);
	}
	require($webRoot.$baseLibsPath."model/album_im.model.cache.php");
	require($webRoot.$baseLibsPath."model/photo_list.model.cache.php");
	$user_name = urlencode($holder_name);
	
	$host_id=$album_row['user_id'];
	$album_information = $album_row['album_information'];
	
	if($ses_uid==$host_id){
		$no_pht = $a_langpackage->a_no_upl.",<a href='?app=photo_upload&album_id=".$album_id."'>".$a_langpackage->a_upl_pht."</a>";
	}else{
		$no_pht = $a_langpackage->a_f_no_pht;
	}
	
	if($is_self=='Y'){
		$a_who=$a_langpackage->a_mine;
		$user_id=$ses_uid;
		$button="";
	}else{
		$a_who=str_replace('{holder}',filt_word($holder_name),$a_langpackage->a_holder)."</div>";
		$user_id=$album_row['user_id'];
		$button="content_none";
	}

	//数据显示控制
	$isNull=0;
	$show_data="";
	$error_str='';
	$show_lock="content_none";
	$none_photo="content_none";
	$is_admin=get_sess_admin();
	if($is_admin==''){
		if($album_row['album_pass']==0){
			$error_str=$a_langpackage->a_lock_album;
			$show_data="content_none";
			$show_lock="";
		}
	}	
	
	if(empty($photo_rs)){
		$isNull=1;//判断结果集是否为空
		$show_data="content_none";
		$show_lock="content_none";
		$none_photo="";
	}
	
	if($album_row['album_secret']==2 and $album_row['user_id']!=$ses_uid){
		$show_data="content_none";
		$error_str=$a_langpackage->a_add_pvw;
		$show_lock="";
		$none_photo="content_none";
	}
	if($album_row['album_secret']==1 and $album_row['user_id']!=$ses_uid){
		if(!$p || empty($ses_uid)){
			$show_data="content_none";
			$error_str=$a_langpackage->a_add_pvw;
			$show_lock="";
			$none_photo="content_none";
		}		
	}
?>
<!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 rel="stylesheet" type="text/css" href="skin/<?php echo $skinUrl;?>/css/row_menus.css">
<link rel="stylesheet" type="text/css" href="skin/<?php echo $skinUrl;?>/css/iframe.css">
<script type='text/javascript' src="skin/default/js/jooyea.js"></script>
</head>
<body>
  <div class="main_right_title">
     <span class="main_title_dot2"></span>
     <span class="main_title_txt"><?php echo $a_who;?></span>
  </div>

<div id='tabsB' class="<?php echo $button;?>">
  <ul>
    <li class="nowbutl"><a href="?app=album_list" title="<?php echo $a_langpackage->a_main;?>" class="nowbutl"><span class="nowbutr"><?php echo $a_langpackage->a_mine;?></span></a></li>
    <li><a href="?app=album_friend" title="<?php echo $a_langpackage->a_friend;?>"><span><?php echo $a_langpackage->a_friend;?></span></a></li>
  </ul>
    <div class="div_but" onclick="location.href='?app=album_creat'"><?php echo $a_langpackage->a_creat;?></div>
    <div class="div_but_3" onclick="location.href='?app=photo_upload&album_id=<?php echo $album_id;?>'"><?php echo $a_langpackage->a_upload;?></div>
</div>

<?php if(!$show_data){?>
<?php if($album_row['user_id']!=$ses_uid&&$ses_uid){?>	
	<span class="right"><a class="fenxiang" href="javascript:void(0);" onclick="parent.show_share(2,<?php echo $album_row['album_id'];?>,'<?php echo $album_row['album_name'];?>','','');"><?php echo $mn_langpackage->mn_share;?></a><a class="jubao" href="javascript:void(0);" onclick="parent.report(2,<?php echo $album_row['user_id'];?>,<?php echo $album_row['album_id'];?>);"><?php echo $mn_langpackage->mn_report;?></a>&nbsp;&nbsp;</span>
<?php }?>
<?php foreach($photo_rs as $val){?>
<?php newline('4');?>
    <div class="album_photo_box">
	    <a href='?app=photo_view&photo_id=<?php echo $val['photo_id'];?>&album_id=<?php echo $album_id;?>&user_id=<?php echo $user_id;?>'>
	    	<img src='<?php echo $val['photo_thumb_src'];?>' width="100px" onerror="parent.pic_error(this)" class='user_ico'>
	    </a>
	</div>
<?php }?>
<div class="clear"></div>
<?php page_show($isNull,$page_num,$page_total);?>
<div class="album_info">
	<div class="album_info_content">
		<div class="album_title"><?php echo $a_langpackage->a_name;?><?php echo filt_word($album_row['album_name']);?></div>
		<div class="album_summary"><?php echo $a_langpackage->a_inf;?><?php echo filt_word($album_information);?></div>
	</div>
</div>

<div class="tleft ml20">
	<div class="replytip"></div>
	<div id='show_2_<?php echo $album_row["album_id"];?>'>
	<?php echo $dbo->setNopages();?>
	<?php echo get_restore($dbo,2,$album_row["album_id"],0,20);?>
	</div>
<?php if($ses_uid!=''){?>	
<div class="reply">
	<img src='<?php echo get_sess_userico();?>' />
	<textarea  style="height:50px" maxlength="160" onkeyup="return isMaxLen(this)" id="reply_2_<?php echo $album_row['album_id'];?>_input"></textarea>
	<div class="replybt">
		<input class="left button2" onclick="parent.restore_com(<?php echo $album_row['user_id'];?>,2,<?php echo $album_row['album_id'];?>);show('face_list_menu',200);" type="submit" name="button" id="button" value="<?php echo $a_langpackage->a_b_com;?>" />
		<a class="right" href="javascript: void(0);" onclick="showFace(this,'face_list_menu','reply_2_<?php echo $album_row['album_id'];?>_input');"><?php echo $a_langpackage->a_face;?></a>
	</div>
	<div class="clear"></div>
</div>
<?php }?>
</div>
<?php }?>
	<!-- face begin -->
	<div id="face_list_menu" class="emBg" style="display:none;z-index:100;">
	</div>
	<!-- face end -->
<!--锁定控制-->
<div class="pageerr <?php echo $show_lock;?>"><?php echo $error_str;?></div>
<div class="guide_info <?php echo $none_photo;?>"><?php echo $no_pht;?></div>

</body>
</html>