Index: trunk/install/php/index.php
===================================================================
--- trunk/install/php/index.php (リビジョン 119)
+++ trunk/install/php/index.php (リビジョン 1)
@@ -13,28 +13,17 @@
オプション
mode:"new"を指定すると、新番組(第1話)のみの表示となる。
-now:YmdHi形式で日付を指定するとその日からの番組表が表示される。
DCC-JPL Japan/foltia project
*/
-
-include("./foltialib.php");
+?>
+
+ 209912342353 )){
- $now = date("YmdHi");
-}
+$now = date("YmdHi");
+
+
function printtitle(){
@@ -44,22 +33,10 @@
- ";
-//ディスク空き容量によって背景色表示変更
-warndiskfreearea();
-print "
foltia:放映予定
+
+foltia:放映予定
";
}//end function printtitle()
-
-
-//////////////////////////
-//ページの表示レコード数
-$lim = 300;
-//クエリ取得
-$p = getgetnumform(p);
-//ページ取得の計算
-list($st,$p,$p2) = number_page($p,$lim);
-////////////////////////////
//同一番組他局検索
@@ -77,29 +54,33 @@
WHERE foltia_tvrecord.tid = foltia_program.tid
AND foltia_program.tid = foltia_subtitle.tid
-AND foltia_subtitle.enddatetime >= ?
-ORDER BY \"startdatetime\" ASC
-LIMIT 1000
- ";
-// $reservedrssametid = m_query($con, $query, "DBクエリに失敗しました");
-$reservedrssametid = sql_query($con, $query, "DBクエリに失敗しました",array($now));
-$rowdata = $reservedrssametid->fetch();
-if ($rowdata) {
- do {
+AND foltia_subtitle.enddatetime >= '$now'
+ ORDER BY \"startdatetime\" ASC
+ ";
+ $reservedrssametid = m_query($con, $query, "DBクエリに失敗しました");
+ $reservedmaxrowssameid = pg_num_rows($reservedrssametid);
+
+ if ($reservedmaxrowssameid > 0 ){
+ for ($rrow = 0; $rrow < $reservedmaxrowssameid ; $rrow++) {
+ $rowdata = pg_fetch_row($reservedrssametid, $rrow);
$reservedpidsametid[] = $rowdata[7];
- } while ($rowdata = $reservedrssametid->fetch());
-
+ }
$rowdata = "";
+ $rrow = "";
}else{
- $reservedpidsametid = array();
+ $reservedpidsametid = "" ;
}//end if
-$reservedrssametid->closeCursor();
//録画番組検索
$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.pid
+foltia_program .tid,
+stationname,
+foltia_program .title,
+foltia_subtitle.countno,
+foltia_subtitle.subtitle,
+foltia_subtitle.startdatetime ,
+foltia_subtitle.lengthmin ,
+foltia_tvrecord.bitrate ,
+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
@@ -107,8 +88,13 @@
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.pid
+foltia_program .tid,
+stationname,
+foltia_program .title,
+foltia_subtitle.countno,
+foltia_subtitle.subtitle,
+foltia_subtitle.startdatetime ,
+foltia_subtitle.lengthmin ,
+foltia_tvrecord.bitrate ,
+foltia_subtitle.pid
FROM foltia_tvrecord
LEFT OUTER JOIN foltia_subtitle on (foltia_tvrecord.tid = foltia_subtitle.tid )
@@ -116,40 +102,17 @@
LEFT OUTER JOIN foltia_station on (foltia_subtitle.stationid = foltia_station.stationid )
WHERE foltia_tvrecord.stationid = 0 AND
- foltia_subtitle.enddatetime >= '$now' ORDER BY x ASC
-LIMIT 1000
- ";
-
-//$reservedrs = m_query($con, $query, "DBクエリに失敗しました");
-$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.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 >= ?
-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.pid
-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 >= ? ORDER BY x ASC
- ";
-$reservedrs = sql_query($con, $query, "DBクエリに失敗しました",array($now,$now));
-
-$rowdata = $reservedrs->fetch();
-if ($rowdata) {
- do {
+foltia_subtitle.enddatetime >= '$now' ORDER BY \"startdatetime\" ASC
+ ";
+
+ $reservedrs = m_query($con, $query, "DBクエリに失敗しました");
+ $reservedmaxrows = pg_num_rows($reservedrs);
+
+ if ($reservedmaxrows > 0 ){
+ for ($rrow = 0; $rrow < $reservedmaxrows ; $rrow++) {
+ $rowdata = pg_fetch_row($reservedrs, $rrow);
$reservedpid[] = $rowdata[8];
- } while ($rowdata = $reservedrs->fetch());
+ }
}else{
- $reservedpid = array();
+ $reservedpid = "";
}//end if
@@ -160,89 +123,45 @@
$query = "
SELECT
- foltia_program.tid, stationname, foltia_program.title,
- foltia_subtitle.countno, foltia_subtitle.subtitle,
- foltia_subtitle.startdatetime, foltia_subtitle.lengthmin,
- foltia_subtitle.pid, foltia_subtitle.startoffset
+foltia_program .tid,
+stationname,
+foltia_program .title,
+foltia_subtitle.countno,
+foltia_subtitle.subtitle,
+foltia_subtitle.startdatetime ,
+foltia_subtitle.lengthmin ,
+foltia_subtitle.pid ,
+foltia_subtitle.startoffset
FROM foltia_subtitle , foltia_program ,foltia_station
WHERE foltia_program.tid = foltia_subtitle.tid AND foltia_station.stationid = foltia_subtitle.stationid
AND foltia_subtitle.enddatetime >= '$now' AND foltia_subtitle.countno = '1'
-ORDER BY foltia_subtitle.startdatetime ASC
-LIMIT 1000
- ";
-$query = "
+ORDER BY foltia_subtitle.startdatetime ASC
+ ";
+ $rs = m_query($con, $query, "DBクエリに失敗しました");
+ $maxrows = pg_num_rows($rs);
+
+
+}else{
+ $query = "
SELECT
- foltia_program.tid, stationname, foltia_program.title,
- foltia_subtitle.countno, foltia_subtitle.subtitle,
- foltia_subtitle.startdatetime, foltia_subtitle.lengthmin,
- foltia_subtitle.pid, foltia_subtitle.startoffset
-FROM foltia_subtitle , foltia_program ,foltia_station
-WHERE foltia_program.tid = foltia_subtitle.tid AND foltia_station.stationid = foltia_subtitle.stationid
- AND foltia_subtitle.enddatetime >= ? AND foltia_subtitle.countno = '1'
-ORDER BY foltia_subtitle.startdatetime ASC
-LIMIT 1000
- ";
-
-}else{
-
-$query = "
- SELECT
- foltia_program.tid, stationname, foltia_program.title,
- foltia_subtitle.countno, foltia_subtitle.subtitle,
- foltia_subtitle.startdatetime, foltia_subtitle.lengthmin,
- foltia_subtitle.pid, foltia_subtitle.startoffset
+foltia_program .tid,
+stationname,
+foltia_program .title,
+foltia_subtitle.countno,
+foltia_subtitle.subtitle,
+foltia_subtitle.startdatetime ,
+foltia_subtitle.lengthmin ,
+foltia_subtitle.pid ,
+foltia_subtitle.startoffset
FROM foltia_subtitle , foltia_program ,foltia_station
WHERE foltia_program.tid = foltia_subtitle.tid AND foltia_station.stationid = foltia_subtitle.stationid
AND foltia_subtitle.enddatetime >= '$now'
-ORDER BY foltia_subtitle.startdatetime ASC
-LIMIT 1000
- ";
-
-/////////////////////////////////////////////////////////////
-//レコード総数取得
-$query = "
- SELECT
-COUNT(*) AS cnt
-FROM foltia_subtitle , foltia_program ,foltia_station
-WHERE foltia_program.tid = foltia_subtitle.tid AND foltia_station.stationid = foltia_subtitle.stationid
- AND foltia_subtitle.enddatetime >= ?
-LIMIT 1000
- ";
-
-$rs = sql_query($con, $query, "DBクエリに失敗しました",array($now));
-$rowdata = $rs->fetch();
-
-$dtcnt = htmlspecialchars($rowdata[0]);
-// echo $dtcnt;
-
-if (! $rowdata) {
- die_exit("番組データがありません
");
-}//endif
-////////////////////////////////////////////////////////////
-
-//レコード表示
-$query = "
- SELECT
- foltia_program.tid, stationname, foltia_program.title,
- foltia_subtitle.countno, foltia_subtitle.subtitle,
- foltia_subtitle.startdatetime, foltia_subtitle.lengthmin,
- foltia_subtitle.pid, foltia_subtitle.startoffset
-FROM foltia_subtitle , foltia_program ,foltia_station
-WHERE foltia_program.tid = foltia_subtitle.tid AND foltia_station.stationid = foltia_subtitle.stationid
- AND foltia_subtitle.enddatetime >= ?
-ORDER BY foltia_subtitle.startdatetime ASC
-LIMIT $lim OFFSET $st
- ";
-
-
-/////////////////////////////////////////////////////////////////
+ORDER BY foltia_subtitle.startdatetime ASC
+ ";
+ $rs = m_query($con, $query, "DBクエリに失敗しました");
+ $maxrows = pg_num_rows($rs);
}//end if
-//$rs = m_query($con, $query, "DBクエリに失敗しました");
-$rs = sql_query($con, $query, "DBクエリに失敗しました",array($now));
-$rowdata = $rs->fetch();
-//
-//
-if (! $rowdata) {
+if ($maxrows == 0) {
header("Status: 404 Not Found",TRUE,404);
printtitle();
@@ -252,5 +171,4 @@
print "
\n";
die_exit("番組データがありません
");
-
}//endif
@@ -274,11 +192,7 @@
放映番組リストを表示します。
-columnCount();
-
-//Autopager
-echo "";
-
+ $maxcols = pg_num_fields($rs);
?>
@@ -292,4 +206,5 @@
開始時刻(ズレ) |
総尺 |
+
@@ -298,5 +213,8 @@
\n");
-
- } while ($rowdata = $rs->fetch());
+ }
?>
-