Mercurial > epgrec.yaz
changeset 39:8965ef108821
change: modify all scripts for web base setting.
author | Sushi-k <epgrec@park.mda.or.jp> |
---|---|
date | Tue, 28 Jul 2009 11:50:04 +0900 |
parents | 2bc96d657ba1 |
children | a935b4789aff |
files | DBRecord.class.php Keyword.class.php Reservation.class.php customReservation.php getepg.php initdb.php keywordTable.php programTable.php recomplete.php recordedTable.php reservation.php reservationTable.php reservationform.php sendstream.php templates/reservation.html viewer.php |
diffstat | 16 files changed, 86 insertions(+), 303 deletions(-) [+] |
line wrap: on
line diff
--- a/DBRecord.class.php Tue Jul 28 10:49:55 2009 +0900 +++ b/DBRecord.class.php Tue Jul 28 11:50:04 2009 +0900 @@ -4,19 +4,20 @@ class DBRecord { protected $table; + protected $settings; protected $dbh; public $id; function __construct( $table, $property = null, $value = null ) { - $settings = Settings::factory(); + $this->settings = Settings::factory(); - $this->table = $settings->tbl_prefix.$table; + $this->table = $this->settings->tbl_prefix.$table; - $this->dbh = @mysql_connect( $settings->db_host , $settings->db_user, $settings->db_pass ); + $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 ".$settings->db_name; + $sqlstr = "use ".$this->settings->db_name; $res = $this->__query($sqlstr); if( $res === false ) throw new exception("construct: " . $sqlstr ); $sqlstr = "set NAMES utf8"; @@ -42,9 +43,7 @@ } function createTable( $tblstring ) { - $settings = Settings::factory(); - - $sqlstr = "use ".$settings->db_name; + $sqlstr = "use ".$this->settings->db_name; $res = $this->__query($sqlstr); if( $res === false ) throw new exception("createTable: " . $sqlstr ); $sqlstr = "CREATE TABLE IF NOT EXISTS ".$this->table." (" .$tblstring.") DEFAULT CHARACTER SET 'utf8'";
--- a/Keyword.class.php Tue Jul 28 10:49:55 2009 +0900 +++ b/Keyword.class.php Tue Jul 28 11:50:04 2009 +0900 @@ -7,11 +7,7 @@ class Keyword extends DBRecord { - protected $settings; - public function __construct($property = null, $value = null ) { - $this->settings = Settings::factory(); - try { parent::__construct(KEYWORD_TBL, $property, $value ); }
--- a/Reservation.class.php Tue Jul 28 10:49:55 2009 +0900 +++ b/Reservation.class.php Tue Jul 28 11:50:04 2009 +0900 @@ -2,15 +2,18 @@ include_once('config.php'); include_once( INSTALL_PATH . "/DBRecord.class.php" ); include_once( INSTALL_PATH . "/reclib.php" ); +include_once( INSTALL_PATH . "/Settings.class.php" ); + // 予約クラス class Reservation { public static function simple( $program_id , $autorec = 0, $mode = 0) { + $settings = Settings::factory(); $rval = 0; try { - $prec = new DBRecord( TBL_PREFIX.PROGRAM_TBL, "id", $program_id ); + $prec = new DBRecord( PROGRAM_TBL, "id", $program_id ); $rval = self::custom( $prec->starttime, @@ -42,21 +45,22 @@ $mode = 0 // 録画モード ) { global $RECORD_MODE; - + $settings = Settings::factory(); + // 時間を計算 $start_time = toTimestamp( $starttime ); - $end_time = toTimestamp( $endtime ) + EXTRA_TIME; + $end_time = toTimestamp( $endtime ) + $settings->extra_time; if( $start_time < (time() + PADDING_TIME + 10) ) { // 現在時刻より3分先より小さい=すでに開始されている番組 $start_time = time() + PADDING_TIME + 10; // 録画開始時間を3分10秒先に設定する } $at_start = $start_time - PADDING_TIME; - $sleep_time = PADDING_TIME - FORMER_TIME; - $rec_start = $start_time - FORMER_TIME; + $sleep_time = PADDING_TIME - $settings->former_time; + $rec_start = $start_time - $settings->former_time; // durationを計算しておく $duration = $end_time - $rec_start; - if( $duration < (FORMER_TIME + 60) ) { // 60秒以下の番組は弾く + if( $duration < ($settings->former_time + 60) ) { // 60秒以下の番組は弾く throw new Exception( "終わりつつある/終わっている番組です" ); } @@ -64,20 +68,20 @@ try { // 同一番組予約チェック if( $program_id ) { - $num = DBRecord::countRecords( TBL_PREFIX.RESERVE_TBL, "WHERE program_id = '".$program_id."'" ); + $num = DBRecord::countRecords( RESERVE_TBL, "WHERE program_id = '".$program_id."'" ); if( $num ) { throw new Exception("同一の番組が録画予約されています"); } } - $crec = new DBRecord( TBL_PREFIX.CHANNEL_TBL, "id", $channel_id ); + $crec = new DBRecord( CHANNEL_TBL, "id", $channel_id ); // 既存予約数 = TUNER番号 - $tuners = ($crec->type == "GR") ? GR_TUNERS : BS_TUNERS; - $battings = DBRecord::countRecords( TBL_PREFIX.RESERVE_TBL, "WHERE complete = '0' ". - "AND type = '".$crec->type."' ". - "AND starttime < '".toDatetime($end_time) ."' ". - "AND endtime > '".toDatetime($rec_start)."'" + $tuners = ($crec->type == "GR") ? $settings->gr_tuners : $settings->bs_tuners; + $battings = DBRecord::countRecords( RESERVE_TBL, "WHERE complete = '0' ". + "AND type = '".$crec->type."' ". + "AND starttime < '".toDatetime($end_time) ."' ". + "AND endtime > '".toDatetime($rec_start)."'" ); if( $battings >= $tuners ) { @@ -85,13 +89,13 @@ if( FORCE_CONT_REC ) { // 解消可能な重複かどうかを調べる // 前後の予約数 - $nexts = DBRecord::countRecords( TBL_PREFIX.RESERVE_TBL, "WHERE complete = '0' ". - "AND type = '".$crec->type."' ". - "AND starttime = '".toDatetime($end_time - FORMER_TIME)."'"); + $nexts = DBRecord::countRecords( RESERVE_TBL, "WHERE complete = '0' ". + "AND type = '".$crec->type."' ". + "AND starttime = '".toDatetime($end_time - $settings->former_time)."'"); - $prevs = DBRecord::countRecords( TBL_PREFIX.RESERVE_TBL, "WHERE complete = '0' ". - "AND type = '".$crec->type."' ". - "AND endtime = '".$starttime."'" ); + $prevs = DBRecord::countRecords( RESERVE_TBL, "WHERE complete = '0' ". + "AND type = '".$crec->type."' ". + "AND endtime = '".$starttime."'" ); // 前後を引いてもチューナー数と同数以上なら重複の解消は無理 if( ($battings - $nexts - $prevs) >= $tuners ) @@ -100,15 +104,15 @@ // 直後の番組はあるか? if( $nexts ) { // この番組の終わりをちょっとだけ早める - $end_time = $end_time - FORMER_TIME - REC_SWITCH_TIME; + $end_time = $end_time - $settings->former_time - $settings->rec_switch_time; $duration = $end_time - $rec_start; // durationを計算しなおす } $battings -= $nexts; // 直前の録画予約を見付ける - $trecs = DBRecord::createRecords(TBL_PREFIX.RESERVE_TBL, "WHERE complete = '0' ". - "AND type = '".$crec->type."' ". - "AND endtime = '".$starttime."'" ); + $trecs = DBRecord::createRecords(RESERVE_TBL, "WHERE complete = '0' ". + "AND type = '".$crec->type."' ". + "AND endtime = '".$starttime."'" ); // 直前の番組をずらす for( $i = 0; $i < count($trecs) ; $i++ ) { if( $battings < $tuners ) break; // 解消終了のハズ? @@ -126,11 +130,11 @@ $prev_start_time = toTimestamp($prev_starttime); // 始まっていない予約? - if( $prev_start_time > (time() + PADDING_TIME + FORMER_TIME) ) { + if( $prev_start_time > (time() + PADDING_TIME + $settings->former_time) ) { // 開始時刻を元に戻す - $prev_starttime = toDatetime( $prev_start_time + FORMER_TIME ); + $prev_starttime = toDatetime( $prev_start_time + $settings->former_time ); // 終わりをちょっとだけずらす - $prev_endtime = toDatetime( toTimestamp($prev_endtime) - FORMER_TIME - REC_SWITCH_TIME ); + $prev_endtime = toDatetime( toTimestamp($prev_endtime) - $settings->former_time - $settings->rec_switch_time ); // tryのネスト try { @@ -168,7 +172,7 @@ $tuner = $battings; // 改めてdurationをチェックしなおす - if( $duration < (FORMER_TIME + 60) ) { // 60秒以下の番組は弾く + if( $duration < ($settings->former_time + 60) ) { // 60秒以下の番組は弾く throw new Exception( "終わりつつある/終わっている番組です" ); } @@ -192,10 +196,8 @@ */ $day_of_week = array( "日","月","火","水","木","金","土" ); - $filename = "%TYPE%%CH%_%ST%_%ET%"; - if( defined( "FILENAME_FORMAT" ) ) { - $filename = FILENAME_FORMAT; - } + $filename = $settings->filename_format; + // あると面倒くさそうな文字を全部_に $fn_title = mb_ereg_replace("[ \./\*:<>\?\\|()\'\"&]","_", trim($title) ); @@ -237,7 +239,7 @@ // ファイル名生成終了 // 予約レコードを埋める - $rrec = new DBRecord( TBL_PREFIX.RESERVE_TBL ); + $rrec = new DBRecord( RESERVE_TBL ); $rrec->channel_disc = $crec->channel_disc; $rrec->channel_id = $crec->id; $rrec->program_id = $program_id; @@ -254,28 +256,28 @@ $rrec->reserve_disc = md5( $crec->channel_disc . toDatetime( $start_time ). toDatetime( $end_time ) ); // 予約実行 - $cmdline = AT." ".date("H:i m/d/Y", $at_start); + $cmdline = $settings->at." ".date("H:i m/d/Y", $at_start); $descriptor = array( 0 => array( "pipe", "r" ), 1 => array( "pipe", "w" ), 2 => array( "pipe", "w" ), ); $env = array( "CHANNEL" => $crec->channel, "DURATION" => $duration, - "OUTPUT" => INSTALL_PATH.SPOOL."/".$filename, + "OUTPUT" => INSTALL_PATH.$settings->spool."/".$filename, "TYPE" => $crec->type, "TUNER" => $tuner, "MODE" => $mode, ); // ATで予約する - $process = proc_open( $cmdline , $descriptor, $pipes, SPOOL, $env ); + $process = proc_open( $cmdline , $descriptor, $pipes, INSTALL_PATH.$settings->spool, $env ); if( is_resource( $process ) ) { - fwrite($pipes[0], SLEEP." ".$sleep_time."\n" ); + fwrite($pipes[0], $settings->sleep." ".$sleep_time."\n" ); fwrite($pipes[0], DO_RECORD . "\n" ); fwrite($pipes[0], COMPLETE_CMD." ".$rrec->id."\n" ); - if( USE_THUMBS ) { + if( $settings->use_thumbs ) { // サムネール生成 - $ffmpeg_cmd = FFMPEG." -i \${OUTPUT} -r 1 -s 160x90 -ss ".(FORMER_TIME+2)." -vframes 1 -f image2 ".INSTALL_PATH.THUMBS."/".$filename.".jpg\n"; + $ffmpeg_cmd = $settings->ffmpeg." -i \${OUTPUT} -r 1 -s 160x90 -ss ".($settings->former_time + 2)." -vframes 1 -f image2 ".INSTALL_PATH.$settings->thumbs."/".$filename.".jpg\n"; fwrite($pipes[0], $ffmpeg_cmd ); } fclose($pipes[0]); @@ -321,23 +323,24 @@ // 取り消し public static function cancel( $reserve_id = 0, $program_id = 0 ) { + $settings = Settings::factory(); $rec = null; try { if( $reserve_id ) { - $rec = new DBRecord( TBL_PREFIX.RESERVE_TBL, "id" , $reserve_id ); + $rec = new DBRecord( RESERVE_TBL, "id" , $reserve_id ); } else if( $program_id ) { - $rec = new DBRecord( TBL_PREFIX.RESERVE_TBL, "program_id" , $program_id ); + $rec = new DBRecord( RESERVE_TBL, "program_id" , $program_id ); } if( $rec == null ) { throw new Exception("IDの指定が無効です"); } if( ! $rec->complete ) { // 未実行の予約である - if( toTimestamp($rec->starttime) < (time() + PADDING_TIME + FORMER_TIME) ) + if( toTimestamp($rec->starttime) < (time() + PADDING_TIME + $settings->former_time) ) throw new Exception("過去の録画予約です"); - exec( ATRM . " " . $rec->job ); + exec( $settings->atrm . " " . $rec->job ); } $rec->delete(); }
--- a/customReservation.php Tue Jul 28 10:49:55 2009 +0900 +++ b/customReservation.php Tue Jul 28 11:50:04 2009 +0900 @@ -7,7 +7,6 @@ $settings = Settings::factory(); - $program_id = 0; if( isset( $_POST['program_id'] ) ) $program_id = $_POST['program_id'];
--- a/getepg.php Tue Jul 28 10:49:55 2009 +0900 +++ b/getepg.php Tue Jul 28 11:50:04 2009 +0900 @@ -88,7 +88,7 @@ $num = DBRecord::countRecords( CHANNEL_TBL , "WHERE channel_disc = '" . $disc ."'" ); if( $num == 0 ) { // チャンネルデータがないなら新規作成 - $rec = new DBRecord( CHANNEL_TBL ); + $rec = new DBRecord( CHANNEL_TBL ); $rec->type = $type; $rec->channel = $map["$disc"]; $rec->channel_disc = $disc;
--- a/initdb.php Tue Jul 28 10:49:55 2009 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -#!/usr/bin/php -<?php - - require_once( "config.php" ); - require_once( INSTALL_PATH. "/DBRecord.class.php" ); - -/* - $dbh = @mysql_connect( DB_HOST, DB_USER, DB_PASS ); - if( $dbh === false ) { - exit("Can't connect DB\n" ); - } - - $sqlstr = "CREATE DATABASE IF NOT EXISTS ".DB_NAME; - $result = mysql_query( $sqlstr ); - if( $result === false ) { - exit( "Quary error\n" ); - } -*/ - try { - $rec = new DBRecord( TBL_PREFIX . RESERVE_TBL ); - $rec->createTable( RESERVE_STRUCT ); - - $rec = new DBRecord( TBL_PREFIX . PROGRAM_TBL ); - $rec->createTable( PROGRAM_STRUCT ); - - $rec = new DBRecord( TBL_PREFIX . CHANNEL_TBL ); - $rec->createTable( CHANNEL_STRUCT ); - - $rec = new DBRecord( TBL_PREFIX . CATEGORY_TBL ); - $rec->createTable( CATEGORY_STRUCT ); - - $rec = new DBRecord( TBL_PREFIX . KEYWORD_TBL ); - $rec->createTable( KEYWORD_STRUCT ); - } - catch( Exception $e ) { - exit( $e->getMessage() ); - } - exit( "Complete!\n"); -?>
--- a/keywordTable.php Tue Jul 28 10:49:55 2009 +0900 +++ b/keywordTable.php Tue Jul 28 11:50:04 2009 +0900 @@ -5,6 +5,7 @@ include_once( INSTALL_PATH . "/reclib.php" ); include_once( INSTALL_PATH . "/Reservation.class.php" ); include_once( INSTALL_PATH . "/Keyword.class.php" ); +// include_once( INSTALL_PATH . "/Settings.class.php" ); // 新規キーワードがポストされた
--- a/programTable.php Tue Jul 28 10:49:55 2009 +0900 +++ b/programTable.php Tue Jul 28 11:50:04 2009 +0900 @@ -97,14 +97,14 @@ $types[0]['name'] = "すべて"; $types[0]['value'] = "*"; $types[0]['selected'] = $type == "*" ? "selected" : ""; - if( GR_TUNERS ) { + if( $settings->gr_tuners ) { $arr = array(); $arr['name'] = "GR"; $arr['value'] = "GR"; $arr['selected'] = $type == "GR" ? "selected" : ""; array_push( $types, $arr ); } - if( BS_TUNERS ) { + if( $settings->bs_tuners ) { $arr = array(); $arr['name'] = "BS"; $arr['value'] = "BS";
--- a/recomplete.php Tue Jul 28 10:49:55 2009 +0900 +++ b/recomplete.php Tue Jul 28 11:50:04 2009 +0900 @@ -6,7 +6,6 @@ $settings = Settings::factory(); - $reserve_id = $argv[1]; try{ @@ -42,4 +41,4 @@ exit( $e->getMessage() ); } -?> +?> \ No newline at end of file
--- a/recordedTable.php Tue Jul 28 10:49:55 2009 +0900 +++ b/recordedTable.php Tue Jul 28 11:50:04 2009 +0900 @@ -2,6 +2,10 @@ include_once('config.php'); include_once( INSTALL_PATH . '/DBRecord.class.php' ); include_once( INSTALL_PATH . '/Smarty/Smarty.class.php' ); +include_once( INSTALL_PATH . '/Settings.class.php' ); + +$settings = Settings::factory(); + $order = ""; $search = ""; @@ -9,7 +13,7 @@ $station = 0; // mysql_real_escape_stringより先に接続しておく必要がある -$dbh = @mysql_connect( DB_HOST, DB_USER, DB_PASS ); +$dbh = @mysql_connect( $settings->db_host, $settings->db_user, $settings->db_pass ); #$options = "WHERE complete='1'"; $options = "WHERE starttime < '". date("Y-m-d H:i:s")."'"; // ながら再生は無理っぽい? @@ -39,27 +43,27 @@ $options .= " ORDER BY starttime DESC"; try{ - $rvs = DBRecord::createRecords(TBL_PREFIX.RESERVE_TBL, $options ); + $rvs = DBRecord::createRecords(RESERVE_TBL, $options ); $records = array(); foreach( $rvs as $r ) { - $cat = new DBRecord(TBL_PREFIX.CATEGORY_TBL, "id", $r->category_id ); - $ch = new DBRecord(TBL_PREFIX.CHANNEL_TBL, "id", $r->channel_id ); + $cat = new DBRecord(CATEGORY_TBL, "id", $r->category_id ); + $ch = new DBRecord(CHANNEL_TBL, "id", $r->channel_id ); $arr = array(); $arr['id'] = $r->id; $arr['station_name'] = $ch->name; $arr['starttime'] = $r->starttime; $arr['endtime'] = $r->endtime; - $arr['asf'] = "".INSTALL_URL."/viewer.php?reserve_id=".$r->id; + $arr['asf'] = "".$settings->install_url."/viewer.php?reserve_id=".$r->id; $arr['title'] = htmlspecialchars($r->title,ENT_QUOTES); $arr['description'] = htmlspecialchars($r->description,ENT_QUOTES); - $arr['thumb'] = "<img src=\"".INSTALL_URL.THUMBS."/".$r->path.".jpg\" />"; + $arr['thumb'] = "<img src=\"".$settings->install_url.$settings->thumbs."/".$r->path.".jpg\" />"; $arr['cat'] = $cat->name_en; $arr['mode'] = $RECORD_MODE[$r->mode]['name']; array_push( $records, $arr ); } - $crecs = DBRecord::createRecords(TBL_PREFIX.CATEGORY_TBL ); + $crecs = DBRecord::createRecords(CATEGORY_TBL ); $cats = array(); $cats[0]['id'] = 0; $cats[0]['name'] = "すべて"; @@ -72,7 +76,7 @@ array_push( $cats, $arr ); } - $crecs = DBRecord::createRecords(TBL_PREFIX.CHANNEL_TBL ); + $crecs = DBRecord::createRecords(CHANNEL_TBL ); $stations = array(); $stations[0]['id'] = 0; $stations[0]['name'] = "すべて"; @@ -92,7 +96,7 @@ $smarty->assign( "search", $search ); $smarty->assign( "stations", $stations ); $smarty->assign( "cats", $cats ); - $smarty->assign( "use_thumbs", USE_THUMBS ); + $smarty->assign( "use_thumbs", $settings->use_thumbs ); $smarty->display("recordedTable.html"); @@ -101,4 +105,4 @@ catch( exception $e ) { exit( $e->getMessage() ); } -?> +?> \ No newline at end of file
--- a/reservation.php Tue Jul 28 10:49:55 2009 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ -<?php -include_once('config.php'); -include_once( INSTALL_PATH . "/DBRecord.class.php" ); -include_once( INSTALL_PATH . "/Smarty/Smarty.class.php" ); -include_once( INSTALL_PATH . "/reclib.php" ); - -if( ! isset( $_GET['program_id'] ) ) exit("Error: 番組IDが指定されていません" ); -$program_id = $_GET['program_id']; - -try { - $prec = new DBRecord( TBL_PREFIX.PROGRAM_TBL, "id", $program_id ); - - sscanf( $prec->starttime, "%4d-%2d-%2d %2d:%2d:%2d", $syear, $smonth, $sday, $shour, $smin, $ssec ); - sscanf( $prec->endtime, "%4d-%2d-%2d %2d:%2d:%2d", $eyear, $emonth, $eday, $ehour, $emin, $esec ); - - $crecs = DBRecord::createRecords( TBL_PREFIX.CATEGORY_TBL ); - $cats = array(); - foreach( $crecs as $crec ) { - $cat = array(); - $cat['id'] = $crec->id; - $cat['name'] = $crec->name_jp; - $cat['selected'] = $prec->category_id == $cat['id'] ? "selected" : ""; - - array_push( $cats , $cat ); - } - - $smarty = new Smarty(); - - $smarty->assign( "syear", $syear ); - $smarty->assign( "smonth", $smonth ); - $smarty->assign( "sday", $sday ); - $smarty->assign( "shour", $shour ); - $smarty->assign( "smin" ,$smin ); - $smarty->assign( "eyear", $eyear ); - $smarty->assign( "emonth", $emonth ); - $smarty->assign( "eday", $eday ); - $smarty->assign( "ehour", $ehour ); - $smarty->assign( "emin" ,$emin ); - - $smarty->assign( "type", $prec->type ); - $smarty->assign( "channel", $prec->channel ); - $smarty->assign( "channel_id", $prec->channel_id ); - $smarty->assign( "record_mode" , $RECORD_MODE ); - - $smarty->assign( "title", $prec->title ); - $smarty->assign( "description", $prec->description ); - - $smarty->assign( "cats" , $cats ); - - $smarty->assign( "program_id", $prec->id ); - - $smarty->assign( "sitetitle" , "詳細予約" ); - - $smarty->display("reservation.html"); -} -catch( exception $e ) { - exit( "Error:". $e->getMessage() ); -} -?>
--- a/reservationTable.php Tue Jul 28 10:49:55 2009 +0900 +++ b/reservationTable.php Tue Jul 28 11:50:04 2009 +0900 @@ -4,11 +4,11 @@ include_once( INSTALL_PATH . '/Smarty/Smarty.class.php' ); try{ - $rvs = DBRecord::createRecords(TBL_PREFIX.RESERVE_TBL, "WHERE complete='0' ORDER BY starttime ASC" ); + $rvs = DBRecord::createRecords(RESERVE_TBL, "WHERE complete='0' ORDER BY starttime ASC" ); $reservations = array(); foreach( $rvs as $r ) { - $cat = new DBRecord(TBL_PREFIX.CATEGORY_TBL, "id", $r->category_id ); + $cat = new DBRecord(CATEGORY_TBL, "id", $r->category_id ); $arr = array(); $arr['id'] = $r->id; $arr['type'] = $r->type;
--- a/reservationform.php Tue Jul 28 10:49:55 2009 +0900 +++ b/reservationform.php Tue Jul 28 11:50:04 2009 +0900 @@ -8,12 +8,12 @@ $program_id = $_GET['program_id']; try { - $prec = new DBRecord( TBL_PREFIX.PROGRAM_TBL, "id", $program_id ); + $prec = new DBRecord( PROGRAM_TBL, "id", $program_id ); sscanf( $prec->starttime, "%4d-%2d-%2d %2d:%2d:%2d", $syear, $smonth, $sday, $shour, $smin, $ssec ); sscanf( $prec->endtime, "%4d-%2d-%2d %2d:%2d:%2d", $eyear, $emonth, $eday, $ehour, $emin, $esec ); - $crecs = DBRecord::createRecords( TBL_PREFIX.CATEGORY_TBL ); + $crecs = DBRecord::createRecords( CATEGORY_TBL ); $cats = array(); foreach( $crecs as $crec ) { $cat = array();
--- a/sendstream.php Tue Jul 28 10:49:55 2009 +0900 +++ b/sendstream.php Tue Jul 28 11:50:04 2009 +0900 @@ -9,13 +9,16 @@ 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( $_GET['reserve_id'] )) jdialog("予約番号が指定されていません", "recordedTable.php"); $reserve_id = $_GET['reserve_id']; try{ - $rrec = new DBRecord( TBL_PREFIX.RESERVE_TBL, "id", $reserve_id ); + $rrec = new DBRecord( RESERVE_TBL, "id", $reserve_id ); $start_time = toTimestamp($rrec->starttime); $end_time = toTimestamp($rrec->endtime ); @@ -30,7 +33,7 @@ ob_clean(); flush(); - $fp = @fopen( INSTALL_PATH.SPOOL."/".$rrec->path, "r" ); + $fp = @fopen( INSTALL_PATH.$settings->spool."/".$rrec->path, "r" ); if( $fp !== false ) { ob_start(null,4096); $status = array();
--- a/templates/reservation.html Tue Jul 28 10:49:55 2009 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,126 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" -"http://www.w3.org/TR/html4/loose.dtd"> - -<html> -<head> -<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> -<title>{$sitetitle}</title> -<meta http-equiv="Content-Style-Type" content="text/css"> - -{literal} - - -<style type="text/css"> -<!-- -body {padding:4px;margin:0;font-size:10pt;} -a {text-decoration:none;} - -table#reservation_table { - width: 640px; - border: 1px #BBB solid; - border-collapse: collapse; - border-spacing: 0; -} - -table#reservation_table th { - padding: 5px; - border: #E3E3E3 solid; - border-width: 0 0 1px 1px; - background: #BBB; - font-weight: bold; - line-height: 120%; - text-align: center; -} -table#reservation_table td { - padding: 5px; - border: 1px #BBB solid; - border-width: 0 0 1px 1px; - text-align: left; -} - -table#reservation_table tr.ctg_news, #category_select a.ctg_news {background-color: #FFFFD8;} -table#reservation_table tr.ctg_etc, #category_select a.ctg_etc {background-color: #FFFFFF;} -table#reservation_table tr.ctg_information, #category_select a.ctg_information {background-color: #F2D8FF;} -table#reservation_table tr.ctg_sports, #category_select a.ctg_sports {background-color: #D8FFFF;} -table#reservation_table tr.ctg_cinema, #category_select a.ctg_cinema {background-color: #FFD8D8;} -table#reservation_table tr.ctg_music, #category_select a.ctg_music {background-color: #D8D8FF;} -table#reservation_table tr.ctg_drama, #category_select a.ctg_drama {background-color: #D8FFD8;} -table#reservation_table tr.ctg_anime, #category_select a.ctg_anime {background-color: #FFE4C8;} -table#reservation_table tr.ctg_variety, #category_select a.ctg_variety {background-color: #FFD2EB;} -table#reservation_table tr.ctg_10, #category_select a.ctg_10 {background-color: #E4F4F4;} - - ---> -</style> - -{/literal} - -</head> -<body> - -<h2>{$sitetitle}</h2> -<p><a href="index.php">予約せずに番組表に戻る</a></p> - -<form method="post" action="customReservation.php"> - <table id="reservation_table"> - <tr> - <th>開始日時</th> - <td><input type="text" size="4" name="syear" value="{$syear}" />年 - <input type="text" size="2" name="smonth" value="{$smonth}" />月 - <input type="text" size="2" name="sday" value="{$sday}" />日 - <input type="text" size="2" name="shour" value="{$shour}" />時 - <input type="text" size="2" name="smin" value="{$smin}" />分~ - </td> - </tr> - <tr> - <th>終了日時</th> - <td><input type="text" size="4" name="eyear" value="{$eyear}" />年 - <input type="text" size="2" name="emonth" value="{$emonth}" />月 - <input type="text" size="2" name="eday" value="{$eday}" />日 - <input type="text" size="2" name="ehour" value="{$ehour}" />時 - <input type="text" size="2" name="emin" value="{$emin}" />分 - </td> - </tr> - <tr> - <th>種別/ch</th> - <td>{$type}:{$channel}ch - <input type="hidden" name="channel_id" value="{$channel_id}" /> - </td> - </tr> - <tr> - <th>録画モード</th> - <td><select name="record_mode"> - {section name=mode loop=$record_mode } - <option value="{$smarty.section.mode.index}">{$record_mode[mode].name}</option> - {/section} - </select> - </td> - </tr> - <tr> - <th>タイトル</th> - <td><input type="text" size="80" name="title" value="{$title}" /></td> - </tr> - <tr> - <th>概要</th> - <td><textarea name="description" rows="4" cols="40" >{$description}</textarea></td> - </tr> - <tr> - <th>カテゴリ</th> - <td> - <select name="category_id"> - {foreach from=$cats item=cat} - <option value="{$cat.id}" {$cat.selected}>{$cat.name}</option> - {/foreach} - </select> - </td> - </tr> - <tr> - <th>番組ID保持</th> - <td><input type="checkbox" name="program_id" value="{$program_id}" checked /></td> - </tr> -</table> -<input type="submit" value="予約する" /> -</form> - -</body> -</html>
--- a/viewer.php Tue Jul 28 10:49:55 2009 +0900 +++ b/viewer.php Tue Jul 28 11:50:04 2009 +0900 @@ -9,16 +9,19 @@ 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( $_GET['reserve_id'] )) jdialog("予約番号が指定されていません", "recordedTable.php"); $reserve_id = $_GET['reserve_id']; try{ - $rrec = new DBRecord( TBL_PREFIX.RESERVE_TBL, "id", $reserve_id ); + $rrec = new DBRecord( RESERVE_TBL, "id", $reserve_id ); $start_time = toTimestamp($rrec->starttime); $end_time = toTimestamp($rrec->endtime ); - $duration = $end_time - $start_time + FORMER_TIME; + $duration = $end_time - $start_time + $settings->former_time; $dh = $duration / 3600; $duration = $duration % 3600; @@ -34,8 +37,8 @@ echo "<ASX version = \"3.0\">"; echo "<PARAM NAME = \"Encoding\" VALUE = \"UTF-8\" />"; echo "<ENTRY>"; - echo "<REF HREF=\"".INSTALL_URL."/sendstream.php?reserve_id=".$rrec->id ."\" />"; - echo "<REF HREF=\"".INSTALL_URL.SPOOL."/".$rrec->path ."\" />"; + echo "<REF HREF=\"".$settings->install_url."/sendstream.php?reserve_id=".$rrec->id ."\" />"; + echo "<REF HREF=\"".$settings->install_url.SPOOL."/".$rrec->path ."\" />"; echo "<TITLE>".$title."</TITLE>"; echo "<ABSTRACT>".$abstract."</ABSTRACT>"; echo "<DURATION VALUE=";