GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — p2-php/tgrepctl.php at master · thermon/p2-php Expand file tree/ Copy pathtgrepctl.phpMore file actions 121 lines (103 loc) · 2.94 KB / Copy pathtgrepctl.phpFile metadata and controls121 lines (103 loc) · 2.94 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 <?php /** * tGrep - スマートリストを操作 */ // {{{ p2基本設定読み込み&認証 require_once './conf/conf.inc.php'; $_login->authorize(); // }}} // {{{ 検索用のパラメータを消去 unset($_GET['Q'], $_GET['S'], $_GET['B'], $_GET['C'], $_GET['O'], $_GET['N'], $_GET['P']); // }}} // {{{ 編集するファイルを設定 if (isset($_GET['file'])) { switch ($_GET['file']) { case 'quick': $list_file = $_conf['expack.tgrep.quick_file']; $include_file = P2EX_LIB_DIR . '/tgrep/menu_quick.inc.php'; break; case 'recent': $list_file = $_conf['expack.tgrep.recent_file']; $include_file = P2EX_LIB_DIR . '/tgrep/menu_recent.inc.php'; break; default: if ($_conf['ktai']) { include P2_BASE_DIR . '/tgrepc.php'; } exit; } } else { if ($_conf['ktai']) { include P2_BASE_DIR . '/tgrepc.php'; } exit; } // }}} // {{{ リストを更新 if (!empty($_GET['query'])) { $purge = !empty($_GET['purge']); $query = preg_replace('/\\s+/', ' ', trim($_GET['query'])); FileCtl::make_datafile($list_file, $_conf['expack.tgrep.file_perm']); $tgrep_list = FileCtl::file_read_lines($list_file, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); if (!is_array($tgrep_list)) { $tgrep_list = array(); } if ($purge) { $tgrep_tmp_list = $tgrep_list; $tgrep_list = array(); foreach ($tgrep_tmp_list as $tgrep_tmp_query) { if ($tgrep_tmp_query != $query) { $tgrep_list[] = $tgrep_tmp_query; } } } else { array_unshift($tgrep_list, $query); } $tgrep_list = array_unique($tgrep_list); $tgrep_data = implode("\n", $tgrep_list) . "\n"; if (FileCtl::file_write_contents($list_file, $tgrep_data) === false) { p2die('cannot write file.'); } chmod($list_file, $_conf['p2_perm']); } elseif (!empty($_GET['clear']) && file_exists($list_file)) { $fp = @fopen($list_file, 'w'); if (!$fp) { p2die('cannot write file.'); } flock($fp, LOCK_EX); ftruncate($fp, 0); flock($fp, LOCK_UN); fclose($fp); chmod($list_file, $_conf['p2_perm']); } // }}} // {{{ 不要になった変数を解放 unset($_GET['clear'], $_GET['file'], $_GET['purge'], $_GET['query'], $purge, $query, $tgrep_list, $tgrep_data, $tgrep_tmp_list, $tgrep_tmp_query, $fp); // }}} // {{{ 出力 P2Util::header_nocache(); if ($_conf['ktai']) { include P2_BASE_DIR . '/tgrepc.php'; } else { header('Content-Type: text/html; charset=Shift_JIS'); define('TGREP_SMARTLIST_PRINT_ONLY_LINKS', 1); ob_start(); include $include_file; $buf = ob_get_clean(); if (P2Util::isBrowserSafariGroup()) { $buf = P2Util::encodeResponseTextForSafari($buf); } echo $buf; } // }}} /* * Local Variables: * mode: php * coding: cp932 * tab-width: 4 * c-basic-offset: 4 * indent-tabs-mode: nil * End: */ // vim: set syn=php fenc=cp932 ai et ts=4 sw=4 sts=4 fdm=marker: |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |