root/trunk/install/php/showplaylist.php

リビジョン 103, 7.4 kB (コミッタ: sorshi, コミット時期: 15 年 前)

PHP tag short open style修正

Line 
1 <?php
2 /*
3  Anime recording system foltia
4  http://www.dcc-jpl.com/soft/foltia/
5
6 showplaylist.php
7
8 目的
9 録画したmpeg2の番組一覧を表示します。
10
11
12 オプション
13 list:
14  省略時、録画順にソートされる。
15  titleのときに、番組順ソートされる。
16  rawのときに、DBに記録されている番組録画情報ではなくディレクトリにあるm2p/m2tファイルを全て表示する。
17
18  DCC-JPL Japan/foltia project
19
20 */
21
22 include("./foltialib.php");
23 $con = m_connect();
24
25 if ($useenvironmentpolicy == 1){
26     if (!isset($_SERVER['PHP_AUTH_USER'])) {
27         header("WWW-Authenticate: Basic realm=\"foltia\"");
28         header("HTTP/1.0 401 Unauthorized");
29         redirectlogin();
30         exit;
31     } else {
32     login($con,$_SERVER['PHP_AUTH_USER'],$_SERVER['PHP_AUTH_PW']);
33     }
34 }//end if login
35
36
37 ?>
38 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
39 <html lang="ja">
40 <head>
41 <meta http-equiv="Content-Type" content="text/html; charset=EUC-JP">
42 <meta http-equiv="Content-Style-Type" content="text/css">
43 <link rel="stylesheet" type="text/css" href="graytable.css">
44 <?php
45
46 // Syabas 判定
47 $useragent = $_SERVER['HTTP_USER_AGENT'];
48
49 //ディスク空き容量によって背景色表示変更
50 warndiskfreearea();
51
52 print "<title>foltia:recorded file list</title>
53 </head>";
54
55 $now = date("YmdHi");   
56 ?>
57 <body BGCOLOR="#ffffff" TEXT="#494949" LINK="#0047ff" VLINK="#000000" ALINK="#c6edff" >
58 <div align="center">
59 <?php
60     printhtmlpageheader();
61 ?>
62   <p align="left"><font color="#494949" size="6">録画一覧表示</font></p>
63   <hr size="4">
64 <p align="left">再生可能番組リストを表示します。<br>
65 <?php
66 if ($demomode){
67 }else{
68     printdiskusage();
69     printtrcnprocesses();
70 }
71 ?>
72 <form name="deletemovie" method="POST" action="./deletemovie.php">
73 <p align="left"><input type="submit" value="項目削除" ></p>
74
75   <table BORDER="0" CELLPADDING="0" CELLSPACING="2" WIDTH="100%">
76     <thead>
77         <tr>
78             <th align="left">削除</th>
79             <th align="left"><A HREF="./showplaylist.php">ファイル名</A></th>
80             <th align="left"><A HREF="./showplaylist.php?list=title">タイトル</A></th>
81             <th align="left">話数</th>
82             <th align="left">サブタイ</th>
83 <?php
84 if (file_exists("./selectcaptureimage.php") ) {
85 print "            <th align=\"left\">キャプ</th>\n";
86 }
87 ?>
88         </tr>
89     </thead>
90
91     <tbody>
92
93
94 <?php
95 $list = getgetform('list');
96
97 //旧仕様
98 if($list == "raw"){
99 exec ("ls -t  $recfolderpath/*.m2?", $m2pfiles);
100
101
102 foreach($m2pfiles as $pathfName) {
103 $fNametmp = split("/",$pathfName);
104 $fName = array_pop($fNametmp);
105 //print "FILENAME:$fName<BR>\n";
106
107         if(($fName == ".") or ($fName == "..") ){ continue; }
108     if (ereg(".m2.+", $fName)){
109         $filesplit = split("-",$fName);
110     
111 if ($filesplit[1] == ""){
112 $query = "
113 SELECT
114 foltia_program.tid,foltia_program.title,foltia_subtitle.subtitle 
115 FROM foltia_subtitle , foltia_program   
116 WHERE foltia_program.tid = foltia_subtitle.tid 
117  AND foltia_subtitle.tid = ?
118 ";
119 //$rs = m_query($con, $query, "DBクエリに失敗しました");
120 $rs = sql_query($con, $query, "DBクエリに失敗しました",array($filesplit[0]));
121                 $rall = $rs->fetchAll();
122                 $rowdata = $rall[$row];
123 //print" $fName./$rowdata[1]//$rowdata[2]<BR>\n";
124 $title = $rowdata[1];
125 $subtitle = "";
126 $count = "";
127 }else{
128
129 $query = "
130 SELECT
131 foltia_program.tid,foltia_program.title,foltia_subtitle.countno,foltia_subtitle.subtitle 
132 FROM foltia_subtitle , foltia_program   
133 WHERE foltia_program.tid = foltia_subtitle.tid 
134  AND foltia_subtitle.tid = ?
135  AND foltia_subtitle.countno = ?
136 ";
137 //$rs = m_query($con, $query, "DBクエリに失敗しました");
138 $rs = sql_query($con, $query, "DBクエリに失敗しました",array($filesplit[0],$filesplit[1]));
139                 $rall = $rs->fetchAll();
140                 $rowdata = $rall[$row];
141 //print" $fName./$rowdata[1]/$rowdata[2]/$rowdata[3]<BR>\n";
142 $title = $rowdata[1];
143 $count = $rowdata[2];
144 $subtitle = $rowdata[3];
145 }//if 話数あるかどうか
146
147 $tid = htmlspecialchars($rowdata[0]);
148 $title = htmlspecialchars($title);
149 $count = htmlspecialchars($count);
150 $subtitle = htmlspecialchars($subtitle);
151
152 //--
153 print "
154 <tr>
155 <td><INPUT TYPE='checkbox' NAME='delete[]' VALUE='$fName'><br></td>
156 <td><A HREF=\"$httpmediamappath/$fName\">$fName</A><br></td>
157 <td><a href=\"http://cal.syoboi.jp/tid/$tid\" target=\"_blank\">$title</a></td>
158 <td>$count<br></td>
159 <td>$subtitle<br></td>";
160     if (file_exists("./selectcaptureimage.php") ) {
161 //    $capimgpath = preg_replace("/.m2p/", "", $fName);
162     print "            <td align=\"left\"> N/A </td>\n";
163     }
164
165 print "</tr>\n
166 ";
167 }//ereg
168 }//foreach
169 print "    </tbody>\n</table>\n</FORM>\n</body>\n</html>\n";
170 exit;
171 }elseif ($list== "title"){//新仕様
172 $query = "
173 SELECT
174 foltia_program.tid,
175 foltia_program.title,
176 foltia_subtitle.countno,
177 foltia_subtitle.subtitle  ,
178 foltia_m2pfiles.m2pfilename  ,
179 foltia_subtitle.pid   
180 FROM foltia_subtitle , foltia_program , foltia_m2pfiles
181 WHERE foltia_program.tid = foltia_subtitle.tid 
182  AND foltia_subtitle.m2pfilename = foltia_m2pfiles.m2pfilename
183 ORDER BY foltia_subtitle.tid  DESC , foltia_subtitle.startdatetime  ASC
184
185
186 ";
187 }else{
188 $query = "
189 SELECT
190 foltia_program.tid,
191 foltia_program.title,
192 foltia_subtitle.countno,
193 foltia_subtitle.subtitle  ,
194 foltia_m2pfiles.m2pfilename  ,
195 foltia_subtitle.pid   
196 FROM foltia_subtitle , foltia_program , foltia_m2pfiles
197 WHERE foltia_program.tid = foltia_subtitle.tid 
198  AND foltia_subtitle.m2pfilename = foltia_m2pfiles.m2pfilename
199 ORDER BY foltia_subtitle.startdatetime DESC
200 ";
201 }
202
203 //$rs = m_query($con, $query, "DBクエリに失敗しました");
204 $rs = sql_query($con, $query, "DBクエリに失敗しました");
205 $rowdata = $rs->fetch();
206 if ($rowdata) {
207     do {
208 $tid = htmlspecialchars($rowdata[0]);
209 $title = htmlspecialchars($rowdata[1]);
210 $count = htmlspecialchars($rowdata[2]);
211 $subtitle = htmlspecialchars($rowdata[3]);
212 $fName  = htmlspecialchars($rowdata[4]);
213 $pid  = htmlspecialchars($rowdata[5]);
214 //--
215 print "
216 <tr>
217 <td><INPUT TYPE='checkbox' NAME='delete[]' VALUE='$fName'><br></td>";
218 if (ereg("syabas",$useragent)){
219 print "<td><A HREF=\"./view_syabas.php?pid=$pid\" vod=playlist>$fName</td>";
220 }
221 else{
222 print "<td><A HREF=\"$httpmediamappath/$fName\">$fName</A><br></td>";
223 }
224 if ($tid > 0){
225 print"<td><a href=\"http://cal.syoboi.jp/tid/$tid\" target=\"_blank\">$title</a></td>
226 <td>$count<br></td>
227 <td><a href = \"http://cal.syoboi.jp/tid/$tid/time#$pid\" target=\"_blank\">$subtitle</a><br></td>";
228 }else{
229 print"<td>$title</td>
230 <td>$count<br></td>
231 <td>$subtitle<br></td>";
232 }
233     if (file_exists("./selectcaptureimage.php") ) {
234     $capimgpath = preg_replace("/.m2.+/", "", $fName);
235     print "            <td align=\"left\"><a href=\"./selectcaptureimage.php?pid=$pid\">キャプ</a></td>\n";
236     }
237 print "</tr>\n
238 ";
239     } while ($rowdata = $rs->fetch());
240 }else{
241 print "
242 <tr>
243 <td COLSPAN=\"5\">ファイルがありません</td>
244 </tr>
245 ";
246
247
248 }//end if
249
250 print "</tbody>
251 </table>
252 </FORM>\n";
253
254 //番組ソートの時、未読番組のタイトルだけ表示
255 if ($list== "title"){
256 $query = "
257 SELECT distinct
258 foltia_program.tid,
259 foltia_program.title
260 FROM foltia_subtitle , foltia_program , foltia_m2pfiles
261 WHERE foltia_program.tid = foltia_subtitle.tid 
262  AND foltia_subtitle.m2pfilename = foltia_m2pfiles.m2pfilename
263 ORDER BY foltia_program.tid DESC
264 ";
265
266 //$rs = m_query($con, $query, "DBクエリに失敗しました");
267 $rs = sql_query($con, $query, "DBクエリに失敗しました");
268     $rowdata = $rs->fetch();
269     if ($rowdata) {
270 print "<hr>
271 <p align=\"left\">未読タイトルを表示します。<br>
272   <table BORDER=\"0\" CELLPADDING=\"0\" CELLSPACING=\"2\" WIDTH=\"100%\">
273     <thead>
274         <tr>
275             <th align=\"left\">TID</th>
276             <th align=\"left\">タイトル</th>
277         </tr>
278     </thead>
279     <tbody>
280 ";
281
282         do {
283 $tid = htmlspecialchars($rowdata[0]);
284 $title = htmlspecialchars($rowdata[1]);
285
286 print "<tr><td>$tid</td><td>$title</td></tr>\n";
287
288         } while ($rowdata = $rs->fetch());
289 print "</tbody></table>\n";
290 }//if maxrows
291 }//if title
292
293 ?>
294    
295
296 </body>
297 </html>
298
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。
track feed