break; // 未定義のリクエスト // 未定義のリクエスト default: P2Util::pushInfoHtml('<p>未定義のリクエストです。</p>'); } if (isset($removed_files)) { $flexy->setData('removedFiles', $removed_files); } } // }}} // {{{ 出力 $flexy->setData('skin', $skin_en); $flexy->setData('php_self', $_SERVER['SCRIPT_NAME']); $flexy->setData('p2vid', P2_VERSION_ID); $flexy->setData('info_msg', P2Util::getInfoHtml()); $flexy->setData('pc', !$_conf['ktai']); $flexy->setData('iphone', $_conf['iphone']); $flexy->setData('doctype', $_conf['doctype']); $flexy->setData('extra_headers', $_conf['extra_headers_ht']); $flexy->setData('extra_headers_x', $_conf['extra_headers_xht']); if ($db->dsn['phptype'] == 'sqlite' || $viewer_cache_exists) { $flexy->setData('enable_optimize_db', true); } else { $flexy->setData('enable_optimize_db', false); } P2Util::header_nocache(); $flexy->compile('ic2mng.tpl.html'); $flexy->output(); // }}} /*
function readNew($aThread) { global $_conf, $newthre_num, $STYLE; global $spmode, $word, $newtime; $orig_no_label = !empty($_conf['expack.iphone.toolbars.no_label']); $_conf['expack.iphone.toolbars.no_label'] = true; $newthre_num++; //========================================================== // idxの読み込み //========================================================== //hostを分解してidxファイルのパスを求める $aThread->setThreadPathInfo($aThread->host, $aThread->bbs, $aThread->key); //FileCtl::mkdirFor($aThread->keyidx); // 板ディレクトリが無ければ作る //この操作はおそらく不要 $aThread->itaj = P2Util::getItaName($aThread->host, $aThread->bbs); if (!$aThread->itaj) { $aThread->itaj = $aThread->bbs; } // idxファイルがあれば読み込む if ($lines = FileCtl::file_read_lines($aThread->keyidx, FILE_IGNORE_NEW_LINES)) { $data = explode('<>', $lines[0]); } else { $data = array_fill(0, 12, ''); } $aThread->getThreadInfoFromIdx(); //================================================================== // DATのダウンロード //================================================================== if (!($word and file_exists($aThread->keydat))) { $aThread->downloadDat(); } // DATを読み込み $aThread->readDat(); $aThread->setTitleFromLocal(); // ローカルからタイトルを取得して設定 //=========================================================== // 表示レス番の範囲を設定 //=========================================================== // 取得済みなら if ($aThread->isKitoku()) { $from_num = $aThread->readnum + 1 - $_conf['respointer'] - $_conf['before_respointer_new']; if ($from_num > $aThread->rescount) { $from_num = $aThread->rescount - $_conf['respointer'] - $_conf['before_respointer_new']; } if ($from_num < 1) { $from_num = 1; } //if (!$aThread->ls) { $aThread->ls = "{$from_num}-"; //} } $aThread->lsToPoint(); //================================================================== // ヘッダ 表示 //================================================================== $motothre_url = $aThread->getMotoThread(); $ttitle_en = UrlSafeBase64::encode($aThread->ttitle); $ttitle_en_q = '&ttitle_en=' . $ttitle_en; $bbs_q = '&bbs=' . $aThread->bbs; $key_q = '&key=' . $aThread->key; $host_bbs_key_q = 'host=' . $aThread->host . $bbs_q . $key_q; $popup_q = '&popup=1'; $itaj_hd = htmlspecialchars($aThread->itaj, ENT_QUOTES, 'Shift_JIS'); if ($spmode) { $read_header_itaj_ht = "({$itaj_hd})"; } else { $read_header_itaj_ht = ''; } if ($_conf['iphone']) { if ($read_header_itaj_ht !== '') { $read_header_itaj_ht = "<span class=\"btitle\">{$read_header_itaj_ht}</span>"; } $read_header_ht = <<<EOP <div class="ntoolbar mtoolbar mtoolbar_top" id="ntt{$newthre_num}"> <h2 class="ttitle">{$aThread->ttitle_hd} {$read_header_itaj_ht}</h2> EOP; $read_header_ht .= '<div class="mover">'; $read_header_ht .= toolbar_i_standard_button('img/gp2-down.png', '', sprintf('#ntt%d', $newthre_num + 1)); $read_header_ht .= '</div>'; $info_ht = P2Util::getInfoHtml(); if (strlen($info_ht)) { $read_header_ht .= "<div class=\"info\">{$info_ht}</div>"; } $read_header_ht .= '</div>'; } else { P2Util::printInfoHtml(); $read_header_ht = <<<EOP <hr><div id="ntt{$newthre_num}" name="ntt{$newthre_num}"><font color="{$STYLE['mobile_read_ttitle_color']}"><b>{$aThread->ttitle_hd}</b></font> {$read_header_itaj_ht} <a href="#ntt_bt{$newthre_num}">▼</a></div><hr> EOP; } //================================================================== // ローカルDatを読み込んでHTML表示 //================================================================== $aThread->resrange['nofirst'] = true; $GLOBALS['newres_to_show_flag'] = false; $read_cont_ht = ''; if ($aThread->rescount) { $aShowThread = new ShowThreadK($aThread, true); if ($_conf['iphone'] && $_conf['expack.spm.enabled']) { $read_cont_ht .= $aShowThread->getSpmObjJs(); } $read_cont_ht .= $aShowThread->getDatToHtml(); unset($aShowThread); } //================================================================== // フッタ 表示 //================================================================== // 表示範囲 if ($aThread->resrange['start'] == $aThread->resrange['to']) { $read_range_on = $aThread->resrange['start']; } else { $read_range_on = "{$aThread->resrange['start']}-{$aThread->resrange['to']}"; } $read_range_ht = "{$read_range_on}/{$aThread->rescount}"; // ツールバー部分HTML ======= if ($spmode) { $toolbar_itaj_ht = "(<a href=\"{$_conf['subject_php']}?{$host_bbs_key_q}{$_conf['k_at_a']}\">{$itaj_hd}</a>)"; } else { $toolbar_itaj_ht = ''; } if ($_conf['iphone']) { if ($toolbar_itaj_ht !== '') { $toolbar_itaj_ht = "<span class=\"btitle\">{$toolbar_itaj_ht}</span>"; } $read_footer_ht = <<<EOP <div class="ntoolbar mtoolbar mtoolbar_bottom" id="ntt_btm{$newthre_num}"> <table><tbody><tr> EOP; // 情報 $read_footer_ht .= '<td>'; $escaped_url = "info.php?{$host_bbs_key_q}{$ttitle_en_q}{$_conf['k_at_a']}"; $read_footer_ht .= toolbar_i_opentab_button('img/gp5-info.png', '', $escaped_url); $read_footer_ht .= '</td>'; // 表示範囲 $read_footer_ht .= "<td colspan=\"3\"><span class=\"large\">{$read_range_ht}</span></td>"; // ツール $read_footer_ht .= '<td>'; $escaped_url = "spm_k.php?{$host_bbs_key_q}&ls={$aThread->ls}&spm_default={$aThread->resrange['to']}{$_conf['k_at_a']}"; $read_footer_ht .= toolbar_i_opentab_button('img/glyphish/icons2/20-gear2.png', '', $escaped_url); $read_footer_ht .= '</td>'; // タイトル等 $read_footer_ht .= <<<EOP </tr></tbody></table> <div class="ttitle"><a href="{$_conf['read_php']}?{$host_bbs_key_q}&offline=1&rescount={$aThread->rescount}{$_conf['k_at_a']}" target="_blank">{$aThread->ttitle_hd}</a> {$toolbar_itaj_ht}</div> <div class="mover"> EOP; $read_footer_ht .= toolbar_i_standard_button('img/gp1-up.png', '', "#ntt{$newthre_num}"); $read_footer_ht .= '</div></div>'; } else { $read_footer_ht = <<<EOP <div id="ntt_bt{$newthre_num}" name="ntt_bt{$newthre_num}" class="read_new_toolbar"> {$read_range_ht} <a href="info.php?{$host_bbs_key_q}{$ttitle_en_q}{$_conf['k_at_a']}">情</a> <a href="spm_k.php?{$host_bbs_key_q}&ls={$aThread->ls}&spm_default={$aThread->resrange['to']}&from_read_new=1{$_conf['k_at_a']}">特</a> <br> <a href="{$_conf['read_php']}?{$host_bbs_key_q}&offline=1&rescount={$aThread->rescount}{$_conf['k_at_a']}#r{$aThread->rescount}">{$aThread->ttitle_hd}</a> {$toolbar_itaj_ht} <a href="#ntt{$newthre_num}">▲</a> </div> <hr> EOP; } // 透明あぼーんや表示数制限で新しいレス表示がない場合はスキップ if ($GLOBALS['newres_to_show_flag']) { echo $read_header_ht; echo $read_cont_ht; echo $read_footer_ht; } //================================================================== // key.idxの値設定 //================================================================== if ($aThread->rescount) { $aThread->readnum = min($aThread->rescount, max(0, $data[5], $aThread->resrange['to'])); $newline = $aThread->readnum + 1; // $newlineは廃止予定だが、旧互換用に念のため $sar = array($aThread->ttitle, $aThread->key, $data[2], $aThread->rescount, $aThread->modified, $aThread->readnum, $data[6], $data[7], $data[8], $newline, $data[10], $data[11], $aThread->datochiok); P2Util::recKeyIdx($aThread->keyidx, $sar); // key.idxに記録 } $_conf['expack.iphone.toolbars.no_label'] = $orig_no_label; }
$elements['popup']->setValue($isPopUp); if ($isPopUp) { $elements['fileupload']->setAttributes('target="_self"'); } else { $elements['fileupload']->setAttributes('target="read"'); } } // テンプレート変数 $view = new stdClass(); $view->php_self = $_SERVER['SCRIPT_NAME']; $view->STYLE = $STYLE; $view->skin = $skin_en; $view->hint = $_conf['detect_hint']; $view->isPopUp = $isPopUp; $view->showForm = $showForm; $view->info_msg = P2Util::getInfoHtml(); $view->upfiles = $upfiles; $view->maxfilesize = $maxsize_si; $view->maxpostsize = ini_get('post_max_size'); $view->extra_headers = $_conf['extra_headers_ht']; $view->extra_headers_x = $_conf['extra_headers_xht']; // ページを表示 P2Util::header_nocache(); $flexy->outputObject($view, $elements); // }}} // {{{ 関数 // {{{ ic2_check_uploaded_file() /** * アップロードされた各画像ファイルを検証する。 * 問題がなければ ic2_register_uploaded_file() にファイル情報を渡し、 * 問題があればエラーメッセージ(文字列)を返す。
$code = -1; if ($finder->find(1)) { if ($rank != -5) { $setter = new IC2_DataObject_Images(); $setter->rank = $rank; $setter->whereAddQuoted('size', '=', $finder->size); $setter->whereAddQuoted('md5', '=', $finder->md5); $setter->whereAddQuoted('mime', '=', $finder->mime); if ($setter->update()) { $code = 1; } else { $code = 0; } } if ($remove) { $orig_info_msg_ht = P2Util::getInfoHtml(); $removed_files = IC2_DatabaseManager::remove(array($finder->id), $rank < 0); if ($code != 0 && !P2Util::hasInfoHtml()) { $code = 1; } else { $code = 0; } P2Util::pushInfoHtml($orig_info_msg_ht); } } echo $code; exit; // }}} /* * Local Variables: * mode: php
$htm['rf_match_field'] = ResFilterElement::getMatchField(); $htm['rf_include_field'] = ResFilterElement::getIncludeField(); echo <<<EOP <div id="read_toolbar_filter" class="extra"> <form id="read_filter" method="get" action="{$_conf['read_php']}" accept-charset="{$_conf['accept_charset']}"> {$htm['rf_hidden_fields']}{$htm['rf_word_field']} <input type="submit" id="submit1" name="submit_filter" value="検索"><br> {$htm['rf_field_field']}に{$htm['rf_method_field']}を{$htm['rf_match_field']} {$htm['rf_include_field']} {$_conf['detect_hint_input_ht']}{$_conf['k_input_ht']} </form> </div> EOP; // }}} // {{{ 各種通知 $info_ht = P2Util::getInfoHtml(); if (strlen($info_ht)) { echo "<div class=\"info\">{$info_ht}</div>"; } // スレが板サーバになければ if ($aThread->diedat) { echo '<div class="info">'; if ($aThread->getdat_error_msg_ht) { echo $aThread->getdat_error_msg_ht; } else { echo $aThread->getDefaultGetDatErrorMessageHTML(); } echo "<p><a href=\"{$motothre_url}\" target=\"_blank\">{$motothre_url}</a></p>"; echo '</div>'; } // フィルタヒット数
/** * ファイル内容を読み込んで編集のためのHTMLを表示する * * @return void */ function _printEditFileHtml($path, $encode) { global $_conf, $modori_url, $rows, $cols; $info_msg_ht = P2Util::getInfoHtml(); if ($path == '') { die('Error: path が指定されていません'); } $filename = basename($path); $ptitle = "Edit: " . $filename; if (false === FileCtl::make_datafile($path)) { die(sprintf("Error: cannot make file. ( %s )", hs($path))); } $cont = file_get_contents($path); if ($encode == 'EUC-JP') { $cont = mb_convert_encoding($cont, 'SJIS-win', 'eucJP-win'); } $cont_area_ht = htmlspecialchars($cont, ENT_QUOTES); $modori_url_ht = ''; if ($modori_url) { $modori_url_ht = sprintf('<p><a href="%s">Back</a></p>', hs($modori_url)); } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html lang="ja"> <head> <meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS"> <meta name="ROBOTS" content="NOINDEX, NOFOLLOW"> <title><?php eh($ptitle); ?> </title> </head> <body onLoad="top.document.title=self.document.title;"> <?php echo $modori_url_ht; ?> Edit: <?php eh($path); ?> <form action="<?php eh($_SERVER['SCRIPT_NAME']); ?> " method="post" accept-charset="<?php eh($_conf['accept_charset']); ?> "> <input type="hidden" name="detect_hint" value="◎◇"> <input type="hidden" name="path" value="<?php eh($path); ?> "> <input type="hidden" name="modori_url" value="<?php eh($modori_url); ?> "> <input type="hidden" name="encode" value="<?php eh($encode); ?> "> <input type="hidden" name="rows" value="<?php eh($rows); ?> "> <input type="hidden" name="cols" value="<?php eh($cols); ?> "> <input type="submit" name="submit" value="Save"> <?php echo $info_msg_ht; ?> <br> <textarea style="font-size:9pt;" id="filecont" name="filecont" rows="<?php eh($rows); ?> " cols="<?php eh($cols); ?> " wrap="off"><?php eh($cont); ?> </textarea> </form> </body></html> <?php }
/** * ファイル内容を読み込んで編集する関数 */ function editFile($path, $encode, $title) { global $_conf, $modori_url, $rows, $cols, $csrfid; if ($path == '') { p2die('path が指定されていません'); } $filename = basename($path); $ptitle = 'Edit: ' . p2h($title) . ' (' . $filename . ')'; //ファイル内容読み込み FileCtl::make_datafile($path) or p2die("cannot make file. ({$path})"); $cont = file_get_contents($path); if ($encode == "EUC-JP") { $cont = mb_convert_encoding($cont, 'CP932', 'CP51932'); } $cont_area = p2h($cont); if ($modori_url) { $modori_url_ht = "<p><a href=\"{$modori_url}\">Back</a></p>\n"; } else { $modori_url_ht = ''; } $rows_at = $rows > 0 ? sprintf(' rows="%d"', $rows) : ''; $cols_at = $cols > 0 ? sprintf(' cols="%d"', $cols) : ''; // プリント echo $_conf['doctype']; echo <<<EOHEADER <html lang="ja"> <head> <meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS"> <meta http-equiv="Content-Style-Type" content="text/css"> <meta http-equiv="Content-Script-Type" content="text/javascript"> <meta name="ROBOTS" content="NOINDEX, NOFOLLOW"> {$_conf['extra_headers_ht']} <title>{$ptitle}</title> </head> <body onload="top.document.title=self.document.title;"> EOHEADER; $info_msg_ht = P2Util::getInfoHtml(); echo $modori_url_ht; echo $ptitle; echo <<<EOFORM <form action="{$_SERVER['SCRIPT_NAME']}" method="post" accept-charset="{$_conf['accept_charset']}"> <input type="hidden" name="file" value="{$filename}"> <input type="hidden" name="modori_url" value="{$modori_url}"> <input type="hidden" name="encode" value="{$encode}"> <input type="hidden" name="rows" value="{$rows}"> <input type="hidden" name="cols" value="{$cols}"> <input type="hidden" name="csrfid" value="{$csrfid}"> <input type="submit" name="submit" value="Save"> {$info_msg_ht}<br> <textarea style="font-size:9pt;" id="filecont" name="filecont" wrap="off"{$rows_at}{$cols_at}>{$cont_area}</textarea> {$_conf['detect_hint_input_ht']}{$_conf['k_input_ht']} </form> EOFORM; echo '</body></html>'; return true; }
/** * 携帯用インデックスプリント */ function index_print_k() { global $_conf, $_login; $info_msg_ht = P2Util::getInfoHtml(); $newtime = date('gis'); $body = ""; $ptitle = "rep2モバイル"; // 認証ユーザ情報 $htm['auth_user'] = "******" . date("Y/m/d (D) G:i:s") . "</p>\n"; // 前回のログイン情報 if ($_conf['login_log_rec'] && $_conf['last_login_log_show']) { if (($log = P2Util::getLastAccessLog($_conf['login_log_file'])) !== false) { $log_hd = array_map('htmlspecialchars', $log); $htm['last_login'] = <<<EOP 前回のログイン情報 - {$log_hd['date']}<br> ユーザ: {$log_hd['user']}<br> IP: {$log_hd['ip']}<br> HOST: {$log_hd['host']}<br> UA: {$log_hd['ua']}<br> REFERER: {$log_hd['referer']} EOP; } } $rss_k_ht = ''; $iv2_k_ht = ''; if ($_conf['expack.rss.enabled']) { $rss_k_ht = "<a href=\"menu_k.php?view=rss{$m_rss_set_a}{$_conf['k_at_a']}\">RSS</a><br>"; } if ($_conf['expack.ic2.enabled'] == 2 || $_conf['expack.ic2.enabled'] == 3) { $iv2_k_ht = "<a href=\"iv2.php?reset_filter=1{$_conf['k_at_a']}\">画像キャッシュ一覧</a><br>"; } //========================================================= // 携帯用 HTML プリント //========================================================= P2Util::header_nocache(); echo $_conf['doctype']; echo <<<EOP <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS"> <meta name="ROBOTS" content="NOINDEX, NOFOLLOW"> {$_conf['extra_headers_ht']} <title>{$ptitle}</title> </head> <body{$_conf['k_colors']}> <h1>{$ptitle}</h1> {$info_msg_ht} <div> <a href="subject.php?spmode=fav&sb_view=shinchaku{$_conf['k_at_a']}"{$_conf['k_accesskey_at'][1]}>{$_conf['k_accesskey_st'][1]}お気にスレの新着</a><br> <a href="subject.php?spmode=fav{$_conf['k_at_a']}"{$_conf['k_accesskey_at'][2]}>{$_conf['k_accesskey_st'][2]}お気にスレの全て</a><br> <a href="menu_k.php?view=favita{$_conf['k_at_a']}"{$_conf['k_accesskey_at'][3]}>{$_conf['k_accesskey_st'][3]}お気に板</a><br> <a href="menu_k.php?view=cate{$_conf['k_at_a']}"{$_conf['k_accesskey_at'][4]}>{$_conf['k_accesskey_st'][4]}板リスト</a><br> <a href="subject.php?spmode=recent&sb_view=shinchaku{$_conf['k_at_a']}"{$_conf['k_accesskey_at'][5]}>{$_conf['k_accesskey_st'][5]}最近読んだスレの新着</a><br> <a href="subject.php?spmode=recent{$_conf['k_at_a']}"{$_conf['k_accesskey_at'][6]}>{$_conf['k_accesskey_st'][6]}最近読んだスレの全て</a><br> <a href="subject.php?spmode=res_hist{$_conf['k_at_a']}"{$_conf['k_accesskey_at'][7]}>{$_conf['k_accesskey_st'][7]}書込履歴</a> <a href="read_res_hist.php?nt={$newtime}{$_conf['k_at_a']}">ログ</a><br> <a href="subject.php?spmode=palace&norefresh=1{$_conf['k_at_a']}"{$_conf['k_accesskey_at'][8]}>{$_conf['k_accesskey_st'][8]}スレの殿堂</a><br> <a href="setting.php?nt={$newtime}{$_conf['k_at_a']}"{$_conf['k_accesskey_at'][9]}>{$_conf['k_accesskey_st'][9]}ログイン管理</a><br> <a href="editpref.php?nt={$newtime}{$_conf['k_at_a']}"{$_conf['k_accesskey_at'][0]}>{$_conf['k_accesskey_st'][0]}設定管理</a><br> {$rss_k_ht} <a href="tgrepc.php{$_conf['k_at_q']}">スレタイ検索</a><br> {$iv2_k_ht} </div> <hr> {$htm['auth_user']} {$htm['last_login']} </body> </html> EOP; }
if (preg_match('/^\\t?(.+?)\\t(.+?)\\t.+?$/', $l, $matches)) { $_host = $matches[1]; $_bbs = $matches[2]; $_id = $_host . '/' . $_bbs; $favitas[$_id] = array('host' => $_host, 'bbs' => $_bbs); } } P2HttpRequestPool::fetchSubjectTxt($favitas); } else { P2HttpRequestPool::fetchSubjectTxt($source); } // }}} // {{{ 後処理 // エラーメッセージの取得 if (P2Util::hasInfoHtml()) { $errmsg = str_replace("\n", PHP_EOL, P2Util::getInfoHtml()); } else { $errmsg = null; } // デバッグ用ログファイルに書き込む if (P2_FETCH_SUBJECT_TXT_DEBUG) { $debug_output = '====================' . PHP_EOL; $debug_output .= __FILE__ . PHP_EOL; $debug_output .= 'date: ' . date('Y-m-d H:i:s') . PHP_EOL; if (extension_loaded('posix')) { $debug_output .= sprintf('pid: %d%s', posix_getpid(), PHP_EOL); $debug_output .= sprintf('uid: %d%s', posix_getuid(), PHP_EOL); $debug_output .= sprintf('gid: %d%s', posix_getgid(), PHP_EOL); } else { $pid = @getmypid(); $debug_output .= sprintf('pid: %d%s', $pid === false ? -1 : $pid, PHP_EOL);