svnno****@sourc*****
svnno****@sourc*****
2010年 1月 10日 (日) 01:57:35 JST
Revision: 767 http://sourceforge.jp/projects/p2-php/svn/view?view=rev&revision=767 Author: rsk Date: 2010-01-10 01:57:35 +0900 (Sun, 10 Jan 2010) Log Message: ----------- expack: - ãªãã¡ã¯ã¿ãªã³ã°ãå®è¡ã -- conf/conf.inc.php ã®å¦çã®ä¸é¨ã lib/bootstrap.php ã«ç§»åã -- conf/conf.inc.php ã§ãã¼ãããã¦ããã¯ã©ã¹ãã¡ã¤ã«ã å¥ã®ç®æã§ããã¼ããã¦ããã®ãåé¤ã - æ¸ãè¾¼ã¿Cookieã®ä¿åãªã©ã«P2KeyValueStoreã使ãããã«ããã -- TODO: P2KeyValueStoreãç´æ¥ä½¿ã£ã¦ããç®æãã¯ã©ã¹ã«åãåºãã - æ¿ãã¨ã«ãBeã§æ¸ãè¾¼ãããå ¬å¼p2ã§æ¸ãè¾¼ãããè¨æ¶ããããã«ããã - host,bbs,key,lsã«HTMLã®ç¹æ®æåãå«ã¾ãã¦ããªãã 常ã«ãã§ãã¯ããããã«ããã - Login::$_user_u ã使ãã¹ãç®æ㧠Login::$_user ã使ã£ã¦ããã®ãä¿®æ£ã - iPhoneç¨ã¹ã¿ã¤ã«ã·ã¼ãã®typoãä¿®æ£ã Modified Paths: -------------- p2ex/trunk/conf/conf.inc.php p2ex/trunk/conf/conf_admin.inc.php p2ex/trunk/conf/ip_emobile.php p2ex/trunk/css/iphone.css p2ex/trunk/edit_user_font.php p2ex/trunk/info_js.php p2ex/trunk/lib/BbsMap.php p2ex/trunk/lib/BrdCtl.php p2ex/trunk/lib/BrdMenu.php p2ex/trunk/lib/HostCheck.php p2ex/trunk/lib/Login.php p2ex/trunk/lib/P2Client.php p2ex/trunk/lib/P2HttpExt.php p2ex/trunk/lib/P2Util.php p2ex/trunk/lib/PresetManager.php p2ex/trunk/lib/Thread.php p2ex/trunk/lib/ThreadRead.php p2ex/trunk/lib/dele.inc.php p2ex/trunk/lib/expack/fixed_name.inc.php p2ex/trunk/lib/expack/rss/common.inc.php p2ex/trunk/lib/expack/rss/parser.inc.php p2ex/trunk/lib/expack/rss/setrss.inc.php p2ex/trunk/lib/login2ch.inc.php p2ex/trunk/lib/post_form_options.inc.php p2ex/trunk/lib/read_footer.inc.php p2ex/trunk/lib/read_machibbs.inc.php p2ex/trunk/lib/read_new.inc.php p2ex/trunk/lib/read_res_hist.inc.php p2ex/trunk/lib/read_shitaraba.inc.php p2ex/trunk/lib/setbookmark.inc.php p2ex/trunk/lib/setfav.inc.php p2ex/trunk/lib/setfavita.inc.php p2ex/trunk/lib/setpalace.inc.php p2ex/trunk/lib/settaborn.inc.php p2ex/trunk/lib/settaborn_off.inc.php p2ex/trunk/lib/subject_new.inc.php p2ex/trunk/menu_i.php p2ex/trunk/post.php p2ex/trunk/post_form.php p2ex/trunk/read_filter_k.php p2ex/trunk/subject.php Added Paths: ----------- p2ex/trunk/lib/bootstrap.php -------------- next part -------------- Modified: p2ex/trunk/conf/conf.inc.php =================================================================== --- p2ex/trunk/conf/conf.inc.php 2010-01-05 14:48:56 UTC (rev 766) +++ p2ex/trunk/conf/conf.inc.php 2010-01-09 16:57:35 UTC (rev 767) @@ -74,956 +74,274 @@ global $_conf, $_info_msg_ht, $_login, $_p2session; global $conf_user_def, $conf_user_rules, $conf_user_rad, $conf_user_sel; -// G[oÍÝè -if (defined('E_DEPRECATED')) { - error_reporting(E_ALL & ~(E_NOTICE | E_STRICT | E_DEPRECATED)); -} else { - error_reporting(E_ALL & ~(E_NOTICE | E_STRICT)); -} - -// {{{ î{Ï - -$_conf['p2web_url'] = 'http://akid.s17.xrea.com/'; -$_conf['p2ime_url'] = 'http://akid.s17.xrea.com/p2ime.php'; -$_conf['favrank_url'] = 'http://akid.s17.xrea.com/favrank/favrank.php'; -$_conf['expack.web_url'] = 'http://page2.skr.jp/rep2/'; -$_conf['expack.download_url'] = 'http://page2.skr.jp/rep2/downloads.html'; -$_conf['expack.history_url'] = 'http://page2.skr.jp/rep2/history.html'; -$_conf['expack.tgrep_url'] = 'http://page2.xrea.jp/tgrep/search'; -$_conf['expack.ime_url'] = 'http://page2.skr.jp/gate.php'; -$_conf['menu_php'] = 'menu.php'; -$_conf['subject_php'] = 'subject.php'; -$_conf['read_php'] = 'read.php'; -$_conf['read_new_php'] = 'read_new.php'; -$_conf['read_new_k_php'] = 'read_new_k.php'; - -// }}} -// {{{ «Ýè - -// fobO -//$debug = !empty($_GET['debug']); - -putenv('LC_CTYPE=C'); - -// ^C][ðZbg -date_default_timezone_set('Asia/Tokyo'); - -// XNvgÀs§ÀÔ (b) -if (!defined('P2_CLI_RUN')) { - set_time_limit(60); // (60) -} - -// ©®tbV ðItÉ·é -ob_implicit_flush(0); - -// NCAg©çÚ±ðØçêÄàð±s·é -// ignore_user_abort(1); - -// file($filename, FILE_IGNORE_NEW_LINES) Å CR/LF/CR+LF Ì¢¸êàsƵĵ¤ -ini_set('auto_detect_line_endings', 1); - -// session.trans_sidLø â output_add_rewrite_var(), http_build_query() Ŷ¬EÏX³êé -// URLÌGETp[^æØè¶(ñ)ð"&"É·éBiftHgÍ"&"j -ini_set('arg_separator.output', '&'); - -// NGXgIDðÝè (RXgªå«¢ÉgÁĢȢÌÅp~) -//define('P2_REQUEST_ID', substr($_SERVER['REQUEST_METHOD'], 0, 1) . md5(serialize($_REQUEST))); - -// Windows Èç -if (strncasecmp(PHP_OS, 'WIN', 3) == 0) { - // Windows - defined('PATH_SEPARATOR') or define('PATH_SEPARATOR', ';'); - defined('DIRECTORY_SEPARATOR') or define('DIRECTORY_SEPARATOR', '\\'); - define('P2_OS_WINDOWS', 1); -} else { - defined('PATH_SEPARATOR') or define('PATH_SEPARATOR', ':'); - defined('DIRECTORY_SEPARATOR') or define('DIRECTORY_SEPARATOR', '/'); - define('P2_OS_WINDOWS', 0); -} - -// mbstring.script_encoding = SJIS-win ¾Æ "\0", "\x00" È~ªJbg³êéÌÅ -define('P2_NULLBYTE', chr(0)); - -// }}} -// {{{ P2Util::header_content_type() ðsvÉ·é¨Ü¶È¢ - -ini_set('default_mimetype', 'text/html'); -ini_set('default_charset', 'Shift_JIS'); - -// }}} -// {{{ CuÞÌpXÝè - -define('P2_CONF_DIR', dirname(__FILE__)); // __DIR__ @php-5.3 - -define('P2_BASE_DIR', dirname(P2_CONF_DIR)); - -// î{IÈ@\ðñ·é·éCu -define('P2_LIB_DIR', P2_BASE_DIR . DIRECTORY_SEPARATOR . 'lib'); - -// ¨Ü¯IÈ@\ðñ·é·éCu -define('P2EX_LIB_DIR', P2_BASE_DIR . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'expack'); - -// X^CV[g -define('P2_STYLE_DIR', P2_BASE_DIR . DIRECTORY_SEPARATOR . 'style'); - -// XL -define('P2_SKIN_DIR', P2_BASE_DIR . DIRECTORY_SEPARATOR . 'skin'); -define('P2_USER_SKIN_DIR', P2_BASE_DIR . DIRECTORY_SEPARATOR . 'user_skin'); - -// PEARCXg[fBNgAõpXÉÇÁ³êé -define('P2_PEAR_DIR', P2_BASE_DIR . DIRECTORY_SEPARATOR . 'includes'); - -// PEARðnbNµ½t@CpfBNgAÊíÌPEARæèDæIÉõpXÉÇÁ³êé -// Cache/Container/db.php(PEAR::Cache)ªMySQLè¾Á½ÌÅAÄpIɵ½àÌðu¢Ä¢é -// include_pathðÇÁ·éÌÍptH[}XÉe¿ðyÚ·½ßA{ÉKvÈêÌÝè` -if (defined('P2_USE_PEAR_HACK')) { - define('P2_PEAR_HACK_DIR', P2_BASE_DIR . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'pear_hack'); -} - -// R}hCc[ -define('P2_CLI_DIR', P2_BASE_DIR . DIRECTORY_SEPARATOR . 'cli'); - -// õpXðZbg -$include_path = ''; -if (defined('P2_PEAR_HACK_DIR')) { - $include_path .= P2_PEAR_HACK_DIR . PATH_SEPARATOR; -} -if (is_dir(P2_PEAR_DIR)) { - $include_path .= P2_PEAR_DIR . PATH_SEPARATOR; -} else { - $paths = array(); - foreach (explode(PATH_SEPARATOR, get_include_path()) as $dir) { - if (is_dir($dir)) { - $dir = realpath($dir); - if ($dir != P2_BASE_DIR) { - $paths[] = $dir; - } - } + // G[oÍÝè + if (defined('E_DEPRECATED')) { + error_reporting(E_ALL & ~(E_NOTICE | E_STRICT | E_DEPRECATED)); + } else { + error_reporting(E_ALL & ~(E_NOTICE | E_STRICT)); } - if (count($paths)) { - $include_path .= implode(PATH_SEPARATOR, array_unique($paths)) . PATH_SEPARATOR; - } -} -$include_path .= P2_BASE_DIR; // fallback -set_include_path($include_path); -$P2_CONF_DIR_S = P2_CONF_DIR . DIRECTORY_SEPARATOR; -$P2_LIB_DIR_S = P2_LIB_DIR . DIRECTORY_SEPARATOR; + // {{{ î{Ï -// }}} -// {{{ «`FbNÆfobO + $_conf['p2web_url'] = 'http://akid.s17.xrea.com/'; + $_conf['p2ime_url'] = 'http://akid.s17.xrea.com/p2ime.php'; + $_conf['favrank_url'] = 'http://akid.s17.xrea.com/favrank/favrank.php'; + $_conf['expack.web_url'] = 'http://page2.skr.jp/rep2/'; + $_conf['expack.download_url'] = 'http://page2.skr.jp/rep2/downloads.html'; + $_conf['expack.history_url'] = 'http://page2.skr.jp/rep2/history.html'; + $_conf['expack.tgrep_url'] = 'http://page2.xrea.jp/tgrep/search'; + $_conf['expack.ime_url'] = 'http://page2.skr.jp/gate.php'; + $_conf['menu_php'] = 'menu.php'; + $_conf['subject_php'] = 'subject.php'; + $_conf['read_php'] = 'read.php'; + $_conf['read_new_php'] = 'read_new.php'; + $_conf['read_new_k_php'] = 'read_new_k.php'; -// [eBeBðÇÝÞ -require_once $P2_LIB_DIR_S . 'DataPhp.php'; -require_once $P2_LIB_DIR_S . 'FileCtl.php'; -require_once $P2_LIB_DIR_S . 'P2Util.php'; -require_once $P2_LIB_DIR_S . 'p2util.inc.php'; + // }}} + // {{{ «Ýè -// ®ì«ðmF (vð½µÄ¢éÈçRgAEgÂ) -p2checkenv(__LINE__); + // fobO + //$debug = !empty($_GET['debug']); -if ($debug) { - if (!class_exists('Benchmark_Profiler', false)) { - require 'Benchmark/Profiler.php'; - } - $profiler = new Benchmark_Profiler(true); - // print_memory_usage(); - register_shutdown_function('print_memory_usage'); -} + putenv('LC_CTYPE=C'); -// }}} -// {{{ ¶R[hÌwè + // ^C][ðZbg + date_default_timezone_set('Asia/Tokyo'); -//mb_detect_order("CP932,CP51932,ASCII"); -mb_internal_encoding('CP932'); -mb_http_output('pass'); -mb_substitute_character(63); // ¶R[hϷɸsµ½¶ª "?" ÉÈé -//mb_substitute_character(0x3013); // ¬ -//ob_start('mb_output_handler'); - -if (function_exists('mb_ereg_replace')) { - define('P2_MBREGEX_AVAILABLE', 1); - mb_regex_encoding('CP932'); -} else { - define('P2_MBREGEX_AVAILABLE', 0); -} - -// }}} -// {{{ ÇÒpÝèetc. - -// ÇÒpÝèðÇÝÝ -require_once $P2_CONF_DIR_S . 'conf_admin.inc.php'; - -// fBNgÌâÎpX» -$_conf['data_dir'] = p2_realpath($_conf['data_dir']); -$_conf['dat_dir'] = p2_realpath($_conf['dat_dir']); -$_conf['idx_dir'] = p2_realpath($_conf['idx_dir']); -$_conf['pref_dir'] = p2_realpath($_conf['pref_dir']); - -// ÇpÛ¶fBNg -$_conf['admin_dir'] = $_conf['data_dir'] . DIRECTORY_SEPARATOR . 'admin'; - -// cache Û¶fBNg -// 2005/06/29 $_conf['pref_dir'] . '/p2_cache' æèÏX -$_conf['cache_dir'] = $_conf['data_dir'] . DIRECTORY_SEPARATOR . 'cache'; - -// Cookie Û¶fBNg -// 2008/09/09 $_conf['pref_dir'] . '/p2_cookie' æèÏX -$_conf['cookie_dir'] = $_conf['data_dir'] . DIRECTORY_SEPARATOR . 'cookie'; - -// RpC³ê½ev[gÌÛ¶fBNg -$_conf['compile_dir'] = $_conf['data_dir'] . DIRECTORY_SEPARATOR . 'compile'; - -// ZbVf[^Û¶fBNg -$_conf['session_dir'] = $_conf['data_dir'] . DIRECTORY_SEPARATOR . 'session'; - -// e|fBNg -$_conf['tmp_dir'] = $_conf['data_dir'] . DIRECTORY_SEPARATOR . 'tmp'; - -// o[WIDðñdøpâqAhL gàÉßÞ½ßÌÏ -$_conf['p2_version_id'] = P2_VERSION_ID; - -// ¶R[h©®»èpÌqg¶ñ -$_conf['detect_hint'] = ''; -$_conf['detect_hint_input_ht'] = '<input type="hidden" name="_hint" value="">'; -$_conf['detect_hint_input_xht'] = '<input type="hidden" name="_hint" value="" />'; -//$_conf['detect_hint_utf8'] = mb_convert_encoding('', 'UTF-8', 'CP932'); -$_conf['detect_hint_q'] = '_hint=%81%9D%81%9E'; // rawurlencode($_conf['detect_hint']) -$_conf['detect_hint_q_utf8'] = '_hint=%E2%97%8E%E2%97%87'; // rawurlencode($_conf['detect_hint_utf8']) - -// }}} -// {{{ ÏÝè - -$pref_dir_s = $_conf['pref_dir'] . DIRECTORY_SEPARATOR; - -$_conf['favita_brd'] = $pref_dir_s . 'p2_favita.brd'; // ¨CÉ (brd) -$_conf['favlist_idx'] = $pref_dir_s . 'p2_favlist.idx'; // ¨CÉX (idx) -$_conf['recent_idx'] = $pref_dir_s . 'p2_recent.idx'; // ÅßÇñ¾X (idx) -$_conf['palace_idx'] = $pref_dir_s . 'p2_palace.idx'; // XÌa° (idx) -$_conf['res_hist_idx'] = $pref_dir_s . 'p2_res_hist.idx'; // «ÝO (idx) -$_conf['res_hist_dat'] = $pref_dir_s . 'p2_res_hist.dat'; // «ÝOt@C (dat) -$_conf['res_hist_dat_php'] = $pref_dir_s . 'p2_res_hist.dat.php'; // «ÝOt@C (f[^PHP) -$_conf['idpw2ch_php'] = $pref_dir_s . 'p2_idpw2ch.php'; // 2ch IDFØÝèt@C (f[^PHP) -$_conf['sid2ch_php'] = $pref_dir_s . 'p2_sid2ch.php'; // 2ch IDFØZbVIDL^t@C (f[^PHP) -$_conf['auth_user_file'] = $pref_dir_s . 'p2_auth_user.php'; // FØ[UÝèt@C(f[^PHP) -$_conf['auth_imodeid_file'] = $pref_dir_s . 'p2_auth_imodeid.php'; // docomo i[hIDFØt@C (f[^PHP) -$_conf['auth_docomo_file'] = $pref_dir_s . 'p2_auth_docomo.php'; // docomo [»¢ÔFØt@C (f[^PHP) -$_conf['auth_ez_file'] = $pref_dir_s . 'p2_auth_ez.php'; // EZweb TuXNCoIDFØt@C (f[^PHP) -$_conf['auth_jp_file'] = $pref_dir_s . 'p2_auth_jp.php'; // SoftBank [VAÔFØt@C (f[^PHP) -$_conf['login_log_file'] = $pref_dir_s . 'p2_login.log.php'; // OCð (f[^PHP) -$_conf['login_failed_log_file'] = $pref_dir_s . 'p2_login_failed.dat.php'; // OC¸sð (f[^PHP) - -$_conf['matome_cache_path'] = $pref_dir_s . 'matome_cache'; -$_conf['matome_cache_ext'] = '.htm'; -$_conf['matome_cache_max'] = 3; // \õLbV Ì - -$_conf['orig_favita_brd'] = $_conf['favita_brd']; -$_conf['orig_favlist_idx'] = $_conf['favlist_idx']; - -$_conf['cookie_file_name'] = 'p2_cookie.txt'; - -// â³ -if ($_conf['expack.use_pecl_http'] && !extension_loaded('http')) { - if (!($_conf['expack.use_pecl_http'] == 2 && $_conf['expack.dl_pecl_http'])) { - $_conf['expack.use_pecl_http'] = 0; + // XNvgÀs§ÀÔ (b) + if (!defined('P2_CLI_RUN')) { + set_time_limit(60); // (60) } -} -// R}hC[hÅͱ±ÜÅ -if (defined('P2_CLI_RUN')) { - return; -} + // ©®tbV ðItÉ·é + ob_implicit_flush(0); -// }}} -// {{{ zXg`FbN + // NCAg©çÚ±ðØçêÄàð±s·é + // ignore_user_abort(1); -if ($_conf['secure']['auth_host'] || $_conf['secure']['auth_bbq']) { - require_once $P2_LIB_DIR_S . 'HostCheck.php'; - if (($_conf['secure']['auth_host'] && HostCheck::getHostAuth() == false) || - ($_conf['secure']['auth_bbq'] && HostCheck::getHostBurned() == true) - ) { - HostCheck::forbidden(); - } -} + // file($filename, FILE_IGNORE_NEW_LINES) Å CR/LF/CR+LF Ì¢¸êàsƵĵ¤ + ini_set('auto_detect_line_endings', 1); -// }}} -// {{{ NGXgÏÌ + // session.trans_sidLø â output_add_rewrite_var(), http_build_query() Ŷ¬EÏX³êé + // URLÌGETp[^æØè¶(ñ)ð"&"É·éBiftHgÍ"&"j + ini_set('arg_separator.output', '&'); -// VKOCÆo[OC̯wèÍ è¦È¢ÌÅAG[ðo· -if (isset($_POST['submit_new']) && isset($_POST['submit_member'])) { - p2die('³øÈURLÅ·B'); -} + // NGXgIDðÝè (RXgªå«¢ÉgÁĢȢÌÅp~) + //define('P2_REQUEST_ID', substr($_SERVER['REQUEST_METHOD'], 0, 1) . md5(serialize($_REQUEST))); -/** - * NGXgÏðêÅNH[g¶R[hÏ· - * - * ú{êðüÍ·éÂ\«Ì étH[ÉÍBµvfÅ - * GR[fBO»èp̶ñðdñÅ¢é - * - * $_COOKIE Í $_REQUEST ÉÜßÈ¢ - */ -if (!empty($_GET) || !empty($_POST)) { - if (isset($_REQUEST['_hint'])) { - // "CP932" Í "SJIS-win" ÌGCAXÅA"SJIS-win" Æ "SJIS" Íʨ - // "CP51932", "eucJP-win", "EUC-JP" Í»ê¼êʨ (libmbflIÈÓ¡Å) - $request_encoding = mb_detect_encoding($_REQUEST['_hint'], 'UTF-8,CP51932,CP932'); - if ($request_encoding == 'SJIS-win') { - $request_encoding = false; - } + // Windows Èç + if (strncasecmp(PHP_OS, 'WIN', 3) == 0) { + // Windows + defined('PATH_SEPARATOR') or define('PATH_SEPARATOR', ';'); + defined('DIRECTORY_SEPARATOR') or define('DIRECTORY_SEPARATOR', '\\'); + define('P2_OS_WINDOWS', 1); } else { - $request_encoding = 'UTF-8,CP51932,CP932'; + defined('PATH_SEPARATOR') or define('PATH_SEPARATOR', ':'); + defined('DIRECTORY_SEPARATOR') or define('DIRECTORY_SEPARATOR', '/'); + define('P2_OS_WINDOWS', 0); } - if (get_magic_quotes_gpc()) { - $_GET = array_map('stripslashes_r', $_GET); - $_POST = array_map('stripslashes_r', $_POST); - } + $DIR_SEP = DIRECTORY_SEPARATOR; + $PATH_SEP = PATH_SEPARATOR; - if ($request_encoding) { - mb_convert_variables('CP932', $request_encoding, $_GET, $_POST); - } + // mbstring.script_encoding = SJIS-win ¾Æ "\0", "\x00" È~ªJbg³êéÌÅ + define('P2_NULLBYTE', chr(0)); - if ($_SERVER['REQUEST_METHOD'] == 'POST') { - $_POST = array_map('nullfilter_r', $_POST); - if (count($_GET)) { - $_GET = array_map('nullfilter_r', $_GET); - $_REQUEST = array_merge($_GET, $_POST); - } else { - $_REQUEST = $_POST; - } - } else { - $_GET = array_map('nullfilter_r', $_GET); - $_REQUEST = $_GET; - } -} else { - $_REQUEST = array(); -} + // }}} + // {{{ P2Util::header_content_type() ðsvÉ·é¨Ü¶È¢ -// }}} -// {{{ [»è + ini_set('default_mimetype', 'text/html'); + ini_set('default_charset', 'Shift_JIS'); -require_once 'Net/UserAgent/Mobile.php'; + // }}} + // {{{ CuÞÌpXÝè -$_conf['ktai'] = false; -$_conf['iphone'] = false; -$_conf['input_type_search'] = false; + define('P2_CONF_DIR', dirname(__FILE__)); // __DIR__ @php-5.3 -$_conf['accesskey'] = 'accesskey'; -$_conf['accept_charset'] = 'Shift_JIS'; -$_conf['extra_headers_ht'] = ''; + define('P2_BASE_DIR', dirname(P2_CONF_DIR)); + $P2_BASE_DIR_S = P2_BASE_DIR . $DIR_SEP; -$support_cookies = true; + // î{IÈ@\ðñ·é·éCu + define('P2_LIB_DIR', $P2_BASE_DIR_S . 'lib'); -$mobile = Net_UserAgent_Mobile::singleton(); + // ¨Ü¯IÈ@\ðñ·é·éCu + define('P2EX_LIB_DIR', $P2_BASE_DIR_S . 'lib' . $DIR_SEP . 'expack'); -// iPhone, iPod Touch -if (P2Util::isBrowserIphone()) { - $_conf['ktai'] = true; - $_conf['iphone'] = true; - $_conf['input_type_search'] = true; - $_conf['accept_charset'] = 'UTF-8'; + // X^CV[g + define('P2_STYLE_DIR', $P2_BASE_DIR_S . 'style'); -// PC -} elseif ($mobile->isNonMobile()) { - // Safari - if (P2Util::isBrowserSafariGroup()) { - $_conf['input_type_search'] = true; - $_conf['accept_charset'] = 'UTF-8'; + // XL + define('P2_SKIN_DIR', $P2_BASE_DIR_S . 'skin'); + define('P2_USER_SKIN_DIR', $P2_BASE_DIR_S . 'user_skin'); - // Windows Mobile, gÑQ[@ - } elseif (P2Util::isClientOSWindowsCE() || P2Util::isBrowserNintendoDS() || P2Util::isBrowserPSP()) { - $_conf['ktai'] = true; - } + // PEARCXg[fBNgAõpXÉÇÁ³êé + define('P2_PEAR_DIR', P2_BASE_DIR . DIRECTORY_SEPARATOR . 'includes'); -// gÑ -} else { - $_conf['ktai'] = true; - - // NTT docomo i[h - if ($mobile->isDoCoMo()) { - $support_cookies = false; - - // au EZweb - //} elseif ($mobile->isEZweb()) { - // $support_cookies = true; - - // SoftBank Mobile - } elseif ($mobile->isSoftBank()) { - // 3GC^[Ínonumber®«ðT|[gµÈ¢ÌÅaccesskeyðg¤ - if (!$mobile->isType3GC()) { - $_conf['accesskey'] = 'DIRECTKEY'; - // 3GC^[ÆW^[ÈOÍCookieðT|[gµÈ¢ - if (!$mobile->isTypeW()) { - $support_cookies = false; - } - } - - // WILLCOM AIR-EDGE - //} elseif ($mobile->isWillcom()) { - // $support_cookies = true; - - // »Ì¼ - //} else { - // $support_cookies = true; + // PEARðnbNµ½t@CpfBNgAÊíÌPEARæèDæIÉõpXÉÇÁ³êé + // Cache/Container/db.php(PEAR::Cache)ªMySQLè¾Á½ÌÅAÄpIɵ½àÌðu¢Ä¢é + // include_pathðÇÁ·éÌÍptH[}XÉe¿ðyÚ·½ßA{ÉKvÈêÌÝè` + if (defined('P2_USE_PEAR_HACK')) { + define('P2_PEAR_HACK_DIR', $P2_BASE_DIR_S . 'lib' . $DIR_SEP . 'pear_hack'); } -} -// }}} -// {{{ NG[Éæé§r [wè + // R}hCc[ + define('P2_CLI_DIR', $P2_BASE_DIR_S . 'cli'); -// b=pc ÍܾN檮SÅÈ¢? -// b=i ÍCSSÅWebKitÌÆ©g£/æsÀvpeBð½pµÄ¢é - -$_conf['b'] = $_conf['client_type'] = ($_conf['iphone'] ? 'i' : ($_conf['ktai'] ? 'k' : 'pc')); -$_conf['view_forced_by_query'] = false; -$_conf['k_at_a'] = ''; -$_conf['k_at_q'] = ''; -$_conf['k_input_ht'] = ''; - -if (isset($_REQUEST['b'])) { - switch ($_REQUEST['b']) { - - // §PCr [wè - case 'pc': - if ($_conf['b'] != 'pc') { - $_conf['b'] = 'pc'; - $_conf['ktai'] = false; - $_conf['iphone'] = false; - } - break; - - // §iPhoner [wè - case 'i': - if ($_conf['b'] != 'i') { - $_conf['b'] = 'i'; - $_conf['ktai'] = true; - $_conf['iphone'] = true; - } - break; - - // §gÑr [wè - case 'k': - if ($_conf['b'] != 'k') { - $_conf['b'] = 'k'; - $_conf['ktai'] = true; - $_conf['iphone'] = false; - } - break; - - } // endswitch - - // §r [wè³êÄ¢½Èç - if ($_conf['b'] != $_conf['client_type']) { - $_conf['view_forced_by_query'] = true; - $_conf['k_at_a'] = '&b=' . $_conf['b']; - $_conf['k_at_q'] = '?b=' . $_conf['b']; - $_conf['k_input_ht'] = '<input type="hidden" name="b" value="' . $_conf['b'] . '">'; - //output_add_rewrite_var('b', $_conf['b']); + // õpXðZbg + $include_path = ''; + if (defined('P2_PEAR_HACK_DIR')) { + $include_path .= P2_PEAR_HACK_DIR . $PATH_SEP; } -} - -// }}} -// {{{ [UÝè Ç - -// [UÝèt@C -$_conf['conf_user_file'] = $_conf['pref_dir'] . '/conf_user.srd.cgi'; - -// `®t@CðRs[ -$conf_user_file_old = $_conf['pref_dir'] . '/conf_user.inc.php'; -if (!file_exists($_conf['conf_user_file']) && file_exists($conf_user_file_old)) { - $old_cont = DataPhp::getDataPhpCont($conf_user_file_old); - FileCtl::make_datafile($_conf['conf_user_file'], $_conf['conf_user_perm']); - if (FileCtl::file_write_contents($_conf['conf_user_file'], $old_cont) === false) { - $_info_msg_ht .= '<p>`®[UÝèÌRs[ɸsµÜµ½B</p>'; - } -} - -// [UÝèª êÎÇÝÞ -if (file_exists($_conf['conf_user_file'])) { - if ($cont = file_get_contents($_conf['conf_user_file'])) { - $conf_user = unserialize($cont); + if (is_dir(P2_PEAR_DIR)) { + $include_path .= P2_PEAR_DIR . $PATH_SEP; } else { - $conf_user = null; - } - - // ½ç©ÌRÅ[UÝèt@CªóêÄ¢½ç - if (!is_array($conf_user)) { - if (unlink($_conf['conf_user_file'])) { - $_info_msg_ht .= '<p>[UÝèt@CªóêÄ¢½ÌÅjüµÜµ½B</p>'; - } else { - $_info_msg_ht .= '<p>[UÝèt@CªóêĢܷªAjüūܹñŵ½B<br>"'; - $_info_msg_ht .= htmlspecialchars($_conf['conf_user_file'], ENT_QUOTES); - $_info_msg_ht .= '" ðè®ÅíµÄ¾³¢B</p>'; + $paths = array(); + foreach (explode($PATH_SEP, get_include_path()) as $dir) { + if (is_dir($dir)) { + $dir = realpath($dir); + if ($dir != P2_BASE_DIR) { + $paths[] = $dir; + } + } } - $conf_user = array(); - $conf_user_mtime = 0; - } else { - $conf_user_mtime = filemtime($_conf['conf_user_file']); - } - - // [UÝèt@CÆftHgÝèt@CÌXVúð`FbN - if (!isset($conf_user['.']) || - $conf_user['.'] != P2_VERSION_ID || - filemtime(__FILE__) > $conf_user_mtime || - filemtime($P2_CONF_DIR_S . 'conf_user_def.inc.php') > $conf_user_mtime || - filemtime($P2_CONF_DIR_S . 'conf_user_def_ex.inc.php') > $conf_user_mtime || - filemtime($P2_CONF_DIR_S . 'conf_user_def_i.inc.php') > $conf_user_mtime) - { - // ftHgÝèðÇÝÞ - require_once $P2_CONF_DIR_S . 'conf_user_def.inc.php'; - - // ÝèÌXV - if (!array_key_exists('mobile.link_youtube', $conf_user)) { - require_once $P2_LIB_DIR_S . 'conf_user_updater.inc.php'; - $conf_user = conf_user_update_080908($conf_user); + if (count($paths)) { + $include_path .= implode($PATH_SEP, array_unique($paths)) . $PATH_SEP; } - - $_conf = array_merge($_conf, $conf_user_def, $conf_user); - - // Vµ¢[UÝèðLbV - $conf_user = array('.' => P2_VERSION_ID); - foreach ($conf_user_def as $k => $v) { - $conf_user[$k] = $_conf[$k]; - } - if (FileCtl::file_write_contents($_conf['conf_user_file'], serialize($conf_user)) === false) { - $_info_msg_ht .= '<p>[UÝèÌLbV ɸsµÜµ½</p>'; - } - - // [UÝèt@CÌXVúÌûªVµ¢êÍAftHgÝèð³ - } else { - $_conf = array_merge($_conf, $conf_user); } + $include_path .= P2_BASE_DIR; // fallback + set_include_path($include_path); - unset($cont, $conf_user); -} else { - // ftHgÝèðÇÝÞ - require_once $P2_CONF_DIR_S . 'conf_user_def.inc.php'; - $_conf = array_merge($_conf, $conf_user_def); -} + $P2_CONF_DIR_S = P2_CONF_DIR . $DIR_SEP; + $P2_LIB_DIR_S = P2_LIB_DIR . $DIR_SEP; -// }}} -// {{{ [UÝè̲® + // }}} + // {{{ «`FbNÆfobO -$_conf['ext_win_target_at'] = ($_conf['ext_win_target']) ? " target=\"{$_conf['ext_win_target']}\"" : ''; -$_conf['bbs_win_target_at'] = ($_conf['bbs_win_target']) ? " target=\"{$_conf['bbs_win_target']}\"" : ''; + // [eBeBðÇÝÞ + include $P2_LIB_DIR_S . 'P2Util.php'; + include $P2_LIB_DIR_S . 'p2util.inc.php'; -if ($_conf['get_new_res']) { - if ($_conf['get_new_res'] == 'all') { - $_conf['get_new_res_l'] = $_conf['get_new_res']; - } else { - $_conf['get_new_res_l'] = 'l'.$_conf['get_new_res']; - } -} else { - $_conf['get_new_res_l'] = 'l200'; -} + // ®ì«ðmF (vð½µÄ¢éÈçRgAEgÂ) + p2checkenv(__LINE__); -if ($_conf['expack.user_agent']) { - ini_set('user_agent', $_conf['expack.user_agent']); -} - -// }}} -// {{{ fUCÝè Ç - -$skin_name = $default_skin_name = 'conf_user_style'; -$skin = $P2_CONF_DIR_S . 'conf_user_style.inc.php'; -if (!$_conf['ktai'] && $_conf['expack.skin.enabled']) { - // Û¶³êÄ¢éXL¼ - $saved_skin_name = null; - if (file_exists($_conf['expack.skin.setting_path'])) { - $saved_skin_name = rtrim(file_get_contents($_conf['expack.skin.setting_path'])); - if (!preg_match('/^[0-9A-Za-z_\\-]+$/', $saved_skin_name)) { - $saved_skin_name = null; + if ($debug) { + if (!class_exists('Benchmark_Profiler', false)) { + require 'Benchmark/Profiler.php'; } - } else { - FileCtl::make_datafile($_conf['expack.skin.setting_path'], $_conf['expack.skin.setting_perm']); + $profiler = new Benchmark_Profiler(true); + // print_memory_usage(); + register_shutdown_function('print_memory_usage'); } - // NGXgÅwè³ê½XL¼ - $new_skin_name = null; - if (array_key_exists('skin', $_REQUEST) && is_string($_REQUEST['skin'])) { - $new_skin_name = $_REQUEST['skin']; - if (!preg_match('/^[0-9A-Za-z_\\-]+$/', $new_skin_name)) { - $new_skin_name = null; - } elseif ($new_skin_name != $saved_skin_name) { - FileCtl::file_write_contents($_conf['expack.skin.setting_path'], $new_skin_name); - } - } + // }}} + // {{{ ¶R[hÌwè - // NGXgÅwè³ê½êXL¼ - $tmp_skin_name = null; - if (array_key_exists('tmp_skin', $_REQUEST) && is_string($_REQUEST['tmp_skin'])) { - $tmp_skin_name = $_REQUEST['tmp_skin']; - if (!preg_match('/^[0-9A-Za-z_\\-]+$/', $tmp_skin_name)) { - $tmp_skin_name = null; - } - } + //mb_detect_order("CP932,CP51932,ASCII"); + mb_internal_encoding('CP932'); + mb_http_output('pass'); + mb_substitute_character(63); // ¶R[hϷɸsµ½¶ª "?" ÉÈé + //mb_substitute_character(0x3013); // ¬ + //ob_start('mb_output_handler'); - // XLõ - foreach (array($tmp_skin_name, $new_skin_name, $saved_skin_name, $default_skin_name) as $skin_name) { - if ($skin_name !== null) { - if ($skin_name == $default_skin_name) { - break; - } - $user_skin_path = P2_USER_SKIN_DIR . DIRECTORY_SEPARATOR . $skin_name . '.php'; - if (file_exists($user_skin_path)) { - $skin = $user_skin_path; - break; - } - $bundled_skin_path = P2_SKIN_DIR . DIRECTORY_SEPARATOR . $skin_name . '.php'; - if (file_exists($bundled_skin_path)) { - $skin = $bundled_skin_path; - break; - } - } + if (function_exists('mb_ereg_replace')) { + define('P2_MBREGEX_AVAILABLE', 1); + mb_regex_encoding('CP932'); + } else { + define('P2_MBREGEX_AVAILABLE', 0); } -} -if (!file_exists($skin)) { - $skin_name = 'conf_user_style'; - $skin = $P2_CONF_DIR_S . 'conf_user_style.inc.php'; -} -$skin_en = rawurlencode($skin_name) . '&_=' . P2_VERSION_ID; -if ($_conf['view_forced_by_query']) { - $skin_en .= $_conf['k_at_a']; -} + // }}} + // {{{ ÇÒpÝèetc. -// ftHgÝèðÇÝñÅ -include $P2_CONF_DIR_S . 'conf_user_style.inc.php'; -// XLÅã« -if ($skin != $P2_CONF_DIR_S . 'conf_user_style.inc.php') { - include $skin; -} + // ÇÒpÝèðÇÝÝ + include $P2_CONF_DIR_S . 'conf_admin.inc.php'; -// }}} -// {{{ fUCÝè̲® + // fBNgÌâÎpX» + $_conf['data_dir'] = p2_realpath($_conf['data_dir']); + $_conf['dat_dir'] = p2_realpath($_conf['dat_dir']); + $_conf['idx_dir'] = p2_realpath($_conf['idx_dir']); + $_conf['pref_dir'] = p2_realpath($_conf['pref_dir']); -$skin_uniq = P2_VERSION_ID; + // ÇpÛ¶fBNg + $_conf['admin_dir'] = $_conf['data_dir'] . $DIR_SEP . 'admin'; -foreach ($STYLE as $K => $V) { - if (empty($V)) { - $STYLE[$K] = ''; - } elseif (strpos($K, 'fontfamily') !== false) { - $STYLE[$K] = p2_correct_css_fontfamily($V); - } elseif (strpos($K, 'color') !== false) { - $STYLE[$K] = p2_correct_css_color($V); - } elseif (strpos($K, 'background') !== false) { - $STYLE[$K] = "url('" . p2_escape_css_url($V) . "')"; - } -} + // cache Û¶fBNg + // 2005/06/29 $_conf['pref_dir'] . '/p2_cache' æèÏX + $_conf['cache_dir'] = $_conf['data_dir'] . $DIR_SEP . 'cache'; -if (!$_conf['ktai']) { - require_once $P2_LIB_DIR_S . 'fontconfig.inc.php'; + // Cookie Û¶fBNg + // 2008/09/09 $_conf['pref_dir'] . '/p2_cookie' æèÏX + $_conf['cookie_dir'] = $_conf['data_dir'] . $DIR_SEP . 'cookie'; - if ($_conf['expack.am.enabled']) { - $_conf['expack.am.fontfamily'] = p2_correct_css_fontfamily($_conf['expack.am.fontfamily']); - if ($STYLE['fontfamily']) { - $_conf['expack.am.fontfamily'] .= '","' . $STYLE['fontfamily']; - } - } + // RpC³ê½ev[gÌÛ¶fBNg + $_conf['compile_dir'] = $_conf['data_dir'] . $DIR_SEP . 'compile'; - fontconfig_apply_custom(); -} + // ZbVf[^Û¶fBNg + $_conf['session_dir'] = $_conf['data_dir'] . $DIR_SEP . 'session'; -// }}} -// {{{ gÑEiPhonepÏ + // e|fBNg + $_conf['tmp_dir'] = $_conf['data_dir'] . $DIR_SEP . 'tmp'; -// iPhonepHTMLwb_vf -if ($_conf['client_type'] == 'i') { - switch ($_conf['b']) { + // o[WIDðñdøpâqAhL gàÉßÞ½ßÌÏ + $_conf['p2_version_id'] = P2_VERSION_ID; - // §PCr [ - case 'pc': - $_conf['extra_headers_ht'] .= <<<EOS -<meta name="format-detection" content="telephone=no"> -<link rel="apple-touch-icon" type="image/png" href="img/touch-icon/p2-serif.png"> -<style type="text/css">body { -webkit-text-size-adjust: none; }</style> -EOS; - break; + // ¶R[h©®»èpÌqg¶ñ + $_conf['detect_hint'] = ''; + $_conf['detect_hint_input_ht'] = '<input type="hidden" name="_hint" value="">'; + $_conf['detect_hint_input_xht'] = '<input type="hidden" name="_hint" value="" />'; + //$_conf['detect_hint_utf8'] = mb_convert_encoding('', 'UTF-8', 'CP932'); + $_conf['detect_hint_q'] = '_hint=%81%9D%81%9E'; // rawurlencode($_conf['detect_hint']) + $_conf['detect_hint_q_utf8'] = '_hint=%E2%97%8E%E2%97%87'; // rawurlencode($_conf['detect_hint_utf8']) - // §gÑr [ - case 'k': - $_conf['extra_headers_ht'] .= <<<EOS -<meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=yes"> -<meta name="format-detection" content="telephone=no"> -<link rel="apple-touch-icon" type="image/png" href="img/touch-icon/p2-serif.png"> -<style type="text/css"> -body { word-break: normal; word-break: break-all; -webkit-text-size-adjust: none; } -* { font-family: sans-serif; font-size: medium; line-height: 150%; } -h1 { font-size: xx-large; } -h2 { font-size: x-large; } -h3 { font-size: large; } -</style> -EOS; - break; + // }}} + // {{{ ÏÝè - // ³iPhoner [ - case 'i': - default: - $_conf['extra_headers_ht'] .= <<<EOS -<meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=yes"> -<meta name="format-detection" content="telephone=no"> -<link rel="apple-touch-icon" type="image/png" href="img/touch-icon/p2-serif.png"> -<link rel="stylesheet" type="text/css" media="screen" href="css/iphone.css?{$_conf['p2_version_id']}"> -<script type="text/javascript" src="js/iphone.js?{$_conf['p2_version_id']}"></script> -EOS; + $pref_dir_s = $_conf['pref_dir'] . $DIR_SEP; - } // endswitch + $_conf['favita_brd'] = $pref_dir_s . 'p2_favita.brd'; // ¨CÉ (brd) + $_conf['favlist_idx'] = $pref_dir_s . 'p2_favlist.idx'; // ¨CÉX (idx) + $_conf['recent_idx'] = $pref_dir_s . 'p2_recent.idx'; // ÅßÇñ¾X (idx) + $_conf['palace_idx'] = $pref_dir_s . 'p2_palace.idx'; // XÌa° (idx) + $_conf['res_hist_idx'] = $pref_dir_s . 'p2_res_hist.idx'; // «ÝO (idx) + $_conf['res_hist_dat'] = $pref_dir_s . 'p2_res_hist.dat'; // «ÝOt@C (dat) + $_conf['res_hist_dat_php'] = $pref_dir_s . 'p2_res_hist.dat.php'; // «ÝOt@C (f[^PHP) + $_conf['idpw2ch_php'] = $pref_dir_s . 'p2_idpw2ch.php'; // 2ch IDFØÝèt@C (f[^PHP) + $_conf['sid2ch_php'] = $pref_dir_s . 'p2_sid2ch.php'; // 2ch IDFØZbVIDL^t@C (f[^PHP) + $_conf['auth_user_file'] = $pref_dir_s . 'p2_auth_user.php'; // FØ[UÝèt@C(f[^PHP) + $_conf['auth_imodeid_file'] = $pref_dir_s . 'p2_auth_imodeid.php'; // docomo i[hIDFØt@C (f[^PHP) + $_conf['auth_docomo_file'] = $pref_dir_s . 'p2_auth_docomo.php'; // docomo [»¢ÔFØt@C (f[^PHP) + $_conf['auth_ez_file'] = $pref_dir_s . 'p2_auth_ez.php'; // EZweb TuXNCoIDFØt@C (f[^PHP) + $_conf['auth_jp_file'] = $pref_dir_s . 'p2_auth_jp.php'; // SoftBank [VAÔFØt@C (f[^PHP) + $_conf['login_log_file'] = $pref_dir_s . 'p2_login.log.php'; // OCð (f[^PHP) + $_conf['login_failed_log_file'] = $pref_dir_s . 'p2_login_failed.dat.php'; // OC¸sð (f[^PHP) -// §iPhoner [ -} elseif ($_conf['iphone']) { - $_conf['extra_headers_ht'] .= <<<EOS -<link rel="stylesheet" type="text/css" media="screen" href="css/iphone.css?{$_conf['p2_version_id']}"> -<script type="text/javascript" src="js/iphone.js?{$_conf['p2_version_id']}"></script> -EOS; -} + $_conf['matome_cache_path'] = $pref_dir_s . 'matome_cache'; + $_conf['matome_cache_ext'] = '.htm'; + $_conf['matome_cache_max'] = 3; // \õLbV Ì -// iPhonepXL -if ($_conf['iphone'] && isset($_conf['expack.iphone.skin'])) { - if (strpos($_conf['expack.iphone.skin'], DIRECTORY_SEPARATOR) === false) { - $iskin = 'skin/iphone/' . $iskin . '.css'; - if (file_exists($iskin)) { - $iskin_mtime = filemtime($iskin); - $_conf['extra_headers_ht'] .= <<<EOS -<link rel="stylesheet" type="text/css" media="screen" href="{$iskin}?{$iskin_mtime}"> -EOS; - } - } -} + $_conf['orig_favita_brd'] = $_conf['favita_brd']; + $_conf['orig_favlist_idx'] = $_conf['favlist_idx']; -// gÑpugbvÉßévNÆaccesskey -if ($_conf['ktai']) { - // iPhone - if ($_conf['iphone']) { - $_conf['k_accesskey_at'] = array_fill(0, 10, ''); - $_conf['k_accesskey_at']['*'] = ''; - $_conf['k_accesskey_at']['#'] = ''; - foreach ($_conf['k_accesskey'] as $name => $key) { - $_conf['k_accesskey_at'][$name] = ''; - } + $_conf['cookie_file_path'] = $_conf['cookie_dir'] . $DIR_SEP . 'p2_cookies.sqlite3'; - $_conf['k_accesskey_st'] = $_conf['k_accesskey_at']; - - $_conf['k_to_index_ht'] = <<<EOP -<a href="index.php{$_conf['k_at_q']}" class="button">TOP</a> -EOP; - - // »Ì¼ - } else { - // SoftBank Mobile - if ($_conf['accesskey'] == 'DIRECTKEY') { - $_conf['k_accesskey_at'] = array( - '0' => ' directkey="0" nonumber', - '1' => ' directkey="1" nonumber', - '2' => ' directkey="2" nonumber', - '3' => ' directkey="3" nonumber', - '4' => ' directkey="4" nonumber', - '5' => ' directkey="5" nonumber', - '6' => ' directkey="6" nonumber', - '7' => ' directkey="7" nonumber', - '8' => ' directkey="8" nonumber', - '9' => ' directkey="9" nonumber', - '*' => ' directkey="*" nonumber', - '#' => ' directkey="#" nonumber', - ); - - // »Ì¼ - } else { - $_conf['k_accesskey_at'] = array( - '0' => ' accesskey="0"', - '1' => ' accesskey="1"', - '2' => ' accesskey="2"', - '3' => ' accesskey="3"', - '4' => ' accesskey="4"', - '5' => ' accesskey="5"', - '6' => ' accesskey="6"', - '7' => ' accesskey="7"', - '8' => ' accesskey="8"', - '9' => ' accesskey="9"', - '*' => ' accesskey="*"', - '#' => ' accesskey="#"', - ); + // â³ + if ($_conf['expack.use_pecl_http'] && !extension_loaded('http')) { + if (!($_conf['expack.use_pecl_http'] == 2 && $_conf['expack.dl_pecl_http'])) { + $_conf['expack.use_pecl_http'] = 0; } - - switch ($_conf['mobile.display_accesskey']) { - case 2: - require_once $P2_LIB_DIR_S . 'emoji.inc.php'; - $emoji = p2_get_emoji($mobile); - //$emoji = p2_get_emoji(Net_UserAgent_Mobile::factory('KDDI-SA31 UP.Browser/6.2.0.7.3.129 (GUI) MMP/2.0')); - $_conf['k_accesskey_st'] = array( - '0' => $emoji[0], - '1' => $emoji[1], - '2' => $emoji[2], - '3' => $emoji[3], - '4' => $emoji[4], - '5' => $emoji[5], - '6' => $emoji[6], - '7' => $emoji[7], - '8' => $emoji[8], - '9' => $emoji[9], - '*' => $emoji['*'], - '#' => $emoji['#'], - ); - break; - case 0: - $_conf['k_accesskey_st'] = array_fill(0, 10, ''); - $_conf['k_accesskey_st']['*'] = ''; - $_conf['k_accesskey_st']['#'] = ''; - break; - case 1: - default: - $_conf['k_accesskey_st'] = array( - 0 => '0.', 1 => '1.', 2 => '2.', 3 => '3.', 4 => '4.', - 5 => '5.', 6 => '6.', 7 => '7.', 8 => '8.', 9 => '9.', - '*' => '*.', '#' => '#.' - ); - } - - foreach ($_conf['k_accesskey'] as $name => $key) { - $_conf['k_accesskey_at'][$name] = $_conf['k_accesskey_at'][$key]; - $_conf['k_accesskey_st'][$name] = $_conf['k_accesskey_st'][$key]; - } - - $_conf['k_to_index_ht'] = <<<EOP -<a href="index.php{$_conf['k_at_q']}"{$_conf['k_accesskey_at'][0]}>{$_conf['k_accesskey_st'][0]}TOP</a> -EOP; } -} -// }}} -// {{{ gÑpJ[O̲® - -$_conf['k_colors'] = ''; - -if ($_conf['ktai']) { - // î{F - if (!$_conf['iphone']) { - if ($_conf['mobile.background_color']) { - $_conf['k_colors'] .= ' bgcolor="' . htmlspecialchars($_conf['mobile.background_color']) . '"'; - } - if ($_conf['mobile.text_color']) { - $_conf['k_colors'] .= ' text="' . htmlspecialchars($_conf['mobile.text_color']) . '"'; - } - if ($_conf['mobile.link_color']) { - $_conf['k_colors'] .= ' link="' . htmlspecialchars($_conf['mobile.link_color']) . '"'; - } - if ($_conf['mobile.vlink_color']) { - $_conf['k_colors'] .= ' vlink="' . htmlspecialchars($_conf['mobile.vlink_color']) . '"'; - } + // R}hC[hÅͱ±ÜÅ + if (defined('P2_CLI_RUN')) { + return; } - // ¶F - if ($_conf['mobile.newthre_color']) { - $STYLE['mobile_subject_newthre_color'] = htmlspecialchars($_conf['mobile.newthre_color']); - } - if ($_conf['mobile.newres_color']) { - $STYLE['mobile_read_newres_color'] = htmlspecialchars($_conf['mobile.newres_color']); - $STYLE['mobile_subject_newres_color'] = htmlspecialchars($_conf['mobile.newres_color']); - } - if ($_conf['mobile.ttitle_color']) { - $STYLE['mobile_read_ttitle_color'] = htmlspecialchars($_conf['mobile.ttitle_color']); - } - if ($_conf['mobile.ngword_color']) { - $STYLE['mobile_read_ngword_color'] = htmlspecialchars($_conf['mobile.ngword_color']); - } - if ($_conf['mobile.onthefly_color']) { - $STYLE['mobile_read_onthefly_color'] = htmlspecialchars($_conf['mobile.onthefly_color']); - } + // }}} - // }[J[ - if ($_conf['mobile.match_color']) { - if ($_conf['iphone']) { - $_conf['extra_headers_ht'] .= sprintf('<style type="text/css">b.filtering, span.matched { color: %s; }</style>', - htmlspecialchars($_conf['mobile.match_color'])); - $_conf['k_filter_marker'] = '<span class="matched">\\1</span>'; - } else { - $_conf['k_filter_marker'] = '<font color="' . htmlspecialchars($_conf['mobile.match_color']) . '">\\1</font>'; - } - } else { - $_conf['k_filter_marker'] = false; - } + include $P2_LIB_DIR_S . 'bootstrap.php'; } // }}} -// {{{ ZbV - -// ¼OÍAZbVNbL[ðjü·éƫ̽ßÉAZbVpÌL³ÉÖíç¸Ýè·é -session_name('PS'); - -$_conf['sid_at_a'] = ''; - -require_once $P2_LIB_DIR_S . 'Session.php'; - -// {{{ ZbVf[^Û¶fBNgð`FbN - -if ($_conf['session_save'] == 'p2' and session_module_name() == 'files') { - if (!is_dir($_conf['session_dir'])) { - FileCtl::mkdir_r($_conf['session_dir']); - } elseif (!is_writable($_conf['session_dir'])) { - p2die("ZbVf[^Û¶fBNg ({$_conf['session_dir']}) É«Ý Àª èܹñB"); - } - - session_save_path($_conf['session_dir']); -} - -// }}} - -$_p2session = new Session(null, null, $support_cookies); - -// }}} -// {{{ ¨CÉZbg - -// ¡Ì¨CÉZbgðg¤Æ« -if ($_conf['expack.misc.multi_favs']) { - if (!class_exists('FavSetManager', false)) { - include $P2_LIB_DIR_S . 'FavSetManager.php'; - } - // ØèÖ¦\¦pÉSĄ̈CÉXE¨CÉÂðÇÝñŨ - FavSetManager::loadAllFavSet(); - // ¨CÉZbgðØèÖ¦é - FavSetManager::switchFavSet(); -} else { - $_conf['m_favlist_set'] = $_conf['m_favlist_set_at_a'] = $_conf['m_favlist_set_input_ht'] = ''; - $_conf['m_favita_set'] = $_conf['m_favita_set_at_a'] = $_conf['m_favita_set_input_ht'] = ''; - $_conf['m_rss_set'] = $_conf['m_rss_set_at_a'] = $_conf['m_rss_set_input_ht'] = ''; -} - -// }}} -// {{{ misc. - -// DOCTYPE HTML é¾ -$_conf['doctype'] = ''; -$ie_strict = false; -if (!$_conf['ktai'] || $_conf['client_type'] != 'k') { - if ($ie_strict || strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') === false) { - $_conf['doctype'] = <<<EODOC -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd">\n -EODOC; - } else { - $_conf['doctype'] = <<<EODOC -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">\n -EODOC; - } -} - -// XHTMLwb_vf -if (defined('P2_OUTPUT_XHTML')) { - $_conf['extra_headers_xht'] = preg_replace('/<((?:link|meta) .+?)>/', '<\\1 />', $_conf['extra_headers_ht']); -} - -// OCNXÌCX^X¶¬iOC[Uªwè³êĢȯêÎA±Ì_ÅOCtH[\¦Éj -require_once $P2_LIB_DIR_S . 'Login.php'; -$_login = new Login(); - -// ¨Ü¶È¢ -//$a = ceil(1/2); -//$b = floor(1/3); -//$c = round(1/4, 1); - -// }}} -} - -// }}} // {{{ p2checkenv() /** @@ -1039,6 +357,19 @@ $required_version = '5.2.8'; $recommended_version52 = '5.2.12'; $recommended_version53 = '5.3.1'; + $required_extensions = array( + 'dom', + 'json', + 'libxml', + 'mbstring', + 'pcre', + 'pdo', + 'pdo_sqlite', + 'session', + 'spl', + //'xsl', + 'zlib', + ); // PHPÌo[W if (version_compare($php_version, $required_version, '<')) { @@ -1046,7 +377,7 @@ } // K{g£W [ - foreach (array('json', 'mbstring', 'pcre', 'pdo', 'pdo_sqlite', 'session', 'zlib') as $ext) { + foreach ($required_extensions as $ext) { if (!extension_loaded($ext)) { p2die("{$ext} g£W [ª[h³êĢܹñB"); } @@ -1067,7 +398,9 @@ } // eAccelerator - if (extension_loaded('eaccelerator') && version_compare(EACCELERATOR_VERSION, '0.9.5.2', '<')) { + if (extension_loaded('eaccelerator') && + version_compare(EACCELERATOR_VERSION, '0.9.5.2', '<')) + { $err = 'eAcceleratorðXVµÄ¾³¢B'; $ev = EACCELERATOR_VERSION; $msg = <<<EOP @@ -1103,21 +436,7 @@ } // }}} -// {{{ __autoload() -/** - * PEARÅæ2øðfalseɹ¸Éclass_exists()ðÇñÅ¢éÂ\«ª éÌÅ - * __autoload()ðg¤ÌÍ|¢ - */ -/*function __autoload($name) -{ - if (preg_match('/^[A-Za-z_][0-9A-Za-z_]*$/', $name)) { - require_once str_replace('_', DIRECTORY_SEPARATOR, $name) . '.php'; - } -}*/ - -// }}} - /* * Local Variables: * mode: php Modified: p2ex/trunk/conf/conf_admin.inc.php =================================================================== --- p2ex/trunk/conf/conf_admin.inc.php 2010-01-05 14:48:56 UTC (rev 766) +++ p2ex/trunk/conf/conf_admin.inc.php 2010-01-09 16:57:35 UTC (rev 767) @@ -135,7 +135,7 @@ // ---------------------------------------------------------------------- // {{{ g£pbN -require_once P2_CONF_DIR . '/conf_admin_ex.inc.php'; +include P2_CONF_DIR . '/conf_admin_ex.inc.php'; // }}} Modified: p2ex/trunk/conf/ip_emobile.php =================================================================== --- p2ex/trunk/conf/ip_emobile.php 2010-01-05 14:48:56 UTC (rev 766) +++ p2ex/trunk/conf/ip_emobile.php 2010-01-09 16:57:35 UTC (rev 767) @@ -10,12 +10,14 @@ * @link http://whois.nic.ad.jp/cgi-bin/whois_gw */ -$host = '/\\.pool\\.e(?:mnet|-?mobile)\\.ne\\.jp$/'; +$host = '/\\.pool\\.e(?:mnet|-mobile)\\.ne\\.jp$/'; $band = array( '60.254.192.0/18', // JPNIC Whois Gateway + '114.48.0.0/14', // JPNIC Whois Gateway '117.55.0.0/17', // JPNIC Whois Gateway //'117.55.1.224/27', // http://developer.emnet.ne.jp/ipaddress.html + '119.72.0.0/16', // JPNIC Whois Gateway ); /* Modified: p2ex/trunk/css/iphone.css =================================================================== --- p2ex/trunk/css/iphone.css 2010-01-05 14:48:56 UTC (rev 766) +++ p2ex/trunk/css/iphone.css 2010-01-09 16:57:35 UTC (rev 767) @@ -223,7 +223,7 @@ div.res.aborned { margin: 0; padding: 0; - fonr-size: xx-small; + font-size: xx-small; line-height: 100%; } Modified: p2ex/trunk/edit_user_font.php =================================================================== --- p2ex/trunk/edit_user_font.php 2010-01-05 14:48:56 UTC (rev 766) +++ p2ex/trunk/edit_user_font.php 2010-01-09 16:57:35 UTC (rev 767) @@ -48,7 +48,6 @@ $current_fontconfig = array('enabled' => false, 'custom' => array()); } } else { - require_once P2_LIB_DIR . '/FileCtl.php'; FileCtl::make_datafile($_conf['expack.skin.fontconfig_path'], $_conf['expack.skin.fontconfig_perm']); $current_fontconfig = array('enabled' => false, 'custom' => array()); } Modified: p2ex/trunk/info_js.php =================================================================== --- p2ex/trunk/info_js.php 2010-01-05 14:48:56 UTC (rev 766) +++ p2ex/trunk/info_js.php 2010-01-09 16:57:35 UTC (rev 767) @@ -4,7 +4,6 @@ */ require_once './conf/conf.inc.php'; -require_once P2_LIB_DIR . '/P2Util.php'; require_once P2_LIB_DIR . '/Thread.php'; $_login->authorize(); // [UFØ Modified: p2ex/trunk/lib/BbsMap.php =================================================================== --- p2ex/trunk/lib/BbsMap.php 2010-01-05 14:48:56 UTC (rev 766) +++ p2ex/trunk/lib/BbsMap.php 2010-01-09 16:57:35 UTC (rev 767) @@ -1,6 +1,4 @@ <?php -require_once P2_LIB_DIR . '/P2Util.php'; -require_once P2_LIB_DIR . '/FileCtl.php'; // {{{ BbsMap Modified: p2ex/trunk/lib/BrdCtl.php =================================================================== --- p2ex/trunk/lib/BrdCtl.php 2010-01-05 14:48:56 UTC (rev 766) +++ p2ex/trunk/lib/BrdCtl.php 2010-01-09 16:57:35 UTC (rev 767) @@ -1,6 +1,5 @@ <?php -require_once P2_LIB_DIR . '/FileCtl.php'; require_once P2_LIB_DIR . '/BrdMenu.php'; // {{{ BrdCtl Modified: p2ex/trunk/lib/BrdMenu.php =================================================================== --- p2ex/trunk/lib/BrdMenu.php 2010-01-05 14:48:56 UTC (rev 766) +++ p2ex/trunk/lib/BrdMenu.php 2010-01-09 16:57:35 UTC (rev 767) @@ -1,7 +1,5 @@ <?php -require_once P2_LIB_DIR . '/FileCtl.php'; - // {{{ BrdMenu /** Modified: p2ex/trunk/lib/HostCheck.php =================================================================== --- p2ex/trunk/lib/HostCheck.php 2010-01-05 14:48:56 UTC (rev 766) +++ p2ex/trunk/lib/HostCheck.php 2010-01-09 16:57:35 UTC (rev 767) @@ -2,7 +2,6 @@ // ANZX³zXgð`FbN·éÖQNX require_once P2_CONF_DIR . '/conf_hostcheck.php'; -require_once P2_LIB_DIR . '/FileCtl.php'; require_once P2_LIB_DIR . '/P2KeyValueStore.php'; // {{{ HostCheck Modified: p2ex/trunk/lib/Login.php =================================================================== --- p2ex/trunk/lib/Login.php 2010-01-05 14:48:56 UTC (rev 766) +++ p2ex/trunk/lib/Login.php 2010-01-09 16:57:35 UTC (rev 767) @@ -1,6 +1,5 @@ <?php -require_once P2_LIB_DIR . '/FileCtl.php'; require_once P2_LIB_DIR . '/Session.php'; // {{{ Login Modified: p2ex/trunk/lib/P2Client.php =================================================================== --- p2ex/trunk/lib/P2Client.php 2010-01-05 14:48:56 UTC (rev 766) +++ p2ex/trunk/lib/P2Client.php 2010-01-09 16:57:35 UTC (rev 767) @@ -15,7 +15,7 @@ /** * CookieðÛ¶·éSQLite3f[^x[XÌt@C¼ */ - const COOKIE_STORE_NAME = 'p2_2ch_net_cookie.sq3'; + const COOKIE_STORE_NAME = 'p2_2ch_net_cookies.sqlite3'; /** * ö®P2ÌURIÆeGg|Cg @@ -53,6 +53,7 @@ * HTTPNGXgÌÅèp[^ */ const REQUEST_DATA_CHARACTER_SET_DETECTION_HINT = ''; + const REQUEST_DATA_LS_LAST1_NO_FIRST = 'l1n'; /** * ÇÝݳۻè̽ß̶ñ @@ -135,6 +136,7 @@ if ($cookieManager = $cookieStore->get($loginId)) { if (!$cookieManager instanceof HTTP_Client_CookieManager) { + $cookieStore->delete($loginId); throw new Exception('Cannot restore the cookie manager.'); } } else { @@ -236,12 +238,7 @@ */ public function readThread($host, $bbs, $key, $ls = '1', &$response = null) { - $getData = array( - self::REQUEST_PARAMETER_HOST => rawurlencode($host), - self::REQUEST_PARAMETER_BBS => rawurlencode($bbs), - self::REQUEST_PARAMETER_KEY => rawurlencode($key), - self::REQUEST_PARAMETER_LS => rawurlencode($ls), - ); + $getData = $this->setupGetData($host, $bbs, $key, $ls); $uri = self::P2_ROOT_URI . self::SCRIPT_NAME_READ; $response = $this->httpGet($uri, $getData, true); $dom = new P2DOM($response['body']); @@ -280,7 +277,9 @@ // XbhÌL³ðm©ßé½ßAܸ read.php ð@B // dat¿ãÉzXgªÚ]µ½êAÚ]ãÌzXg¼ÅANZXµÄà // Xbhîñðæ¾Å«È©Á½ÆÌbZ[Wª\¦³êéB - $html = $this->readThread($host, $bbs, $key, 'l1n', $response); + $html = $this->readThread($host, $bbs, $key, + self::REQUEST_DATA_LS_LAST1_NO_FIRST, + $response); if ($html === null) { return null; } @@ -300,11 +299,7 @@ } // datðæ¾·éB - $getData = array( - self::REQUEST_PARAMETER_HOST => rawurlencode($host), - self::REQUEST_PARAMETER_BBS => rawurlencode($bbs), - self::REQUEST_PARAMETER_KEY => rawurlencode($key), - ); + $getData = $this->setupGetData($host, $bbs, $key); $uri = self::P2_ROOT_URI . self::SCRIPT_NAME_DAT; $response = $this->httpGet($uri, $getData, true); @@ -338,7 +333,9 @@ // csrfIdðæ¾µA©Âö®p2ÌùÇðÅVÌóÔÉ·é½ßAܸ read.php ð@B // ÊMÊðßñÅ«éæ¤É ls=l1n ƵĢéB // popup=1 Í«ÝãÌy[WÉ_CNg³¹È¢½ßB - $html = $this->readThread($host, $bbs, $key, 'l1n', $response); + $html = $this->readThread($host, $bbs, $key, + self::REQUEST_DATA_LS_LAST1_NO_FIRST, + $response); if ($html === null) { return false; } @@ -349,21 +346,8 @@ throw new P2Exception('Post form not found.'); } - $uri = self::P2_ROOT_URI . self::SCRIPT_NAME_POST; - - // CookiemFãÌPOSTÅ̶»¯\hÌ½ß - // URLGR[hÏÝÌlðpӵĨ¢ÄÄãü·éB - $hintEncoded = rawurlencode(self::REQUEST_DATA_CHARACTER_SET_DETECTION_HINT); - $nameEncoded = rawurlencode($name); - $mailEncoded = rawurlencode($mail); - $messageEncoded = rawurlencode($message); - // POST·éf[^ðpÓB - $postData = $this->getFormValues($dom, $form); - $postData[self::REQUEST_PARAMETER_CHARACTER_SET_DETECTION_HINT] = $hintEncoded; - $postData[self::REQUEST_PARAMETER_NAME] = $nameEncoded; - $postData[self::REQUEST_PARAMETER_MAIL] = $mailEncoded; - $postData[self::REQUEST_PARAMETER_MESSAGE] = $messageEncoded; + $postData = $this->setupPostData($dom, $form, $name, $mail, $message); $postData[self::REQUEST_PARAMETER_POPUP] = '1'; if ($beRes) { $postData[self::REQUEST_PARAMETER_BERES] = '1'; @@ -372,6 +356,7 @@ } // POSTÀsB + $uri = self::P2_ROOT_URI . self::SCRIPT_NAME_POST; $response = $this->httpPost($uri, $postData, true); // CookiemFÌêÍÄPOSTB @@ -383,11 +368,7 @@ $expression = './/form[contains(@action, "' . self::SCRIPT_NAME_POST . '")]'; $result = $dom->query($expression); if ($result instanceof DOMNodeList && $result->length > 0) { - $postData = $this->getFormValues($dom, $result->item(0)); - $postData[self::REQUEST_PARAMETER_CHARACTER_SET_DETECTION_HINT] = $hintEncoded; - $postData[self::REQUEST_PARAMETER_NAME] = $nameEncoded; - $postData[self::REQUEST_PARAMETER_MAIL] = $mailEncoded; - $postData[self::REQUEST_PARAMETER_MESSAGE] = $messageEncoded; + $postData = $this->setupPostData($dom, $result->item(0), $name, $mail, $message); $response = $this->httpPost($uri, $postData, true); } else { return false; @@ -516,6 +497,58 @@ } // }}} + // {{{ setupGetData() + + /** + * XbhðÇÞ½ß̤Êp[^Ìzñ𶬷é + * + * @param string $host + * @param string $bbs + * @param string $key + * @return array + */ + protected function setupGetData($host, $bbs, $key, $ls = null) + { + $data = array( + self::REQUEST_PARAMETER_HOST => rawurlencode($host), + self::REQUEST_PARAMETER_BBS => rawurlencode($bbs), + self::REQUEST_PARAMETER_KEY => rawurlencode($key), + ); + if ($ls !== null) { + $data[self::REQUEST_PARAMETER_LS] = rawurlencode($ls); + } + + return $data; + } + + // }}} + // {{{ setupPostData() + + /** + * XbhÉ«Þ½ß̤Êp[^Ìzñ𶬷é + * + * @param P2DOM $dom + * @param DOMElement $form + * @param string $key + * @param string $name + * @param string $mail + * @param string $message + * @return array + */ + protected function setupPostData(P2DOM $dom, DOMElement $form, + $name, $mail, $message) + { + $data = $this->getFormValues($dom, $form); + $data[self::REQUEST_PARAMETER_CHARACTER_SET_DETECTION_HINT] = + rawurlencode(self::REQUEST_DATA_CHARACTER_SET_DETECTION_HINT); + $data[self::REQUEST_PARAMETER_NAME] = rawurlencode($name); + $data[self::REQUEST_PARAMETER_MAIL] = rawurlencode($mail); + $data[self::REQUEST_PARAMETER_MESSAGE] = rawurlencode($message); + + return $data; + } + + // }}} } // }}} Modified: p2ex/trunk/lib/P2HttpExt.php =================================================================== --- p2ex/trunk/lib/P2HttpExt.php 2010-01-05 14:48:56 UTC (rev 766) +++ p2ex/trunk/lib/P2HttpExt.php 2010-01-09 16:57:35 UTC (rev 767) @@ -3,9 +3,6 @@ * rep2expack feat. pecl_http */ -require_once P2_LIB_DIR . '/FileCtl.php'; -require_once P2_LIB_DIR . '/P2Util.php'; - // {{{ CONSTANTS define('P2HTTPEXT_DEBUG', 0); Modified: p2ex/trunk/lib/P2Util.php =================================================================== --- p2ex/trunk/lib/P2Util.php 2010-01-05 14:48:56 UTC (rev 766) +++ p2ex/trunk/lib/P2Util.php 2010-01-09 16:57:35 UTC (rev 767) @@ -56,6 +56,13 @@ */ static private $_hostIsJbbsShitaraba = array(); + /** + * ²ÆÌ«ÝÝè¨æÑXbh²ÆÌ«Ýf[^ðÛ¶·éf[^x[X + * + * @var P2KeyValueStore + */ + static private $_postDataStore = null; + // }}} // {{{ fileDownload() @@ -382,22 +389,89 @@ } // }}} - // {{{ getFailedPostFilePath() + // {{{ pathForHost() /** - * failed_post_file ÌpXð¾éÖ + * hostÉηéÄpÌpXðÔ· + * + * @param string $host + * @param bool $with_slashes + * @return string + * @see P2Util::_p2DirOfHost() */ - static public function getFailedPostFilePath($host, $bbs, $key = false) + static public function pathForHost($host, $with_slashes = true) { - if ($key) { - $filename = $key.'.failed.data.php'; - } else { - $filename = 'failed.data.php'; + $path = self::_p2DirOfHost('', $host, $with_slashes); + if (DIRECTORY_SEPARATOR != '/') { + $path = str_replace(DIRECTORY_SEPARATOR, '/', $path); } - return $failed_post_file = self::idxDirOfHostBbs($host, $bbs) . $filename; + if (!$with_slashes) { + $path = trim($path, '/'); + } + return $path; } // }}} + // {{{ pathForHostBbs() + + /** + * host,bbsÉηéÄpÌpXðÔ· + * + * @param string $host + * @param string $bbs + * @param bool $with_slash + * @return string + * @see P2Util::_p2DirOfHost() + */ + static public function pathForHostBbs($host, $bbs, $with_slashes = true) + { + $path = self::_p2DirOfHost('', $host, true) . $bbs; + if (DIRECTORY_SEPARATOR != '/') { + $path = str_replace(DIRECTORY_SEPARATOR, '/', $path); + } + if (!$with_slashes) { + $path = trim($path, '/'); + } + return $path; + } + + // }}} + // {{{ getPostDataStore() + + /** + * ²ÆÌ«ÝÝè¨æÑXbh²ÆÌ«Ýf[^ðÛ¶·éf[^x[XðÔ· + * + * @param void + * @return P2KeyValueStore + */ + static public function getPostDataStore() + { + global $_conf; + + if (self::$_postDataStore !== null) { + return self::$_postDataStore; + } + + if (!class_exists('P2KeyValueStore', false)) { + require P2_LIB_DIR . '/P2KeyValueStore.php'; + } + + if (!is_dir($_conf['cookie_dir'])) { + FileCtl::mkdir_r($_conf['cookie_dir']); + } + + try { + $databasePath = $_conf['cookie_dir'] . DIRECTORY_SEPARATOR . 'p2_post_data.sqlite3'; + self::$_postDataStore = P2KeyValueStore::getStore($databasePath, + P2KeyValueStore::KVS_SERIALIZING); + } catch (Exception $e) { + p2die($e->getMessage()); + } + + return self::$_postDataStore; + } + + // }}} // {{{ getListNaviRange() /** @@ -491,49 +565,6 @@ } // }}} - // {{{ cachePathForCookie() - - /** - * zXg©çNbL[t@CpXðÔ· - */ - static public function cachePathForCookie($host) - { - global $_conf; - - $host = self::normalizeHostName($host); - - if (preg_match('/[^.0-9A-Za-z.\\-_]/', $host)) { - if (self::isHostJbbsShitaraba($host)) { - if (DIRECTORY_SEPARATOR == '/') { - $cookie_host_dir = $_conf['cookie_dir'] . DIRECTORY_SEPARATOR . $host; - } else { - $cookie_host_dir = $_conf['cookie_dir'] . DIRECTORY_SEPARATOR . str_replace('/', DIRECTORY_SEPARATOR, $host); - } - } else { - $cookie_host_dir = $_conf['cookie_dir'] . DIRECTORY_SEPARATOR . rawurlencode($host); - /* - if (DIRECTORY_SEPARATOR == '/') { - $old_cookie_host_dir = $_conf['cookie_dir'] . DIRECTORY_SEPARATOR . $host; - } else { - $old_cookie_host_dir = $_conf['cookie_dir'] . DIRECTORY_SEPARATOR . str_replace('/', DIRECTORY_SEPARATOR, $host); - } - if (is_dir($old_cookie_host_dir)) { - rename($old_cookie_host_dir, $cookie_host_dir); - clearstatcache(); - } - */ - } - } else { - $cookie_host_dir = $_conf['cookie_dir'] . DIRECTORY_SEPARATOR . $host; - } - $cachefile = $cookie_host_dir . DIRECTORY_SEPARATOR . $_conf['cookie_file_name']; - - FileCtl::mkdir_for($cachefile); - - return $cachefile; - } - - // }}} // {{{ throughIme() /** @@ -1117,7 +1148,7 @@ { global $_login; - return $_login->user . $_SERVER['SERVER_NAME'] . $_SERVER['SERVER_SOFTWARE']; + return $_login->user_u . $_SERVER['SERVER_NAME'] . $_SERVER['SERVER_SOFTWARE']; } // }}} @@ -1130,7 +1161,7 @@ { global $_login; - $key = $_login->user . $_login->pass_x . $_SERVER['HTTP_USER_AGENT'] . $salt; + $key = $_login->user_u . $_login->pass_x . $_SERVER['HTTP_USER_AGENT'] . $salt; if (array_key_exists('login_microtime', $_SESSION)) { $key .= $_SESSION['login_microtime']; } @@ -1820,6 +1851,10 @@ require P2_LIB_DIR . '/P2Client.php'; } + if (!is_dir($_conf['cookie_dir'])) { + FileCtl::mkdir_r($_conf['cookie_dir']); + } + try { return new P2Client($_conf['p2_2ch_mail'], $_conf['p2_2ch_pass'], $_conf['cookie_dir'], (bool)$_conf['p2_2ch_ignore_cip']); Modified: p2ex/trunk/lib/PresetManager.php =================================================================== --- p2ex/trunk/lib/PresetManager.php 2010-01-05 14:48:56 UTC (rev 766) +++ p2ex/trunk/lib/PresetManager.php 2010-01-09 16:57:35 UTC (rev 767) @@ -3,8 +3,6 @@ * rep2expack - è^¶ÇNX */ -require_once P2_LIB_DIR . '/FileCtl.php'; - // {{{ constants define('PRESETMANAGER_REAF_FIRST', 0); Modified: p2ex/trunk/lib/Thread.php =================================================================== --- p2ex/trunk/lib/Thread.php 2010-01-05 14:48:56 UTC (rev 766) +++ p2ex/trunk/lib/Thread.php 2010-01-09 16:57:35 UTC (rev 767) @@ -1,5 +1,4 @@ <?php -require_once P2_LIB_DIR . '/FileCtl.php'; // {{{ Thread Modified: p2ex/trunk/lib/ThreadRead.php =================================================================== --- p2ex/trunk/lib/ThreadRead.php 2010-01-05 14:48:56 UTC (rev 766) +++ p2ex/trunk/lib/ThreadRead.php 2010-01-09 16:57:35 UTC (rev 767) @@ -3,7 +3,6 @@ * rep2 - Xbh [h NX */ -require_once P2_LIB_DIR . '/FileCtl.php'; require_once P2_LIB_DIR . '/Thread.php'; // {{{ ThreadRead Added: p2ex/trunk/lib/bootstrap.php =================================================================== --- p2ex/trunk/lib/bootstrap.php (rev 0) +++ p2ex/trunk/lib/bootstrap.php 2010-01-09 16:57:35 UTC (rev 767) @@ -0,0 +1,708 @@ +<?php +/** + * rep2expack - ú»XNvg + * conf/conf.inc.php Ì p2configure() ©çÇÝÜêéB + */ + +// {{{ zXg`FbN + +if ($_conf['secure']['auth_host'] || $_conf['secure']['auth_bbq']) { + require_once $P2_LIB_DIR_S . 'HostCheck.php'; + if (($_conf['secure']['auth_host'] && HostCheck::getHostAuth() == false) || + ($_conf['secure']['auth_bbq'] && HostCheck::getHostBurned() == true) + ) { + HostCheck::forbidden(); + } +} + +// }}} +// {{{ NGXgÏÌ + +// VKOCÆo[OC̯wèÍ è¦È¢ÌÅAG[ðo· +if (isset($_POST['submit_new']) && isset($_POST['submit_member'])) { + p2die('³øÈURLÅ·B'); +} + +/** + * NGXgÏðêÅNH[g¶R[hÏ· + * + * ú{êðüÍ·éÂ\«Ì étH[ÉÍBµvfÅ + * GR[fBO»èp̶ñðdñÅ¢é + * + * $_COOKIE Í $_REQUEST ÉÜßÈ¢ + */ +if (!empty($_GET) || !empty($_POST)) { + if (isset($_REQUEST['_hint'])) { + // "CP932" Í "SJIS-win" ÌGCAXÅA"SJIS-win" Æ "SJIS" Íʨ + // "CP51932", "eucJP-win", "EUC-JP" Í»ê¼êʨ (libmbflIÈÓ¡Å) + $request_encoding = mb_detect_encoding($_REQUEST['_hint'], 'UTF-8,CP51932,CP932'); + if ($request_encoding == 'SJIS-win') { + $request_encoding = false; + } + } else { + $request_encoding = 'UTF-8,CP51932,CP932'; + } + + if (get_magic_quotes_gpc()) { + $_GET = array_map('stripslashes_r', $_GET); + $_POST = array_map('stripslashes_r', $_POST); + } + + if ($request_encoding) { + mb_convert_variables('CP932', $request_encoding, $_GET, $_POST); + } + + if ($_SERVER['REQUEST_METHOD'] == 'POST') { + $_POST = array_map('nullfilter_r', $_POST); + if (count($_GET)) { + $_GET = array_map('nullfilter_r', $_GET); + $_REQUEST = array_merge($_GET, $_POST); + } else { + $_REQUEST = $_POST; + } + } else { + $_GET = array_map('nullfilter_r', $_GET); + $_REQUEST = $_GET; + } + + // ÈÕXNvgCWFNVÎô + foreach (array('host', 'bbs', 'key', 'ls') as $_k) { + if (array_key_exists($_k, $_REQUEST)) { + $_v = $_REQUEST[$_k]; + if (htmlspecialchars($_v, ENT_QUOTES) != $_v) { + p2die('NGXgp[^És³È¶ª èÜ·B'); + } + } + } +} else { + $_REQUEST = array(); +} + +// }}} +// {{{ [»è + +require_once 'Net/UserAgent/Mobile.php'; + +$_conf['ktai'] = false; +$_conf['iphone'] = false; +$_conf['input_type_search'] = false; + +$_conf['accesskey'] = 'accesskey'; +$_conf['accept_charset'] = 'Shift_JIS'; +$_conf['extra_headers_ht'] = ''; + +$support_cookies = true; + +$mobile = Net_UserAgent_Mobile::singleton(); + +// iPhone, iPod Touch +if (P2Util::isBrowserIphone()) { + $_conf['ktai'] = true; + $_conf['iphone'] = true; + $_conf['input_type_search'] = true; + $_conf['accept_charset'] = 'UTF-8'; + +// PC +} elseif ($mobile->isNonMobile()) { + // Safari + if (P2Util::isBrowserSafariGroup()) { + $_conf['input_type_search'] = true; + $_conf['accept_charset'] = 'UTF-8'; + + // Windows Mobile, gÑQ[@ + } elseif (P2Util::isClientOSWindowsCE() || P2Util::isBrowserNintendoDS() || P2Util::isBrowserPSP()) { + $_conf['ktai'] = true; + } + +// gÑ +} else { + $_conf['ktai'] = true; + + // NTT docomo i[h + if ($mobile->isDoCoMo()) { + $support_cookies = false; + + // au EZweb + //} elseif ($mobile->isEZweb()) { + // $support_cookies = true; + + // SoftBank Mobile + } elseif ($mobile->isSoftBank()) { + // 3GC^[Ínonumber®«ðT|[gµÈ¢ÌÅaccesskeyðg¤ + if (!$mobile->isType3GC()) { + $_conf['accesskey'] = 'DIRECTKEY'; + // 3GC^[ÆW^[ÈOÍCookieðT|[gµÈ¢ + if (!$mobile->isTypeW()) { + $support_cookies = false; + } + } + + // WILLCOM AIR-EDGE + //} elseif ($mobile->isWillcom()) { + // $support_cookies = true; + + // »Ì¼ + //} else { + // $support_cookies = true; + } +} + +// }}} +// {{{ NG[Éæé§r [wè + +// b=pc ÍܾN檮SÅÈ¢? +// b=i ÍCSSÅWebKitÌÆ©g£/æsÀvpeBð½pµÄ¢é + +$_conf['b'] = $_conf['client_type'] = ($_conf['iphone'] ? 'i' : ($_conf['ktai'] ? 'k' : 'pc')); +$_conf['view_forced_by_query'] = false; +$_conf['k_at_a'] = ''; +$_conf['k_at_q'] = ''; +$_conf['k_input_ht'] = ''; + +if (isset($_REQUEST['b'])) { + switch ($_REQUEST['b']) { + + // §PCr [wè + case 'pc': + if ($_conf['b'] != 'pc') { + $_conf['b'] = 'pc'; + $_conf['ktai'] = false; + $_conf['iphone'] = false; + } + break; + + // §iPhoner [wè + case 'i': + if ($_conf['b'] != 'i') { + $_conf['b'] = 'i'; + $_conf['ktai'] = true; + $_conf['iphone'] = true; + } + break; + + // §gÑr [wè + case 'k': + if ($_conf['b'] != 'k') { + $_conf['b'] = 'k'; + $_conf['ktai'] = true; + $_conf['iphone'] = false; + } + break; + + } // endswitch + + // §r [wè³êÄ¢½Èç + if ($_conf['b'] != $_conf['client_type']) { + $_conf['view_forced_by_query'] = true; + $_conf['k_at_a'] = '&b=' . $_conf['b']; + $_conf['k_at_q'] = '?b=' . $_conf['b']; + $_conf['k_input_ht'] = '<input type="hidden" name="b" value="' . $_conf['b'] . '">'; + //output_add_rewrite_var('b', $_conf['b']); + } +} + +// }}} +// {{{ [UÝè Ç + +// [UÝèt@C +$_conf['conf_user_file'] = $_conf['pref_dir'] . '/conf_user.srd.cgi'; + +// `®t@CðRs[ +$conf_user_file_old = $_conf['pref_dir'] . '/conf_user.inc.php'; +if (!file_exists($_conf['conf_user_file']) && file_exists($conf_user_file_old)) { + $old_cont = DataPhp::getDataPhpCont($conf_user_file_old); + FileCtl::make_datafile($_conf['conf_user_file'], $_conf['conf_user_perm']); + if (FileCtl::file_write_contents($_conf['conf_user_file'], $old_cont) === false) { + $_info_msg_ht .= '<p>`®[UÝèÌRs[ɸsµÜµ½B</p>'; + } +} + +// [UÝèª êÎÇÝÞ +if (file_exists($_conf['conf_user_file'])) { + if ($cont = file_get_contents($_conf['conf_user_file'])) { + $conf_user = unserialize($cont); + } else { + $conf_user = null; + } + + // ½ç©ÌRÅ[UÝèt@CªóêÄ¢½ç + if (!is_array($conf_user)) { + if (unlink($_conf['conf_user_file'])) { + $_info_msg_ht .= '<p>[UÝèt@CªóêÄ¢½ÌÅjüµÜµ½B</p>'; + } else { + $_info_msg_ht .= '<p>[UÝèt@CªóêĢܷªAjüūܹñŵ½B<br>"'; + $_info_msg_ht .= htmlspecialchars($_conf['conf_user_file'], ENT_QUOTES); + $_info_msg_ht .= '" ðè®ÅíµÄ¾³¢B</p>'; + } + $conf_user = array(); + $conf_user_mtime = 0; + } else { + $conf_user_mtime = filemtime($_conf['conf_user_file']); + } + + // [UÝèt@CÆftHgÝèt@CÌXVúð`FbN + if (!isset($conf_user['.']) || + $conf_user['.'] != P2_VERSION_ID || + filemtime(__FILE__) > $conf_user_mtime || + filemtime($P2_CONF_DIR_S . 'conf_user_def.inc.php') > $conf_user_mtime || + filemtime($P2_CONF_DIR_S . 'conf_user_def_ex.inc.php') > $conf_user_mtime || + filemtime($P2_CONF_DIR_S . 'conf_user_def_i.inc.php') > $conf_user_mtime) + { + // ftHgÝèðÇÝÞ + require_once $P2_CONF_DIR_S . 'conf_user_def.inc.php'; + + // ÝèÌXV + if (!array_key_exists('mobile.link_youtube', $conf_user)) { + require_once $P2_LIB_DIR_S . 'conf_user_updater.inc.php'; + $conf_user = conf_user_update_080908($conf_user); + } + + $_conf = array_merge($_conf, $conf_user_def, $conf_user); + + // Vµ¢[UÝèðLbV + $conf_user = array('.' => P2_VERSION_ID); + foreach ($conf_user_def as $k => $v) { + $conf_user[$k] = $_conf[$k]; + } + if (FileCtl::file_write_contents($_conf['conf_user_file'], serialize($conf_user)) === false) { + $_info_msg_ht .= '<p>[UÝèÌLbV ɸsµÜµ½</p>'; + } + + // [UÝèt@CÌXVúÌûªVµ¢êÍAftHgÝèð³ + } else { + $_conf = array_merge($_conf, $conf_user); + } + + unset($cont, $conf_user); +} else { + // ftHgÝèðÇÝÞ + require_once $P2_CONF_DIR_S . 'conf_user_def.inc.php'; + $_conf = array_merge($_conf, $conf_user_def); +} + +// }}} +// {{{ [UÝè̲® + +$_conf['ext_win_target_at'] = ($_conf['ext_win_target']) ? " target=\"{$_conf['ext_win_target']}\"" : ''; +$_conf['bbs_win_target_at'] = ($_conf['bbs_win_target']) ? " target=\"{$_conf['bbs_win_target']}\"" : ''; + +if ($_conf['get_new_res']) { + if ($_conf['get_new_res'] == 'all') { + $_conf['get_new_res_l'] = $_conf['get_new_res']; + } else { + $_conf['get_new_res_l'] = 'l'.$_conf['get_new_res']; + } +} else { + $_conf['get_new_res_l'] = 'l200'; +} + +if ($_conf['expack.user_agent']) { + ini_set('user_agent', $_conf['expack.user_agent']); +} + +// }}} +// {{{ fUCÝè Ç + +$skin_name = $default_skin_name = 'conf_user_style'; +$skin = $P2_CONF_DIR_S . 'conf_user_style.inc.php'; +if (!$_conf['ktai'] && $_conf['expack.skin.enabled']) { + // Û¶³êÄ¢éXL¼ + $saved_skin_name = null; + if (file_exists($_conf['expack.skin.setting_path'])) { + $saved_skin_name = rtrim(file_get_contents($_conf['expack.skin.setting_path'])); + if (!preg_match('/^[0-9A-Za-z_\\-]+$/', $saved_skin_name)) { + $saved_skin_name = null; + } + } else { + FileCtl::make_datafile($_conf['expack.skin.setting_path'], $_conf['expack.skin.setting_perm']); + } + + // NGXgÅwè³ê½XL¼ + $new_skin_name = null; + if (array_key_exists('skin', $_REQUEST) && is_string($_REQUEST['skin'])) { + $new_skin_name = $_REQUEST['skin']; + if (!preg_match('/^[0-9A-Za-z_\\-]+$/', $new_skin_name)) { + $new_skin_name = null; + } elseif ($new_skin_name != $saved_skin_name) { + FileCtl::file_write_contents($_conf['expack.skin.setting_path'], $new_skin_name); + } + } + + // NGXgÅwè³ê½êXL¼ + $tmp_skin_name = null; + if (array_key_exists('tmp_skin', $_REQUEST) && is_string($_REQUEST['tmp_skin'])) { + $tmp_skin_name = $_REQUEST['tmp_skin']; + if (!preg_match('/^[0-9A-Za-z_\\-]+$/', $tmp_skin_name)) { + $tmp_skin_name = null; + } + } + + // XLõ + foreach (array($tmp_skin_name, $new_skin_name, $saved_skin_name, $default_skin_name) as $skin_name) { + if ($skin_name !== null) { + if ($skin_name == $default_skin_name) { + break; + } + $user_skin_path = P2_USER_SKIN_DIR . DIRECTORY_SEPARATOR . $skin_name . '.php'; + if (file_exists($user_skin_path)) { + $skin = $user_skin_path; + break; + } + $bundled_skin_path = P2_SKIN_DIR . DIRECTORY_SEPARATOR . $skin_name . '.php'; + if (file_exists($bundled_skin_path)) { + $skin = $bundled_skin_path; + break; + } + } + } +} + +if (!file_exists($skin)) { + $skin_name = 'conf_user_style'; + $skin = $P2_CONF_DIR_S . 'conf_user_style.inc.php'; +} +$skin_en = rawurlencode($skin_name) . '&_=' . P2_VERSION_ID; +if ($_conf['view_forced_by_query']) { + $skin_en .= $_conf['k_at_a']; +} + +// ftHgÝèðÇÝñÅ +include $P2_CONF_DIR_S . 'conf_user_style.inc.php'; +// XLÅã« +if ($skin != $P2_CONF_DIR_S . 'conf_user_style.inc.php') { + include $skin; +} + +// }}} +// {{{ fUCÝè̲® + +$skin_uniq = P2_VERSION_ID; + +foreach ($STYLE as $K => $V) { + if (empty($V)) { + $STYLE[$K] = ''; + } elseif (strpos($K, 'fontfamily') !== false) { + $STYLE[$K] = p2_correct_css_fontfamily($V); + } elseif (strpos($K, 'color') !== false) { + $STYLE[$K] = p2_correct_css_color($V); + } elseif (strpos($K, 'background') !== false) { + $STYLE[$K] = "url('" . p2_escape_css_url($V) . "')"; + } +} + +if (!$_conf['ktai']) { + require_once $P2_LIB_DIR_S . 'fontconfig.inc.php'; + + if ($_conf['expack.am.enabled']) { + $_conf['expack.am.fontfamily'] = p2_correct_css_fontfamily($_conf['expack.am.fontfamily']); + if ($STYLE['fontfamily']) { + $_conf['expack.am.fontfamily'] .= '","' . $STYLE['fontfamily']; + } + } + + fontconfig_apply_custom(); +} + +// }}} +// {{{ gÑEiPhonepÏ + +// iPhonepHTMLwb_vf +if ($_conf['client_type'] == 'i') { + switch ($_conf['b']) { + + // §PCr [ + case 'pc': + $_conf['extra_headers_ht'] .= <<<EOS +<meta name="format-detection" content="telephone=no"> +<link rel="apple-touch-icon" type="image/png" href="img/touch-icon/p2-serif.png"> +<style type="text/css">body { -webkit-text-size-adjust: none; }</style> +EOS; + break; + + // §gÑr [ + case 'k': + $_conf['extra_headers_ht'] .= <<<EOS +<meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=yes"> +<meta name="format-detection" content="telephone=no"> +<link rel="apple-touch-icon" type="image/png" href="img/touch-icon/p2-serif.png"> +<style type="text/css"> +body { word-break: normal; word-break: break-all; -webkit-text-size-adjust: none; } +* { font-family: sans-serif; font-size: medium; line-height: 150%; } +h1 { font-size: xx-large; } +h2 { font-size: x-large; } +h3 { font-size: large; } +</style> +EOS; + break; + + // ³iPhoner [ + case 'i': + default: + $_conf['extra_headers_ht'] .= <<<EOS +<meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=yes"> +<meta name="format-detection" content="telephone=no"> +<link rel="apple-touch-icon" type="image/png" href="img/touch-icon/p2-serif.png"> +<link rel="stylesheet" type="text/css" media="screen" href="css/iphone.css?{$_conf['p2_version_id']}"> +<script type="text/javascript" src="js/iphone.js?{$_conf['p2_version_id']}"></script> +EOS; + + } // endswitch + +// §iPhoner [ +} elseif ($_conf['iphone']) { + $_conf['extra_headers_ht'] .= <<<EOS +<link rel="stylesheet" type="text/css" media="screen" href="css/iphone.css?{$_conf['p2_version_id']}"> +<script type="text/javascript" src="js/iphone.js?{$_conf['p2_version_id']}"></script> +EOS; +} + +// iPhonepXL +if ($_conf['iphone'] && isset($_conf['expack.iphone.skin'])) { + if (strpos($_conf['expack.iphone.skin'], DIRECTORY_SEPARATOR) === false) { + $iskin = 'skin/iphone/' . $iskin . '.css'; + if (file_exists($iskin)) { + $iskin_mtime = filemtime($iskin); + $_conf['extra_headers_ht'] .= <<<EOS +<link rel="stylesheet" type="text/css" media="screen" href="{$iskin}?{$iskin_mtime}"> +EOS; + } + } +} + +// gÑpugbvÉßévNÆaccesskey +if ($_conf['ktai']) { + // iPhone + if ($_conf['iphone']) { + $_conf['k_accesskey_at'] = array_fill(0, 10, ''); + $_conf['k_accesskey_at']['*'] = ''; + $_conf['k_accesskey_at']['#'] = ''; + foreach ($_conf['k_accesskey'] as $name => $key) { + $_conf['k_accesskey_at'][$name] = ''; + } + + $_conf['k_accesskey_st'] = $_conf['k_accesskey_at']; + + $_conf['k_to_index_ht'] = <<<EOP +<a href="index.php{$_conf['k_at_q']}" class="button">TOP</a> +EOP; + + // »Ì¼ + } else { + // SoftBank Mobile + if ($_conf['accesskey'] == 'DIRECTKEY') { + $_conf['k_accesskey_at'] = array( + '0' => ' directkey="0" nonumber', + '1' => ' directkey="1" nonumber', + '2' => ' directkey="2" nonumber', + '3' => ' directkey="3" nonumber', + '4' => ' directkey="4" nonumber', + '5' => ' directkey="5" nonumber', + '6' => ' directkey="6" nonumber', + '7' => ' directkey="7" nonumber', + '8' => ' directkey="8" nonumber', + '9' => ' directkey="9" nonumber', + '*' => ' directkey="*" nonumber', + '#' => ' directkey="#" nonumber', + ); + + // »Ì¼ + } else { + $_conf['k_accesskey_at'] = array( + '0' => ' accesskey="0"', + '1' => ' accesskey="1"', + '2' => ' accesskey="2"', + '3' => ' accesskey="3"', + '4' => ' accesskey="4"', + '5' => ' accesskey="5"', + '6' => ' accesskey="6"', + '7' => ' accesskey="7"', + '8' => ' accesskey="8"', + '9' => ' accesskey="9"', + '*' => ' accesskey="*"', + '#' => ' accesskey="#"', + ); + } + + switch ($_conf['mobile.display_accesskey']) { + case 2: + require_once $P2_LIB_DIR_S . 'emoji.inc.php'; + $emoji = p2_get_emoji($mobile); + //$emoji = p2_get_emoji(Net_UserAgent_Mobile::factory('KDDI-SA31 UP.Browser/6.2.0.7.3.129 (GUI) MMP/2.0')); + $_conf['k_accesskey_st'] = array( + '0' => $emoji[0], + '1' => $emoji[1], + '2' => $emoji[2], + '3' => $emoji[3], + '4' => $emoji[4], + '5' => $emoji[5], + '6' => $emoji[6], + '7' => $emoji[7], + '8' => $emoji[8], + '9' => $emoji[9], + '*' => $emoji['*'], + '#' => $emoji['#'], + ); + break; + case 0: + $_conf['k_accesskey_st'] = array_fill(0, 10, ''); + $_conf['k_accesskey_st']['*'] = ''; + $_conf['k_accesskey_st']['#'] = ''; + break; + case 1: + default: + $_conf['k_accesskey_st'] = array( + 0 => '0.', 1 => '1.', 2 => '2.', 3 => '3.', 4 => '4.', + 5 => '5.', 6 => '6.', 7 => '7.', 8 => '8.', 9 => '9.', + '*' => '*.', '#' => '#.' + ); + } + + foreach ($_conf['k_accesskey'] as $name => $key) { + $_conf['k_accesskey_at'][$name] = $_conf['k_accesskey_at'][$key]; + $_conf['k_accesskey_st'][$name] = $_conf['k_accesskey_st'][$key]; + } + + $_conf['k_to_index_ht'] = <<<EOP +<a href="index.php{$_conf['k_at_q']}"{$_conf['k_accesskey_at'][0]}>{$_conf['k_accesskey_st'][0]}TOP</a> +EOP; + } +} + +// }}} +// {{{ gÑpJ[O̲® + +$_conf['k_colors'] = ''; + +if ($_conf['ktai']) { + // î{F + if (!$_conf['iphone']) { + if ($_conf['mobile.background_color']) { + $_conf['k_colors'] .= ' bgcolor="' . htmlspecialchars($_conf['mobile.background_color']) . '"'; + } + if ($_conf['mobile.text_color']) { + $_conf['k_colors'] .= ' text="' . htmlspecialchars($_conf['mobile.text_color']) . '"'; + } + if ($_conf['mobile.link_color']) { + $_conf['k_colors'] .= ' link="' . htmlspecialchars($_conf['mobile.link_color']) . '"'; + } + if ($_conf['mobile.vlink_color']) { + $_conf['k_colors'] .= ' vlink="' . htmlspecialchars($_conf['mobile.vlink_color']) . '"'; + } + } + + // ¶F + if ($_conf['mobile.newthre_color']) { + $STYLE['mobile_subject_newthre_color'] = htmlspecialchars($_conf['mobile.newthre_color']); + } + if ($_conf['mobile.newres_color']) { + $STYLE['mobile_read_newres_color'] = htmlspecialchars($_conf['mobile.newres_color']); + $STYLE['mobile_subject_newres_color'] = htmlspecialchars($_conf['mobile.newres_color']); + } + if ($_conf['mobile.ttitle_color']) { + $STYLE['mobile_read_ttitle_color'] = htmlspecialchars($_conf['mobile.ttitle_color']); + } + if ($_conf['mobile.ngword_color']) { + $STYLE['mobile_read_ngword_color'] = htmlspecialchars($_conf['mobile.ngword_color']); + } + if ($_conf['mobile.onthefly_color']) { + $STYLE['mobile_read_onthefly_color'] = htmlspecialchars($_conf['mobile.onthefly_color']); + } + + // }[J[ + if ($_conf['mobile.match_color']) { + if ($_conf['iphone']) { + $_conf['extra_headers_ht'] .= sprintf('<style type="text/css">b.filtering, span.matched { color: %s; }</style>', + htmlspecialchars($_conf['mobile.match_color'])); + $_conf['k_filter_marker'] = '<span class="matched">\\1</span>'; + } else { + $_conf['k_filter_marker'] = '<font color="' . htmlspecialchars($_conf['mobile.match_color']) . '">\\1</font>'; + } + } else { + $_conf['k_filter_marker'] = false; + } +} + +// }}} +// {{{ ZbV + +// ¼OÍAZbVNbL[ðjü·éƫ̽ßÉAZbVpÌL³ÉÖíç¸Ýè·é +session_name('PS'); + +$_conf['sid_at_a'] = ''; + +require_once $P2_LIB_DIR_S . 'Session.php'; + +// {{{ ZbVf[^Û¶fBNgð`FbN + +if ($_conf['session_save'] == 'p2' and session_module_name() == 'files') { + if (!is_dir($_conf['session_dir'])) { + FileCtl::mkdir_r($_conf['session_dir']); + } elseif (!is_writable($_conf['session_dir'])) { + p2die("ZbVf[^Û¶fBNg ({$_conf['session_dir']}) É«Ý Àª èܹñB"); + } + + session_save_path($_conf['session_dir']); +} + +// }}} + +$_p2session = new Session(null, null, $support_cookies); + +// }}} +// {{{ ¨CÉZbg + +// ¡Ì¨CÉZbgðg¤Æ« +if ($_conf['expack.misc.multi_favs']) { + if (!class_exists('FavSetManager', false)) { + include $P2_LIB_DIR_S . 'FavSetManager.php'; + } + // ØèÖ¦\¦pÉSĄ̈CÉXE¨CÉÂðÇÝñŨ + FavSetManager::loadAllFavSet(); + // ¨CÉZbgðØèÖ¦é + FavSetManager::switchFavSet(); +} else { + $_conf['m_favlist_set'] = $_conf['m_favlist_set_at_a'] = $_conf['m_favlist_set_input_ht'] = ''; + $_conf['m_favita_set'] = $_conf['m_favita_set_at_a'] = $_conf['m_favita_set_input_ht'] = ''; + $_conf['m_rss_set'] = $_conf['m_rss_set_at_a'] = $_conf['m_rss_set_input_ht'] = ''; +} + +// }}} +// {{{ misc. + +// DOCTYPE HTML é¾ +$_conf['doctype'] = ''; +$ie_strict = false; +if (!$_conf['ktai'] || $_conf['client_type'] != 'k') { + if ($ie_strict || strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') === false) { + $_conf['doctype'] = <<<EODOC +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" + "http://www.w3.org/TR/html4/loose.dtd">\n +EODOC; + } else { + $_conf['doctype'] = <<<EODOC +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">\n +EODOC; + } +} + +// XHTMLwb_vf +if (defined('P2_OUTPUT_XHTML')) { + $_conf['extra_headers_xht'] = preg_replace('/<((?:link|meta) .+?)>/', '<\\1 />', $_conf['extra_headers_ht']); +} + +// OCNXÌCX^X¶¬iOC[Uªwè³êĢȯêÎA±Ì_ÅOCtH[\¦Éj +require_once $P2_LIB_DIR_S . 'Login.php'; +$_login = new Login(); + +// }}} + +/* + * 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: Modified: p2ex/trunk/lib/dele.inc.php =================================================================== --- p2ex/trunk/lib/dele.inc.php 2010-01-05 14:48:56 UTC (rev 766) +++ p2ex/trunk/lib/dele.inc.php 2010-01-09 16:57:35 UTC (rev 767) @@ -3,7 +3,6 @@ * rep2 - Xbhf[^ADATðí·é½ßÌÖS */ -require_once P2_LIB_DIR . '/FileCtl.php'; require_once P2_LIB_DIR . '/setfav.inc.php'; require_once P2_LIB_DIR . '/setpalace.inc.php'; Modified: p2ex/trunk/lib/expack/fixed_name.inc.php =================================================================== --- p2ex/trunk/lib/expack/fixed_name.inc.php 2010-01-05 14:48:56 UTC (rev 766) +++ p2ex/trunk/lib/expack/fixed_name.inc.php 2010-01-09 16:57:35 UTC (rev 767) @@ -4,7 +4,6 @@ */ require_once P2_LIB_DIR . '/SjisPersister.php'; -require_once P2_LIB_DIR . '/P2Util.php'; // {{{ fixed_name_get_persister() Modified: p2ex/trunk/lib/expack/rss/common.inc.php =================================================================== --- p2ex/trunk/lib/expack/rss/common.inc.php 2010-01-05 14:48:56 UTC (rev 766) +++ p2ex/trunk/lib/expack/rss/common.inc.php 2010-01-09 16:57:35 UTC (rev 767) @@ -3,7 +3,6 @@ * rep2expack - RSS[eBeBÖ */ -require_once P2_LIB_DIR . '/FileCtl.php'; require_once 'PEAR.php'; // {{{ rss_get_save_path() Modified: p2ex/trunk/lib/expack/rss/parser.inc.php =================================================================== --- p2ex/trunk/lib/expack/rss/parser.inc.php 2010-01-05 14:48:56 UTC (rev 766) +++ p2ex/trunk/lib/expack/rss/parser.inc.php 2010-01-09 16:57:35 UTC (rev 767) @@ -3,7 +3,6 @@ * rep2expack - RSS Parser */ -require_once P2_LIB_DIR . '/FileCtl.php'; require_once P2EX_LIB_DIR . '/rss/common.inc.php'; require_once 'XML/RSS.php'; Modified: p2ex/trunk/lib/expack/rss/setrss.inc.php =================================================================== --- p2ex/trunk/lib/expack/rss/setrss.inc.php 2010-01-05 14:48:56 UTC (rev 766) +++ p2ex/trunk/lib/expack/rss/setrss.inc.php 2010-01-09 16:57:35 UTC (rev 767) @@ -3,7 +3,6 @@ * rep2expack - RSSXgÌ */ -require_once P2_LIB_DIR . '/FileCtl.php'; require_once P2EX_LIB_DIR . '/rss/parser.inc.php'; // {{{ Ï Modified: p2ex/trunk/lib/login2ch.inc.php =================================================================== --- p2ex/trunk/lib/login2ch.inc.php 2010-01-05 14:48:56 UTC (rev 766) +++ p2ex/trunk/lib/login2ch.inc.php 2010-01-09 16:57:35 UTC (rev 767) @@ -4,7 +4,6 @@ */ require_once './conf/conf.inc.php'; -require_once P2_LIB_DIR . '/FileCtl.php'; require_once P2_LIB_DIR . '/Wap.php'; // {{{ login2ch() Modified: p2ex/trunk/lib/post_form_options.inc.php =================================================================== --- p2ex/trunk/lib/post_form_options.inc.php 2010-01-05 14:48:56 UTC (rev 766) +++ p2ex/trunk/lib/post_form_options.inc.php 2010-01-09 16:57:35 UTC (rev 767) @@ -18,6 +18,8 @@ $hd['mail'] = ''; $hd['MESSAGE'] = ''; $hd['subject'] = ''; +$hd['beres_checked'] = ''; +$hd['p2res_checked'] = ''; $htm['beres'] = ''; $htm['p2res'] = ''; @@ -88,31 +90,61 @@ } // }}} +// {{{ f[^x[X©çOñÌPOST¸sf[^Æberes/p2resÌÝèðÇÝ -// OñÌPOST¸sª êÎÄÑoµ -$failed_post_file = P2Util::getFailedPostFilePath($host, $bbs, $key); -if ($cont_srd = DataPhp::getDataPhpCont($failed_post_file)) { - $last_posted = unserialize($cont_srd); +if (!isset($_login)) { + $_login = $GLOBALS['_login']; +} +$post_id_suffix = $_login->user_u . P2Util::pathForHostBbs($host, $bbs); +$post_backup_id = 'backup:' . $post_id_suffix; +$post_config_id = 'config:' . $post_id_suffix; +if (!empty($_REQUEST['newthread'])) { + $post_backup_id .= 'new'; +} else { + $post_backup_id .= $key; +} - // ÜÆßÄTj^CY - $last_posted = array_map(create_function('$n', 'return htmlspecialchars($n, ENT_QUOTES);'), $last_posted); - //$addslashesS = create_function('$str', 'return str_replace("\'", "\\\'", $str);'); - //$last_posted = array_map($addslashesS, $last_posted); +$post_store = P2Util::getPostDataStore(); - $hd['FROM'] = $last_posted['FROM']; - $hd['mail'] = $last_posted['mail']; - $hd['MESSAGE'] = $last_posted['MESSAGE']; - $hd['subject'] = $last_posted['subject']; +// OñÌPOST¸sf[^ +if ($post_backup = $post_store->get($post_backup_id)) { + $hd['FROM'] = htmlspecialchars($post_backup['FROM'], ENT_QUOTES, 'Shift_JIS'); + $hd['mail'] = htmlspecialchars($post_backup['mail'], ENT_QUOTES, 'Shift_JIS'); + $hd['MESSAGE'] = htmlspecialchars($post_backup['MESSAGE'], ENT_QUOTES, 'Shift_JIS'); + $hd['subject'] = htmlspecialchars($post_backup['subject'], ENT_QUOTES, 'Shift_JIS'); } +// beres/p2res +if ($post_config = $post_store->get($post_config_id)) { + if ($post_config['beres']) { + $hd['beres_checked'] = ' checked'; + } + if ($post_config['p2res']) { + $hd['p2res_checked'] = ' checked'; + } +} + +// }}} +// {{{ ¼OÆ[ÌÅI²® + // óÍ[UÝèlÉÏ· -$hd['FROM'] = ($hd['FROM'] == '') ? htmlspecialchars($_conf['my_FROM'], ENT_QUOTES) : $hd['FROM']; -$hd['mail'] = ($hd['mail'] == '') ? htmlspecialchars($_conf['my_mail'], ENT_QUOTES) : $hd['mail']; +if ($hd['FROM'] === '') { + $hd['FROM'] = htmlspecialchars($_conf['my_FROM'], ENT_QUOTES, 'Shift_JIS'); +} +if ($hd['mail'] === '') { + $hd['mail'] = htmlspecialchars($_conf['my_mail'], ENT_QUOTES, 'Shift_JIS'); +} // P2NULLÍóÉÏ· -$hd['FROM'] = ($hd['FROM'] == 'P2NULL') ? '' : $hd['FROM']; -$hd['mail'] = ($hd['mail'] == 'P2NULL') ? '' : $hd['mail']; +if ($hd['FROM'] === 'P2NULL') { + $hd['FROM'] = ''; +} +if ($hd['mail'] === 'P2NULL') { + $hd['mail'] = ''; +} +// }}} +// {{{ textareaÌ®« // Ql NVbN COLS='60' ROWS='8' $mobile = Net_UserAgent_Mobile::singleton(); @@ -132,17 +164,8 @@ $wrap_at = ' wrap="soft"'; } -// Be.2ch -if (P2Util::isHost2chs($host) and $_conf['be_2ch_code'] && $_conf['be_2ch_mail']) { - $htm['beres'] = '<input type="checkbox" id="beres" name="beres" value="1"><label for="beres">BEÅ«Þ</label>'; -} +// {{{ PCp sage `FbN{bNX -// ö®p2 -if ((P2Util::isHost2chs($host) || P2Util::isHostMachiBbs($host)) && $_conf['p2_2ch_mail'] && $_conf['p2_2ch_pass']) { - $htm['p2res'] = '<input type="checkbox" id="p2res" name="p2res" value="1"><label for="p2res">ö®p2Å«Þ</label>'; -} - -// PCp sage checkbox if (!$_conf['ktai']) { $on_check_sage = ' onchange="checkSage();"'; $htm['sage_cb'] = <<<EOP @@ -152,14 +175,29 @@ $on_check_sage = ''; } -// {{{ 2ch«Ý +// }}} +// {{{ /Be/ö®p2 «Ý `FbN{bNX +// 2ch«Ý if (P2Util::isHost2chs($host) and file_exists($_conf['sid2ch_php'])) { - $htm['maru_post'] = <<<EOP -<span title="2chIDÌgp"><input id="maru" name="maru" type="checkbox" value="1"><label for="maru"></label></span> -EOP; + $htm['maru_post'] = '<span title="2chIDÌgp"><input type="checkbox" id="maru" name="maru" value="1">' + . '<label for="maru"></label></span>'; } +// Be +if (P2Util::isHost2chs($host) and $_conf['be_2ch_code'] && $_conf['be_2ch_mail']) { + $htm['beres'] = '<input type="checkbox" id="beres" name="beres" value="1"'. $hd['beres_checked'] . '>' + . '<label for="beres">BeÅ«Þ</label>'; +} + +// ö®p2 +if ((P2Util::isHost2chs($host) || P2Util::isHostMachiBbs($host)) && + $_conf['p2_2ch_mail'] && $_conf['p2_2ch_pass']) +{ + $htm['p2res'] = '<input type="checkbox" id="p2res" name="p2res" value="1"'. $hd['p2res_checked'] . '>' + . '<label for="p2res">ö®p2Å«Þ</label>'; +} + // }}} // {{{ «ÝubNp`FbN{bNX Modified: p2ex/trunk/lib/read_footer.inc.php =================================================================== --- p2ex/trunk/lib/read_footer.inc.php 2010-01-05 14:48:56 UTC (rev 766) +++ p2ex/trunk/lib/read_footer.inc.php 2010-01-09 16:57:35 UTC (rev 767) @@ -3,8 +3,6 @@ * rep2 - Xbh\¦ - tb^ª - for read.php */ -require_once P2_LIB_DIR . '/DataPhp.php'; - //===================================================================== // ¡tb^ //===================================================================== Modified: p2ex/trunk/lib/read_machibbs.inc.php =================================================================== --- p2ex/trunk/lib/read_machibbs.inc.php 2010-01-05 14:48:56 UTC (rev 766) +++ p2ex/trunk/lib/read_machibbs.inc.php 2010-01-09 16:57:35 UTC (rev 767) @@ -3,8 +3,6 @@ * rep2 - Ü¿BBSpÌÖ */ -require_once P2_LIB_DIR . '/FileCtl.php'; - // {{{ machiDownload() /** Modified: p2ex/trunk/lib/read_new.inc.php =================================================================== --- p2ex/trunk/lib/read_new.inc.php 2010-01-05 14:48:56 UTC (rev 766) +++ p2ex/trunk/lib/read_new.inc.php 2010-01-09 16:57:35 UTC (rev 767) @@ -3,8 +3,6 @@ * rep2 - for read_new.php, read_new_k.php */ -require_once P2_LIB_DIR . '/FileCtl.php'; - // {{{ saveMatomeCache() /** Modified: p2ex/trunk/lib/read_res_hist.inc.php =================================================================== --- p2ex/trunk/lib/read_res_hist.inc.php 2010-01-05 14:48:56 UTC (rev 766) +++ p2ex/trunk/lib/read_res_hist.inc.php 2010-01-09 16:57:35 UTC (rev 767) @@ -3,8 +3,6 @@ * rep2 - «Ýð ̽ßÌÖQ */ -require_once P2_LIB_DIR . '/DataPhp.php'; - // {{{ deleMsg() /** Modified: p2ex/trunk/lib/read_shitaraba.inc.php =================================================================== --- p2ex/trunk/lib/read_shitaraba.inc.php 2010-01-05 14:48:56 UTC (rev 766) +++ p2ex/trunk/lib/read_shitaraba.inc.php 2010-01-09 16:57:35 UTC (rev 767) @@ -5,8 +5,6 @@ * eíBBSÉÎÅ«évt@CNXݽ¢ÈÌðìè½¢à̾BB aki */ -require_once P2_LIB_DIR . '/FileCtl.php'; - // {{{ shitarabaDownload() /** Modified: p2ex/trunk/lib/setbookmark.inc.php =================================================================== --- p2ex/trunk/lib/setbookmark.inc.php 2010-01-05 14:48:56 UTC (rev 766) +++ p2ex/trunk/lib/setbookmark.inc.php 2010-01-09 16:57:35 UTC (rev 767) @@ -3,8 +3,6 @@ * rep2expack - ubN}[No^Eð */ -require_once P2_LIB_DIR . '/FileCtl.php'; - // {{{ setbookmark() /** Modified: p2ex/trunk/lib/setfav.inc.php =================================================================== --- p2ex/trunk/lib/setfav.inc.php 2010-01-05 14:48:56 UTC (rev 766) +++ p2ex/trunk/lib/setfav.inc.php 2010-01-09 16:57:35 UTC (rev 767) @@ -14,8 +14,6 @@ * Xbh\¦Ì¨CÉX\¦ ¨ Xbh.idx ðQÆ */ -require_once P2_LIB_DIR . '/FileCtl.php'; - // {{{ setFav() /** Modified: p2ex/trunk/lib/setfavita.inc.php =================================================================== --- p2ex/trunk/lib/setfavita.inc.php 2010-01-05 14:48:56 UTC (rev 766) +++ p2ex/trunk/lib/setfavita.inc.php 2010-01-09 16:57:35 UTC (rev 767) @@ -3,8 +3,6 @@ * rep2 - ¨CÉÂÌ */ -require_once P2_LIB_DIR . '/FileCtl.php'; - // {{{ setFavIta() /** Modified: p2ex/trunk/lib/setpalace.inc.php =================================================================== --- p2ex/trunk/lib/setpalace.inc.php 2010-01-05 14:48:56 UTC (rev 766) +++ p2ex/trunk/lib/setpalace.inc.php 2010-01-09 16:57:35 UTC (rev 767) @@ -3,8 +3,6 @@ * rep2 - a°üèÖWÌ */ -require_once P2_LIB_DIR . '/FileCtl.php'; - // {{{ setPal() /** Modified: p2ex/trunk/lib/settaborn.inc.php =================================================================== --- p2ex/trunk/lib/settaborn.inc.php 2010-01-05 14:48:56 UTC (rev 766) +++ p2ex/trunk/lib/settaborn.inc.php 2010-01-09 16:57:35 UTC (rev 767) @@ -3,8 +3,6 @@ * rep2 - Xbh Ú[ñÌÖ */ -require_once P2_LIB_DIR . '/FileCtl.php'; - // {{{ settaborn() /** Modified: p2ex/trunk/lib/settaborn_off.inc.php =================================================================== --- p2ex/trunk/lib/settaborn_off.inc.php 2010-01-05 14:48:56 UTC (rev 766) +++ p2ex/trunk/lib/settaborn_off.inc.php 2010-01-09 16:57:35 UTC (rev 767) @@ -3,8 +3,6 @@ * rep2 - Xbh Ú[ñ¡êð */ -require_once P2_LIB_DIR . '/FileCtl.php'; - // {{{ settaborn_off() /** Modified: p2ex/trunk/lib/subject_new.inc.php =================================================================== --- p2ex/trunk/lib/subject_new.inc.php 2010-01-05 14:48:56 UTC (rev 766) +++ p2ex/trunk/lib/subject_new.inc.php 2010-01-09 16:57:35 UTC (rev 767) @@ -8,7 +8,6 @@ require_once P2_LIB_DIR . '/ThreadList.php'; require_once P2_LIB_DIR . '/Thread.php'; -require_once P2_LIB_DIR . '/FileCtl.php'; $_newthre_num = 0; $shinchaku_num = 0; Modified: p2ex/trunk/menu_i.php =================================================================== --- p2ex/trunk/menu_i.php 2010-01-05 14:48:56 UTC (rev 766) +++ p2ex/trunk/menu_i.php 2010-01-09 16:57:35 UTC (rev 767) @@ -300,7 +300,7 @@ <div id="login_info" class="panel" title="OCîñ"> <h2>FØ[U</h2> -<p><strong><?php echo $_login->user; ?></strong> - <?php echo date('Y/m/d (D) G:i:s'); ?></p> +<p><strong><?php echo $_login->user_u; ?></strong> - <?php echo date('Y/m/d (D) G:i:s'); ?></p> <?php if ($_conf['login_log_rec'] && $_conf['last_login_log_show']) { ?> <h2>OñÌOC</h2> <pre style="word-wrap:break-word;word-break:break-all"><?php Modified: p2ex/trunk/post.php =================================================================== --- p2ex/trunk/post.php 2010-01-05 14:48:56 UTC (rev 766) +++ p2ex/trunk/post.php 2010-01-09 16:57:35 UTC (rev 767) @@ -4,6 +4,7 @@ */ require_once './conf/conf.inc.php'; +require_once P2_LIB_DIR . '/P2KeyValueStore.php'; $_login->authorize(); // [UFØ @@ -76,22 +77,7 @@ } // }}} -// {{{ NbL[ÌÇÝÝ -$cookie_file = P2Util::cachePathForCookie($host); -if ($cookie_cont = FileCtl::file_read_contents($cookie_file)) { - $p2cookies = unserialize($cookie_cont); - if ($p2cookies['expires']) { - if (time() > strtotime($p2cookies['expires'])) { // úÀØêÈçjü - // echo "<p>úÀØêÌNbL[ðíµÜµ½</p>"; - unlink($cookie_file); - unset($cookie_cont, $p2cookies); - } - } -} - -// }}} - // µ½çÎÌlivedoorÚ]ÉÎBpostæðlivedoorÆ·éB $host = P2Util::adjustHostJbbs($host); @@ -170,44 +156,80 @@ } } +$post_id_suffix = $_login->user_u . P2Util::pathForHostBbs($host, $bbs); +$post_backup_id = 'backup:' . $post_id_suffix; +$post_config_id = 'config:' . $post_id_suffix; if (!empty($_POST['newthread'])) { + $post_backup_id .= 'new'; $ptitle = 'rep2 - VKXbhì¬'; } else { + $post_backup_id .= $key; $ptitle = 'rep2 - X«Ý'; } +// ÝèðÛ¶ +$post_store = P2Util::getPostDataStore(); +$post_store->set($post_config_id, array( + 'beres' => !empty($_REQUEST['beres']), + 'p2res' => !empty($_REQUEST['p2res']), +)); + //================================================================ // «Ý //================================================================ // «ÝðêIÉÛ¶ -$failed_post_file = P2Util::getFailedPostFilePath($host, $bbs, $key); -$cont = serialize($post_cache); -DataPhp::writeDataPhp($failed_post_file, $cont, $_conf['res_write_perm']); +$post_store->set($post_backup_id, $post_cache); // |XgÀs if (!empty($_POST['p2res']) && empty($_POST['newthread'])) { // ö®p2Å«Ý $posted = postIt2($host, $bbs, $key, $FROM, $mail, $MESSAGE); } else { + // cookie ÇÝÝ + if (!file_exists($_conf['cookie_file_path']) && + dirname($_conf['cookie_file_path']) != $_conf['cookie_dir']) + { + FileCtl::mkdir_for($_conf['cookie_file_path']); + } + + try { + $cookie_store = P2KeyValueStore::getStore($_conf['cookie_file_path'], + P2KeyValueStore::KVS_SERIALIZING); + } catch (Exception $e) { + p2die(get_class($e) . ': ' . $e->getMessage()); + } + + $cookie_key = $_login->user_u . '/' . P2Util::normalizeHostName($host); + if ($p2cookies = $cookie_store->get($cookie_key)) { + if (is_array($p2cookies)) { + if (array_key_exists('expires', $p2cookies)) { + // úÀØêÈçjü + if (time() > strtotime($p2cookies['expires'])) { + $cookie_store->delete($cookie_key); + $p2cookies = null; + } + } + } else { + $cookie_store->delete($cookie_key); + $p2cookies = null; + } + } else { + $p2cookies = null; + } + // ¼Ú«Ý $posted = postIt($host, $bbs, $key, $post); // cookie Û¶ - FileCtl::make_datafile($cookie_file, $_conf['p2_perm']); // ȯêζ¬ if ($p2cookies) { - $cookie_cont = serialize($p2cookies); + $cookie_store->set($cookie_key, $p2cookies); } - if ($cookie_cont) { - if (FileCtl::file_write_contents($cookie_file, $cookie_cont) === false) { - p2die('cannot write file.'); - } - } } // e¸sL^ðí -if ($posted && file_exists($failed_post_file)) { - unlink($failed_post_file); +if ($posted) { + $post_store->delete($post_backup_id); } //============================================= @@ -451,17 +473,20 @@ } else { $l = fgets($fp, 164000); - //echo $l ."<br>"; // for debug - $response_header_ht .= $l."<br>"; + //echo $l .'<br>'; // for debug + $response_header_ht .= $l . '<br>'; // NbL[L^ - if (preg_match("/Set-Cookie: (.+?)\r\n/", $l, $matches)) { - //echo "<p>".$matches[0]."</p>"; // - $cgroups = explode(";", $matches[1]); + if (preg_match('/Set-Cookie: (.+?)\\r\\n/', $l, $matches)) { + //echo '<p>' . $matches[0] . '</p>'; // + $cgroups = explode(';', $matches[1]); if ($cgroups) { foreach ($cgroups as $v) { - if (preg_match("/(.+)=(.*)/", $v, $m)) { + if (preg_match('/(.+)=(.*)/', $v, $m)) { $k = ltrim($m[1]); - if ($k != "path") { + if ($k != 'path') { + if (!$p2cookies) { + $p2cookies = array(); + } $p2cookies[$k] = $m[2]; } } @@ -470,17 +495,17 @@ if ($p2cookies) { unset($cookies_to_send); foreach ($p2cookies as $cname => $cvalue) { - if ($cname != "expires") { + if ($cname != 'expires') { $cookies_to_send .= " {$cname}={$cvalue};"; } } $newcookies = "Cookie:{$cookies_to_send}\r\n"; - $request = preg_replace("/Cookie: .*?\r\n/", $newcookies, $request); + $request = preg_replace('/Cookie: .*?\\r\\n/', $newcookies, $request); } // ]ͫݬ÷Æ»f - } elseif (preg_match("/^Location: /", $l, $matches)) { + } elseif (preg_match('/^Location: /', $l, $matches)) { $post_seikou = true; } if ($l == "\r\n") { @@ -540,12 +565,6 @@ */ function postIt2($host, $bbs, $key, $FROM, $mail, $MESSAGE) { - global $_conf; - - if (!is_dir($_conf['cookie_dir'])) { - FileCtl::mkdir_r($_conf['cookie_dir']); - } - if (P2Util::isHostBe2chNet($host) || !empty($_REQUEST['beres'])) { $beRes = true; } else { Modified: p2ex/trunk/post_form.php =================================================================== --- p2ex/trunk/post_form.php 2010-01-05 14:48:56 UTC (rev 766) +++ p2ex/trunk/post_form.php 2010-01-09 16:57:35 UTC (rev 767) @@ -24,7 +24,10 @@ $popup = isset($_GET['popup']) ? intval($_GET['popup']) : 0; $itaj = P2Util::getItaName($host, $bbs); -if (!$itaj) { $itaj = $bbs; } +if (!$itaj) { + $itaj = $bbs; +} +$itaj_hd = htmlspecialchars($itaj, ENT_QUOTES, 'Shift_JIS', false); $ttitle_en = isset($_GET['ttitle_en']) ? $_GET['ttitle_en'] : ''; $ttitle = (strlen($ttitle_en) > 0) ? base64_decode($ttitle_en) : ''; @@ -33,7 +36,7 @@ $key_idx = P2Util::idxDirOfHostBbs($host, $bbs) . $key . '.idx'; // tH[ÌIvVÇÝÝ -require_once P2_LIB_DIR . '/post_form_options.inc.php'; +include P2_LIB_DIR . '/post_form_options.inc.php'; // \¦wè if (!$_conf['ktai']) { @@ -44,28 +47,28 @@ // {{{ X§ÄÈç if (!empty($_GET['newthread'])) { - $ptitle = "{$itaj} - VKXbhì¬"; + $ptitle = "{$itaj_hd} - VKXbhì¬"; // machibbsAJBBS@µ½çÎ Èç if (P2Util::isHostMachiBbs($host) or P2Util::isHostJbbsShitaraba($host)) { - $submit_value = "VK«Ý"; + $submit_value = 'VK«Ý'; // 2chÈç } else { - $submit_value = "VKXbhì¬"; + $submit_value = 'VKXbhì¬'; } $htm['subject'] = <<<EOP <b><span{$class_ttitle}>^Cg</span></b>F<input type="text" name="subject"{$sub_size_at} value="{$hd['subject']}"><br> EOP; if ($_conf['ktai']) { - $htm['subject'] = "<a href=\"{$_conf['subject_php']}?host={$host}&bbs={$bbs}{$_conf['k_at_a']}\">{$itaj}</a><br>".$htm['subject']; + $htm['subject'] = "<a href=\"{$_conf['subject_php']}?host={$host}&bbs={$bbs}{$_conf['k_at_a']}\">{$itaj_hd}</a><br>".$htm['subject']; } - $newthread_hidden_ht = "<input type=\"hidden\" name=\"newthread\" value=\"1\">"; + $newthread_hidden_ht = '<input type="hidden" name="newthread" value="1">'; // }}} // {{{ «ÝÈç } else { - $ptitle = "{$itaj} - X«Ý"; + $ptitle = "{$itaj_hd} - X«Ý"; $submit_value = "«Þ"; Modified: p2ex/trunk/read_filter_k.php =================================================================== --- p2ex/trunk/read_filter_k.php 2010-01-05 14:48:56 UTC (rev 766) +++ p2ex/trunk/read_filter_k.php 2010-01-09 16:57:35 UTC (rev 767) @@ -21,8 +21,6 @@ /** * OñtB^lÇÝÝ */ -require_once P2_LIB_DIR . '/FileCtl.php'; - $cachefile = $_conf['pref_dir'] . '/p2_res_filter.txt'; $res_filter_cont = FileCtl::file_read_contents($cachefile); Modified: p2ex/trunk/subject.php =================================================================== --- p2ex/trunk/subject.php 2010-01-05 14:48:56 UTC (rev 766) +++ p2ex/trunk/subject.php 2010-01-09 16:57:35 UTC (rev 767) @@ -1129,11 +1129,11 @@ updateThreadTitleAborn($aborn_threads, $k); return true; }*/ - if ($re_method($v['word'], $subject)) { + if ($re_method($v['word'], $subject)) { updateThreadTitleAborn($aborn_threads, $k); return true; } - // 嶬¶ð³ + // 嶬¶ð³ } elseif ($v['ignorecase']) { if (stripos($subject, $v['word']) !== false) { updateThreadTitleAborn($aborn_threads, $k);