<?php
	//引入语言包
	$a_langpackage=new albumlp;
	require("foundation/adata_count.php");
	require("foundation/aintegral.php");
	
	//变量取得
	$photo_id = short_check(get_argg('photo_id'));
	$album_id=short_check(get_argg('album_id'));
	$user_id=get_sess_userid();

	//数据表定义区
	$t_album = $tablePreStr."album";
	$t_photo = $tablePreStr."photo";

	//功能===========================================================================
	$dbo = new dbex;
	//读写分离定义函数
	dbtarget('r',$dbServs);

	$sql = "select * from $t_album where album_id=$album_id";
	$album_row = $dbo ->getRow($sql);
	$sql = "select * from $t_photo where photo_id=$photo_id";
	$photo_row = $dbo ->getRow($sql);

	//读写分离定义函数
	dbtarget('w',$dbServs);

	//删除照片
	if($album_row['album_skin']==$photo_row['photo_thumb_src']){
		$album_skin = 'uploadfiles/album/logo.jpg';
		$sql = "update $t_album set album_skin = '$album_skin' where album_id=$album_id and user_id=$user_id";
		$dbo -> exeUpdate($sql);
	}
	@unlink($photo_row['photo_src']);
	@unlink($photo_row['photo_thumb_src']);

	$sql = "delete from $t_photo where photo_id=$photo_id and user_id=$user_id";

	if($dbo -> exeUpdate($sql)){
		update_count($dbo,$user_id,"photo_num",-1);
		increase_integral($dbo,$int_del_photo,$user_id);
	}

	$key_mt_al='alb_list_mt_'.$user_id;
	$sql = "update $t_album set photo_num=photo_num-1 where album_id=$album_id and user_id=$user_id";
	$dbo -> exeUpdate($sql);
	//缓存功能区
	require($webRoot.$baseLibsPath."action/photo_list_update.action.cache.php");

	//回应信息
	action_return(1,"","modules.php?app=photo_list&album_id=$album_id");
?>
