Mercurial > epgrec.yaz
comparison 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 |
comparison
equal
deleted
inserted
replaced
160:47a3acf19870 | 165:3d4df1fe4166 |
---|---|
6 include_once( INSTALL_PATH . '/Settings.class.php' ); | 6 include_once( INSTALL_PATH . '/Settings.class.php' ); |
7 | 7 |
8 $program_id = 0; | 8 $program_id = 0; |
9 $reserve_id = 0; | 9 $reserve_id = 0; |
10 $settings = Settings::factory(); | 10 $settings = Settings::factory(); |
11 $rec = null; | |
12 $path = ""; | |
11 | 13 |
12 if( isset($_GET['program_id'])) { | 14 if( isset($_GET['program_id'])) { |
13 $program_id = $_GET['program_id']; | 15 $program_id = $_GET['program_id']; |
14 } | 16 } |
15 else if(isset($_GET['reserve_id'])) { | 17 else if(isset($_GET['reserve_id'])) { |
18 $rec = new DBRecord( RESERVE_TBL, "id" , $reserve_id ); | 20 $rec = new DBRecord( RESERVE_TBL, "id" , $reserve_id ); |
19 $program_id = $rec->program_id; | 21 $program_id = $rec->program_id; |
20 | 22 |
21 if( isset( $_GET['delete_file'] ) ) { | 23 if( isset( $_GET['delete_file'] ) ) { |
22 if( $_GET['delete_file'] == 1 ) { | 24 if( $_GET['delete_file'] == 1 ) { |
23 // ファイルを削除 | 25 $path = INSTALL_PATH."/".$settings->spool."/".$rec->path; |
24 if( file_exists( INSTALL_PATH."/".$settings->spool."/".$rec->path ) ) { | |
25 @unlink(INSTALL_PATH."/".$settings->spool."/".$rec->path); | |
26 @unlink(INSTALL_PATH."/".$settings->thumbs."/".$rec->path.".jpg"); | |
27 } | |
28 } | 26 } |
29 } | 27 } |
30 } | 28 } |
31 catch( Exception $e ) { | 29 catch( Exception $e ) { |
32 // 無視 | 30 // 無視 |
33 } | 31 } |
34 } | 32 } |
35 | |
36 | |
37 | 33 |
38 // 手動取り消しのときには、その番組を自動録画対象から外す | 34 // 手動取り消しのときには、その番組を自動録画対象から外す |
39 if( $program_id ) { | 35 if( $program_id ) { |
40 try { | 36 try { |
41 $rec = new DBRecord(PROGRAM_TBL, "id", $program_id ); | 37 $rec = new DBRecord(PROGRAM_TBL, "id", $program_id ); |
44 catch( Exception $e ) { | 40 catch( Exception $e ) { |
45 // 無視 | 41 // 無視 |
46 } | 42 } |
47 } | 43 } |
48 | 44 |
45 | |
46 | |
49 // 予約取り消し実行 | 47 // 予約取り消し実行 |
50 try { | 48 try { |
51 Reservation::cancel( $reserve_id, $program_id ); | 49 Reservation::cancel( $reserve_id, $program_id ); |
50 if( isset( $_GET['delete_file'] ) ) { | |
51 if( $_GET['delete_file'] == 1 ) { | |
52 // ファイルを削除 | |
53 if( file_exists( $path) ) { | |
54 @unlink($path); | |
55 @unlink($path.".jpg"); | |
56 } | |
57 } | |
58 } | |
52 } | 59 } |
53 catch( Exception $e ) { | 60 catch( Exception $e ) { |
54 exit( "Error" . $e->getMessage() ); | 61 exit( "Error" . $e->getMessage() ); |
55 } | 62 } |
56 exit(); | 63 exit(); |