1 |
<?php |
---|
2 |
|
---|
3 |
|
---|
4 |
|
---|
5 |
|
---|
6 |
|
---|
7 |
|
---|
8 |
|
---|
9 |
|
---|
10 |
|
---|
11 |
|
---|
12 |
|
---|
13 |
|
---|
14 |
|
---|
15 |
|
---|
16 |
|
---|
17 |
|
---|
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 |
} |
---|
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 |
} |
---|
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 |
} |
---|
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 |
} |
---|
133 |
|
---|
134 |
$mode = getgetform(mode); |
---|
135 |
|
---|
136 |
if ($mode == "new"){ |
---|
137 |
|
---|
138 |
$query = " |
---|
139 |
|
---|
140 |
|
---|
141 |
|
---|
142 |
|
---|
143 |
|
---|
144 |
|
---|
145 |
|
---|
146 |
|
---|
147 |
|
---|
148 |
|
---|
149 |
|
---|
150 |
|
---|
151 |
|
---|
152 |
|
---|
153 |
|
---|
154 |
; |
---|
155 |
$rs = m_query($con, $query, "DBクエリに失敗しました"); |
---|
156 |
$maxrows = pg_num_rows($rs); |
---|
157 |
|
---|
158 |
|
---|
159 |
|
---|
160 |
$query = " |
---|
161 |
|
---|
162 |
|
---|
163 |
|
---|
164 |
|
---|
165 |
|
---|
166 |
|
---|
167 |
|
---|
168 |
|
---|
169 |
|
---|
170 |
|
---|
171 |
|
---|
172 |
|
---|
173 |
|
---|
174 |
|
---|
175 |
|
---|
176 |
; |
---|
177 |
$rs = m_query($con, $query, "DBクエリに失敗しました"); |
---|
178 |
$maxrows = pg_num_rows($rs); |
---|
179 |
|
---|
180 |
|
---|
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 |
} |
---|
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 |
|
---|
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 |
|
---|