diff cancelReservation.php @ 165:3d4df1fe4166

merged with upstream
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Thu, 08 Apr 2010 04:22:20 +0900
parents c6c6bd734f18
children
line wrap: on
line diff
--- a/cancelReservation.php	Fri Apr 02 20:40:55 2010 +0900
+++ b/cancelReservation.php	Thu Apr 08 04:22:20 2010 +0900
@@ -8,6 +8,8 @@
 $program_id = 0;
 $reserve_id = 0;
 $settings = Settings::factory();
+$rec = null;
+$path = "";
 
 if( isset($_GET['program_id'])) {
 	$program_id = $_GET['program_id'];
@@ -20,11 +22,7 @@
 		
 		if( isset( $_GET['delete_file'] ) ) {
 			if( $_GET['delete_file'] == 1 ) {
-				// ファイルを削除
-				if( file_exists( INSTALL_PATH."/".$settings->spool."/".$rec->path ) ) {
-					@unlink(INSTALL_PATH."/".$settings->spool."/".$rec->path);
-					@unlink(INSTALL_PATH."/".$settings->thumbs."/".$rec->path.".jpg");
-				}
+				$path = INSTALL_PATH."/".$settings->spool."/".$rec->path;
 			}
 		}
 	}
@@ -33,8 +31,6 @@
 	}
 }
 
-
-
 // 手動取り消しのときには、その番組を自動録画対象から外す
 if( $program_id ) {
 	try {
@@ -46,9 +42,20 @@
 	}
 }
 
+
+
 // 予約取り消し実行
 try {
 	Reservation::cancel( $reserve_id, $program_id );
+	if( isset( $_GET['delete_file'] ) ) {
+		if( $_GET['delete_file'] == 1 ) {
+			// ファイルを削除
+			if( file_exists( $path) ) {
+				@unlink($path);
+				@unlink($path.".jpg");
+			}
+		}
+	}
 }
 catch( Exception $e ) {
 	exit( "Error" . $e->getMessage() );