root/trunk/install/php/showlibc.php

リビジョン 94, 7.7 kB (コミッタ: sorshi, コミット時期: 14 年 前)

SQLite採用

Line 
1 <?php
2 /*
3  Anime recording system foltia
4  http://www.dcc-jpl.com/soft/foltia/
5
6 showlibc.php
7
8 目的
9 録画ライブラリ番組を個別表示します。
10
11 引数
12 tid:タイトルID
13
14  DCC-JPL Japan/foltia project
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 }//end if login
31
32 $tid = getgetnumform(tid);
33
34 if ($tid == "") {
35     header("Status: 404 Not Found",TRUE,404);
36 }
37
38 ?>
39 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
40 <html lang="ja">
41 <head>
42 <meta http-equiv="Content-Type" content="text/html; charset=EUC-JP">
43 <?php
44 if (file_exists  ( "./iui/iui.css"  )){
45     $useragent = $_SERVER['HTTP_USER_AGENT'];
46 }
47 if(ereg("iPhone",$useragent)){
48 print "<meta name=\"viewport\" content=\"width=320; initial-scale=1.0; maximum-scale=1.0; user-scalable=no;\"/>
49 <link rel=\"apple-touch-icon\" type=\"image/png\" href=\"./img/icon.png\" />
50 <style type=\"text/css\" media=\"screen\">@import \"./iui/iui.css\";</style>
51 <script type=\"application/x-javascript\" src=\"./iui/iui.js\"></script>";
52 }else{
53 print "<meta http-equiv=\"Content-Style-Type\" content=\"text/css\">
54 <link rel=\"stylesheet\" type=\"text/css\" href=\"graytable.css\">
55 <script src=\"http://images.apple.com/main/js/ac_quicktime.js\" language=\"JavaScript\" type=\"text/javascript\"></script>
56 <link rel=\"alternate\" type=\"application/rss+xml\" title=\"RSS\" href=\"./folcast.php?tid=$tid\" />
57 ";
58 }
59 if ($tid == "") {
60     print "<title>foltia:Lib</title>
61 </head><body BGCOLOR=\"#ffffff\" TEXT=\"#494949\" LINK=\"#0047ff\" VLINK=\"#000000\" ALINK=\"#c6edff\" > \n";
62         printhtmlpageheader();
63         die_exit("再生可能番組がありません<BR>");
64     }
65 $now = date("YmdHi");   
66
67 $query = "
68 SELECT foltia_program.title 
69 FROM  foltia_program   
70 WHERE foltia_program.tid = ?
71 ";
72 //$rs = m_query($con, $query, "DBクエリに失敗しました");
73 $rs = sql_query($con, $query, "DBクエリに失敗しました",array($tid));
74 $rowdata = $rs->fetch();
75 if (! $rowdata) {
76 $syobocaldb = `curl "http://cal.syoboi.jp/db?Command=TitleLookup&TID=$tid" | head -2 `;
77 $syobocaldb = mb_convert_encoding($syobocaldb, "EUC-JP", "UTF-8");
78     $syobocaldb = preg_match("/<Title>.*<\/Title>/", $syobocaldb,$title);
79     $title = $title[0];
80     $title = strip_tags($title);
81     $title htmlspecialchars($title) ;
82 }else{
83 $title = $rowdata[0];
84 $title htmlspecialchars($title) ;
85 }
86 //ヘッダ続き
87 print "<title>foltia:Lib $tid:$title</title></head>";
88 $serveruri = getserveruri();
89
90 if(ereg("iPhone",$useragent)){
91     print "<body onclick=\"console.log('Hello', event.target);\">
92     <div class=\"toolbar\">
93         <h1 id=\"pageTitle\"></h1>
94         <a id=\"backButton\" class=\"button\" href=\"#\"></a>
95     </div>
96 ";
97 }else{
98
99 print "<body BGCOLOR=\"#ffffff\" TEXT=\"#494949\" LINK=\"#0047ff\" VLINK=\"#000000\" ALINK=\"#c6edff\" >
100 <div align=\"center\">
101 ";
102     printhtmlpageheader();
103 print "  <p align=\"left\"><font color=\"#494949\" size=\"6\">録画ライブラリ番組個別表示</font></p>
104   <hr size=\"4\">
105 <p align=\"left\">再生可能ムービーを表示します。<br>";
106 if ($tid == 0){
107 print "$title 【<A HREF = \"./folcast.php?tid=$tid\">この番組のFolcast</A> [<a href=\"itpc://$serveruri/folcast.php?tid=$tid\">iTunesに登録</a>】 <br>\n";
108 }else{
109
110 print "<a href=\"http://cal.syoboi.jp/tid/" .
111                      htmlspecialchars($tid)  . "\" target=\"_blank\">$title</a> 【<A HREF = \"./folcast.php?tid=$tid\">この番組のFolcast</A> [<a href=\"itpc://$serveruri/folcast.php?tid=$tid\">iTunesに登録</a>]】 <br>\n";
112 }
113 }// endif if(ereg("iPhone",$useragent))
114
115 //確認
116 if (file_exists ("$recfolderpath/$tid.localized")){
117 //    print "ディレクトリは存在します\n";
118 }else{
119 //    print "ディレクトリはありません\n";
120         print "再生可能番組がありません<BR>\n</body></html>";
121     exit;
122 }                     
123
124 //新仕様/* 2006/10/26 */
125 if (file_exists("./selectcaptureimage.php") ) {
126     $sbpluginexist = 1;
127 }
128 $serverfqdn = getserverfqdn();
129
130 $query = "
131 SELECT
132 foltia_program.tid,
133 foltia_program.title,
134 foltia_subtitle.countno,
135 foltia_subtitle.subtitle,
136 foltia_subtitle.startdatetime ,
137 foltia_subtitle.m2pfilename ,
138 foltia_subtitle.pid ,
139 foltia_mp4files.mp4filename
140 FROM foltia_mp4files 
141 LEFT JOIN foltia_subtitle
142 ON   foltia_mp4files.mp4filename = foltia_subtitle.pspfilename   
143 LEFT JOIN foltia_program 
144 ON foltia_mp4files.tid = foltia_program.tid
145 WHERE foltia_mp4files.tid = ? 
146 ORDER BY \"startdatetime\" ASC
147 ";
148
149 $rs = "";
150 //$rs = m_query($con, $query, "DBクエリに失敗しました");
151 $rs = sql_query($con, $query, "DBクエリに失敗しました",array($tid));
152 $rowdata = $rs->fetch();
153 if ($rowdata) {
154 if(ereg("iPhone",$useragent)){
155     print "<ul id=\"home\" title=\"$title\" selected=\"true\">";
156 }else{
157 print "
158   <table BORDER=\"0\" CELLPADDING=\"0\" CELLSPACING=\"2\" WIDTH=\"100%\">
159     <tbody>
160 ";
161 }
162     do {
163 $title = $rowdata[1];
164
165 if ($rowdata[2]== "" ){
166     $count = "[話数]";
167 }else{
168     $count = $rowdata[2];
169 }
170 if ($rowdata[3]== "" ){
171     $subtitle = "[サブタイトル]";
172 }else{
173     $subtitle = $rowdata[3];
174 }
175 $onairdate $rowdata[4];
176
177 $tid = htmlspecialchars($rowdata[0]);
178 $title = htmlspecialchars($title);
179 $count = htmlspecialchars($count);
180 $subtitle = htmlspecialchars($subtitle);
181 $onairdate = htmlspecialchars($onairdate);
182 $pid = htmlspecialchars($rowdata[6]);
183 $fName = htmlspecialchars($rowdata[7]);
184 if (ereg(".MP4", $fName)){
185     $thumbnail = $fName;
186     $thumbnail = ereg_replace(".MP4", ".THM", $thumbnail);
187 }
188 if ($onairdate == ""){
189 $onairdate = "[放送日]";
190 }else{
191 $day = substr($onairdate,0,4)."/".substr($onairdate,4,2)."/".substr($onairdate,6,2);
192 $time = substr($onairdate,8,2).":".substr($onairdate,10,2);
193 $onairdate = "$day $time";
194 }
195 //Starlight Breaker向け拡張
196 //$debug_pg_num_rows = $rs ->rowCount();
197 $caplink = "";
198
199         if ($sbpluginexist == 1) {
200  //$capimgpath = htmlspecialchars(preg_replace("/.m2p/", "", $rowdata[5]));
201  $capimgpath = htmlspecialchars(preg_replace("/.m2./", "", $rowdata[5]));
202     
203     if (($capimgpath != "") && (file_exists("$recfolderpath/$tid.localized/img/$capimgpath") )){
204     $caplink = " / <a href = \"./selectcaptureimage.php?pid=$rowdata[6]\">キャプ</a>";
205     }else{
206     $caplink = " / キャプなし";
207     }
208 }else{
209 $caplink = "";
210 }//end if sb
211
212 if (file_exists("$recfolderpath/$tid.localized/mp4/$thumbnail") ){
213     $imgsrcuri = "$httpmediamappath/$tid.localized/mp4/$thumbnail\" alt=\"$title $count $subtitle";
214 }else{
215     $imgsrcuri = "./img/no-thumbnail-img.png\" alt=\"NO IMAGE";
216 }
217
218 if(ereg("iPhone",$useragent)){
219
220 print "<li><a href=\"http://$serverfqdn/$httpmediamappath/$tid.localized/mp4/$fName\" target=\"_self\">$count $subtitle $onairdate</a></li>\n";
221
222 }else{
223 print "  <tr>
224     <td rowspan=\"4\" width=\"170\"><a href = \"$httpmediamappath/$tid.localized/mp4/$fName\" target=\"_blank\"><img src = \"$imgsrcuri\" width=\"160\" height=\"120\"></a></td>
225     <td>$count</td>
226   </tr>
227   <tr>
228 ";
229     if ($tid == 0){
230     print "\n    <td>$subtitle</td>";
231     }else{
232     print "\n    <td><a href = \"http://cal.syoboi.jp/tid/$tid/time#$pid\" target=\"_blank\">$subtitle</a></td>";
233     }//if
234 print "  </tr>
235   <tr>
236     <td>$onairdate</td>
237   </tr>
238   <tr>
239     <td><a href =\"$httpmediamappath/$tid.localized/mp4/$fName\" target=\"_blank\">$fName</A> / <script language=\"JavaScript\" type=\"text/javascript\">QT_WriteOBJECT_XHTML('http://g.hatena.ne.jp/images/podcasting.gif','16','16','','controller','FALSE','href','http://$serverfqdn/$httpmediamappath/$tid.localized/mp4/$fName','target','QuickTimePlayer','type','video/mp4');</script> $caplink</td>
240   </tr>
241 ";
242
243 }//endif iPhone
244
245     } while ($rowdata = $rs->fetch());
246 }else{
247 print "録画ファイルがありません<br>\n";
248 }//if
249
250 if(ereg("iPhone",$useragent)){
251     print "<li><a href=\"http://$serveruri/showlib.php\" target=\"_self\">一覧へ戻る</a></li>\n";
252     print "</ul>\n";
253 }else{
254     print "</tbody></table>\n";
255 }
256 ?>
257 </body>
258 </html>
259
260    
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。
track feed