changeset 102:49145003e6a3

fix whitespace and new line code
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Mon, 08 Mar 2010 01:08:47 +0900
parents 8ac1bea85c5e
children 368a68c9d579
files DBRecord.class.php Reservation.class.php channelSetSID.php
diffstat 3 files changed, 41 insertions(+), 41 deletions(-) [+]
line wrap: on
line diff
--- a/DBRecord.class.php	Thu Mar 04 17:12:53 2010 +0900
+++ b/DBRecord.class.php	Mon Mar 08 01:08:47 2010 +0900
@@ -5,18 +5,18 @@
 class DBRecord {
 	protected $table;
 	protected $settings;
-	
+
 	protected $dbh;
 	public $id;
-	
+
     function __construct( $table, $property = null, $value = null ) {
 		$this->settings = Settings::factory();
-		
+
 		$this->table = $this->settings->tbl_prefix.$table;
-		
+
 		$this->dbh = @mysql_connect( $this->settings->db_host , $this->settings->db_user, $this->settings->db_pass );
 		if( $this->dbh === FALSE ) throw new exception( "construct:データベースに接続できない" );
-		
+
 		$sqlstr = "use ".$this->settings->db_name;
 		$res = $this->__query($sqlstr);
 		if( $res === false ) throw new exception("construct: " . $sqlstr );
@@ -31,17 +31,17 @@
 			$sqlstr = "SELECT * FROM ".$this->table.
 			            " WHERE ".mysql_real_escape_string( $property ).
 			              "='".mysql_real_escape_string( $value )."'";
-			
+
 			$res = $this->__query( $sqlstr );
 			$arr = mysql_fetch_array( $res , MYSQL_ASSOC );
 			if( $arr === FALSE ) throw new exception( "construct:無効な行" );
 			// 最初にヒットした行のidを使用する
 			$this->id = $arr['id'];
 		}
-		
+
 		return;
 	}
-	
+
 	function createTable( $tblstring ) {
 		$sqlstr = "use ".$this->settings->db_name;
 		$res = $this->__query($sqlstr);
@@ -50,20 +50,20 @@
 		$result = $this->__query( $sqlstr );
 		if( $result === false ) throw new exception( "createTable:テーブル作成失敗" );
 	}
-	
+
 	protected function __query( $sqlstr ) {
 		$res = @mysql_query( $sqlstr, $this->dbh );
 		if( $res === FALSE ) throw new exception( "__query:DBクエリ失敗:".$sqlstr );
 		return $res;
 	}
-	
+
 	function fetch_array( $property , $value, $options = null ) {
 		$retval = array();
-		
+
 		$sqlstr = "SELECT * FROM ".$this->table.
 		            " WHERE ".mysql_real_escape_string( $property ).
 		              "='".mysql_real_escape_string( $value )."'";
-		
+
 		if( $options != null ) {
 			$sqlstr .= "AND ".$options;
 		}
@@ -71,10 +71,10 @@
 		while ($row = mysql_fetch_array($res, MYSQL_ASSOC)) {
 			array_push( $retval, $row );
 		}
-		
+
 		return $retval;
 	}
-	
+
 	function __set( $property, $value ) {
 		if( $property == "id" ) throw new exception( "set:idの変更は不可" );
 		// id = 0なら空の新規レコード作成
@@ -89,27 +89,27 @@
 		$res = $this->__query( $sqlstr );
 		if( $res == FALSE )  throw new exception("set:セット失敗" );
 	}
-	
+
 	function __get( $property ) {
 		if( $this->id == 0 ) throw new exception( "get:無効なid" );
 		if( $property == "id" ) return $this->id;
-		
+
 		$sqlstr = "SELECT ".mysql_real_escape_string($property)." FROM ".$this->table." WHERE id='".$this->id."'";
 		$res = $this->__query($sqlstr);
 		$arr = mysql_fetch_row( $res );
 		if( $arr === FALSE ) throw new exception( "get:".$property."は存在しない" );
-		
+
 		return stripslashes($arr[0]);
 	}
-	
+
 	function delete() {
 		if( $this->id == 0 ) throw new exception( "delete:無効なid" );
-		
+
 		$sqlstr = "DELETE FROM ".$this->table." WHERE id='".$this->id."'";
 		$this->__query( $sqlstr );
 		$this->id = 0;
 	}
-	
+
 	// countを実行する
 	static function countRecords( $table, $options = "" ) {
 		try{
@@ -124,7 +124,7 @@
 		$retval = mysql_fetch_row( $result );
 		return $retval[0];
 	}
-	
+
 	// DBRecordオブジェクトを返すstaticなメソッド
 	static function createRecords( $table, $options = "" ) {
 		$retval = array();
@@ -143,9 +143,9 @@
 		}
 		return $retval;
 	}
-	
+
 	function __destruct() {
 		$this->id = 0;
 	}
 }
-?>
\ No newline at end of file
+?>
--- a/Reservation.class.php	Thu Mar 04 17:12:53 2010 +0900
+++ b/Reservation.class.php	Mon Mar 08 01:08:47 2010 +0900
@@ -79,7 +79,7 @@
 			// 既存予約数 = TUNER番号
 			$tuners = ($crec->type == "GR") ? $settings->gr_tuners : $settings->bs_tuners;
 			$type_str = ($crec->type == "GR") ? "type = 'GR' " : "(type = 'BS' OR type = 'CS') ";
-			
+
 			$battings = DBRecord::countRecords( RESERVE_TBL, "WHERE complete = '0' ".
 															  "AND ".$type_str.
 															  "AND starttime < '".toDatetime($end_time) ."' ".
--- a/channelSetSID.php	Thu Mar 04 17:12:53 2010 +0900
+++ b/channelSetSID.php	Mon Mar 08 01:08:47 2010 +0900
@@ -1,17 +1,17 @@
-<?php
-include_once('config.php');
-include_once( INSTALL_PATH . "/DBRecord.class.php" );
-include_once( INSTALL_PATH . "/Settings.class.php" );
-
-
-if( isset($_POST['sid']) && isset($_POST['channel_disc']) ) {
-	
-	try {
-		$crec = new DBRecord( CHANNEL_TBL, "channel_disc", $_POST['channel_disc'] );
-		$crec->sid = trim($_POST['sid']);
-	}
-	catch( Exception $e ) {
-		// 無視
-	}
-}
-?>
\ No newline at end of file
+<?php
+include_once('config.php');
+include_once( INSTALL_PATH . "/DBRecord.class.php" );
+include_once( INSTALL_PATH . "/Settings.class.php" );
+
+
+if( isset($_POST['sid']) && isset($_POST['channel_disc']) ) {
+
+	try {
+		$crec = new DBRecord( CHANNEL_TBL, "channel_disc", $_POST['channel_disc'] );
+		$crec->sid = trim($_POST['sid']);
+	}
+	catch( Exception $e ) {
+		// 無視
+	}
+}
+?>