Index: trunk/install/php/listreserve.php =================================================================== --- trunk/install/php/listreserve.php (リビジョン 128) +++ trunk/install/php/listreserve.php (リビジョン 1) @@ -10,33 +10,9 @@ 引数 -r:録画デバイス数 -startdate:特定日付からの予約状況。YYYYmmddHHii形式で。表示数に限定かけてないのでレコード数が大量になると重くなるかも知れません。 - +なし DCC-JPL Japan/foltia project - -History - -2009/5/1 -重複予約検出処理の修正 http://www.dcc-jpl.com/foltia/ticket/7 -パッチ適用 */ - -include("./foltialib.php"); -$con = m_connect(); - -if ($useenvironmentpolicy == 1){ - if (!isset($_SERVER['PHP_AUTH_USER'])) { - header("WWW-Authenticate: Basic realm=\"foltia\""); - header("HTTP/1.0 401 Unauthorized"); - redirectlogin(); - exit; - } else { - login($con,$_SERVER['PHP_AUTH_USER'],$_SERVER['PHP_AUTH_PW']); - } -}//end if login -$userclass = getuserclass($con); - ?> @@ -50,33 +26,38 @@ 200501010000){ -}else{ - $now = date("YmdHi"); -} + + include("./foltialib.php"); + +$con = m_connect(); + +$now = date("YmdHi"); + $query = " SELECT - foltia_program.tid, stationname, foltia_program.title, - foltia_subtitle.countno, foltia_subtitle.subtitle, - foltia_subtitle.startdatetime as x, foltia_subtitle.lengthmin, - foltia_tvrecord.bitrate, foltia_subtitle.startoffset, - foltia_subtitle.pid, foltia_subtitle.epgaddedby, -foltia_tvrecord.digital +foltia_program .tid, +stationname, +foltia_program .title, +foltia_subtitle.countno, +foltia_subtitle.subtitle, +foltia_subtitle.startdatetime , +foltia_subtitle.lengthmin , +foltia_tvrecord.bitrate , +foltia_subtitle.startoffset , +foltia_subtitle.pid FROM foltia_subtitle , foltia_program ,foltia_station ,foltia_tvrecord WHERE foltia_tvrecord.tid = foltia_program.tid AND foltia_tvrecord.stationid = foltia_station .stationid AND foltia_program.tid = foltia_subtitle.tid AND foltia_station.stationid = foltia_subtitle.stationid -AND foltia_subtitle.enddatetime >= ? +AND foltia_subtitle.enddatetime >= '$now' UNION SELECT - foltia_program.tid, stationname, foltia_program.title, - foltia_subtitle.countno, foltia_subtitle.subtitle, - foltia_subtitle.startdatetime, foltia_subtitle.lengthmin, - foltia_tvrecord.bitrate, foltia_subtitle.startoffset, - foltia_subtitle.pid, foltia_subtitle.epgaddedby, -foltia_tvrecord.digital +foltia_program .tid, +stationname, +foltia_program .title, +foltia_subtitle.countno, +foltia_subtitle.subtitle, +foltia_subtitle.startdatetime , +foltia_subtitle.lengthmin , +foltia_tvrecord.bitrate , +foltia_subtitle.startoffset , +foltia_subtitle.pid FROM foltia_tvrecord LEFT OUTER JOIN foltia_subtitle on (foltia_tvrecord.tid = foltia_subtitle.tid ) @@ -84,18 +65,13 @@ LEFT OUTER JOIN foltia_station on (foltia_subtitle.stationid = foltia_station.stationid ) WHERE foltia_tvrecord.stationid = 0 AND - foltia_subtitle.enddatetime >= ? ORDER BY x ASC +foltia_subtitle.enddatetime >= '$now' ORDER BY \"startdatetime\" ASC "; -// $rs = m_query($con, $query, "DBクエリに失敗しました"); - $rs = sql_query($con, $query, "DBクエリに失敗しました",array($now,$now)); - -//チューナー数 -if (getgetnumform(r) != ""){ - $recunits = getgetnumform(r); -}elseif($recunits == ""){ - $recunits = 2; -} - -?> + $rs = m_query($con, $query, "DBクエリに失敗しました"); + $maxrows = pg_num_rows($rs); + +?> + + @@ -108,11 +84,12 @@

録画予約番組放映予定と予約番組名を表示します。

