| 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 |
////////////////////////// |
|---|
| 57 |
//ページの表示レコード数 |
|---|
| 58 |
$lim = 300; |
|---|
| 59 |
|
|---|
| 60 |
$p = getgetnumform(p); |
|---|
| 61 |
|
|---|
| 62 |
list($st,$p,$p2) = number_page($p,$lim); |
|---|
| 63 |
|
|---|
| 64 |
|
|---|
| 65 |
|
|---|
| 66 |
$query = " |
|---|
| 67 |
SELECT |
|---|
| 68 |
foltia_program .tid, |
|---|
| 69 |
foltia_program .title, |
|---|
| 70 |
foltia_subtitle.countno, |
|---|
| 71 |
foltia_subtitle.subtitle, |
|---|
| 72 |
foltia_subtitle.startdatetime , |
|---|
| 73 |
foltia_subtitle.lengthmin , |
|---|
| 74 |
foltia_tvrecord.bitrate , |
|---|
| 75 |
foltia_subtitle.pid |
|---|
| 76 |
FROM foltia_subtitle , foltia_program ,foltia_tvrecord |
|---|
| 77 |
WHERE foltia_tvrecord.tid = foltia_program.tid |
|---|
| 78 |
AND foltia_program.tid = foltia_subtitle.tid |
|---|
| 79 |
AND foltia_subtitle.enddatetime >= ? |
|---|
| 80 |
ORDER BY \"startdatetime\" ASC |
|---|
| 81 |
LIMIT 1000 |
|---|
| 82 |
"; |
|---|
| 83 |
|
|---|
| 84 |
$reservedrssametid = sql_query($con, $query, "DBクエリに失敗しました",array($now)); |
|---|
| 85 |
$rowdata = $reservedrssametid->fetch(); |
|---|
| 86 |
if ($rowdata) { |
|---|
| 87 |
do { |
|---|
| 88 |
$reservedpidsametid[] = $rowdata[7]; |
|---|
| 89 |
} while ($rowdata = $reservedrssametid->fetch()); |
|---|
| 90 |
|
|---|
| 91 |
$rowdata = ""; |
|---|
| 92 |
}else{ |
|---|
| 93 |
$reservedpidsametid = array(); |
|---|
| 94 |
} |
|---|
| 95 |
$reservedrssametid->closeCursor(); |
|---|
| 96 |
|
|---|
| 97 |
|
|---|
| 98 |
$query = " |
|---|
| 99 |
SELECT |
|---|
| 100 |
foltia_program.tid, stationname, foltia_program.title, |
|---|
| 101 |
foltia_subtitle.countno, foltia_subtitle.subtitle, |
|---|
| 102 |
foltia_subtitle.startdatetime as x, foltia_subtitle.lengthmin, |
|---|
| 103 |
foltia_tvrecord.bitrate, foltia_subtitle.pid |
|---|
| 104 |
FROM foltia_subtitle , foltia_program ,foltia_station ,foltia_tvrecord |
|---|
| 105 |
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 |
|---|
| 106 |
AND foltia_subtitle.enddatetime >= '$now' |
|---|
| 107 |
UNION |
|---|
| 108 |
SELECT |
|---|
| 109 |
foltia_program.tid, stationname, foltia_program.title, |
|---|
| 110 |
foltia_subtitle.countno, foltia_subtitle.subtitle, |
|---|
| 111 |
foltia_subtitle.startdatetime, foltia_subtitle.lengthmin, |
|---|
| 112 |
foltia_tvrecord.bitrate, 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 x ASC |
|---|
| 119 |
LIMIT 1000 |
|---|
| 120 |
"; |
|---|
| 121 |
|
|---|
| 122 |
|
|---|
| 123 |
$query = " |
|---|
| 124 |
SELECT |
|---|
| 125 |
foltia_program.tid, stationname, foltia_program.title, |
|---|
| 126 |
foltia_subtitle.countno, foltia_subtitle.subtitle, |
|---|
| 127 |
foltia_subtitle.startdatetime as x, foltia_subtitle.lengthmin, |
|---|
| 128 |
foltia_tvrecord.bitrate, foltia_subtitle.pid |
|---|
| 129 |
FROM foltia_subtitle , foltia_program ,foltia_station ,foltia_tvrecord |
|---|
| 130 |
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 |
|---|
| 131 |
AND foltia_subtitle.enddatetime >= ? |
|---|
| 132 |
UNION |
|---|
| 133 |
SELECT |
|---|
| 134 |
foltia_program.tid, stationname, foltia_program.title, |
|---|
| 135 |
foltia_subtitle.countno, foltia_subtitle.subtitle, |
|---|
| 136 |
foltia_subtitle.startdatetime, foltia_subtitle.lengthmin, |
|---|
| 137 |
foltia_tvrecord.bitrate, foltia_subtitle.pid |
|---|
| 138 |
FROM foltia_tvrecord |
|---|
| 139 |
LEFT OUTER JOIN foltia_subtitle on (foltia_tvrecord.tid = foltia_subtitle.tid ) |
|---|
| 140 |
LEFT OUTER JOIN foltia_program on (foltia_tvrecord.tid = foltia_program.tid ) |
|---|
| 141 |
LEFT OUTER JOIN foltia_station on (foltia_subtitle.stationid = foltia_station.stationid ) |
|---|
| 142 |
WHERE foltia_tvrecord.stationid = 0 AND |
|---|
| 143 |
foltia_subtitle.enddatetime >= ? ORDER BY x ASC |
|---|
| 144 |
"; |
|---|
| 145 |
$reservedrs = sql_query($con, $query, "DBクエリに失敗しました",array($now,$now)); |
|---|
| 146 |
|
|---|
| 147 |
$rowdata = $reservedrs->fetch(); |
|---|
| 148 |
if ($rowdata) { |
|---|
| 149 |
do { |
|---|
| 150 |
$reservedpid[] = $rowdata[8]; |
|---|
| 151 |
} while ($rowdata = $reservedrs->fetch()); |
|---|
| 152 |
}else{ |
|---|
| 153 |
$reservedpid = array(); |
|---|
| 154 |
} |
|---|
| 155 |
|
|---|
| 156 |
$mode = getgetform(mode); |
|---|
| 157 |
|
|---|
| 158 |
if ($mode == "new"){ |
|---|
| 159 |
|
|---|
| 160 |
$query = " |
|---|
| 161 |
|
|---|
| 162 |
|
|---|
| 163 |
|
|---|
| 164 |
|
|---|
| 165 |
|
|---|
| 166 |
|
|---|
| 167 |
|
|---|
| 168 |
|
|---|
| 169 |
|
|---|
| 170 |
|
|---|
| 171 |
; |
|---|
| 172 |
$query = " |
|---|
| 173 |
SELECT |
|---|
| 174 |
foltia_program.tid, stationname, foltia_program.title, |
|---|
| 175 |
foltia_subtitle.countno, foltia_subtitle.subtitle, |
|---|
| 176 |
foltia_subtitle.startdatetime, foltia_subtitle.lengthmin, |
|---|
| 177 |
foltia_subtitle.pid, foltia_subtitle.startoffset |
|---|
| 178 |
FROM foltia_subtitle , foltia_program ,foltia_station |
|---|
| 179 |
WHERE foltia_program.tid = foltia_subtitle.tid AND foltia_station.stationid = foltia_subtitle.stationid |
|---|
| 180 |
AND foltia_subtitle.enddatetime >= ? AND foltia_subtitle.countno = '1' |
|---|
| 181 |
ORDER BY foltia_subtitle.startdatetime ASC |
|---|
| 182 |
LIMIT 1000 |
|---|
| 183 |
"; |
|---|
| 184 |
|
|---|
| 185 |
}else{ |
|---|
| 186 |
|
|---|
| 187 |
$query = " |
|---|
| 188 |
SELECT |
|---|
| 189 |
foltia_program.tid, stationname, foltia_program.title, |
|---|
| 190 |
foltia_subtitle.countno, foltia_subtitle.subtitle, |
|---|
| 191 |
foltia_subtitle.startdatetime, foltia_subtitle.lengthmin, |
|---|
| 192 |
foltia_subtitle.pid, foltia_subtitle.startoffset |
|---|
| 193 |
FROM foltia_subtitle , foltia_program ,foltia_station |
|---|
| 194 |
WHERE foltia_program.tid = foltia_subtitle.tid AND foltia_station.stationid = foltia_subtitle.stationid |
|---|
| 195 |
AND foltia_subtitle.enddatetime >= '$now' |
|---|
| 196 |
ORDER BY foltia_subtitle.startdatetime ASC |
|---|
| 197 |
LIMIT 1000 |
|---|
| 198 |
"; |
|---|
| 199 |
|
|---|
| 200 |
|
|---|
| 201 |
|
|---|
| 202 |
$query = " |
|---|
| 203 |
SELECT |
|---|
| 204 |
COUNT(*) AS cnt |
|---|
| 205 |
FROM foltia_subtitle , foltia_program ,foltia_station |
|---|
| 206 |
WHERE foltia_program.tid = foltia_subtitle.tid AND foltia_station.stationid = foltia_subtitle.stationid |
|---|
| 207 |
AND foltia_subtitle.enddatetime >= ? |
|---|
| 208 |
LIMIT 1000 |
|---|
| 209 |
"; |
|---|
| 210 |
|
|---|
| 211 |
$rs = sql_query($con, $query, "DBクエリに失敗しました",array($now)); |
|---|
| 212 |
$rowdata = $rs->fetch(); |
|---|
| 213 |
|
|---|
| 214 |
$dtcnt = htmlspecialchars($rowdata[0]); |
|---|
| 215 |
|
|---|
| 216 |
|
|---|
| 217 |
if (! $rowdata) { |
|---|
| 218 |
die_exit("番組データがありません<BR>"); |
|---|
| 219 |
} |
|---|
| 220 |
//////////////////////////////////////////////////////////// |
|---|
| 221 |
|
|---|
| 222 |
//レコード表示 |
|---|
| 223 |
$query = " |
|---|
| 224 |
SELECT |
|---|
| 225 |
foltia_program.tid, stationname, foltia_program.title, |
|---|
| 226 |
foltia_subtitle.countno, foltia_subtitle.subtitle, |
|---|
| 227 |
foltia_subtitle.startdatetime, foltia_subtitle.lengthmin, |
|---|
| 228 |
foltia_subtitle.pid, foltia_subtitle.startoffset |
|---|
| 229 |
FROM foltia_subtitle , foltia_program ,foltia_station |
|---|
| 230 |
WHERE foltia_program.tid = foltia_subtitle.tid AND foltia_station.stationid = foltia_subtitle.stationid |
|---|
| 231 |
AND foltia_subtitle.enddatetime >= ? |
|---|
| 232 |
ORDER BY foltia_subtitle.startdatetime ASC |
|---|
| 233 |
LIMIT $lim OFFSET $st |
|---|
| 234 |
"; |
|---|
| 235 |
|
|---|
| 236 |
|
|---|
| 237 |
|
|---|
| 238 |
|
|---|
| 239 |
} |
|---|
| 240 |
|
|---|
| 241 |
//$rs = m_query($con, $query, "DBクエリに失敗しました"); |
|---|
| 242 |
$rs = sql_query($con, $query, "DBクエリに失敗しました",array($now)); |
|---|
| 243 |
$rowdata = $rs->fetch(); |
|---|
| 244 |
|
|---|
| 245 |
|
|---|
| 246 |
if (! $rowdata) { |
|---|
| 247 |
header("Status: 404 Not Found",TRUE,404); |
|---|
| 248 |
printtitle(); |
|---|
| 249 |
print "<body BGCOLOR=\"#ffffff\" TEXT=\"#494949\" LINK=\"#0047ff\" VLINK=\"#000000\" ALINK=\"#c6edff\" > |
|---|
| 250 |
<div align=\"center\">\n"; |
|---|
| 251 |
printhtmlpageheader(); |
|---|
| 252 |
print "<hr size=\"4\">\n"; |
|---|
| 253 |
die_exit("番組データがありません<BR>"); |
|---|
| 254 |
|
|---|
| 255 |
} |
|---|
| 256 |
|
|---|
| 257 |
printtitle(); |
|---|
| 258 |
?> |
|---|
| 259 |
<body BGCOLOR="#ffffff" TEXT="#494949" LINK="#0047ff" VLINK="#000000" ALINK="#c6edff" > |
|---|
| 260 |
<div align="center"> |
|---|
| 261 |
<?php |
|---|
| 262 |
printhtmlpageheader(); |
|---|
| 263 |
?> |
|---|
| 264 |
<p align="left"><font color="#494949" size="6"> |
|---|
| 265 |
<?php |
|---|
| 266 |
if ($mode == "new"){ |
|---|
| 267 |
print "新番組放映予定"; |
|---|
| 268 |
}else{ |
|---|
| 269 |
print "放映予定"; |
|---|
| 270 |
} |
|---|
| 271 |
?> |
|---|
| 272 |
</font></p> |
|---|
| 273 |
<hr size="4"> |
|---|
| 274 |
<p align="left">放映番組リストを表示します。</p> |
|---|
| 275 |
|
|---|
| 276 |
<?php |
|---|
| 277 |
|
|---|
| 278 |
$maxcols = $rs->columnCount(); |
|---|
| 279 |
|
|---|
| 280 |
|
|---|
| 281 |
echo "<div id=contents class=autopagerize_page_element />"; |
|---|
| 282 |
|
|---|
| 283 |
?> |
|---|
| 284 |
<table BORDER="0" CELLPADDING="0" CELLSPACING="2" WIDTH="100%"> |
|---|
| 285 |
<thead> |
|---|
| 286 |
<tr> |
|---|
| 287 |
<th align="left">TID</th> |
|---|
| 288 |
<th align="left">放映局</th> |
|---|
| 289 |
<th align="left">タイトル</th> |
|---|
| 290 |
<th align="left">話数</th> |
|---|
| 291 |
<th align="left">サブタイトル</th> |
|---|
| 292 |
<th align="left">開始時刻(ズレ)</th> |
|---|
| 293 |
<th align="left">総尺</th> |
|---|
| 294 |
</tr> |
|---|
| 295 |
</thead> |
|---|
| 296 |
|
|---|
| 297 |
<tbody> |
|---|
| 298 |
<?php |
|---|
| 299 |
|
|---|
| 300 |
do { |
|---|
| 301 |
|
|---|
| 302 |
if (in_array($rowdata[7], $reservedpidsametid)) { |
|---|
| 303 |
$rclass = "reservedtitle"; |
|---|
| 304 |
}else{ |
|---|
| 305 |
$rclass = ""; |
|---|
| 306 |
} |
|---|
| 307 |
|
|---|
| 308 |
if (in_array($rowdata[7], $reservedpid)) { |
|---|
| 309 |
$rclass = "reserved"; |
|---|
| 310 |
} |
|---|
| 311 |
$pid = htmlspecialchars($rowdata[7]); |
|---|
| 312 |
|
|---|
| 313 |
$tid = htmlspecialchars($rowdata[0]); |
|---|
| 314 |
$title = htmlspecialchars($rowdata[2]); |
|---|
| 315 |
$subtitle = htmlspecialchars($rowdata[4]); |
|---|
| 316 |
|
|---|
| 317 |
echo("<tr class=\"$rclass\">\n"); |
|---|
| 318 |
|
|---|
| 319 |
print "<td>"; |
|---|
| 320 |
if ($tid == 0 ){ |
|---|
| 321 |
print "$tid"; |
|---|
| 322 |
}else{ |
|---|
| 323 |
print "<a href=\"reserveprogram.php?tid=$tid\">$tid</a>"; |
|---|
| 324 |
} |
|---|
| 325 |
print "</td>\n"; |
|---|
| 326 |
|
|---|
| 327 |
echo("<td>".htmlspecialchars($rowdata[1])."<br></td>\n"); |
|---|
| 328 |
|
|---|
| 329 |
print "<td>"; |
|---|
| 330 |
if ($tid == 0 ){ |
|---|
| 331 |
print "$title"; |
|---|
| 332 |
}else{ |
|---|
| 333 |
print "<a href=\"http://cal.syoboi.jp/tid/$tid\" target=\"_blank\">$title</a>"; |
|---|
| 334 |
} |
|---|
| 335 |
print "</td>\n"; |
|---|
| 336 |
|
|---|
| 337 |
echo("<td>".htmlspecialchars($rowdata[3])."<br></td>\n"); |
|---|
| 338 |
|
|---|
| 339 |
if ($pid > 0 ){ |
|---|
| 340 |
print "<td><a href=\"http://cal.syoboi.jp/tid/$tid/time#$pid\" target=\"_blank\">$subtitle<br></td>\n"; |
|---|
| 341 |
}else{ |
|---|
| 342 |
print "<td>$subtitle<br></td>\n"; |
|---|
| 343 |
} |
|---|
| 344 |
|
|---|
| 345 |
echo("<td>".htmlspecialchars(foldate2print($rowdata[5]))."<br>(".htmlspecialchars($rowdata[8]).")</td>\n"); |
|---|
| 346 |
|
|---|
| 347 |
echo("<td>".htmlspecialchars($rowdata[6])."<br></td>\n"); |
|---|
| 348 |
|
|---|
| 349 |
echo("</tr>\n"); |
|---|
| 350 |
|
|---|
| 351 |
} while ($rowdata = $rs->fetch()); |
|---|
| 352 |
?> |
|---|
| 353 |
</tbody> |
|---|
| 354 |
</table> |
|---|
| 355 |
|
|---|
| 356 |
<?php |
|---|
| 357 |
|
|---|
| 358 |
|
|---|
| 359 |
page_display("",$p,$p2,$lim,$dtcnt,$mode); |
|---|
| 360 |
|
|---|
| 361 |
?> |
|---|
| 362 |
|
|---|
| 363 |
</body> |
|---|
| 364 |
</html> |
|---|
| 365 |
|
|---|