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