-fetch(); - if (! $rowdata) { +\n"; }else{ + + /* フィールド数 */ - $maxcols = $rs->columnCount(); + $maxcols = pg_num_fields($rs); ?> @@ -124,8 +101,7 @@ - + - @@ -135,136 +111,14 @@ \n"); - + /* pg_fetch_row で一行取り出す */ + $rowdata = pg_fetch_row($rs, $row); $pid = htmlspecialchars($rowdata[9]); $tid = htmlspecialchars($rowdata[0]); $title = htmlspecialchars($rowdata[2]); -$subtitle = htmlspecialchars($rowdata[4]); -$dbepgaddedby = htmlspecialchars($rowdata[10]); - -//重複検出 -//開始時刻 $rowdata[5] -//終了時刻 -$endtime = calcendtime($rowdata[5],$rowdata[6]); -//番組の開始時刻より遅い時刻に終了し、終了時刻より前にはじまる番組があるかどうか -//オンボードチューナー録画 -$query = " -SELECT - foltia_program.tid, stationname, foltia_program.title, - foltia_subtitle.countno, foltia_subtitle.subtitle, - foltia_subtitle.startdatetime, foltia_subtitle.lengthmin, - foltia_tvrecord.bitrate, foltia_subtitle.startoffset, - foltia_subtitle.pid, foltia_tvrecord.digital -FROM foltia_subtitle , foltia_program ,foltia_station ,foltia_tvrecord -WHERE foltia_tvrecord.tid = foltia_program.tid AND foltia_tvrecord.stationid = foltia_station .stationid AND foltia_program.tid = foltia_subtitle.tid AND foltia_station.stationid = foltia_subtitle.stationid -AND foltia_subtitle.enddatetime > ? -AND foltia_subtitle.startdatetime < ? -UNION -SELECT - foltia_program.tid, stationname, foltia_program.title, - foltia_subtitle.countno, foltia_subtitle.subtitle, - foltia_subtitle.startdatetime, foltia_subtitle.lengthmin, - foltia_tvrecord.bitrate, foltia_subtitle.startoffset, - foltia_subtitle.pid, foltia_tvrecord.digital -FROM foltia_tvrecord -LEFT OUTER JOIN foltia_subtitle on (foltia_tvrecord.tid = foltia_subtitle.tid ) -LEFT OUTER JOIN foltia_program on (foltia_tvrecord.tid = foltia_program.tid ) -LEFT OUTER JOIN foltia_station on (foltia_subtitle.stationid = foltia_station.stationid ) -WHERE foltia_tvrecord.stationid = 0 AND -foltia_subtitle.enddatetime > ? -AND foltia_subtitle.startdatetime < ? -"; - $rclass = ""; -// $overlap = m_query($con, $query, "DBクエリに失敗しました"); - $overlap = sql_query($con, $query, "DBクエリに失敗しました",array($rowdata[5],$endtime,$rowdata[5],$endtime)); - $owrowall = $overlap->fetchAll(); - $overlapmaxrows = count($owrowall); - if ($overlapmaxrows > ($recunits) ){ - - $owtimeline = array(); - - for ($rrow = 0; $rrow < $overlapmaxrows ; $rrow++) { - $owrowdata = $owrowall[$rrow]; - $owtimeline[ $owrowdata['startdatetime'] ] = $owtimeline[ $owrowdata['startdatetime'] ] +1; - - $owrend = calcendtime( $owrowdata['startdatetime'], $owrowdata['lengthmin'] ); - $owtimeline[ $owrend ] = $owtimeline[ $owrend ] -1; - //注意: NULL に減算子を適用しても何も起こりませんが、NULL に加算子を 適用すると 1 となります。 - } - - ksort ( $owtimeline ); - - $owcount = 0; - foreach ( $owtimeline as $key => $val ) { - $owcount += $val; - - if ( $owcount > $recunits ) { - $rclass = "overwraped"; - break; - } - } - } - -//外部チューナー録画 -$externalinputs = 1; //現状一系統のみ -$query = " -SELECT - foltia_program.tid, stationname, foltia_program.title, - foltia_subtitle.countno, foltia_subtitle.subtitle, - foltia_subtitle.startdatetime, foltia_subtitle.lengthmin, - foltia_tvrecord.bitrate, foltia_subtitle.startoffset, - foltia_subtitle.pid, foltia_tvrecord.digital -FROM foltia_subtitle , foltia_program ,foltia_station ,foltia_tvrecord -WHERE foltia_tvrecord.tid = foltia_program.tid AND foltia_tvrecord.stationid = foltia_station .stationid AND foltia_program.tid = foltia_subtitle.tid AND foltia_station.stationid = foltia_subtitle.stationid -AND foltia_subtitle.enddatetime > ? -AND foltia_subtitle.startdatetime < ? -AND (foltia_station.stationrecch = '0' OR foltia_station.stationrecch = '-1' ) -UNION -SELECT - foltia_program.tid, stationname, foltia_program.title, - foltia_subtitle.countno, foltia_subtitle.subtitle, - foltia_subtitle.startdatetime, foltia_subtitle.lengthmin, - foltia_tvrecord.bitrate, foltia_subtitle.startoffset, - foltia_subtitle.pid, foltia_tvrecord.digital -FROM foltia_tvrecord -LEFT OUTER JOIN foltia_subtitle on (foltia_tvrecord.tid = foltia_subtitle.tid ) -LEFT OUTER JOIN foltia_program on (foltia_tvrecord.tid = foltia_program.tid ) -LEFT OUTER JOIN foltia_station on (foltia_subtitle.stationid = foltia_station.stationid ) -WHERE foltia_tvrecord.stationid = 0 AND -foltia_subtitle.enddatetime > ? -AND foltia_subtitle.startdatetime < ? -AND (foltia_station.stationrecch = '0' OR foltia_station.stationrecch = '-1' ) - "; -// $eoverlap = m_query($con, $query, "DBクエリに失敗しました"); - $eoverlap = sql_query($con, $query, "DBクエリに失敗しました",array($rowdata[5], $endtime,$rowdata[5], $endtime)); - $eowrowall = $eoverlap->fetchAll(); - $eoverlapmaxrows = count($eowrowall); - if ($eoverlapmaxrows > ($externalinputs) ){ - - $eowtimeline = array(); - - for ($erow = 0; $erow < $eoverlapmaxrows ; $erow++) { - $eowrowdata = $eowrowall[$erow]; - $eowtimeline[ $eowrowdata['startdatetime'] ] = $eowtimeline[ $eowrowdata['startdatetime'] ] +1; - - $eowrend = calcendtime( $eowrowdata['startdatetime'], $eowrowdata['lengthmin'] ); - $eowtimeline[ $eowrend ] = $eowtimeline[ $eowrend ] -1; - } - - ksort ( $eowtimeline ); - - $eowcount = 0; - foreach ( $eowtimeline as $key => $val ) { - $eowcount += $val; - - if ( $eowcount > $externalinputs ) { - $rclass = "exoverwraped"; - break; - } - } - - } +$subtitle = htmlspecialchars($rowdata[4]); + echo("\n"); // TID @@ -284,5 +138,4 @@ }else{ print "$title"; - } print "\n"; @@ -293,15 +146,8 @@ print "\n"; }else{ - //if ( $userclass <= 2){ - if (($mymemberid == $dbepgaddedby)||($userclass <= 1)){ - if ($userclass <= 1 ){//管理者なら - $membername = getmemberid2name($con,$dbepgaddedby); - $membername = ":" . $membername ; - }else{ - $membername = ""; - } - print "\n"; - }else{ - print "\n"; + if ($protectmode) { + print "\n"; + }else{ + print "\n"; } } @@ -313,47 +159,32 @@ //録画レート echo("\n"); - - //デジタル優先 - echo("\n"); echo("\n"); - } while ($rowdata = $rs->fetch()); + } ?>
話数 サブタイトル開始時刻(ズレ)開始時刻 総尺 画質デジタル優先
$subtitle
$subtitle [予約解除$membername]
$subtitle [解除不能]
$subtitle
$subtitle [予約解除]
".htmlspecialchars($rowdata[7])."
"); - if (htmlspecialchars($rowdata[11]) == 1){ - print "する"; - }else{ - print "しない"; - } - echo("
- - - - - - - -
アナログ重複表示
エンコーダ数
チューナー重複
外部入力重複
- - fetch(); -if (! $rowdata) { + $rs = m_query($con, $query, "DBクエリに失敗しました"); + $maxrows = pg_num_rows($rs); + + if ($maxrows == 0) { //なければなにもしない }else{ - $maxcols = $rs->columnCount(); + $maxcols = pg_num_fields($rs); ?> @@ -368,6 +199,4 @@ 録画リスト 画質 - デジタル優先 - @@ -376,5 +205,8 @@ \n"); //予約解除 - if ( $userclass <= 1){ + if ($protectmode) { + echo("−"); + }else{ echo("解除\n"); - }else{ - echo("−"); + htmlspecialchars($rowdata[4]) . "\">解除\n"); } //TID @@ -393,18 +225,12 @@ echo("".htmlspecialchars($rowdata[1])."
\n"); //タイトル - echo("" . + echo("" . htmlspecialchars($rowdata[2]) . "\n"); //MP4 echo("mp4\n"); - //画質(アナログビットレート) + echo("".htmlspecialchars($rowdata[3])."
\n"); - //デジタル優先 - echo(""); - if (htmlspecialchars($rowdata[5]) == 1){ - print "する"; - }else{ - print "しない"; - } + echo("\n"); }else{ @@ -414,15 +240,7 @@ EPG録画 mp4"; - echo("".htmlspecialchars($rowdata[3])."
"); - //デジタル優先 - echo(""); - if (htmlspecialchars($rowdata[5]) == 1){ - print "する"; - }else{ - print "しない"; - } - echo("\n"); + echo("".htmlspecialchars($rowdata[3])."
\n"); }//if tid 0 - } while ($rowdata = $rs->fetch()); + }//for }//else ?>