comparison changeReservation.php @ 37:e5f9aa34d06f

change: modify all script for web base setting
author yoneda <epgrec@park.mda.or.jp>
date Tue, 28 Jul 2009 00:00:04 +0900
parents a34f2ff49097
children f8f6e0d3acaf
comparison
equal deleted inserted replaced
36:c2522d1df005 37:e5f9aa34d06f
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 include_once(INSTALL_PATH."/reclib.php");
5 include_once(INSTALL_PATH."/Settings.class.php");
6
7 $settings = Settings::factory();
5 8
6 if( !isset( $_POST['reserve_id'] ) ) { 9 if( !isset( $_POST['reserve_id'] ) ) {
7 exit("Error: IDが指定されていません" ); 10 exit("Error: IDが指定されていません" );
8 } 11 }
9 $reserve_id = $_POST['reserve_id']; 12 $reserve_id = $_POST['reserve_id'];
10 13
11 $dbh = false; 14 $dbh = false;
12 if( defined("MEDIATOMB_UPDATE") ) { 15 if( $settings->mediatomb_update ) {
13 if( MEDIATOMB_UPDATE ) { 16 $dbh = @mysql_connect( $settings->db_host, $settings->db_user, $settings->db_pass );
14 $dbh = @mysql_connect( DB_HOST, DB_USER, DB_PASS ); 17 if( $dbh !== false ) {
15 if( $dbh !== false ) { 18 $sqlstr = "use ".$settings->db_name;
16 $sqlstr = "use ".DB_NAME; 19 @mysql_query( $sqlstr );
17 @mysql_query( $sqlstr ); 20 $sqlstr = "set NAME utf8";
18 $sqlstr = "set NAME utf8"; 21 @mysql_query( $sqlstr );
19 @mysql_query( $sqlstr );
20 }
21 } 22 }
22 } 23 }
23 24
24 try { 25 try {
25 $rec = new DBRecord(TBL_PREFIX.RESERVE_TBL, "id", $reserve_id ); 26 $rec = new DBRecord(RESERVE_TBL, "id", $reserve_id );
26 27
27 if( isset( $_POST['title'] ) ) { 28 if( isset( $_POST['title'] ) ) {
28 $rec->title = trim( $_POST['title'] ); 29 $rec->title = trim( $_POST['title'] );
29 if( ($dbh !== false) && ($rec->complete == 1) ) { 30 if( ($dbh !== false) && ($rec->complete == 1) ) {
30 $title = trim( mysql_real_escape_string($_POST['title'])); 31 $title = trim( mysql_real_escape_string($_POST['title']));
31 $title .= "(".date("Y/m/d", toTimestamp($rec->starttime)).")"; 32 $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 $sqlstr = "update mt_cds_object set dc_title='".$title."' where metadata regexp 'epgrec:id=".$reserve_id."$'";
33 mysql_query( $sqlstr ); 34 @mysql_query( $sqlstr );
34 } 35 }
35 } 36 }
36 37
37 if( isset( $_POST['description'] ) ) { 38 if( isset( $_POST['description'] ) ) {
38 $rec->description = trim( $_POST['description'] ); 39 $rec->description = trim( $_POST['description'] );