forked from stz2012/epgrec
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cancelReservation.php
64 lines (57 loc) · 1.34 KB
/
cancelReservation.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
include_once('config.php');
include_once( INSTALL_PATH . '/DBRecord.class.php' );
include_once( INSTALL_PATH . '/Reservation.class.php' );
include_once( INSTALL_PATH . '/reclib.php' );
include_once( INSTALL_PATH . '/Settings.class.php' );
$program_id = 0;
$reserve_id = 0;
$settings = Settings::factory();
$rec = null;
$path = "";
if( isset($_GET['program_id'])) {
$program_id = $_GET['program_id'];
}
else if(isset($_GET['reserve_id'])) {
$reserve_id = $_GET['reserve_id'];
try {
$rec = new DBRecord( RESERVE_TBL, "id" , $reserve_id );
$program_id = $rec->program_id;
if( isset( $_GET['delete_file'] ) ) {
if( $_GET['delete_file'] == 1 ) {
$path = INSTALL_PATH."/".$settings->spool."/".$rec->path;
}
}
}
catch( Exception $e ) {
// 無視
}
}
// 手動取り消しのときには、その番組を自動録画対象から外す
if( $program_id ) {
try {
$rec = new DBRecord(PROGRAM_TBL, "id", $program_id );
$rec->autorec = 0;
}
catch( Exception $e ) {
// 無視
}
}
// 予約取り消し実行
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() );
}
exit();
?>