svnno****@sourc*****
svnno****@sourc*****
2010年 1月 13日 (水) 13:36:03 JST
Revision: 773 http://sourceforge.jp/projects/p2-php/svn/view?view=rev&revision=773 Author: rsk Date: 2010-01-13 13:36:03 +0900 (Wed, 13 Jan 2010) Log Message: ----------- expack: - rev.100113.1300. - å ã¹ã¬ãéãã¢ã³ã«ã¼ã¸ã®ãã¦ã¹ãªã¼ãã¼ã§ã¬ã¹è¡¨ç¤ºç¯å² (1, 1-10,1-100, ææ°50, å ¨é¨) ãæå®ãã¦éããããã¢ããã¡ãã¥ã¼ã表示ããããã«ããã - æ稿ãã©ã¼ã ãéãã¢ã³ã«ã¼ã®æååãrep2 1.8.xãå ¬å¼p2ã«ãããã¦ãæ¸è¾¼ãã«å¤æ´ã - P2KeyValueStoreãImageCache2ããªã¼ããã¼ãæ©æ§ã使ãããã«å¤æ´ã - ãã¼ã¸ã§ã³ã¢ããæã®èªåãã¤ã°ã¬ã¼ã·ã§ã³å¦çãæ¹è¯ã - ã³ãã³ãã©ã¤ã³çImageMagickã使ã£ãç»åãµã ãã¤ã«ä½æã失æããä¸å ·åãä¿®æ£ã - ãã®ä»ãã³ã¼ãã®ã¯ãªã¼ã³ã¢ããã Modified Paths: -------------- p2ex/trunk/conf/conf.inc.php p2ex/trunk/conf/conf_admin.inc.php p2ex/trunk/cookie.php p2ex/trunk/editpref.php p2ex/trunk/httpcmd.php p2ex/trunk/ic2.php p2ex/trunk/ic2_fitimage.php p2ex/trunk/ic2_getinfo.php p2ex/trunk/ic2_getter.php p2ex/trunk/ic2_manager.php p2ex/trunk/ic2_mkthumb.php p2ex/trunk/ic2_setrank.php p2ex/trunk/ic2_setter.php p2ex/trunk/ic2_viewtable.php p2ex/trunk/index.php p2ex/trunk/iv2.php p2ex/trunk/lib/HostCheck.php p2ex/trunk/lib/P2Client.php p2ex/trunk/lib/P2DataStore/AbstractDataStore.php p2ex/trunk/lib/P2DataStore/CookieStore.php p2ex/trunk/lib/P2DataStore/PostDataStore.php p2ex/trunk/lib/P2KeyValueStore/Iterator.php p2ex/trunk/lib/P2KeyValueStore.php p2ex/trunk/lib/P2Util.php p2ex/trunk/lib/ResHist.php p2ex/trunk/lib/Session.php p2ex/trunk/lib/ShowThreadK.php p2ex/trunk/lib/Thumbnailer/Common.php p2ex/trunk/lib/Thumbnailer/Gd.php p2ex/trunk/lib/Thumbnailer/Imagemagick.php p2ex/trunk/lib/Thumbnailer/Imagick.php p2ex/trunk/lib/bootstrap.php p2ex/trunk/lib/expack/ExpackLoader.php p2ex/trunk/lib/expack/ic2/DataObject/BlackList.php p2ex/trunk/lib/expack/ic2/DataObject/Common.php p2ex/trunk/lib/expack/ic2/DataObject/Errors.php p2ex/trunk/lib/expack/ic2/DataObject/Images.php p2ex/trunk/lib/expack/ic2/Thumbnailer.php p2ex/trunk/lib/expack/rss/getimage.inc.php p2ex/trunk/lib/menu.inc.php p2ex/trunk/lib/read_footer.inc.php p2ex/trunk/lib/read_footer_k.inc.php p2ex/trunk/lib/read_header.inc.php p2ex/trunk/lib/read_header_k.inc.php p2ex/trunk/lib/sb_footer.inc.php p2ex/trunk/lib/sb_footer_k.inc.php p2ex/trunk/lib/sb_header.inc.php p2ex/trunk/lib/sb_print.inc.php p2ex/trunk/lib/sb_print_k.inc.php p2ex/trunk/lib/sb_toolbar.inc.php p2ex/trunk/read_new.php p2ex/trunk/read_new_k.php p2ex/trunk/style/style_css.inc p2ex/trunk/style/subject_css.inc Added Paths: ----------- p2ex/trunk/js/motolspopup.js p2ex/trunk/lib/P2KeyValueStore/Codec/ p2ex/trunk/lib/P2KeyValueStore/Codec/Binary.php p2ex/trunk/lib/P2KeyValueStore/Codec/Compressing.php p2ex/trunk/lib/P2KeyValueStore/Codec/Default.php p2ex/trunk/lib/P2KeyValueStore/Codec/Interface.php p2ex/trunk/lib/P2KeyValueStore/Codec/Serializing.php p2ex/trunk/lib/P2KeyValueStore/Codec/ShiftJIS.php p2ex/trunk/lib/P2KeyValueStore/FunctionCache/ p2ex/trunk/lib/P2KeyValueStore/FunctionCache/Proxy.php p2ex/trunk/lib/P2KeyValueStore/FunctionCache.php p2ex/trunk/lib/P2KeyValueStore/Result.php p2ex/trunk/lib/Thumbnailer/ p2ex/trunk/lib/expack/ic2/DatabaseManager.php p2ex/trunk/lib/expack/ic2/ImageInfo.php p2ex/trunk/lib/expack/ic2/ParameterUtility.php p2ex/trunk/lib/expack/ic2/bootstrap.php p2ex/trunk/lib/migrators/ p2ex/trunk/lib/migrators/100113_1300.php p2ex/trunk/lib/migrators/yymmdd_hhmm.php Removed Paths: ------------- p2ex/trunk/lib/P2KeyValueStore/Binary.php p2ex/trunk/lib/P2KeyValueStore/Compressing.php p2ex/trunk/lib/P2KeyValueStore/Serializing.php p2ex/trunk/lib/P2KeyValueStore/ShiftJIS.php p2ex/trunk/lib/expack/ic2/Thumbnailer/ p2ex/trunk/lib/expack/ic2/buildimgcell.inc.php p2ex/trunk/lib/expack/ic2/findexec.inc.php p2ex/trunk/lib/expack/ic2/getvalidvalue.inc.php p2ex/trunk/lib/expack/ic2/loadconfig.inc.php p2ex/trunk/lib/expack/ic2/managedb.inc.php -------------- next part -------------- Modified: p2ex/trunk/conf/conf.inc.php =================================================================== --- p2ex/trunk/conf/conf.inc.php 2010-01-13 00:37:02 UTC (rev 772) +++ p2ex/trunk/conf/conf.inc.php 2010-01-13 04:36:03 UTC (rev 773) @@ -7,7 +7,7 @@ // o[Wîñ $_conf = array( 'p2version' => '1.7.29+1.8.x', // rep2Ìo[W - 'p2expack' => '100105.2345', // g£pbNÌo[W + 'p2expack' => '100113.1300', // g£pbNÌo[W 'p2name' => 'expack', // rep2̼O ); @@ -136,9 +136,6 @@ define('P2_OS_WINDOWS', 0); } - $DIR_SEP = DIRECTORY_SEPARATOR; - $PATH_SEP = PATH_SEPARATOR; - // koCgè // mbstring.script_encoding = SJIS-win ¾Æ // "\0", "\x00" È~ªJbg³êéÌÅAchr()Öðg¤ @@ -156,44 +153,43 @@ define('P2_CONF_DIR', dirname(__FILE__)); // __DIR__ @php-5.3 define('P2_BASE_DIR', dirname(P2_CONF_DIR)); - $P2_BASE_DIR_S = P2_BASE_DIR . $DIR_SEP; // î{IÈ@\ðñ·é·éCu - define('P2_LIB_DIR', $P2_BASE_DIR_S . 'lib'); + define('P2_LIB_DIR', P2_BASE_DIR . '/lib'); // ¨Ü¯IÈ@\ðñ·é·éCu - define('P2EX_LIB_DIR', $P2_BASE_DIR_S . 'lib' . $DIR_SEP . 'expack'); + define('P2EX_LIB_DIR', P2_BASE_DIR . '/lib/expack'); // X^CV[g - define('P2_STYLE_DIR', $P2_BASE_DIR_S . 'style'); + define('P2_STYLE_DIR', P2_BASE_DIR . '/style'); // XL - define('P2_SKIN_DIR', $P2_BASE_DIR_S . 'skin'); - define('P2_USER_SKIN_DIR', $P2_BASE_DIR_S . 'user_skin'); + define('P2_SKIN_DIR', P2_BASE_DIR . '/skin'); + define('P2_USER_SKIN_DIR', P2_BASE_DIR . '/user_skin'); // PEARCXg[fBNgAõpXÉÇÁ³êé - define('P2_PEAR_DIR', P2_BASE_DIR . DIRECTORY_SEPARATOR . 'includes'); + define('P2_PEAR_DIR', P2_BASE_DIR . '/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_S . 'lib' . $DIR_SEP . 'pear_hack'); + define('P2_PEAR_HACK_DIR', P2_BASE_DIR . '/lib/pear_hack'); } // R}hCc[ - define('P2_CLI_DIR', $P2_BASE_DIR_S . 'cli'); + define('P2_CLI_DIR', P2_BASE_DIR . '/cli'); // õpXðZbg $include_path = ''; if (defined('P2_PEAR_HACK_DIR')) { - $include_path .= P2_PEAR_HACK_DIR . $PATH_SEP; + $include_path .= P2_PEAR_HACK_DIR . PATH_SEPARATOR; } if (is_dir(P2_PEAR_DIR)) { - $include_path .= P2_PEAR_DIR . $PATH_SEP; + $include_path .= P2_PEAR_DIR . PATH_SEPARATOR; } else { $paths = array(); - foreach (explode($PATH_SEP, get_include_path()) as $dir) { + foreach (explode(PATH_SEPARATOR, get_include_path()) as $dir) { if (is_dir($dir)) { $dir = realpath($dir); if ($dir != P2_BASE_DIR) { @@ -202,21 +198,18 @@ } } if (count($paths)) { - $include_path .= implode($PATH_SEP, array_unique($paths)) . $PATH_SEP; + $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 . $DIR_SEP; - $P2_LIB_DIR_S = P2_LIB_DIR . $DIR_SEP; - // }}} // {{{ «`FbNÆfobO // [eBeBðÇÝÞ - include $P2_LIB_DIR_S . 'P2Util.php'; - include $P2_LIB_DIR_S . 'p2util.inc.php'; + include P2_LIB_DIR . '/P2Util.php'; + include P2_LIB_DIR . '/p2util.inc.php'; // ®ì«ðmF (vð½µÄ¢éÈçRgAEgÂ) p2checkenv(__LINE__); @@ -251,7 +244,7 @@ // {{{ ÇÒpÝèetc. // ÇÒpÝèðÇÝÝ - include $P2_CONF_DIR_S . 'conf_admin.inc.php'; + include P2_CONF_DIR . '/conf_admin.inc.php'; // fBNgÌâÎpX» $_conf['data_dir'] = p2_realpath($_conf['data_dir']); @@ -260,24 +253,24 @@ $_conf['pref_dir'] = p2_realpath($_conf['pref_dir']); // ÇpÛ¶fBNg - $_conf['admin_dir'] = $_conf['data_dir'] . $DIR_SEP . 'admin'; + $_conf['admin_dir'] = $_conf['data_dir'] . '/admin'; // cache Û¶fBNg // 2005/06/29 $_conf['pref_dir'] . '/p2_cache' æèÏX - $_conf['cache_dir'] = $_conf['data_dir'] . $DIR_SEP . 'cache'; + $_conf['cache_dir'] = $_conf['data_dir'] . '/cache'; // Cookie Û¶fBNg // 2008/09/09 $_conf['pref_dir'] . '/p2_cookie' æèÏX - $_conf['cookie_dir'] = $_conf['data_dir'] . $DIR_SEP . 'cookie'; + $_conf['cookie_dir'] = $_conf['data_dir'] . '/cookie'; // RpC³ê½ev[gÌÛ¶fBNg - $_conf['compile_dir'] = $_conf['data_dir'] . $DIR_SEP . 'compile'; + $_conf['compile_dir'] = $_conf['data_dir'] . '/compile'; // ZbVf[^Û¶fBNg - $_conf['session_dir'] = $_conf['data_dir'] . $DIR_SEP . 'session'; + $_conf['session_dir'] = $_conf['data_dir'] . '/session'; // e|fBNg - $_conf['tmp_dir'] = $_conf['data_dir'] . $DIR_SEP . 'tmp'; + $_conf['tmp_dir'] = $_conf['data_dir'] . '/tmp'; // o[WIDðñdøpâqAhL gàÉßÞ½ßÌÏ $_conf['p2_version_id'] = P2_VERSION_ID; @@ -293,34 +286,38 @@ // }}} // {{{ ÏÝè - $pref_dir_s = $_conf['pref_dir'] . $DIR_SEP; + $preferences = array( + 'favita_brd' => 'p2_favita.brd', // ¨CÉ (brd) + 'favlist_idx' => 'p2_favlist.idx', // ¨CÉX (idx) + 'recent_idx' => 'p2_recent.idx', // ÅßÇñ¾X (idx) + 'palace_idx' => 'p2_palace.idx', // XÌa° (idx) + 'res_hist_idx' => 'p2_res_hist.idx', // «ÝO (idx) + 'res_hist_dat' => 'p2_res_hist.dat', // «ÝOt@C (dat) + 'res_hist_dat_php' => 'p2_res_hist.dat.php', // «ÝOt@C (f[^PHP) + 'idpw2ch_php' => 'p2_idpw2ch.php', // 2ch IDFØÝèt@C (f[^PHP) + 'sid2ch_php' => 'p2_sid2ch.php', // 2ch IDFØZbVIDL^t@C (f[^PHP) + 'auth_user_file' => 'p2_auth_user.php', // FØ[UÝèt@C(f[^PHP) + 'auth_imodeid_file' => 'p2_auth_imodeid.php', // docomo i[hIDFØt@C (f[^PHP) + 'auth_docomo_file' => 'p2_auth_docomo.php', // docomo [»¢ÔFØt@C (f[^PHP) + 'auth_ez_file' => 'p2_auth_ez.php', // EZweb TuXNCoIDFØt@C (f[^PHP) + 'auth_jp_file' => 'p2_auth_jp.php', // SoftBank [VAÔFØt@C (f[^PHP) + 'login_log_file' => 'p2_login.log.php', // OCð (f[^PHP) + 'login_failed_log_file' => 'p2_login_failed.dat.php', // OC¸sð (f[^PHP) + ); + foreach ($preferences as $k => $v) { + $_conf[$k] = $_conf['pref_dir'] . '/' . $v; + } - $_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_path'] = $_conf['pref_dir'] . '/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_db_path'] = $_conf['cookie_dir'] . $DIR_SEP . 'p2_cookies.sqlite3'; - $_conf['post_db_path'] = $_conf['cookie_dir'] . $DIR_SEP . 'p2_post_data.sqlite3'; + $_conf['cookie_db_path'] = $_conf['db_dir'] . '/p2_cookies.sqlite3'; + $_conf['post_db_path'] = $_conf['db_dir'] . '/p2_post_data.sqlite3'; + $_conf['hostcheck_db_path'] = $_conf['db_dir'] . '/p2_hostcheck_cache.sqlite3'; // â³ if ($_conf['expack.use_pecl_http'] && !extension_loaded('http')) { @@ -336,7 +333,7 @@ // }}} - include $P2_LIB_DIR_S . 'bootstrap.php'; + include P2_LIB_DIR . '/bootstrap.php'; } // }}} @@ -381,16 +378,13 @@ } } - // Z[t[h - if (ini_get('safe_mode')) { - p2die('Z[t[hÅ®ì·éPHPÅÍg¦Ü¹ñB'); - } - - // register_globals, magic_quotes_gpc, mbstring.encoding_translation + // Lø¾Æ®ìµÈ¢php.inifBNeBu $directives = array( + 'safe_mode', 'register_globals', 'magic_quotes_gpc', 'mbstring.encoding_translation', + 'session.cookie_httponly', ); foreach ($directives as $directive) { if (ini_get($directive)) { @@ -438,7 +432,66 @@ } // }}} +// {{{ p2checkmigration() +/** + * }CO[VÌKvª é©Ç¤©ð`FbN + * + * @param string $config_version + * @return array + */ +function p2checkmigration($config_version) +{ + // "yymmdd.hhmm" `®Ì}CO[VªKvÈÏXÌ Á½o[WÔÌzñ + // lÍj[N©Â¸É\[g³êĢȯêÎÈçÈ¢ + $versions = array( + '100113.1300', + ); + + $migrators = array(); + $found = false; + + foreach ($versions as $version) { + if ($found || version_compare($config_version, $version, '<')) { + $found = true; + $migrator_name = str_replace('.', '_', $version); + $migrator_func = 'p2_migrate_' . $migrator_name; + $migrator_file = '/migrators/' . $migrator_name . '.php'; + $migrators[$migrator_func] = $migrator_file; + } + } + + if ($found) { + return $migrators; + } else { + return null; + } +} + +// }}} +// {{{ p2migrate() + +/** + * }CO[VðÀs + * + * @param array $user_conf â[U[Ýè + * @param array $migrators }CO[VÖÌXg + * @return array Vµ¢[U[Ýè + */ +function p2migrate(array $user_conf, array $migrators) +{ + global $_conf; + + foreach ($migrators as $migrator_func => $migrator_file) { + include P2_LIB_DIR . $migrator_file; + $user_conf = $migrator_func($_conf, $user_conf); + } + + return $user_conf; +} + +// }}} + /* * Local Variables: * mode: php Modified: p2ex/trunk/conf/conf_admin.inc.php =================================================================== --- p2ex/trunk/conf/conf_admin.inc.php 2010-01-13 00:37:02 UTC (rev 772) +++ p2ex/trunk/conf/conf_admin.inc.php 2010-01-13 04:36:03 UTC (rev 773) @@ -22,6 +22,8 @@ // úÝèf[^Û¶fBNg $_conf['pref_dir'] = "./data"; // ("./data") +// SQLite3f[^x[XÛ¶fBNg +$_conf['db_dir'] = "./data/db"; // ("./data/db") // «IÉÍȺÌæ¤Éµ½¢\è // $_conf['dat_dir'] = $_conf['data_dir'] . '/dat'; Modified: p2ex/trunk/cookie.php =================================================================== --- p2ex/trunk/cookie.php 2010-01-13 00:37:02 UTC (rev 772) +++ p2ex/trunk/cookie.php 2010-01-13 04:36:03 UTC (rev 773) @@ -18,11 +18,9 @@ {$return_path}?check_regist_cookie=1&regist_cookie={$_REQUEST['regist_cookie']}{$_conf['k_at_a']} EOP; - $next_url = str_replace('&', '&', $next_url); -$sid_q = defined('SID') ? '&'.strip_tags(SID) : ''; -header('Location: '.$next_url.$sid_q); +header('Location: '.$next_url); exit; /* Modified: p2ex/trunk/editpref.php =================================================================== --- p2ex/trunk/editpref.php 2010-01-13 00:37:02 UTC (rev 772) +++ p2ex/trunk/editpref.php 2010-01-13 04:36:03 UTC (rev 773) @@ -381,10 +381,9 @@ if (file_exists($file)) { $filemtime = filemtime($file); $date = date('Y/m/d G:i:s', $filemtime); - $b = filesize($file)/1024; - $kb = round($b, 0); + $kib = round(filesize($file) / 1024, 0); $url = 'read_new.php?cview=1' . $ai . '&filemtime=' . $filemtime . $_conf['k_at_a']; - $links[] = '<a href="'.$url.'" target="read">'.$date.'</a> '.$kb.'KB'; + $links[] = '<a href="' . $url . '" target="read">' . $date . '</a> ' . $kib . 'KiB'; } } if (!empty($links)) { Modified: p2ex/trunk/httpcmd.php =================================================================== --- p2ex/trunk/httpcmd.php 2010-01-13 00:37:02 UTC (rev 772) +++ p2ex/trunk/httpcmd.php 2010-01-13 04:36:03 UTC (rev 773) @@ -235,7 +235,9 @@ case 'ic2': if (isset($_REQUEST['switch'])) { - require_once P2EX_LIB_DIR . '/ic2/Switch.php'; + if (!class_exists('IC2_Switch', false)) { + include P2EX_LIB_DIR . '/ic2/Switch.php'; + } $switch = (bool)$_REQUEST['switch']; if (IC2_Switch::set($switch, !empty($_REQUEST['mobile']))) { if ($switch) { Modified: p2ex/trunk/ic2.php =================================================================== --- p2ex/trunk/ic2.php 2010-01-13 00:37:02 UTC (rev 772) +++ p2ex/trunk/ic2.php 2010-01-13 04:36:03 UTC (rev 773) @@ -19,14 +19,8 @@ // {{{ ú» // CuÇÝÝ -require_once 'PEAR.php'; -require_once 'DB/DataObject.php'; require_once 'HTTP/Client.php'; -require_once P2EX_LIB_DIR . '/ic2/findexec.inc.php'; -require_once P2EX_LIB_DIR . '/ic2/loadconfig.inc.php'; -require_once P2EX_LIB_DIR . '/ic2/DataObject/Common.php'; -require_once P2EX_LIB_DIR . '/ic2/DataObject/Images.php'; -require_once P2EX_LIB_DIR . '/ic2/Thumbnailer.php'; +require_once P2EX_LIB_DIR . '/ic2/bootstrap.php'; // ó¯t¯éMIME^Cv $mimemap = array('image/jpeg' => '.jpg', 'image/png' => '.png', 'image/gif' => '.gif'); @@ -419,10 +413,7 @@ } else { $clamscan = 'clamscan'; } - if (findexec($clamscan, $searchpath)) { - if ($searchpath) { - $clamscan = $searchpath . DIRECTORY_SEPARATOR . $clamscan; - } + if ($clamscan = ic2_findexec($clamscan, $searchpath)) { $scan_command = $clamscan . ' --stdout ' . escapeshellarg(realpath($tmpfile)); $scan_result = @exec($scan_command, $scan_stdout, $scan_result); if ($scan_result == 1) { @@ -818,7 +809,6 @@ } $k_at_a = str_replace('&', '&', $_conf['k_at_a']); - $sid_at_a = str_replace('&', '&', $_conf['sid_at_a']); $setrank_url = "ic2.php?{$img_q}&t={$thumb}&r=0{$k_at_a}"; $flexy->setData('stars', $stars); @@ -833,7 +823,7 @@ $link = $path; } $r = ($ini['General']['redirect'] == 1) ? 1 : 2; - $preview = "{$_SERVER['SCRIPT_NAME']}?o=1&r={$r}&t={$t}&{$img_q}{$k_at_a}{$sid_at_a}"; + $preview = "{$_SERVER['SCRIPT_NAME']}?o=1&r={$r}&t={$t}&{$img_q}{$k_at_a}"; $flexy->setData('preview', $preview); $flexy->setData('link', $link); $flexy->setData('info', null); Modified: p2ex/trunk/ic2_fitimage.php =================================================================== --- p2ex/trunk/ic2_fitimage.php 2010-01-13 00:37:02 UTC (rev 772) +++ p2ex/trunk/ic2_fitimage.php 2010-01-13 04:36:03 UTC (rev 773) @@ -6,8 +6,7 @@ // {{{ p2î{ÝèÇÝÝ&FØ require_once './conf/conf.inc.php'; -require_once P2EX_LIB_DIR . '/ic2/DataObject/Images.php'; -require_once P2EX_LIB_DIR . '/ic2/Thumbnailer.php'; +require_once P2EX_LIB_DIR . '/ic2/bootstrap.php'; $_login->authorize(); Modified: p2ex/trunk/ic2_getinfo.php =================================================================== --- p2ex/trunk/ic2_getinfo.php 2010-01-13 00:37:02 UTC (rev 772) +++ p2ex/trunk/ic2_getinfo.php 2010-01-13 04:36:03 UTC (rev 773) @@ -29,13 +29,7 @@ } // CuÇÝÝ -require_once 'PEAR.php'; -require_once 'DB.php'; -require_once 'DB/DataObject.php'; -require_once P2EX_LIB_DIR . '/ic2/loadconfig.inc.php'; -require_once P2EX_LIB_DIR . '/ic2/DataObject/Common.php'; -require_once P2EX_LIB_DIR . '/ic2/DataObject/Images.php'; -require_once P2EX_LIB_DIR . '/ic2/Thumbnailer.php'; +require_once P2EX_LIB_DIR . '/ic2/bootstrap.php'; // }}} // {{{ execute Modified: p2ex/trunk/ic2_getter.php =================================================================== --- p2ex/trunk/ic2_getter.php 2010-01-13 00:37:02 UTC (rev 772) +++ p2ex/trunk/ic2_getter.php 2010-01-13 04:36:03 UTC (rev 773) @@ -22,10 +22,7 @@ require_once 'HTML/QuickForm.php'; require_once 'HTML/QuickForm/Renderer/ObjectFlexy.php'; require_once 'HTML/Template/Flexy.php'; -require_once P2EX_LIB_DIR . '/ic2/loadconfig.inc.php'; -require_once P2EX_LIB_DIR . '/ic2/DataObject/Common.php'; -require_once P2EX_LIB_DIR . '/ic2/DataObject/Images.php'; -require_once P2EX_LIB_DIR . '/ic2/Thumbnailer.php'; +require_once P2EX_LIB_DIR . '/ic2/bootstrap.php'; // |bvAbvEChEH if (empty($_GET['popup'])) { Modified: p2ex/trunk/ic2_manager.php =================================================================== --- p2ex/trunk/ic2_manager.php 2010-01-13 00:37:02 UTC (rev 772) +++ p2ex/trunk/ic2_manager.php 2010-01-13 04:36:03 UTC (rev 773) @@ -19,10 +19,8 @@ // {{{ ú» // CuÇÝÝ -require_once 'PEAR.php'; -require_once 'DB.php'; require_once 'HTML/Template/Flexy.php'; -require_once P2EX_LIB_DIR . '/ic2/loadconfig.inc.php'; +require_once P2EX_LIB_DIR . '/ic2/bootstrap.php'; // ÝèÇÝÝ $ini = ic2_loadconfig(); @@ -52,8 +50,6 @@ case 'dropZero': case 'dropAborn': - require_once P2EX_LIB_DIR . '/ic2/managedb.inc.php'; - if ($_POST['action'] == 'dropZero') { $where = $db->quoteIdentifier('rank') . ' = 0'; if (isset($_POST['dropZeroLimit'])) { @@ -89,7 +85,7 @@ break; } $target = $result[0]; - $removed_files = manageDB_remove($target, $to_blacklist); + $removed_files = IC2_DatabaseManager::remove($target, $to_blacklist); $flexy->setData('toBlackList', $to_blacklist); break; Modified: p2ex/trunk/ic2_mkthumb.php =================================================================== --- p2ex/trunk/ic2_mkthumb.php 2010-01-13 00:37:02 UTC (rev 772) +++ p2ex/trunk/ic2_mkthumb.php 2010-01-13 04:36:03 UTC (rev 773) @@ -21,11 +21,7 @@ exit; }*/ -require_once 'PEAR.php'; -require_once 'DB/DataObject.php'; -require_once P2EX_LIB_DIR . '/ic2/loadconfig.inc.php'; -require_once P2EX_LIB_DIR . '/ic2/DataObject/Common.php'; -require_once P2EX_LIB_DIR . '/ic2/Thumbnailer.php'; +require_once P2EX_LIB_DIR . '/ic2/bootstrap.php'; // {{{ NGXgp[^Ì Modified: p2ex/trunk/ic2_setrank.php =================================================================== --- p2ex/trunk/ic2_setrank.php 2010-01-13 00:37:02 UTC (rev 772) +++ p2ex/trunk/ic2_setrank.php 2010-01-13 04:36:03 UTC (rev 773) @@ -39,12 +39,7 @@ } // CuÇÝÝ -require_once 'PEAR.php'; -require_once 'DB.php'; -require_once 'DB/DataObject.php'; -require_once P2EX_LIB_DIR . '/ic2/loadconfig.inc.php'; -require_once P2EX_LIB_DIR . '/ic2/DataObject/Common.php'; -require_once P2EX_LIB_DIR . '/ic2/DataObject/Images.php'; +require_once P2EX_LIB_DIR . '/ic2/bootstrap.php'; // }}} // {{{ execute @@ -70,12 +65,11 @@ if ($remove) { global $_info_msg_ht; - require_once P2EX_LIB_DIR . '/ic2/managedb.inc.php'; $orig_info_msg_ht = $_info_msg_ht; $_info_msg_ht = ''; - $removed_files = manageDB_remove(array($finder->id), $rank < 0); + $removed_files = IC2_DatabaseManager::remove(array($finder->id), $rank < 0); if ($code != 0 && $_info_msg_ht === '') { $code = 1; } else { Modified: p2ex/trunk/ic2_setter.php =================================================================== --- p2ex/trunk/ic2_setter.php 2010-01-13 00:37:02 UTC (rev 772) +++ p2ex/trunk/ic2_setter.php 2010-01-13 04:36:03 UTC (rev 773) @@ -19,10 +19,7 @@ // {{{ CuÇÝÝ require_once 'HTML/Template/Flexy.php'; -require_once P2EX_LIB_DIR . '/ic2/loadconfig.inc.php'; -require_once P2EX_LIB_DIR . '/ic2/DataObject/Common.php'; -require_once P2EX_LIB_DIR . '/ic2/DataObject/Images.php'; -require_once P2EX_LIB_DIR . '/ic2/Thumbnailer.php'; +require_once P2EX_LIB_DIR . '/ic2/bootstrap.php'; // }}} // {{{ config Modified: p2ex/trunk/ic2_viewtable.php =================================================================== --- p2ex/trunk/ic2_viewtable.php 2010-01-13 00:37:02 UTC (rev 772) +++ p2ex/trunk/ic2_viewtable.php 2010-01-13 04:36:03 UTC (rev 773) @@ -19,12 +19,8 @@ // {{{ ú» // CuÇÝÝ -require_once 'PEAR.php'; -require_once 'DB/DataObject.php'; require_once 'HTML/Template/Flexy.php'; -require_once P2EX_LIB_DIR . '/ic2/findexec.inc.php'; -require_once P2EX_LIB_DIR . '/ic2/loadconfig.inc.php'; -require_once P2EX_LIB_DIR . '/ic2/DataObject/Common.php'; +require_once P2EX_LIB_DIR . '/ic2/bootstrap.php'; // }}} // {{{ ÝèÆÁ @@ -39,13 +35,11 @@ $mode = $_REQUEST['table']; switch ($mode) { case 'errlog': - require_once P2EX_LIB_DIR . '/ic2/DataObject/Errors.php'; $table = new IC2_DataObject_Errors; $table->orderBy('occured ASC'); $title = 'G[O'; break; case 'blacklist': - require_once P2EX_LIB_DIR . '/ic2/DataObject/BlackList.php'; $table = new IC2_DataObject_BlackList; $table->orderBy('uri ASC'); $title = 'ubNXg'; @@ -99,11 +93,11 @@ switch ($mode) { case 'errlog': $flexy->setData('data_renderer_errlog', TRUE); - $flexy->setData('data', ic2dumptable_errlog($table)); + $flexy->setData('data', ic2_dump_table_errlog($table)); break; case 'blacklist': $flexy->setData('data_renderer_blacklist', TRUE); - $flexy->setData('data', ic2dumptable_blacklist($table)); + $flexy->setData('data', ic2_dump_table_blacklist($table)); break; } } @@ -114,12 +108,12 @@ // }}} // {{{ Ö -// {{{ ic2dumptable_errlog() +// {{{ ic2_dump_table_errlog() /** * G[Oðæ¾·é */ -function ic2dumptable_errlog($dbdo) +function ic2_dump_table_errlog($dbdo) { $data = array(); while ($dbdo->fetch()) { @@ -134,12 +128,12 @@ } // }}} -// {{{ ic2dumptable_blacklist() +// {{{ ic2_dump_table_blacklist() /** * ubNXgðæ¾·é */ -function ic2dumptable_blacklist($dbdo) +function ic2_dump_table_blacklist($dbdo) { $data = array(); while ($dbdo->fetch()) { Modified: p2ex/trunk/index.php =================================================================== --- p2ex/trunk/index.php 2010-01-13 00:37:02 UTC (rev 772) +++ p2ex/trunk/index.php 2010-01-13 04:36:03 UTC (rev 773) @@ -30,7 +30,7 @@ //========================================================= // urlwèª êÎA»ÌÜÜXbhÇÝÖòη if (!empty($_GET['url']) || !empty($_GET['nama_url'])) { - header('Location: '.$me_dir_url.'/read.php?'.$_SERVER['QUERY_STRING']); + header('Location: '.$me_dir_url . '/read.php?' . $_SERVER['QUERY_STRING']); exit; } if ($_conf['iphone']) { @@ -47,7 +47,7 @@ $title_page = "title.php"; if (!empty($_GET['url']) || !empty($_GET['nama_url'])) { - $htm['read_page'] = "read.php?".$_SERVER['QUERY_STRING']; + $htm['read_page'] = 'read.php?' . $_SERVER['QUERY_STRING']; } else { if (!empty($_conf['first_page'])) { $htm['read_page'] = $_conf['first_page']; Modified: p2ex/trunk/iv2.php =================================================================== --- p2ex/trunk/iv2.php 2010-01-13 00:37:02 UTC (rev 772) +++ p2ex/trunk/iv2.php 2010-01-13 04:36:03 UTC (rev 773) @@ -44,25 +44,14 @@ // {{{ ú» // CuÇÝÝ -require_once 'PEAR.php'; require_once 'Cache.php'; require_once 'Cache/Function.php'; -require_once 'DB.php'; -require_once 'DB/DataObject.php'; require_once 'HTML/QuickForm.php'; require_once 'HTML/QuickForm/Renderer/ObjectFlexy.php'; require_once 'HTML/Template/Flexy.php'; require_once 'HTML/Template/Flexy/Element.php'; -require_once P2EX_LIB_DIR . '/ic2/loadconfig.inc.php'; -require_once P2EX_LIB_DIR . '/ic2/DataObject/Common.php'; -require_once P2EX_LIB_DIR . '/ic2/DataObject/Images.php'; -require_once P2EX_LIB_DIR . '/ic2/Thumbnailer.php'; +require_once P2EX_LIB_DIR . '/ic2/bootstrap.php'; require_once P2EX_LIB_DIR . '/ic2/QuickForm/Rules.php'; -require_once P2EX_LIB_DIR . '/ic2/EditForm.php'; -require_once P2EX_LIB_DIR . '/ic2/managedb.inc.php'; -require_once P2EX_LIB_DIR . '/ic2/getvalidvalue.inc.php'; -require_once P2EX_LIB_DIR . '/ic2/buildimgcell.inc.php'; -require_once P2EX_LIB_DIR . '/ic2/Matrix.php'; // }}} // {{{ config @@ -337,16 +326,16 @@ // Ø $qf->validate(); $sv = $qf->getSubmitValues(); -$page = getValidValue('page', $_defaults['page'], 'intval'); -$cols = getValidValue('cols', $_defaults['cols'], 'intval'); -$rows = getValidValue('rows', $_defaults['rows'], 'intval'); -$order = getValidValue('order', $_defaults['order']); -$sort = getValidValue('sort', $_defaults['sort'] ); -$field = getValidValue('field', $_defaults['field']); -$key = getValidValue('key', $_defaults['key']); -$threshold = getValidValue('threshold', $_defaults['threshold'], 'intval'); -$compare = getValidValue('compare', $_defaults['compare']); -$mode = getValidValue('mode', $_defaults['mode'], 'intval'); +$page = IC2_ParameterUtility::getValidValue('page', $_defaults['page'], 'intval'); +$cols = IC2_ParameterUtility::getValidValue('cols', $_defaults['cols'], 'intval'); +$rows = IC2_ParameterUtility::getValidValue('rows', $_defaults['rows'], 'intval'); +$order = IC2_ParameterUtility::getValidValue('order', $_defaults['order']); +$sort = IC2_ParameterUtility::getValidValue('sort', $_defaults['sort'] ); +$field = IC2_ParameterUtility::getValidValue('field', $_defaults['field']); +$key = IC2_ParameterUtility::getValidValue('key', $_defaults['key']); +$threshold = IC2_ParameterUtility::getValidValue('threshold', $_defaults['threshold'], 'intval'); +$compare = IC2_ParameterUtility::getValidValue('compare', $_defaults['compare']); +$mode = IC2_ParameterUtility::getValidValue('mode', $_defaults['mode'], 'intval'); // gÑpɲ® if ($_conf['ktai']) { @@ -477,14 +466,14 @@ // êÅp[^ÏX case 1: // NðÏX - $newrank = intoRange($_POST['setrank'], -1, 5); - manageDB_setRank($target, $newrank); + $newrank = IC2_ParameterUtility::intoRange($_POST['setrank'], -1, 5); + IC2_DatabaseManager::setRank($target, $newrank); // ðÇÁ if (!empty($_POST['addmemo'])) { $newmemo = get_magic_quotes_gpc() ? stripslashes($_POST['addmemo']) : $_POST['addmemo']; $newmemo = $icdb->uniform($newmemo, 'CP932'); if ($newmemo !== '') { - manageDB_addMemo($target, $newmemo); + IC2_DatabaseManager::addMemo($target, $newmemo); } } break; @@ -520,13 +509,14 @@ // îñðXV if (count($updated) > 0) { - manageDB_update($updated); + IC2_DatabaseManager::update($updated); } // íiubNXgèj if (count($removed) > 0) { foreach ($removed as $id => $to_blacklist) { - $removed_files = array_merge($removed_files, manageDB_remove(array($id), $to_blacklist)); + $removed_files = array_merge($removed_files, + IC2_DatabaseManager::remove(array($id), $to_blacklist)); } if ($to_blacklist) { if ($no_blacklist) { @@ -549,7 +539,8 @@ } elseif ($mode == 1 && isset($_POST['edit_remove']) && !empty($_POST['change'])) { $target = array_unique(array_map('intval', $_POST['change'])); $to_blacklist = !empty($_POST['edit_toblack']); - $removed_files = array_merge($removed_files, manageDB_remove($target, $to_blacklist)); + $removed_files = array_merge($removed_files, + IC2_DatabaseManager::remove($target, $to_blacklist)); $flexy->setData('toBlackList', $to_blacklist); } @@ -795,7 +786,7 @@ } else { $k_backto = ''; } - $sid_at_a = str_replace('&', '&', $_conf['sid_at_a']); + while ($icdb->fetch()) { // õÊðzñɵA_OpÌvfðtÁ // zñǤµÈç+ZqÅvfðÇÁÅ«é @@ -818,7 +809,7 @@ // \¦pÏðÝè if ($enable_cache) { - $add = $cache->call('ic2_image_extra_info', $img); + $add = $cache->call('IC2_ImageInfo::getExtraInfo', $img); if ($mode == 1) { $chk = IC2_EditForm::imgChecker($img); // ärIy¢ÌÅLbV µÈ¢ $add += $chk; @@ -827,7 +818,7 @@ $add += $mng; } } else { - $add = ic2_image_extra_info($img); + $add = IC2_ImageInfo::getExtraInfo($img); if ($mode == 1) { $chk = IC2_EditForm::imgChecker($img); $add += $chk; @@ -841,7 +832,8 @@ $add['thumb_k'] = $add['thumb'] = 'img/ic_removed.png'; $add['t_width'] = $add['t_height'] = 32; $to_blacklist = false; - $removed_files = array_merge($removed_files, manageDB_remove(array($img['id'], $to_blacklist))); + $removed_files = array_merge($removed_files, + IC2_DatabaseManager::remove(array($img['id'], $to_blacklist))); $flexy->setData('toBlackList', $to_blacklist); } else { if (!file_exists($add['thumb'])) { @@ -852,7 +844,6 @@ } else { $add['thumb'] .= '&uri=' . rawurlencode($img['uri']); } - $add['thumb'] .= $sid_at_a; } if ($_conf['ktai']) { $add['thumb_k'] = 'ic2.php?r=0&t=2'; @@ -861,14 +852,14 @@ } else { $add['thumb_k'] .= '&uri=' . rawurlencode($img['uri']); } - $add['thumb_k'] .= $k_backto . $sid_at_a; + $add['thumb_k'] .= $k_backto; } } $item = array_merge($img, $add, $status); // Exifîñðæ¾ if ($show_exif && file_exists($add['src']) && $img['mime'] == 'image/jpeg') { - $item['exif'] = $enable_cache ? $cache->call('ic2_read_exif', $add['src']) : ic2_read_exif($add['src']); + $item['exif'] = $enable_cache ? $cache->call('IC2_ImageInfo::getExifData', $add['src']) : IC2_ImageInfo::getExifData($add['src']); } else { $item['exif'] = null; } Added: p2ex/trunk/js/motolspopup.js =================================================================== --- p2ex/trunk/js/motolspopup.js (rev 0) +++ p2ex/trunk/js/motolspopup.js 2010-01-13 04:36:03 UTC (rev 773) @@ -0,0 +1,76 @@ +/** + * rep2expack - XÌ\¦ÍÍðwèµÄ³XðJ|bvAbvð\¦/ñ\¦·é + */ + +var _MOTOLSPOPUP_PARAMETERS = [ + { 'label': '>>1', 'parameter': '1' }, + { 'label': '1-10', 'parameter': '1-10' }, + { 'label': '1-100', 'parameter': '1-100' }, + { 'label': 'ÅV50', 'parameter': 'l50' }, + { 'label': 'S', 'parameter': '' } +]; + +function showMotoLsPopUp(event, origin, title) +{ + var div, baseUrl, url, anchor, i, l; + + l = _MOTOLSPOPUP_PARAMETERS.length; + + div = document.getElementById('motols'); + if (!div) { + div = document.createElement('div'); + div.id = 'motols'; + div.className = 'popup_element'; + div.onmouseover = showMotoLsPopUpDo; + div.onmouseout = hideMotoLsPopUp; + + for (i = 0; i < l; i++) { + anchor = document.createElement('a'); + anchor.appendChild(document.createTextNode(_MOTOLSPOPUP_PARAMETERS[i].label)); + div.appendChild(anchor); + } + + document.body.insertBefore(div, document.body.firstChild); + } + + if (title) { + title += '\n'; + } else { + title = ''; + } + + //var target = origin.hasAttribute('target') ? origin.getAttribute('target') : null; + baseUrl = origin.getAttribute('href'); + for (i = 0; i < l; i++) { + anchor = div.childNodes[i]; + url = baseUrl + _MOTOLSPOPUP_PARAMETERS[i].parameter; + anchor.setAttribute('href', url); + anchor.setAttribute('title', title + url); + /*if (tgt) { + anchor.setAttribute('target', tgt); + }*/ + } + + showMotoLsPopUpDo(event); +} + +function showMotoLsPopUpDo(event) +{ + showResPopUp('motols', event || window.event); +} + +function hideMotoLsPopUp() +{ + hideResPopUp('motols'); +} + +/* + * Local Variables: + * mode: javascript + * coding: cp932 + * tab-width: 4 + * c-basic-offset: 4 + * indent-tabs-mode: t + * End: + */ +/* vim: set syn=javascript fenc=cp932 ai noet ts=4 sw=4 sts=4 fdm=marker: */ Modified: p2ex/trunk/lib/HostCheck.php =================================================================== --- p2ex/trunk/lib/HostCheck.php 2010-01-13 00:37:02 UTC (rev 772) +++ p2ex/trunk/lib/HostCheck.php 2010-01-13 04:36:03 UTC (rev 773) @@ -70,11 +70,10 @@ return $function($remote); } - $cache_db = $_conf['cache_dir'] . '/hostcheck_gethostby.sq3'; - if (!file_exists($cache_db)) { - FileCtl::mkdir_for($cache_db); + if (!file_exists($_conf['hostcheck_db_path'])) { + FileCtl::mkdir_for($_conf['hostcheck_db_path']); } - $kvs = P2KeyValueStore::getStore($cache_db); + $kvs = P2KeyValueStore::getStore($_conf['hostcheck_db_path']); $result = $kvs->get($remote, $lifeTime); if ($result !== null) { Modified: p2ex/trunk/lib/P2Client.php =================================================================== --- p2ex/trunk/lib/P2Client.php 2010-01-13 00:37:02 UTC (rev 772) +++ p2ex/trunk/lib/P2Client.php 2010-01-13 04:36:03 UTC (rev 773) @@ -129,7 +129,7 @@ try { $cookieSavePath = $cookieSaveDir . DIRECTORY_SEPARATOR . self::COOKIE_STORE_NAME; $cookieStore = P2KeyValueStore::getStore($cookieSavePath, - P2KeyValueStore::KVS_SERIALIZING); + P2KeyValueStore::CODEC_SERIALIZING); } catch (Exception $e) { throw new P2Exception(get_class($e) . ': ' . $e->getMessage()); } Modified: p2ex/trunk/lib/P2DataStore/AbstractDataStore.php =================================================================== --- p2ex/trunk/lib/P2DataStore/AbstractDataStore.php 2010-01-13 00:37:02 UTC (rev 772) +++ p2ex/trunk/lib/P2DataStore/AbstractDataStore.php 2010-01-13 04:36:03 UTC (rev 773) @@ -2,6 +2,9 @@ /** * rep2expack - P2KeyValueStoreðbv·é * [eBeBNX̽ßÌîêÛNX + * + * P2KeyValueStoreÍrep2É˶¹¸PÌÅg¦éªA + * P2DataStoreÍrep2Åg¤½ßÉÝv³êÄ¢éB */ require_once P2_LIB_DIR . '/P2KeyValueStore.php'; @@ -12,6 +15,11 @@ { // {{{ properties + /** + * P2KeyValueStoreIuWFNgðÛ·éAzzñ + * + * @var array + */ static private $_kvs = array(); // }}} @@ -25,12 +33,14 @@ * @return P2KeyValueStore */ static protected function _getKVS($databasePath, - $type = P2KeyValueStore::KVS_SERIALIZING) + $type = P2KeyValueStore::CODEC_SERIALIZING) { global $_conf; - if (array_key_exists($databasePath, self::$_kvs)) { - return self::$_kvs[$databasePath]; + $id = $type . ':' . $databasePath; + + if (array_key_exists($id, self::$_kvs)) { + return self::$_kvs[$id]; } if (!file_exists($databasePath) && !is_dir(dirname($databasePath))) { @@ -39,7 +49,7 @@ try { $kvs = P2KeyValueStore::getStore($databasePath, $type); - self::$_kvs[$databasePath] = $kvs; + self::$_kvs[$id] = $kvs; } catch (Exception $e) { p2die(get_class($e) . ': ' . $e->getMessage()); } @@ -133,8 +143,11 @@ return $kvs->clear(); } - $pattern = str_replace(array('%', '_'), array('\\%', '\\_'), $kvs->encodeKey($prefix)); - $stmt = $kvs->prepare('DELETE FROM $__table WHERE arkey LIKE :pattern ESCAPE :escape', true); + $pattern = str_replace(array( '%', '_', '\\'), + array('\\%', '\\_', '\\\\'), + $kvs->encodeKey($prefix)); + $query = 'DELETE FROM $__table WHERE $__key LIKE :pattern ESCAPE :escape'; + $stmt = $kvs->prepare($query); $stmt->bindValue(':pattern', $pattern); $stmt->bindValue(':escape', '\\'); Modified: p2ex/trunk/lib/P2DataStore/CookieStore.php =================================================================== --- p2ex/trunk/lib/P2DataStore/CookieStore.php 2010-01-13 00:37:02 UTC (rev 772) +++ p2ex/trunk/lib/P2DataStore/CookieStore.php 2010-01-13 04:36:03 UTC (rev 773) @@ -94,8 +94,11 @@ return $kvs->clear(); } - $pattern = str_replace(array('%', '_'), array('\\%', '\\_'), $kvs->encodeKey($prefix)); - $stmt = $kvs->prepare('DELETE FROM $__table WHERE arkey LIKE :pattern ESCAPE :escape', true); + $pattern = str_replace(array( '%', '_', '\\'), + array('\\%', '\\_', '\\\\'), + $kvs->encodeKey($prefix)); + $query = 'DELETE FROM $__table WHERE $__key LIKE :pattern ESCAPE :escape'; + $stmt = $kvs->prepare($query); $stmt->bindValue(':pattern', $pattern); $stmt->bindValue(':escape', '\\'); Modified: p2ex/trunk/lib/P2DataStore/PostDataStore.php =================================================================== --- p2ex/trunk/lib/P2DataStore/PostDataStore.php 2010-01-13 00:37:02 UTC (rev 772) +++ p2ex/trunk/lib/P2DataStore/PostDataStore.php 2010-01-13 04:36:03 UTC (rev 773) @@ -94,8 +94,11 @@ return $kvs->clear(); } - $pattern = str_replace(array('%', '_'), array('\\%', '\\_'), $kvs->encodeKey($prefix)); - $stmt = $kvs->prepare('DELETE FROM $__table WHERE arkey LIKE :pattern ESCAPE :escape', true); + $pattern = str_replace(array( '%', '_', '\\'), + array('\\%', '\\_', '\\\\'), + $kvs->encodeKey($prefix)); + $query = 'DELETE FROM $__table WHERE $__key LIKE :pattern ESCAPE :escape'; + $stmt = $kvs->prepare($query); $stmt->bindValue(':pattern', $pattern); $stmt->bindValue(':escape', '\\'); Deleted: p2ex/trunk/lib/P2KeyValueStore/Binary.php =================================================================== --- p2ex/trunk/lib/P2KeyValueStore/Binary.php 2010-01-13 00:37:02 UTC (rev 772) +++ p2ex/trunk/lib/P2KeyValueStore/Binary.php 2010-01-13 04:36:03 UTC (rev 773) @@ -1,52 +0,0 @@ -<?php -require_once dirname(__FILE__) . '/../P2KeyValueStore.php'; - -// {{{ P2KeyValueStore_Binary - -/** - * oCif[^ði±»·é - */ -class P2KeyValueStore_Binary extends P2KeyValueStore -{ - // {{{ encodeValue() - - /** - * f[^ðBase64GR[h·é - * - * @param string $value - * @return string - */ - public function encodeValue($value) - { - return base64_encode($value); - } - - // }}} - // {{{ decodeValue() - - /** - * f[^ðBase64fR[h·é - * - * @param string $value - * @return string - */ - public function decodeValue($value) - { - return base64_decode($value); - } - - // }}} -} - -// }}} - -/* - * 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: Copied: p2ex/trunk/lib/P2KeyValueStore/Codec/Binary.php (from rev 771, p2ex/trunk/lib/P2KeyValueStore/Binary.php) =================================================================== --- p2ex/trunk/lib/P2KeyValueStore/Codec/Binary.php (rev 0) +++ p2ex/trunk/lib/P2KeyValueStore/Codec/Binary.php 2010-01-13 04:36:03 UTC (rev 773) @@ -0,0 +1,79 @@ +<?php + +// {{{ P2KeyValueStore_Codec_Binary + +/** + * oCif[^pCodec + */ +class P2KeyValueStore_Codec_Binary implements P2KeyValueStore_Codec_Interface +{ + // {{{ encodeKey() + + /** + * L[Í»ÌÜÜ + * + * @param string $key + * @return string + */ + public function encodeKey($key) + { + return $key; + } + + // }}} + // {{{ decodeKey() + + /** + * L[Í»ÌÜÜ + * + * @param string $key + * @return string + */ + public function decodeKey($key) + { + return $key; + } + + // }}} + // {{{ encodeValue() + + /** + * f[^ðBase64GR[h·é + * + * @param string $value + * @return string + */ + public function encodeValue($value) + { + return base64_encode($value); + } + + // }}} + // {{{ decodeValue() + + /** + * f[^ðBase64fR[h·é + * + * @param string $value + * @return string + */ + public function decodeValue($value) + { + return base64_decode($value); + } + + // }}} +} + +// }}} + +/* + * 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: Copied: p2ex/trunk/lib/P2KeyValueStore/Codec/Compressing.php (from rev 771, p2ex/trunk/lib/P2KeyValueStore/Compressing.php) =================================================================== --- p2ex/trunk/lib/P2KeyValueStore/Codec/Compressing.php (rev 0) +++ p2ex/trunk/lib/P2KeyValueStore/Codec/Compressing.php 2010-01-13 04:36:03 UTC (rev 773) @@ -0,0 +1,51 @@ +<?php + +// {{{ P2KeyValueStore_Codec_Compressing + +/** + * TCYÌå«¢f[^ð³k·éCodec + */ +class P2KeyValueStore_Codec_Compressing extends P2KeyValueStore_Codec_Binary +{ + // {{{ encodeValue() + + /** + * f[^ð³k·é + * + * @param string $value + * @return string + */ + public function encodeValue($value) + { + return parent::encodeValue(gzdeflate($value, 6)); + } + + // }}} + // {{{ decodeValue() + + /** + * f[^ðWJ·é + * + * @param string $value + * @return string + */ + public function decodeValue($value) + { + return gzinflate(parent::decodeValue($value)); + } + + // }}} +} + +// }}} + +/* + * 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: Added: p2ex/trunk/lib/P2KeyValueStore/Codec/Default.php =================================================================== --- p2ex/trunk/lib/P2KeyValueStore/Codec/Default.php (rev 0) +++ p2ex/trunk/lib/P2KeyValueStore/Codec/Default.php 2010-01-13 04:36:03 UTC (rev 773) @@ -0,0 +1,79 @@ +<?php + +// {{{ P2KeyValueStore_Codec_Default + +/** + * ½àµÈ¢Codec + */ +class P2KeyValueStore_Codec_Default implements P2KeyValueStore_Codec_Interface +{ + // {{{ encodeKey() + + /** + * L[Í»ÌÜÜ + * + * @param string $key + * @return string + */ + public function encodeKey($key) + { + return $key; + } + + // }}} + // {{{ decodeKey() + + /** + * L[Í»ÌÜÜ + * + * @param string $key + * @return string + */ + public function decodeKey($key) + { + return $key; + } + + // }}} + // {{{ encodeValue() + + /** + * lÍ»ÌÜÜ + * + * @param string $value + * @return string + */ + public function encodeValue($value) + { + return $value; + } + + // }}} + // {{{ decodeValue() + + /** + * lÍ»ÌÜÜ + * + * @param string $value + * @return string + */ + public function decodeValue($value) + { + return $value; + } + + // }}} +} + +// }}} + +/* + * 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: Added: p2ex/trunk/lib/P2KeyValueStore/Codec/Interface.php =================================================================== --- p2ex/trunk/lib/P2KeyValueStore/Codec/Interface.php (rev 0) +++ p2ex/trunk/lib/P2KeyValueStore/Codec/Interface.php 2010-01-13 04:36:03 UTC (rev 773) @@ -0,0 +1,67 @@ +<?php + +// {{{ P2KeyValueStore_Codec_Interface + +/** + * P2KeyValueStoreªg¤CodecÌC^[tFCXè` + */ +interface P2KeyValueStore_Codec_Interface +{ + // {{{ encodeKey() + + /** + * L[ðUTF-8 (or US-ASCII) ¶ñÉGR[h·é + * + * @param string $key + * @return string + */ + public function encodeKey($key); + + // }}} + // {{{ decodeKey() + + /** + * L[ðfR[h·é + * + * @param string $key + * @return string + */ + public function decodeKey($key); + + // }}} + // {{{ encodeValue() + + /** + * lðUTF-8 (or US-ASCII) ¶ñÉGR[h·é + * + * @param string $value + * @return string + */ + public function encodeValue($value); + + // }}} + // {{{ decodeValue() + + /** + * lðfR[h·é + * + * @param string $value + * @return string + */ + public function decodeValue($value); + + // }}} +} + +// }}} + +/* + * 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: Copied: p2ex/trunk/lib/P2KeyValueStore/Codec/Serializing.php (from rev 771, p2ex/trunk/lib/P2KeyValueStore/Serializing.php) =================================================================== --- p2ex/trunk/lib/P2KeyValueStore/Codec/Serializing.php (rev 0) +++ p2ex/trunk/lib/P2KeyValueStore/Codec/Serializing.php 2010-01-13 04:36:03 UTC (rev 773) @@ -0,0 +1,51 @@ +<?php + +// {{{ P2KeyValueStore_Codec_Serializing + +/** + * lðVACYEAVACY·éCodec + */ +class P2KeyValueStore_Codec_Serializing extends P2KeyValueStore_Codec_Compressing +{ + // {{{ encodeValue() + + /** + * lðVACY·é + * + * @param mixed $value + * @return string + */ + public function encodeValue($value) + { + return parent::encodeValue(serialize($value)); + } + + // }}} + // {{{ decodeValue() + + /** + * lðAVACY·é + * + * @param string $value + * @return mixed + */ + public function decodeValue($value) + { + return unserialize(parent::decodeValue($value)); + } + + // }}} +} + +// }}} + +/* + * 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: Copied: p2ex/trunk/lib/P2KeyValueStore/Codec/ShiftJIS.php (from rev 771, p2ex/trunk/lib/P2KeyValueStore/ShiftJIS.php) =================================================================== --- p2ex/trunk/lib/P2KeyValueStore/Codec/ShiftJIS.php (rev 0) +++ p2ex/trunk/lib/P2KeyValueStore/Codec/ShiftJIS.php 2010-01-13 04:36:03 UTC (rev 773) @@ -0,0 +1,107 @@ +<?php + +// {{{ P2KeyValueStore_Codec_ShiftJIS + +/** + * Shift_JIS (SJIS-win=CP932) ̶ñðUTF-8ÉÏ·E³·éCodec + */ +class P2KeyValueStore_Codec_ShiftJIS implements P2KeyValueStore_Codec_Interface +{ + // {{{ _encode() + + /** + * Shift_JIS̶ñðUTF-8ÉÏ··é + * + * @param string $str + * @return string + */ + static private function _encode($str) + { + return mb_convert_encoding($str, 'UTF-8', 'SJIS-win'); + } + + // }}} + // {{{ _decode() + + /** + * UTF-8̶ñðShift_JISÉÏ··é + * + * @param string $str + * @return string + */ + static private function _decode($str) + { + return mb_convert_encoding($str, 'SJIS-win', 'UTF-8'); + } + + // }}} + // {{{ encodeKey() + + /** + * L[ðGR[h·é + * + * @param string $key + * @return string + */ + public function encodeKey($key) + { + return self::_encode($key); + } + + // }}} + // {{{ decodeKey() + + /** + * L[ðfR[h·é + * + * @param string $key + * @return string + */ + public function decodeKey($key) + { + return self::_decode($key); + } + + // }}} + // {{{ encodeValue() + + /** + * lðGR[h·é + * + * @param string $value + * @return string + */ + public function encodeValue($value) + { + return self::_encode($value); + } + + // }}} + // {{{ decodeValue() + + /** + * lðfR[h·é + * + * @param string $value + * @return string + */ + public function decodeValue($value) + { + return self::_decode($value); + } + + // }}} +} + +// }}} + +/* + * 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: Deleted: p2ex/trunk/lib/P2KeyValueStore/Compressing.php =================================================================== --- p2ex/trunk/lib/P2KeyValueStore/Compressing.php 2010-01-13 00:37:02 UTC (rev 772) +++ p2ex/trunk/lib/P2KeyValueStore/Compressing.php 2010-01-13 04:36:03 UTC (rev 773) @@ -1,52 +0,0 @@ -<?php -require_once dirname(__FILE__) . '/Binary.php'; - -// {{{ P2KeyValueStore_Compressing - -/** - * TCYÌå«¢f[^ð³kµÄi±»·é - */ -class P2KeyValueStore_Compressing extends P2KeyValueStore_Binary -{ - // {{{ encodeValue() - - /** - * f[^ð³k·é - * - * @param string $value - * @return string - */ - public function encodeValue($value) - { - return parent::encodeValue(gzdeflate($value, 6)); - } - - // }}} - // {{{ decodeValue() - - /** - * f[^ðWJ·é - * - * @param string $value - * @return string - */ - public function decodeValue($value) - { - return gzinflate(parent::decodeValue($value)); - } - - // }}} -} - -// }}} - -/* - * 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: Added: p2ex/trunk/lib/P2KeyValueStore/FunctionCache/Proxy.php =================================================================== --- p2ex/trunk/lib/P2KeyValueStore/FunctionCache/Proxy.php (rev 0) +++ p2ex/trunk/lib/P2KeyValueStore/FunctionCache/Proxy.php 2010-01-13 04:36:03 UTC (rev 773) @@ -0,0 +1,133 @@ +<?php + +// {{{ P2KeyValueStore_FunctionCache + +/** + * P2KeyValueStore_FunctionCacheðg¤ÖÄÑoµvLV + */ +class P2KeyValueStore_FunctionCache_Proxy +{ + // {{{ properties + + private $_cache; + private $_function; + private $_prependedParameters; + private $_appendedParameters; + private $_lifeTime; + + // }}} + // {{{ __construct() + + /** + * @param P2KeyValueStore_FunctionCache $cache + * @param callable $function + * @throws InvalidArgumentException + */ + public function __construct(P2KeyValueStore_FunctionCache $cache, $function) + { + if (!is_callable($function)) { + throw new InvalidArgumentException('Non-callable value was given'); + } + $this->_cache = $cache; + $this->_function = $function; + $this->_prependedParameters = array(); + $this->_appendedParameters = array(); + $this->_lifeTime = -1; + } + + // }}} + // {{{ __invoke() + + /** + * @param mixed $... + * @return mixed + * @see P2KeyValueStore_FunctionCache_Proxy::invoke() + */ + public function __invoke() + { + $parameters = $this->_prependedParameters; + $arguments = func_get_args(); + foreach ($arguments as $parameter) { + $parameters[] = $parameter; + } + foreach ($this->_appendedParameters as $parameter) { + $parameters[] = $parameter; + } + + $oldLifeTime = $this->_cache->setLifeTime($this->_lifeTime); + $result = $this->_cache->invoke($this->_function, $parameters); + $this->_cache->setLifeTime($oldLifeTime); + + return $result; + } + + // }}} + // {{{ invoke() + + /** + * @param mixed $... + * @return mixed + */ + public function invoke() + { + $args = func_get_args(); + if (count($args)) { + return call_user_func_array(array($this, '__invoke'), $args); + } else { + return $this->__invoke(); + } + } + + // }}} + // {{{ prependParameters() + + /** + * @param mixed $... + * @return void + */ + public function prependParameters() + { + $this->_prependedParameters = func_get_args(); + } + + // }}} + // {{{ appendParameters() + + /** + * @param mixed $... + * @return void + */ + public function appendParameters() + { + $this->_appendedParameters = func_get_args(); + } + + // }}} + // {{{ setLifeTime() + + /** + * @param int $lifeTime + * @return int + */ + public function setLifeTime($lifeTime = -1) + { + $oldLifeTime = $this->_lifeTime; + $this->_lifeTime = $lifeTime; + return $oldLifeTime; + } + + // }}} +} + +// }}} + +/* + * 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: Added: p2ex/trunk/lib/P2KeyValueStore/FunctionCache.php =================================================================== --- p2ex/trunk/lib/P2KeyValueStore/FunctionCache.php (rev 0) +++ p2ex/trunk/lib/P2KeyValueStore/FunctionCache.php 2010-01-13 04:36:03 UTC (rev 773) @@ -0,0 +1,135 @@ +<?php + +// {{{ P2KeyValueStore_FunctionCache + +/** + * P2KeyValueStoreðg¤ÖÄÑoµLbV + */ +class P2KeyValueStore_FunctionCache +{ + // {{{ properties + + private $_kvs; + private $_lifeTime; + + // }}} + // {{{ __construct() + + /** + * @param P2KeyValueStore $kvs + * @param callable $function + */ + public function __construct(P2KeyValueStore $kvs) + { + $this->_kvs = $kvs; + $this->_lifeTime = -1; + } + + // }}} + // {{{ getProxy() + + /** + * @param callable $function + * @return P2KeyValueStore_FunctionCache_Proxy + * @throws InvalidArgumentException + */ + public function getProxy($function) + { + $proxy = new P2KeyValueStore_FunctionCache_Proxy($this, $function); + $proxy->setLifeTime($this->_lifeTime); + return $proxy; + } + + // }}} + // {{{ invoke() + + /** + * @param callable $function + * @param array $parameters + * @return mixed + * @throws InvalidArgumentException + */ + public function invoke($function, array $parameters = array()) + { + if (!is_callable($function)) { + throw new InvalidArgumentException('Non-callable value was given'); + } + + // Ö¼ + if (is_string($function)) { + $name = $function; + } elseif (is_object($function)) { + $name = get_class($function) . '->__invoke'; + } elseif (is_object($function[0])) { + $name = get_class($function[0]) . '->' . $function[1]; + } else { + $name = $function[0] . '::' . $function[1]; + } + + // L[ + $key = strtolower($name) . '('; + if ($n = count($parameters)) { + $key .= $n . ':' . md5(serialize($parameters)); + } else { + $key .= 'void'; + } + $key .= ')'; + + // LbV ðæ¾ + $record = $this->_kvs->getRaw($key); + if ($record && !$record->isExpired($this->_lifeTime)) { + return $this->_kvs->getCodec()->decodeValue($record->value); + } + + // ȯêÎÖðÀs + if ($n) { + if ($n == 1 && !is_array($function)) { + $value = $function(reset($parameters)); + } else { + $value = call_user_func_array($function, $parameters); + } + } elseif (is_array($function)) { + $value = call_user_func($function); + } else { + $value = $function(); + } + + // LbV ÉÛ¶ + if ($record) { + $this->_kvs->update($key, $value); + } else { + $this->_kvs->set($key, $value); + } + + return $value; + } + + // }}} + // {{{ setLifeTime() + + /** + * @param int $lifeTime + * @return int + */ + public function setLifeTime($lifeTime = -1) + { + $oldLifeTime = $this->_lifeTime; + $this->_lifeTime = $lifeTime; + return $oldLifeTime; + } + + // }}} +} + +// }}} + +/* + * 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/P2KeyValueStore/Iterator.php =================================================================== --- p2ex/trunk/lib/P2KeyValueStore/Iterator.php 2010-01-13 00:37:02 UTC (rev 772) +++ p2ex/trunk/lib/P2KeyValueStore/Iterator.php 2010-01-13 04:36:03 UTC (rev 773) @@ -1,5 +1,4 @@ <?php -require_once dirname(__FILE__) . '/../P2KeyValueStore.php'; // {{{ P2KeyValueStore_Iterator Added: p2ex/trunk/lib/P2KeyValueStore/Result.php =================================================================== --- p2ex/trunk/lib/P2KeyValueStore/Result.php (rev 0) +++ p2ex/trunk/lib/P2KeyValueStore/Result.php 2010-01-13 04:36:03 UTC (rev 773) @@ -0,0 +1,231 @@ +<?php + +// {{{ P2KeyValueStore_Result + +/** + * P2KeyValueStoreÅPDOStatement::fetch()ÌÊði[·é + */ +class P2KeyValueStore_Result implements ArrayAccess +{ + // {{{ properties + + /** + * PDO::FETCH_INTO Åãü³êévpeB + * P2KeyValueStore Åg¤e[uÌeJ¼Æ¯¶ + */ + public $id; + public $arkey; + public $value; + public $mtime; + public $sort_order; + + /** + * ArrayAccessÌ\bhÅANZXÅ«éL[Æ + * ÀÛÌvpeB¼ÌÎ\ + */ + static protected $_keyMap = array( + 0 => 'id', + 1 => 'arkey', + 2 => 'value', + 3 => 'mtime', + 4 => 'sort_order', + 'id' => 'id', + 'key' => 'arkey', + 'arkey' => 'arkey', + 'value' => 'value', + 'mtime' => 'mtime', + 'order' => 'sort_order', + 'sort_order' => 'sort_order', + ); + + // }}} + // {{{ isExpired() + + /** + * LøúÀØêÌ`FbNðs¤ + * + * @param int $lifeTime + * @return bool + */ + public function isExpired($lifeTime) + { + if ($lifeTime > -1 && $this->mtime < time() - $lifeTime) { + return false; + } else { + return true; + } + } + + // }}} + // {{{ toArray() + + /** + * ÊZbgðAzzñÉÏ··é + * + * @param P2KeyValueStore_Codec_Interface $codec + * @return array + */ + public function toArray(P2KeyValueStore_Codec_Interface $codec = null) + { + if ($codc === null) { + $key = $this->arkey; + $value = $this->value; + } else { + $key = $codec->decodeKey($this->arkey); + $value = $codec->decodeValue($this->value); + } + + return array( + 'id' => (int)$this->id, + 'key' => $key, + 'value' => $value, + 'mtime' => (int)$this->mtime, + 'order' => (int)$this->sort_order, + ); + } + + // }}} + // {{{ toObject() + + /** + * ÊZbgðÊÌCÓÌIuWFNgÉÏ··é + * + * @param P2KeyValueStore_Codec_Interface $codec + * @param mixed $object + * @return array + */ + public function toObject($object = null, P2KeyValueStore_Codec_Interface $codec = null) + { + $properties = $this->toArray($codec); + + if ($object === null) { + return (object)$properties; // stdClass + } + + if (!is_object($object)) { + $object = new $object; + } + foreach ($properties as $key => $value) { + $object->$key = $value; + } + + return $object; + } + + // }}} + // {{{ clear() + + /** + * vpeBðZbg·é + * + * @param void + * @return void + */ + public function clear() + { + $this->id = null; + $this->arkey = null; + $this->value = null; + $this->mtime = null; + $this->sort_order = null; + } + + // }}} + // {{{ offsetExists() + + /** + * ArrayAccess::offsetExists() + * + * @param string $offset + * @return string + */ + public function offsetExists($offset) + { + return self::_resolveOffset($offset) !== false; + } + + // }}} + // {{{ offsetGet() + + /** + * ArrayAccess::offsetGet() + * + * @param string $offset + * @return mixed + */ + public function offsetGet($offset) + { + if ($name = self::_resolveOffset($offset)) { + return $this->$name; + } else { + return null; + } + } + + // }}} + // {{{ offsetSet() + + /** + * ArrayAccess::offsetSet() + * + * @param string $offset + * @param string $value + * @return void + */ + public function offsetSet($offset, $value) + { + if ($name = self::_resolveOffset($offset)) { + $this->$name = $value; + } + } + + // }}} + // {{{ offsetUnset() + + /** + * ArrayAccess::offsetUnset() + * + * @param string $offset + * @return void + */ + public function offsetUnset($offset) + { + if ($name = self::_resolveOffset($offset)) { + $this->$name = null; + } + } + + // }}} + // {{{ _resolveOffset() + + /** + * ArrayAccessÌ\bhÉ^¦çê½ItZbgÆ + * ÀÛÌvpeB¼Ìðð·é + * + * @param string $offset + * @return string + */ + static protected function _resolveOffset($offset) + { + if (array_key_exists($offset, self::$_keyMap)) { + return self::$_keyMap[$offset]; + } else { + return false; + } + } + + // }}} +} + +// }}} + +/* + * 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: Deleted: p2ex/trunk/lib/P2KeyValueStore/Serializing.php =================================================================== --- p2ex/trunk/lib/P2KeyValueStore/Serializing.php 2010-01-13 00:37:02 UTC (rev 772) +++ p2ex/trunk/lib/P2KeyValueStore/Serializing.php 2010-01-13 04:36:03 UTC (rev 773) @@ -1,52 +0,0 @@ -<?php -require_once dirname(__FILE__) . '/Compressing.php'; - -// {{{ P2KeyValueStore_Serializing - -/** - * lðVACYµÄi±»·é - */ -class P2KeyValueStore_Serializing extends P2KeyValueStore_Compressing -{ - // {{{ encodeValue() - - /** - * lðVACY·é - * - * @param mixed $value - * @return string - */ - public function encodeValue($value) - { - return parent::encodeValue(serialize($value)); - } - - // }}} - // {{{ decodeValue() - - /** - * lðAVACY·é - * - * @param string $value - * @return mixed - */ - public function decodeValue($value) - { - return unserialize(parent::decodeValue($value)); - } - - // }}} -} - -// }}} - -/* - * 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: Deleted: p2ex/trunk/lib/P2KeyValueStore/ShiftJIS.php =================================================================== --- p2ex/trunk/lib/P2KeyValueStore/ShiftJIS.php 2010-01-13 00:37:02 UTC (rev 772) +++ p2ex/trunk/lib/P2KeyValueStore/ShiftJIS.php 2010-01-13 04:36:03 UTC (rev 773) @@ -1,108 +0,0 @@ -<?php -require_once dirname(__FILE__) . '/../P2KeyValueStore.php'; - -// {{{ P2KeyValueStore_ShiftJIS - -/** - * Shift_JIS̶ñðUTF-8ÉÏ·µÄi±»·é - */ -class P2KeyValueStore_ShiftJIS extends P2KeyValueStore -{ - // {{{ _encode() - - /** - * Shift_JIS (SJIS-win=CP932) ̶ñðUTF-8ÉÏ··é - * - * @param string $str - * @return string - */ - private function _encode($str) - { - return mb_convert_encoding($str, 'UTF-8', 'SJIS-win'); - } - - // }}} - // {{{ _decode() - - /** - * UTF-8̶ñðShift_JIS (CP932) ÉÏ··é - * - * @param string $str - * @return string - */ - private function _decode($str) - { - return mb_convert_encoding($str, 'SJIS-win', 'UTF-8'); - } - - // }}} - // {{{ encodeKey() - - /** - * L[ðGR[h·é - * - * @param string $key - * @return string - */ - public function encodeKey($key) - { - return $this->_encode($key); - } - - // }}} - // {{{ decodeKey() - - /** - * L[ðfR[h·é - * - * @param string $key - * @return string - */ - public function decodeKey($key) - { - return $this->_decode($key); - } - - // }}} - // {{{ encodeValue() - - /** - * lðGR[h·é - * - * @param string $value - * @return string - */ - public function encodeValue($value) - { - return $this->_encode($value); - } - - // }}} - // {{{ decodeValue() - - /** - * lðfR[h·é - * - * @param string $value - * @return string - */ - public function decodeValue($value) - { - return $this->_decode($value); - } - - // }}} -} - -// }}} - -/* - * 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/P2KeyValueStore.php =================================================================== --- p2ex/trunk/lib/P2KeyValueStore.php 2010-01-13 00:37:02 UTC (rev 772) +++ p2ex/trunk/lib/P2KeyValueStore.php 2010-01-13 04:36:03 UTC (rev 773) @@ -1,5 +1,5 @@ <?php -require_once dirname(__FILE__) . '/P2KeyValueStore/Iterator.php'; +require_once dirname(__FILE__) . '/P2KeyValueStore/Codec/Interface.php'; // {{{ P2KeyValueStore @@ -34,21 +34,26 @@ const Q_CLEAR = 'DELETE FROM $__table'; const Q_GC = 'DELETE FROM $__table WHERE mtime < :expires'; - const KVS_DEFAULT = 'default'; - const KVS_BINARY = 'Binary'; - const KVS_COMPRESSING = 'Compressing'; - const KVS_SHIFTJS = 'ShiftJIS'; - const KVS_SERIALIZING = 'Serializing'; + const CODEC_DEFAULT = 'P2KeyValueStore_Codec_Default'; + const CODEC_BINARY = 'P2KeyValueStore_Codec_Binary'; + const CODEC_COMPRESSING = 'P2KeyValueStore_Codec_Compressing'; + const CODEC_SHIFTJIS = 'P2KeyValueStore_Codec_ShiftJIS'; + const CODEC_SERIALIZING = 'P2KeyValueStore_Codec_Serializing'; + const MEMORY_DATABASE = ':memory:'; + // }}} - // {{{ staric private properties + // {{{ static private properties /** - * f[^x[XÉêÓÈPDO,PDOStatement,P2KeyValueStoreÌCX^XðÛ·ézñ + * eíIuWFNgðÛ·ézñQ * * @var array */ - static private $_objects = array(); + static private $_pdoCache = array(); + static private $_stmtCache = array(); + static private $_kvsCache = array(); + static private $_codecCache = array(); // }}} // {{{ private properties @@ -61,19 +66,33 @@ private $_pdo; /** - * SQLite3f[^x[XÌpX + * PDOÌCX^XÉηéêÓÈl * * @var string */ - private $_path; + private $_pdoId; /** + * CodecÌCX^X + * + * @var P2KeyValueStore_Codec_Interface + */ + private $_codec; + + /** * ¯ÊqƵÄNH[gÏÝÌe[u¼ * * @var string */ private $_quotedTableName; + /** + * g¢ñµpÌÊZbgIuWFNg + * + * @var P2KeyValueStore_Result + */ + private $_sharedResult; + // }}} // {{{ getStore() @@ -81,96 +100,54 @@ * VOg\bh * * @param string $fileName - * @param string $type - * @param string &$openedPath + * @param string $codec * @return P2KeyValueStore - * @throws InvalidArgumentException, UnexpectedValueException, RuntimeException, PDOException + * @throws PDOException */ - static public function getStore($fileName, $type = self::KVS_DEFAULT, &$openedPath = null) + static public function getStore($fileName, $codec = self::CODEC_DEFAULT) { - // øÌ^ð`FbN - if (!is_string($fileName)) { - throw new InvalidArgumentException('Parameter #1 \'$fileName\' should be a string value'); + // IuWFNgIDÆe[u¼ðè + if (is_object($codec)) { + $className = get_class($codec); + } else { + $className = $codec; } - if (!is_string($type)) { - throw new InvalidArgumentException('Parameter #2 \'$className\' should be a string value'); + $lcName = strtolower($className); + if (strpos($lcName, 'p2keyvaluestore_codec_') === 0) { + $codecId = substr($lcName, 22); + } else { + $codecId = 'user_' . $lcName; } + $kvsId = $lcName . ':' . $fileName; + $tableName = 'kvs_' . $codecId; - // NX¼ð`FbN - if ($type == self::KVS_DEFAULT) { - $className = 'P2KeyValueStore'; - } else { - $className = 'P2KeyValueStore_' . $type; + // P2KeyValueStoreÌLbV ðmF + if (array_key_exists($kvsId, self::$_kvsCache)) { + return self::$_kvsCache[$kvsId]; } - if (strcasecmp($className, 'P2KeyValueStore') != 0) { - if (!class_exists($className, false)) { - include dirname(__FILE__) . '/P2KeyValueStore/' . $type . '.php'; - if (!class_exists($className, false)) { - throw new UnexpectedValueException("Class '{$className}' is not declared"); - } - } - if (!is_subclass_of($className, 'P2KeyValueStore')) { - throw new UnexpectedValueException("Class '{$className}' is not a subclass of P2KeyValueStore"); - } - } - // f[^x[Xt@Cð`FbN - if ($fileName == ':memory:') { - $path = $fileName; - $createTable = true; - } elseif (file_exists($fileName)) { - if (!is_file($fileName)) { - throw new RuntimeException("'{$fileName}' is not a standard file"); - } - if (!is_writable($fileName)) { - throw new RuntimeException("File '{$fileName}' is not writable"); - } - $path = realpath($fileName); - $createTable = false; + // PDOÌLbV ðmF + if (array_key_exists($fileName, self::$_pdoCache)) { + $pdo = self::$_pdoCache[$fileName]; } else { - if (strpos($fileName, '/') !== false || - (strncasecmp(PHP_OS, 'WIN', 3) == 0 && strpos($fileName, '\\') !== false)) - { - $dirName = dirname($fileName); - $baseName = basename($fileName); - } else { - $dirName = getcwd(); - $baseName = $fileName; - } - if (!is_string($dirName) || !is_dir($dirName)) { - throw new RuntimeException("No directory for '{$fileName}'"); - } - if (!is_writable($dirName)) { - throw new RuntimeException("Directory '{$dirName}' is not writable"); - } - $path = realpath($dirName) . DIRECTORY_SEPARATOR . $baseName; - $createTable = true; + $pdo = new PDO('sqlite:' . $fileName); + self::$_pdoCache[$fileName] = $pdo; } - $lcname = strtolower($className); - $tableName = 'kvs_' . $lcname; - $openedPath = $path; - - // CX^Xð쬵AÃIÏÉÛ - if (array_key_exists($path, self::$_objects)) { - if (array_key_exists($lcname, self::$_objects[$path]['persisters'])) { - $kvs = self::$_objects[$path]['persisters'][$lcname]; + // CodecÌLbV ðmF + if (!is_object($codec)) { + if (array_key_exists($codecId, self::$_codecCache)) { + $codec = self::$_codecCache[$codecId]; } else { - $pdo = self::$_objects[$path]['connection']; - $kvs = new $className($pdo, $path, $tableName); - self::$_objects[$path]['persisters'][$lcname] = $kvs; + $codec = new $className; + self::$_codecCache[$codecId] = $codec; } - } else { - $pdo = new PDO('sqlite:' . $path); - $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - $kvs = new $className($pdo, $path, $tableName); - self::$_objects[$path] = array( - 'connection' => $pdo, - 'statements' => array(), - 'persisters' => array($lcname => $kvs), - ); } + // P2KeyValueStoreÌCX^Xðì¬ + $kvs = new P2KeyValueStore($pdo, $codec, $tableName); + self::$_kvsCache[$kvsId] = $kvs; + return $kvs; } @@ -182,19 +159,27 @@ * getStore()©çÄÑo³êé * * @param PDO $pdo - * @param string $path + * @param P2KeyValueStore_Codec_Interface $codec * @param string $tableName * @throws PDOException */ - private function __construct(PDO $pdo, $path, $tableName) + public function __construct(PDO $pdo, + P2KeyValueStore_Codec_Interface $codec, + $tableName) { $this->_pdo = $pdo; - $this->_path = $path; + $this->_pdoId = spl_object_hash($pdo); + $this->_codec = $codec; $this->_quotedTableName = '"' . str_replace('"', '""', $tableName) . '"'; + $this->_sharedResult = new P2KeyValueStore_Result; + if (!array_key_exists($this->_pdoId, self::$_stmtCache)) { + self::$_stmtCache[$this->_pdoId] = array(); + } + // e[uª¶Ý·é©ð²× $stmt = $pdo->prepare(self::Q_TABLEEXISTS); - $stmt->bindValue(':table', $tableName, PDO::PARAM_STR); + $stmt->bindValue(':table', $tableName); $stmt->execute(); $exists = $stmt->fetchColumn(); $stmt->closeCursor(); @@ -207,30 +192,31 @@ } // }}} - // {{{ prepare() + // {{{ _prepare() /** - * vyA[hXe[ggð쬷é + * vyA[hXe[ggð쬷é (àp) * * @param string $query * @param bool $isTemporary + * @param bool $forwardOnly * @return PDOStatement * @throws PDOException */ - public function prepare($query, $isTemporary = false) + protected function _prepare($query, $isTemporary = false, $forwardOnly = true) { $query = str_replace('$__table', $this->_quotedTableName, $query); - if (!$isTemporary && array_key_exists($query, self::$_objects[$this->_path]['statements'])) { - $stmt = self::$_objects[$this->_path]['statements'][$query]; + if (!$isTemporary && array_key_exists($query, self::$_stmtCache[$this->_pdoId])) { + $stmt = self::$_stmtCache[$this->_pdoId][$query]; } else { - if (strncmp($query, 'SELECT ', 7) == 0) { + if ($forwardOnly && strncmp($query, 'SELECT ', 7) == 0) { $stmt = $this->_pdo->prepare($query, array(PDO::ATTR_CURSOR => PDO::CURSOR_FWDONLY)); } else { $stmt = $this->_pdo->prepare($query); } if (!$isTemporary) { - self::$_objects[$this->_path]['statements'][$query] = $stmt; + self::$_stmtCache[$this->_pdoId][$query] = $stmt; } } @@ -238,6 +224,27 @@ } // }}} + // {{{ prepare() + + /** + * vyA[hXe[ggð쬷é + * + * @param string $query + * @param bool $forwardOnly + * @return PDOStatement + * @throws PDOException + * @see P2KeyValueStore::_prepare() + */ + public function prepare($query, $forwardOnly = true) + { + return $this->_prepare(str_replace(array('$__key', '$__value'), + array( 'arkey', 'value'), + $query), + true, + $forwardOnly); + } + + // }}} // {{{ buildOrderBy() /** @@ -253,25 +260,31 @@ } $terms = array(); - foreach ($orderBy as $column => $ascending) { - $direction = $ascending ? 'ASC' : 'DESC'; - switch ($column) { - case 'id': - $terms[] = 'id ' . $direction; - break; - case 'key': - $terms[] = 'arkey ' . $direction; - break; - case 'value': - $terms[] = 'value ' . $direction; - break; - case 'mtime': - $terms[] = 'mtime ' . $direction; - break; - case 'order': - $terms[] = 'sort_order ' . $direction; - break; + $mapping = array( + 'id' => 'id', + 'key' => 'arkey', + 'arkey' => 'arkey', + 'value' => 'value', + 'mtime' => 'mtime', + 'order' => 'sort_order', + 'sort_order' => 'sort_order', + ); + + foreach ($orderBy as $column => $direction) { + $column = strtolower($column); + if (array_key_exists($column, $mapping)) { + $condition = $mapping[$column] . ' '; + if (strcasecmp($direction, 'ASC') == 0) { + $condition .= 'ASC'; + } elseif (strcasecmp($direction, 'DESC') == 0) { + $condition .= 'DESC'; + } elseif (0 < (int)$direction) { + $condition .= 'ASC'; + } else { + $condition .= 'DESC'; + } } + $terms[] = $condition; } if (count($terms)) { @@ -303,62 +316,6 @@ } // }}} - // {{{ encodeKey() - - /** - * L[ðUTF-8 or US-ASCII¶ñÉGR[h·é - * - * @param string $key - * @return string - */ - public function encodeKey($key) - { - return (string)$key; - } - - // }}} - // {{{ decodeKey() - - /** - * L[ðfR[h·é - * - * @param string $key - * @return string - */ - public function decodeKey($key) - { - return $key; - } - - // }}} - // {{{ encodeValue() - - /** - * lðUTF-8 or US-ASCII¶ñÉGR[h·é - * - * @param string $value - * @return string - */ - public function encodeValue($value) - { - return (string)$value; - } - - // }}} - // {{{ decodeValue() - - /** - * lðfR[h·é - * - * @param string $value - * @return string - */ - public function decodeValue($value) - { - return $value; - } - - // }}} // {{{ exists() /** @@ -368,18 +325,19 @@ * @param int $lifeTime * @return bool */ - public function exists($key, $lifeTime = null) + public function exists($key, $lifeTime = -1) { - $stmt = $this->prepare(self::Q_EXSITS); - $stmt->setFetchMode(PDO::FETCH_ASSOC); - $stmt->bindValue(':key', $this->encodeKey($key), PDO::PARAM_STR); + $stmt = $this->_prepare(self::Q_EXSITS); + $stmt->setFetchMode(PDO::FETCH_INTO, $this->_sharedResult); + $stmt->bindValue(':key', $this->_codec->encodeKey($key)); $stmt->execute(); $row = $stmt->fetch(); $stmt->closeCursor(); + if ($row === false) { return false; - } elseif ($lifeTime !== null && $row['mtime'] < time() - $lifeTime) { - $this->deleteById($row['id']); + } elseif ($row->isExpired()) { + $this->deleteById($row->id); return false; } else { return true; @@ -397,23 +355,24 @@ * @param int $lifeTime * @return array */ - public function findById($id, $lifeTime = null) + public function findById($id, $lifeTime = -1) { - $stmt = $this->prepare(self::Q_FINDBYID); - $stmt->setFetchMode(PDO::FETCH_ASSOC); - $stmt->bindValue(':id', (int)$id, PDO::PARAM_INT); + $stmt = $this->_prepare(self::Q_FINDBYID); + $stmt->setFetchMode(PDO::FETCH_INTO, $this->_sharedResult); + $stmt->bindValue(':id', $id, PDO::PARAM_INT); $stmt->execute(); $row = $stmt->fetch(); $stmt->closeCursor(); + if ($row === false) { return null; - } elseif ($lifeTime !== null && $row['mtime'] < time() - $lifeTime) { + } elseif ($row->isExpired()) { $this->deleteById($id); return null; } else { return array( - 'key' => $this->decodeKey($row['arkey']), - 'value' => $this->decodeValue($row['value']), + 'key' => $this->_codec->decodeKey($row->key), + 'value' => $this->_codec->decodeValue($row->value), ); } } @@ -428,55 +387,47 @@ * @param int $lifeTime * @return string */ - public function get($key, $lifeTime = null) + public function get($key, $lifeTime = -1) { - $stmt = $this->prepare(self::Q_GET); - $stmt->setFetchMode(PDO::FETCH_ASSOC); - $stmt->bindValue(':key', $this->encodeKey($key), PDO::PARAM_STR); + $stmt = $this->_prepare(self::Q_GET); + $stmt->setFetchMode(PDO::FETCH_INTO, $this->_sharedResult); + $stmt->bindValue(':key', $this->_codec->encodeKey($key)); $stmt->execute(); $row = $stmt->fetch(); $stmt->closeCursor(); + if ($row === false) { return null; - } elseif ($lifeTime !== null && $row['mtime'] < time() - $lifeTime) { - $this->deleteById($row['id']); + } elseif ($row->isExpired()) { + $this->deleteById($row->id); return null; } else { - return $this->decodeValue($row['value']); + return $this->_codec->decodeValue($row->value); } } // }}} - // {{{ getDetail() + // {{{ getRaw() /** - * L[ÉηéR[hðæ¾·é + * L[ÉηéÊZbgIuWFNgðæ¾·é * * @param string $key - * @param int $lifeTime - * @return array + * @return P2KeyValueStore_Result */ - public function getDetail($key, $lifeTime = null) + public function getRaw($key) { - $stmt = $this->prepare(self::Q_GET); - $stmt->setFetchMode(PDO::FETCH_ASSOC); - $stmt->bindValue(':key', $this->encodeKey($key), PDO::PARAM_STR); + $stmt = $this->_prepare(self::Q_GET); + $stmt->setFetchMode(PDO::FETCH_CLASS, 'P2KeyValueStore_Result'); + $stmt->bindValue(':key', $this->_codec->encodeKey($key)); $stmt->execute(); $row = $stmt->fetch(); $stmt->closeCursor(); + if ($row === false) { return null; - } elseif ($lifeTime !== null && $row['mtime'] < time() - $lifeTime) { - $this->deleteById($row['id']); - return null; } else { - return array( - 'id' => (int)$row['id'], - 'key' => $this->decodeKey($row['arkey']), - 'value' => $this->decodeValue($row['value']), - 'mtime' => (int)$row['mtime'], - 'order' => (int)$row['sort_order'], - ); + return $row; } } @@ -490,35 +441,33 @@ * @param array $orderBy * @param int $limit * @param int $offset - * @param bool $getDetails + * @param bool $getRaw * @return array */ - public function getAll(array $orderBy = null, $limit = null, $offset = null, $getDetails = false) + public function getAll(array $orderBy = null, + $limit = null, $offset = null, + $getRaw = false) { $query = self::Q_GETALL . $this->buildOrderBy($orderBy) . $this->buildLimit($limit, $offset); - $stmt = $this->prepare($query, true); - $stmt->setFetchMode(PDO::FETCH_ASSOC); + $stmt = $this->_prepare($query, true); $stmt->execute(); + $values = array(); - if ($getDetails) { + if ($getRaw) { + $stmt->setFetchMode(PDO::FETCH_CLASS, 'P2KeyValueStore_Result'); while ($row = $stmt->fetch()) { - $key = $this->decodeKey($row['arkey']); - $values[$key] = array( - 'id' => (int)$row['id'], - 'key' => $key, - 'value' => $this->decodeValue($row['value']), - 'mtime' => (int)$row['mtime'], - 'order' => (int)$row['sort_order'], - ); + $values[$this->_codec->decodeKey($row->key)] = $row; } } else { + $stmt->setFetchMode(PDO::FETCH_INTO, $this->_sharedResult); while ($row = $stmt->fetch()) { - $values[$this->decodeKey($row['arkey'])] = $this->decodeValue($row['value']); + $value = $this->_codec->decodeValue($row->value); + $values[$this->_codec->decodeKey($row->key)] = $value; } } - $stmt->closeCursor(); + return $values; } @@ -540,15 +489,10 @@ $query = self::Q_GETIDS . $this->buildOrderBy($orderBy) . $this->buildLimit($limit, $offset); - $stmt = $this->prepare($query, true); - $stmt->setFetchMode(PDO::FETCH_COLUMN, 0); + $stmt = $this->_prepare($query, true); $stmt->execute(); - $ids = array(); - while (($id = $stmt->fetch()) !== false) { - $ids[] = (int)$id; - } - $stmt->closeCursor(); - return $ids; + + return $stmt->fetchAll(PDO::FETCH_COLUMN, 0); } // }}} @@ -568,14 +512,15 @@ $query = self::Q_GETKEYS . $this->buildOrderBy($orderBy) . $this->buildLimit($limit, $offset); - $stmt = $this->prepare($query, true); + $stmt = $this->_prepare($query, true); $stmt->setFetchMode(PDO::FETCH_COLUMN, 0); $stmt->execute(); + $keys = array(); while (($key = $stmt->fetch()) !== false) { - $keys[] = $this->decodeKey($key); + $keys[] = $this->_codec->decodeKey($key); } - $stmt->closeCursor(); + return $keys; } @@ -592,10 +537,10 @@ */ public function set($key, $value, $order = 0) { - $stmt = $this->prepare(self::Q_SET); - $stmt->bindValue(':key', $this->encodeKey($key), PDO::PARAM_STR); - $stmt->bindValue(':value', $this->encodeValue($value), PDO::PARAM_STR); - $stmt->bindValue(':order', (int)$order, PDO::PARAM_INT); + $stmt = $this->_prepare(self::Q_SET); + $stmt->bindValue(':key', $this->_codec->encodeKey($key)); + $stmt->bindValue(':value', $this->_codec->encodeValue($value)); + $stmt->bindValue(':order', $order, PDO::PARAM_INT); if ($stmt->execute()) { return $stmt->rowCount() == 1; } else { @@ -616,10 +561,10 @@ */ public function update($key, $value, $order = 0) { - $stmt = $this->prepare(self::Q_UPDATE); - $stmt->bindValue(':key', $this->encodeKey($key), PDO::PARAM_STR); - $stmt->bindValue(':value', $this->encodeValue($value), PDO::PARAM_STR); - $stmt->bindValue(':order', (int)$order, PDO::PARAM_INT); + $stmt = $this->_prepare(self::Q_UPDATE); + $stmt->bindValue(':key', $this->_codec->encodeKey($key)); + $stmt->bindValue(':value', $this->_codec->encodeValue($value)); + $stmt->bindValue(':order', $order, PDO::PARAM_INT); if ($stmt->execute()) { return $stmt->rowCount() == 1; } else { @@ -639,12 +584,12 @@ */ public function touch($key, $time = null) { - $stmt = $this->prepare(self::Q_TOUCH); - $stmt->bindValue(':key', $this->encodeKey($key), PDO::PARAM_STR); + $stmt = $this->_prepare(self::Q_TOUCH); + $stmt->bindValue(':key', $this->_codec->encodeKey($key)); if ($time === null) { $stmt->bindValue(':mtime', null, PDO::PARAM_NULL); } else { - $stmt->bindValue(':mtime', (int)$time, PDO::PARAM_INT); + $stmt->bindValue(':mtime', $time, PDO::PARAM_INT); } if ($stmt->execute()) { return $stmt->rowCount() == 1; @@ -665,9 +610,9 @@ */ public function setOrder($key, $order) { - $stmt = $this->prepare(self::Q_SETORDER); - $stmt->bindValue(':key', $this->encodeKey($key), PDO::PARAM_STR); - $stmt->bindValue(':order', (int)$order, PDO::PARAM_INT); + $stmt = $this->_prepare(self::Q_SETORDER); + $stmt->bindValue(':key', $this->_codec->encodeKey($key)); + $stmt->bindValue(':order', $order, PDO::PARAM_INT); if ($stmt->execute()) { return $stmt->rowCount() == 1; } else { @@ -686,8 +631,8 @@ */ public function delete($key) { - $stmt = $this->prepare(self::Q_DELETE); - $stmt->bindValue(':key', $this->encodeKey($key), PDO::PARAM_STR); + $stmt = $this->_prepare(self::Q_DELETE); + $stmt->bindValue(':key', $this->_codec->encodeKey($key)); if ($stmt->execute()) { return $stmt->rowCount() == 1; } else { @@ -706,8 +651,8 @@ */ public function deleteById($id) { - $stmt = $this->prepare(self::Q_DELETEBYID); - $stmt->bindValue(':id', (int)$id, PDO::PARAM_INT); + $stmt = $this->_prepare(self::Q_DELETEBYID); + $stmt->bindValue(':id', $id, PDO::PARAM_INT); if ($stmt->execute()) { return $stmt->rowCount() == 1; } else { @@ -726,7 +671,7 @@ */ public function clear() { - $stmt = $this->prepare(self::Q_CLEAR, true); + $stmt = $this->_prepare(self::Q_CLEAR, true); if ($stmt->execute()) { return $stmt->rowCount(); } else { @@ -745,7 +690,7 @@ */ public function gc($lifeTime) { - $stmt = $this->prepare(self::Q_GC, true); + $stmt = $this->_prepare(self::Q_GC, true); $stmt->bindValue(':expires', time() - $lifeTime, PDO::PARAM_INT); if ($stmt->execute()) { return $stmt->rowCount(); @@ -766,7 +711,7 @@ */ public function vacuum() { - self::$_objects[$this->_path]['statements'] = array(); + self::$_stmtCache[$this->_pdoId] = array(); $this->_pdo->exec('VACUUM'); } @@ -783,10 +728,11 @@ */ public function count() { - $stmt = $this->prepare(self::Q_COUNT); + $stmt = $this->_prepare(self::Q_COUNT); $stmt->execute(); $ret = (int)$stmt->fetchColumn(); $stmt->closeCursor(); + return $ret; } @@ -870,20 +816,65 @@ /** * gpµÄ¢éPDOIuWFNgðÔ· * - * @param &$quotedTableName + * @param void * @return PDO */ - public function getPDO(&$quotedTableName = null) + public function getPDO() { - $quotedTableName = $this->_quotedTableName; return $this->_pdo; } // }}} + // {{{ getCodec() + + /** + * gpµÄ¢éCodecIuWFNgðÔ· + * + * @param void + * @return P2KeyValueStore_Codec_Interface + */ + public function getCodec() + { + return $this->_codec; + } + + // }}} + // {{{ getTableName() + + /** + * NH[gÏÝÌe[u¼ðÔ· + * + * @param void + * @return string + */ + public function getTableName() + { + return $this->_quotedTableName; + } + + // }}} + // {{{ loadClass() + + /** + * NX[_[ + * + * @string $name + * @return void + */ + static public function loadClass($name) + { + if (strncmp($name, 'P2KeyValueStore_', 16) === 0) { + include dirname(__FILE__) . '/' . str_replace('_', '/', $name) . '.php'; + } + } + + // }}} } // }}} +spl_autoload_register('P2KeyValueStore::loadClass'); + /* * Local Variables: * mode: php Modified: p2ex/trunk/lib/P2Util.php =================================================================== --- p2ex/trunk/lib/P2Util.php 2010-01-13 00:37:02 UTC (rev 772) +++ p2ex/trunk/lib/P2Util.php 2010-01-13 04:36:03 UTC (rev 773) @@ -1029,6 +1029,18 @@ } // }}} + // }}} + // {{{ isBrowserAndroid() + + /** + * uEUªAndroidhÈçtrueðÔ· + */ + static public function isBrowserAndroid() + { + return (strpos($_SERVER['HTTP_USER_AGENT'], 'Android') !== false); + } + + // }}} // {{{ isUrlWikipediaJa() /** @@ -1817,13 +1829,13 @@ require P2_LIB_DIR . '/P2Client.php'; } - if (!is_dir($_conf['cookie_dir'])) { - FileCtl::mkdir_r($_conf['cookie_dir']); + if (!is_dir($_conf['db_dir'])) { + FileCtl::mkdir_r($_conf['db_dir']); } try { return new P2Client($_conf['p2_2ch_mail'], $_conf['p2_2ch_pass'], - $_conf['cookie_dir'], (bool)$_conf['p2_2ch_ignore_cip']); + $_conf['db_dir'], (bool)$_conf['p2_2ch_ignore_cip']); } catch (P2Exception $e) { p2die($e->getMessage()); } Modified: p2ex/trunk/lib/ResHist.php =================================================================== --- p2ex/trunk/lib/ResHist.php 2010-01-13 00:37:02 UTC (rev 772) +++ p2ex/trunk/lib/ResHist.php 2010-01-13 04:36:03 UTC (rev 773) @@ -116,8 +116,6 @@ { global $_conf, $STYLE; - $sid_q = (defined('SID')) ? '&' . strip_tags(SID) : ''; - // Pager õ $perPage = 100; $params = array( @@ -160,10 +158,10 @@ $footer_q = "#r{$lf}"; } $time = time(); - $href_ht = $_conf['read_php'] . "?host=" . $a_res->host . "&bbs=" . $a_res->bbs . "&key=" . $a_res->key . $ls_q . "{$_conf['k_at_a']}&nt={$time}{$footer_q}"; + $href_ht = "{$_conf['read_php']}?host={$a_res->host}&bbs={$a_res->bbs}&key={$a_res->key}{$ls_q}{$_conf['k_at_a']}&nt={$time}{$footer_q}"; } $info_view_ht = <<<EOP - <a href="info.php?host={$a_res->host}&bbs={$a_res->bbs}&key={$a_res->key}{$_conf['k_at_a']}" target="_self" onclick="return OpenSubWin('info.php?host={$a_res->host}&bbs={$a_res->bbs}&key={$a_res->key}&popup=1{$sid_q}',{$STYLE['info_pop_size']},0,0)">îñ</a> + <a href="info.php?host={$a_res->host}&bbs={$a_res->bbs}&key={$a_res->key}{$_conf['k_at_a']}" target="_self" onclick="return OpenSubWin('info.php?host={$a_res->host}&bbs={$a_res->bbs}&key={$a_res->key}&popup=1',{$STYLE['info_pop_size']},0,0)">îñ</a> EOP; $res_ht = "<div class=\"res\">\n"; Modified: p2ex/trunk/lib/Session.php =================================================================== --- p2ex/trunk/lib/Session.php 2010-01-13 00:37:02 UTC (rev 772) +++ p2ex/trunk/lib/Session.php 2010-01-13 04:36:03 UTC (rev 773) @@ -78,7 +78,6 @@ $snm = session_name(); $sid = session_id(); output_add_rewrite_var($snm, $sid); - $GLOBALS['_conf']['sid_at_a'] = '&' . rawurlencode($snm) . '=' . rawurlencode($sid); } /* Modified: p2ex/trunk/lib/ShowThreadK.php =================================================================== --- p2ex/trunk/lib/ShowThreadK.php 2010-01-13 00:37:02 UTC (rev 772) +++ p2ex/trunk/lib/ShowThreadK.php 2010-01-13 04:36:03 UTC (rev 773) @@ -288,7 +288,7 @@ if (($ng_type & self::NG_AA) && P2_AAS_AVAILABLE) { $aas_url = "aas.php?host={$this->thread->host}&bbs={$this->thread->bbs}&key={$this->thread->key}&resnum={$i}"; if (P2_AAS_AVAILABLE == 2) { - $aas_txt = "<img src=\"{$aas_url}{$_conf['k_at_a']}&inline=1{$_conf['sid_at_a']}\">"; + $aas_txt = "<img src=\"{$aas_url}{$_conf['k_at_a']}&inline=1\">"; } else { $aas_txt = "AAS"; } @@ -1005,7 +1005,7 @@ } else { $prv_url = "ic2.php?r={$r_type}&t=1&uri={$url_en}"; } - $img_str = "<img src=\"{$prv_url}{$_conf['sid_at_a']}\">"; + $img_str = "<img src=\"{$prv_url}\">"; } $inline_preview_done = true; } else { @@ -1035,7 +1035,7 @@ // CCvr [ªLøÅATlC\¦§ÀÈàÈç if ($this->thumbnailer->ini['General']['inline'] == 1 && $inline_preview_flag) { - $img_str = "<img src=\"ic2.php?r=2&t=1&uri={$url_en}{$this->img_memo_query}{$_conf['sid_at_a']}\">"; + $img_str = "<img src=\"ic2.php?r=2&t=1&uri={$url_en}{$this->img_memo_query}\">"; $inline_preview_done = true; } else { $img_url .= $this->img_memo_query; Modified: p2ex/trunk/lib/Thumbnailer/Common.php =================================================================== --- p2ex/trunk/lib/expack/ic2/Thumbnailer/Common.php 2010-01-13 00:37:02 UTC (rev 772) +++ p2ex/trunk/lib/Thumbnailer/Common.php 2010-01-13 04:36:03 UTC (rev 773) @@ -6,22 +6,6 @@ require_once 'PEAR.php'; -// {{{ _thumbnailer_common_unlink_tempfile() - -/** - * Remove the temporary file. - * - * @param string $file - * @return void - */ -function _thumbnailer_common_unlink_tempfile($file) -{ - if (file_exists($file)) { - @unlink($file); - } -} - -// }}} // {{{ Thumbnailer_Common /** @@ -319,7 +303,7 @@ protected function _tempnam() { $tmp = tempnam($this->_tempDir, 'thumb_temp_'); - register_shutdown_function('_thumbnailer_common_unlink_tempfile', $tmp); + register_shutdown_function('Thumbnailer_Common::removeTemporaryFile', $tmp); return $tmp; } @@ -352,6 +336,22 @@ } // }}} + // {{{ removeTemporaryFile() + + /** + * Removes the temporary file. + * + * @param string $filename + * @return void + */ + static public function removeTemporaryFile($filename) + { + if (file_exists($filename)) { + @unlink($filename); + } + } + + // }} } // }}} Modified: p2ex/trunk/lib/Thumbnailer/Gd.php =================================================================== --- p2ex/trunk/lib/expack/ic2/Thumbnailer/Gd.php 2010-01-13 00:37:02 UTC (rev 772) +++ p2ex/trunk/lib/Thumbnailer/Gd.php 2010-01-13 04:36:03 UTC (rev 773) @@ -4,8 +4,6 @@ * PHP Version 5 */ -require_once dirname(__FILE__) . '/Common.php'; - // {{{ Thumbnailer_Gd /** Modified: p2ex/trunk/lib/Thumbnailer/Imagemagick.php =================================================================== --- p2ex/trunk/lib/expack/ic2/Thumbnailer/Imagemagick.php 2010-01-13 00:37:02 UTC (rev 772) +++ p2ex/trunk/lib/Thumbnailer/Imagemagick.php 2010-01-13 04:36:03 UTC (rev 773) @@ -4,8 +4,6 @@ * PHP Version 5 */ -require_once dirname(__FILE__) . '/Common.php'; - // {{{ Thumbnailer_Imagemagick /** @@ -15,11 +13,31 @@ { // {{{ properties - protected $_imagemagick_convert = 'convert'; - protected $_imagemagick_version_gte6 = true; - protected $_imagemagick_have_flatten = true; + protected $_imageMagickConvert = 'convert'; + protected $_imageMagickVersion6 = true; + protected $_imageMagickSupportsFlatten = true; + protected $_imageMagickSupportsAdjoin = true; // }}} + // {{{ __construct + + /** + * Constructor + * + * @param string $path + */ + public function __construct($path = null) + { + if ($path !== null) { + $this->setImageMagickConvertPath($path); + } + + if (strncasecmp(PHP_OS, 'win', 3) == 0) { + $this->_imageMagickSupportsAdjoin = false; + } + } + + // }}} // {{{ setImageMagickConvertPath() /** @@ -32,16 +50,16 @@ { if (is_file($path) && is_executable($path)) { $convert = escapeshellarg($path); - $this->_imagemagick_convert = $convert; + $this->_imageMagickConvert = $convert; $output = null; @exec("$convert --version 2>&1", $output); if ($output && preg_match('/Version: ImageMagick (([0-9.]+)-[0-9]+)/', $output[0], $v)) { - $this->_imagemagick_version_gte6 = version_compare($v[2], '6.0.0', 'ge'); - $this->_imagemagick_have_flatten = version_compare($v[1], '6.3.6-2', 'ge'); + $this->_imageMagickVersion6 = version_compare($v[2], '6.0.0', 'ge'); + $this->_imageMagickSupportsFlatten = version_compare($v[1], '6.3.6-2', 'ge'); } else { - $this->_imagemagick_version_gte6 = false; - $this->_imagemagick_have_flatten = false; + $this->_imageMagickVersion6 = false; + $this->_imageMagickSupportsFlatten = false; } } } @@ -136,29 +154,37 @@ */ protected function _convert($source, $size) { - $source = (!$source || $source == '-') ? '-' : escapeshellarg($source); + if ($source === '' || $source === null) { + $source = '-'; + } extract($size); - $command = $this->_imagemagick_convert; + $command = $this->_imageMagickConvert; // ³ÌTCYðwè - $command .= sprintf(' -size %dx%d', $w, $h); + $command .= sprintf(' -size "%dx%d"', $w, $h); // ¡t[©çÈéæ©àµêȢƫ - if ($this->_imagemagick_have_flatten) { - $command .= ' -flatten'; + if (preg_match('/\\.gif$/i', $source)) { + if ($this->_imageMagickSupportsFlatten && !$this->doesTrimming()) { + $command .= ' -flatten'; + } + if ($this->_imageMagickSupportsAdjoin) { + $source .= '[0]'; + } } - if (!$this->windows && preg_match('/\\.gif$/', $source)) { - $command .= ' +adjoin'; - $source .= '[0]'; + + // GXP[v + if ($source != '-') { + $source = escapeshellarg($source); } // NbvµÄpCv if ($this->doesTrimming()) { - $command .= sprintf(' -format PNG -crop %dx%d+%d+%d %s - | %s -size %dx%d', + $command .= sprintf(' -format PNG -crop "%dx%d+%d+%d" %s - | %s -size "%dx%d"', $sw, $sh, $sx, $sy, $source, - $this->_imagemagick_convert, + $this->_imageMagickConvert, $sw, $sh); $source = '-'; } @@ -168,7 +194,8 @@ if ($degrees = $this->getRotation()) { $bgcolor = $this->getBgColor(); $command .= sprintf(' -rotate %d', $degrees); - $command .= sprintf(' -background rgb(%d,%d,%d)', $bgcolor[0], $bgcolor[1], $bgcolor[2]); + $command .= sprintf(' -background "rgb(%d,%d,%d)"', + $bgcolor[0], $bgcolor[1], $bgcolor[2]); if ($degrees % 180 == 90) { $_t = $tw; $tw = $th; @@ -177,17 +204,17 @@ } // TlCÌTCYðwèE^f[^Í - if ($this->_imagemagick_version_gte6) { + if ($this->_imageMagickVersion6) { if ($this->doesResampling()) { - $command .= sprintf(' -thumbnail %dx%d!', $tw, $th); + $command .= sprintf(' -thumbnail "%dx%d!"', $tw, $th); } else { $command .= ' -strip'; } } else { if ($this->doesResampling()) { - $command .= sprintf(' -scale %dx%d!', $tw, $th); + $command .= sprintf(' -scale "%dx%d!"', $tw, $th); } - $command .= " +profile '*'"; + $command .= ' +profile "*"'; } // TlCÌæ`®Æi¿ Modified: p2ex/trunk/lib/Thumbnailer/Imagick.php =================================================================== --- p2ex/trunk/lib/expack/ic2/Thumbnailer/Imagick.php 2010-01-13 00:37:02 UTC (rev 772) +++ p2ex/trunk/lib/Thumbnailer/Imagick.php 2010-01-13 04:36:03 UTC (rev 773) @@ -4,8 +4,6 @@ * PHP Version 5 */ -require_once dirname(__FILE__) . '/Common.php'; - // {{{ Thumbnailer_Imagick /** Modified: p2ex/trunk/lib/bootstrap.php =================================================================== --- p2ex/trunk/lib/bootstrap.php 2010-01-13 00:37:02 UTC (rev 772) +++ p2ex/trunk/lib/bootstrap.php 2010-01-13 04:36:03 UTC (rev 773) @@ -5,14 +5,83 @@ */ require_once 'Net/UserAgent/Mobile.php'; -require_once $P2_LIB_DIR_S . 'Session.php'; -require_once $P2_LIB_DIR_S . 'Login.php'; +require_once P2_LIB_DIR . '/Session.php'; +require_once P2_LIB_DIR . '/Login.php'; +// {{{ [U[Ýè Ç + +// [U[Ýèt@C +$_conf['conf_user_file'] = $_conf['pref_dir'] . '/conf_user.srd.cgi'; + +// [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ªóêÄ¢½ÌÅíµÜµ½B</p>'; + $conf_user = array(); + } else { + $dispname = '$_conf[\'pref_dir\']/' . basename($_conf['conf_user_file']); + p2die("óêÄ¢é[U[Ýèt@C {$dispname} ðíūܹñŵ½B"); + } + } + + // [U[ÝèÌo[Wð`FbN + if (array_key_exists('.', $conf_user) && + preg_match('/^\\d{6}\\.\\d{4}$/', $conf_user['.'])) + { + $config_version = $conf_user['.']; + } else { + $config_version = '000000.0000'; + } + + if ($config_version !== $_conf['p2expack']) { + // ÝèÌXV + if ($migrators = p2checkmigration($config_version)) { + $conf_user = p2migrate($conf_user, $migrators); + } + + // ftHgÝèðÇÝÝA[U[ÝèÆÆàÉ}[W + include P2_CONF_DIR . '/conf_user_def.inc.php'; + $_conf = array_merge($_conf, $conf_user_def, $conf_user); + $creae_config_cache = true; + } else { + // LbV ³êÄ¢½[U[Ýèð}[W + $_conf = array_merge($_conf, $conf_user); + $creae_config_cache = false; + } +} else { + // ftHgÝèðÇÝÝA}[W + include P2_CONF_DIR . '/conf_user_def.inc.php'; + $_conf = array_merge($_conf, $conf_user_def); + $creae_config_cache = true; +} + +// Vµ¢[U[ÝèðLbV +if ($creae_config_cache) { + $conf_user = array('.' => $_conf['p2expack']); + foreach ($conf_user_def as $k => $v) { + $conf_user[$k] = $_conf[$k]; + } + $cont = serialize($conf_user); + if (FileCtl::file_write_contents($_conf['conf_user_file'], $cont) === false) { + $dispname = '$_conf[\'pref_dir\']/' . basename($_conf['conf_user_file']); + p2die("[U[Ýèt@C {$dispname} É«ßܹñŵ½B"); + } +} + +// }}} // {{{ zXg`FbN if ($_conf['secure']['auth_host'] || $_conf['secure']['auth_bbq']) { if (!class_exists('HostCheck', false)) { - include $P2_LIB_DIR_S . 'HostCheck.php'; + include P2_LIB_DIR . '/HostCheck.php'; } if (($_conf['secure']['auth_host'] && HostCheck::getHostAuth() == false) || ($_conf['secure']['auth_bbq'] && HostCheck::getHostBurned() == true) @@ -22,16 +91,9 @@ } // }}} -// {{{ NGXgÏÌ +// {{{ NGXgÏÌØƶR[hÏ· -// VKOCÆo[OC̯wèÍ è¦È¢ÌÅAG[ðo· -if (isset($_POST['submit_new']) && isset($_POST['submit_member'])) { - p2die('³øÈURLÅ·B'); -} - /** - * NGXgÏÌØƶR[hÏ· - * * ú{êðüÍ·éÂ\«Ì étH[ÉÍBµvfÅ * GR[fBO»èp̶ñðdñÅ¢é * @@ -42,25 +104,30 @@ // NULLoCgA^bNÆXNvgCWFNVÌØA // GR[fBO»èp¶ñÌæ¾ - if (!empty($_GET)) { - array_walk_recursive($_GET, 'p2_scan_nullbyte'); - p2_scan_script_injection($_GET); - if (array_key_exists('_hint', $_GET)) { - $hint = $_GET['_hint']; - } - } if (!empty($_POST)) { + // VKOCÆo[OC̯wèÍ è¦È¢ÌÅAG[ðo· + if (isset($_POST['submit_new']) && isset($_POST['submit_member'])) { + p2die('³øÈNGXgÅ·B'); + } + array_walk_recursive($_POST, 'p2_scan_nullbyte'); p2_scan_script_injection($_POST); if (array_key_exists('_hint', $_POST)) { $hint = $_POST['_hint']; } } + if (!empty($_GET)) { + array_walk_recursive($_GET, 'p2_scan_nullbyte'); + p2_scan_script_injection($_GET); + if (array_key_exists('_hint', $_GET)) { + $hint = $_GET['_hint']; + } + } // GR[fBO»è if ($hint) { $request_encoding = mb_detect_encoding($hint, 'ASCII,UTF-8,SJIS-win'); - if (!strcasecmp($request_encoding, 'ASCII')) { + if ($request_encoding == 'ASCII') { p2die('s³ÈGR[fBO»èqgÅ·B'); } } else { @@ -68,7 +135,7 @@ } // UTF-8ÈçShift_JISÉÏ· - if (!strcasecmp($request_encoding, 'UTF-8')) { + if ($request_encoding == 'UTF-8') { mb_convert_variables('SJIS-win', 'UTF-8', $_GET, $_POST); } @@ -97,8 +164,8 @@ $mobile = Net_UserAgent_Mobile::singleton(); -// iPhone, iPod Touch -if (P2Util::isBrowserIphone()) { +// iPhone, iPod Touch or Android +if (P2Util::isBrowserIphone() || P2Util::isBrowserAndroid()) { $_conf['ktai'] = true; $_conf['iphone'] = true; $_conf['input_type_search'] = true; @@ -111,9 +178,13 @@ $_conf['input_type_search'] = true; $_conf['accept_charset'] = 'UTF-8'; - // Windows Mobile, gÑQ[@ - } elseif (P2Util::isClientOSWindowsCE() || P2Util::isBrowserNintendoDS() || P2Util::isBrowserPSP()) { + // Windows Mobile, + } elseif (P2Util::isClientOSWindowsCE()) { $_conf['ktai'] = true; + + // gÑQ[@ + } elseif (P2Util::isBrowserNintendoDS() || P2Util::isBrowserPSP()) { + $_conf['ktai'] = true; } // gÑ @@ -204,89 +275,8 @@ } // }}} -// {{{ [UÝè Ç +// {{{ [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ÝèðÇÝÞ - include $P2_CONF_DIR_S . 'conf_user_def.inc.php'; - - // ÝèÌXV - if (!array_key_exists('mobile.link_youtube', $conf_user)) { - if (!function_exists('p2_conf_user_update_080908')) { - include $P2_LIB_DIR_S . 'conf_user_updater.inc.php'; - } - $conf_user = p2_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ÝèðÇÝÞ - include $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']}\"" : ''; @@ -294,7 +284,7 @@ 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']; + $_conf['get_new_res_l'] = 'l' . $_conf['get_new_res']; } } else { $_conf['get_new_res_l'] = 'l200'; @@ -308,7 +298,7 @@ // {{{ fUCÝè Ç $skin_name = $default_skin_name = 'conf_user_style'; -$skin = $P2_CONF_DIR_S . 'conf_user_style.inc.php'; +$skin = P2_CONF_DIR . '/conf_user_style.inc.php'; if (!$_conf['ktai'] && $_conf['expack.skin.enabled']) { // Û¶³êÄ¢éXL¼ $saved_skin_name = null; @@ -347,12 +337,12 @@ if ($skin_name == $default_skin_name) { break; } - $user_skin_path = P2_USER_SKIN_DIR . DIRECTORY_SEPARATOR . $skin_name . '.php'; + $user_skin_path = P2_USER_SKIN_DIR . '/' . $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'; + $bundled_skin_path = P2_SKIN_DIR . '/' . $skin_name . '.php'; if (file_exists($bundled_skin_path)) { $skin = $bundled_skin_path; break; @@ -363,7 +353,7 @@ if (!file_exists($skin)) { $skin_name = 'conf_user_style'; - $skin = $P2_CONF_DIR_S . 'conf_user_style.inc.php'; + $skin = P2_CONF_DIR . '/conf_user_style.inc.php'; } $skin_en = rawurlencode($skin_name) . '&_=' . P2_VERSION_ID; if ($_conf['view_forced_by_query']) { @@ -371,9 +361,9 @@ } // ftHgÝèðÇÝñÅ -include $P2_CONF_DIR_S . 'conf_user_style.inc.php'; +include P2_CONF_DIR . '/conf_user_style.inc.php'; // XLÅã« -if ($skin != $P2_CONF_DIR_S . 'conf_user_style.inc.php') { +if ($skin != P2_CONF_DIR . '/conf_user_style.inc.php') { include $skin; } @@ -396,7 +386,7 @@ if (!$_conf['ktai']) { if (!function_exists('p2_fontconfig_apply_custom')) { - include $P2_LIB_DIR_S . 'fontconfig.inc.php'; + include P2_LIB_DIR . '/fontconfig.inc.php'; } if ($_conf['expack.am.enabled']) { @@ -532,7 +522,7 @@ switch ($_conf['mobile.display_accesskey']) { case 2: if (!function_exists('p2_get_emoji')) { - include $P2_LIB_DIR_S . 'emoji.inc.php'; + include P2_LIB_DIR . '/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')); @@ -636,8 +626,6 @@ // ¼OÍAZbVNbL[ðjü·éƫ̽ßÉAZbVpÌL³ÉÖíç¸Ýè·é session_name('PS'); -$_conf['sid_at_a'] = ''; - // {{{ ZbVf[^Û¶fBNgð`FbN if ($_conf['session_save'] == 'p2' and session_module_name() == 'files') { @@ -660,16 +648,22 @@ // ¡Ì¨CÉZbgðg¤Æ« if ($_conf['expack.misc.multi_favs']) { if (!class_exists('FavSetManager', false)) { - include $P2_LIB_DIR_S . 'FavSetManager.php'; + include P2_LIB_DIR . '/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'] = ''; + $_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'] = ''; } // }}} Modified: p2ex/trunk/lib/expack/ExpackLoader.php =================================================================== --- p2ex/trunk/lib/expack/ExpackLoader.php 2010-01-13 00:37:02 UTC (rev 772) +++ p2ex/trunk/lib/expack/ExpackLoader.php 2010-01-13 04:36:03 UTC (rev 773) @@ -112,11 +112,7 @@ if ((!$_conf['ktai'] && $_conf['expack.ic2.enabled'] % 2 == 1) || ($_conf['ktai'] && $_conf['expack.ic2.enabled'] >= 2)) { - self::loadFunction('ic2_loadconfig', 'ic2/loadconfig.inc.php'); - self::loadClass('IC2_DataObject_Images', 'ic2/DataObject/Images.php'); - self::loadClass('IC2_DataObject_BlackList', 'ic2/DataObject/BlackList.php'); - self::loadClass('IC2_DataObject_Errors', 'ic2/DataObject/Errors.php'); - self::loadClass('IC2_Thumbnailer', 'ic2/Thumbnailer.php'); + self::loadFunction('ic2_loadconfig', 'ic2/bootstrap.php'); define('P2_IMAGECACHE_AVAILABLE', 2); } else { define('P2_IMAGECACHE_AVAILABLE', 0); @@ -199,7 +195,7 @@ if ($_conf['iphone']) { $aShowThread->aas_rotate = '↻'; } elseif ($_conf['ktai']) { - $mobile = &Net_UserAgent_Mobile::singleton(); + $mobile = Net_UserAgent_Mobile::singleton(); /** * @link http://www.nttdocomo.co.jp/service/imode/make/content/pictograph/ * @link http://www.au.kddi.com/ezfactory/tec/spec/3.html Modified: p2ex/trunk/lib/expack/ic2/DataObject/BlackList.php =================================================================== --- p2ex/trunk/lib/expack/ic2/DataObject/BlackList.php 2010-01-13 00:37:02 UTC (rev 772) +++ p2ex/trunk/lib/expack/ic2/DataObject/BlackList.php 2010-01-13 04:36:03 UTC (rev 773) @@ -1,14 +1,5 @@ <?php -require_once P2EX_LIB_DIR . '/ic2/loadconfig.inc.php'; -require_once P2EX_LIB_DIR . '/ic2/DataObject/Common.php'; -// {{{ constants - -define('P2_IMAGECACHE_BLACKLIST_NOMORE', 0); -define('P2_IMAGECACHE_BLACKLIST_ABORN', 1); -define('P2_IMAGECACHE_BLACKLIST_VIRUS', 2); - -// }}} // {{{ IC2_DataObject_BlackList class IC2_DataObject_BlackList extends IC2_DataObject_Common Modified: p2ex/trunk/lib/expack/ic2/DataObject/Common.php =================================================================== --- p2ex/trunk/lib/expack/ic2/DataObject/Common.php 2010-01-13 00:37:02 UTC (rev 772) +++ p2ex/trunk/lib/expack/ic2/DataObject/Common.php 2010-01-13 04:36:03 UTC (rev 773) @@ -1,7 +1,4 @@ <?php -require_once 'DB.php'; -require_once 'DB/DataObject.php'; -require_once P2EX_LIB_DIR . '/ic2/loadconfig.inc.php'; // {{{ IC2_DataObject_Common Modified: p2ex/trunk/lib/expack/ic2/DataObject/Errors.php =================================================================== --- p2ex/trunk/lib/expack/ic2/DataObject/Errors.php 2010-01-13 00:37:02 UTC (rev 772) +++ p2ex/trunk/lib/expack/ic2/DataObject/Errors.php 2010-01-13 04:36:03 UTC (rev 773) @@ -1,6 +1,4 @@ <?php -require_once P2EX_LIB_DIR . '/ic2/loadconfig.inc.php'; -require_once P2EX_LIB_DIR . '/ic2/DataObject/Common.php'; // {{{ IC2_DataObject_Errors Modified: p2ex/trunk/lib/expack/ic2/DataObject/Images.php =================================================================== --- p2ex/trunk/lib/expack/ic2/DataObject/Images.php 2010-01-13 00:37:02 UTC (rev 772) +++ p2ex/trunk/lib/expack/ic2/DataObject/Images.php 2010-01-13 04:36:03 UTC (rev 773) @@ -1,23 +1,5 @@ <?php -require_once P2EX_LIB_DIR . '/ic2/loadconfig.inc.php'; -require_once P2EX_LIB_DIR . '/ic2/DataObject/Common.php'; -require_once P2EX_LIB_DIR . '/ic2/DataObject/BlackList.php'; -require_once P2EX_LIB_DIR . '/ic2/DataObject/Errors.php'; -// {{{ constants - -define('P2_IMAGECACHE_OK', 0); -define('P2_IMAGECACHE_ABORN', 1); -define('P2_IMAGECACHE_BROKEN', 2); -define('P2_IMAGECACHE_LARGE', 3); -define('P2_IMAGECACHE_VIRUS', 4); - -// }}} -// {{{ GLOBALS - -$GLOBALS['_P2_GETIMAGE_CACHE'] = array(); - -// }}} // {{{ IC2_DataObject_Images class IC2_DataObject_Images extends IC2_DataObject_Common Copied: p2ex/trunk/lib/expack/ic2/DatabaseManager.php (from rev 772, p2ex/trunk/lib/expack/ic2/managedb.inc.php) =================================================================== --- p2ex/trunk/lib/expack/ic2/DatabaseManager.php (rev 0) +++ p2ex/trunk/lib/expack/ic2/DatabaseManager.php 2010-01-13 04:36:03 UTC (rev 773) @@ -0,0 +1,286 @@ +<?php + +// {{{ IC2_DatabaseManager + +/** + * ImageCache2 - æîñðì·éNX + */ +class IC2_DatabaseManager +{ + // {{{ update() + + /** + * æîñðXV + */ + static public function update($updated) + { + if (empty($updated)) { + return; + } + if (!is_array($updated)) { + global $_info_msg_ht; + $_info_msg_ht .= '<p>WARNING! IC2_DatabaseManager::update(): s³Èø</p>'; + return; + } + + // gUNVÌJn + $ta = new IC2_DataObject_Images; + $db = $ta->getDatabaseConnection(); + if ($db->phptype == 'pgsql') { + $ta->query('BEGIN'); + } elseif ($db->phptype == 'sqlite') { + $db->query('BEGIN;'); + } + + // æf[^ðXV + foreach ($updated as $id => $data) { + $icdb = new IC2_DataObject_Images; + $icdb->whereAdd("id = $id"); + if ($icdb->find(true)) { + // ðXV + if ($icdb->memo != $data['memo']) { + $memo = new IC2_DataObject_Images; + $memo->memo = (strlen($data['memo']) > 0) ? $data['memo'] : ''; + $memo->whereAdd("id = $id"); + $memo->update(); + } + // NðXV + if ($icdb->rank != $data['rank']) { + $rank = new IC2_DataObject_Images; + $rank->rank = $data['rank']; + $rank->whereAddQuoted('size', '=', $icdb->size); + $rank->whereAddQuoted('md5', '=', $icdb->md5); + $rank->whereAddQuoted('mime', '=', $icdb->mime); + $rank->update(); + } + } + } + + // gUNVÌR~bg + if ($db->phptype == 'pgsql') { + $ta->query('COMMIT'); + } elseif ($db->phptype == 'sqlite') { + $db->query('COMMIT;'); + } + } + + // }}} + // {{{ remove() + + /** + * æðí + */ + static public function remove($target, $to_blacklist = false) + { + $removed_files = array(); + if (empty($target)) { + return $removed_files; + } + if (!is_array($target)) { + if (is_integer($target) || ctype_digit($target)) { + $id = (int) $target; + if ($id > 0) { + $target = array($id); + } else { + return $removed_files; + } + } else { + global $_info_msg_ht; + $_info_msg_ht .= '<p>WARNING! IC2_DatabaseManager::remove(): s³Èø</p>'; + return $removed_files; + } + } + + // gUNVÌJn + $ta = new IC2_DataObject_Images; + $db = $ta->getDatabaseConnection(); + if ($db->phptype == 'pgsql') { + $ta->query('BEGIN'); + } elseif ($db->phptype == 'sqlite') { + $db->query('BEGIN;'); + } + + // æðí + foreach ($target as $id) { + $icdb = new IC2_DataObject_Images; + $icdb->whereAdd("id = {$id}"); + + if ($icdb->find(true)) { + // LbV µÄ¢ét@Cðí + $t1 = new IC2_Thumbnailer(IC2_Thumbnailer::SIZE_PC); + $t2 = new IC2_Thumbnailer(IC2_Thumbnailer::SIZE_MOBILE); + $t3 = new IC2_Thumbnailer(IC2_Thumbnailer::SIZE_INTERMD); + $srcPath = $t1->srcPath($icdb->size, $icdb->md5, $icdb->mime); + $t1Path = $t1->thumbPath($icdb->size, $icdb->md5, $icdb->mime); + $t2Path = $t2->thumbPath($icdb->size, $icdb->md5, $icdb->mime); + $t3Path = $t3->thumbPath($icdb->size, $icdb->md5, $icdb->mime); + if (file_exists($srcPath)) { + unlink($srcPath); + $removed_files[] = $srcPath; + } + if (file_exists($t1Path)) { + unlink($t1Path); + $removed_files[] = $t1Path; + } + if (file_exists($t2Path)) { + unlink($t2Path); + $removed_files[] = $t2Path; + } + if (file_exists($t3Path)) { + unlink($t3Path); + $removed_files[] = $t3Path; + } + + // ubNXgèÌõ + if ($to_blacklist) { + $_blacklist = new IC2_DataObject_BlackList; + $_blacklist->size = $icdb->size; + $_blacklist->md5 = $icdb->md5; + if ($icdb->mime == 'clamscan/infected' || $icdb->rank == -4) { + $_blacklist->type = 2; + } elseif ($icdb->rank < 0) { + $_blacklist->type = 1; + } else { + $_blacklist->type = 0; + } + } + + // ¯êæðõ + $remover = new IC2_DataObject_Images; + $remover->whereAddQuoted('size', '=', $icdb->size); + $remover->whereAddQuoted('md5', '=', $icdb->md5); + //$remover->whereAddQuoted('mime', '=', $icdb->mime); // SizeÆMD5Å\ª + $remover->find(); + while ($remover->fetch()) { + // ubNXgèÉ·é + if ($to_blacklist) { + $blacklist = clone $_blacklist; + $blacklist->uri = $remover->uri; + $blacklist->insert(); + } + // e[u©çÁ + $remover->delete(); + } + } + } + + // gUNVÌR~bg + if ($db->phptype == 'pgsql') { + $ta->query('COMMIT'); + } elseif ($db->phptype == 'sqlite') { + $db->query('COMMIT;'); + } + + return $removed_files; + } + + // }}} + // {{{ setRank() + + /** + * NðÝè + */ + static public function setRank($target, $rank) + { + if (empty($target)) { + return; + } + if (!is_array($target)) { + if (is_integer($updated) || ctype_digit($updated)) { + $id = (int)$updated; + if ($id > 0) { + $updated = array($id); + } else { + return; + } + } else { + global $_info_msg_ht; + $_info_msg_ht .= '<p>WARNING! IC2_DatabaseManager::setRank(): s³Èø</p>'; + return $removed_files; + } + } + + $icdb = new IC2_DataObject_Images; + $icdb->rank = $rank; + foreach ($target as $id) { + $icdb->whereAdd("id = $id", 'OR'); + } + $icdb->update(); + } + + // }}} + // {{{ addMemo() + + /** + * ðÇÁ + */ + static public function addMemo($target, $memo) + { + if (empty($target)) { + return; + } + if (!is_array($target)) { + if (is_integer($updated) || ctype_digit($updated)) { + $id = (int)$updated; + if ($id > 0) { + $updated = array($id); + } else { + return; + } + } else { + global $_info_msg_ht; + $_info_msg_ht .= '<p>WARNING! IC2_DatabaseManager::addMemo(): s³Èø</p>'; + return $removed_files; + } + } + + // gUNVÌJn + $ta = new IC2_DataObject_Images; + $db = $ta->getDatabaseConnection(); + if ($db->phptype == 'pgsql') { + $ta->query('BEGIN'); + } elseif ($db->phptype == 'sqlite') { + $db->query('BEGIN;'); + } + + // Éwè¶ñªÜÜêĢȯêÎXV + foreach ($target as $id) { + $find = new IC2_DataObject_Images; + $find->whereAdd("id = $id"); + if ($find->find(true) && strpos($find->memo, $memo) === false) { + $update = new IC2_DataObject_Images; + $update->whereAdd("id = $id"); + if (strlen($find->memo) > 0) { + $update->memo = $find->memo . ' ' . $memo; + } else { + $update->memo = $memo; + } + $update->update(); + unset($update); + } + unset($find); + } + + // gUNVÌR~bg + if ($db->phptype == 'pgsql') { + $ta->query('COMMIT'); + } elseif ($db->phptype == 'sqlite') { + $db->query('COMMIT;'); + } + } + + // }}} +} + +// }}} + +/* + * 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: Copied: p2ex/trunk/lib/expack/ic2/ImageInfo.php (from rev 772, p2ex/trunk/lib/expack/ic2/buildimgcell.inc.php) =================================================================== --- p2ex/trunk/lib/expack/ic2/ImageInfo.php (rev 0) +++ p2ex/trunk/lib/expack/ic2/ImageInfo.php 2010-01-13 04:36:03 UTC (rev 773) @@ -0,0 +1,95 @@ +<?php + +// {{{ IC2_ImageInfo + +/** + * ImageCache2 - æîñæ¾p[eBeBNX + */ +class IC2_ImageInfo +{ + // {{{ getExtraInfo() + + static public function getExtraInfo($img) + { + global $_conf, $ini, $icdb, $thumb; + + // ··¬éURIÍÜèÔ· + if (strlen($img['uri']) > 45) { + $w = explode("\n", wordwrap($img['uri'], 45, "\n", 1)); + $w = array_map('htmlspecialchars', $w); + $add['uri_w'] = implode('<br />', $w); + } else { + $add['uri_w'] = $img['uri']; + } + + if ($img['mime'] == 'clamscan/infected') { + + // EBXÉ´õµÄ¢½t@CÌÆ« + $add['src'] = './img/x04.png'; + $add['thumb'] = './img/x04.png'; + $add['t_width'] = 32; + $add['t_height'] = 32; + + } else { + + // \[XÆTlCÌpXðæ¾ + $add['src'] = $thumb->srcPath($icdb->size, $icdb->md5, $icdb->mime); + $add['thumb'] = $thumb->thumbPath($icdb->size, $icdb->md5, $icdb->mime); + + // TlCÌc¡Ì嫳ðvZ + $m = explode('x', $thumb->calc($icdb->width, $icdb->height)); + $add['t_width'] = (int)$m[0]; + $add['t_height'] = (int)$m[1]; + + } + + // \[XÌt@CTCYÌ®ð®¦é + if ($img['size'] > 1024 * 1024) { + $add['size_f'] = number_format($img['size'] / (1024 * 1024), 1) . 'MB'; + } elseif ($img['size'] > 1024) { + $add['size_f'] = number_format($img['size'] / 1024, 1) . 'KB'; + } else { + $add['size_f'] = $img['size'] . 'B'; + } + + // útÌ®ð®¦é + $add['date'] = date('Y-m-d (D) H:i:s', $img['time']); + + return $add; + } + + // }}} + // {{{ getExifData() + + static public function getExifData($path) + { + $exif = @exif_read_data($path, '', true, false); + if ($exif) { + // oCiÅAµ©àf[^TCYªå«¢vfðí + if (isset($exif['MakerNote'])) { + unset($exif['MakerNote']); + } + if (isset($exif['EXIF']) && isset($exif['EXIF']['MakerNote'])) { + unset($exif['EXIF']['MakerNote']); + } + return $exif; + } else { + return null; + } + } + + // }}} +} + +// }}} + +/* + * 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: Copied: p2ex/trunk/lib/expack/ic2/ParameterUtility.php (from rev 772, p2ex/trunk/lib/expack/ic2/getvalidvalue.inc.php) =================================================================== --- p2ex/trunk/lib/expack/ic2/ParameterUtility.php (rev 0) +++ p2ex/trunk/lib/expack/ic2/ParameterUtility.php 2010-01-13 04:36:03 UTC (rev 773) @@ -0,0 +1,70 @@ +<?php + +// {{{ IC2_ParameterUtility + +/** + * ImageCache2 - NGXgÏ̸³[eBeBNX + */ +class IC2_ParameterUtility +{ + // {{{ getValidValue() + + /** + * Submit³ê½lªÃÈçitB^ðKpµÄjÔµA»¤ÅȯêÎftHglðKp·é + * + * WI{^â`FbN{bNXAHTML_QuickFormÌO[vÉÍñÎ + * HTML_QuickFormðp³µ½NXÌ\bhƵÄÀ·×« + */ + static public function getValidValue($key, $default, $filter = '') + { + global $qf, $qfe; + $value = $qf->getSubmitValue($key); + if (is_null($value) || $qf->getElementError($key)) { + if ($qfe[$key]->getType() == 'select') { + $qfe[$key]->setSelected($default); + } else { + $qfe[$key]->setValue($default); + } + return $default; + } + return (strlen($filter) > 0) ? $filter($value) : $value; + } + + // }}} + // {{{ intoRange() + + /** + * lðwè³ê½ÍÍɳîµßéÖ + */ + static public function intoRange($int) + { + $a = func_get_args(); + $r = array_map('intval', $a); + $g = func_num_args(); + $int = $r[0]; + switch ($g) { + case 1: return $int; + case 2: $min = 0; $max = $r[1]; break; + default: $min = $r[1]; $max = $r[2]; + } + if ($min > $max) { + list($min, $max) = array($max, $min); + } + return max($min, min($max, intval($int))); + } + + // }}} +} + +// }}} + +/* + * 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/expack/ic2/Thumbnailer.php =================================================================== --- p2ex/trunk/lib/expack/ic2/Thumbnailer.php 2010-01-13 00:37:02 UTC (rev 772) +++ p2ex/trunk/lib/expack/ic2/Thumbnailer.php 2010-01-13 04:36:03 UTC (rev 773) @@ -3,11 +3,6 @@ * rep2expack - ImageCache2 */ -require_once P2EX_LIB_DIR . '/ic2/findexec.inc.php'; -require_once P2EX_LIB_DIR . '/ic2/loadconfig.inc.php'; -require_once P2EX_LIB_DIR . '/ic2/DataObject/Common.php'; -require_once P2EX_LIB_DIR . '/ic2/DataObject/Images.php'; - // {{{ IC2_Thumbnailer class IC2_Thumbnailer @@ -57,7 +52,6 @@ ); // @var array $mimemap, MIME^CvÆg£qÌÎ\ public $mimemap = array('image/jpeg' => '.jpg', 'image/png' => '.png', 'image/gif' => '.gif'); - public $windows; // @var bool T[oOSªWindows©Û© // }}} // {{{ constructor @@ -80,14 +74,12 @@ $this->intermd = false; } - $this->windows = (bool)P2_OS_WINDOWS; - // Ýè $this->ini = ic2_loadconfig(); // f[^x[XÉÚ± $icdb = new IC2_DataObject_Images; - $this->db = &$icdb->getDatabaseConnection(); + $this->db = $icdb->getDatabaseConnection(); if (DB::isError($this->db)) { $this->error($this->db->getMessage()); } @@ -119,7 +111,7 @@ $this->driver = 'imagemagick'; case 'imagemagick': // ImageMagick Ì convert R}h $searchpath = $this->ini['General']['magick']; - if (!findexec('convert', $searchpath)) { + if (!ic2_findexec('convert', $searchpath)) { $this->error('ImageMagickªg¦Ü¹ñB'); } if ($searchpath) { @@ -291,17 +283,7 @@ // C[WhCoÉTlCì¬ð³¹é $convertorClass = 'Thumbnailer_' . ucfirst(strtolower($this->driver)); - if ($convertorClass == 'Thumbnailer_Imagick') { - if (!class_exists('Imagick', false)) { - $convertorClass = 'Thumbnailer_Imagick09'; - } - } - if (!class_exists($convertorClass, false)) { - require dirname(__FILE__) . DIRECTORY_SEPARATOR . - str_replace('_', DIRECTORY_SEPARATOR, $convertorClass) . '.php'; - } - $convertor = new $convertorClass(); $convertor->setBgColor($this->bgcolor[0], $this->bgcolor[1], $this->bgcolor[2]); $convertor->setHttp(true); @@ -504,7 +486,7 @@ } $sql = 'SELECT MAX(' . $this->db->quoteIdentifier('id') . ') + 1 FROM ' . $this->db->quoteIdentifier($this->ini['General']['table']) . ';'; - $nextid = &$this->db->getOne($sql); + $nextid = $this->db->getOne($sql); if (DB::isError($nextid) || !$nextid) { $nextid = 1; } Added: p2ex/trunk/lib/expack/ic2/bootstrap.php =================================================================== --- p2ex/trunk/lib/expack/ic2/bootstrap.php (rev 0) +++ p2ex/trunk/lib/expack/ic2/bootstrap.php 2010-01-13 04:36:03 UTC (rev 773) @@ -0,0 +1,148 @@ +<?php +/** + * rep2expack - ImageCache2 ú»XNvg + */ + +require_once 'DB.php'; +require_once 'DB/DataObject.php'; + +// {{{ GLOBALS + +$GLOBALS['_P2_GETIMAGE_CACHE'] = array(); + +// }}} +// {{{ constants + +define('P2_IMAGECACHE_OK', 0); +define('P2_IMAGECACHE_ABORN', 1); +define('P2_IMAGECACHE_BROKEN', 2); +define('P2_IMAGECACHE_LARGE', 3); +define('P2_IMAGECACHE_VIRUS', 4); + +define('P2_IMAGECACHE_BLACKLIST_NOMORE', 0); +define('P2_IMAGECACHE_BLACKLIST_ABORN', 1); +define('P2_IMAGECACHE_BLACKLIST_VIRUS', 2); + +// }}} +// {{{ ic2_loadconfig() + +/** + * [UÝèÇÝÝÖ + * + * @param void + * @return array + */ +function ic2_loadconfig() +{ + static $ini = null; + + if (is_null($ini)) { + include P2_CONF_DIR . '/conf_ic2.inc.php'; + + $ini = array(); + $_ic2conf = preg_grep('/^expack\\.ic2\\.\\w+\\.\\w+$/', array_keys($_conf)); + foreach ($_ic2conf as $key) { + $p = explode('.', $key); + $cat = ucfirst($p[2]); + $name = $p[3]; + if (!isset($ini[$cat])) { + $ini[$cat] = array(); + } + $ini[$cat][$name] = $_conf[$key]; + } + + // DB_DataObjectÌÝè + $_dao_options = &PEAR::getStaticProperty('DB_DataObject', 'options'); + if (!is_array($_dao_options)) { + $_dao_options = array(); + } + $_dao_options['database'] = $ini['General']['dsn']; + $_dao_options['debug'] = false; + $_dao_options['quote_identifiers'] = true; + $_dao_options['db_driver'] = 'DB'; + } + + return $ini; +} + +// }}} +// {{{ ic2_findexec() + +/** + * Àst@CõÖ + * + * $search_path©çÀst@C$commandðõ·é + * ©Â©êÎpXðGXP[vµÄÔ·i$escapeªUÈç»ÌÜÜÔ·j + * ©Â©çȯêÎfalseðÔ· + * + * @param string $command + * @param string $search_path + * @param bool $escape + * @return string + */ +function ic2_findexec($command, $search_path = '', $escape = true) +{ + // Windows©A»Ì¼ÌOS© + if (P2_OS_WINDOWS) { + if (strtolower(strrchr($command, '.')) != '.exe') { + $command .= '.exe'; + } + $check = function_exists('is_executable') ? 'is_executable' : 'file_exists'; + } else { + $check = 'is_executable'; + } + + // $search_pathªóÌÆ«Í«ÏPATH©çõ·é + if ($search_path == '') { + $search_dirs = explode(PATH_SEPARATOR, getenv('PATH')); + } else { + $search_dirs = explode(PATH_SEPARATOR, $search_path); + } + + // õ + foreach ($search_dirs as $path) { + $path = realpath($path); + if ($path === false || !is_dir($path)) { + continue; + } + if ($check($path . DIRECTORY_SEPARATOR . $command)) { + return ($escape ? escapeshellarg($command) : $command); + } + } + + // ©Â©çÈ©Á½ + return false; +} + +// }}} +// {{{ ic2_load_class() + +/** + * NX[_[ + * + * @string $name + * @return void + */ +function ic2_load_class($name) +{ + if (strncmp($name, 'IC2_', 3) === 0) { + include P2EX_LIB_DIR . '/ic2/' . str_replace('_', '/', substr($name, 3)) . '.php'; + } elseif (strncmp($name, 'Thumbnailer_', 12) === 0) { + include P2_LIB_DIR . '/' . str_replace('_', '/', $name) . '.php'; + } +} + +// }}} + +spl_autoload_register('ic2_load_class'); + +/* + * 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: Deleted: p2ex/trunk/lib/expack/ic2/buildimgcell.inc.php =================================================================== --- p2ex/trunk/lib/expack/ic2/buildimgcell.inc.php 2010-01-13 00:37:02 UTC (rev 772) +++ p2ex/trunk/lib/expack/ic2/buildimgcell.inc.php 2010-01-13 04:36:03 UTC (rev 773) @@ -1,88 +0,0 @@ -<?php -/** - * ImageCache2 - ê\¦p[eBeBÖ - */ - -// {{{ ic2_image_extra_info() - -function ic2_image_extra_info($img) -{ - global $_conf, $ini, $icdb, $thumb; - - // ··¬éURIÍÜèÔ· - if (strlen($img['uri']) > 45) { - $w = explode("\n", wordwrap($img['uri'], 45, "\n", 1)); - $w = array_map('htmlspecialchars', $w); - $add['uri_w'] = implode('<br />', $w); - } else { - $add['uri_w'] = $img['uri']; - } - - if ($img['mime'] == 'clamscan/infected') { - - // EBXÉ´õµÄ¢½t@CÌÆ« - $add['src'] = './img/x04.png'; - $add['thumb'] = './img/x04.png'; - $add['t_width'] = 32; - $add['t_height'] = 32; - - } else { - - // \[XÆTlCÌpXðæ¾ - $add['src'] = $thumb->srcPath($icdb->size, $icdb->md5, $icdb->mime); - $add['thumb'] = $thumb->thumbPath($icdb->size, $icdb->md5, $icdb->mime); - - // TlCÌc¡Ì嫳ðvZ - $m = explode('x', $thumb->calc($icdb->width, $icdb->height)); - $add['t_width'] = (int)$m[0]; - $add['t_height'] = (int)$m[1]; - - } - - // \[XÌt@CTCYÌ®ð®¦é - if ($img['size'] > 1024 * 1024) { - $add['size_f'] = number_format($img['size'] / (1024 * 1024), 1) . 'MB'; - } elseif ($img['size'] > 1024) { - $add['size_f'] = number_format($img['size'] / 1024, 1) . 'KB'; - } else { - $add['size_f'] = $img['size'] . 'B'; - } - - // útÌ®ð®¦é - $add['date'] = date('Y-m-d (D) H:i:s', $img['time']); - - return $add; -} - -// }}} -// {{{ ic2_read_exif() - -function ic2_read_exif($path) -{ - $exif = @exif_read_data($path, '', true, false); - if ($exif) { - // oCiÅAµ©àf[^TCYªå«¢vfðí - if (isset($exif['MakerNote'])) { - unset($exif['MakerNote']); - } - if (isset($exif['EXIF']) && isset($exif['EXIF']['MakerNote'])) { - unset($exif['EXIF']['MakerNote']); - } - return $exif; - } else { - return null; - } -} - -// }}} - -/* - * 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: Deleted: p2ex/trunk/lib/expack/ic2/findexec.inc.php =================================================================== --- p2ex/trunk/lib/expack/ic2/findexec.inc.php 2010-01-13 00:37:02 UTC (rev 772) +++ p2ex/trunk/lib/expack/ic2/findexec.inc.php 2010-01-13 04:36:03 UTC (rev 773) @@ -1,58 +0,0 @@ -<?php -/** - * ImageCache2 - Àst@CõÖ - */ - -// {{{ findexec() - -/** - * $search_path©çÀst@C$commandðõ·é - * ©Â©êÎpXðGXP[vµÄÔ·i$escapeªUÈç»ÌÜÜÔ·j - * ©Â©çȯêÎfalseðÔ· - */ -function findexec($command, $search_path = '', $escape = true) -{ - // Windows©A»Ì¼ÌOS© - if (P2_OS_WINDOWS) { - if (strtolower(strrchr($command, '.')) != '.exe') { - $command .= '.exe'; - } - $check = function_exists('is_executable') ? 'is_executable' : 'file_exists'; - } else { - $check = 'is_executable'; - } - - // $search_pathªóÌÆ«Í«ÏPATH©çõ·é - if ($search_path == '') { - $search_dirs = explode(PATH_SEPARATOR, getenv('PATH')); - } else { - $search_dirs = explode(PATH_SEPARATOR, $search_path); - } - - // õ - foreach ($search_dirs as $path) { - $path = realpath($path); - if ($path === false || !is_dir($path)) { - continue; - } - if ($check($path . DIRECTORY_SEPARATOR . $command)) { - return ($escape ? escapeshellarg($command) : $command); - } - } - - // ©Â©çÈ©Á½ - return false; -} - -// }}} - -/* - * 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: Deleted: p2ex/trunk/lib/expack/ic2/getvalidvalue.inc.php =================================================================== --- p2ex/trunk/lib/expack/ic2/getvalidvalue.inc.php 2010-01-13 00:37:02 UTC (rev 772) +++ p2ex/trunk/lib/expack/ic2/getvalidvalue.inc.php 2010-01-13 04:36:03 UTC (rev 773) @@ -1,63 +0,0 @@ -<?php -/** - * ImageCache2 - NGXgÏ̸³[eBeBÖ - */ - -// {{{ getValidValue() - -/** - * Submit³ê½lªÃÈçitB^ðKpµÄjÔµA»¤ÅȯêÎftHglðKp·é - * - * WI{^â`FbN{bNXAHTML_QuickFormÌO[vÉÍñÎ - * HTML_QuickFormðp³µ½NXÌ\bhƵÄÀ·×« - */ -function getValidValue($key, $default, $filter = '') -{ - global $qf, $qfe; - $value = $qf->getSubmitValue($key); - if (is_null($value) || $qf->getElementError($key)) { - if ($qfe[$key]->getType() == 'select') { - $qfe[$key]->setSelected($default); - } else { - $qfe[$key]->setValue($default); - } - return $default; - } - return (strlen($filter) > 0) ? $filter($value) : $value; -} - -// }}} -// {{{ intoRange() - -/** - * lðwè³ê½ÍÍɳîµßéÖ - */ -function intoRange($int) -{ - $a = func_get_args(); - $r = array_map('intval', $a); - $g = func_num_args(); - $int = $r[0]; - switch ($g) { - case 1: return $int; - case 2: $min = 0; $max = $r[1]; break; - default: $min = $r[1]; $max = $r[2]; - } - if ($min > $max) { - list($min, $max) = array($max, $min); - } - return max($min, min($max, intval($int))); -} - -// }}} - -/* - * 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: Deleted: p2ex/trunk/lib/expack/ic2/loadconfig.inc.php =================================================================== --- p2ex/trunk/lib/expack/ic2/loadconfig.inc.php 2010-01-13 00:37:02 UTC (rev 772) +++ p2ex/trunk/lib/expack/ic2/loadconfig.inc.php 2010-01-13 04:36:03 UTC (rev 773) @@ -1,54 +0,0 @@ -<?php -/** - * ImageCache2 - [UÝèÇÝÝÖ - */ - -require_once 'DB/DataObject.php'; - -// {{{ ic2_loadconfig() - -function ic2_loadconfig() -{ - static $ini = null; - - if (is_null($ini)) { - include P2_CONF_DIR . '/conf_ic2.inc.php'; - - $ini = array(); - $_ic2conf = preg_grep('/^expack\\.ic2\\.\\w+\\.\\w+$/', array_keys($_conf)); - foreach ($_ic2conf as $key) { - $p = explode('.', $key); - $cat = ucfirst($p[2]); - $name = $p[3]; - if (!isset($ini[$cat])) { - $ini[$cat] = array(); - } - $ini[$cat][$name] = $_conf[$key]; - } - - // DB_DataObjectÌÝè - $_dao_options = &PEAR::getStaticProperty('DB_DataObject', 'options'); - if (!is_array($_dao_options)) { - $_dao_options = array(); - } - $_dao_options['database'] = $ini['General']['dsn']; - $_dao_options['debug'] = false; - $_dao_options['quote_identifiers'] = true; - $_dao_options['db_driver'] = 'DB'; - } - - return $ini; -} - -// }}} - -/* - * 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: Deleted: p2ex/trunk/lib/expack/ic2/managedb.inc.php =================================================================== --- p2ex/trunk/lib/expack/ic2/managedb.inc.php 2010-01-13 00:37:02 UTC (rev 772) +++ p2ex/trunk/lib/expack/ic2/managedb.inc.php 2010-01-13 04:36:03 UTC (rev 773) @@ -1,284 +0,0 @@ -<?php -/** - * ImageCache2 - æîñðì·éÖ - */ - -require_once P2EX_LIB_DIR . '/ic2/DataObject/Common.php'; -require_once P2EX_LIB_DIR . '/ic2/DataObject/Images.php'; -require_once P2EX_LIB_DIR . '/ic2/DataObject/BlackList.php'; -require_once P2EX_LIB_DIR . '/ic2/Thumbnailer.php'; - -// {{{ manageDB_update() - -/** - * æîñðXV - */ -function manageDB_update($updated) -{ - if (empty($updated)) { - return; - } - if (!is_array($updated)) { - global $_info_msg_ht; - $_info_msg_ht .= '<p>WARNING! manageDB_update(): s³Èø</p>'; - return; - } - - // gUNVÌJn - $ta = new IC2_DataObject_Images; - $db = $ta->getDatabaseConnection(); - if ($db->phptype == 'pgsql') { - $ta->query('BEGIN'); - } elseif ($db->phptype == 'sqlite') { - $db->query('BEGIN;'); - } - - // æf[^ðXV - foreach ($updated as $id => $data) { - $icdb = new IC2_DataObject_Images; - $icdb->whereAdd("id = $id"); - if ($icdb->find(true)) { - // ðXV - if ($icdb->memo != $data['memo']) { - $memo = new IC2_DataObject_Images; - $memo->memo = (strlen($data['memo']) > 0) ? $data['memo'] : ''; - $memo->whereAdd("id = $id"); - $memo->update(); - } - // NðXV - if ($icdb->rank != $data['rank']) { - $rank = new IC2_DataObject_Images; - $rank->rank = $data['rank']; - $rank->whereAddQuoted('size', '=', $icdb->size); - $rank->whereAddQuoted('md5', '=', $icdb->md5); - $rank->whereAddQuoted('mime', '=', $icdb->mime); - $rank->update(); - } - } - } - - // gUNVÌR~bg - if ($db->phptype == 'pgsql') { - $ta->query('COMMIT'); - } elseif ($db->phptype == 'sqlite') { - $db->query('COMMIT;'); - } -} - -// }}} -// {{{ manageDB_remove() - -/** - * æðí - */ -function manageDB_remove($target, $to_blacklist = false) -{ - $removed_files = array(); - if (empty($target)) { - return $removed_files; - } - if (!is_array($target)) { - if (is_integer($target) || ctype_digit($target)) { - $id = (int) $target; - if ($id > 0) { - $target = array($id); - } else { - return $removed_files; - } - } else { - global $_info_msg_ht; - $_info_msg_ht .= '<p>WARNING! manageDB_remove(): s³Èø</p>'; - return $removed_files; - } - } - - // gUNVÌJn - $ta = new IC2_DataObject_Images; - $db = $ta->getDatabaseConnection(); - if ($db->phptype == 'pgsql') { - $ta->query('BEGIN'); - } elseif ($db->phptype == 'sqlite') { - $db->query('BEGIN;'); - } - - // æðí - foreach ($target as $id) { - $icdb = new IC2_DataObject_Images; - $icdb->whereAdd("id = {$id}"); - - if ($icdb->find(true)) { - // LbV µÄ¢ét@Cðí - $t1 = new IC2_Thumbnailer(IC2_Thumbnailer::SIZE_PC); - $t2 = new IC2_Thumbnailer(IC2_Thumbnailer::SIZE_MOBILE); - $t3 = new IC2_Thumbnailer(IC2_Thumbnailer::SIZE_INTERMD); - $srcPath = $t1->srcPath($icdb->size, $icdb->md5, $icdb->mime); - $t1Path = $t1->thumbPath($icdb->size, $icdb->md5, $icdb->mime); - $t2Path = $t2->thumbPath($icdb->size, $icdb->md5, $icdb->mime); - $t3Path = $t3->thumbPath($icdb->size, $icdb->md5, $icdb->mime); - if (file_exists($srcPath)) { - unlink($srcPath); - $removed_files[] = $srcPath; - } - if (file_exists($t1Path)) { - unlink($t1Path); - $removed_files[] = $t1Path; - } - if (file_exists($t2Path)) { - unlink($t2Path); - $removed_files[] = $t2Path; - } - if (file_exists($t3Path)) { - unlink($t3Path); - $removed_files[] = $t3Path; - } - - // ubNXgèÌõ - if ($to_blacklist) { - $_blacklist = new IC2_DataObject_BlackList; - $_blacklist->size = $icdb->size; - $_blacklist->md5 = $icdb->md5; - if ($icdb->mime == 'clamscan/infected' || $icdb->rank == -4) { - $_blacklist->type = 2; - } elseif ($icdb->rank < 0) { - $_blacklist->type = 1; - } else { - $_blacklist->type = 0; - } - } - - // ¯êæðõ - $remover = new IC2_DataObject_Images; - $remover->whereAddQuoted('size', '=', $icdb->size); - $remover->whereAddQuoted('md5', '=', $icdb->md5); - //$remover->whereAddQuoted('mime', '=', $icdb->mime); // SizeÆMD5Å\ª - $remover->find(); - while ($remover->fetch()) { - // ubNXgèÉ·é - if ($to_blacklist) { - $blacklist = clone $_blacklist; - $blacklist->uri = $remover->uri; - $blacklist->insert(); - } - // e[u©çÁ - $remover->delete(); - } - } - } - - // gUNVÌR~bg - if ($db->phptype == 'pgsql') { - $ta->query('COMMIT'); - } elseif ($db->phptype == 'sqlite') { - $db->query('COMMIT;'); - } - - return $removed_files; -} - -// }}} -// {{{ manageDB_setRank() - -/** - * NðÝè - */ -function manageDB_setRank($target, $rank) -{ - if (empty($target)) { - return; - } - if (!is_array($target)) { - if (is_integer($updated) || ctype_digit($updated)) { - $id = (int)$updated; - if ($id > 0) { - $updated = array($id); - } else { - return; - } - } else { - global $_info_msg_ht; - $_info_msg_ht .= '<p>WARNING! manageDB_setRank(): s³Èø</p>'; - return $removed_files; - } - } - - $icdb = new IC2_DataObject_Images; - $icdb->rank = $rank; - foreach ($target as $id) { - $icdb->whereAdd("id = $id", 'OR'); - } - $icdb->update(); -} - -// }}} -// {{{ manageDB_addMemo() - -/** - * ðÇÁ - */ -function manageDB_addMemo($target, $memo) -{ - if (empty($target)) { - return; - } - if (!is_array($target)) { - if (is_integer($updated) || ctype_digit($updated)) { - $id = (int)$updated; - if ($id > 0) { - $updated = array($id); - } else { - return; - } - } else { - global $_info_msg_ht; - $_info_msg_ht .= '<p>WARNING! manageDB_addMemo(): s³Èø</p>'; - return $removed_files; - } - } - - // gUNVÌJn - $ta = new IC2_DataObject_Images; - $db = $ta->getDatabaseConnection(); - if ($db->phptype == 'pgsql') { - $ta->query('BEGIN'); - } elseif ($db->phptype == 'sqlite') { - $db->query('BEGIN;'); - } - - // Éwè¶ñªÜÜêĢȯêÎXV - foreach ($target as $id) { - $find = new IC2_DataObject_Images; - $find->whereAdd("id = $id"); - if ($find->find(true) && strpos($find->memo, $memo) === false) { - $update = new IC2_DataObject_Images; - $update->whereAdd("id = $id"); - if (strlen($find->memo) > 0) { - $update->memo = $find->memo . ' ' . $memo; - } else { - $update->memo = $memo; - } - $update->update(); - unset($update); - } - unset($find); - } - - // gUNVÌR~bg - if ($db->phptype == 'pgsql') { - $ta->query('COMMIT'); - } elseif ($db->phptype == 'sqlite') { - $db->query('COMMIT;'); - } -} - -// }}} - -/* - * 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/expack/rss/getimage.inc.php =================================================================== --- p2ex/trunk/lib/expack/rss/getimage.inc.php 2010-01-13 00:37:02 UTC (rev 772) +++ p2ex/trunk/lib/expack/rss/getimage.inc.php 2010-01-13 04:36:03 UTC (rev 773) @@ -3,8 +3,7 @@ * rep2expck - RSSæLbV */ -require_once P2EX_LIB_DIR . '/ic2/DataObject/Images.php'; -require_once P2EX_LIB_DIR . '/ic2/Thumbnailer.php'; +require_once P2EX_LIB_DIR . '/bootstrap.php'; // {{{ rss_get_image() Modified: p2ex/trunk/lib/menu.inc.php =================================================================== --- p2ex/trunk/lib/menu.inc.php 2010-01-13 00:37:02 UTC (rev 772) +++ p2ex/trunk/lib/menu.inc.php 2010-01-13 04:36:03 UTC (rev 773) @@ -332,8 +332,9 @@ // ¡ImageCache2 //============================================================== if ($_conf['expack.ic2.enabled']) { - require_once P2EX_LIB_DIR . '/ic2/Switch.php'; - + if (!class_exists('IC2_Switch', false)) { + include P2EX_LIB_DIR . '/ic2/Switch.php'; + } if (IC2_Switch::get()) { $ic2sw = array('inline', 'none'); } else { Added: p2ex/trunk/lib/migrators/100113_1300.php =================================================================== --- p2ex/trunk/lib/migrators/100113_1300.php (rev 0) +++ p2ex/trunk/lib/migrators/100113_1300.php 2010-01-13 04:36:03 UTC (rev 773) @@ -0,0 +1,163 @@ +<?php +/** + * rep2expack - o[WAbvÌÚsx + */ + +// {{{ p2_migrate_100113_1300() + +/** + * rev.100113.1300 + * + * @param array $core_conf rep2RAÌÝè + * @param array $user_conf â[U[Ýè + * @return array Vµ¢[U[Ýè + */ +function p2_migrate_100113_1300(array $core_conf, array $user_conf) +{ + $data_dir = $core_conf['data_dir']; + $db_dir = $core_conf['db_dir']; + $cache_dir = $core_conf['cache_dir']; + $cookie_dir = $core_conf['cookie_dir']; + + // {{{ zXg`FbNÌgethostbyaddr()LbV + + $old_hostcheck_db = $cache_dir . '/hostcheck_gethostby.sq3'; + $new_hostcheck_db = $core_conf['hostcheck_db_path']; + + _100113_1300_rename_db($old_hostcheck_db, $new_hostcheck_db); + _100113_1300_rename_table($new_hostcheck_db, 'kvs_p2keyvaluestore', 'kvs_default'); + _100113_1300_rename_table($new_hostcheck_db, 'kvs_keyvaluestore', 'kvs_default'); + + // }}} + // {{{ ö®p2NCAgÌCookieXg[W + + $old_p2_cookie_db1 = $cookie_dir . '/p2_2ch_net_cookies.sqlite3'; + $old_p2_cookie_db2 = $cookie_dir . '/p2_2ch_net_cookie.sq3'; + $new_p2_cookie_db = $db_dir . '/p2_2ch_net_cookies.sqlite3'; + + _100113_1300_rename_db($old_p2_cookie_db1, $new_p2_cookie_db); + _100113_1300_rename_db($old_p2_cookie_db2, $new_p2_cookie_db); + _100113_1300_rename_table($new_p2_cookie_db, 'kvs_p2keyvaluestore_serializing', 'kvs_serializing'); + + // }}} + // {{{ epCookieXg[W + + $old_cookie_db = $cookie_dir . '/p2_cookies.sqlite3'; + $new_cookie_db = $core_conf['cookie_db_path']; + + _100113_1300_rename_db($old_cookie_db, $new_cookie_db); + _100113_1300_rename_table($new_cookie_db, 'kvs_p2keyvaluestore_serializing', 'kvs_serializing'); + + // }}} + // {{{ «Ýf[^ÌobNAbvXg[W + + $old_post_db = $cookie_dir . '/p2_post_data.sqlite3'; + $new_post_db = $core_conf['post_db_path']; + + _100113_1300_rename_db($old_post_db, $new_post_db); + _100113_1300_rename_table($new_post_db, 'kvs_p2keyvaluestore_serializing', 'kvs_serializing'); + + // }}} + + return $user_conf; +} + +// }}} +// {{{ _100113_1300_rename_db + +/** + * SQLite3f[^x[Xðl[·é + * + * @param string $old_name + * @param string $new_name + * @return void + */ +function _100113_1300_rename_db($old_name, $new_name) +{ + if (DIRECTORY_SEPARATOR != '/') { + $old_name = str_replace('/', DIRECTORY_SEPARATOR, $old_name); + $new_name = str_replace('/', DIRECTORY_SEPARATOR, $new_name); + } + + if ($old_name == $new_name) { + return; + } + + if (file_exists($old_name)) { + if (file_exists($new_name)) { + unlink($old_name); + } else { + $dir = dirname($new_name); + if (!is_dir($dir)) { + mkdir($dir, 0777, true); + } + rename($old_name, $new_name); + } + clearstatcache(); + } +} + +// }}} +// {{{ _100113_1300_rename_table + +/** + * SQLite3e[uðl[·é + * + * @param string $database + * @param string $old_name + * @param string $new_name + * @return void + */ +function _100113_1300_rename_table($database, $old_name, $new_name) +{ + if (!file_exists($database) || $old_name == $new_name) { + return; + } + + $pdo = new PDO('sqlite:' . realpath($database)); + $tableChecker = $pdo->prepare('SELECT 1 FROM sqlite_master WHERE type = \'table\' AND name = :name LIMIT 1'); + + $tableChecker->bindValue(':name', $old_name); + $tableChecker->execute(); + if ($tableChecker->fetchColumn()) { + $tableChecker->closeCursor(); + $tableChecker->bindValue(':name', $new_name); + $tableChecker->execute(); + if ($tableChecker->fetchColumn()) { + $tableChecker->closeCursor(); + $query = 'DROP TABLE ' . _100113_1300_quote_identifier($old_name); + } else { + $query = 'ALTER TABLE ' . _100113_1300_quote_identifier($old_name) + . ' RENAME TO ' . _100113_1300_quote_identifier($new_name); + } + unset($tableChecker); + $pdo->exec($query); + } +} + +// }}} +// {{{ _100113_1300_quote_identifier + +/** + * SQLite3e[u¼ðNH[g·é + * + * @param string $identifier + * @return string + */ +function _100113_1300_quote_identifier($identifier) +{ + return '"' . str_replace('"', '""', $identifier) . '"'; +} + +// }}} + +/* + * 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: Added: p2ex/trunk/lib/migrators/yymmdd_hhmm.php =================================================================== --- p2ex/trunk/lib/migrators/yymmdd_hhmm.php (rev 0) +++ p2ex/trunk/lib/migrators/yymmdd_hhmm.php 2010-01-13 04:36:03 UTC (rev 773) @@ -0,0 +1,31 @@ +<?php +/** + * rep2expack - o[WAbvÌÚsx + */ + +// {{{ p2_migrate_yymmdd_hhmm() + +/** + * yymmdd_hhmm ðÀÛÌo[WÔÉu·µÄÖÌgðLq·é + * + * @param array $core_conf rep2RAÌÝè + * @param array $user_conf â[U[Ýè + * @return array Vµ¢[U[Ýè + */ +function p2_migrate_yymmdd_hhmm(array $core_conf, array $user_conf) +{ + return $user_conf; +} + +// }}} + +/* + * 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/read_footer.inc.php =================================================================== --- p2ex/trunk/lib/read_footer.inc.php 2010-01-13 00:37:02 UTC (rev 772) +++ p2ex/trunk/lib/read_footer.inc.php 2010-01-13 04:36:03 UTC (rev 773) @@ -44,8 +44,6 @@ } // ============================================================ -$sid_q = (defined('SID')) ? '&'.strip_tags(SID) : ''; - if ($aThread->rescount or ($_GET['one'] && !$aThread->diedat)) { // and (!$_GET['renzokupop']) if (!$aThread->diedat) { @@ -55,7 +53,7 @@ EOP; } else { $htm['dores'] = <<<EOP -<a href="post_form.php?host={$aThread->host}{$bbs_q}{$key_q}&rescount={$aThread->rescount}{$ttitle_en_q}" target="_self" onclick="return OpenSubWin('post_form.php?host={$aThread->host}{$bbs_q}{$key_q}&rescount={$aThread->rescount}{$ttitle_en_q}&popup=1{$sid_q}',{$STYLE['post_pop_size']},1,0)"{$onmouse_showform_ht}>{$dores_st}</a> +<a href="post_form.php?{$host_bbs_key_q}&rescount={$aThread->rescount}{$ttitle_en_q}" target="_self" onclick="return OpenSubWin('post_form.php?{$host_bbs_key_q}&rescount={$aThread->rescount}{$ttitle_en_q}&popup=1',{$STYLE['post_pop_size']},1,0)"{$onmouse_showform_ht}>{$dores_st}</a> EOP; } @@ -92,10 +90,10 @@ // {{{ tB^qbgª Á½êAXƱ«ðÇÞðXV /* //if (!$read_navi_next_isInvisible) { - $read_navi_next = "<a href=\"{$_conf['read_php']}?host={$aThread->host}{$bbs_q}{$key_q}&ls={$aThread->resrange['to']}-{$after_rnum}{$offline_range_q}&nt={$newtime}{$read_navi_next_anchor}\">{$next_st}{$rnum_range}</a>"; + $read_navi_next = "<a href=\"{$_conf['read_php']}?{$host_bbs_key_q}&ls={$aThread->resrange['to']}-{$after_rnum}{$offline_range_q}&nt={$newtime}{$read_navi_next_anchor}\">{$next_st}{$rnum_range}</a>"; //} - $read_footer_navi_new = "<a href=\"{$_conf['read_php']}?host={$aThread->host}{$bbs_q}{$key_q}&ls={$aThread->resrange['to']}-{$offline_q}\" accesskey=\"r\">{$tuduki_st}</a>"; + $read_footer_navi_new = "<a href=\"{$_conf['read_php']}?{$host_bbs_key_q}&ls={$aThread->resrange['to']}-{$offline_q}\" accesskey=\"r\">{$tuduki_st}</a>"; */ if (!empty($GLOBALS['last_hit_resnum'])) { @@ -104,10 +102,10 @@ $read_navi_next_anchor = "#r{$aThread->rescount}"; } $after_rnum = $GLOBALS['last_hit_resnum'] + $rnum_range; - $read_navi_next = "<a href=\"{$_conf['read_php']}?host={$aThread->host}{$bbs_q}{$key_q}&ls={$GLOBALS['last_hit_resnum']}-{$after_rnum}{$offline_range_q}&nt={$newtime}{$read_navi_next_anchor}\">{$next_st}{$rnum_range}</a>"; + $read_navi_next = "<a href=\"{$_conf['read_php']}?{$host_bbs_key_q}&ls={$GLOBALS['last_hit_resnum']}-{$after_rnum}{$offline_range_q}&nt={$newtime}{$read_navi_next_anchor}\">{$next_st}{$rnum_range}</a>"; // u±«ðÇÞv - $read_footer_navi_new = "<a href=\"{$_conf['read_php']}?host={$aThread->host}{$bbs_q}{$key_q}&ls={$GLOBALS['last_hit_resnum']}-{$offline_q}\" accesskey=\"r\">{$tuduki_st}</a>"; + $read_footer_navi_new = "<a href=\"{$_conf['read_php']}?{$host_bbs_key_q}&ls={$GLOBALS['last_hit_resnum']}-{$offline_q}\" accesskey=\"r\">{$tuduki_st}</a>"; } // }}} @@ -118,10 +116,10 @@ <tr> <td class="lblock"> {$q_ichi} - <a href="{$_conf['read_php']}?host={$aThread->host}{$bbs_q}{$key_q}&ls=all">{$all_st}</a> + <a href="{$_conf['read_php']}?{$host_bbs_key_q}&ls=all">{$all_st}</a> {$read_navi_previous} {$read_navi_next} - <a href="{$_conf['read_php']}?host={$aThread->host}{$bbs_q}{$key_q}&ls=l{$latest_show_res_num}">{$latest_st}{$latest_show_res_num}</a> + <a href="{$_conf['read_php']}?{$host_bbs_key_q}&ls=l{$latest_show_res_num}">{$latest_st}{$latest_show_res_num}</a> {$htm['goto']} | {$read_footer_navi_new} | {$htm['dores']} Modified: p2ex/trunk/lib/read_footer_k.inc.php =================================================================== --- p2ex/trunk/lib/read_footer_k.inc.php 2010-01-13 00:37:02 UTC (rev 772) +++ p2ex/trunk/lib/read_footer_k.inc.php 2010-01-13 04:36:03 UTC (rev 773) @@ -37,7 +37,7 @@ EOP; } else { $dores_ht = <<<EOP -<a href="post_form.php?host={$aThread->host}{$bbs_q}{$key_q}&rescount={$aThread->rescount}{$ttitle_en_q}{$_conf['k_at_a']}"{$_conf['k_accesskey_at']['res']}{$holdhandlers_at}>{$_conf['k_accesskey_st']['res']}{$dores_st}</a> +<a href="post_form.php?{$host_bbs_key_q}&rescount={$aThread->rescount}{$ttitle_en_q}{$_conf['k_at_a']}"{$_conf['k_accesskey_at']['res']}{$holdhandlers_at}>{$_conf['k_accesskey_st']['res']}{$dores_st}</a> EOP; } } else { @@ -92,7 +92,9 @@ if ($_conf['iphone']) { // ImageCache2 if ($_conf['expack.ic2.enabled']) { - require_once P2EX_LIB_DIR . '/ic2/loadconfig.inc.php'; + if (!function_exists('ic2_loadconfig')) { + include P2EX_LIB_DIR . '/ic2/bootstrap.php'; + } $ic2conf = ic2_loadconfig(); if ($ic2conf['Thumb1']['width'] > 80) { include P2EX_LIB_DIR . '/ic2/templates/info-v.tpl.html'; Modified: p2ex/trunk/lib/read_header.inc.php =================================================================== --- p2ex/trunk/lib/read_header.inc.php 2010-01-13 00:37:02 UTC (rev 772) +++ p2ex/trunk/lib/read_header.inc.php 2010-01-13 04:36:03 UTC (rev 773) @@ -4,30 +4,31 @@ */ // Ï -$diedat_msg = ""; +$diedat_msg = ''; -$info_st = "îñ"; -$delete_st = "í"; -$all_st = "S"; -$prev_st = "O"; -$next_st = ""; -$shinchaku_st = "V XÌ\¦"; -$midoku_st = "¢ÇXÌ\¦"; -$tuduki_st = "±«ðÇÞ"; -$moto_thre_st = "³X"; -$siml_thre_st = "X"; // "ÞX" -$latest_st = "ÅV"; -$dores_st = "X"; -$aborn_st = " Úñ"; +$info_st = 'îñ'; +$delete_st = 'í'; +$all_st = 'S'; +$prev_st = 'O'; +$next_st = ''; +$shinchaku_st = 'V XÌ\¦'; +$midoku_st = '¢ÇXÌ\¦'; +$tuduki_st = '±«ðÇÞ'; +$moto_thre_st = '³X'; +$siml_thre_st = 'X'; // 'ÞX' +$latest_st = 'ÅV'; +$dores_st = ''; // 'X'; +$aborn_st = ' Úñ'; -$motothre_url = $aThread->getMotoThread(); +$motothre_url = $aThread->getMotoThread(false, ''); $ttitle_en = base64_encode($aThread->ttitle); $ttitle_urlen = rawurlencode($ttitle_en); -$ttitle_en_q = "&ttitle_en=" . $ttitle_urlen; -$bbs_q = "&bbs=" . $aThread->bbs; -$key_q = "&key=" . $aThread->key; -$popup_q = "&popup=1"; -$offline_q = "&offline=1"; +$ttitle_en_q = '&ttitle_en=' . $ttitle_urlen; +$bbs_q = '&bbs=' . $aThread->bbs; +$key_q = '&key=' . $aThread->key; +$host_bbs_key_q = 'host=' . $aThread->host . $bbs_q . $key_q; +$popup_q = '&popup=1'; +$offline_q = '&offline=1'; //================================================================= // wb_ @@ -37,17 +38,17 @@ $rnum_range = 100; $latest_show_res_num = 50; // ÅVXX -$read_navi_range = ""; +$read_navi_range = ''; //---------------------------------------------- // $read_navi_range -- 1- 101- 201- for ($i = 1; $i <= $aThread->rescount; $i = $i + $rnum_range) { - $offline_range_q = ""; + $offline_range_q = ''; $ito = $i + $rnum_range - 1; if ($ito <= $aThread->gotnum) { $offline_range_q = $offline_q; } - $read_navi_range = $read_navi_range . "<a href=\"{$_conf['read_php']}?host={$aThread->host}{$bbs_q}{$key_q}&ls={$i}-{$ito}{$offline_range_q}\">{$i}-</a>\n"; + $read_navi_range = $read_navi_range . "<a href=\"{$_conf['read_php']}?{$host_bbs_key_q}&ls={$i}-{$ito}{$offline_range_q}\">{$i}-</a>\n"; } @@ -67,8 +68,8 @@ //} if (!$read_navi_previous_isInvisible) { - $read_navi_previous = "<a href=\"{$_conf['read_php']}?host={$aThread->host}{$bbs_q}{$key_q}&ls={$before_rnum}-{$aThread->resrange['start']}{$offline_q}{$read_navi_previous_anchor}\">{$prev_st}{$rnum_range}</a>"; - $read_navi_previous_header = "<a href=\"{$_conf['read_php']}?host={$aThread->host}{$bbs_q}{$key_q}&ls={$before_rnum}-{$aThread->resrange['start']}{$offline_q}#r{$aThread->resrange['start']}\">{$prev_st}{$rnum_range}</a>"; + $read_navi_previous = "<a href=\"{$_conf['read_php']}?{$host_bbs_key_q}&ls={$before_rnum}-{$aThread->resrange['start']}{$offline_q}{$read_navi_previous_anchor}\">{$prev_st}{$rnum_range}</a>"; + $read_navi_previous_header = "<a href=\"{$_conf['read_php']}?{$host_bbs_key_q}&ls={$before_rnum}-{$aThread->resrange['start']}{$offline_q}#r{$aThread->resrange['start']}\">{$prev_st}{$rnum_range}</a>"; } else { $read_navi_previous = ''; $read_navi_previous_header = ''; @@ -90,22 +91,22 @@ } $after_rnum = $aThread->resrange['to'] + $rnum_range; -$offline_range_q = ""; +$offline_range_q = ''; if ($after_rnum <= $aThread->gotnum) { $offline_range_q = $offline_q; } //if (!$read_navi_next_isInvisible) { -$read_navi_next = "<a href=\"{$_conf['read_php']}?host={$aThread->host}{$bbs_q}{$key_q}&ls={$aThread->resrange['to']}-{$after_rnum}{$offline_range_q}&nt={$newtime}{$read_navi_next_anchor}\">{$next_st}{$rnum_range}</a>"; +$read_navi_next = "<a href=\"{$_conf['read_php']}?{$host_bbs_key_q}&ls={$aThread->resrange['to']}-{$after_rnum}{$offline_range_q}&nt={$newtime}{$read_navi_next_anchor}\">{$next_st}{$rnum_range}</a>"; //} //---------------------------------------------- // $read_footer_navi_new ±«ðÇÞ V XÌ\¦ if ($aThread->resrange['to'] == $aThread->rescount) { - $read_footer_navi_new = "<a href=\"{$_conf['read_php']}?host={$aThread->host}{$bbs_q}{$key_q}&ls={$aThread->rescount}-&nt={$newtime}#r{$aThread->rescount}\" accesskey=\"r\">{$shinchaku_st}</a>"; + $read_footer_navi_new = "<a href=\"{$_conf['read_php']}?{$host_bbs_key_q}&ls={$aThread->rescount}-&nt={$newtime}#r{$aThread->rescount}\" accesskey=\"r\">{$shinchaku_st}</a>"; } else { - $read_footer_navi_new = "<a href=\"{$_conf['read_php']}?host={$aThread->host}{$bbs_q}{$key_q}&ls={$aThread->resrange['to']}-{$offline_q}\" accesskey=\"r\">{$tuduki_st}</a>"; + $read_footer_navi_new = "<a href=\"{$_conf['read_php']}?{$host_bbs_key_q}&ls={$aThread->resrange['to']}-{$offline_q}\" accesskey=\"r\">{$tuduki_st}</a>"; } @@ -124,8 +125,6 @@ //==================================================================== // HTMLvg //==================================================================== -$sid_q = (defined('SID')) ? '&'.strip_tags(SID) : ''; - // c[o[ªHTML ======= // ¨CÉ}[NÝè @@ -141,7 +140,7 @@ $favtitle = ((!isset($favlist_titles[0]) || $favlist_titles[0] == '') ? '¨CÉX' : $favlist_titles[0]) . ($favdo ? 'ÉÇÁ' : '©çO·'); $setnum_q = '&setnum=0'; $toolbar_setfav_ht .= <<<EOP -<span class="favdo set0"><a href="info.php?host={$aThread->host}{$bbs_q}{$key_q}{$ttitle_en_q}{$favdo_q}{$setnum_q}{$sid_q}" target="info" onclick="return setFavJs('host={$aThread->host}{$bbs_q}{$key_q}{$ttitle_en_q}{$sid_q}', '{$favdo}', {$STYLE['info_pop_size']}, 'read', this, '0');" title="{$favtitle}">{$favmark}</a></span> +<span class="favdo set0"><a href="info.php?{$host_bbs_key_q}{$ttitle_en_q}{$favdo_q}{$setnum_q}" target="info" onclick="return setFavJs('{$host_bbs_key_q}{$ttitle_en_q}', '{$favdo}', {$STYLE['info_pop_size']}, 'read', this, '0');" title="{$favtitle}">{$favmark}</a></span> EOP; for ($i = 1; $i <= $_conf['expack.misc.favset_num']; $i++) { $favdo = (!empty($aThread->favs[$i])) ? 0 : 1; @@ -150,7 +149,7 @@ $favtitle = ((!isset($favlist_titles[$i]) || $favlist_titles[$i] == '') ? '¨CÉX' . $i : $favlist_titles[$i]) . ($favdo ? 'ÉÇÁ' : '©çO·'); $setnum_q = '&setnum=' . $i; $toolbar_setfav_ht .= <<<EOP -|<span class="favdo set{$i}"><a href="info.php?host={$aThread->host}{$bbs_q}{$key_q}{$ttitle_en_q}{$favdo_q}{$setnum_q}{$sid_q}" target="info" onclick="return setFavJs('host={$aThread->host}{$bbs_q}{$key_q}{$ttitle_en_q}{$sid_q}', '{$favdo}', {$STYLE['info_pop_size']}, 'read', this, '{$i}');" title="{$favtitle}">{$favmark}</a></span> +|<span class="favdo set{$i}"><a href="info.php?{$host_bbs_key_q}{$ttitle_en_q}{$favdo_q}{$setnum_q}" target="info" onclick="return setFavJs('{$host_bbs_key_q}{$ttitle_en_q}', '{$favdo}', {$STYLE['info_pop_size']}, 'read', this, '{$i}');" title="{$favtitle}">{$favmark}</a></span> EOP; } $toolbar_setfav_ht .= ']'; @@ -160,18 +159,18 @@ $favmark = $favdo ? '+' : ''; $favtitle = $favdo ? '¨CÉXÉÇÁ' : '¨CÉX©çO·'; $toolbar_setfav_ht = <<<EOP -<span class="favdo"><a href="info.php?host={$aThread->host}{$bbs_q}{$key_q}{$ttitle_en_q}{$favdo_q}{$sid_q}" target="info" onclick="return setFavJs('host={$aThread->host}{$bbs_q}{$key_q}{$ttitle_en_q}{$sid_q}', '{$favdo}', {$STYLE['info_pop_size']}, 'read', this);" title="{$favtitle}">¨CÉ{$favmark}</a></span> +<span class="favdo"><a href="info.php?{$host_bbs_key_q}{$ttitle_en_q}{$favdo_q}" target="info" onclick="return setFavJs('{$host_bbs_key_q}{$ttitle_en_q}', '{$favdo}', {$STYLE['info_pop_size']}, 'read', this);" title="{$favtitle}">¨CÉ{$favmark}</a></span> EOP; } $toolbar_right_ht = <<<EOTOOLBAR - <a href="{$_conf['subject_php']}?host={$aThread->host}{$bbs_q}{$key_q}" target="subject" title="ÂðJ">{$itaj_hd}</a> - <a href="info.php?host={$aThread->host}{$bbs_q}{$key_q}{$ttitle_en_q}" target="info" onclick="return OpenSubWin('info.php?host={$aThread->host}{$bbs_q}{$key_q}{$ttitle_en_q}{$popup_q}{$sid_q}',{$STYLE['info_pop_size']},0,0)" title="Xbhîñð\¦">{$info_st}</a> + <a href="{$_conf['subject_php']}?{$host_bbs_key_q}" target="subject" title="ÂðJ">{$itaj_hd}</a> + <a href="info.php?{$host_bbs_key_q}{$ttitle_en_q}" target="info" onclick="return OpenSubWin('info.php?{$host_bbs_key_q}{$ttitle_en_q}{$popup_q}',{$STYLE['info_pop_size']},0,0)" title="Xbhîñð\¦">{$info_st}</a> {$toolbar_setfav_ht} - <span><a href="info.php?host={$aThread->host}{$bbs_q}{$key_q}{$ttitle_en_q}&dele=true" target="info" onclick="return deleLog('host={$aThread->host}{$bbs_q}{$key_q}{$ttitle_en_q}{$sid_q}', {$STYLE['info_pop_size']}, 'read', this);" title="Oðí·é">{$delete_st}</a></span> -<!-- <a href="info.php?host={$aThread->host}{$bbs_q}{$key_q}{$ttitle_en_q}&taborn=2" target="info" onclick="return OpenSubWin('info.php?host={$aThread->host}{$bbs_q}&key={$aThread->key}{$ttitle_en_q}&popup=2&taborn=2{$sid_q}',{$STYLE['info_pop_size']},0,0)" title="XbhÌ Ú[ñóÔðgO·é">{$aborn_st}</a> --> - <a href="{$motothre_url}" title="ÂT[oãÌIWiXð\¦">{$moto_thre_st}</a> - <a href="{$_conf['subject_php']}?host={$aThread->host}{$bbs_q}{$key_q}{$similar_q}" target="subject" title="^CgªÄ¢éXbhðõ">{$siml_thre_st}</a> + <span><a href="info.php?{$host_bbs_key_q}{$ttitle_en_q}&dele=true" target="info" onclick="return deleLog('{$host_bbs_key_q}{$ttitle_en_q}', {$STYLE['info_pop_size']}, 'read', this);" title="Oðí·é">{$delete_st}</a></span> +<!-- <a href="info.php?{$host_bbs_key_q}{$ttitle_en_q}&taborn=2" target="info" onclick="return OpenSubWin('info.php?{$host_bbs_key_q}{$ttitle_en_q}&popup=2&taborn=2',{$STYLE['info_pop_size']},0,0)" title="XbhÌ Ú[ñóÔðgO·é">{$aborn_st}</a> --> + <a href="{$motothre_url}" title="ÂT[oãÌIWiXð\¦" onmouseover="showMotoLsPopUp(event, this)" onmouseout="hideMotoLsPopUp()">{$moto_thre_st}</a> + <a href="{$_conf['subject_php']}?{$host_bbs_key_q}{$similar_q}" target="subject" title="^CgªÄ¢éXbhðõ">{$siml_thre_st}</a> EOTOOLBAR; //===================================== @@ -191,6 +190,7 @@ <script type="text/javascript" src="js/basic.js?{$_conf['p2_version_id']}"></script> <script type="text/javascript" src="js/respopup.js?{$_conf['p2_version_id']}"></script> <script type="text/javascript" src="js/htmlpopup.js?{$_conf['p2_version_id']}"></script> + <script type="text/javascript" src="js/motolspopup.js?{$_conf['p2_version_id']}"></script> <script type="text/javascript" src="js/ngabornctl.js?{$_conf['p2_version_id']}"></script> <script type="text/javascript" src="js/setfavjs.js?{$_conf['p2_version_id']}"></script> <script type="text/javascript" src="js/delelog.js?{$_conf['p2_version_id']}"></script>\n @@ -275,7 +275,7 @@ EOP; echo $_info_msg_ht; -$_info_msg_ht = ""; +$_info_msg_ht = ''; // XªÂT[oÉȯêÎ ============================ if ($aThread->diedat) { @@ -405,10 +405,10 @@ <table{$id_header} class="toolbar"> <tr> <td class="lblock"> - <a href="{$_conf['read_php']}?host={$aThread->host}{$bbs_q}{$key_q}&ls=all">{$all_st}</a> + <a href="{$_conf['read_php']}?{$host_bbs_key_q}&ls=all">{$all_st}</a> {$read_navi_range} {$read_navi_previous_header} - <a href="{$_conf['read_php']}?host={$aThread->host}{$bbs_q}{$key_q}&ls=l{$latest_show_res_num}">{$latest_st}{$latest_show_res_num}</a> {$htm['goto']} + <a href="{$_conf['read_php']}?{$host_bbs_key_q}&ls=l{$latest_show_res_num}">{$latest_st}{$latest_show_res_num}</a> {$htm['goto']} </td> <td class="rblock">{$htm['p2frame']} {$toolbar_right_ht}</td> <td class="rblock"><a href="#footer">¥</a></td> Modified: p2ex/trunk/lib/read_header_k.inc.php =================================================================== --- p2ex/trunk/lib/read_header_k.inc.php 2010-01-13 00:37:02 UTC (rev 772) +++ p2ex/trunk/lib/read_header_k.inc.php 2010-01-13 04:36:03 UTC (rev 773) @@ -17,11 +17,12 @@ $dores_st = '攴'; $find_st = 'õ'; -$motothre_url = $aThread->getMotoThread(); +$motothre_url = $aThread->getMotoThread(false, '1-10'); $ttitle_en = rawurlencode(base64_encode($aThread->ttitle)); $ttitle_en_q = '&ttitle_en=' . $ttitle_en; $bbs_q = '&bbs=' . $aThread->bbs; $key_q = '&key=' . $aThread->key; +$host_bbs_key_q = 'host=' . $aThread->host . $bbs_q . $key_q; $offline_q = '&offline=1'; $do_filtering = (isset($GLOBALS['word']) && strlen($GLOBALS['word']) > 0); @@ -60,7 +61,7 @@ //---------------------------------------------- // $htm['read_navi_range'] -- 1- 101- 201- -$htm['read_navi_range'] = "<a{$pointer_header_at} href=\"{$_conf['read_php']}?host={$aThread->host}{$bbs_q}{$key_q}&ls=1-{$rnum_range}{$offline_range_q}{$_conf['k_at_a']}\"{$_conf['k_accesskey_at'][1]}>1-</a>\t"; +$htm['read_navi_range'] = "<a{$pointer_header_at} href=\"{$_conf['read_php']}?{$host_bbs_key_q}&ls=1-{$rnum_range}{$offline_range_q}{$_conf['k_at_a']}\"{$_conf['k_accesskey_at'][1]}>1-</a>\t"; //---------------------------------------------- @@ -79,8 +80,8 @@ //} if (!$read_navi_previous_isInvisible) { - $read_navi_previous = "<a href=\"{$_conf['read_php']}?host={$aThread->host}{$bbs_q}{$key_q}&ls={$before_rnum}-{$aThread->resrange['start']}n{$offline_q}{$_conf['k_at_a']}{$read_navi_previous_anchor}\">{$prev_st}</a>"; - $read_navi_previous_btm = "<a href=\"{$_conf['read_php']}?host={$aThread->host}{$bbs_q}{$key_q}&ls={$before_rnum}-{$aThread->resrange['start']}n{$offline_q}{$_conf['k_at_a']}{$read_navi_previous_anchor}\"{$_conf['k_accesskey_at']['prev']}>{$_conf['k_accesskey_st']['prev']}{$prev_st}</a>"; + $read_navi_previous = "<a href=\"{$_conf['read_php']}?{$host_bbs_key_q}&ls={$before_rnum}-{$aThread->resrange['start']}n{$offline_q}{$_conf['k_at_a']}{$read_navi_previous_anchor}\">{$prev_st}</a>"; + $read_navi_previous_btm = "<a href=\"{$_conf['read_php']}?{$host_bbs_key_q}&ls={$before_rnum}-{$aThread->resrange['start']}n{$offline_q}{$_conf['k_at_a']}{$read_navi_previous_anchor}\"{$_conf['k_accesskey_at']['prev']}>{$_conf['k_accesskey_st']['prev']}{$prev_st}</a>"; } //---------------------------------------------- @@ -103,35 +104,35 @@ $after_rnum = $aThread->resrange['to'] + $rnum_range; if (!$read_navi_next_isInvisible) { - $read_navi_next = "<a href=\"{$_conf['read_php']}?host={$aThread->host}{$bbs_q}{$key_q}&ls={$aThread->resrange['to']}-{$after_rnum}n{$offline_q}&nt={$newtime}{$_conf['k_at_a']}{$read_navi_next_anchor}\">{$next_st}</a>"; - $read_navi_next_btm = "<a href=\"{$_conf['read_php']}?host={$aThread->host}{$bbs_q}{$key_q}&ls={$aThread->resrange['to']}-{$after_rnum}n{$offline_q}&nt={$newtime}{$_conf['k_at_a']}{$read_navi_next_anchor}\"{$_conf['k_accesskey_at']['next']}>{$_conf['k_accesskey_st']['next']}{$next_st}</a>"; + $read_navi_next = "<a href=\"{$_conf['read_php']}?{$host_bbs_key_q}&ls={$aThread->resrange['to']}-{$after_rnum}n{$offline_q}&nt={$newtime}{$_conf['k_at_a']}{$read_navi_next_anchor}\">{$next_st}</a>"; + $read_navi_next_btm = "<a href=\"{$_conf['read_php']}?{$host_bbs_key_q}&ls={$aThread->resrange['to']}-{$after_rnum}n{$offline_q}&nt={$newtime}{$_conf['k_at_a']}{$read_navi_next_anchor}\"{$_conf['k_accesskey_at']['next']}>{$_conf['k_accesskey_st']['next']}{$next_st}</a>"; } //---------------------------------------------- // $read_footer_navi_new ±«ðÇÞ V XÌ\¦ if ($aThread->resrange['to'] == $aThread->rescount) { - $read_footer_navi_new = "<a href=\"{$_conf['read_php']}?host={$aThread->host}{$bbs_q}{$key_q}&ls={$aThread->rescount}-n&nt={$newtime}{$_conf['k_at_a']}#r{$aThread->rescount}\">{$shinchaku_st}</a>"; - $read_footer_navi_new_btm = "<a href=\"{$_conf['read_php']}?host={$aThread->host}{$bbs_q}{$key_q}&ls={$aThread->rescount}-n&nt={$newtime}{$_conf['k_at_a']}#r{$aThread->rescount}\"{$_conf['k_accesskey_at']['next']}>{$_conf['k_accesskey_st']['next']}{$shinchaku_st}</a>"; + $read_footer_navi_new = "<a href=\"{$_conf['read_php']}?{$host_bbs_key_q}&ls={$aThread->rescount}-n&nt={$newtime}{$_conf['k_at_a']}#r{$aThread->rescount}\">{$shinchaku_st}</a>"; + $read_footer_navi_new_btm = "<a href=\"{$_conf['read_php']}?{$host_bbs_key_q}&ls={$aThread->rescount}-n&nt={$newtime}{$_conf['k_at_a']}#r{$aThread->rescount}\"{$_conf['k_accesskey_at']['next']}>{$_conf['k_accesskey_st']['next']}{$shinchaku_st}</a>"; } if (!$read_navi_next_isInvisible) { $read_navi_latest = <<<EOP -<a href="{$_conf['read_php']}?host={$aThread->host}{$bbs_q}{$key_q}&ls=l{$latest_show_res_num}{$_conf['k_at_a']}">{$latest_st}{$latest_show_res_num}</a> +<a href="{$_conf['read_php']}?{$host_bbs_key_q}&ls=l{$latest_show_res_num}{$_conf['k_at_a']}">{$latest_st}{$latest_show_res_num}</a> EOP; $time = time(); $read_navi_latest_btm = <<<EOP -<a href="{$_conf['read_php']}?host={$aThread->host}{$bbs_q}{$key_q}&ls=l{$latest_show_res_num}&dummy={$time}{$_conf['k_at_a']}"{$_conf['k_accesskey_at']['latest']}>{$_conf['k_accesskey_st']['latest']}{$latest_st}{$latest_show_res_num}</a> +<a href="{$_conf['read_php']}?{$host_bbs_key_q}&ls=l{$latest_show_res_num}&dummy={$time}{$_conf['k_at_a']}"{$_conf['k_accesskey_at']['latest']}>{$_conf['k_accesskey_st']['latest']}{$latest_st}{$latest_show_res_num}</a> EOP; } // {{{ õ $read_navi_filter = <<<EOP -<a href="read_filter_k.php?host={$aThread->host}{$bbs_q}{$key_q}{$ttitle_en_q}{$_conf['k_at_a']}">{$find_st}</a> +<a href="read_filter_k.php?{$host_bbs_key_q}{$ttitle_en_q}{$_conf['k_at_a']}">{$find_st}</a> EOP; $read_navi_filter_btm = <<<EOP -<a href="read_filter_k.php?host={$aThread->host}{$bbs_q}{$key_q}{$ttitle_en_q}{$_conf['k_at_a']}"{$_conf['k_accesskey_at']['filter']}>{$_conf['k_accesskey_st']['filter']}{$find_st}</a> +<a href="read_filter_k.php?{$host_bbs_key_q}{$ttitle_en_q}{$_conf['k_at_a']}"{$_conf['k_accesskey_at']['filter']}>{$_conf['k_accesskey_st']['filter']}{$find_st}</a> EOP; // }}} @@ -191,11 +192,11 @@ $similar_q = '&itaj_en=' . rawurlencode(base64_encode($aThread->itaj)) . '&method=similar&word=' . rawurlencode($aThread->ttitle_hc) . '&refresh=1'; $itaj_hd = htmlspecialchars($aThread->itaj, ENT_QUOTES); $toolbar_right_ht = <<<EOTOOLBAR -<a href="{$_conf['subject_php']}?host={$aThread->host}{$bbs_q}{$key_q}{$_conf['k_at_a']}"{$_conf['k_accesskey_at']['up']}>{$_conf['k_accesskey_st']['up']}{$itaj_hd}</a> -<a href="info.php?host={$aThread->host}{$bbs_q}{$key_q}{$ttitle_en_q}{$_conf['k_at_a']}"{$_conf['k_accesskey_at']['info']}>{$_conf['k_accesskey_st']['info']}{$info_st}</a> -<a href="info.php?host={$aThread->host}{$bbs_q}{$key_q}{$ttitle_en_q}&dele=1{$_conf['k_at_a']}"{$_conf['k_accesskey_at']['dele']}>{$_conf['k_accesskey_st']['dele']}{$delete_st}</a> +<a href="{$_conf['subject_php']}?{$host_bbs_key_q}{$_conf['k_at_a']}"{$_conf['k_accesskey_at']['up']}>{$_conf['k_accesskey_st']['up']}{$itaj_hd}</a> +<a href="info.php?{$host_bbs_key_q}{$ttitle_en_q}{$_conf['k_at_a']}"{$_conf['k_accesskey_at']['info']}>{$_conf['k_accesskey_st']['info']}{$info_st}</a> +<a href="info.php?{$host_bbs_key_q}{$ttitle_en_q}&dele=1{$_conf['k_at_a']}"{$_conf['k_accesskey_at']['dele']}>{$_conf['k_accesskey_st']['dele']}{$delete_st}</a> <a href="{$motothre_url}" target="_blank">{$moto_thre_st}</a> -<a href="{$_conf['subject_php']}?host={$aThread->host}{$bbs_q}{$key_q}{$similar_q}{$_conf['k_at_a']}">{$siml_thre_st}</a> +<a href="{$_conf['subject_php']}?{$host_bbs_key_q}{$similar_q}{$_conf['k_at_a']}">{$siml_thre_st}</a> EOTOOLBAR; // }}} Modified: p2ex/trunk/lib/sb_footer.inc.php =================================================================== --- p2ex/trunk/lib/sb_footer.inc.php 2010-01-13 00:37:02 UTC (rev 772) +++ p2ex/trunk/lib/sb_footer.inc.php 2010-01-13 04:36:03 UTC (rev 773) @@ -4,8 +4,8 @@ * for subject.php */ -$bbs_q = "&bbs=".$aThreadList->bbs; -$sid_q = (defined('SID')) ? '&'.strip_tags(SID) : ''; +$bbs_q = '&bbs=' . $aThreadList->bbs; +$host_bbs_q = 'host=' . $aThreadList->host . $bbs_q; $have_sb_footer_links = false; @@ -14,7 +14,7 @@ $dat_soko_ht = ''; if(!$aThreadList->spmode or $aThreadList->spmode=="taborn"){ $dat_soko_ht =<<<EOP - <a href="{$_conf['subject_php']}?host={$aThreadList->host}{$bbs_q}{$norefresh_q}&spmode=soko" target="_self">datqÉ</a> | + <a href="{$_conf['subject_php']}?{$host_bbs_q}{$norefresh_q}&spmode=soko" target="_self">datqÉ</a> | EOP; $have_sb_footer_links = true; } @@ -23,7 +23,7 @@ $taborn_link_ht = ''; if ($ta_num) { $taborn_link_ht = <<<EOP - <a href="{$_conf['subject_php']}?host={$aThreadList->host}{$bbs_q}{$norefresh_q}&spmode=taborn" target="_self"> Ú[ñÌXbh (<span id="ta_num">{$ta_num}</span>)</a> | + <a href="{$_conf['subject_php']}?{$host_bbs_q}{$norefresh_q}&spmode=taborn" target="_self"> Ú[ñÌXbh (<span id="ta_num">{$ta_num}</span>)</a> | EOP; $have_sb_footer_links = true; } @@ -42,10 +42,10 @@ $import_dat_ht = ''; if (!$aThreadList->spmode) { $buildnewthread_ht = <<<EOP - <a href="post_form.php?host={$aThreadList->host}{$bbs_q}&newthread=true" target="_self" onclick="return OpenSubWin('post_form.php?host={$aThreadList->host}{$bbs_q}&newthread=true&popup=1{$sid_q}',{$STYLE['post_pop_size']},1,0)">VKXbhì¬</a> + <a href="post_form.php?{$host_bbs_q}&newthread=true" target="_self" onclick="return OpenSubWin('post_form.php?{$host_bbs_q}&newthread=true&popup=1',{$STYLE['post_pop_size']},1,0)">VKXbhì¬</a> EOP; $import_dat_ht = <<<EOP - | <a href="import.php?host={$aThreadList->host}{$bbs_q}" onclick="return OpenSubWin('import.php?host={$aThreadList->host}{$bbs_q}', 600, 380, 0, 0);" target="_self">datÌC|[g</a> + | <a href="import.php?{$host_bbs_q}" onclick="return OpenSubWin('import.php?{$host_bbs_q}', 600, 380, 0, 0);" target="_self">datÌC|[g</a> EOP; $have_sb_footer_links = true; } Modified: p2ex/trunk/lib/sb_footer_k.inc.php =================================================================== --- p2ex/trunk/lib/sb_footer_k.inc.php 2010-01-13 00:37:02 UTC (rev 772) +++ p2ex/trunk/lib/sb_footer_k.inc.php 2010-01-13 04:36:03 UTC (rev 773) @@ -7,9 +7,10 @@ //================================================= //tb^vg //================================================= -$mae_ht = ""; -$tugi_ht = ""; -$bbs_q = "&bbs=".$aThreadList->bbs; +$mae_ht = ''; +$tugi_ht = ''; +$bbs_q = '&bbs=' . $aThreadList->bbs; +$host_bbs_q = 'host=' . $aThreadList->host . $bbs_q; if (!empty($GLOBALS['wakati_words'])) { $word_at = '&method=similar&word=' . rawurlencode($GLOBALS['wakati_word']); @@ -166,7 +167,7 @@ // XyV[hÅȯêÎAÜ½Í Ú[ñXgÈç if (!$aThreadList->spmode or $aThreadList->spmode == "taborn") { $dat_soko_ht = <<<EOP - <a href="{$_conf['subject_php']}?host={$aThreadList->host}{$bbs_q}{$norefresh_q}&spmode=soko{$_conf['k_at_a']}">datqÉ</a> + <a href="{$_conf['subject_php']}?{$host_bbs_q}{$norefresh_q}&spmode=soko{$_conf['k_at_a']}">datqÉ</a> EOP; } else { $dat_soko_ht = ''; @@ -177,7 +178,7 @@ if ($ta_num) { $taborn_link_ht = <<<EOP - <a href="{$_conf['subject_php']}?host={$aThreadList->host}{$bbs_q}{$norefresh_q}&spmode=taborn{$_conf['k_at_a']}">±ÎÞÝ({$ta_num})</a> + <a href="{$_conf['subject_php']}?{$host_bbs_q}{$norefresh_q}&spmode=taborn{$_conf['k_at_a']}">±ÎÞÝ({$ta_num})</a> EOP; } else { $taborn_link_ht = ''; @@ -188,7 +189,7 @@ if (!$aThreadList->spmode) { $buildnewthread_ht = <<<EOP - <a href="post_form.php?host={$aThreadList->host}{$bbs_q}&newthread=1{$_conf['k_at_a']}">½Ú§Ä</a> + <a href="post_form.php?{$host_bbs_q}&newthread=1{$_conf['k_at_a']}">½Ú§Ä</a> EOP; } else { $buildnewthread_ht = ''; Modified: p2ex/trunk/lib/sb_header.inc.php =================================================================== --- p2ex/trunk/lib/sb_header.inc.php 2010-01-13 00:37:02 UTC (rev 772) +++ p2ex/trunk/lib/sb_header.inc.php 2010-01-13 04:36:03 UTC (rev 773) @@ -156,7 +156,7 @@ EOP; $filter_form_ht = <<<EOP - <form class="toolbar" method="GET" action="subject.php" accept-charset="{$_conf['accept_charset']}" target="_self"> + <form class="toolbar" method="GET" action="{$_conf['subject_php']}" accept-charset="{$_conf['accept_charset']}" target="_self"> {$sb_form_hidden_ht} <input type="text" name="word" value="{$hd['word']}" size="16">{$sb_form_method_ht} {$input_find_cont_ht} @@ -212,6 +212,8 @@ <script type="text/javascript" src="js/setfavjs.js?{$_conf['p2_version_id']}"></script> <script type="text/javascript" src="js/settabornjs.js?{$_conf['p2_version_id']}"></script> <script type="text/javascript" src="js/delelog.js?{$_conf['p2_version_id']}"></script> + <script type="text/javascript" src="js/respopup.js?{$_conf['p2_version_id']}"></script> + <script type="text/javascript" src="js/motolspopup.js?{$_conf['p2_version_id']}"></script> <script type="text/javascript" src="js/jquery.pack.js?{$_conf['p2_version_id']}"></script> <script type="text/javascript"> //<![CDATA[ @@ -329,7 +331,7 @@ include P2_LIB_DIR . '/sb_toolbar.inc.php'; echo $_info_msg_ht; -$_info_msg_ht = ""; +$_info_msg_ht = ''; echo <<<EOP {$taborn_check_ht}{$check_form_ht} Modified: p2ex/trunk/lib/sb_print.inc.php =================================================================== --- p2ex/trunk/lib/sb_print.inc.php 2010-01-13 00:37:02 UTC (rev 772) +++ p2ex/trunk/lib/sb_print.inc.php 2010-01-13 04:36:03 UTC (rev 773) @@ -109,6 +109,12 @@ $sortq_common = $sortq_spmode . $sortq_host . $sortq_ita; + if (!empty($_REQUEST['find_cont']) && strlen($GLOBALS['word_fm']) > 0) { + $word_q = '&word=' . rawurlencode($GLOBALS['word']) . '&method=' . rawurlencode($GLOBALS['sb_filter']['method']); + } else { + $word_q = ''; + } + //===================================================== // e[uwb_ //===================================================== @@ -196,13 +202,6 @@ } else { $spmode_q = ''; } - $sid = defined('SID') ? strip_tags(SID) : ''; - if ($sid === '') { - $sid_q = $sid_js = ''; - } else { - $sid_q = "&{$sid}"; - $sid_js = "+'{$sid_q}'"; - } $i = 0; foreach ($aThreadList->threads as $aThread) { @@ -210,7 +209,7 @@ $midoku_ari = false; $anum_ht = ''; // #r1 - $base_q = "host={$aThread->host}&bbs={$aThread->bbs}&key={$aThread->key}"; + $host_bbs_key_q = "host={$aThread->host}&bbs={$aThread->bbs}&key={$aThread->key}"; if ($aThreadList->spmode != 'taborn') { if (!$aThread->torder) { $aThread->torder = $i; } @@ -230,7 +229,7 @@ $row_class .= ' r_read'; // readÍߪ // $ttitle_en_q Í߸Ȫ - $delelog_js = "return wrapDeleLog('{$base_q}{$sid_q}',this);"; + $delelog_js = "return wrapDeleLog('{$host_bbs_key_q}',this);"; $title_at = ' title="NbN·éÆOí"'; $anum_ht = sprintf('#r%d', min($aThread->rescount, $aThread->rescount - $aThread->nunum + 1 - $_conf['respointer'])); @@ -240,7 +239,7 @@ $row_class .= ' r_offline'; // JavaScriptÅÌmF_CAO è $unum_ht_c = <<<EOP -<a class="un_n" href="{$_conf['subject_php']}?{$base_q}{$spmode_q}&dele=true" target="_self" onclick="if (!window.confirm('OðíµÜ·©H')) {return false;} {$delelog_js}"{$title_at}>-</a> +<a class="un_n" href="{$_conf['subject_php']}?{$host_bbs_key_q}{$spmode_q}&dele=true" target="_self" onclick="if (!window.confirm('OðíµÜ·©H')) {return false;} {$delelog_js}"{$title_at}>-</a> EOP; // V è @@ -248,13 +247,13 @@ $row_class .= ' r_new'; $midoku_ari = true; $unum_ht_c = <<<EOP -<a id="un{$i}" class="un_a" href="{$_conf['subject_php']}?{$base_q}{$spmode_q}&dele=true" target="_self" onclick="{$delelog_js}"{$title_at}>{$aThread->unum}</a> +<a id="un{$i}" class="un_a" href="{$_conf['subject_php']}?{$host_bbs_key_q}{$spmode_q}&dele=true" target="_self" onclick="{$delelog_js}"{$title_at}>{$aThread->unum}</a> EOP; // subject.txtÉÍ éªAV ȵ } else { $unum_ht_c = <<<EOP -<a class="un" href="{$_conf['subject_php']}?{$base_q}{$spmode_q}&dele=true" target="_self" onclick="{$delelog_js}"{$title_at}>{$aThread->unum}</a> +<a class="un" href="{$_conf['subject_php']}?{$host_bbs_key_q}{$spmode_q}&dele=true" target="_self" onclick="{$delelog_js}"{$title_at}>{$aThread->unum}</a> EOP; } } @@ -284,7 +283,7 @@ // $ttitle_en_q àt¯½ûª¢¢ªAßñ̽ßȪ·é $td['fav'] = <<<EOP -<td{$class_t}><a class="fav" href="info.php?{$base_q}{$favdo_q}" target="info" onclick="return wrapSetFavJs('{$base_q}','{$favdo}',this);" title="{$favtitle}">{$favmark}</a></td>\n +<td{$class_t}><a class="fav" href="info.php?{$host_bbs_key_q}{$favdo_q}" target="info" onclick="return wrapSetFavJs('{$host_bbs_key_q}','{$favdo}',this);" title="{$favtitle}">{$favmark}</a></td>\n EOP; } } @@ -297,7 +296,7 @@ $torder_st = $aThread->torder; } $torder_ht = <<<EOP -<a id="to{$i}" class="info" href="info.php?{$base_q}" target="_self" onclick="return wrapOpenSubWin(this.href.toString(){$sid_js})">{$torder_st}</a> +<a id="to{$i}" class="info" href="info.php?{$host_bbs_key_q}" target="_self" onclick="return wrapOpenSubWin(this.href.toString())">{$torder_st}</a> EOP; // title ================================================= @@ -326,10 +325,14 @@ } // ³X - $moto_thre_ht = ""; + $moto_thre_ht = ''; if ($_conf['sb_show_motothre']) { if (!$aThread->isKitoku()) { - $moto_thre_ht = '<a class="thre_title" href="' . htmlspecialchars($aThread->getMotoThread()) . '">E</a> '; + $moto_thre_ht = '<a class="thre_title moto_thre" href="' + . htmlspecialchars($aThread->getMotoThread(false, ''), ENT_QUOTES) + . '"' + . ' onmouseover="showMotoLsPopUp(event, this, this.nextSibling.innerText)"' + . ' onmouseout="hideMotoLsPopUp()">E</a>'; } } @@ -342,24 +345,20 @@ } // XN - if (!empty($_REQUEST['find_cont']) && strlen($GLOBALS['word_fm']) > 0) { - $word_q = '&word=' . rawurlencode($GLOBALS['word']) . '&method=' . rawurlencode($GLOBALS['sb_filter']['method']); + if ($word_q) { $rescount_q = ''; $offline_q = '&offline=true'; $anum_ht = ''; - } else { - $word_q = ''; } - $thre_url = "{$_conf['read_php']}?{$base_q}{$rescount_q}{$offline_q}{$word_q}{$anum_ht}"; + $thre_url = "{$_conf['read_php']}?{$host_bbs_key_q}{$rescount_q}{$offline_q}{$word_q}{$anum_ht}"; - $chUnColor_js = ($midoku_ari) ? "chUnColor('{$i}');" : ''; $change_color = " onclick=\"chTtColor('{$i}');{$chUnColor_js}\""; // I[>>1 if ($only_one_bool) { $td['one'] = <<<EOP -<td{$class_t}><a href="{$_conf['read_php']}?{$base_q}&one=true">>>1</a></td>\n +<td{$class_t}><a href="{$_conf['read_php']}?{$host_bbs_key_q}&one=true">>>1</a></td>\n EOP; } @@ -386,7 +385,7 @@ } elseif ($aThreadList->spmode == 'palace') { $setkey = 'setpal'; } - $narabikae_a = "{$_conf['subject_php']}?{$base_q}{$spmode_q}{$sb_view_q}"; + $narabikae_a = "{$_conf['subject_php']}?{$host_bbs_key_q}{$spmode_q}{$sb_view_q}"; $td['edit'] = <<<EOP <td{$class_te}> @@ -401,7 +400,7 @@ // ÅßÇñ¾XÌð if ($aThreadList->spmode == 'recent') { $td['offrec'] = <<<EOP -<td{$class_tc}><a href="info.php?{$base_q}&offrec=true" target="_self" onclick="return offrec_ajax(this);">~</a></td>\n +<td{$class_tc}><a href="info.php?{$host_bbs_key_q}&offrec=true" target="_self" onclick="return offrec_ajax(this);">~</a></td>\n EOP; } Modified: p2ex/trunk/lib/sb_print_k.inc.php =================================================================== --- p2ex/trunk/lib/sb_print_k.inc.php 2010-01-13 00:37:02 UTC (rev 772) +++ p2ex/trunk/lib/sb_print_k.inc.php 2010-01-13 04:36:03 UTC (rev 773) @@ -17,7 +17,7 @@ //================================================= if (!$aThreadList->threads) { - if ($aThreadList->spmode == "fav" && $sb_view == "shinchaku") { + if ($aThreadList->spmode == 'fav' && $sb_view == 'shinchaku') { echo '<p class="empty-subject">¨CɽÚÉV È©Á½Û</p>'; } else { echo '<p class="empty-subject">Y»ÌÞ¼Þª¸ÄÍÈ©Á½Û</p>'; @@ -36,17 +36,17 @@ // >>1 if (strpos($aThreadList->bbs, 'news') !== false || $aThreadList->bbs == 'bizplus') { // qÉÍ - if ($aThreadList->spmode != "soko") { + if ($aThreadList->spmode != 'soko') { $only_one_bool = true; } } // ¼ - if ($aThreadList->spmode and $aThreadList->spmode != "taborn" and $aThreadList->spmode != "soko") { + if ($aThreadList->spmode and $aThreadList->spmode != 'taborn' and $aThreadList->spmode != 'soko') { $ita_name_bool = true; } - $norefresh_q = "&norefresh=1"; + $norefresh_q = '&norefresh=1'; // \[g ================================================== @@ -83,8 +83,9 @@ $anum_ht = ""; //#r1 $htm = array('ita' => '', 'rnum' => '', 'unum' => '', 'sim' => ''); - $bbs_q = "&bbs=".$aThread->bbs; - $key_q = "&key=".$aThread->key; + $bbs_q = '&bbs=' . $aThread->bbs; + $key_q = '&key=' . $aThread->key; + $host_bbs_key_q = 'host=' . $aThread->host . $bbs_q . $key_q; $offline_q = ''; if ($aThreadList->spmode!="taborn") { @@ -168,7 +169,7 @@ } else { $torder_st = $aThread->torder; } - $torder_ht = "<a id=\"to{$i}\" class=\"info\" href=\"info.php?host={$aThread->host}{$bbs_q}{$key_q}{$_conf['k_at_a']}\">{$torder_st}</a>"; + $torder_ht = "<a id=\"to{$i}\" class=\"info\" href=\"info.php?{$host_bbs_key_q}{$_conf['k_at_a']}\">{$torder_st}</a>"; */ $torder_ht = $aThread->torder; @@ -209,14 +210,14 @@ } } - $thre_url = "{$_conf['read_php']}?host={$aThread->host}{$bbs_q}{$key_q}"; + $thre_url = "{$_conf['read_php']}?{$host_bbs_key_q}"; if ($_conf['iphone']) { $thre_url .= '&ttitle_en=' . rawurlencode(base64_encode($aThread->ttitle)); } $thre_url .= "{$rescount_q}{$offline_q}{$_conf['k_at_a']}{$anum_ht}"; // I[>>1 - $onlyone_url = "{$_conf['read_php']}?host={$aThread->host}{$bbs_q}{$key_q}&one=true&k_continue=1{$_conf['k_at_a']}"; + $onlyone_url = "{$_conf['read_php']}?{$host_bbs_key_q}&one=true&k_continue=1{$_conf['k_at_a']}"; if ($only_one_bool) { $one_ht = "<a href=\"{$onlyone_url}\">>>1</a>"; } Modified: p2ex/trunk/lib/sb_toolbar.inc.php =================================================================== --- p2ex/trunk/lib/sb_toolbar.inc.php 2010-01-13 00:37:02 UTC (rev 772) +++ p2ex/trunk/lib/sb_toolbar.inc.php 2010-01-13 04:36:03 UTC (rev 773) @@ -53,7 +53,7 @@ <tr> <td class="toolbar-title">{$ptitle_ht}</td> <td class="toolbar-update"> - <form class="toolbar" method="GET" action="subject.php" accept-charset="{$_conf['accept_charset']}" target="_self"> + <form class="toolbar" method="GET" action="{$_conf['subject_php']}" accept-charset="{$_conf['accept_charset']}" target="_self"> {$sb_form_hidden_ht} {$sb_disp_num_ht} <input type="hidden" name="submit_refresh" value="1"> Modified: p2ex/trunk/read_new.php =================================================================== --- p2ex/trunk/read_new.php 2010-01-13 00:37:02 UTC (rev 772) +++ p2ex/trunk/read_new.php 2010-01-13 04:36:03 UTC (rev 773) @@ -39,14 +39,12 @@ $GLOBALS['rnum_all_range'] = $_conf['rnum_all_range']; } -$sb_view = "shinchaku"; -$newtime = date("gis"); +$sb_view = 'shinchaku'; +$newtime = date('gis'); $online_num = 0; $newthre_num = 0; -$sid_q = (defined('SID')) ? '&'.strip_tags(SID) : ''; - //================================================= // ÂÌwè //================================================= @@ -155,6 +153,7 @@ <script type="text/javascript" src="js/basic.js?{$_conf['p2_version_id']}"></script> <script type="text/javascript" src="js/respopup.js?{$_conf['p2_version_id']}"></script> <script type="text/javascript" src="js/htmlpopup.js?{$_conf['p2_version_id']}"></script> + <script type="text/javascript" src="js/motolspopup.js?{$_conf['p2_version_id']}"></script> <script type="text/javascript" src="js/ngabornctl.js?{$_conf['p2_version_id']}"></script> <script type="text/javascript" src="js/setfavjs.js?{$_conf['p2_version_id']}"></script> <script type="text/javascript" src="js/delelog.js?{$_conf['p2_version_id']}"></script>\n @@ -392,7 +391,7 @@ function readNew($aThread) { global $_conf, $newthre_num, $STYLE; - global $_info_msg_ht, $sid_q, $word; + global $_info_msg_ht, $word; static $favlist_titles = null; if ($_conf['expack.misc.multi_favs'] && is_null($favlist_titles)) { @@ -466,14 +465,15 @@ //================================================================== // wb_ \¦ //================================================================== - $motothre_url = $aThread->getMotoThread(); + $motothre_url = $aThread->getMotoThread(false, ''); $ttitle_en = base64_encode($aThread->ttitle); $ttitle_urlen = rawurlencode($ttitle_en); - $ttitle_en_q ="&ttitle_en=".$ttitle_urlen; - $bbs_q = "&bbs=".$aThread->bbs; - $key_q = "&key=".$aThread->key; - $popup_q = "&popup=1"; + $ttitle_en_q = '&ttitle_en=' . $ttitle_urlen; + $bbs_q = '&bbs=' . $aThread->bbs; + $key_q = '&key=' . $aThread->key; + $host_bbs_key_q = 'host=' . $aThread->host . $bbs_q . $key_q; + $popup_q = '&popup=1'; // require_once P2_LIB_DIR . '/read_header.inc.php'; @@ -524,20 +524,21 @@ // $read_footer_navi_new ±«ðÇÞ V XÌ\¦ $newtime = date("gis"); // NðNbNµÄàÄǵȢdlÉÎR·é_~[NG[ - $info_st = "îñ"; - $delete_st = "í"; - $prev_st = "O"; - $next_st = ""; + $info_st = 'îñ'; + $delete_st = 'í'; + $prev_st = 'O'; + $next_st = ''; + $dores_st = ''; - $read_footer_navi_new = "<a href=\"{$_conf['read_php']}?host={$aThread->host}{$bbs_q}{$key_q}&ls={$aThread->rescount}-&nt=$newtime#r{$aThread->rescount}\">V XÌ\¦</a>"; + $read_footer_navi_new = "<a href=\"{$_conf['read_php']}?{$host_bbs_key_q}&ls={$aThread->rescount}-&nt=$newtime#r{$aThread->rescount}\">V XÌ\¦</a>"; if (!empty($_conf['disable_res'])) { $dores_ht = <<<EOP - <a href="{$motothre_url}" target="_blank">X</a> + <a href="{$motothre_url}" target="_blank">{$dores_st}</a> EOP; } else { $dores_ht = <<<EOP - <a href="post_form.php?host={$aThread->host}{$bbs_q}{$key_q}&rescount={$aThread->rescount}{$ttitle_en_q}" target='_self' onclick="return OpenSubWin('post_form.php?host={$aThread->host}{$bbs_q}{$key_q}&rescount={$aThread->rescount}{$ttitle_en_q}{$popup_q}&from_read_new=1{$sid_q}',{$STYLE['post_pop_size']},1,0)">X</a> + <a href="post_form.php?{$host_bbs_key_q}&rescount={$aThread->rescount}{$ttitle_en_q}" target='_self' onclick="return OpenSubWin('post_form.php?{$host_bbs_key_q}&rescount={$aThread->rescount}{$ttitle_en_q}{$popup_q}&from_read_new=1',{$STYLE['post_pop_size']},1,0)">{$dores_st}</a> EOP; } @@ -555,7 +556,7 @@ $favtitle = $favlist_titles[0] . ($favdo ? 'ÉÇÁ' : '©çO·'); $setnum_q = '&setnum=0'; $toolbar_setfav_ht .= <<<EOP -<span class="favdo set0"><a href="info.php?host={$aThread->host}{$bbs_q}{$key_q}{$ttitle_en_q}{$favdo_q}{$setnum_q}{$sid_q}" target="info" onclick="return setFavJs('host={$aThread->host}{$bbs_q}{$key_q}{$ttitle_en_q}{$sid_q}', '{$favdo}', {$STYLE['info_pop_size']}, 'read_new', this, '0');" title="{$favtitle}">{$favmark}</a></span> +<span class="favdo set0"><a href="info.php?{$host_bbs_key_q}{$ttitle_en_q}{$favdo_q}{$setnum_q}" target="info" onclick="return setFavJs('{$host_bbs_key_q}{$ttitle_en_q}', '{$favdo}', {$STYLE['info_pop_size']}, 'read_new', this, '0');" title="{$favtitle}">{$favmark}</a></span> EOP; for ($i = 1; $i <= $_conf['expack.misc.favset_num']; $i++) { $favdo = (!empty($aThread->favs[$i])) ? 0 : 1; @@ -564,7 +565,7 @@ $favtitle = $favlist_titles[$i] . ($favdo ? 'ÉÇÁ' : '©çO·'); $setnum_q = '&setnum=' . $i; $toolbar_setfav_ht .= <<<EOP -|<span class="favdo set{$i}"><a href="info.php?host={$aThread->host}{$bbs_q}{$key_q}{$ttitle_en_q}{$favdo_q}{$setnum_q}{$sid_q}" target="info" onclick="return setFavJs('host={$aThread->host}{$bbs_q}{$key_q}{$ttitle_en_q}{$sid_q}', '{$favdo}', {$STYLE['info_pop_size']}, 'read_new', this, '{$i}');" title="{$favtitle}">{$favmark}</a></span> +|<span class="favdo set{$i}"><a href="info.php?{$host_bbs_key_q}{$ttitle_en_q}{$favdo_q}{$setnum_q}" target="info" onclick="return setFavJs('{$host_bbs_key_q}{$ttitle_en_q}', '{$favdo}', {$STYLE['info_pop_size']}, 'read_new', this, '{$i}');" title="{$favtitle}">{$favmark}</a></span> EOP; } $toolbar_setfav_ht .= ']'; @@ -574,18 +575,18 @@ $favmark = $favdo ? '+' : ''; $favtitle = $favdo ? '¨CÉXÉÇÁ' : '¨CÉX©çO·'; $toolbar_setfav_ht = <<<EOP -<span class="favdo"><a href="info.php?host={$aThread->host}{$bbs_q}{$key_q}{$ttitle_en_q}{$favdo_q}{$sid_q}" target="info" onclick="return setFavJs('host={$aThread->host}{$bbs_q}{$key_q}{$ttitle_en_q}{$sid_q}', '{$favdo}', {$STYLE['info_pop_size']}, 'read_new', this, '0');" title="{$favtitle}">¨CÉ{$favmark}</a></span> +<span class="favdo"><a href="info.php?{$host_bbs_key_q}{$ttitle_en_q}{$favdo_q}" target="info" onclick="return setFavJs('{$host_bbs_key_q}{$ttitle_en_q}', '{$favdo}', {$STYLE['info_pop_size']}, 'read_new', this, '0');" title="{$favtitle}">¨CÉ{$favmark}</a></span> EOP; } $toolbar_right_ht = <<<EOTOOLBAR - <a href="{$_conf['subject_php']}?host={$aThread->host}{$bbs_q}{$key_q}" target="subject" title="ÂðJ">{$itaj_hd}</a> - <a href="info.php?host={$aThread->host}{$bbs_q}{$key_q}{$ttitle_en_q}{$sid_q}" target="info" onclick="return OpenSubWin('info.php?host={$aThread->host}{$bbs_q}{$key_q}{$ttitle_en_q}{$popup_q}{$sid_q}',{$STYLE['info_pop_size']},1,0)" title="Xbhîñð\¦">{$info_st}</a> + <a href="{$_conf['subject_php']}?{$host_bbs_key_q}" target="subject" title="ÂðJ">{$itaj_hd}</a> + <a href="info.php?{$host_bbs_key_q}{$ttitle_en_q}" target="info" onclick="return OpenSubWin('info.php?{$host_bbs_key_q}{$ttitle_en_q}{$popup_q}',{$STYLE['info_pop_size']},1,0)" title="Xbhîñð\¦">{$info_st}</a> {$toolbar_setfav_ht} - <span><a href="info.php?host={$aThread->host}{$bbs_q}{$key_q}{$ttitle_en_q}&dele=true" target="info" onclick="return deleLog('host={$aThread->host}{$bbs_q}{$key_q}{$ttitle_en_q}{$sid_q}', {$STYLE['info_pop_size']}, 'read_new', this);" title="Oðí·é">{$delete_st}</a></span> -<!-- <a href="info.php?host={$aThread->host}{$bbs_q}{$key_q}{$ttitle_en_q}&taborn=2" target="info" onclick="return OpenSubWin('info.php?host={$aThread->host}{$bbs_q}&key={$aThread->key}{$ttitle_en_q}&popup=2&taborn=2{$sid_q}',{$STYLE['info_pop_size']},0,0)" title="XbhÌ Ú[ñóÔðgO·é"> Úñ</a> --> - <a href="{$motothre_url}" title="ÂT[oãÌIWiXð\¦">³X</a> - <a href="{$_conf['subject_php']}?host={$aThread->host}{$bbs_q}{$key_q}{$similar_q}" target="subject" title="^CgªÄ¢éXbhðõ">X</a> + <span><a href="info.php?{$host_bbs_key_q}{$ttitle_en_q}&dele=true" target="info" onclick="return deleLog('{$host_bbs_key_q}{$ttitle_en_q}', {$STYLE['info_pop_size']}, 'read_new', this);" title="Oðí·é">{$delete_st}</a></span> +<!-- <a href="info.php?{$host_bbs_key_q}{$ttitle_en_q}&taborn=2" target="info" onclick="return OpenSubWin('info.php?{$host_bbs_key_q}{$ttitle_en_q}&popup=2&taborn=2',{$STYLE['info_pop_size']},0,0)" title="XbhÌ Ú[ñóÔðgO·é"> Úñ</a> --> + <a href="{$motothre_url}" title="ÂT[oãÌIWiXð\¦" onmouseover="showMotoLsPopUp(event, this)" onmouseout="hideMotoLsPopUp()">³X</a> + <a href="{$_conf['subject_php']}?{$host_bbs_key_q}{$similar_q}" target="subject" title="^CgªÄ¢éXbhðõ">X</a> EOTOOLBAR; // XÌ·Îâ³ @@ -605,7 +606,7 @@ $read_footer_ht = <<<EOP <table class="toolbar"> <tr> - <td class="lblock">{$res1['body']} | <a href="{$_conf['read_php']}?host={$aThread->host}{$bbs_q}{$key_q}&offline=1&rescount={$aThread->rescount}#r{$aThread->rescount}">{$aThread->ttitle_hd}</a> | {$dores_ht} {$dsize_ht} {$spd_ht}</td> + <td class="lblock">{$res1['body']} | <a href="{$_conf['read_php']}?{$host_bbs_key_q}&offline=1&rescount={$aThread->rescount}#r{$aThread->rescount}">{$aThread->ttitle_hd}</a> | {$dores_ht} {$dsize_ht} {$spd_ht}</td> <td class="rblock">{$toolbar_right_ht}</td> <td class="rblock"><a href="#ntt{$newthre_num}">£</a></td> </tr> Modified: p2ex/trunk/read_new_k.php =================================================================== --- p2ex/trunk/read_new_k.php 2010-01-13 00:37:02 UTC (rev 772) +++ p2ex/trunk/read_new_k.php 2010-01-13 04:36:03 UTC (rev 773) @@ -439,6 +439,7 @@ $ttitle_en_q = '&ttitle_en=' . $ttitle_en; $bbs_q = '&bbs=' . $aThread->bbs; $key_q = '&key=' . $aThread->key; + $host_bbs_key_q = 'host=' . $aThread->host . $bbs_q . $key_q; $popup_q = '&popup=1'; // require_once P2_LIB_DIR . '/read_header.inc.php'; @@ -495,6 +496,7 @@ $delete_st = 'í'; $prev_st = 'O'; $next_st = ''; + //$dores_st = '攴'; // \¦ÍÍ if ($aThread->resrange['start'] == $aThread->resrange['to']) { @@ -504,16 +506,16 @@ } $read_range_ht = "{$read_range_on}/{$aThread->rescount}"; - $read_footer_navi_new = "<a href=\"{$_conf['read_php']}?host={$aThread->host}{$bbs_q}{$key_q}&ls={$aThread->rescount}-&nt={$newtime}{$_conf['k_at_a']}#r{$aThread->rescount}\" target=\"_blank\">V Ú½Ì\¦</a>"; + $read_footer_navi_new = "<a href=\"{$_conf['read_php']}?{$host_bbs_key_q}&ls={$aThread->rescount}-&nt={$newtime}{$_conf['k_at_a']}#r{$aThread->rescount}\" target=\"_blank\">V Ú½Ì\¦</a>"; /* if (!empty($_conf['disable_res'])) { $dores_ht = <<<EOP -<a href="{$motothre_url}" target="_blank">攴</a> +<a href="{$motothre_url}" target="_blank">{$dores_st}</a> EOP; } else { $dores_ht = <<<EOP -<a href="post_form.php?host={$aThread->host}{$bbs_q}{$key_q}&rescount={$aThread->rescount}{$ttitle_en_q}{$_conf['k_at_a']}">攴</a> +<a href="post_form.php?{$host_bbs_key_q}&rescount={$aThread->rescount}{$ttitle_en_q}{$_conf['k_at_a']}">{$dores_st}</a> EOP; } */ @@ -521,7 +523,7 @@ // c[o[ªHTML ======= if ($spmode) { $toolbar_itaj_ht = <<<EOP - (<a href="{$_conf['subject_php']}?host={$aThread->host}{$bbs_q}{$key_q}{$_conf['k_at_a']}" target="_blank">{$itaj_hd}</a>) + (<a href="{$_conf['subject_php']}?{$host_bbs_key_q}{$_conf['k_at_a']}" target="_blank">{$itaj_hd}</a>) EOP; } else { $toolbar_itaj_ht = ''; @@ -529,8 +531,8 @@ /* $toolbar_right_ht .= <<<EOTOOLBAR -<a href="info.php?host={$aThread->host}{$bbs_q}{$key_q}{$ttitle_en_q}{$_conf['k_at_a']}">{$info_st}</a> -<a href="info.php?host={$aThread->host}{$bbs_q}{$key_q}{$ttitle_en_q}&dele=true{$_conf['k_at_a']}">{$delete_st}</a> +<a href="info.php?{$host_bbs_key_q}{$ttitle_en_q}{$_conf['k_at_a']}">{$info_st}</a> +<a href="info.php?{$host_bbs_key_q}{$ttitle_en_q}&dele=true{$_conf['k_at_a']}">{$delete_st}</a> <a href="{$motothre_url}" target="_blank">³½Ú</a>\n EOTOOLBAR; */ @@ -538,10 +540,10 @@ $read_footer_ht = <<<EOP <div id="ntt_bt{$newthre_num}" name="ntt_bt{$newthre_num}" class="read_new_toolbar"> {$read_range_ht} -<a class="button" href="info.php?host={$aThread->host}{$bbs_q}{$key_q}{$ttitle_en_q}{$_conf['k_at_a']}" target="_blank">{$info_st}</a> -<a class="button" href="spm_k.php?host={$aThread->host}{$bbs_q}{$key_q}&ls={$aThread->ls}&spm_default={$aThread->resrange['to']}&from_read_new=1{$_conf['k_at_a']}" target="_blank">Á</a> +<a class="button" href="info.php?{$host_bbs_key_q}{$ttitle_en_q}{$_conf['k_at_a']}" target="_blank">{$info_st}</a> +<a class="button" href="spm_k.php?{$host_bbs_key_q}&ls={$aThread->ls}&spm_default={$aThread->resrange['to']}&from_read_new=1{$_conf['k_at_a']}" target="_blank">Á</a> <br> -<a href="{$_conf['read_php']}?host={$aThread->host}{$bbs_q}{$key_q}&offline=1&rescount={$aThread->rescount}{$_conf['k_at_a']}#r{$aThread->rescount}" target="_blank">{$aThread->ttitle_hd}</a>{$toolbar_itaj_ht} +<a href="{$_conf['read_php']}?{$host_bbs_key_q}&offline=1&rescount={$aThread->rescount}{$_conf['k_at_a']}#r{$aThread->rescount}" target="_blank">{$aThread->ttitle_hd}</a>{$toolbar_itaj_ht} <a class="button" href="#ntt{$newthre_num}">£</a> </div> <hr>\n @@ -617,7 +619,9 @@ if ($_conf['iphone']) { // ImageCache2 if ($_conf['expack.ic2.enabled']) { - require_once P2EX_LIB_DIR . '/ic2/loadconfig.inc.php'; + if (!function_exists('ic2_loadconfig')) { + include P2EX_LIB_DIR . '/ic2/bootstrap.php'; + } $ic2conf = ic2_loadconfig(); if ($ic2conf['Thumb1']['width'] > 80) { include P2EX_LIB_DIR . '/ic2/templates/info-v.tpl.html'; Modified: p2ex/trunk/style/style_css.inc =================================================================== --- p2ex/trunk/style/style_css.inc 2010-01-13 00:37:02 UTC (rev 772) +++ p2ex/trunk/style/style_css.inc 2010-01-13 04:36:03 UTC (rev 773) @@ -95,6 +95,50 @@ EOSTYLE; +// {{{ Äp|bvAbvƳXN|bvAbv (X|bvAbv̬p) + +if (!isset($STYLE['respop_bgcolor'])) { $STYLE['respop_bgcolor'] = '#ffffcc'; } +if (!isset($STYLE['respop_background'])) { $STYLE['respop_background'] = ''; } +$respop_background = "background:{$STYLE['respop_bgcolor']} {$STYLE['respop_background']};"; + +if (!isset($STYLE['respop_b_style'])) { $STYLE['respop_b_style'] = 'solid'; } +if (!isset($STYLE['respop_b_width'])) { $STYLE['respop_b_width'] = '1px'; } +if (!isset($STYLE['respop_b_color'])) { $STYLE['respop_b_color'] = 'black'; } +$respop_border = "border:{$STYLE['respop_b_style']} {$STYLE['respop_b_width']} {$STYLE['respop_b_color']};"; + +$respop_color = ''; +if (isset($STYLE['respop_color']) && strlen($STYLE['respop_color']) > 0) { + $respop_color = "color:{$STYLE['respop_color']};"; +} + + echo <<<EOSTYLE + +.popup_element { + position: absolute; + visibility: hidden; /* iÍBµÄ¨*/ + {$respop_background} + {$respop_border} + {$respop_color} + font-size:{$STYLE['respop_fontsize']}; + margin: 0; + padding: 8px; +} + +div#motols { + padding: 1px 2px; +} + +div#motols a { + display: block; + margin: 0; + padding: 3px; + line-height: 100%; +} + +EOSTYLE; + +// }}} + // X^CÌã« if (isset($MYSTYLE) && is_array($MYSTYLE)) { require_once P2_STYLE_DIR . '/mystyle_css.php'; Modified: p2ex/trunk/style/subject_css.inc =================================================================== --- p2ex/trunk/style/subject_css.inc 2010-01-13 00:37:02 UTC (rev 772) +++ p2ex/trunk/style/subject_css.inc 2010-01-13 04:36:03 UTC (rev 773) @@ -183,6 +183,9 @@ {$thre_title_underline_css} +/* ³XN */ +a.moto_thre { margin-right: 0.5em; } + /* XêÌÔ */ a.info { color: {$STYLE['sb_order_color']}; } a.info:hover { color: {$STYLE['sb_tacolor_h']}; }