<?php
  //引入公共模块
  require("foundation/module_mypals.php");	
	require("foundation/module_blog.php");
  require("foundation/module_restore.php");
  
  //语言包引入
  $b_langpackage=new bloglp;
	$mn_langpackage=new menulp;

  //变量区
	$url_uid=short_check(get_argg('user_id'));
	$ses_uid=get_sess_userid();
	$is_friend=short_check(get_argg('is_friend'));
	$ulog_id=short_check(get_argg("id"));
	$is_admin=get_sess_admin();

  //引入模块公共权限过程文件
  $is_login_mode='';
	$is_self_mode='partLimit';
	require("foundation/auser_validate.php");
  
  //数据表定义
  $t_blog=$tablePreStr."blog";
  $t_mypals=$tablePreStr."pals_mine";
  
  //初始化数据库操作对象
  $dbo=new dbex;
  
  if($ses_uid!=get_session('b_'.$ulog_id)){
	  //读写分离方法-写操作
	  dbtarget('w',$dbServs);      
	  $sql="update $t_blog set hits=hits+1 where log_id=$ulog_id";
	  $dbo->exeUpdate($sql);
	  set_session('b_'.$ulog_id,$ses_uid);
}

  //读写分离方法-读操作
  dbtarget('r',$dbServs);
  $condition="log_id=$ulog_id";
  $order_by="";
  $type="getRow";
  $blog_row=get_db_data($dbo,$t_blog,$condition,$order_by,$type);
  $blog_limit=$blog_row['blog_limit'];
  
	//控制按钮显示
	$button_ctrl_his="content_none";
	$button_ctrl_mine="";
	
	if(get_argg('is_friend')==1){
		$button_ctrl_his="";
		$button_ctrl_mine="content_none";
	}
	
	//控制数据显示
	$show_error="content_none";
	$is_show=1;
	$error_str='';
	if(empty($blog_row)){
		$error_str=$b_langpackage->b_error;
		$is_show=0;$show_error="";
	}
	
  if($is_self=='N'){
  	if($is_admin==''){
		  if($blog_row['blog_limit']==2){
				$show_error="";$is_show=0;
				$error_str=$b_langpackage->b_limit_blog;
		  }
			if($blog_row["blog_limit"]==1){
				$holder_pals=getHodlerpals($dbo,$t_mypals,$url_uid);
				if(!strstr($holder_pals,",".$ses_uid.",")||empty($ses_uid)){
					$show_error="";$is_show=0;
					$error_str=$b_langpackage->b_limit_blog;
				}
		  }
	  }
   }
   
	if($is_admin==''){
		if($blog_row['log_pass']==0){
			$show_error='';
			$is_show=0;
			$error_str=$b_langpackage->b_lock;
		}
	}

?>