<?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";
		}		
	}
?>