root/trunk/install/php/index.php

リビジョン 83, 7.6 kB (コミッタ: sorshi, コミット時期: 15 年 前)

foltiaHD最初のリリース。
デジタル録画はFriio/Friio BS/CSのみに対応。
ivtvは1.0系使用になりました。

Line 
1 <?php
2 /*
3  Anime recording system foltia
4  http://www.dcc-jpl.com/soft/foltia/
5
6 index.php
7
8 目的
9 全番組放映予定を表示します。
10 録画予約されている番組は別色でわかりやすく表現されています。
11
12
13 オプション
14 mode:"new"を指定すると、新番組(第1話)のみの表示となる。
15 now:YmdHi形式で日付を指定するとその日からの番組表が表示される。
16
17  DCC-JPL Japan/foltia project
18
19 */
20
21 include("./foltialib.php");
22 $con = m_connect();
23
24 if ($useenvironmentpolicy == 1){
25     if (!isset($_SERVER['PHP_AUTH_USER'])) {
26         header("WWW-Authenticate: Basic realm=\"foltia\"");
27         header("HTTP/1.0 401 Unauthorized");
28         redirectlogin();
29         exit;
30     } else {
31     login($con,$_SERVER['PHP_AUTH_USER'],$_SERVER['PHP_AUTH_PW']);
32     }
33 }//end if login
34
35 $now = getgetnumform(date);
36 if(($now < 200001010000 ) || ($now > 209912342353 )){
37     $now = date("YmdHi");   
38 }
39 function printtitle(){
40
41 print "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">
42 <html lang=\"ja\">
43 <head>
44 <meta http-equiv=\"Content-Type\" content=\"text/html; charset=EUC-JP\">
45 <meta http-equiv=\"Content-Style-Type\" content=\"text/css\">
46 <link rel=\"stylesheet\" type=\"text/css\" href=\"graytable.css\"> ";
47 //ディスク空き容量によって背景色表示変更
48 warndiskfreearea();
49 print "<title>foltia:放映予定</title>
50 </head>";
51
52
53 }//end function printtitle()
54
55 //同一番組他局検索
56 $query = "
57 SELECT
58 foltia_program .tid,
59 foltia_program .title,
60 foltia_subtitle.countno,
61 foltia_subtitle.subtitle,
62 foltia_subtitle.startdatetime ,
63 foltia_subtitle.lengthmin ,
64 foltia_tvrecord.bitrate ,
65 foltia_subtitle.pid 
66 FROM foltia_subtitle , foltia_program  ,foltia_tvrecord
67 WHERE foltia_tvrecord.tid = foltia_program.tid
68 AND foltia_program.tid = foltia_subtitle.tid
69 AND foltia_subtitle.enddatetime >= '$now'
70 ORDER BY \"startdatetime\" ASC
71 LIMIT 1000
72     ";
73     $reservedrssametid = m_query($con, $query, "DBクエリに失敗しました");
74     $reservedmaxrowssameid = pg_num_rows($reservedrssametid);
75     
76     if ($reservedmaxrowssameid > 0 ){
77     for ($rrow = 0; $rrow < $reservedmaxrowssameid ; $rrow++) {
78         $rowdata = pg_fetch_row($reservedrssametid, $rrow);
79         $reservedpidsametid[] = $rowdata[7];
80     }
81     $rowdata = "";
82     $rrow = "";
83     }else{
84     $reservedpidsametid = "" ;
85     }//end if
86
87 //録画番組検索
88 $query = "
89 SELECT
90 foltia_program .tid,
91 stationname,
92 foltia_program .title,
93 foltia_subtitle.countno,
94 foltia_subtitle.subtitle,
95 foltia_subtitle.startdatetime ,
96 foltia_subtitle.lengthmin ,
97 foltia_tvrecord.bitrate ,
98 foltia_subtitle.pid 
99 FROM foltia_subtitle , foltia_program ,foltia_station ,foltia_tvrecord
100 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
101 AND foltia_subtitle.enddatetime >= '$now'
102 UNION
103 SELECT
104 foltia_program .tid,
105 stationname,
106 foltia_program .title,
107 foltia_subtitle.countno,
108 foltia_subtitle.subtitle,
109 foltia_subtitle.startdatetime ,
110 foltia_subtitle.lengthmin ,
111 foltia_tvrecord.bitrate ,
112 foltia_subtitle.pid 
113 FROM foltia_tvrecord
114 LEFT OUTER JOIN foltia_subtitle on (foltia_tvrecord.tid = foltia_subtitle.tid )
115 LEFT OUTER JOIN foltia_program on (foltia_tvrecord.tid = foltia_program.tid )
116 LEFT OUTER JOIN foltia_station on (foltia_subtitle.stationid = foltia_station.stationid )
117 WHERE foltia_tvrecord.stationid = 0 AND
118 foltia_subtitle.enddatetime >= '$now' ORDER BY \"startdatetime\" ASC
119 LIMIT 1000
120     ";
121
122     $reservedrs = m_query($con, $query, "DBクエリに失敗しました");
123     $reservedmaxrows = pg_num_rows($reservedrs);
124     
125     if ($reservedmaxrows > 0 ){
126     for ($rrow = 0; $rrow < $reservedmaxrows ; $rrow++) {
127         $rowdata = pg_fetch_row($reservedrs, $rrow);
128         $reservedpid[] = $rowdata[8];
129     }
130     }else{
131     $reservedpid = "";
132     }//end if
133
134 $mode = getgetform(mode);
135
136 if ($mode == "new"){
137 //新番組表示モード
138     $query = "
139     SELECT
140 foltia_program .tid,
141 stationname,
142 foltia_program .title,
143 foltia_subtitle.countno,
144 foltia_subtitle.subtitle,
145 foltia_subtitle.startdatetime ,
146 foltia_subtitle.lengthmin  ,
147 foltia_subtitle.pid ,
148 foltia_subtitle.startoffset   
149 FROM foltia_subtitle , foltia_program ,foltia_station 
150 WHERE foltia_program.tid = foltia_subtitle.tid AND foltia_station.stationid = foltia_subtitle.stationid
151  AND foltia_subtitle.enddatetime >= '$now'  AND foltia_subtitle.countno = '1'
152 ORDER BY foltia_subtitle.startdatetime  ASC
153 LIMIT 1000
154     ";
155     $rs = m_query($con, $query, "DBクエリに失敗しました");
156     $maxrows = pg_num_rows($rs);
157
158
159 }else{
160     $query = "
161     SELECT
162 foltia_program .tid,
163 stationname,
164 foltia_program .title,
165 foltia_subtitle.countno,
166 foltia_subtitle.subtitle,
167 foltia_subtitle.startdatetime ,
168 foltia_subtitle.lengthmin ,
169 foltia_subtitle.pid  ,
170 foltia_subtitle.startoffset   
171 FROM foltia_subtitle , foltia_program ,foltia_station 
172 WHERE foltia_program.tid = foltia_subtitle.tid AND foltia_station.stationid = foltia_subtitle.stationid
173  AND foltia_subtitle.enddatetime >= '$now' 
174 ORDER BY foltia_subtitle.startdatetime  ASC
175 LIMIT 1000
176     ";
177     $rs = m_query($con, $query, "DBクエリに失敗しました");
178     $maxrows = pg_num_rows($rs);
179
180 }//end if
181
182 if ($maxrows == 0) {
183 header("Status: 404 Not Found",TRUE,404);
184 printtitle();
185 print "<body BGCOLOR=\"#ffffff\" TEXT=\"#494949\" LINK=\"#0047ff\" VLINK=\"#000000\" ALINK=\"#c6edff\" >
186 <div align=\"center\">\n";
187 printhtmlpageheader();
188 print "<hr size=\"4\">\n";
189         die_exit("番組データがありません<BR>");
190 }//endif
191
192 printtitle();
193 ?>
194 <body BGCOLOR="#ffffff" TEXT="#494949" LINK="#0047ff" VLINK="#000000" ALINK="#c6edff" >
195 <div align="center">
196 <?php
197 printhtmlpageheader();
198 ?>
199   <p align="left"><font color="#494949" size="6">
200 <?php
201 if ($mode == "new"){
202     print "新番組放映予定";
203 }else{
204     print "放映予定";
205 }
206 ?>
207 </font></p>
208   <hr size="4">
209 <p align="left">放映番組リストを表示します。</p>
210
211 <?
212         /* フィールド数 */
213         $maxcols = pg_num_fields($rs);
214         ?>
215   <table BORDER="0" CELLPADDING="0" CELLSPACING="2" WIDTH="100%">
216     <thead>
217         <tr>
218             <th align="left">TID</th>
219             <th align="left">放映局</th>
220             <th align="left">タイトル</th>
221             <th align="left">話数</th>
222             <th align="left">サブタイトル</th>
223             <th align="left">開始時刻(ズレ)</th>
224             <th align="left">総尺</th>
225
226         </tr>
227     </thead>
228
229     <tbody>
230         <?php
231             /* テーブルのデータを出力 */
232             for ($row = 0; $row < $maxrows; $row++) { /* 行に対応 */
233                 /* pg_fetch_row で一行取り出す */
234                 $rowdata = pg_fetch_row($rs, $row);
235
236 //他局で同一番組録画済みなら色変え
237 if (in_array($rowdata[7], $reservedpidsametid)) {
238 $rclass = "reservedtitle";
239 }else{
240 $rclass = "";
241 }
242 //録画予約済みなら色変え
243 if (in_array($rowdata[7], $reservedpid)) {
244 $rclass = "reserved";
245 }
246 $pid = htmlspecialchars($rowdata[7]);
247
248 $tid = htmlspecialchars($rowdata[0]);
249 $title = htmlspecialchars($rowdata[2]);
250 $subtitle htmlspecialchars($rowdata[4]);
251
252                 echo("<tr class=\"$rclass\">\n");
253                     // TID
254                     print "<td>";
255                     if ($tid == 0 ){
256                     print "$tid";
257                     }else{
258                     print "<a href=\"reserveprogram.php?tid=$tid\">$tid</a>";
259                     }
260                     print "</td>\n";
261                      // 放映局
262                      echo("<td>".htmlspecialchars($rowdata[1])."<br></td>\n");
263                      // タイトル
264                     print "<td>";
265                     if ($tid == 0 ){
266                     print "$title";
267                     }else{
268                     print "<a href=\"http://cal.syoboi.jp/tid/$tid\" target=\"_blank\">$title</a>";
269                     }
270                     print "</td>\n";
271                      // 話数
272                     echo("<td>".htmlspecialchars($rowdata[3])."<br></td>\n");
273                     // サブタイ
274                     if ($pid > 0 ){
275                     print "<td><a href=\"http://cal.syoboi.jp/tid/$tid/time#$pid\" target=\"_blank\">$subtitle<br></td>\n";
276                     }else{
277                     print "<td>$subtitle<br></td>\n";
278                     }
279                     // 開始時刻(ズレ)
280                     echo("<td>".htmlspecialchars(foldate2print($rowdata[5]))."<br>(".htmlspecialchars($rowdata[8]).")</td>\n");
281                     // 総尺
282                     echo("<td>".htmlspecialchars($rowdata[6])."<br></td>\n");
283
284                 echo("</tr>\n");
285             }
286         ?>
287     </tbody>
288 </table>
289
290
291 </body>
292 </html>
293
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。
track feed