root/trunk/install/php/showplaylist.php

リビジョン 70, 7.2 kB (コミッタ: sorshi, コミット時期: 17 年 前)

環境ポリシー機能搭載

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ファイルを全て表示する。
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 <?
95 $list = getgetform('list');
96
97 //旧仕様
98 if($list == "raw"){
99 exec ("ls -t  $recfolderpath/*.m2p", $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(".m2p", $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 = $filesplit[0]
118 ";
119 $rs = m_query($con, $query, "DBクエリに失敗しました");
120 $rowdata = pg_fetch_row($rs, $row);
121 //print" $fName./$rowdata[1]//$rowdata[2]<BR>\n";
122 $title = $rowdata[1];
123 $subtitle = "";
124 $count = "";
125 }else{
126
127 $query = "
128 SELECT
129 foltia_program.tid,foltia_program.title,foltia_subtitle.countno,foltia_subtitle.subtitle 
130 FROM foltia_subtitle , foltia_program   
131 WHERE foltia_program.tid = foltia_subtitle.tid 
132  AND foltia_subtitle.tid = $filesplit[0]
133  AND foltia_subtitle.countno = $filesplit[1]
134 ";
135 $rs = m_query($con, $query, "DBクエリに失敗しました");
136 $rowdata = pg_fetch_row($rs, $row);
137 //print" $fName./$rowdata[1]/$rowdata[2]/$rowdata[3]<BR>\n";
138 $title = $rowdata[1];
139 $count = $rowdata[2];
140 $subtitle = $rowdata[3];
141 }//if 話数あるかどうか
142
143 $tid = htmlspecialchars($rowdata[0]);
144 $title = htmlspecialchars($title);
145 $count = htmlspecialchars($count);
146 $subtitle = htmlspecialchars($subtitle);
147
148 //--
149 print "
150 <tr>
151 <td><INPUT TYPE='checkbox' NAME='delete[]' VALUE='$fName'><br></td>
152 <td><A HREF=\"$httpmediamappath/$fName\">$fName</A><br></td>
153 <td><a href=\"http://cal.syoboi.jp/tid/$tid\" target=\"_blank\">$title</a></td>
154 <td>$count<br></td>
155 <td>$subtitle<br></td>";
156     if (file_exists("./selectcaptureimage.php") ) {
157 //    $capimgpath = preg_replace("/.m2p/", "", $fName);
158     print "            <td align=\"left\"> N/A </td>\n";
159     }
160
161 print "</tr>\n
162 ";
163 }//ereg
164 }//foreach
165 print "    </tbody>\n</table>\n</FORM>\n</body>\n</html>\n";
166 exit;
167 }elseif ($list== "title"){//新仕様
168 $query = "
169 SELECT
170 foltia_program.tid,
171 foltia_program.title,
172 foltia_subtitle.countno,
173 foltia_subtitle.subtitle  ,
174 foltia_m2pfiles.m2pfilename  ,
175 foltia_subtitle.pid   
176 FROM foltia_subtitle , foltia_program , foltia_m2pfiles
177 WHERE foltia_program.tid = foltia_subtitle.tid 
178  AND foltia_subtitle.m2pfilename = foltia_m2pfiles.m2pfilename
179 ORDER BY foltia_subtitle.tid  DESC , foltia_subtitle.startdatetime  ASC
180
181
182 ";
183 }else{
184 $query = "
185 SELECT
186 foltia_program.tid,
187 foltia_program.title,
188 foltia_subtitle.countno,
189 foltia_subtitle.subtitle  ,
190 foltia_m2pfiles.m2pfilename  ,
191 foltia_subtitle.pid   
192 FROM foltia_subtitle , foltia_program , foltia_m2pfiles
193 WHERE foltia_program.tid = foltia_subtitle.tid 
194  AND foltia_subtitle.m2pfilename = foltia_m2pfiles.m2pfilename
195 ORDER BY foltia_subtitle.startdatetime DESC
196 ";
197 }
198
199 $rs = m_query($con, $query, "DBクエリに失敗しました");
200 $maxrows = pg_num_rows($rs);
201
202 if ($maxrows > 0){
203 for ($row = 0; $row < $maxrows; $row++) {
204 $rowdata = pg_fetch_row($rs, $row);
205
206 $tid = htmlspecialchars($rowdata[0]);
207 $title = htmlspecialchars($rowdata[1]);
208 $count = htmlspecialchars($rowdata[2]);
209 $subtitle = htmlspecialchars($rowdata[3]);
210 $fName  = htmlspecialchars($rowdata[4]);
211 $pid  = htmlspecialchars($rowdata[5]);
212 //--
213 print "
214 <tr>
215 <td><INPUT TYPE='checkbox' NAME='delete[]' VALUE='$fName'><br></td>";
216 if (ereg("syabas",$useragent)){
217 print "<td><A HREF=\"./view_syabas.php?pid=$pid\" vod=playlist>$fName</td>";
218 }
219 else{
220 print "<td><A HREF=\"$httpmediamappath/$fName\">$fName</A><br></td>";
221 }
222 if ($tid > 0){
223 print"<td><a href=\"http://cal.syoboi.jp/tid/$tid\" target=\"_blank\">$title</a></td>
224 <td>$count<br></td>
225 <td><a href = \"http://cal.syoboi.jp/tid/$tid/time#$pid\" target=\"_blank\">$subtitle</a><br></td>";
226 }else{
227 print"<td>$title</td>
228 <td>$count<br></td>
229 <td>$subtitle<br></td>";
230 }
231     if (file_exists("./selectcaptureimage.php") ) {
232     $capimgpath = preg_replace("/.m2p/", "", $fName);
233     print "            <td align=\"left\"><a href=\"./selectcaptureimage.php?pid=$pid\">キャプ</a></td>\n";
234     }
235 print "</tr>\n
236 ";
237 }//for
238 }else{
239 print "
240 <tr>
241 <td COLSPAN=\"5\">ファイルがありません</td>
242 </tr>
243 ";
244
245
246 }//end if
247
248 print "</tbody>
249 </table>
250 </FORM>\n";
251
252 //番組ソートの時、未読番組のタイトルだけ表示
253 if ($list== "title"){
254 $query = "
255 SELECT distinct
256 foltia_program.tid,
257 foltia_program.title
258 FROM foltia_subtitle , foltia_program , foltia_m2pfiles
259 WHERE foltia_program.tid = foltia_subtitle.tid 
260  AND foltia_subtitle.m2pfilename = foltia_m2pfiles.m2pfilename
261 ORDER BY foltia_program.tid DESC
262 ";
263
264 $rs = m_query($con, $query, "DBクエリに失敗しました");
265 $maxrows = pg_num_rows($rs);
266
267
268 if ($maxrows > 0){
269 print "<hr>
270 <p align=\"left\">未読タイトルを表示します。<br>
271   <table BORDER=\"0\" CELLPADDING=\"0\" CELLSPACING=\"2\" WIDTH=\"100%\">
272     <thead>
273         <tr>
274             <th align=\"left\">TID</th>
275             <th align=\"left\">タイトル</th>
276         </tr>
277     </thead>
278     <tbody>
279 ";
280
281 for ($row = 0; $row < $maxrows; $row++) {
282 $rowdata = pg_fetch_row($rs, $row);
283
284 $tid = htmlspecialchars($rowdata[0]);
285 $title = htmlspecialchars($rowdata[1]);
286
287
288 print "<tr><td>$tid</td><td>$title</td></tr>\n";
289
290 }//for
291 print "</tbody></table>\n";
292 }//if maxrows
293 }//if title
294
295 ?>
296    
297
298 </body>
299 </html>
300
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。
track feed