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