annotate index.php @ 100:6619fefc7056

make config.xml writable by anyone if it exists.
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Thu, 04 Mar 2010 17:11:02 +0900
parents cb7da56c4198
children cb04c9ca1cb0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
50
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
1 <?php
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
2
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
3 include_once("config.php");
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
4 include_once( INSTALL_PATH . "/DBRecord.class.php" );
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
5 include_once( INSTALL_PATH . "/Smarty/Smarty.class.php" );
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
6 include_once( INSTALL_PATH . "/reclib.php" );
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
7 include_once( INSTALL_PATH . "/Settings.class.php" );
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
8
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
9 // 設定ファイルの有無を検査する
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
10 if( ! file_exists( INSTALL_PATH."/settings/config.xml") ) {
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
11 header( "Content-Type: text/html;charset=utf-8" );
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
12 exit( "<script type=\"text/javascript\">\n" .
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
13 "<!--\n".
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
14 "window.open(\"install/step1.php\",\"_self\");".
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
15 "// -->\n</script>" );
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
16 }
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
17
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
18 $settings = Settings::factory();
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
19
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
20 $DAY_OF_WEEK = array( "(日)","(月)","(火)","(水)","(木)","(金)","(土)" );
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
21
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
22 // パラメータの処理
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
23 // 表示する長さ(時間)
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
24 $program_length = $settings->program_length;
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
25 if( isset( $_GET['length']) ) $program_length = (int) $_GET['length'];
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
26 // 地上=GR/BS=BS
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
27 $type = "GR";
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
28 if( isset( $_GET['type'] ) ) $type = $_GET['type'];
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
29 // 現在の時間
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
30 $top_time = mktime( date("H"), 0 , 0 );
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
31 if( isset( $_GET['time'] ) ) {
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
32 if( sscanf( $_GET['time'] , "%04d%2d%2d%2d", $y, $mon, $day, $h ) == 4 ) {
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
33 $tmp_time = mktime( $h, 0, 0, $mon, $day, $y );
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
34 if( ($tmp_time < ($top_time + 3600 * 24 * 8)) && ($tmp_time > ($top_time - 3600 * 24 * 8)) )
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
35 $top_time = $tmp_time;
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
36 }
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
37 }
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
38 $last_time = $top_time + 3600 * $program_length;
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
39
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
40 // 時刻欄
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
41 for( $i = 0 ; $i < $program_length; $i++ ) {
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
42 $tvtimes[$i] = date("H", $top_time + 3600 * $i );
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
43 }
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
44
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
45
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
46 // 番組表
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
47 $programs = array();
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
48 if( $type == "BS" ) $channel_map = $BS_CHANNEL_MAP;
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
49 else if( $type == "GR" ) $channel_map = $GR_CHANNEL_MAP;
67
a2c4665b310c add: CS support (thanks to dakku)
Sushi-k <epgrec@park.mda.or.jp>
parents: 58
diff changeset
50 else if( $type == "CS" ) $channel_map = $CS_CHANNEL_MAP;
50
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
51 $st = 0;
76
69e0dabc765a fixed: Reservation.class.php
Sushi-k <epgrec@park.mda.or.jp>
parents: 67
diff changeset
52 $prec = null;
69e0dabc765a fixed: Reservation.class.php
Sushi-k <epgrec@park.mda.or.jp>
parents: 67
diff changeset
53 try {
69e0dabc765a fixed: Reservation.class.php
Sushi-k <epgrec@park.mda.or.jp>
parents: 67
diff changeset
54 $prec = new DBRecord(PROGRAM_TBL);
69e0dabc765a fixed: Reservation.class.php
Sushi-k <epgrec@park.mda.or.jp>
parents: 67
diff changeset
55 }
69e0dabc765a fixed: Reservation.class.php
Sushi-k <epgrec@park.mda.or.jp>
parents: 67
diff changeset
56 catch( Exception $e ) {
69e0dabc765a fixed: Reservation.class.php
Sushi-k <epgrec@park.mda.or.jp>
parents: 67
diff changeset
57 exit('プログラムテーブルが存在しないようです。インストールをやり直してください.');
69e0dabc765a fixed: Reservation.class.php
Sushi-k <epgrec@park.mda.or.jp>
parents: 67
diff changeset
58 }
50
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
59 foreach( $channel_map as $channel_disc => $channel ) {
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
60 $prev_end = $top_time;
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
61 try {
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
62 $crec = new DBRecord( CHANNEL_TBL, "channel_disc", $channel_disc );
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
63 $programs[$st]["station_name"] = $crec->name;
77
cb7da56c4198 modified: Keyword.class.php
Sushi-k <epgrec@park.mda.or.jp>
parents: 76
diff changeset
64 $programs[$st]["channel_disc"] = $crec->channel_disc;
50
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
65
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
66 $reca = $prec->fetch_array( "channel_disc", $channel_disc,
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
67 "endtime > '".toDatetime($top_time)."' ".
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
68 "AND starttime < '". toDatetime($last_time)."' ".
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
69 "ORDER BY starttime ASC "
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
70 );
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
71 $programs[$st]['list'] = array();
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
72 $num = 0;
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
73 foreach( $reca as $prg ) {
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
74 // 前プログラムとの空きを調べる
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
75 $start = toTimestamp( $prg['starttime'] );
51
31f73a50ae33 fix: bug
Sushi-k <epgrec@park.mda.or.jp>
parents: 50
diff changeset
76 if( ($start - $prev_end) > 0 ) {
50
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
77 $height = ($start-$prev_end) * $settings->height_per_hour / 3600;
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
78 $height = $height;
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
79 $programs[$st]['list'][$num]['category_none'] = "none";
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
80 $programs[$st]['list'][$num]['height'] = $height;
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
81 $programs[$st]['list'][$num]['title'] = "";
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
82 $programs[$st]['list'][$num]['starttime'] = "";
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
83 $programs[$st]['list'][$num]['description'] = "";
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
84 $num++;
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
85 }
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
86 $prev_end = toTimestamp( $prg['endtime'] );
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
87
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
88 $height = ((toTimestamp($prg['endtime']) - toTimestamp($prg['starttime'])) * $settings->height_per_hour / 3600);
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
89 // $top_time より早く始まっている番組
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
90 if( toTimestamp($prg['starttime']) <$top_time ) {
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
91 $height = ((toTimestamp($prg['endtime']) - $top_time ) * $settings->height_per_hour / 3600);
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
92 }
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
93 // $last_time より遅く終わる番組
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
94 if( toTimestamp($prg['endtime']) > $last_time ) {
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
95 $height = (($last_time - toTimestamp($prg['starttime'])) * $settings->height_per_hour / 3600);
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
96 }
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
97
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
98 // プログラムを埋める
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
99 $cat = new DBRecord( CATEGORY_TBL, "id", $prg['category_id'] );
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
100 $programs[$st]['list'][$num]['category_name'] = $cat->name_en;
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
101 $programs[$st]['list'][$num]['height'] = $height;
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
102 $programs[$st]['list'][$num]['title'] = $prg['title'];
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
103 $programs[$st]['list'][$num]['starttime'] = date("H:i", $start )."" ;
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
104 $programs[$st]['list'][$num]['description'] = $prg['description'];
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
105 $programs[$st]['list'][$num]['prg_start'] = str_replace( "-", "/", $prg['starttime']);
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
106 $programs[$st]['list'][$num]['duration'] = "" . (toTimestamp($prg['endtime']) - toTimestamp($prg['starttime']));
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
107 $programs[$st]['list'][$num]['channel'] = ($prg['type'] == "GR" ? "地上D" : "BS" ) . ":". $prg['channel'] . "ch";
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
108 $programs[$st]['list'][$num]['id'] = "" . ($prg['id']);
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
109 $programs[$st]['list'][$num]['rec'] = DBRecord::countRecords(RESERVE_TBL, "WHERE complete = '0' AND program_id = '".$prg['id']."'" );
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
110 $num++;
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
111 }
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
112 }
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
113 catch( exception $e ) {
76
69e0dabc765a fixed: Reservation.class.php
Sushi-k <epgrec@park.mda.or.jp>
parents: 67
diff changeset
114 // exit( $e->getMessage() );
69e0dabc765a fixed: Reservation.class.php
Sushi-k <epgrec@park.mda.or.jp>
parents: 67
diff changeset
115 // 何もしない
50
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
116 }
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
117 // 空きを埋める
51
31f73a50ae33 fix: bug
Sushi-k <epgrec@park.mda.or.jp>
parents: 50
diff changeset
118 if( ($last_time - $prev_end) > 0 ) {
50
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
119 $height = ($last_time - $prev_end) * $settings->height_per_hour / 3600;
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
120 $height = $height;
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
121 $programs[$st]['list'][$num]['category_name'] = "none";
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
122 $programs[$st]['list'][$num]['height'] = $height;
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
123 $programs[$st]['list'][$num]['title'] = "";
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
124 $programs[$st]['list'][$num]['starttime'] = "";
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
125 $programs[$st]['list'][$num]['description'] = "";
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
126 $num++;
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
127 }
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
128 $st++;
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
129 }
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
130 $prec = null;
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
131
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
132 // 局の幅
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
133 $ch_set_width = $settings->ch_set_width;
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
134 // 全体の幅
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
135 $chs_width = $ch_set_width * count( $channel_map );
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
136
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
137 // GETパラメタ
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
138 $get_param = $_SERVER['SCRIPT_NAME'] . "?type=".$type."&length=".$program_length."";
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
139
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
140 $smarty = new Smarty();
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
141
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
142 // カテゴリ一覧
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
143 $crec = DBRecord::createRecords( CATEGORY_TBL );
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
144 $cats = array();
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
145 $num = 0;
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
146 foreach( $crec as $val ) {
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
147 $cats[$num]['name_en'] = $val->name_en;
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
148 $cats[$num]['name_jp'] = $val->name_jp;
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
149 $num++;
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
150 }
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
151 $smarty->assign( "cats", $cats );
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
152
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
153
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
154
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
155 // タイプ選択
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
156 $types = array();
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
157 $i = 0;
57
73350e16077a fix: bug
Sushi-k <epgrec@park.mda.or.jp>
parents: 51
diff changeset
158 if( $settings->bs_tuners != 0 ) {
50
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
159 $types[$i]['selected'] = $type == "BS" ? 'class="selected"' : "";
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
160 $types[$i]['link'] = $_SERVER['SCRIPT_NAME'] . "?type=BS&length=".$program_length."&time=".date( "YmdH", $top_time);
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
161 $types[$i]['name'] = "BS";
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
162 $i++;
67
a2c4665b310c add: CS support (thanks to dakku)
Sushi-k <epgrec@park.mda.or.jp>
parents: 58
diff changeset
163
a2c4665b310c add: CS support (thanks to dakku)
Sushi-k <epgrec@park.mda.or.jp>
parents: 58
diff changeset
164 // CS
a2c4665b310c add: CS support (thanks to dakku)
Sushi-k <epgrec@park.mda.or.jp>
parents: 58
diff changeset
165 if ($settings->cs_rec_flg != 0) {
a2c4665b310c add: CS support (thanks to dakku)
Sushi-k <epgrec@park.mda.or.jp>
parents: 58
diff changeset
166 $types[$i]['selected'] = $type == "CS" ? 'class="selected"' : "";
a2c4665b310c add: CS support (thanks to dakku)
Sushi-k <epgrec@park.mda.or.jp>
parents: 58
diff changeset
167 $types[$i]['link'] = $_SERVER['SCRIPT_NAME'] . "?type=CS&length=".$program_length."&time=".date( "YmdH", $top_time);
a2c4665b310c add: CS support (thanks to dakku)
Sushi-k <epgrec@park.mda.or.jp>
parents: 58
diff changeset
168 $types[$i]['name'] = "CS";
a2c4665b310c add: CS support (thanks to dakku)
Sushi-k <epgrec@park.mda.or.jp>
parents: 58
diff changeset
169 $i++;
a2c4665b310c add: CS support (thanks to dakku)
Sushi-k <epgrec@park.mda.or.jp>
parents: 58
diff changeset
170 }
50
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
171 }
57
73350e16077a fix: bug
Sushi-k <epgrec@park.mda.or.jp>
parents: 51
diff changeset
172 if( $settings->gr_tuners != 0 ) {
50
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
173 $types[$i]['selected'] = $type == "GR" ? 'class="selected"' : "";
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
174 $types[$i]['link'] = $_SERVER['SCRIPT_NAME'] . "?type=GR&length=".$program_length."&time=".date( "YmdH", $top_time);
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
175 $types[$i]['name'] = "地上デジタル";
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
176 $i++;
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
177 }
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
178 $smarty->assign( "types", $types );
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
179
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
180 // 日付選択
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
181 $days = array();
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
182 $day = array();
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
183 $day['d'] = "昨日";
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
184 $day['link'] = $get_param . "&time=". date( "YmdH", time() - 3600 *24 );
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
185 $day['ofweek'] = "";
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
186 $day['selected'] = $top_time < mktime( 0, 0 , 0) ? 'class="selected"' : '';
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
187
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
188 array_push( $days , $day );
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
189 $day['d'] = "現在";
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
190 $day['link'] = $get_param;
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
191 $day['ofweek'] = "";
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
192 $day['selected'] = "";
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
193 array_push( $days, $day );
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
194 for( $i = 0 ; $i < 8 ; $i++ ) {
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
195 $day['d'] = "".date("d", time() + 24 * 3600 * $i ) . "日";
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
196 $day['link'] = $get_param . "&time=".date( "Ymd", time() + 24 * 3600 * $i) . date("H" , $top_time );
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
197 $day['ofweek'] = $DAY_OF_WEEK[(int)date( "w", time() + 24 * 3600 * $i )];
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
198 $day['selected'] = date("d", $top_time) == date("d", time() + 24 * 3600 * $i ) ? 'class="selected"' : '';
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
199 array_push( $days, $day );
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
200 }
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
201 $smarty->assign( "days" , $days );
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
202
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
203 // 時間選択
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
204 $toptimes = array();
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
205 for( $i = 0 ; $i < 24; $i+=4 ) {
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
206 $tmp = array();
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
207 $tmp['hour'] = sprintf( "%02d:00", $i );
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
208 $tmp['link'] = $get_param . "&time=".date("Ymd", $top_time ) . sprintf("%02d", $i );
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
209 array_push( $toptimes, $tmp );
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
210 }
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
211 $smarty->assign( "toptimes" , $toptimes );
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
212
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
213 $smarty->assign( "tvtimes", $tvtimes );
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
214 $smarty->assign( "programs", $programs );
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
215 $smarty->assign( "ch_set_width", $settings->ch_set_width );
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
216 $smarty->assign( "chs_width", $chs_width );
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
217 $smarty->assign( "height_per_hour", $settings->height_per_hour );
58
80dc62c94185 add: height_per_minite at index.html
Sushi-k <epgrec@park.mda.or.jp>
parents: 57
diff changeset
218 $smarty->assign( "height_per_min", $settings->height_per_hour / 60 );
50
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
219
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
220 // date("Y-m-d H:i:s", $timestamp);
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
221
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
222 $sitetitle = date( "Y", $top_time ) . "年" . date( "m", $top_time ) . "月" . date( "d", $top_time ) . "日". date( "H", $top_time ) .
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
223 "時~".( $type == "GR" ? "地上デジタル" : "BSデジタル" )."番組表";
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
224
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
225 $smarty->assign("sitetitle", $sitetitle );
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
226
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
227 $smarty->assign("top_time", str_replace( "-", "/" ,toDatetime($top_time)) );
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
228 $smarty->assign("last_time", str_replace( "-", "/" ,toDatetime($last_time)) );
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
229
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
230
c18851a70d33 fix: height use real number
Sushi-k <epgrec@park.mda.or.jp>
parents: 38
diff changeset
231 $smarty->display("index.html");
76
69e0dabc765a fixed: Reservation.class.php
Sushi-k <epgrec@park.mda.or.jp>
parents: 67
diff changeset
232 ?>