チェンジセット 94: trunk/install/php
- コミット日時:
- 2010/02/28 22:28:26 (15 年前)
- ファイル:
-
- trunk/install/php/StarlightBreaker/sb-edit.php (更新) (1 diff)
- trunk/install/php/accountregist.php (更新) (3 diffs)
- trunk/install/php/delepgp.php (更新) (2 diffs)
- trunk/install/php/deletemovie.php (更新) (4 diffs)
- trunk/install/php/delreserve.php (更新) (5 diffs)
- trunk/install/php/folcast.php (更新) (5 diffs)
- trunk/install/php/foltia_config2.php.template (更新) (1 diff)
- trunk/install/php/foltialib.php (更新) (19 diffs)
- trunk/install/php/graytable.css (更新) (1 diff)
- trunk/install/php/index.php (更新) (9 diffs)
- trunk/install/php/listreserve.php (更新) (15 diffs)
- trunk/install/php/m.php (更新) (8 diffs)
- trunk/install/php/reservecomp.php (更新) (4 diffs)
- trunk/install/php/reserveepg.php (更新) (3 diffs)
- trunk/install/php/reserveepgcomp.php (更新) (3 diffs)
- trunk/install/php/reserveprogram.php (更新) (6 diffs)
- trunk/install/php/selectcaptureimage.php (更新) (2 diffs)
- trunk/install/php/showlib.php (更新) (4 diffs)
- trunk/install/php/showlibc.php (更新) (6 diffs)
- trunk/install/php/showplaylist.php (更新) (6 diffs)
- trunk/install/php/titlelist.php (更新) (4 diffs)
- trunk/install/php/view_syabas.php (更新) (1 diff)
- trunk/install/php/viewepg.php (更新) (6 diffs)
凡例:
- 変更無し
- 追加
- 削除
- 更新
- コピー
- 移動
trunk/install/php/StarlightBreaker/sb-edit.php
r88 r94 73 73 FROM foltia_subtitle , foltia_program ,foltia_station 74 74 WHERE foltia_program.tid = foltia_subtitle.tid AND foltia_station.stationid = foltia_subtitle.stationid 75 AND foltia_subtitle.pid = '$pid'76 77 ";78 $rs = m_query($con, $query, "DBクエリに失敗しました");75 AND foltia_subtitle.pid = ? 76 "; 77 // $rs = m_query($con, $query, "DBクエリに失敗しました"); 78 $rs = sql_query($con, $query, "DBクエリに失敗しました",array($pid)); 79 79 $rows = pg_num_rows($rs); 80 80 if ($rows == 0){ trunk/install/php/accountregist.php
r70 r94 58 58 if ($username != ""){ 59 59 $query = " 60 SELECT memberid ,userclass,name,passwd160 SELECT count(memberid) 61 61 FROM foltia_envpolicy 62 WHERE foltia_envpolicy.name = '$username'62 WHERE foltia_envpolicy.name = ? 63 63 "; 64 $isaccountexist = m_query($con, $query, "DBクエリに失敗しました"); 65 $isaccountexistncount = pg_num_rows($isaccountexist); 64 // $isaccountexist = m_query($con, $query, "DBクエリに失敗しました"); 65 $isaccountexist = sql_query($con, $query, "DBクエリに失敗しました",array($username)); 66 67 $isaccountexistncount = $isaccountexist->fetchColumn(0); 66 68 67 69 if ($isaccountexistncount == 0){ … … 85 87 "; 86 88 $rs = m_query($con, $query, "DBクエリに失敗しました"); 87 $max rows = pg_num_rows($rs);88 if ($max rows == 0){89 $nextcno = 1;89 $maxid = $rs->fetchColumn(0); 90 if ($maxid) { 91 $nextcno = $maxid + 1; 90 92 }else{ 91 $rowdata = pg_fetch_row($rs, 0); 92 $nextcno = $rowdata[0]; 93 $nextcno++ ; 93 $nextcno = 1; 94 94 } 95 95 … … 110 110 $query = " 111 111 insert into foltia_envpolicy 112 values ( '$nextcno','2','$username','$userpasswd',now(),'$remotehost')";112 values ( ?,'2',?,?,now(),?)"; 113 113 //print "$query <br>\n"; 114 $rs = m_query($con, $query, "DBクエリに失敗しました"); 114 // $rs = m_query($con, $query, "DBクエリに失敗しました"); 115 $rs = sql_query($con, $query, "DBクエリに失敗しました",array($nextcno,$username,$userpasswd,$remotehost)); 115 116 116 117 print "次のアカウントを登録しました。<br> trunk/install/php/delepgp.php
r84 r94 70 70 WHERE foltia_subtitle.tid = 0 AND 71 71 foltia_station.stationid = foltia_subtitle.stationid AND 72 foltia_subtitle.pid = $pid72 foltia_subtitle.pid = ? 73 73 "; 74 74 75 $rs = m_query($con, $query, "DBクエリに失敗しました");76 $ maxrows = pg_num_rows($rs);77 78 if ($maxrows == 0) {75 // $rs = m_query($con, $query, "DBクエリに失敗しました"); 76 $rs = sql_query($con, $query, "DBクエリに失敗しました",array($pid)); 77 $rowdata = $rs->fetch(); 78 if (! $rowdate) { 79 79 die_exit("登録番組がありません<BR>"); 80 80 } 81 $rowdata = pg_fetch_row($rs, 0);82 81 83 82 $pid = htmlspecialchars($rowdata[0]); … … 114 113 DELETE 115 114 FROM foltia_subtitle 116 WHERE foltia_subtitle.pid = $pid AND foltia_subtitle.tid = 0 "; 117 $rs = m_query($con, $query, "DBクエリに失敗しました"); 115 WHERE foltia_subtitle.pid = ? AND foltia_subtitle.tid = 0 "; 116 // $rs = m_query($con, $query, "DBクエリに失敗しました"); 117 $rs = sql_query($con, $query, "DBクエリに失敗しました",array($pid)); 118 118 } 119 119 }else{ trunk/install/php/deletemovie.php
r76 r94 88 88 FROM foltia_subtitle , foltia_program 89 89 WHERE foltia_program.tid = foltia_subtitle.tid 90 AND foltia_subtitle.tid = $filesplit[0]90 AND foltia_subtitle.tid = ? 91 91 "; 92 $rs = m_query($con, $query, "DBクエリに失敗しました"); 93 $rowdata = pg_fetch_row($rs, $row); 92 //$rs = m_query($con, $query, "DBクエリに失敗しました"); 93 $rs = sql_query($con, $query, "DBクエリに失敗しました",array($filesplit[0])); 94 $rall = $rs->fetchAll(); 95 $rowdata = $rall[$row]; 94 96 //print" $fName./$rowdata[1]//$rowdata[2]<BR>\n"; 95 97 $title = $rowdata[1]; … … 103 105 FROM foltia_subtitle , foltia_program 104 106 WHERE foltia_program.tid = foltia_subtitle.tid 105 AND foltia_subtitle.tid = $filesplit[0]106 AND foltia_subtitle.countno = $filesplit[1]107 AND foltia_subtitle.tid = ? 108 AND foltia_subtitle.countno = ? 107 109 "; 108 $rs = m_query($con, $query, "DBクエリに失敗しました"); 109 $rowdata = pg_fetch_row($rs, $row); 110 //$rs = m_query($con, $query, "DBクエリに失敗しました"); 111 $rs = sql_query($con, $query, "DBクエリに失敗しました",array($filesplit[0] ,$filesplit[1])); 112 $rall = $rs->fetchAll(); 113 $rowdata = $rall[$row]; 110 114 //print" $fName./$rowdata[1]/$rowdata[2]/$rowdata[3]<BR>\n"; 111 115 $title = $rowdata[1]; … … 119 123 $count = htmlspecialchars($count); 120 124 $subtitle = htmlspecialchars($subtitle); 121 122 //--123 124 125 125 126 print " … … 138 139 $query = " 139 140 DELETE FROM foltia_m2pfiles 140 WHERE m2pfilename = '$fName'141 WHERE m2pfilename = ? 141 142 "; 142 $rs = m_query($con, $query, "DBクエリに失敗しました"); 143 //$rs = m_query($con, $query, "DBクエリに失敗しました"); 144 $rs = sql_query($con, $query, "DBクエリに失敗しました",array($fName)); 143 145 144 146 //削除処理 trunk/install/php/delreserve.php
r70 r94 44 44 <?php 45 45 46 47 $tid = getgetnumform(tid); 46 $tid = getgetnumform("tid"); 48 47 if ($tid == "") { 49 48 die_exit("番組がありません<BR>"); 50 49 } 51 $sid = getgetnumform(sid);50 $sid = getgetnumform("sid"); 52 51 if ($sid == "") { 53 52 die_exit("局がありません<BR>"); … … 70 69 foltia_tvrecord.stationid 71 70 FROM foltia_tvrecord , foltia_program , foltia_station 72 WHERE foltia_tvrecord.tid = foltia_program.tid AND foltia_tvrecord.stationid = foltia_station .stationid AND foltia_tvrecord.tid = $tid AND foltia_tvrecord.stationid = $sid "; 73 74 $rs = m_query($con, $query, "DBクエリに失敗しました"); 75 $maxrows = pg_num_rows($rs); 76 77 if ($maxrows == 0) { 71 WHERE foltia_tvrecord.tid = foltia_program.tid AND foltia_tvrecord.stationid = foltia_station .stationid AND foltia_tvrecord.tid = ? AND foltia_tvrecord.stationid = ? "; 72 73 // $rs = m_query($con, $query, "DBクエリに失敗しました"); 74 $rs = sql_query($con, $query, "DBクエリに失敗しました",array($tid,$sid)); 75 $rowdata = $rs->fetch(); 76 77 if (! $rowdata ) { 78 78 die_exit("登録番組がありません<BR>"); 79 79 } 80 $rowdata = pg_fetch_row($rs, 0);81 82 80 $tid = htmlspecialchars($rowdata[0]); 83 81 $stationname = htmlspecialchars($rowdata[1]); … … 107 105 DELETE 108 106 FROM foltia_tvrecord 109 WHERE foltia_tvrecord.tid = $tid AND foltia_tvrecord.stationid = $sid "; 110 $rs = m_query($con, $query, "DBクエリに失敗しました"); 107 WHERE foltia_tvrecord.tid = ? AND foltia_tvrecord.stationid = ? "; 108 $rs->closeCursor(); 109 // $rs = m_query($con, $query, "DBクエリに失敗しました"); 110 $rs = sql_query($con, $query, "DBクエリに失敗しました",array($tid,$sid)); 111 111 } 112 112 … … 164 164 FROM foltia_subtitle , foltia_program ,foltia_station 165 165 WHERE foltia_program.tid = foltia_subtitle.tid AND foltia_station.stationid = foltia_subtitle.stationid 166 AND foltia_subtitle.startdatetime >= '$now' AND foltia_program.tid ='$tid'166 AND foltia_subtitle.startdatetime >= ? AND foltia_program.tid = ? 167 167 ORDER BY foltia_subtitle.startdatetime ASC 168 168 "; 169 $rs = m_query($con, $query, "DBクエリに失敗しました");170 $ maxrows = pg_num_rows($rs);171 172 if ($maxrows == 0) {169 // $rs = m_query($con, $query, "DBクエリに失敗しました"); 170 $rs = sql_query($con, $query, "DBクエリに失敗しました",array($now,$tid)); 171 $rowdata = $rs->fetch(); 172 if (! $rowdata) { 173 173 echo("放映予定はありません<BR>"); 174 } 175 else{ 176 $maxcols = pg_num_fields($rs); 174 }else{ 175 $maxcols = $rs->columnCount(); 177 176 ?> 178 177 <table BORDER="0" CELLPADDING="0" CELLSPACING="2" WIDTH="100%" BGCOLOR="#bcf1be"> … … 192 191 <?php 193 192 /* テーブルのデータを出力 */ 194 for ($row = 0; $row < $maxrows; $row++) { /* 行に対応 */193 do { 195 194 echo("<tr>\n"); 196 /* pg_fetch_row で一行取り出す */197 $rowdata = pg_fetch_row($rs, $row);198 199 195 for ($col = 0; $col < $maxcols; $col++) { /* 列に対応 */ 200 196 echo("<td>".htmlspecialchars($rowdata[$col])."<br></td>\n"); 201 197 } 202 198 echo("</tr>\n"); 203 }199 } while ($row = $rs->fetch()); 204 200 }//end if 205 201 ?> trunk/install/php/folcast.php
r70 r94 51 51 $query = " 52 52 SELECT foltia_program.tid,foltia_program.title, 53 foltia_subtitle.countno , foltia_subtitle.subtitle , foltia_subtitle.startdatetime, foltia_subtitle.pspfilename,foltia_subtitle.lengthmin,foltia_subtitle.enddatetime FROM foltia_subtitle , foltia_program WHERE \"pspfilename\" ~~'M%%' AND foltia_program.tid = foltia_subtitle.tid AND foltia_program.tid = $tid53 foltia_subtitle.countno , foltia_subtitle.subtitle , foltia_subtitle.startdatetime, foltia_subtitle.pspfilename,foltia_subtitle.lengthmin,foltia_subtitle.enddatetime FROM foltia_subtitle , foltia_program WHERE \"pspfilename\" LIKE 'M%%' AND foltia_program.tid = foltia_subtitle.tid AND foltia_program.tid = $tid 54 54 ORDER BY \"enddatetime\" DESC 55 55 offset 0 limit $max … … 59 59 SELECT foltia_program.tid,foltia_program.title 60 60 FROM foltia_program 61 WHERE foltia_program.tid = $tid61 WHERE foltia_program.tid = ? 62 62 "; 63 $titlers = m_query($con, $query, "DBクエリに失敗しました"); 64 $rowdata = pg_fetch_row($titlers, 0); 63 // $titlers = m_query($con, $query, "DBクエリに失敗しました"); 64 $titlers = sql_query($con, $query, "DBクエリに失敗しました",array($tid)); 65 $rowdata = $titlers->fetch(); 65 66 $rsstitle = $rowdata[1]; 66 67 }else{ … … 68 69 $query = " 69 70 SELECT foltia_program.tid,foltia_program.title, 70 foltia_subtitle.countno , foltia_subtitle.subtitle , foltia_subtitle.startdatetime, foltia_subtitle.pspfilename,foltia_subtitle.lengthmin,foltia_subtitle.enddatetime FROM foltia_subtitle , foltia_program WHERE \"pspfilename\" ~~'M%%' AND foltia_program.tid = foltia_subtitle.tid ORDER BY \"enddatetime\" DESC71 offset 0 limit $max71 foltia_subtitle.countno , foltia_subtitle.subtitle , foltia_subtitle.startdatetime, foltia_subtitle.pspfilename,foltia_subtitle.lengthmin,foltia_subtitle.enddatetime FROM foltia_subtitle , foltia_program WHERE \"pspfilename\" LIKE 'M%%' AND foltia_program.tid = foltia_subtitle.tid ORDER BY \"enddatetime\" DESC 72 offset 0 limit ? 72 73 "; 73 74 $rsstitle = "新規録画"; … … 96 97 print $header; 97 98 98 $rs = m_query($con, $query, "DBクエリに失敗しました"); 99 $maxrows = pg_num_rows($rs); 99 // $rs = m_query($con, $query, "DBクエリに失敗しました"); 100 $rs = sql_query($con, $query, "DBクエリに失敗しました",array($max)); 101 $rowdata = $rs->fetch(); 100 102 101 if ( $maxrows == 0) {103 if (! $rowdata) { 102 104 //die_exit("No items"); 103 105 }else{ 104 105 for ($row = 0; $row < $maxrows; $row++) { 106 $rowdata = pg_fetch_row($rs, $row); 107 106 do { 108 107 //$title = mb_convert_encoding($rowdata[1],"UTF-8", "EUC-JP"); 109 108 $tid = $rowdata[0]; … … 163 162 print $item ; 164 163 165 }//for 164 } while ($rowdata = $rs->fetch()); //do 166 165 167 166 }//if trunk/install/php/foltia_config2.php.template
r83 r94 27 27 28 28 // データベース接続設定 29 define("DATABASE_NAME", "foltia"); 30 define("DBHOST", "localhost"); 31 define("USER_NAME" , "foltia" ); 32 define("USER_PASSWORD", "passwd" ); 29 // define("DSN", "pgsql:host=localhost dbname=foltia user=foltia password= "); 30 define("DSN", "sqlite:/home/foltia/foltia.sqlite"); 33 31 34 32 // $mylocalip = "192.168.0.177" ; //動いている機械のIPアドレス trunk/install/php/foltialib.php
r89 r94 93 93 } 94 94 } 95 96 /* LIKE 用の文字列のエスケープ */ 97 function escape_like($sql, $quote = TRUE) { 98 return ($quote ? "'" : "") . 99 str_replace(array("\\\\", "%" , "_" ), 100 array("\\\\\\\\", "\\\\%", "\\\\_"), 101 pg_escape_string($sql)) . 102 ($quote ? "'" : ""); 103 } 104 95 105 96 /* SQL 文字列のエスケープ */ 106 97 function escape_string($sql, $quote = FALSE) { … … 108 99 return "null"; 109 100 } 101 if (preg_match("/^pgsql/", DSN)){ 110 102 return ($quote ? "'" : "") . 111 103 pg_escape_string($sql) . 112 104 ($quote ? "'" : ""); 113 } 105 }else if (preg_match("/^sqlite/", DSN)){ 106 /* return ($quote ? "'" : "") . 107 sqlite_escape_string($sql) . 108 ($quote ? "'" : ""); 109 */ 110 return($sql); 111 }else{ 112 return "null"; 113 } 114 } 114 115 115 116 /* SQL 数値のエスケープ */ … … 124 125 } 125 126 126 /* PostgreSQL サーバに接続 */127 /* DBに接続 */ 127 128 function m_connect() { 128 /* $con = @pg_connect("host=".DBHOST ." dbname=".DATABASE_NAME . 129 " user=".USER_NAME . 130 " password=".USER_PASSWORD); 131 */ 132 $con = @pg_pconnect("host=".DBHOST ." dbname=".DATABASE_NAME . 133 " user=".USER_NAME . 134 " password=".USER_PASSWORD); 135 136 137 if (!$con) { 138 die_exit("データベースに接続出来ませんでした。"); 129 try { 130 $dbh = new PDO(DSN); 131 $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); 132 return($dbh); 133 } catch (PDOException $e) { 134 die_exit($e->getMessage() . ": データベースに接続出来ませんでした。"); 139 135 } 140 136 /* データベースと、PHP の内部文字コードが違う場合 */ 141 return($con);142 137 } 143 138 144 139 /* データベースとの接続を切り離す */ 145 function m_close($con) { 146 return @pg_close($con); 147 } 148 149 /* SQL 文を実行 */ 150 function m_query($con, $query, $errmessage) { 151 $rtn = @pg_query($con, $query); 152 if (!$rtn) { 140 function m_close($dbh) { 141 return null; 142 } 143 144 //旧関数 sql_queryに置き換え 145 function m_query($dbh, $query, $errmessage) { 146 try { 147 $rtn = $dbh->query($query); 148 return($rtn); 149 } catch (PDOException $e) { 153 150 /* エラーメッセージに SQL 文を出すのはセキュリティ上良くない!! */ 154 151 $msg = $errmessage . "<br>\n" . 155 @pg_last_error($con) . "<br>\n" . 152 $e->getMessage() . "<br>\n" . 153 var_export($e->errorInfo, true) . "<br>\n" . 156 154 "<small><code>" . htmlspecialchars($query) . 157 155 "</code></small>\n"; 158 $rtn = @pg_query($con, "rollback");//04.4.8 159 m_close($con);156 // $dbh->rollBack(); 157 $dbh = null; 160 158 die_exit($msg); 161 159 } 160 } 161 /* SQL 文を実行 */ 162 function sql_query($dbh, $query, $errmessage,$paramarray) { 163 try { 164 $rtn = $dbh->prepare("$query"); 165 $rtn->execute($paramarray); 162 166 return($rtn); 167 } catch (PDOException $e) { 168 /* エラーメッセージに SQL 文を出すのはセキュリティ上良くない!! */ 169 $msg = $errmessage . "<br>\n" . 170 $e->getMessage() . "<br>\n" . 171 var_export($e->errorInfo, true) . "<br>\n" . 172 "<small><code>" . htmlspecialchars($query) . 173 "</code></small>\n"; 174 // $dbh->rollBack(); 175 $dbh = null; 176 die_exit($msg); 177 } 163 178 } 164 179 … … 166 181 function m_showtable($rs) { 167 182 /* 検索件数 */ 168 $maxrows = pg_num_rows($rs);183 $maxrows = 0; 169 184 170 if ($maxrows == 0) { 185 $rowdata = $rs->fetch(); 186 if (! $rowdata) { 171 187 echo("<p class=\"msg\">データが存在しません</p>\n"); 172 188 return 0; … … 174 190 175 191 /* フィールド数 */ 176 $maxcols = pg_num_fields($rs);192 $maxcols = $rs->columnCount(); 177 193 ?> 178 194 <table class="list" summary="データ検索結果を表示" border="1"> … … 183 199 for ($col = 1; $col < $maxcols; $col++) { 184 200 /* pg_field_name() はフィールド名を返す */ 185 $f_name = htmlspecialchars(pg_field_name($rs, $col)); 201 $meta = $rs->getColumnMeta($col); 202 $f_name = htmlspecialchars($meta["name"]); 186 203 echo("<th abbr=\"$f_name\">$f_name</th>\n"); 187 204 } … … 192 209 <?php 193 210 /* テーブルのデータを出力 */ 194 for ($row = 0; $row < $maxrows; $row++) { /* 行に対応 */ 211 do { 212 $maxrows++; 213 195 214 echo("<tr>\n"); 196 /* pg_fetch_row で一行取り出す */197 $rowdata = pg_fetch_row($rs, $row);198 215 /* 1列目にリンクを張る */ 199 216 echo("<td><a href=\"edit.php?q_code=" . … … 204 221 } 205 222 echo("</tr>\n"); 206 }223 } while ($rowdata = $rs->fetch()); 207 224 ?> 208 225 </tbody> … … 212 229 } 213 230 214 /* 指定したコードのデータを表示 */ 215 function m_viewdata($con, $code) { 216 /* コードに該当するデータを検索 */ 217 $query = " 231 232 function m_viewdata($dbh, $code) { 233 234 /*これ使ってないよね? 235 236 $query = " 218 237 select p.code 219 238 ,p.name … … 222 241 ,s.name as job 223 242 ,p.profile 224 , to_char(p.editdate, 'YYYY/MM/DD HH24:MI:SS') as editdate243 ,datetime(p.editdate) as editdate 225 244 from inet_profile p left join inet_job s on p.job = s.code 226 245 where p.code = $code"; 227 $rs = m_query($con, $query, "個人情報の取得に失敗しました。"); 228 if (pg_num_rows($rs) == 0) { 246 $rs = m_query($dbh, $query, "個人情報の取得に失敗しました。"); 247 $rowdata = $rs->fetch(); 248 if (! $rowdata) { 229 249 echo("<p class=\"msg\">データが存在しません</p>\n"); 230 250 return FALSE; 231 251 } 232 252 233 /* フィールド数 */ 234 $maxcols = pg_num_fields($rs); 235 /* 先頭行 */ 236 $rowdata = pg_fetch_row($rs, 0); 253 // フィールド数 254 $maxcols = $rs->columnCount(); 237 255 ?> 238 256 <table class="view" summary="データベース上のデータを表示" border="1"> 239 257 <tr> 240 <td class="name"><?= htmlspecialchars(pg_field_name($rs, 1)) ?></td> 258 <?php $meta = $rs->getColumnMeta(1); ?> 259 <td class="name"><?= htmlspecialchars($meta["name"]) ?></td> 241 260 <td><a href="edit.php?q_code=<?= $rowdata[0] ?>" 242 261 ><?= htmlspecialchars($rowdata[1]) ?></a></td> 243 262 </tr> 244 <?php for ($col = 2; $col < $maxcols; $col++) { ?> 263 <?php for ($col = 2; $col < $maxcols; $col++) { 264 $meta = $rs->getColumnMeta($col); ?> 245 265 <tr> 246 <td class="name"><?= htmlspecialchars(pg_field_name($rs, $col)) ?></td>266 <td class="name"><?= htmlspecialchars($meta["name"]) ?></td> 247 267 <td><?= htmlspecialchars($rowdata[$col]) ?></td> 248 268 </tr> … … 250 270 </table> 251 271 <?php 252 /* クエリーを解放 */ 253 pg_free_result($rs); 254 272 // クエリーを解放 273 $rs = null; 255 274 return TRUE; 275 */ 256 276 } 257 277 … … 294 314 "; 295 315 $rs = m_query($con, $query, "DBクエリに失敗しました"); 296 $ maxrows = pg_num_rows($rs);297 if ($maxrows == 0) {316 $rowdata = $rs->fetch(); 317 if (! $rowdata) { 298 318 print("番組データがありません<BR>"); 299 319 }else{ … … 301 321 //print "<ul><!-- ($maxrows) $query -->\n"; 302 322 303 for ($row = 0; $row < $maxrows; $row++) { 304 305 $rowdata = pg_fetch_row($rs, $row); 306 323 do { 307 324 $printstarttime = substr($rowdata[0],8,2) . ":" . substr($rowdata[0],10,2); 308 325 $tdclass = "t".substr($rowdata[0],8,2) . substr($rowdata[0],10,2); … … 323 340 </li>\n"; 324 341 */ 325 }//for 342 } while ($rowdata = $rs->fetch());//do 326 343 //print "</ul>\n"; 327 344 print "</table>\n"; … … 429 446 global $recfolderpath,$recfolderpath; 430 447 431 exec ( "df -h $recfolderpath | grep $recfolderpath", $hdfreearea); 432 $freearea = preg_split ("/[\s,]+/", $hdfreearea[0]); 448 // exec ( "df -h $recfolderpath | grep $recfolderpath", $hdfreearea); 449 // $freearea = preg_split ("/[\s,]+/", $hdfreearea[0]); 450 exec ( "df -hP $recfolderpath", $hdfreearea); 451 $freearea = preg_split ("/[\s,]+/", $hdfreearea[count($hdfreearea)-1]); 433 452 434 453 return $freearea; … … 557 576 "; 558 577 $useraccount = m_query($con, $query, "DBクエリに失敗しました"); 559 $useraccountrows = pg_num_rows($useraccount); 560 561 if ($useraccountrows == 1 ){ 562 $rowdata = pg_fetch_row($useraccount, 0); 578 $rowdata = $useraccount->fetch(); 579 if (! $rowdata) { 580 header("HTTP/1.0 401 Unauthorized"); 581 redirectlogin(); 582 } 583 563 584 $memberid = $rowdata[0]; 564 585 $userclass = $rowdata[1]; 565 586 $username = $rowdata[2]; 566 587 $dbpasswd = $rowdata[3]; 567 }else{ 588 589 $rowdata = $useraccount->fetch(); 590 if ($rowdata) { 568 591 header("HTTP/1.0 401 Unauthorized"); 569 //print "<!-- DEBUG DB record error ($useraccountrows)-->";570 592 redirectlogin(); 571 }//end if 572 593 } 573 594 574 595 // passwdをdbから取りだし … … 627 648 "; 628 649 $useraccount = m_query($con, $query, "DBクエリに失敗しました"); 629 $useraccountrows = pg_num_rows($useraccount); 630 631 if ($useraccountrows == 1 ){ 632 $rowdata = pg_fetch_row($useraccount, 0); 633 //$userclass = $rowdata[1]; 634 return ($rowdata[1]); 635 }else{ 636 return (99);//エラー 637 }//end if 650 $rowdata = $useraccount->fetch(); 651 if (! $rowdata) { 652 return (99); 653 } 654 655 $userclass = $rowdata[1]; 656 657 $rowdata = $useraccount->fetch(); 658 if ($rowdata) { 659 return (99); 660 } 661 662 return ($userclass); 638 663 639 664 }else{ … … 655 680 "; 656 681 $useraccount = m_query($con, $query, "DBクエリに失敗しました"); 657 $useraccountrows = pg_num_rows($useraccount); 658 659 if ($useraccountrows == 1 ){ 660 $rowdata = pg_fetch_row($useraccount, 0); 661 //$userclass = $rowdata[1]; 662 return ($rowdata[0]); 663 }else{ 682 $rowdata = $useraccount->fetch(); 683 if (! $rowdata) { 664 684 return (-1);//エラー 665 }//end if 685 } 686 687 $memberid = $rowdata[0]; 688 689 $rowdata = $useraccount->fetch(); 690 if ($rowdata) { 691 return (-1); 692 } 693 694 return ($memberid); 666 695 667 696 }else{ … … 682 711 "; 683 712 $useraccount = m_query($con, $query, "DBクエリに失敗しました"); 684 $useraccountrows = pg_num_rows($useraccount); 685 686 if ($useraccountrows == 1 ){ 687 $rowdata = pg_fetch_row($useraccount, 0); 688 return ($rowdata[2]); 713 $rowdata = $useraccount->fetch(); 714 if (! $rowdata) { 715 return ("");//エラー 716 } 717 718 $name = $rowdata[2]; 719 720 $rowdata = $useraccount->fetch(); 721 if ($rowdata) { 722 return (""); 723 } 724 725 return ($name); 726 689 727 }else{ 690 return ("");//エラー728 return (""); 691 729 }//end if 692 693 }else{694 return ("");695 }//end if696 697 698 730 699 731 }//end function getmemberid2name trunk/install/php/graytable.css
r51 r94 1 body * {margin:0px;padding:0px;border:0px;}1 // body * {margin:0px;padding:0px;border:0px;} 2 2 3 3 body { trunk/install/php/index.php
r83 r94 67 67 WHERE foltia_tvrecord.tid = foltia_program.tid 68 68 AND foltia_program.tid = foltia_subtitle.tid 69 AND foltia_subtitle.enddatetime >= '$now'69 AND foltia_subtitle.enddatetime >= ? 70 70 ORDER BY \"startdatetime\" ASC 71 71 LIMIT 1000 72 72 "; 73 $reservedrssametid = m_query($con, $query, "DBクエリに失敗しました"); 74 $reservedmaxrowssameid = pg_num_rows($reservedrssametid); 75 76 if ($reservedmaxrowssameid > 0 ){ 77 for ($rrow = 0; $rrow < $reservedmaxrowssameid ; $rrow++) { 78 $rowdata = pg_fetch_row($reservedrssametid, $rrow); 73 // $reservedrssametid = m_query($con, $query, "DBクエリに失敗しました"); 74 $reservedrssametid = sql_query($con, $query, "DBクエリに失敗しました",array($now)); 75 $rowdata = $reservedrssametid->fetch(); 76 if ($rowdata) { 77 do { 79 78 $reservedpidsametid[] = $rowdata[7]; 80 } 79 } while ($rowdata = $reservedrssametid->fetch()); 80 81 81 $rowdata = ""; 82 $rrow = "";83 82 }else{ 84 $reservedpidsametid = "";83 $reservedpidsametid = array(); 85 84 }//end if 85 $reservedrssametid->closeCursor(); 86 86 87 87 //録画番組検索 88 88 $query = " 89 89 SELECT 90 foltia_program .tid, 91 stationname, 92 foltia_program .title, 93 foltia_subtitle.countno, 94 foltia_subtitle.subtitle, 95 foltia_subtitle.startdatetime , 96 foltia_subtitle.lengthmin , 97 foltia_tvrecord.bitrate , 98 foltia_subtitle.pid 90 foltia_program.tid, stationname, foltia_program.title, 91 foltia_subtitle.countno, foltia_subtitle.subtitle, 92 foltia_subtitle.startdatetime as x, foltia_subtitle.lengthmin, 93 foltia_tvrecord.bitrate, foltia_subtitle.pid 99 94 FROM foltia_subtitle , foltia_program ,foltia_station ,foltia_tvrecord 100 95 WHERE foltia_tvrecord.tid = foltia_program.tid AND foltia_tvrecord.stationid = foltia_station .stationid AND foltia_program.tid = foltia_subtitle.tid AND foltia_station.stationid = foltia_subtitle.stationid … … 102 97 UNION 103 98 SELECT 104 foltia_program .tid, 105 stationname, 106 foltia_program .title, 107 foltia_subtitle.countno, 108 foltia_subtitle.subtitle, 109 foltia_subtitle.startdatetime , 110 foltia_subtitle.lengthmin , 111 foltia_tvrecord.bitrate , 112 foltia_subtitle.pid 99 foltia_program.tid, stationname, foltia_program.title, 100 foltia_subtitle.countno, foltia_subtitle.subtitle, 101 foltia_subtitle.startdatetime, foltia_subtitle.lengthmin, 102 foltia_tvrecord.bitrate, foltia_subtitle.pid 113 103 FROM foltia_tvrecord 114 104 LEFT OUTER JOIN foltia_subtitle on (foltia_tvrecord.tid = foltia_subtitle.tid ) … … 116 106 LEFT OUTER JOIN foltia_station on (foltia_subtitle.stationid = foltia_station.stationid ) 117 107 WHERE foltia_tvrecord.stationid = 0 AND 118 foltia_subtitle.enddatetime >= '$now' ORDER BY \"startdatetime\" ASC 119 LIMIT 1000 120 "; 121 122 $reservedrs = m_query($con, $query, "DBクエリに失敗しました"); 123 $reservedmaxrows = pg_num_rows($reservedrs); 124 125 if ($reservedmaxrows > 0 ){ 126 for ($rrow = 0; $rrow < $reservedmaxrows ; $rrow++) { 127 $rowdata = pg_fetch_row($reservedrs, $rrow); 108 foltia_subtitle.enddatetime >= '$now' ORDER BY x ASC 109 LIMIT 1000 110 "; 111 112 //$reservedrs = m_query($con, $query, "DBクエリに失敗しました"); 113 $query = " 114 SELECT 115 foltia_program.tid, stationname, foltia_program.title, 116 foltia_subtitle.countno, foltia_subtitle.subtitle, 117 foltia_subtitle.startdatetime as x, foltia_subtitle.lengthmin, 118 foltia_tvrecord.bitrate, foltia_subtitle.pid 119 FROM foltia_subtitle , foltia_program ,foltia_station ,foltia_tvrecord 120 WHERE foltia_tvrecord.tid = foltia_program.tid AND foltia_tvrecord.stationid = foltia_station .stationid AND foltia_program.tid = foltia_subtitle.tid AND foltia_station.stationid = foltia_subtitle.stationid 121 AND foltia_subtitle.enddatetime >= ? 122 UNION 123 SELECT 124 foltia_program.tid, stationname, foltia_program.title, 125 foltia_subtitle.countno, foltia_subtitle.subtitle, 126 foltia_subtitle.startdatetime, foltia_subtitle.lengthmin, 127 foltia_tvrecord.bitrate, foltia_subtitle.pid 128 FROM foltia_tvrecord 129 LEFT OUTER JOIN foltia_subtitle on (foltia_tvrecord.tid = foltia_subtitle.tid ) 130 LEFT OUTER JOIN foltia_program on (foltia_tvrecord.tid = foltia_program.tid ) 131 LEFT OUTER JOIN foltia_station on (foltia_subtitle.stationid = foltia_station.stationid ) 132 WHERE foltia_tvrecord.stationid = 0 AND 133 foltia_subtitle.enddatetime >= ? ORDER BY x ASC 134 LIMIT 1000 135 "; 136 $reservedrs = sql_query($con, $query, "DBクエリに失敗しました",array($now,$now)); 137 138 $rowdata = $reservedrs->fetch(); 139 if ($rowdata) { 140 do { 128 141 $reservedpid[] = $rowdata[8]; 129 } 142 } while ($rowdata = $reservedrs->fetch()); 130 143 }else{ 131 $reservedpid = "";144 $reservedpid = array(); 132 145 }//end if 133 146 … … 138 151 $query = " 139 152 SELECT 140 foltia_program .tid, 141 stationname, 142 foltia_program .title, 143 foltia_subtitle.countno, 144 foltia_subtitle.subtitle, 145 foltia_subtitle.startdatetime , 146 foltia_subtitle.lengthmin , 147 foltia_subtitle.pid , 148 foltia_subtitle.startoffset 153 foltia_program.tid, stationname, foltia_program.title, 154 foltia_subtitle.countno, foltia_subtitle.subtitle, 155 foltia_subtitle.startdatetime, foltia_subtitle.lengthmin, 156 foltia_subtitle.pid, foltia_subtitle.startoffset 149 157 FROM foltia_subtitle , foltia_program ,foltia_station 150 158 WHERE foltia_program.tid = foltia_subtitle.tid AND foltia_station.stationid = foltia_subtitle.stationid … … 153 161 LIMIT 1000 154 162 "; 155 $rs = m_query($con, $query, "DBクエリに失敗しました"); 156 $maxrows = pg_num_rows($rs); 157 158 163 $query = " 164 SELECT 165 foltia_program.tid, stationname, foltia_program.title, 166 foltia_subtitle.countno, foltia_subtitle.subtitle, 167 foltia_subtitle.startdatetime, foltia_subtitle.lengthmin, 168 foltia_subtitle.pid, foltia_subtitle.startoffset 169 FROM foltia_subtitle , foltia_program ,foltia_station 170 WHERE foltia_program.tid = foltia_subtitle.tid AND foltia_station.stationid = foltia_subtitle.stationid 171 AND foltia_subtitle.enddatetime >= ? AND foltia_subtitle.countno = '1' 172 ORDER BY foltia_subtitle.startdatetime ASC 173 LIMIT 1000 174 "; 159 175 }else{ 160 176 $query = " 161 177 SELECT 162 foltia_program .tid, 163 stationname, 164 foltia_program .title, 165 foltia_subtitle.countno, 166 foltia_subtitle.subtitle, 167 foltia_subtitle.startdatetime , 168 foltia_subtitle.lengthmin , 169 foltia_subtitle.pid , 170 foltia_subtitle.startoffset 178 foltia_program.tid, stationname, foltia_program.title, 179 foltia_subtitle.countno, foltia_subtitle.subtitle, 180 foltia_subtitle.startdatetime, foltia_subtitle.lengthmin, 181 foltia_subtitle.pid, foltia_subtitle.startoffset 171 182 FROM foltia_subtitle , foltia_program ,foltia_station 172 183 WHERE foltia_program.tid = foltia_subtitle.tid AND foltia_station.stationid = foltia_subtitle.stationid … … 175 186 LIMIT 1000 176 187 "; 177 $rs = m_query($con, $query, "DBクエリに失敗しました"); 178 $maxrows = pg_num_rows($rs); 179 188 $query = " 189 SELECT 190 foltia_program.tid, stationname, foltia_program.title, 191 foltia_subtitle.countno, foltia_subtitle.subtitle, 192 foltia_subtitle.startdatetime, foltia_subtitle.lengthmin, 193 foltia_subtitle.pid, foltia_subtitle.startoffset 194 FROM foltia_subtitle , foltia_program ,foltia_station 195 WHERE foltia_program.tid = foltia_subtitle.tid AND foltia_station.stationid = foltia_subtitle.stationid 196 AND foltia_subtitle.enddatetime >= ? 197 ORDER BY foltia_subtitle.startdatetime ASC 198 LIMIT 1000 199 "; 180 200 }//end if 181 201 182 if ($maxrows == 0) { 202 //$rs = m_query($con, $query, "DBクエリに失敗しました"); 203 $rs = sql_query($con, $query, "DBクエリに失敗しました",array($now)); 204 $rowdata = $rs->fetch(); 205 if (! $rowdata) { 183 206 header("Status: 404 Not Found",TRUE,404); 184 207 printtitle(); … … 211 234 <? 212 235 /* フィールド数 */ 213 $maxcols = pg_num_fields($rs);236 $maxcols = $rs->columnCount(); 214 237 ?> 215 238 <table BORDER="0" CELLPADDING="0" CELLSPACING="2" WIDTH="100%"> … … 230 253 <?php 231 254 /* テーブルのデータを出力 */ 232 for ($row = 0; $row < $maxrows; $row++) { /* 行に対応 */ 233 /* pg_fetch_row で一行取り出す */ 234 $rowdata = pg_fetch_row($rs, $row); 235 255 do { 236 256 //他局で同一番組録画済みなら色変え 237 257 if (in_array($rowdata[7], $reservedpidsametid)) { … … 283 303 284 304 echo("</tr>\n"); 285 } 305 } while ($rowdata = $rs->fetch()); 286 306 ?> 287 307 </tbody> trunk/install/php/listreserve.php
r90 r94 62 62 $query = " 63 63 SELECT 64 foltia_program .tid, 65 stationname, 66 foltia_program .title, 67 foltia_subtitle.countno, 68 foltia_subtitle.subtitle, 69 foltia_subtitle.startdatetime , 70 foltia_subtitle.lengthmin , 71 foltia_tvrecord.bitrate , 72 foltia_subtitle.startoffset , 73 foltia_subtitle.pid , 74 foltia_subtitle.epgaddedby , 64 foltia_program.tid, stationname, foltia_program.title, 65 foltia_subtitle.countno, foltia_subtitle.subtitle, 66 foltia_subtitle.startdatetime as x, foltia_subtitle.lengthmin, 67 foltia_tvrecord.bitrate, foltia_subtitle.startoffset, 68 foltia_subtitle.pid, foltia_subtitle.epgaddedby, 75 69 foltia_tvrecord.digital 76 70 FROM foltia_subtitle , foltia_program ,foltia_station ,foltia_tvrecord 77 71 WHERE foltia_tvrecord.tid = foltia_program.tid AND foltia_tvrecord.stationid = foltia_station .stationid AND foltia_program.tid = foltia_subtitle.tid AND foltia_station.stationid = foltia_subtitle.stationid 78 AND foltia_subtitle.enddatetime >= '$now'72 AND foltia_subtitle.enddatetime >= ? 79 73 UNION 80 74 SELECT 81 foltia_program .tid, 82 stationname, 83 foltia_program .title, 84 foltia_subtitle.countno, 85 foltia_subtitle.subtitle, 86 foltia_subtitle.startdatetime , 87 foltia_subtitle.lengthmin , 88 foltia_tvrecord.bitrate , 89 foltia_subtitle.startoffset , 90 foltia_subtitle.pid , 91 foltia_subtitle.epgaddedby , 75 foltia_program.tid, stationname, foltia_program.title, 76 foltia_subtitle.countno, foltia_subtitle.subtitle, 77 foltia_subtitle.startdatetime, foltia_subtitle.lengthmin, 78 foltia_tvrecord.bitrate, foltia_subtitle.startoffset, 79 foltia_subtitle.pid, foltia_subtitle.epgaddedby, 92 80 foltia_tvrecord.digital 93 81 FROM foltia_tvrecord … … 96 84 LEFT OUTER JOIN foltia_station on (foltia_subtitle.stationid = foltia_station.stationid ) 97 85 WHERE foltia_tvrecord.stationid = 0 AND 98 foltia_subtitle.enddatetime >= '$now' ORDER BY \"startdatetime\"ASC86 foltia_subtitle.enddatetime >= ? ORDER BY x ASC 99 87 "; 100 88 101 $rs = m_query($con, $query, "DBクエリに失敗しました"); 102 $maxrows = pg_num_rows($rs); 103 89 // $rs = m_query($con, $query, "DBクエリに失敗しました"); 90 $rs = sql_query($con, $query, "DBクエリに失敗しました",array($now,$now)); 104 91 105 92 //チューナー数 … … 122 109 123 110 <? 124 if ($maxrows == 0) { 111 $rowdata = $rs->fetch(); 112 if (! $rowdata) { 125 113 print "番組データがありません<BR>\n"; 126 114 }else{ 127 128 129 115 /* フィールド数 */ 130 $maxcols = pg_num_fields($rs);116 $maxcols = $rs->columnCount(); 131 117 ?> 132 118 <table BORDER="0" CELLPADDING="0" CELLSPACING="2" WIDTH="100%"> … … 149 135 <?php 150 136 /* テーブルのデータを出力 */ 151 for ($row = 0; $row < $maxrows; $row++) { /* 行に対応 */137 do { 152 138 echo("<tr>\n"); 153 /* pg_fetch_row で一行取り出す */ 154 $rowdata = pg_fetch_row($rs, $row); 139 155 140 $pid = htmlspecialchars($rowdata[9]); 156 141 … … 168 153 $query = " 169 154 SELECT 170 foltia_program .tid, 171 stationname, 172 foltia_program .title, 173 foltia_subtitle.countno, 174 foltia_subtitle.subtitle, 175 foltia_subtitle.startdatetime , 176 foltia_subtitle.lengthmin , 177 foltia_tvrecord.bitrate , 178 foltia_subtitle.startoffset , 179 foltia_subtitle.pid , 180 foltia_tvrecord.digital 155 foltia_program.tid, stationname, foltia_program.title, 156 foltia_subtitle.countno, foltia_subtitle.subtitle, 157 foltia_subtitle.startdatetime, foltia_subtitle.lengthmin, 158 foltia_tvrecord.bitrate, foltia_subtitle.startoffset, 159 foltia_subtitle.pid, foltia_tvrecord.digital 181 160 FROM foltia_subtitle , foltia_program ,foltia_station ,foltia_tvrecord 182 161 WHERE foltia_tvrecord.tid = foltia_program.tid AND foltia_tvrecord.stationid = foltia_station .stationid AND foltia_program.tid = foltia_subtitle.tid AND foltia_station.stationid = foltia_subtitle.stationid 183 AND foltia_subtitle.enddatetime > '$rowdata[5]'184 AND foltia_subtitle.startdatetime < '$endtime'162 AND foltia_subtitle.enddatetime > ? 163 AND foltia_subtitle.startdatetime < ? 185 164 UNION 186 165 SELECT 187 foltia_program .tid, 188 stationname, 189 foltia_program .title, 190 foltia_subtitle.countno, 191 foltia_subtitle.subtitle, 192 foltia_subtitle.startdatetime , 193 foltia_subtitle.lengthmin , 194 foltia_tvrecord.bitrate , 195 foltia_subtitle.startoffset , 196 foltia_subtitle.pid , 197 foltia_tvrecord.digital 166 foltia_program.tid, stationname, foltia_program.title, 167 foltia_subtitle.countno, foltia_subtitle.subtitle, 168 foltia_subtitle.startdatetime, foltia_subtitle.lengthmin, 169 foltia_tvrecord.bitrate, foltia_subtitle.startoffset, 170 foltia_subtitle.pid, foltia_tvrecord.digital 198 171 FROM foltia_tvrecord 199 172 LEFT OUTER JOIN foltia_subtitle on (foltia_tvrecord.tid = foltia_subtitle.tid ) … … 201 174 LEFT OUTER JOIN foltia_station on (foltia_subtitle.stationid = foltia_station.stationid ) 202 175 WHERE foltia_tvrecord.stationid = 0 AND 203 foltia_subtitle.enddatetime > '$rowdata[5]'204 AND foltia_subtitle.startdatetime < '$endtime'205 176 foltia_subtitle.enddatetime > ? 177 AND foltia_subtitle.startdatetime < ? 178 "; 206 179 $rclass = ""; 207 $overlap = m_query($con, $query, "DBクエリに失敗しました"); 208 $overlapmaxrows = pg_num_rows($overlap); 180 // $overlap = m_query($con, $query, "DBクエリに失敗しました"); 181 $overlap = sql_query($con, $query, "DBクエリに失敗しました",array($rowdata[5],$endtime,$rowdata[5],$endtime)); 182 $owrowall = $overlap->fetchAll(); 183 $overlapmaxrows = count($owrowall); 209 184 if ($overlapmaxrows > ($recunits) ){ 210 185 … … 212 187 213 188 for ($rrow = 0; $rrow < $overlapmaxrows ; $rrow++) { 214 $owrowdata = pg_fetch_array($overlap, $rrow);189 $owrowdata = $owrowall[$rrow]; 215 190 $owtimeline[ $owrowdata['startdatetime'] ] = $owtimeline[ $owrowdata['startdatetime'] ] +1; 216 191 … … 237 212 $query = " 238 213 SELECT 239 foltia_program .tid, 240 stationname, 241 foltia_program .title, 242 foltia_subtitle.countno, 243 foltia_subtitle.subtitle, 244 foltia_subtitle.startdatetime , 245 foltia_subtitle.lengthmin , 246 foltia_tvrecord.bitrate , 247 foltia_subtitle.startoffset , 248 foltia_subtitle.pid , 249 foltia_tvrecord.digital 214 foltia_program.tid, stationname, foltia_program.title, 215 foltia_subtitle.countno, foltia_subtitle.subtitle, 216 foltia_subtitle.startdatetime, foltia_subtitle.lengthmin, 217 foltia_tvrecord.bitrate, foltia_subtitle.startoffset, 218 foltia_subtitle.pid, foltia_tvrecord.digital 250 219 FROM foltia_subtitle , foltia_program ,foltia_station ,foltia_tvrecord 251 220 WHERE foltia_tvrecord.tid = foltia_program.tid AND foltia_tvrecord.stationid = foltia_station .stationid AND foltia_program.tid = foltia_subtitle.tid AND foltia_station.stationid = foltia_subtitle.stationid 252 AND foltia_subtitle.enddatetime > '$rowdata[5]'253 AND foltia_subtitle.startdatetime < '$endtime'221 AND foltia_subtitle.enddatetime > ? 222 AND foltia_subtitle.startdatetime < ? 254 223 AND (foltia_station.stationrecch = '0' OR foltia_station.stationrecch = '-1' ) 255 224 UNION 256 225 SELECT 257 foltia_program .tid, 258 stationname, 259 foltia_program .title, 260 foltia_subtitle.countno, 261 foltia_subtitle.subtitle, 262 foltia_subtitle.startdatetime , 263 foltia_subtitle.lengthmin , 264 foltia_tvrecord.bitrate , 265 foltia_subtitle.startoffset , 266 foltia_subtitle.pid , 267 foltia_tvrecord.digital 226 foltia_program.tid, stationname, foltia_program.title, 227 foltia_subtitle.countno, foltia_subtitle.subtitle, 228 foltia_subtitle.startdatetime, foltia_subtitle.lengthmin, 229 foltia_tvrecord.bitrate, foltia_subtitle.startoffset, 230 foltia_subtitle.pid, foltia_tvrecord.digital 268 231 FROM foltia_tvrecord 269 232 LEFT OUTER JOIN foltia_subtitle on (foltia_tvrecord.tid = foltia_subtitle.tid ) … … 271 234 LEFT OUTER JOIN foltia_station on (foltia_subtitle.stationid = foltia_station.stationid ) 272 235 WHERE foltia_tvrecord.stationid = 0 AND 273 foltia_subtitle.enddatetime > '$rowdata[5]'274 AND foltia_subtitle.startdatetime < '$endtime'236 foltia_subtitle.enddatetime > ? 237 AND foltia_subtitle.startdatetime < ? 275 238 AND (foltia_station.stationrecch = '0' OR foltia_station.stationrecch = '-1' ) 276 277 239 "; 278 $eoverlap = m_query($con, $query, "DBクエリに失敗しました"); 279 $eoverlapmaxrows = pg_num_rows($eoverlap); 240 // $eoverlap = m_query($con, $query, "DBクエリに失敗しました"); 241 $eoverlap = sql_query($con, $query, "DBクエリに失敗しました",array($rowdata[5], $endtime,$rowdata[5], $endtime)); 242 $eowrowall = $eoverlap->fetchAll(); 243 $eoverlapmaxrows = count($eowrowall); 280 244 if ($eoverlapmaxrows > ($externalinputs) ){ 281 245 … … 283 247 284 248 for ($erow = 0; $erow < $eoverlapmaxrows ; $erow++) { 285 $eowrowdata = pg_fetch_array($eoverlap, $erow);249 $eowrowdata = $eowrowall[$erow]; 286 250 $eowtimeline[ $eowrowdata['startdatetime'] ] = $eowtimeline[ $eowrowdata['startdatetime'] ] +1; 287 251 … … 359 323 echo("<br></td>\n"); 360 324 echo("</tr>\n"); 361 }325 } while ($rowdata = $rs->fetch()); 362 326 ?> 363 327 </tbody> … … 374 338 375 339 <?php 376 } //if ($maxrows == 0) { 377 378 340 } //if ($maxrows == 0) 379 341 $query = " 380 342 SELECT 381 foltia_program.tid, 382 stationname, 383 foltia_program .title , 384 foltia_tvrecord.bitrate , 385 foltia_tvrecord.stationid , 343 foltia_program.tid, stationname, foltia_program.title, 344 foltia_tvrecord.bitrate, foltia_tvrecord.stationid, 386 345 foltia_tvrecord.digital 387 346 FROM foltia_tvrecord , foltia_program , foltia_station … … 389 348 ORDER BY foltia_program.tid DESC 390 349 "; 391 $rs = m_query($con, $query, "DBクエリに失敗しました");392 $ maxrows = pg_num_rows($rs);393 394 if ($maxrows == 0) {350 // $rs = m_query($con, $query, "DBクエリに失敗しました"); 351 $rs = sql_query($con, $query, "DBクエリに失敗しました"); 352 $rowdata = $rs->fetch(); 353 if (! $rowdata) { 395 354 //なければなにもしない 396 355 397 356 }else{ 398 $maxcols = pg_num_fields($rs);357 $maxcols = $rs->columnCount(); 399 358 400 359 ?> … … 417 376 <?php 418 377 /* テーブルのデータを出力 */ 419 for ($row = 0; $row < $maxrows; $row++) { /* 行に対応 */ 420 /* pg_fetch_row で一行取り出す */ 421 $rowdata = pg_fetch_row($rs, $row); 422 378 do { 423 379 $tid = htmlspecialchars($rowdata[0]); 424 380 … … 468 424 echo("\n</tr>"); 469 425 }//if tid 0 470 }//for426 } while ($rowdata = $rs->fetch()); 471 427 }//else 472 428 ?> trunk/install/php/m.php
r83 r94 97 97 SELECT stationname 98 98 FROM foltia_station 99 WHERE stationid = $recstid"; 100 $stationvalid = m_query($con, $query, "DBクエリに失敗しました"); 101 $stationcount = pg_num_rows($stationvalid); 102 103 if ($stationcount == 1){ 104 $recstationname = pg_fetch_row($stationvalid, 0); 105 //valid 106 }else{ 99 WHERE stationid = ? "; 100 // $stationvalid = m_query($con, $query, "DBクエリに失敗しました"); 101 $stationvalid = sql_query($con, $query, "DBクエリに失敗しました",array($recstid)); 102 $recstationname = $stationvalid->fetch(); 103 if (! $recstationname) { 107 104 $errflag = 3; 108 105 $errmsg = "放送局設定が異常です。"; … … 128 125 //min pidを探す 129 126 $query = "SELECT min(pid) FROM foltia_subtitle "; 130 $rs = m_query($con, $query, "DBクエリに失敗しました"); 131 $maxrows = pg_num_rows($rs); 132 if ($maxrows == 0){ 133 $insertpid = -1 ; 127 // $rs = m_query($con, $query, "DBクエリに失敗しました"); 128 $rs = sql_query($con, $query, "DBクエリに失敗しました"); 129 $rowdata = $rs->fetch(); 130 if (! $rowdata) { 131 $insertpid = -1 ; 134 132 }else{ 135 $rowdata = pg_fetch_row($rs, 0); 136 $insertpid = $rowdata[0]; 137 $insertpid-- ; 133 if ($rowdata[0] > 0) { 134 $insertpid = -1 ; 135 }else{ 136 $insertpid = $rowdata[0]; 137 $insertpid-- ; 138 } 138 139 } 139 140 // next 話数を探す 140 141 $query = "SELECT max(countno) FROM foltia_subtitle WHERE tid = 0"; 141 $rs = m_query($con, $query, "DBクエリに失敗しました"); 142 $maxrows = pg_num_rows($rs); 143 if ($maxrows == 0){ 142 // $rs = m_query($con, $query, "DBクエリに失敗しました"); 143 $rs = sql_query($con, $query, "DBクエリに失敗しました"); 144 $rowdata = $rs->fetch(); 145 if (! $rowdata) { 144 146 $nextcno = 1 ; 145 147 }else{ 146 $rowdata = pg_fetch_row($rs, 0);147 148 $nextcno = $rowdata[0]; 148 149 $nextcno++ ; … … 159 160 insert into foltia_subtitle (pid ,tid ,stationid , countno ,subtitle , 160 161 startdatetime ,enddatetime ,startoffset , lengthmin , epgaddedby ) 161 values ( '$insertpid','0','$recstid', 162 '$nextcno','$pname','$startdatetime','$enddatetime','0' ,'$lengthmin', '$memberid')"; 162 values ( ?,'0',?,?,?,?,?,'0',?,?)"; 163 163 164 $rs = m_query($con, $query, "DBクエリに失敗しました"); 164 // $rs = m_query($con, $query, "DBクエリに失敗しました"); 165 //print "【DEBUG】$insertpid,$recstid,$nextcno,$pname,$startdatetime,$enddatetime ,$lengthmin,$memberid <br>\n"; 166 $rs = sql_query($con, $query, "DBクエリに失敗しました",array($insertpid,$recstid,$nextcno,$pname,$startdatetime,$enddatetime ,$lengthmin,$memberid)); 165 167 166 168 //addatq.pl … … 168 170 //引数 TID チャンネルID 169 171 //echo("$toolpath/perl/addatq.pl $tid $station"); 170 171 $oserr = system("$toolpath/perl/addatq.pl 0 0"); 172 exec("$toolpath/perl/addatq.pl 0 0"); 173 $oserr = system("$toolpath/perl/addatq.pl 0 0"); 174 //--------------------------------------------------- 175 if ($oserr){ 176 print "[DEBUG]$oserr 「$toolpath/perl/addatq.pl 0 0」<br>\n"; 177 }else{ 178 print "[DEBUG]exec addatq.pl false 「$toolpath/perl/addatq.pl 0 0」<br>\n"; 179 180 $oserr = system("$toolpath/perl/perltestscript.pl"); 181 if ($oserr){ 182 print "[DEBUG]exec perltestscript.pl $oserr<br>\n"; 183 }else{ 184 print "[DEBUG]exec perltestscript.pl false <br>\n"; 185 } 186 187 } 188 //----------------------------------------------------- 172 189 }else{ 173 190 print "EPG予約を行う権限がありません。"; … … 200 217 }// 初回表示かデータ処理か 201 218 ?> 202 <form id="record" name="record" method="get" action="./m.php" >219 <form id="record" name="record" method="get" action="./m.php" autocomplete="off"> 203 220 <p>放送日: 204 221 <input name="startdate" type="text" id="startdate" size="9" value="<?=$startdate?>" /> … … 215 232 <?php 216 233 $query = " 217 SELECT stationid ,stationname,stationrecch ,digitalch234 SELECT stationid as x, stationname, stationrecch, digitalch 218 235 FROM foltia_station 219 236 WHERE stationrecch > 0 … … 221 238 SELECT DISTINCT stationid,stationname,stationrecch ,digitalch 222 239 FROM foltia_station 223 WHERE digitalch > 0 224 ORDER BY \"stationid\" ASC"; 225 226 $stations = m_query($con, $query, "DBクエリに失敗しました"); 227 $stationcount = pg_num_rows($stations); 228 229 if ($stationcount > 0 ){ 230 for ($row = 0; $row < $stationcount ; $row++) { 231 $rowdata = pg_fetch_row($stations, $row); 240 WHERE digitalch > 0 241 ORDER BY x ASC"; 242 243 $stations = sql_query($con, $query, "DBクエリに失敗しました"); 244 $rowdata = $stations->fetch(); 245 246 if ($rowdata) { 247 do { 232 248 if ($recstid == $rowdata[0]){ 233 print " <input name=\"recstid\" type=\"radio\" value=\"$rowdata[0]\" checked /> $rowdata[1] ($rowdata[2]ch ) \n";249 print " <input name=\"recstid\" type=\"radio\" value=\"$rowdata[0]\" checked /> $rowdata[1] ($rowdata[2]ch / $rowdata[3]ch) \n"; 234 250 }else{ 235 print " <input name=\"recstid\" type=\"radio\" value=\"$rowdata[0]\" /> $rowdata[1] ($rowdata[2]ch ) \n";251 print " <input name=\"recstid\" type=\"radio\" value=\"$rowdata[0]\" /> $rowdata[1] ($rowdata[2]ch / $rowdata[3]ch) \n"; 236 252 } 237 }253 } while ($rowdata = $stations->fetch()); 238 254 }else{ 239 255 print "放送局データベースが正しくセットアップされていません。録画可能局がありません"; 240 256 } 241 257 //外部入力チャンネル 242 258 $query = " 243 SELECT stationid ,stationname,stationrecch259 SELECT stationid as x ,stationname,stationrecch 244 260 FROM foltia_station 245 261 WHERE stationrecch > -2 AND stationrecch < 1 246 ORDER BY \"stationid\" ASC"; 247 248 $stations = m_query($con, $query, "DBクエリに失敗しました"); 249 $stationcount = pg_num_rows($stations); 250 251 if ($stationcount > 0 ){ 252 for ($row = 0; $row < $stationcount ; $row++) { 253 $rowdata = pg_fetch_row($stations, $row); 262 ORDER BY x ASC"; 263 264 // $stations = m_query($con, $query, "DBクエリに失敗しました"); 265 $stations = sql_query($con, $query, "DBクエリに失敗しました"); 266 $rowdata = $stations->fetch(); 267 if ($rowdata) { 268 do { 254 269 if ($rowdata[0] != 0){ 255 270 if ($recstid == $rowdata[0]){ … … 260 275 261 276 } 262 } 277 } while ($rowdata = $stations->fetch()); 263 278 } 264 279 /* trunk/install/php/reservecomp.php
r83 r94 67 67 68 68 //タイトル取得 69 $query = "select title from foltia_program where tid ='$tid'";70 $rs = m_query($con, $query, "DBクエリに失敗しました");71 $ maxrows = pg_num_rows($rs);72 73 if ($maxrows == 0) {69 $query = "select title from foltia_program where tid = ? "; 70 // $rs = m_query($con, $query, "DBクエリに失敗しました"); 71 $rs = sql_query($con, $query, "DBクエリに失敗しました",array($tid)); 72 $rowdata = $rs->fetch(); 73 if (! $rowdata) { 74 74 $title = "(未登録)"; 75 75 }else{ 76 $rowdata = pg_fetch_row($rs, 0);77 76 $title = htmlspecialchars($rowdata[0]); 78 77 } … … 130 129 } 131 130 $rs = m_query($con, $query, "DBクエリに失敗しました"); 132 $maxrows = pg_num_rows($rs); 133 134 if ($maxrows == 0) { 131 $rowdata = $rs->fetch(); 132 if (! $rowdata) { 135 133 echo("放映予定はいまのところありません<BR>"); 136 134 } 137 135 else{ 138 $maxcols = pg_num_fields($rs);136 $maxcols = $rs->columnCount(); 139 137 ?> 140 138 <table BORDER="0" CELLPADDING="0" CELLSPACING="2" WIDTH="100%" BGCOLOR="#bcf1be"> … … 155 153 <?php 156 154 /* テーブルのデータを出力 */ 157 for ($row = 0; $row < $maxrows; $row++) { /* 行に対応 */ 155 do { 158 156 echo("<tr>\n"); 159 /* pg_fetch_row で一行取り出す */160 $rowdata = pg_fetch_row($rs, $row);161 162 157 for ($col = 0; $col < $maxcols; $col++) { /* 列に対応 */ 163 158 echo("<td>".htmlspecialchars($rowdata[$col])."<br></td>\n"); 164 159 } 165 160 echo("</tr>\n"); 166 } 161 } while ($rowdata = $rs->fetch()); 167 162 }//end if 168 163 ?> … … 177 172 //既存が予約あって、新着が全局予約だったら 178 173 if ($station ==0){ 179 $query = "180 SELECT181 *182 FROM foltia_tvrecord183 WHERE tid = '$tid'184 ";185 $rs = m_query($con, $query, "DBクエリに失敗しました");186 $maxrows = pg_num_rows($rs);187 if ($maxrows > 0){188 174 //既存局を消す 189 175 $query = "DELETE 190 176 FROM foltia_tvrecord 191 WHERE tid = '$tid'192 "; 193 $rs = m_query($con, $query, "DBクエリに失敗しました");194 }177 WHERE tid = ? 178 "; 179 // $rs = m_query($con, $query, "DBクエリに失敗しました"); 180 $rs = sql_query($con, $query, "DBクエリに失敗しました",array($tid)); 195 181 }//endif 196 182 197 183 $query = " 198 184 SELECT 199 *185 count(*) 200 186 FROM foltia_tvrecord 201 WHERE tid = '$tid' AND stationid = '$station'202 "; 203 $rs = m_query($con, $query, "DBクエリに失敗しました");204 $ maxrows = pg_num_rows($rs);205 187 WHERE tid = ? AND stationid = ? 188 "; 189 // $rs = m_query($con, $query, "DBクエリに失敗しました"); 190 $rs = sql_query($con, $query, "DBクエリに失敗しました",array($tid,$station)); 191 $maxrows = $rs->fetchColumn(0); 206 192 if ($maxrows == 0) { //新規追加 207 $query = "INSERT INTO foltia_tvrecord values ('$tid','$station','$bitrate','$usedigital')"; 208 $rs = m_query($con, $query, "DB書き込みに失敗しました"); 193 $query = "INSERT INTO foltia_tvrecord values (?,?,?,?)"; 194 // $rs = m_query($con, $query, "DB書き込みに失敗しました"); 195 $rs = sql_query($con, $query, "DB書き込みに失敗しました",array($tid,$station,$bitrate,$usedigital)); 209 196 }else{//修正 (ビットレート) 210 197 $query = "UPDATE foltia_tvrecord SET 211 bitrate = '$bitrate' , digital = '$usedigital' WHERE tid = '$tid' AND stationid = '$station' "; 212 $rs = m_query($con, $query, "DB書き込みに失敗しました"); 198 bitrate = ? , digital = ? WHERE tid = ? AND stationid = ? "; 199 // $rs = m_query($con, $query, "DB書き込みに失敗しました"); 200 $rs = sql_query($con, $query, "DB書き込みに失敗しました",array( $bitrate, $usedigital , $tid , $station )); 213 201 } 214 202 trunk/install/php/reserveepg.php
r70 r94 56 56 stationname , stationrecch ,stationid 57 57 FROM foltia_epg , foltia_station 58 WHERE epgid ='$epgid'AND foltia_station.ontvcode = foltia_epg.ontvchannel58 WHERE epgid = ? AND foltia_station.ontvcode = foltia_epg.ontvchannel 59 59 ";//4812 60 $rs = m_query($con, $query, "DBクエリに失敗しました");61 $ maxrows = pg_num_rows($rs);62 63 if ($maxrows == 0) {60 // $rs = m_query($con, $query, "DBクエリに失敗しました"); 61 $rs = sql_query($con, $query, "DBクエリに失敗しました",array($epgid)); 62 $rowdata = $rs->fetch(); 63 if (! $rowdata) { 64 64 die_exit("登録番組がありません<BR>"); 65 65 } 66 $rowdata = pg_fetch_row($rs, 0); 66 67 67 //$title = htmlspecialchars($rowdata[0]); 68 68 ?> … … 136 136 $query = " 137 137 SELECT 138 foltia_program .title, 139 foltia_program .tid, 140 stationname, 141 foltia_station.stationid , 142 foltia_subtitle.countno, 143 foltia_subtitle.subtitle, 144 foltia_subtitle.startdatetime , 145 foltia_subtitle.lengthmin , 146 foltia_tvrecord.bitrate , 147 foltia_subtitle.startoffset , 148 foltia_subtitle.pid 138 foltia_program.title, foltia_program.tid, stationname, 139 foltia_station.stationid, foltia_subtitle.countno, 140 foltia_subtitle.subtitle, foltia_subtitle.startdatetime, 141 foltia_subtitle.lengthmin, foltia_tvrecord.bitrate, 142 foltia_subtitle.startoffset, foltia_subtitle.pid 149 143 FROM foltia_subtitle , foltia_program ,foltia_station ,foltia_tvrecord 150 144 WHERE foltia_tvrecord.tid = foltia_program.tid AND foltia_tvrecord.stationid = foltia_station .stationid AND foltia_program.tid = foltia_subtitle.tid AND foltia_station.stationid = foltia_subtitle.stationid 151 AND foltia_subtitle.startdatetime = '$startfoltime'152 AND foltia_subtitle.enddatetime = '$endfoltime'153 AND foltia_station.stationid = '$stationid'145 AND foltia_subtitle.startdatetime = ? 146 AND foltia_subtitle.enddatetime = ? 147 AND foltia_station.stationid = ? 154 148 UNION 155 149 SELECT 156 foltia_program .title, 157 foltia_program .tid, 158 stationname, 159 foltia_station.stationid , 160 foltia_subtitle.countno, 161 foltia_subtitle.subtitle, 162 foltia_subtitle.startdatetime , 163 foltia_subtitle.lengthmin , 164 foltia_tvrecord.bitrate , 165 foltia_subtitle.startoffset , 166 foltia_subtitle.pid 150 foltia_program.title, foltia_program.tid, stationname, 151 foltia_station.stationid, foltia_subtitle.countno, 152 foltia_subtitle.subtitle, foltia_subtitle.startdatetime, 153 foltia_subtitle.lengthmin, foltia_tvrecord.bitrate, 154 foltia_subtitle.startoffset, foltia_subtitle.pid 167 155 FROM foltia_tvrecord 168 156 LEFT OUTER JOIN foltia_subtitle on (foltia_tvrecord.tid = foltia_subtitle.tid ) … … 170 158 LEFT OUTER JOIN foltia_station on (foltia_subtitle.stationid = foltia_station.stationid ) 171 159 WHERE foltia_tvrecord.stationid = 0 172 AND foltia_subtitle.startdatetime = '$startfoltime'173 AND foltia_subtitle.enddatetime = '$endfoltime'174 AND foltia_station.stationid = '$stationid'160 AND foltia_subtitle.startdatetime = ? 161 AND foltia_subtitle.enddatetime = ? 162 AND foltia_station.stationid = ? 175 163 "; 176 164 177 178 179 $rs = m_query($con, $query, "DBクエリに失敗しました");180 $maxrows = pg_num_rows($rs);181 182 165 //print "<!--$query \n $maxrows\n -->"; 183 166 184 167 print "<form name=\"recordingsetting\" method=\"POST\" action=\"reserveepgcomp.php\">\n"; 185 168 186 if ($maxrows == 0) { 169 //$rs = m_query($con, $query, "DBクエリに失敗しました"); 170 $rs = sql_query($con, $query, "DBクエリに失敗しました",array($startfoltime,$endfoltime,$stationid,$startfoltime,$endfoltime,$stationid)); 171 $chkoverwrap = $rs->fetch(); 172 if (! $chkoverwrap) { 187 173 //重複なし 188 174 print "<input type=\"submit\" value=\"予約\" ><br>\n"; 189 175 }else{ 190 $chkoverwrap = pg_fetch_row($rs, 0);191 176 $prereservedtitle = htmlspecialchars($chkoverwrap[0]); 192 177 $tid = htmlspecialchars($chkoverwrap[1]); trunk/install/php/reserveepgcomp.php
r83 r94 72 72 //min pidを探す 73 73 $query = "SELECT min(pid) FROM foltia_subtitle "; 74 $rs = m_query($con, $query, "DBクエリに失敗しました"); 75 $maxrows = pg_num_rows($rs); 76 if ($maxrows == 0){ 74 // $rs = m_query($con, $query, "DBクエリに失敗しました"); 75 $rs = sql_query($con, $query, "DBクエリに失敗しました"); 76 $rowdata = $rs->fetch(); 77 if (! $rowdata) { 77 78 $insertpid = -1 ; 78 79 }else{ 79 $rowdata = pg_fetch_row($rs, 0);80 81 80 $insertpid = $rowdata[0]; 82 81 if ($insertpid > 0){ … … 88 87 // next 話数を探す 89 88 $query = "SELECT max(countno) FROM foltia_subtitle WHERE tid = 0"; 90 $rs = m_query($con, $query, "DBクエリに失敗しました"); 91 $maxrows = pg_num_rows($rs); 92 if ($maxrows == 0){ 89 // $rs = m_query($con, $query, "DBクエリに失敗しました"); 90 $rs = sql_query($con, $query, "DBクエリに失敗しました"); 91 $rowdata = $rs->fetch(); 92 if (! $rowdata) { 93 93 $nextcno = 1 ; 94 94 }else{ 95 $rowdata = pg_fetch_row($rs, 0);96 95 $nextcno = $rowdata[0]; 97 96 $nextcno++ ; … … 124 123 insert into foltia_subtitle (pid ,tid ,stationid , countno ,subtitle , 125 124 startdatetime ,enddatetime ,startoffset , lengthmin , epgaddedby ) 126 values ( '$insertpid','0','$stationid',127 '$nextcno','$subtitle','$startdatetime','$enddatetime','0' ,'$lengthmin' , '$memberid')";128 $rs = m_query($con, $query, "DBクエリに失敗しました");125 values ( ?,'0',?,?,?,?,?,'0',?,?)"; 126 // $rs = m_query($con, $query, "DBクエリに失敗しました"); 127 $rs = sql_query($con, $query, "DBクエリに失敗しました",array($insertpid,$stationid,$nextcno,$subtitle,$startdatetime,$enddatetime,$lengthmin,$memberid)); 129 128 130 129 //addatq.pl trunk/install/php/reserveprogram.php
r83 r94 53 53 54 54 //タイトル取得 55 $query = "select title from foltia_program where tid ='$tid'";56 $rs = m_query($con, $query, "DBクエリに失敗しました");57 $maxrows = pg_num_rows($rs);58 59 if ($maxrows == 0) {55 $query = "select title from foltia_program where tid = ? "; 56 // $rs = m_query($con, $query, "DBクエリに失敗しました"); 57 $rs = sql_query($con, $query, "DBクエリに失敗しました",array($tid)); 58 $rowdata = $rs->fetch(); 59 if (! $rowdata) { 60 60 die_exit("登録番組がありません<BR>"); 61 61 } 62 $rowdata = pg_fetch_row($rs, 0); 62 63 63 $title = htmlspecialchars($rowdata[0]); 64 64 ?> … … 100 100 FROM foltia_subtitle , foltia_program ,foltia_station 101 101 WHERE foltia_program.tid = foltia_subtitle.tid AND foltia_station.stationid = foltia_subtitle.stationid 102 AND foltia_program.tid = '$tid'102 AND foltia_program.tid = ? 103 103 ORDER BY stationrecch DESC 104 104 "; 105 106 $rs = m_query($con, $query, "DBクエリに失敗しました"); 107 $maxrows = pg_num_rows($rs); 108 109 if ($maxrows == 0) { 105 // $rs = m_query($con, $query, "DBクエリに失敗しました"); 106 $rs = sql_query($con, $query, "DBクエリに失敗しました",array($tid)); 107 $rowdata = $rs->fetch(); 108 if (! $rowdata) { 110 109 echo("放映局情報がまだはいってません<BR>"); 111 110 } 112 111 else{ 113 $maxcols = pg_num_fields($rs);112 $maxcols = $rs->columnCount(); 114 113 115 114 echo("<select name=\"station\">\n"); 116 115 /* テーブルのデータを出力 */ 117 for ($row = 0; $row < $maxrows; $row++) { /* 行に対応 */ 118 /* pg_fetch_row で一行取り出す */ 119 $rowdata = pg_fetch_row($rs, $row); 116 do { 120 117 echo("<option value=\""); 121 118 echo(htmlspecialchars($rowdata[0])); … … 123 120 echo(htmlspecialchars($rowdata[1])); 124 121 echo("</option>\n"); 125 }//for122 } while ($rowdata = $rs->fetch()); 126 123 echo("<option value=\"0\">全局</option>\n</select>\n"); 127 124 }//endif … … 182 179 FROM foltia_subtitle , foltia_program ,foltia_station 183 180 WHERE foltia_program.tid = foltia_subtitle.tid AND foltia_station.stationid = foltia_subtitle.stationid 184 AND foltia_subtitle.startdatetime >= '$now' AND foltia_program.tid ='$tid'181 AND foltia_subtitle.startdatetime >= ? AND foltia_program.tid = ? 185 182 ORDER BY foltia_subtitle.startdatetime ASC 186 183 "; 187 $rs = m_query($con, $query, "DBクエリに失敗しました");188 $maxrows = pg_num_rows($rs);189 190 if ($maxrows == 0) {184 // $rs = m_query($con, $query, "DBクエリに失敗しました"); 185 $rs = sql_query($con, $query, "DBクエリに失敗しました",array($now,$tid)); 186 $rowdata = $rs->fetch(); 187 if (! $rowdata) { 191 188 echo("放映予定はありません<BR>"); 192 189 } 193 190 else{ 194 $maxcols = pg_num_fields($rs);191 $maxcols = $rs->columnCount(); 195 192 ?> 196 193 <table BORDER="0" CELLPADDING="0" CELLSPACING="2" WIDTH="100%" BGCOLOR="#bcf1be"> … … 210 207 <?php 211 208 /* テーブルのデータを出力 */ 212 for ($row = 0; $row < $maxrows; $row++) { /* 行に対応 */ 209 do { 213 210 echo("<tr>\n"); 214 /* pg_fetch_row で一行取り出す */215 $rowdata = pg_fetch_row($rs, $row);216 217 211 for ($col = 0; $col < $maxcols; $col++) { /* 列に対応 */ 218 212 if ($col == 3){ … … 223 217 } 224 218 echo("</tr>\n"); 225 } 219 } while ($rowdata = $rs->fetch()); 226 220 }//end if 227 221 ?> trunk/install/php/selectcaptureimage.php
r85 r94 74 74 FROM foltia_subtitle , foltia_program ,foltia_station 75 75 WHERE foltia_program.tid = foltia_subtitle.tid AND foltia_station.stationid = foltia_subtitle.stationid 76 AND foltia_subtitle.pid = '$pid'76 AND foltia_subtitle.pid = ? 77 77 78 78 "; 79 $rs = m_query($con, $query, "DBクエリに失敗しました"); 80 $rows = pg_num_rows($rs); 81 if ($rows == 0){ 79 // $rs = m_query($con, $query, "DBクエリに失敗しました"); 80 $rs = sql_query($con, $query, "DBクエリに失敗しました",array($pid)); 81 $rowdata = $rs->fetch(); 82 if (! $rowdata) { 82 83 print " <p align=\"left\"><font color=\"#494949\" size=\"6\">キャプチャ画像</font></p> 83 84 <hr size=\"4\"> … … 87 88 88 89 }else{ 89 $rowdata = pg_fetch_row($rs, 0);90 91 90 print " <p align=\"left\"><font color=\"#494949\" size=\"6\">キャプチャ画像</font></p> 92 91 <hr size=\"4\"> trunk/install/php/showlib.php
r83 r94 84 84 "; 85 85 86 $rs = m_query($con, $query, "DBクエリに失敗しました"); 87 88 $maxrows = pg_num_rows($rs); 89 90 if ($maxrows > 0 ){ 86 //$rs = m_query($con, $query, "DBクエリに失敗しました"); 87 $rs = sql_query($con, $query, "DBクエリに失敗しました"); 88 $rowdata = $rs->fetch(); 89 if ($rowdata) { 91 90 if(ereg("iPhone",$useragent)){ 92 91 print "<ul id=\"home\" title=\"録画ライブラリ表示\" selected=\"true\">"; … … 105 104 "; 106 105 } 107 for ($row = 0; $row < $maxrows; $row++) { 108 $rowdata = pg_fetch_row($rs, $row); 106 do { 109 107 $title = $rowdata[1]; 110 108 $counts = $rowdata[2]; … … 125 123 "; 126 124 } 127 }//for 125 } while ($rowdata = $rs->fetch()); 128 126 129 127 if(ereg("iPhone",$useragent)){ … … 160 158 "; 161 159 $rs = m_query($con, $query, "DBクエリに失敗しました"); 162 $rowdata = pg_fetch_row($rs, $row);160 $rowdata = $rs->fetch(); 163 161 //print" $fName./$rowdata[1]/$rowdata[2]/$rowdata[3]<BR>\n"; 164 162 $title = $rowdata[1]; trunk/install/php/showlibc.php
r83 r94 68 68 SELECT foltia_program.title 69 69 FROM foltia_program 70 WHERE foltia_program.tid = $tid 71 "; 72 $rs = m_query($con, $query, "DBクエリに失敗しました"); 73 $maxrows = pg_num_rows($rs); 74 if ($maxrows == 0 ){ 75 $syobocaldb = `curl "http://cal.syoboi.jp/db?Command=TitleLookup&TID=$tid" | head -2 `; 70 WHERE foltia_program.tid = ? 71 "; 72 //$rs = m_query($con, $query, "DBクエリに失敗しました"); 73 $rs = sql_query($con, $query, "DBクエリに失敗しました",array($tid)); 74 $rowdata = $rs->fetch(); 75 if (! $rowdata) { 76 $syobocaldb = `curl "http://cal.syoboi.jp/db?Command=TitleLookup&TID=$tid" | head -2 `; 76 77 $syobocaldb = mb_convert_encoding($syobocaldb, "EUC-JP", "UTF-8"); 77 78 $syobocaldb = preg_match("/<Title>.*<\/Title>/", $syobocaldb,$title); … … 80 81 $title = htmlspecialchars($title) ; 81 82 }else{ 82 $rowdata = pg_fetch_row($rs, 0);83 83 $title = $rowdata[0]; 84 84 $title = htmlspecialchars($title) ; … … 143 143 LEFT JOIN foltia_program 144 144 ON foltia_mp4files.tid = foltia_program.tid 145 WHERE foltia_mp4files.tid = $tid145 WHERE foltia_mp4files.tid = ? 146 146 ORDER BY \"startdatetime\" ASC 147 147 "; 148 148 149 149 $rs = ""; 150 $rs = m_query($con, $query, "DBクエリに失敗しました"); 151 $maxrows = pg_num_rows($rs); 152 if ($maxrows > 0 ){ 150 //$rs = m_query($con, $query, "DBクエリに失敗しました"); 151 $rs = sql_query($con, $query, "DBクエリに失敗しました",array($tid)); 152 $rowdata = $rs->fetch(); 153 if ($rowdata) { 153 154 if(ereg("iPhone",$useragent)){ 154 155 print "<ul id=\"home\" title=\"$title\" selected=\"true\">"; … … 159 160 "; 160 161 } 161 for ($row = 0; $row < $maxrows; $row++) { 162 $rowdata = pg_fetch_row($rs, $row); 163 162 do { 164 163 $title = $rowdata[1]; 165 164 … … 195 194 } 196 195 //Starlight Breaker向け拡張 197 //$debug_pg_num_rows = pg_num_rows ($rs);196 //$debug_pg_num_rows = $rs ->rowCount(); 198 197 $caplink = ""; 199 198 200 if (($sbpluginexist == 1) && (pg_num_rows ($rs ) > 0)){199 if ($sbpluginexist == 1) { 201 200 //$capimgpath = htmlspecialchars(preg_replace("/.m2p/", "", $rowdata[5])); 202 201 $capimgpath = htmlspecialchars(preg_replace("/.m2./", "", $rowdata[5])); … … 244 243 }//endif iPhone 245 244 246 }//for 245 } while ($rowdata = $rs->fetch()); 247 246 }else{ 248 247 print "録画ファイルがありません<br>\n"; trunk/install/php/showplaylist.php
r83 r94 115 115 FROM foltia_subtitle , foltia_program 116 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); 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]; 121 123 //print" $fName./$rowdata[1]//$rowdata[2]<BR>\n"; 122 124 $title = $rowdata[1]; … … 130 132 FROM foltia_subtitle , foltia_program 131 133 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); 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]; 137 141 //print" $fName./$rowdata[1]/$rowdata[2]/$rowdata[3]<BR>\n"; 138 142 $title = $rowdata[1]; … … 197 201 } 198 202 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 203 //$rs = m_query($con, $query, "DBクエリに失敗しました"); 204 $rs = sql_query($con, $query, "DBクエリに失敗しました"); 205 $rowdata = $rs->fetch(); 206 if ($rowdata) { 207 do { 206 208 $tid = htmlspecialchars($rowdata[0]); 207 209 $title = htmlspecialchars($rowdata[1]); … … 235 237 print "</tr>\n 236 238 "; 237 }//for 239 } while ($rowdata = $rs->fetch()); 238 240 }else{ 239 241 print " … … 262 264 "; 263 265 264 $rs = m_query($con, $query, "DBクエリに失敗しました"); 265 $maxrows = pg_num_rows($rs); 266 267 268 if ($maxrows > 0){ 266 //$rs = m_query($con, $query, "DBクエリに失敗しました"); 267 $rs = sql_query($con, $query, "DBクエリに失敗しました"); 268 $rowdata = $rs->fetch(); 269 if ($rowdata) { 269 270 print "<hr> 270 271 <p align=\"left\">未読タイトルを表示します。<br> … … 279 280 "; 280 281 281 for ($row = 0; $row < $maxrows; $row++) { 282 $rowdata = pg_fetch_row($rs, $row); 283 282 do { 284 283 $tid = htmlspecialchars($rowdata[0]); 285 284 $title = htmlspecialchars($rowdata[1]); 286 285 287 288 286 print "<tr><td>$tid</td><td>$title</td></tr>\n"; 289 287 290 }//for 288 } while ($rowdata = $rs->fetch()); 291 289 print "</tbody></table>\n"; 292 290 }//if maxrows trunk/install/php/titlelist.php
r70 r94 51 51 ORDER BY foltia_program.tid DESC 52 52 "; 53 $rs = m_query($con, $query, "DBクエリに失敗しました");54 $maxrows = pg_num_rows($rs);55 56 if ($maxrows == 0) {53 // $rs = m_query($con, $query, "DBクエリに失敗しました"); 54 $rs = sql_query($con, $query, "DBクエリに失敗しました"); 55 $rowdata = $rs->fetch(); 56 if (! $rowdata) { 57 57 die_exit("番組データがありません<BR>"); 58 59 58 } 60 61 59 ?> 62 60 … … 72 70 <? 73 71 /* フィールド数 */ 74 $maxcols = pg_num_fields($rs);72 $maxcols = $rs->columnCount(); 75 73 ?> 76 74 <table BORDER="0" CELLPADDING="0" CELLSPACING="2" WIDTH="100%"> … … 86 84 <?php 87 85 /* テーブルのデータを出力 */ 88 for ($row = 0; $row < $maxrows; $row++) { /* 行に対応 */ 86 do { 89 87 echo("<tr>\n"); 90 /* pg_fetch_row で一行取り出す */ 91 $rowdata = pg_fetch_row($rs, $row); 88 92 89 //TID 93 90 echo("<td><a href=\"reserveprogram.php?tid=" . … … 100 97 print "<td><A HREF = \"showlibc.php?tid=".htmlspecialchars($rowdata[0])."\">mp4</A></td>\n"; 101 98 echo("</tr>\n"); 102 } 99 } while ($rowdata = $rs->fetch()); 103 100 ?> 104 101 </tbody> trunk/install/php/view_syabas.php
r86 r94 56 56 FROM foltia_subtitle , foltia_program ,foltia_station 57 57 WHERE foltia_program.tid = foltia_subtitle.tid AND foltia_station.stationid = foltia_subtitle.stationid 58 AND foltia_subtitle.pid = '$pid' 59 60 "; 61 $rs = m_query($con, $query, "DBクエリに失敗しました"); 62 63 $rows = pg_num_rows($rs); 64 if ($rows == 0){ 58 AND foltia_subtitle.pid = ? "; 59 // $rs = m_query($con, $query, "DBクエリに失敗しました"); 60 $rs = sql_query($con, $query, "DBクエリに失敗しました",array($pid)); 61 $rowdata = $rs->fetch(); 62 if (! $rowdata) { 65 63 print ""; 66 64 exit; 67 65 }else{ 68 $rowdata = pg_fetch_row($rs, 0);69 70 66 $title = $rowdata[2]; 71 67 $episode = $rowdata[3]; trunk/install/php/viewepg.php
r91 r94 91 91 $maxdisplay = 8; 92 92 93 $query = "SELECT stationid, stationname, stationrecch, ontvcode FROM foltia_station WHERE \"ontvcode\" ~~ '%ontvjapan%' 94 "; 95 $rs = m_query($con, $query, "DBクエリに失敗しました"); 96 $maxrows = pg_num_rows($rs); 97 93 $query = "SELECT count(*) FROM foltia_station WHERE \"ontvcode\" LIKE '%ontvjapan%'"; 94 //$rs = m_query($con, $query, "DBクエリに失敗しました"); 95 $rs = sql_query($con, $query, "DBクエリに失敗しました"); 96 $maxrows = $rs->fetchColumn(0); 98 97 if ($maxrows > $maxdisplay){ 99 98 $pages = ceil($maxrows / $maxdisplay) ; … … 138 137 $query = "SELECT stationid, stationname, stationrecch, ontvcode 139 138 FROM foltia_station 140 WHERE \"ontvcode\" ~~'%ontvjapan%'139 WHERE \"ontvcode\" LIKE '%ontvjapan%' 141 140 ORDER BY stationid ASC , stationrecch 142 OFFSET $offset LIMIT $maxdisplay 141 LIMIT ? OFFSET ? 143 142 "; 144 $slistrs = m_query($con, $query, "DBクエリに失敗しました"); 145 $stations = pg_num_rows($slistrs); 146 for ($i=0 ; $i < $stations ; $i++){ 147 $rowdata = pg_fetch_row($slistrs, $i); 148 $stationhash[$i] = $rowdata[3] ; 143 144 //$slistrs = m_query($con, $query, "DBクエリに失敗しました"); 145 $slistrs = sql_query($con, $query, "DBクエリに失敗しました",array($maxdisplay,$offset)); 146 while ($rowdata = $slistrs->fetch()) { 147 $stationhash[] = $rowdata[3]; 148 $snames[] = $rowdata[1]; // headder 149 149 } 150 150 … … 158 158 SELECT ontvcode 159 159 FROM foltia_station 160 WHERE \"ontvcode\" ~~'%ontvjapan%'160 WHERE \"ontvcode\" LIKE '%ontvjapan%' 161 161 ORDER BY stationid ASC , stationrecch 162 OFFSET $offset LIMIT $maxdisplay162 LIMIT ? OFFSET ? 163 163 ) 164 AND startdatetime >= $start165 AND startdatetime < $epgend164 AND startdatetime >= ? 165 AND startdatetime < ? 166 166 ORDER BY foltia_epg.startdatetime ASC "; 167 167 168 $rs = m_query($con, $query, "DBクエリに失敗しました"); 168 //$rs = m_query($con, $query, "DBクエリに失敗しました"); 169 $rs = sql_query($con, $query, "DBクエリに失敗しました",array($maxdisplay,$offset,$start,$epgend)); 169 170 170 171 //print "$query<br>\n"; 171 172 172 $ colmnums = pg_num_rows($rs);173 if ( $colmnums == 0){173 $rowdata = $rs->fetch(); 174 if (! $rowdata) { 174 175 //番組データがない 175 176 $colmnums = 2; 176 177 }else{ 177 for ($i=0 ; $i < $colmnums ; $i++){ 178 $rowdata = pg_fetch_row($rs, $i); 179 $timetablehash["$rowdata[0]"] = ($i + 1); 178 $colmnums = 0; 179 do { 180 $colmnums++; 181 $timetablehash[$rowdata[0]] = $colmnums; 180 182 // print "$rowdata[0]:$i+1 <br>\n"; 181 } 183 } while ($rowdata = $rs->fetch()); 182 184 } 183 185 //print "colmnums $colmnums <br>\n"; 184 186 185 187 //・局ごとに縦に配列入れていく 186 for ($j=0 ; $j < $stations ; $j++){ 187 $rowdata = pg_fetch_row($slistrs, $j); 188 $stationname = $rowdata[3]; 189 188 foreach ($stationhash as $stationname) { 190 189 $epgstart = $start ; 191 190 $epgend = calcendtime($start , (8*60)); … … 193 192 SELECT startdatetime , enddatetime , lengthmin , epgtitle , epgdesc , epgcategory ,ontvchannel ,epgid , epgcategory 194 193 FROM foltia_epg 195 WHERE foltia_epg.ontvchannel = '$stationname'AND196 enddatetime > $epgstartAND197 startdatetime < $epgend194 WHERE foltia_epg.ontvchannel = ? AND 195 enddatetime > ? AND 196 startdatetime < ? 198 197 ORDER BY foltia_epg.startdatetime ASC 199 198 "; 200 $statiodh = m_query($con, $query, "DBクエリに失敗しました"); 201 $maxrowsstation = pg_num_rows($statiodh); 202 203 //print "maxrowsstation $maxrowsstation stationname $stationname<br>\n"; 204 205 if ($maxrowsstation == 0) { 199 200 // $statiodh = m_query($con, $query, "DBクエリに失敗しました"); 201 $statiodh = sql_query($con, $query, "DBクエリに失敗しました",array($stationname,$epgstart,$epgend)); 202 $stationrowdata = $statiodh->fetch(); 203 if (! $stationrowdata) { 206 204 //print("番組データがありません<BR>"); 207 205 $item[0]["$stationname"] = ">番組データがありません"; 208 206 }else{ 209 210 for ($srow = 0; $srow < $maxrowsstation ; $srow++) { 211 212 $stationrowdata = pg_fetch_row($statiodh, $srow); 213 207 do { 214 208 $printstarttime = substr($stationrowdata[0],8,2) . ":" . substr($stationrowdata[0],10,2); 215 209 $tdclass = "t".substr($stationrowdata[0],8,2) . substr($stationrowdata[0],10,2); … … 235 229 }//if 236 230 237 }//for 231 } while ($stationrowdata = $statiodh->fetch()); 238 232 }//if 239 233 … … 291 285 292 286 //ヘッダ 293 for ($i=0;$i<$stations;$i++){ 294 $rowdata = pg_fetch_row($slistrs, $i); 295 print "<th>".htmlspecialchars($rowdata[1])."</th>" ; 287 foreach ($snames as $s) { 288 print "<th>".htmlspecialchars($s)."</th>" ; 296 289 } 297 290 //本体 298 291 for ($l = 0 ;$l < $colmnums; $l++){ 299 292 print "<tr>"; 300 for ($m = 0 ; $m < $stations ; $m++ ){ 301 $stationname = $stationhash[$m]; 293 foreach ($stationhash as $stationname) { 302 294 print_r($item[$l]["$stationname"]); 303 295 }