| 1 | <?php | 
|---|
| 2 |  | 
|---|
| 3 |  | 
|---|
| 4 |  | 
|---|
| 5 |  | 
|---|
| 6 |  | 
|---|
| 7 |  | 
|---|
| 8 |  | 
|---|
| 9 |  | 
|---|
| 10 |  | 
|---|
| 11 |  | 
|---|
| 12 |  | 
|---|
| 13 |  | 
|---|
| 14 |  | 
|---|
| 15 |  | 
|---|
| 16 |  | 
|---|
| 17 |  | 
|---|
| 18 | include("./foltialib.php"); | 
|---|
| 19 | $con = m_connect(); | 
|---|
| 20 |  | 
|---|
| 21 | if ($useenvironmentpolicy == 1){ | 
|---|
| 22 | if (!isset($_SERVER['PHP_AUTH_USER'])) { | 
|---|
| 23 | header("WWW-Authenticate: Basic realm=\"foltia\""); | 
|---|
| 24 | header("HTTP/1.0 401 Unauthorized"); | 
|---|
| 25 | redirectlogin(); | 
|---|
| 26 | exit; | 
|---|
| 27 | } else { | 
|---|
| 28 | login($con,$_SERVER['PHP_AUTH_USER'],$_SERVER['PHP_AUTH_PW']); | 
|---|
| 29 | } | 
|---|
| 30 | } | 
|---|
| 31 |  | 
|---|
| 32 | ?> | 
|---|
| 33 |  | 
|---|
| 34 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> | 
|---|
| 35 | <html lang="ja"> | 
|---|
| 36 | <head> | 
|---|
| 37 | <meta http-equiv="Content-Type" content="text/html; charset=EUC-JP"> | 
|---|
| 38 | <?php | 
|---|
| 39 | if (file_exists  ( "./iui/iui.css"  )){ | 
|---|
| 40 | $useragent = $_SERVER['HTTP_USER_AGENT']; | 
|---|
| 41 | } | 
|---|
| 42 | if(ereg("iPhone",$useragent)){ | 
|---|
| 43 | print "<meta name=\"viewport\" content=\"width=320; initial-scale=1.0; maximum-scale=1.0; user-scalable=no;\"/> | 
|---|
| 44 | <link rel=\"apple-touch-icon\" type=\"image/png\" href=\"./img/icon.png\" /> | 
|---|
| 45 |  | 
|---|
| 46 | <style type=\"text/css\" media=\"screen\">@import \"./iui/iui.css\";</style> | 
|---|
| 47 | <script type=\"application/x-javascript\" src=\"./iui/iui.js\"></script>"; | 
|---|
| 48 | }else{ | 
|---|
| 49 | print "<meta http-equiv=\"Content-Style-Type\" content=\"text/css\"> | 
|---|
| 50 | <link rel=\"stylesheet\" type=\"text/css\" href=\"graytable.css\"> | 
|---|
| 51 | <link rel=\"alternate\" type=\"application/rss+xml\" title=\"RSS\" href=\"./folcast.php\" />"; | 
|---|
| 52 | } | 
|---|
| 53 | ?> | 
|---|
| 54 | <title>foltia:MP4 Lib</title> | 
|---|
| 55 | </head> | 
|---|
| 56 |  | 
|---|
| 57 | <?php | 
|---|
| 58 | $now = date("YmdHi"); | 
|---|
| 59 | if(ereg("iPhone",$useragent)){ | 
|---|
| 60 | print "<body onclick=\"console.log('Hello', event.target);\"> | 
|---|
| 61 | <div class=\"toolbar\"> | 
|---|
| 62 | <h1 id=\"pageTitle\"></h1> | 
|---|
| 63 | <a id=\"backButton\" class=\"button\" href=\"#\"></a> | 
|---|
| 64 | </div> | 
|---|
| 65 | "; | 
|---|
| 66 | }else{ | 
|---|
| 67 | print "<body BGCOLOR=\"#ffffff\" TEXT=\"#494949\" LINK=\"#0047ff\" VLINK=\"#000000\" ALINK=\"#c6edff\" > | 
|---|
| 68 | <div align=\"center\"> | 
|---|
| 69 | "; | 
|---|
| 70 | printhtmlpageheader(); | 
|---|
| 71 | print "  <p align=\"left\"><font color=\"#494949\" size=\"6\">録画ライブラリ表示</font></p> | 
|---|
| 72 | <hr size=\"4\"> | 
|---|
| 73 | <p align=\"left\">再生可能ライブラリを表示します。<br> | 
|---|
| 74 | "; | 
|---|
| 75 | } | 
|---|
| 76 |  | 
|---|
| 77 |  | 
|---|
| 78 | $query = " | 
|---|
| 79 | SELECT foltia_mp4files.tid,foltia_program.title , count(foltia_mp4files.mp4filename) | 
|---|
| 80 | FROM   foltia_mp4files ,  foltia_program | 
|---|
| 81 | WHERE  foltia_program.tid = foltia_mp4files.tid | 
|---|
| 82 | GROUP BY foltia_mp4files.tid ,foltia_program.title | 
|---|
| 83 | ORDER BY foltia_mp4files.tid DESC | 
|---|
| 84 | "; | 
|---|
| 85 |  | 
|---|
| 86 |  | 
|---|
| 87 | $rs = sql_query($con, $query, "DBクエリに失敗しました"); | 
|---|
| 88 | $rowdata = $rs->fetch(); | 
|---|
| 89 | if ($rowdata) { | 
|---|
| 90 | if(ereg("iPhone",$useragent)){ | 
|---|
| 91 | print "<ul id=\"home\" title=\"録画ライブラリ表示\" selected=\"true\">"; | 
|---|
| 92 | }else{ | 
|---|
| 93 | print " | 
|---|
| 94 | <table BORDER=\"0\" CELLPADDING=\"0\" CELLSPACING=\"2\" WIDTH=\"100%\"> | 
|---|
| 95 | <thead> | 
|---|
| 96 | <tr> | 
|---|
| 97 | <th align=\"left\">TID</th> | 
|---|
| 98 | <th align=\"left\">タイトル(内容リンク)</th> | 
|---|
| 99 | <th align=\"left\">内容数</th> | 
|---|
| 100 | <th align=\"left\">リンク</th> | 
|---|
| 101 | </tr> | 
|---|
| 102 | </thead> | 
|---|
| 103 | <tbody> | 
|---|
| 104 | "; | 
|---|
| 105 | } | 
|---|
| 106 | do { | 
|---|
| 107 | $title = $rowdata[1]; | 
|---|
| 108 | $counts = $rowdata[2]; | 
|---|
| 109 | $tid = htmlspecialchars($rowdata[0]); | 
|---|
| 110 | $title = htmlspecialchars($title); | 
|---|
| 111 | $counts = htmlspecialchars($counts); | 
|---|
| 112 |  | 
|---|
| 113 | if(ereg("iPhone",$useragent)){ | 
|---|
| 114 | print "<li><a href=\"showlibc.php?tid=$tid\" target=\"_self\">$title</a></li>\n"; | 
|---|
| 115 | }else{ | 
|---|
| 116 | print " | 
|---|
| 117 | <tr> | 
|---|
| 118 | <td>$tid<br></td> | 
|---|
| 119 | <td><a href=\"showlibc.php?tid=$tid\">$title</a></td> | 
|---|
| 120 | <td>$counts<br></td> | 
|---|
| 121 | <td><a href=\"http://cal.syoboi.jp/tid/$tid\" target=\"_blank\">しょぼかる-$tid</a><br></td> | 
|---|
| 122 | </tr>\n | 
|---|
| 123 | "; | 
|---|
| 124 | } | 
|---|
| 125 | } while ($rowdata = $rs->fetch()); | 
|---|
| 126 |  | 
|---|
| 127 | if(ereg("iPhone",$useragent)){ | 
|---|
| 128 | print "</ul>\n</body>\n</html>\n"; | 
|---|
| 129 | }else{ | 
|---|
| 130 | print " | 
|---|
| 131 | </tbody> | 
|---|
| 132 | </table> | 
|---|
| 133 | </body> | 
|---|
| 134 | </html> | 
|---|
| 135 | "; | 
|---|
| 136 | } | 
|---|
| 137 |  | 
|---|
| 138 | }else{ | 
|---|
| 139 | print "録画ファイルが存在しません。</body></html>"; | 
|---|
| 140 |  | 
|---|
| 141 | } | 
|---|
| 142 | /* | 
|---|
| 143 | //旧仕様 | 
|---|
| 144 | //ディレクトリからファイル一覧を取得 | 
|---|
| 145 | exec ("ls  $recfolderpath | grep localized | sort -r", $libdir); | 
|---|
| 146 | //print "libdir:$libdir<BR>\n"; | 
|---|
| 147 |  | 
|---|
| 148 | foreach($libdir as $fName) { | 
|---|
| 149 |  | 
|---|
| 150 | if(($fName == ".") or ($fName == "..") ){ continue; } | 
|---|
| 151 | if (ereg(".localized", $fName)){ | 
|---|
| 152 | $filesplit = split("\.",$fName); | 
|---|
| 153 | $query = " | 
|---|
| 154 | SELECT | 
|---|
| 155 | foltia_program.tid,foltia_program.title | 
|---|
| 156 | FROM   foltia_program | 
|---|
| 157 | WHERE foltia_program.tid = $filesplit[0] | 
|---|
| 158 | "; | 
|---|
| 159 | $rs = m_query($con, $query, "DBクエリに失敗しました"); | 
|---|
| 160 | $rowdata = $rs->fetch(); | 
|---|
| 161 | //print" $fName./$rowdata[1]/$rowdata[2]/$rowdata[3]<BR>\n"; | 
|---|
| 162 | $title = $rowdata[1]; | 
|---|
| 163 |  | 
|---|
| 164 | $tid = htmlspecialchars($rowdata[0]); | 
|---|
| 165 | $title = htmlspecialchars($title); | 
|---|
| 166 | //-- | 
|---|
| 167 | print " | 
|---|
| 168 | <tr> | 
|---|
| 169 | <td>$tid<br></td> | 
|---|
| 170 | <td><a href=\"showlibc.php?tid=$tid\">$title</a></td> | 
|---|
| 171 | <td>"; | 
|---|
| 172 | //計数 | 
|---|
| 173 | $counts = system ("ls  $recfolderpath/$fName/mp4/*.MP4 | wc -l"); | 
|---|
| 174 | print "<br></td> | 
|---|
| 175 | <td><a href=\"http://cal.syoboi.jp/tid/$tid\" target=\"_blank\">しょぼかる-$tid</a><br></td> | 
|---|
| 176 | </tr>\n | 
|---|
| 177 | "; | 
|---|
| 178 | }//end if ereg m2p | 
|---|
| 179 | }//end foreach | 
|---|
| 180 | //旧仕様ココまで | 
|---|
| 181 | */ | 
|---|
| 182 | //$d->close(); | 
|---|
| 183 | ?> | 
|---|
| 184 |  | 
|---|