annotate recordedTable.php @ 175:f68f63465a41 default tip

handles RecException instead of Exception
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Tue, 16 Apr 2013 15:24:02 +0900
parents 4bd07b03c694
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
1 <?php
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
2 include_once('config.php');
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
3 include_once( INSTALL_PATH . '/DBRecord.class.php' );
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
4 include_once( INSTALL_PATH . '/Smarty/Smarty.class.php' );
39
8965ef108821 change: modify all scripts for web base setting.
Sushi-k <epgrec@park.mda.or.jp>
parents: 14
diff changeset
5 include_once( INSTALL_PATH . '/Settings.class.php' );
8965ef108821 change: modify all scripts for web base setting.
Sushi-k <epgrec@park.mda.or.jp>
parents: 14
diff changeset
6
8965ef108821 change: modify all scripts for web base setting.
Sushi-k <epgrec@park.mda.or.jp>
parents: 14
diff changeset
7 $settings = Settings::factory();
8965ef108821 change: modify all scripts for web base setting.
Sushi-k <epgrec@park.mda.or.jp>
parents: 14
diff changeset
8
1
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
9
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
10 $order = "";
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
11 $search = "";
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
12 $category_id = 0;
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
13 $station = 0;
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
14
10
152b146bd276 fixed: mysql_connect before mysql_real_escape_string
Sushi-k <epgrec@park.mda.or.jp>
parents: 1
diff changeset
15 // mysql_real_escape_stringより先に接続しておく必要がある
39
8965ef108821 change: modify all scripts for web base setting.
Sushi-k <epgrec@park.mda.or.jp>
parents: 14
diff changeset
16 $dbh = @mysql_connect( $settings->db_host, $settings->db_user, $settings->db_pass );
10
152b146bd276 fixed: mysql_connect before mysql_real_escape_string
Sushi-k <epgrec@park.mda.or.jp>
parents: 1
diff changeset
17
61
87ded65fa485 add: keyword link
yoneda <yoneda@recorder.localnet.mda.or.jp>
parents: 39
diff changeset
18 // $options = "WHERE complete='1'";
1
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
19 $options = "WHERE starttime < '". date("Y-m-d H:i:s")."'"; // ながら再生は無理っぽい?
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
20
61
87ded65fa485 add: keyword link
yoneda <yoneda@recorder.localnet.mda.or.jp>
parents: 39
diff changeset
21 if(isset( $_GET['key']) ) {
87ded65fa485 add: keyword link
yoneda <yoneda@recorder.localnet.mda.or.jp>
parents: 39
diff changeset
22 $options .= " AND autorec ='".mysql_real_escape_string(trim($_GET['key']))."'";
87ded65fa485 add: keyword link
yoneda <yoneda@recorder.localnet.mda.or.jp>
parents: 39
diff changeset
23 }
87ded65fa485 add: keyword link
yoneda <yoneda@recorder.localnet.mda.or.jp>
parents: 39
diff changeset
24
1
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
25 if(isset( $_POST['do_search'] )) {
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
26 if( isset($_POST['search'])){
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
27 if( $_POST['search'] != "" ) {
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
28 $search = $_POST['search'];
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
29 $options .= " AND CONCAT(title,description) like '%".mysql_real_escape_string($_POST['search'])."%'";
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
30 }
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
31 }
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
32 if( isset($_POST['category_id'])) {
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
33 if( $_POST['category_id'] != 0 ) {
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
34 $category_id = $_POST['category_id'];
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
35 $options .= " AND category_id = '".$_POST['category_id']."'";
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
36 }
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
37 }
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
38 if( isset($_POST['station'])) {
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
39 if( $_POST['station'] != 0 ) {
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
40 $station = $_POST['station'];
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
41 $options .= " AND channel_id = '".$_POST['station']."'";
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
42 }
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
43 }
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
44 }
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
45
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
46
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
47 $options .= " ORDER BY starttime DESC";
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
48
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
49 try{
39
8965ef108821 change: modify all scripts for web base setting.
Sushi-k <epgrec@park.mda.or.jp>
parents: 14
diff changeset
50 $rvs = DBRecord::createRecords(RESERVE_TBL, $options );
1
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
51 $records = array();
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
52 foreach( $rvs as $r ) {
39
8965ef108821 change: modify all scripts for web base setting.
Sushi-k <epgrec@park.mda.or.jp>
parents: 14
diff changeset
53 $cat = new DBRecord(CATEGORY_TBL, "id", $r->category_id );
8965ef108821 change: modify all scripts for web base setting.
Sushi-k <epgrec@park.mda.or.jp>
parents: 14
diff changeset
54 $ch = new DBRecord(CHANNEL_TBL, "id", $r->channel_id );
1
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
55 $arr = array();
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
56 $arr['id'] = $r->id;
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
57 $arr['station_name'] = $ch->name;
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
58 $arr['starttime'] = $r->starttime;
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
59 $arr['endtime'] = $r->endtime;
39
8965ef108821 change: modify all scripts for web base setting.
Sushi-k <epgrec@park.mda.or.jp>
parents: 14
diff changeset
60 $arr['asf'] = "".$settings->install_url."/viewer.php?reserve_id=".$r->id;
14
bbbc4f1ecf1d added: remove video with real file.
Sushi-k <epgrec@park.mda.or.jp>
parents: 10
diff changeset
61 $arr['title'] = htmlspecialchars($r->title,ENT_QUOTES);
bbbc4f1ecf1d added: remove video with real file.
Sushi-k <epgrec@park.mda.or.jp>
parents: 10
diff changeset
62 $arr['description'] = htmlspecialchars($r->description,ENT_QUOTES);
108
4bd07b03c694 fix: #ʸե̾˺ȥ͡뤬ɽǤʤꡩ
Sushi-k <epgrec@park.mda.or.jp>
parents: 61
diff changeset
63 $arr['thumb'] = "<img src=\"".$settings->install_url.$settings->thumbs."/".htmlentities($r->path, ENT_QUOTES,"UTF-8").".jpg\" />";
1
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
64 $arr['cat'] = $cat->name_en;
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
65 $arr['mode'] = $RECORD_MODE[$r->mode]['name'];
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
66
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
67 array_push( $records, $arr );
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
68 }
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
69
39
8965ef108821 change: modify all scripts for web base setting.
Sushi-k <epgrec@park.mda.or.jp>
parents: 14
diff changeset
70 $crecs = DBRecord::createRecords(CATEGORY_TBL );
1
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
71 $cats = array();
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
72 $cats[0]['id'] = 0;
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
73 $cats[0]['name'] = "すべて";
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
74 $cats[0]['selected'] = $category_id == 0 ? "selected" : "";
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
75 foreach( $crecs as $c ) {
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
76 $arr = array();
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
77 $arr['id'] = $c->id;
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
78 $arr['name'] = $c->name_jp;
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
79 $arr['selected'] = $c->id == $category_id ? "selected" : "";
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
80 array_push( $cats, $arr );
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
81 }
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
82
39
8965ef108821 change: modify all scripts for web base setting.
Sushi-k <epgrec@park.mda.or.jp>
parents: 14
diff changeset
83 $crecs = DBRecord::createRecords(CHANNEL_TBL );
1
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
84 $stations = array();
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
85 $stations[0]['id'] = 0;
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
86 $stations[0]['name'] = "すべて";
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
87 $stations[0]['selected'] = (! $station) ? "selected" : "";
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
88 foreach( $crecs as $c ) {
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
89 $arr = array();
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
90 $arr['id'] = $c->id;
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
91 $arr['name'] = $c->name;
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
92 $arr['selected'] = $station == $c->id ? "selected" : "";
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
93 array_push( $stations, $arr );
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
94 }
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
95
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
96
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
97 $smarty = new Smarty();
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
98 $smarty->assign("sitetitle","録画済一覧");
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
99 $smarty->assign( "records", $records );
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
100 $smarty->assign( "search", $search );
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
101 $smarty->assign( "stations", $stations );
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
102 $smarty->assign( "cats", $cats );
39
8965ef108821 change: modify all scripts for web base setting.
Sushi-k <epgrec@park.mda.or.jp>
parents: 14
diff changeset
103 $smarty->assign( "use_thumbs", $settings->use_thumbs );
1
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
104
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
105 $smarty->display("recordedTable.html");
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
106
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
107
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
108 }
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
109 catch( exception $e ) {
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
110 exit( $e->getMessage() );
f5a9f0eb4858 deleted: LICENSE.ja
Sushi-k <epgrec@park.mda.or.jp>
parents:
diff changeset
111 }
39
8965ef108821 change: modify all scripts for web base setting.
Sushi-k <epgrec@park.mda.or.jp>
parents: 14
diff changeset
112 ?>