Mercurial > epgrec.yaz
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 |
rev | line source |
---|---|
1 | 1 <?php |
2 include_once('config.php'); | |
3 include_once( INSTALL_PATH . '/DBRecord.class.php' ); | |
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 | 9 |
10 $order = ""; | |
11 $search = ""; | |
12 $category_id = 0; | |
13 $station = 0; | |
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 | 19 $options = "WHERE starttime < '". date("Y-m-d H:i:s")."'"; // ながら再生は無理っぽい? |
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 | 25 if(isset( $_POST['do_search'] )) { |
26 if( isset($_POST['search'])){ | |
27 if( $_POST['search'] != "" ) { | |
28 $search = $_POST['search']; | |
29 $options .= " AND CONCAT(title,description) like '%".mysql_real_escape_string($_POST['search'])."%'"; | |
30 } | |
31 } | |
32 if( isset($_POST['category_id'])) { | |
33 if( $_POST['category_id'] != 0 ) { | |
34 $category_id = $_POST['category_id']; | |
35 $options .= " AND category_id = '".$_POST['category_id']."'"; | |
36 } | |
37 } | |
38 if( isset($_POST['station'])) { | |
39 if( $_POST['station'] != 0 ) { | |
40 $station = $_POST['station']; | |
41 $options .= " AND channel_id = '".$_POST['station']."'"; | |
42 } | |
43 } | |
44 } | |
45 | |
46 | |
47 $options .= " ORDER BY starttime DESC"; | |
48 | |
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 | 51 $records = array(); |
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 | 55 $arr = array(); |
56 $arr['id'] = $r->id; | |
57 $arr['station_name'] = $ch->name; | |
58 $arr['starttime'] = $r->starttime; | |
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 | 63 $arr['thumb'] = "<img src=\"".$settings->install_url.$settings->thumbs."/".htmlentities($r->path, ENT_QUOTES,"UTF-8").".jpg\" />"; |
1 | 64 $arr['cat'] = $cat->name_en; |
65 $arr['mode'] = $RECORD_MODE[$r->mode]['name']; | |
66 | |
67 array_push( $records, $arr ); | |
68 } | |
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 | 71 $cats = array(); |
72 $cats[0]['id'] = 0; | |
73 $cats[0]['name'] = "すべて"; | |
74 $cats[0]['selected'] = $category_id == 0 ? "selected" : ""; | |
75 foreach( $crecs as $c ) { | |
76 $arr = array(); | |
77 $arr['id'] = $c->id; | |
78 $arr['name'] = $c->name_jp; | |
79 $arr['selected'] = $c->id == $category_id ? "selected" : ""; | |
80 array_push( $cats, $arr ); | |
81 } | |
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 | 84 $stations = array(); |
85 $stations[0]['id'] = 0; | |
86 $stations[0]['name'] = "すべて"; | |
87 $stations[0]['selected'] = (! $station) ? "selected" : ""; | |
88 foreach( $crecs as $c ) { | |
89 $arr = array(); | |
90 $arr['id'] = $c->id; | |
91 $arr['name'] = $c->name; | |
92 $arr['selected'] = $station == $c->id ? "selected" : ""; | |
93 array_push( $stations, $arr ); | |
94 } | |
95 | |
96 | |
97 $smarty = new Smarty(); | |
98 $smarty->assign("sitetitle","録画済一覧"); | |
99 $smarty->assign( "records", $records ); | |
100 $smarty->assign( "search", $search ); | |
101 $smarty->assign( "stations", $stations ); | |
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 | 104 |
105 $smarty->display("recordedTable.html"); | |
106 | |
107 | |
108 } | |
109 catch( exception $e ) { | |
110 exit( $e->getMessage() ); | |
111 } | |
39
8965ef108821
change: modify all scripts for web base setting.
Sushi-k <epgrec@park.mda.or.jp>
parents:
14
diff
changeset
|
112 ?> |