forked from stz2012/epgrec
-
Notifications
You must be signed in to change notification settings - Fork 0
/
changeReservation.php
56 lines (48 loc) · 1.6 KB
/
changeReservation.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
<?php
include_once('config.php');
include_once(INSTALL_PATH."/DBRecord.class.php");
include_once(INSTALL_PATH."/reclib.php");
include_once(INSTALL_PATH."/Settings.class.php");
$settings = Settings::factory();
if( !isset( $_POST['reserve_id'] ) ) {
exit("Error: IDが指定されていません" );
}
$reserve_id = $_POST['reserve_id'];
$dbh = false;
if( $settings->mediatomb_update == 1 ) {
$dbh = @mysql_connect( $settings->db_host, $settings->db_user, $settings->db_pass );
if( $dbh !== false ) {
$sqlstr = "use ".$settings->db_name;
@mysql_query( $sqlstr );
$sqlstr = "set NAME utf8";
@mysql_query( $sqlstr );
}
}
try {
$rec = new DBRecord(RESERVE_TBL, "id", $reserve_id );
if( isset( $_POST['title'] ) ) {
$rec->title = trim( $_POST['title'] );
$rec->dirty = 1;
if( ($dbh !== false) && ($rec->complete == 1) ) {
$title = trim( mysql_real_escape_string($_POST['title']));
$title .= "(".date("Y/m/d", toTimestamp($rec->starttime)).")";
$sqlstr = "update mt_cds_object set dc_title='".$title."' where metadata regexp 'epgrec:id=".$reserve_id."$'";
@mysql_query( $sqlstr );
}
}
if( isset( $_POST['description'] ) ) {
$rec->description = trim( $_POST['description'] );
$rec->dirty = 1;
if( ($dbh !== false) && ($rec->complete == 1) ) {
$desc = "dc:description=".trim( mysql_real_escape_string($_POST['description']));
$desc .= "&epgrec:id=".$reserve_id;
$sqlstr = "update mt_cds_object set metadata='".$desc."' where metadata regexp 'epgrec:id=".$reserve_id."$'";
@mysql_query( $sqlstr );
}
}
}
catch( Exception $e ) {
exit("Error: ". $e->getMessage());
}
exit("complete");
?>