root/trunk/install/php/showlibc.php

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

AutoPagerize?対応

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
66
67 //////////////////////////////////////////////////////////
68 //1ページの表示レコード数
69 $lim = 52;
70 //クエリ取得
71 $p = getgetnumform(p);
72 //ページ取得の計算
73 list($st,$p,$p2) = number_page($p,$lim);
74 ///////////////////////////////////////////////////////////
75
76 $now = date("YmdHi");   
77
78 $query = "
79 SELECT foltia_program.title 
80 FROM  foltia_program   
81 WHERE foltia_program.tid = ?
82 ";
83 //$rs = m_query($con, $query, "DBクエリに失敗しました");
84 $rs = sql_query($con, $query, "DBクエリに失敗しました",array($tid));
85 $rowdata = $rs->fetch();
86 if (! $rowdata) {
87 $syobocaldb = `curl "http://cal.syoboi.jp/db?Command=TitleLookup&TID=$tid" | head -2 `;
88 $syobocaldb = mb_convert_encoding($syobocaldb, "EUC-JP", "UTF-8");
89     $syobocaldb = preg_match("/<Title>.*<\/Title>/", $syobocaldb,$title);
90     $title = $title[0];
91     $title = strip_tags($title);
92     $title htmlspecialchars($title) ;
93 }else{
94 $title = $rowdata[0];
95 $title htmlspecialchars($title) ;
96 }
97 //ヘッダ続き
98 print "<title>foltia:Lib $tid:$title</title></head>";
99 $serveruri = getserveruri();
100
101
102 if(ereg("iPhone",$useragent)){
103     print "<body onclick=\"console.log('Hello', event.target);\">
104     <div class=\"toolbar\">
105         <h1 id=\"pageTitle\"></h1>
106         <a id=\"backButton\" class=\"button\" href=\"#\"></a>
107     </div>
108 ";
109 }else{
110
111 print "<body BGCOLOR=\"#ffffff\" TEXT=\"#494949\" LINK=\"#0047ff\" VLINK=\"#000000\" ALINK=\"#c6edff\" >
112 <div align=\"center\">
113 ";
114     printhtmlpageheader();
115 print "  <p align=\"left\"><font color=\"#494949\" size=\"6\">録画ライブラリ番組個別表示</font></p>
116   <hr size=\"4\">
117 <p align=\"left\">再生可能ムービーを表示します。<br>";
118 if ($tid == 0){
119 print "$title 【<A HREF = \"./folcast.php?tid=$tid\">この番組のFolcast</A> [<a href=\"itpc://$serveruri/folcast.php?tid=$tid\">iTunesに登録</a>】 <br>\n";
120 }else{
121 print "<a href=\"http://cal.syoboi.jp/tid/" .
122                      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";
123 }
124 }// endif if(ereg("iPhone",$useragent))
125
126 //確認
127 if (file_exists ("$recfolderpath/$tid.localized")){
128 //    print "ディレクトリは存在します\n";
129 }else{
130 //    print "ディレクトリはありません\n";
131         print "再生可能番組がありません<BR>\n</body></html>";
132     exit;
133 }                     
134
135 //新仕様/* 2006/10/26 */
136 if (file_exists("./selectcaptureimage.php") ) {
137     $sbpluginexist = 1;
138 }
139 $serverfqdn = getserverfqdn();
140
141 //Autopager
142 echo "<div id=contents class=autopagerize_page_element />";
143
144 /////////////////////////////////////////////////////////
145 //レコード総数取得
146     $query = "
147 SELECT
148 COUNT(*) AS cnt
149 FROM foltia_mp4files
150 LEFT JOIN foltia_subtitle
151 ON   foltia_mp4files.mp4filename = foltia_subtitle.pspfilename
152 LEFT JOIN foltia_program
153 ON foltia_mp4files.tid = foltia_program.tid
154 WHERE foltia_mp4files.tid = ? 
155 ";
156
157 $rs = sql_query($con, $query, "DBクエリに失敗しました",array($tid));
158 $rowdata = $rs->fetch();
159 $dtcnt = htmlspecialchars($rowdata[0]);
160 //echo $dtcnt;
161 //
162 if (! $rowdata) {
163         die_exit("番組データがありません。<BR>");
164 }//endif
165
166 //////////////////////////////////////////////////////////
167 //レコード表示
168 $query = "
169 SELECT
170 foltia_program.tid,
171 foltia_program.title,
172 foltia_subtitle.countno,
173 foltia_subtitle.subtitle,
174 foltia_subtitle.startdatetime ,
175 foltia_subtitle.m2pfilename ,
176 foltia_subtitle.pid ,
177 foltia_mp4files.mp4filename
178 FROM foltia_mp4files 
179 LEFT JOIN foltia_subtitle
180 ON   foltia_mp4files.mp4filename = foltia_subtitle.pspfilename   
181 LEFT JOIN foltia_program 
182 ON foltia_mp4files.tid = foltia_program.tid
183 WHERE foltia_mp4files.tid = ? 
184 ORDER BY \"startdatetime\" ASC
185 LIMIT $lim OFFSET $st
186 ";
187
188 $rs = "";
189 //$rs = m_query($con, $query, "DBクエリに失敗しました");
190 $rs = sql_query($con, $query, "DBクエリに失敗しました",array($tid));
191 $rowdata = $rs->fetch();
192 if ($rowdata) {
193 if(ereg("iPhone",$useragent)){
194     print "<ul id=\"home\" title=\"$title\" selected=\"true\">";
195 }else{
196 print "
197   <table BORDER=\"0\" CELLPADDING=\"0\" CELLSPACING=\"2\" WIDTH=\"100%\">
198     <tbody>
199 ";
200 }
201     do {
202 $title = $rowdata[1];
203
204 if ($rowdata[2]== "" ){
205     $count = "[話数]";
206 }else{
207     $count = $rowdata[2];
208 }
209 if ($rowdata[3]== "" ){
210     $subtitle = "[サブタイトル]";
211 }else{
212     $subtitle = $rowdata[3];
213 }
214 $onairdate $rowdata[4];
215
216 $tid = htmlspecialchars($rowdata[0]);
217 $title = htmlspecialchars($title);
218 $count = htmlspecialchars($count);
219 $subtitle = htmlspecialchars($subtitle);
220 $onairdate = htmlspecialchars($onairdate);
221 $pid = htmlspecialchars($rowdata[6]);
222 $fName = htmlspecialchars($rowdata[7]);
223 if (ereg(".MP4", $fName)){
224     $thumbnail = $fName;
225     $thumbnail = ereg_replace(".MP4", ".THM", $thumbnail);
226 }
227 if ($onairdate == ""){
228 $onairdate = "[放送日]";
229 }else{
230 $day = substr($onairdate,0,4)."/".substr($onairdate,4,2)."/".substr($onairdate,6,2);
231 $time = substr($onairdate,8,2).":".substr($onairdate,10,2);
232 $onairdate = "$day $time";
233 }
234 //Starlight Breaker向け拡張
235 //$debug_pg_num_rows = $rs ->rowCount();
236 $caplink = "";
237
238         if ($sbpluginexist == 1) {
239  //$capimgpath = htmlspecialchars(preg_replace("/.m2p/", "", $rowdata[5]));
240  $capimgpath = htmlspecialchars(preg_replace("/.m2./", "", $rowdata[5]));
241     
242     if (($capimgpath != "") && (file_exists("$recfolderpath/$tid.localized/img/$capimgpath") )){
243     $caplink = " / <a href = \"./selectcaptureimage.php?pid=$rowdata[6]\">キャプ</a>";
244     }else{
245     $caplink = " / キャプなし";
246     }
247 }else{
248 $caplink = "";
249 }//end if sb
250
251 if (file_exists("$recfolderpath/$tid.localized/mp4/$thumbnail") ){
252     $imgsrcuri = "$httpmediamappath/$tid.localized/mp4/$thumbnail\" alt=\"$title $count $subtitle";
253 }else{
254     $imgsrcuri = "./img/no-thumbnail-img.png\" alt=\"NO IMAGE";
255 }
256
257 if(ereg("iPhone",$useragent)){
258
259 print "<li><a href=\"http://$serverfqdn/$httpmediamappath/$tid.localized/mp4/$fName\" target=\"_self\">$count $subtitle $onairdate</a></li>\n";
260
261 }else{
262 print "  <tr>
263     <td rowspan=\"4\" width=\"170\"><a href=\"./mp4player.php?p=$pid\" target=\"_blank\"><img src = \"$imgsrcuri\" width=\"160\" height=\"120\"></a></td>
264     <td>$count</td>
265   </tr>
266   <tr>
267 ";
268     if ($tid == 0){
269     print "\n    <td>$subtitle</td>";
270     }else{
271     print "\n    <td><a href = \"http://cal.syoboi.jp/tid/$tid/time#$pid\" target=\"_blank\">$subtitle</a></td>";
272     }//if
273 print "  </tr>
274   <tr>
275     <td>$onairdate</td>
276   </tr>
277   <tr>
278     <td><a href =\"$httpmediamappath/$tid.localized/mp4/$fName\" target=\"_blank\">$fName</A> / <a href=\"./mp4player.php?p=$pid\" target=\"_blank\">Player</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>
279   </tr>
280 ";
281
282 }//endif iPhone
283
284     } while ($rowdata = $rs->fetch());
285 }else{
286 print "録画ファイルがありません<br>\n";
287 }//if
288
289 if(ereg("iPhone",$useragent)){
290     print "<li><a href=\"http://$serveruri/showlib.php\" target=\"_self\">一覧へ戻る</a></li>\n";
291     print "</ul>\n";
292 }else{
293     print "</tbody></table>\n";
294 }
295
296 //////////////////////////////////////////////
297 //クエリ代入
298 $query_st $tid;
299 //Autopager処理とページのリンク表示
300 page_display($query_st,$p,$p2,$lim,$dtcnt,"");
301 //////////////////////////////////////////////
302 ?>
303 </body>
304 </html>
305
306    
307
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。
track feed