Mercurial > epgrec.yaz
comparison changeReservation.php @ 27:a34f2ff49097
add: editable title & description
author | yoneda <epgrec@park.mda.or.jp> |
---|---|
date | Sun, 26 Jul 2009 18:00:11 +0900 |
parents | 82c1375ddb4a |
children | e5f9aa34d06f |
comparison
equal
deleted
inserted
replaced
26:82c1375ddb4a | 27:a34f2ff49097 |
---|---|
1 <?php | 1 <?php |
2 include_once('config.php'); | 2 include_once('config.php'); |
3 include_once(INSTALL_PATH."/DBRecord.class.php"); | 3 include_once(INSTALL_PATH."/DBRecord.class.php"); |
4 include_once(INSTALL_PATH."/reclib.php"); | |
4 | 5 |
5 if( !isset( $_POST['reserve_id'] ) ) { | 6 if( !isset( $_POST['reserve_id'] ) ) { |
6 exit("Error: IDが指定されていません" ); | 7 exit("Error: IDが指定されていません" ); |
7 } | 8 } |
8 $reserve_id = $_POST['reserve_id']; | 9 $reserve_id = $_POST['reserve_id']; |
9 | 10 |
11 $dbh = false; | |
12 if( defined("MEDIATOMB_UPDATE") ) { | |
13 if( MEDIATOMB_UPDATE ) { | |
14 $dbh = @mysql_connect( DB_HOST, DB_USER, DB_PASS ); | |
15 if( $dbh !== false ) { | |
16 $sqlstr = "use ".DB_NAME; | |
17 @mysql_query( $sqlstr ); | |
18 $sqlstr = "set NAME utf8"; | |
19 @mysql_query( $sqlstr ); | |
20 } | |
21 } | |
22 } | |
23 | |
10 try { | 24 try { |
11 $rec = new DBRecord(TBL_PREFIX.RESERVE_TBL, "id", $reserve_id ); | 25 $rec = new DBRecord(TBL_PREFIX.RESERVE_TBL, "id", $reserve_id ); |
12 | 26 |
13 if( isset( $_POST['title'] ) ) { | 27 if( isset( $_POST['title'] ) ) { |
14 $rec->title = trim( $_POST['title'] ); | 28 $rec->title = trim( $_POST['title'] ); |
29 if( ($dbh !== false) && ($rec->complete == 1) ) { | |
30 $title = trim( mysql_real_escape_string($_POST['title'])); | |
31 $title .= "(".date("Y/m/d", toTimestamp($rec->starttime)).")"; | |
32 $sqlstr = "update mt_cds_object set dc_title='".$title."' where metadata regexp 'epgrec:id=".$reserve_id."$'"; | |
33 mysql_query( $sqlstr ); | |
34 } | |
15 } | 35 } |
16 | 36 |
17 if( isset( $_POST['description'] ) ) { | 37 if( isset( $_POST['description'] ) ) { |
18 $rec->description = trim( $_POST['description'] ); | 38 $rec->description = trim( $_POST['description'] ); |
39 if( ($dbh !== false) && ($rec->complete == 1) ) { | |
40 $desc = "dc:description=".trim( mysql_real_escape_string($_POST['description'])); | |
41 $desc .= "&epgrec:id=".$reserve_id; | |
42 $sqlstr = "update mt_cds_object set metadata='".$desc."' where metadata regexp 'epgrec:id=".$reserve_id."$'"; | |
43 @mysql_query( $sqlstr ); | |
44 } | |
19 } | 45 } |
20 } | 46 } |
21 catch( Exception $e ) { | 47 catch( Exception $e ) { |
22 exit("Error: ". $e->getMessage()); | 48 exit("Error: ". $e->getMessage()); |
23 } | 49 } |