svnno****@sourc*****
svnno****@sourc*****
2011年 1月 16日 (日) 16:42:18 JST
Revision: 901 http://sourceforge.jp/projects/p2-php/svn/view?view=rev&revision=901 Author: akid Date: 2011-01-16 16:42:18 +0900 (Sun, 16 Jan 2011) Log Message: ----------- p2/ be.2ch.netã®ä»æ§å¤æ´ã«å¯¾å¿ããã æºå¸¯ã¨iPhoneã§ãæ°çã¾ã¨ãèªã¿ã®æ°çã¬ã¹ããªãã£ãæãååãã£ãã·ã¥ã¸ã®ãªã³ã¯ã表示ããããã«ããã Modified Paths: -------------- p2/trunk/conf/conf_user_def.inc.php p2/trunk/edit_conf_user.php p2/trunk/edit_conf_user_i.php p2/trunk/editpref.php p2/trunk/editpref_i.php p2/trunk/iphone/post_options_loader_popup.inc.php p2/trunk/lib/BbsMap.php p2/trunk/lib/P2Util.php p2/trunk/lib/P2View.php p2/trunk/lib/ThreadRead.php p2/trunk/lib/login_first.inc.php p2/trunk/lib/post_options_loader.inc.php p2/trunk/login.php p2/trunk/post.php p2/trunk/read_new.php p2/trunk/read_new_i.php p2/trunk/read_new_k.php p2/trunk/style/login_css.inc Added Paths: ----------- p2/trunk/lib/edit_conf_user.funcs.php -------------- next part -------------- Modified: p2/trunk/conf/conf_user_def.inc.php =================================================================== --- p2/trunk/conf/conf_user_def.inc.php 2011-01-10 14:49:28 UTC (rev 900) +++ p2/trunk/conf/conf_user_def.inc.php 2011-01-16 07:42:18 UTC (rev 901) @@ -16,6 +16,13 @@ // be.2ch.netÌo^[AhX $conf_user_def['be_2ch_mail'] = ""; // ("") +// be.2ch.netÌo^pX[h +$conf_user_def['be_2ch_password'] = ""; // ("") + +// be.2ch.net DMDM MDMD è®wè +//$conf_user_def['be_2ch_DMDM'] = ""; // ("") +//$conf_user_def['be_2ch_MDMD'] = ""; // ("") + // }}} // {{{ ¡PATH Modified: p2/trunk/edit_conf_user.php =================================================================== --- p2/trunk/edit_conf_user.php 2011-01-10 14:49:28 UTC (rev 900) +++ p2/trunk/edit_conf_user.php 2011-01-16 07:42:18 UTC (rev 901) @@ -1,11 +1,15 @@ <?php /* p2 - [UÝèÒWUI + + ¦±ÌXNvgÈOÅàÝè³êé[UÝèlª êÎA + »Ìkeyð_getConfSave()àÌ$remain_keysÉo^µÄ¨B */ require_once './conf/conf.inc.php'; require_once P2_LIB_DIR . '/DataPhp.php'; +require_once P2_LIB_DIR . '/edit_conf_user.funcs.php'; $_login->authorize(); // [UFØ @@ -30,28 +34,14 @@ $_POST['conf_edit'] = array_map('trim', $_POST['conf_edit']); // IðÉÈ¢àÌ ¨ ftHg¸³ - notSelToDef(); + _notSelToDef(); // [ðKp·é - applyRules(); + _applyRules(); - /** - * ftHgl $conf_user_def ÆÏXl $_POST['conf_edit'] ̼ûª¶ÝµÄ¢ÄA - * ftHglÆÏXlªÙÈéêÌÝÝèÛ¶·éi»Ì¼Ìf[^ÍÛ¶³ê¸Ajü³êéj - */ - $conf_save = array(); - foreach ($conf_user_def as $k => $v) { - if (isset($conf_user_def[$k]) && isset($_POST['conf_edit'][$k])) { - if ($conf_user_def[$k] != $_POST['conf_edit'][$k]) { - $conf_save[$k] = $_POST['conf_edit'][$k]; - } - - // ÁÊÈÚiedit_conf_user.php ÈOÅàÝè³ê¤éàÌÍjü¹¸É»ÌÜÜc·j - // L[ɽ¼K¥iprefixjð¯½ûª¢¢©à ¨ L[¼ÏXÌKvª éÌÅÐÆܸۯ - } elseif (in_array($k, array('k_use_aas', 'maru_kakiko', 'index_menu_k', 'index_menu_k_from1'))) { - $conf_save[$k] = $_conf[$k]; - } - } + // ftHgl $conf_user_def ÆÏXl $_POST['conf_edit'] ̼ûª¶ÝµÄ¢ÄA + // ftHglÆÏXlªÙÈéêÌÝÝèÛ¶·éi»Ì¼Ìf[^ÍÛ¶³ê¸Ajü³êéj + $conf_save = _getConfSave(); // VACYµÄÛ¶ FileCtl::make_datafile($_conf['conf_user_file'], $_conf['conf_user_perm']); @@ -62,8 +52,7 @@ } else { P2Util::pushInfoHtml("<p>ÝèðXVÛ¶µÜµ½</p>"); // ÏXª êÎAàf[^àXVµÄ¨ - $_conf = array_merge($_conf, $conf_user_def); - $_conf = array_merge($_conf, $conf_save); + $_conf = array_merge($_conf, $conf_user_def, $conf_save); } // }}} @@ -79,6 +68,13 @@ // }}} +/* +// beÌFØmF +if (false === P2Util::getBe2chCodeWithUserConf()) { + P2Util::pushInfoHtml('<p>~ b2.2ch.netÌAJEgðmFūܹñŵ½Bo^[AhX©pX[hª³µÈ¢æ¤Å·B</p>'); +} +*/ + //===================================================================== // vgÝè //===================================================================== @@ -165,9 +161,13 @@ echo getGroupSepaHtml('be.2ch.net AJEg'); -echo getEditConfHtml('be_2ch_code', '<a href="http://be.2ch.net/" target="_blank">be.2ch.net</a>ÌFØR[h(<a href="http://be.2ch.net/test/editprof.php" target="_blank">FØR[hÌmF</a>)'); -echo getEditConfHtml('be_2ch_mail', 'be.2ch.netÌo^[AhX'); +//echo getEditConfHtml('be_2ch_code', '<a href="http://be.2ch.net/" target="_blank">be.2ch.net</a>ÌFØR[h(<a href="http://be.2ch.net/test/editprof.php" target="_blank">FØR[hÌmF</a>)'); +echo getEditConfHtml('be_2ch_mail', 'be.2ch.netÌo^[AhX(<a href="http://be.2ch.net/test/login.php" target="_blank">BeOC</a>)'); +echo getEditConfHtml('be_2ch_password', 'be.2ch.netÌo^pX[h(<a href="http://be.2ch.net/test/pass.php" target="_blank">pX[hÌmF</a>)'); +//echo getEditConfHtml('be_2ch_DMDM', '<a href="http://be.2ch.net/" target="_blank">be.2ch.net</a> DMDM è®wè'); +//echo getEditConfHtml('be_2ch_MDMD', 'be.2ch.net MDMD è®wè'); + echo getGroupSepaHtml('PATH'); //echo getEditConfHtml('first_page', 'EºªÉÅÉ\¦³êéy[WBICURLàÂB'); @@ -189,6 +189,7 @@ echo getEditConfHtml('sb_show_motothre', 'XbhêÅ¢æ¾XÉεijXÖÌNiEjð\¦'); echo getEditConfHtml('sb_show_one', 'PC{AXbhêiÂ\¦jÅ>>1ð\¦'); echo getEditConfHtml('k_sb_show_first', 'gÑÌXbhêiÂ\¦j©çßÄÌXðJÌ\¦û@'); + echo getEditConfHtml('sb_show_spd', 'XbhêÅ·Îâ³iXÔujð\¦'); echo getEditConfHtml('sb_show_ikioi', 'XbhêŨ¢i1ú ½èÌXjð\¦'); echo getEditConfHtml('sb_show_fav', 'XbhêŨCÉX}[Nð\¦'); @@ -220,7 +221,6 @@ echo getEditConfHtml('bottom_res_form', 'XbhºÉ«ÝtH[ð\¦'); echo getEditConfHtml('quote_res_view', 'øpXði|bvAbvj\¦'); - echo getEditConfHtml('enable_headbar', 'PC wbho[ð\¦'); echo getEditConfHtml('enable_spm', 'XÔ©çX}[g|bvAbvj [(SPM)ð\¦'); //echo getEditConfHtml('spm_kokores', 'X}[g|bvAbvj [Åu±êÉXvð\¦'); @@ -238,7 +238,9 @@ echo getEditConfHtml('k_motothre_external', 'gÑ{A³XURLÌJX^}CYwèðOÂÅàLøÉ·é'); echo getEditConfHtml('k_bbs_noname_name', 'gÑ{AftHg̼³µ¼ð\¦'); + echo getEditConfHtml('k_clip_unique_id', 'gÑ{Ad¡µÈ¢IDÍöÌÝÌȪ\¦'); + echo getEditConfHtml('k_date_zerosuppress', 'gÑ{AútÌ0ðȪ\¦'); echo getEditConfHtml('k_clip_time_sec', 'gÑ{AÌbðȪ\¦'); echo getEditConfHtml('mobile.id_underline', 'gÑ{AIDöÌ"O"iI[jɺüðÇÁ'); @@ -305,27 +307,6 @@ //===================================================================== // Ö i±Ìt@CàÅÌÝpj //===================================================================== -/** - * [Ýèi$conf_user_rulesjÉîâÄAtB^iftHgZbgjðs¤ - * 2007/10/10 $conf_user_rules Í $conf_user_filters Éü¼µ½¢ - * - * @return void - */ -function applyRules() -{ - global $conf_user_rules, $conf_user_def; - - if (is_array($conf_user_rules)) { - foreach ($conf_user_rules as $k => $v) { - if (isset($_POST['conf_edit'][$k])) { - $def = isset($conf_user_def[$k]) ? $conf_user_def[$k] : null; - foreach ($v as $func) { - $_POST['conf_edit'][$k] = call_user_func($func, $_POST['conf_edit'][$k], $def); - } - } - } - } -} // emptyToDef() ÈÇÌtB^ÍEditConfFiterNXÈÇÉÜÆßé\è @@ -388,26 +369,6 @@ } /** - * IðÉÈ¢lÍftHgZbg·é - */ -function notSelToDef() -{ - global $conf_user_def, $conf_user_sel; - - $names = array_keys($conf_user_sel); - - if (is_array($names)) { - foreach ($names as $n) { - if (isset($_POST['conf_edit'][$n])) { - if (!array_key_exists($_POST['conf_edit'][$n], $conf_user_sel[$n])) { - $_POST['conf_edit'][$n] = $conf_user_def[$n]; - } - } - } - } -} - -/** * O[vª¯pÌHTMLð¾éiÖàÅPCAgÑp\¦ðU誯j * * @return string @@ -417,7 +378,7 @@ global $_conf; // PCp - if (empty($_conf['ktai'])) { + if (UA::isPC()) { $ht = <<<EOP <tr class="group"> <td colspan="4"><h4 style="display:inline;">{$title}</h4></td> @@ -446,7 +407,7 @@ } // gÑÅÍÒW\¦µÈ¢Ú - if ($_conf['ktai']) { + if (UA::isK()) { $noKtais = array( 'enable_headbar', 'enable_spm', 'spm_kokores', 'frame_menu_width', 'frame_subject_width', 'frame_read_width' @@ -461,7 +422,7 @@ $name_view_hs = hs($_conf[$name]); - if (empty($_conf['ktai'])) { + if (UA::isPC()) { $input_size_at = ' size="38"'; } else { $input_size_at = ''; @@ -475,8 +436,12 @@ // input üÍ®Èç } else { + $type = 'text'; + if (strstr($name, 'password')) { + $type = 'password'; + } $form_ht = <<<EOP -<input type="text" name="conf_edit[{$name}]" value="{$name_view_hs}"{$input_size_at}>\n +<input type="${type}" name="conf_edit[{$name}]" value="{$name_view_hs}"{$input_size_at}>\n EOP; $def_views[$name] = htmlspecialchars($conf_user_def[$name], ENT_QUOTES); } Modified: p2/trunk/edit_conf_user_i.php =================================================================== --- p2/trunk/edit_conf_user_i.php 2011-01-10 14:49:28 UTC (rev 900) +++ p2/trunk/edit_conf_user_i.php 2011-01-16 07:42:18 UTC (rev 901) @@ -1,12 +1,16 @@ <?php /* p2 - [UÝèÒWUI + + ¦±ÌXNvgÈOÅàÝè³êé[UÝèlª êÎA + »Ìkeyð_getConfSave()àÌ$remain_keysÉo^µÄ¨B */ /* 2008/7/25 iPhonepÉJX^}CY*/ require_once './conf/conf.inc.php'; require_once P2_LIB_DIR . '/DataPhp.php'; +require_once P2_LIB_DIR . '/edit_conf_user.funcs.php'; $_login->authorize(); // [UFØ @@ -31,28 +35,16 @@ $_POST['conf_edit'] = array_map('trim', $_POST['conf_edit']); // IðÉÈ¢àÌ ¨ ftHg¸³ - notSelToDef(); + _notSelToDef(); // [ðKp·é - applyRules(); + _applyRules(); /** * ftHgl $conf_user_def ÆÏXl $_POST['conf_edit'] ̼ûª¶ÝµÄ¢ÄA * ftHglÆÏXlªÙÈéêÌÝÝèÛ¶·éi»Ì¼Ìf[^ÍÛ¶³ê¸Ajü³êéj */ - $conf_save = array(); - foreach ($conf_user_def as $k => $v) { - if (isset($conf_user_def[$k]) && isset($_POST['conf_edit'][$k])) { - if ($conf_user_def[$k] != $_POST['conf_edit'][$k]) { - $conf_save[$k] = $_POST['conf_edit'][$k]; - } - - // ÁÊÈÚiedit_conf_user.php ÈOÅàÝè³ê¤éàÌÍjü¹¸É»ÌÜÜc·j - // L[ɽ¼K¥iprefixjð¯½ûª¢¢©à ¨ L[¼ÏXÌKvª éÌÅpº - } elseif (in_array($k, array('k_use_aas', 'maru_kakiko', 'index_menu_k', 'index_menu_k_from1'))) { - $conf_save[$k] = $_conf[$k]; - } - } + $conf_save = _getConfSave(); // VACYµÄÛ¶ FileCtl::make_datafile($_conf['conf_user_file'], $_conf['conf_user_perm']); @@ -80,6 +72,13 @@ // }}} +/* +// beÌFØmF +if (false === P2Util::getBe2chCodeWithUserConf()) { + P2Util::pushInfoHtml('<p>~ b2.2ch.netÌAJEgðmFūܹñŵ½Bo^[AhX©pX[hª³µÈ¢æ¤Å·B</p>'); +} +*/ + //===================================================================== // vgÝè //===================================================================== @@ -132,9 +131,13 @@ echo getGroupSepaHtml('be.2ch.net AJEg'); -echo getEditConfHtml('be_2ch_code', '<a href="http://be.2ch.net/" target="_blank">be.2ch.net</a>ÌFØR[h(pX[hÅÍ èܹñ)'); -echo getEditConfHtml('be_2ch_mail', 'be.2ch.netÌo^[AhX'); +//echo getEditConfHtml('be_2ch_code', '<a href="http://be.2ch.net/" target="_blank">be.2ch.net</a>ÌFØR[h(pX[hÅÍ èܹñ)'); +echo getEditConfHtml('be_2ch_mail', 'be.2ch.netÌo^[AhX(<a href="http://be.2ch.net/test/login.php" target="_blank">BeOC</a>)'); +echo getEditConfHtml('be_2ch_password', 'be.2ch.netÌo^pX[h(<a href="http://be.2ch.net/test/pass.php" target="_blank">pX[hÌmF</a>)'); +//echo getEditConfHtml('be_2ch_DMDM', '<a href="http://be.2ch.net/" target="_blank">be.2ch.net</a> DMDM è®wè'); +//echo getEditConfHtml('be_2ch_MDMD', 'be.2ch.net MDMD è®wè'); + echo getGroupSepaHtml('PATH'); //echo getEditConfHtml('first_page', 'EºªÉÅÉ\¦³êéy[WBICURLàÂB'); @@ -263,26 +266,6 @@ //===================================================================== // Ö i±Ìt@CàÅÌÝpj //===================================================================== -/** - * [Ýèi$conf_user_rulesjÉîâÄAtB^iftHgZbgjðs¤ - * - * @return void - */ -function applyRules() -{ - global $conf_user_rules, $conf_user_def; - - if (is_array($conf_user_rules)) { - foreach ($conf_user_rules as $k => $v) { - if (isset($_POST['conf_edit'][$k])) { - $def = isset($conf_user_def[$k]) ? $conf_user_def[$k] : null; - foreach ($v as $func) { - $_POST['conf_edit'][$k] = call_user_func($func, $_POST['conf_edit'][$k], $def); - } - } - } - } -} // emptyToDef() ÈÇÌtB^ÍEditConfFiterNXÈÇÉÜÆßé\è @@ -345,26 +328,6 @@ } /** - * IðÉÈ¢lÍftHgZbg·é - */ -function notSelToDef() -{ - global $conf_user_def, $conf_user_sel; - - $names = array_keys($conf_user_sel); - - if (is_array($names)) { - foreach ($names as $n) { - if (isset($_POST['conf_edit'][$n])) { - if (!array_key_exists($_POST['conf_edit'][$n], $conf_user_sel[$n])) { - $_POST['conf_edit'][$n] = $conf_user_def[$n]; - } - } - } - } -} - -/** * O[vª¯pÌHTMLð¾éiÖàÅPCAgÑp\¦ðU誯j * * @return string @@ -393,7 +356,7 @@ } // gÑÅÍÒW\¦µÈ¢Ú - if ($_conf['ktai']) { + if (UA::isK()) { $noKtais = array( 'enable_headbar', 'enable_spm', 'spm_kokores', 'frame_menu_width', 'frame_subject_width', 'frame_read_width' @@ -408,7 +371,7 @@ $name_view_hs = hs($_conf[$name]); - if (!$_conf['ktai']) { + if (UA::isPC()) { $input_size_at = ' size="38"'; } else { $input_size_at = ''; @@ -419,10 +382,15 @@ $form_ht = getEditConfSelHtml($name); $key = $conf_user_def[$name]; $def_views[$name] = htmlspecialchars($conf_user_sel[$name][$key], ENT_QUOTES); + // input üÍ®Èç } else { + $type = 'text'; + if (strstr($name, 'password')) { + $type = 'password'; + } $form_ht = <<<EOP -<input type="text" name="conf_edit[{$name}]" value="{$name_view_hs}"{$input_size_at}>\n +<input type="{$type}" name="conf_edit[{$name}]" value="{$name_view_hs}"{$input_size_at}>\n EOP; $def_views[$name] = htmlspecialchars($conf_user_def[$name], ENT_QUOTES); } Modified: p2/trunk/editpref.php =================================================================== --- p2/trunk/editpref.php 2011-01-10 14:49:28 UTC (rev 900) +++ p2/trunk/editpref.php 2011-01-16 07:42:18 UTC (rev 901) @@ -147,7 +147,7 @@ <?php // gÑp\¦ -if ($_conf['ktai']) { +if (UA::isK()) { echo $hr; } @@ -266,12 +266,14 @@ } // V ÜÆßÇÝÌLbV NHTMLð\¦·é -_printMatomeCacheLinksHtml(); +echo P2View::getMatomeCacheLinksHtml(); +if (UA::isK()) { + echo $hr; +} - // PC - zXg̯ú HTMLð\¦ -if (!$_conf['ktai']) { +if (UA::isPC()) { $sync_htm = <<<EOP <table><tr><td> @@ -646,44 +648,6 @@ exit; } -/** - * V ÜÆßÇÝÌLbV NHTMLð\¦·é - * - * @return void - */ -function _printMatomeCacheLinksHtml() -{ - global $_conf; - - $max = $_conf['matome_cache_max']; - $links = array(); - for ($i = 0; $i <= $max; $i++) { - $dnum = $i ? '.' . $i : ''; - $file = $_conf['matome_cache_path'] . $dnum . $_conf['matome_cache_ext']; - //echo '<!-- ' . $file . ' -->'; - if (file_exists($file)) { - $filemtime = filemtime($file); - $date = date('Y/m/d G:i:s', $filemtime); - $b = filesize($file) / 1024; - $kb = round($b, 0); - $atag = P2View::tagA( - UriUtil::buildQueryUri('read_new.php', array('cview' => '1', 'cnum' => "$i", 'filemtime' => $filemtime)), - hs($date), - array('target' => 'read') - ); - $links[] = sprintf('%s %dKB', $atag, $kb); - } - } - if ($links) { - echo '<p>V ÜÆßÇÝÌOñLbV ð\¦<br>' . implode('<br>', $links) . '</p>' . "\n"; - - if ($_conf['ktai']) { - $hr = P2View::getHrHtmlK(); - echo $hr . "\n"; - } - } -} - /* * Local Variables: * mode: php Modified: p2/trunk/editpref_i.php =================================================================== --- p2/trunk/editpref_i.php 2011-01-10 14:49:28 UTC (rev 900) +++ p2/trunk/editpref_i.php 2011-01-16 07:42:18 UTC (rev 901) @@ -164,24 +164,10 @@ // }}} -/*/ V ÜÆßÇÝÌLbV NHTMLð\¦·é -echo <<<EOP -<ul><li class="group">V ÜÆß</li></ul> -<div id="usage" class="panel"> -<h2>OñLbV \¦</h2> -<filedset> -EOP; +// V ÜÆßÇÝÌLbV NHTMLð\¦·é +echo P2View::getMatomeCacheLinksHtml(); -printMatomeCacheLinksHtml(); -echo <<<EOP -</filedset> -</div> -EOP; -*/ -_printMatomeCacheLinksHtml(); - - // PC - zXg̯ú HTMLð\¦ $sync_htm = "<ul><li class=\"group\">zXg̯ú</li></ul>\n<div id=\"usage\" class=\"panel\"><felidset>2chÌÂÚ]ÉεܷB<br>ÊíÍ©®ÅsíêéÌÅA±ÌìÍÁÉKv èܹñj\n"; $exist_sync_flag = false; @@ -373,40 +359,6 @@ return $ht; } -/** - * V ÜÆßÇÝÌLbV NHTMLð\¦·é - * - * @return void - */ -function _printMatomeCacheLinksHtml() -{ - global $_conf; - - $max = $_conf['matome_cache_max']; - $links = array(); - for ($i = 0; $i <= $max; $i++) { - $dnum = $i ? '.' . $i : ''; - $file = $_conf['matome_cache_path'] . $dnum . $_conf['matome_cache_ext']; - //echo '<!-- ' . $file . ' -->'; - if (file_exists($file)) { - $filemtime = filemtime($file); - $date = date('Y/m/d G:i:s', $filemtime); - $b = filesize($file) / 1024; - $kb = round($b, 0); - $atag = P2View::tagA( - UriUtil::buildQueryUri('read_new.php', array('cview' => '1', 'cnum' => "$i", 'filemtime' => $filemtime)), - hs($date), - array('target' => 'read') - ); - $links[] = sprintf('%s %dKB', $atag, $kb); - } - } - if ($links) { - echo '<ul><li class="group">V ÜÆßÇÝÌOñLbV </li></ul><div id="usage" class="panel"><filedset>' . implode('<br>', $links) .'</fildset></div>'. "\n"; - - } -} - /* * Local Variables: * mode: php Modified: p2/trunk/iphone/post_options_loader_popup.inc.php =================================================================== --- p2/trunk/iphone/post_options_loader_popup.inc.php 2011-01-10 14:49:28 UTC (rev 900) +++ p2/trunk/iphone/post_options_loader_popup.inc.php 2011-01-16 07:42:18 UTC (rev 901) @@ -70,7 +70,7 @@ // Be«Ý $htm['be2ch'] = ''; -if (P2Util::isHost2chs($host) and $_conf['be_2ch_code'] && $_conf['be_2ch_mail']) { +if (P2Util::isHost2chs($host) and P2Util::enableBe2ch()) { $htm['be2ch'] = '<input id="submit_beres" type="submit" name="submit_beres" value="BEÅ«Þ" onClick="setHiddenValue(this); popUpFootbarFormIPhone(1, 1);"><br>'; } @@ -79,7 +79,7 @@ if (P2Util::isBbsBe2chNet($host, $bbs)) { // âÁÏè³øɵȢB«Ý¸sÉA2ch¤ÅBeOCÖÌU±ª éÌÅB //$res_disabled_at = ' disabled'; - if ($_conf['be_2ch_code'] && $_conf['be_2ch_mail']) { + if (P2Util::enableBe2ch()) { $htm['title_need_be'] = ' title="BeÂÉ«A©®Be«ÝµÜ·"'; } else { $htm['title_need_be'] = ' title="«ÞÉÍBeOCªKvÅ·"'; Modified: p2/trunk/lib/BbsMap.php =================================================================== --- p2/trunk/lib/BbsMap.php 2011-01-10 14:49:28 UTC (rev 900) +++ p2/trunk/lib/BbsMap.php 2011-01-16 07:42:18 UTC (rev 901) @@ -339,7 +339,7 @@ } $req = new HTTP_Request($bbsmenu_url, $params); $req->setMethod('GET'); - $err = $req->sendRequest(true); + $err = $req->sendRequest(true); // $saveBody = true // G[ðØ if (PEAR::isError($err)) { Modified: p2/trunk/lib/P2Util.php =================================================================== --- p2/trunk/lib/P2Util.php 2011-01-10 14:49:28 UTC (rev 900) +++ p2/trunk/lib/P2Util.php 2011-01-16 07:42:18 UTC (rev 901) @@ -9,6 +9,180 @@ */ class P2Util { + /** + * @access public + * @return boolean + */ + function enableBe2ch() + { + global $_conf; + + if ( + strlen($_conf['be_2ch_password']) && $_conf['be_2ch_mail'] + //|| isset($_COOKIE['DMDM']) && isset($_COOKIE['MDMD']) + ) { + return true; + } + return false; + } + + /** + * [U[Ýèµ½AJEgÅAbe.2ch.netÉOCµÄDMDM, MDMDðæ¾·é + * iFØR[hÍurlencode³ê½ÜÜÌóÔj + * + * @access public + * @return array|false|null FØR[hzñ|FØÅ«È©Á½|³Ýè¾Á½ + */ + function getBe2chCodeWithUserConf() + { + global $_conf; + + if ($_conf['be_2ch_mail'] && strlen($_conf['be_2ch_password'])) { + $r = P2Util::getBe2chCodeByMailPass($_conf['be_2ch_mail'], $_conf['be_2ch_password']); + if (is_array($r)) { + return $r; + } + return false; + } + return null; + } + + /** + * be.2ch.netÉOCµÄDMDM, MDMDðæ¾·é + * iFØR[hÍurlencode³ê½ÜÜÌóÔj + * + * @access private + * @return array|string ¬÷|G[bZ[W + */ + function getBe2chCodeByMailPass($mail, $pass) + { + global $_conf; + + require_once 'HTTP/Request.php'; + + $params = array('timeout' => $_conf['fsockopen_time_limit']); + + if (!empty($GLOBALS['_conf']['proxy_use'])) { + $params['proxy_host'] = $GLOBALS['_conf']['proxy_host']; + $params['proxy_port'] = $GLOBALS['_conf']['proxy_port']; + } + + $req = new HTTP_Request('http://be.2ch.net/test/login.php', $params); + + $req->setMethod(HTTP_REQUEST_METHOD_POST); + $req->addPostData('m', $mail); + $be2chEncoding = 'eucJP-win'; + $req->addPostData('p', mb_convert_encoding($pass, $be2chEncoding, mb_internal_encoding())); + $req->addPostData('submit', mb_convert_encoding('o^', $be2chEncoding, mb_internal_encoding())); + + //var_dump($req); + // If-Modified-Since => gmdate('D, d M Y H:i:s', time()) . ' GMT'; + + /* + if ($headers) { + foreach ($headers as $k => $v) { + $req->addHeader($k, $v); + } + } + */ + + // 2011/01/11 ³ÛÍSet-CookieŻʷê΢¢ + // ÊÚÈÆ«Íus³ÈNGXgvÆ©upX[h©[AhXª³µÈ¢æ¤Å·BvªÔé + // ¬÷ + /* +<html><head> +<meta http-equiv="Content-Type" content="text/html; charset=EUC-JP" /> +<title>BeOC</title> +<script type="text/javascript"><!-- + +var exp = new Date(); +exp.setTime(exp.getTime() + 5 * 365 * 86400 * 1000); +exp = exp.toUTCString(); + +document.cookie = "DMDM=1127232; expires=" + exp + "; path=/; domain=.2ch.net"; +document.cookie = "MDMD=jy7MPa%2Bu0r7mScKRop3YBoPZ0HH6Is00; expires=" + exp + "; path=/; domain=.2ch.net"; + +//--></script> +</head><body> +OC®¹ +<hr />±¿ç©ç<a href="/">f¦Â</a>ÉüÁľ³¢B +</body></html> +*/ + $response = $req->sendRequest(); // $saveBody = true +//var_dump($req->getResponseHeader()); +//var_dump($req->getResponseCookies()); +//var_dump($req->getResponseCode()); +//var_dump(mb_convert_encoding($req->getResponseBody(), 'SJIS-win', 'eucJP-win')); + + if (PEAR::isError($response)) { + $error_msg = $response->getMessage(); + + } else { + $code = $req->getResponseCode(); + // ¬÷ÆÝÈ·R[h + if ($code == 200 || $code == 206) { + //return $req->getResponseBody(); + if ($cookies = $req->getResponseCookies()) { // urlencode³ê½óÔ + $r = array(); + foreach ($cookies as $cookie) { + if (in_array($cookie['name'], array('DMDM', 'MDMD'))) { + $r[$cookie['name']] = $cookie['value']; + } + } + if (!empty($r['DMDM']) && !empty($r['MDMD'])) { + return $r; + } + } + + //$error_msg = mb_convert_encoding($req->getResponseBody(), 'SJIS-win', 'eucJP-win'); + + /* + // XVªÈ¯êÎnullðÔ· + } elseif ($code == 304) { + // 304ÌÍA$req->getResponseBody() Íó¶""ÆÈé + return null; + */ + } else { + //var_dump($req->getResponseHeader()); + $error_msg = $code; + } + } + + return false; // $error_msg + } + + /** + * V ÜÆßÇÝÌLbV Nðæ¾·é + * + * @access private + * @return array + */ + function getMatomeCacheLinks() + { + global $_conf; + + $max = $_conf['matome_cache_max']; + $links = array(); + for ($i = 0; $i <= $max; $i++) { + $dnum = $i ? '.' . $i : ''; + $file = $_conf['matome_cache_path'] . $dnum . $_conf['matome_cache_ext']; + //echo '<!-- ' . $file . ' -->'; + if (file_exists($file)) { + $filemtime = filemtime($file); + $date = date('Y/m/d G:i:s', $filemtime); + $b = filesize($file) / 1024; + $kb = round($b, 0); + $atag = P2View::tagA( + UriUtil::buildQueryUri('read_new.php', array('cview' => '1', 'cnum' => "$i", 'filemtime' => $filemtime)), + hs($date), + array('target' => 'read') + ); + $links[] = sprintf('%s %dKB', $atag, $kb); + } + } + return $links; + } + // {{{ @deprecated 2010/01/26 function getMyHost() Modified: p2/trunk/lib/P2View.php =================================================================== --- p2/trunk/lib/P2View.php 2011-01-10 14:49:28 UTC (rev 900) +++ p2/trunk/lib/P2View.php 2011-01-16 07:42:18 UTC (rev 901) @@ -5,8 +5,27 @@ class P2View { /** - * 2008/09/28 $_conf['k_to_index_ht'] ãå»æ¢ãã¦ããã¡ããå©ç¨ãã + * V ÜÆßÇÝÌLbV NHTMLðÔ· * + * @return string HTML + */ + function getMatomeCacheLinksHtml() + { + $html = ''; + if ($links = P2Util::getMatomeCacheLinks()) { + if (UA::isIPhoneGroup()) { + $html .= '<ul><li class="group">V ÜÆßÇÝÌOñLbV </li></ul>'; + $html .= '<div id="usage" class="panel"><filedset>' . implode('<br>', $links) .'</fildset></div>'. "\n"; + } else { + $html .= '<p>V ÜÆßÇÝÌOñLbV ð\¦<br>' . implode('<br>', $links) . '</p>' . "\n"; + } + } + return $html; + } + + /** + * 2008/09/28 $_conf['k_to_index_ht'] ðp~µÄA±¿çðp·é + * * @static * @access public * @return string @@ -37,16 +56,16 @@ } /** - * HTMLã¿ã° <a href="$url">$html</a> ãçæãã + * HTML^O <a href="$url">$html</a> 𶬷é * * @static * @access public - * @param string $url èªå㧠htmlspecialchars() ãããã - * 2007/10/04 http_build_query() 㯠ã»ãã¬ã¼ã¿ã¨ã㦠arg_separator.output ã®è¨å®å¤ãåç §ãããã - * PHP5.1.2ããå¼æ°ã§æå®ã§ããããã«ãªã£ãã®ã§ãèªåã§htmlspecialchars()ããããããã«å¤æ´ããã - * PEARã®compatã®ã¯ãã¾ã 第ä¸å¼æ°ãåããªãããã ããï¼ - * @param string $html ãªã³ã¯æååãHTMLãæååã§ããã°æå㧠htmlspecialchars() ãã¦ãããã¨ã - * @param array $attr aè¦ç´ ã®è¿½å å±æ§ãèªå㧠htmlspecialchars() ããããããï¼keyã念ã®ããï¼ + * @param string $url ©®Å htmlspecialchars() ³êéB + * 2007/10/04 http_build_query() Í Zp[^ÆµÄ arg_separator.output ÌÝèlðQÆ·éªA + * PHP5.1.2©çøÅwèÅ«éæ¤ÉÈÁ½ÌÅA©®Åhtmlspecialchars()ð©¯éæ¤ÉÏXµ½B + * PEARÌcompatÌÍAܾæOøðæêȢ椾BBI + * @param string $html N¶ñâHTMLB¶ñÅ êÎè®Å htmlspecialchars() µÄ¨±ÆB + * @param array $attr avfÌÇÁ®«B©®Å htmlspecialchars() ª©¯çêéikeyàO̽ßj * @return string */ function tagA($url, $html = null, $attr = array()) @@ -69,7 +88,7 @@ /** * @static * @access public - * @return void HTMLã¿ã°åºå + * @return void HTML^OoÍ */ function printDoctypeTag() { @@ -141,7 +160,7 @@ /** * @static * @access public - * @return void HTMLåºå + * @return void HTMLoÍ */ function printIncludeCssHtml($css) { @@ -160,7 +179,7 @@ /** * @static * @access public - * @return void HTMLåºå + * @return void HTMLoÍ */ function printExtraHeadersHtml($frameset = false) { @@ -170,7 +189,7 @@ /** * @static * @access public - * @return void HTMLåºå + * @return void HTMLoÍ */ function printHeadMetasHtml($frameset = false) { @@ -185,7 +204,7 @@ ), ); /* - // çç¥ + // Ȫ if (UA::isPC() || UA::isIPhoneGroup()) { $metas[] = array( 'http-equiv' => 'Content-Style-Type', @@ -204,7 +223,7 @@ // <meta name="viewport" content="width=device-width, initial-scale=1.0"> // initial-scale=1.0, maximum-scale=1.0 - // initial-scale=1.0 ã¨ããã¨ã縦â横ã¨åããå¤ããæã«ãæ¡å¤§çã大ããç¶æ ã«ãªã£ã¦ãã¾ãã + // initial-scale=1.0 Æ·éÆAc¨¡Æü«ðϦ½ÉAg妪嫢óÔÉÈÁĵܤB $metas[] = array( 'name' => 'viewport', 'content' => 'width=device-width' @@ -227,10 +246,10 @@ } /** - * [todo] ä»ã¯ã¾ã 使ã£ã¦ããªãã$_conf['templateDir'] ã®è¨å®ããã¦ããã + * [todo] ¡ÍܾgÁĢȢB$_conf['templateDir'] ÌÝèðµÄ©çB * @static * @access public - * @return void HTMLåºå + * @return void HTMLoÍ */ function render($template, $params) { Modified: p2/trunk/lib/ThreadRead.php =================================================================== --- p2/trunk/lib/ThreadRead.php 2011-01-10 14:49:28 UTC (rev 900) +++ p2/trunk/lib/ThreadRead.php 2011-01-16 07:42:18 UTC (rev 901) @@ -347,7 +347,7 @@ } $req = new HTTP_Request($url, $params); $req->setMethod('GET'); - $err = $req->sendRequest(true); + $err = $req->sendRequest(true); // $saveBody = true if (PEAR::isError($err)) { //var_dump('error'); Added: p2/trunk/lib/edit_conf_user.funcs.php =================================================================== --- p2/trunk/lib/edit_conf_user.funcs.php (rev 0) +++ p2/trunk/lib/edit_conf_user.funcs.php 2011-01-16 07:42:18 UTC (rev 901) @@ -0,0 +1,74 @@ +<?php +//============================================================= +// edit_conf_user.php, edit_conf_user_i.php ÅÌÝp·éÖ +//============================================================= + +/** + * tHgl $conf_user_def ÆÏXl $_POST['conf_edit'] ̼ûª¶ÝµÄ¢ÄA + * ftHglÆÏXlªÙÈéêÌÝÝèÛ¶ÎÛÆÈéi»Ì¼Ìf[^ÍÛ¶³ê¸Ajü³êéj + * + * @return array + */ +function _getConfSave() +{ + global $_conf, $conf_user_def; + + // ¦ÁÊÈkeyiedit_conf_user.php ÈOÅàÝè³ê¤éàÌÍjü¹¸É»ÌÜÜc·j + // L[ɽ¼K¥iprefixjð¯½ûª¢¢©à ¨ L[¼ÏXÌKvª éÌÅÐÆܸۯ + $remain_keys = array('k_use_aas', 'maru_kakiko', 'index_menu_k', 'index_menu_k_from1'); + + $conf_save = array(); + foreach ($conf_user_def as $k => $v) { + if (isset($conf_user_def[$k]) && isset($_POST['conf_edit'][$k])) { + if ($conf_user_def[$k] != $_POST['conf_edit'][$k]) { + $conf_save[$k] = $_POST['conf_edit'][$k]; + } + + } elseif (in_array($k, $remain_keys)) { + $conf_save[$k] = $_conf[$k]; + } + } + return $conf_save; +} + +/** + * [Ýèi$conf_user_rulesjÉîâÄAtB^iftHgZbgjðs¤ + * 2007/10/10 $conf_user_rules Í $conf_user_filters Éü¼µ½¢ + * + * @return void + */ +function _applyRules() +{ + global $conf_user_rules, $conf_user_def; + + if (is_array($conf_user_rules)) { + foreach ($conf_user_rules as $k => $v) { + if (isset($_POST['conf_edit'][$k])) { + $def = isset($conf_user_def[$k]) ? $conf_user_def[$k] : null; + foreach ($v as $func) { + $_POST['conf_edit'][$k] = call_user_func($func, $_POST['conf_edit'][$k], $def); + } + } + } + } +} + +/** + * IðÉÈ¢lÍftHgZbg·é + */ +function _notSelToDef() +{ + global $conf_user_def, $conf_user_sel; + + $names = array_keys($conf_user_sel); + + if (is_array($names)) { + foreach ($names as $n) { + if (isset($_POST['conf_edit'][$n])) { + if (!array_key_exists($_POST['conf_edit'][$n], $conf_user_sel[$n])) { + $_POST['conf_edit'][$n] = $conf_user_def[$n]; + } + } + } + } +} \ No newline at end of file Modified: p2/trunk/lib/login_first.inc.php =================================================================== --- p2/trunk/lib/login_first.inc.php 2011-01-10 14:49:28 UTC (rev 900) +++ p2/trunk/lib/login_first.inc.php 2011-01-16 07:42:18 UTC (rev 901) @@ -112,8 +112,8 @@ $submit_ht = '<input type="submit" name="submit_newuser" value="VKo^">'; } - $login_form_ht = <<<EOP -{$docomo_utn_ht} + $login_form_ht = $docomo_utn_ht; + $login_form_ht .= <<<EOP <form id="login" method="POST" action="{$REQUEST_URI_hs}" target="_self" utn> {$_conf['k_input_ht']} {$p_str['user']}: <input type="text" name="form_login_id" value="{$form_login_id_hs}" istyle="3" size="32" autocorrect="off" autocapitalize="off"><br> @@ -243,6 +243,7 @@ if ($show_login_form_flag) { echo $login_form_ht; + if (empty($GLOBALS['brazil']) and !(HostCheck::isAddrLocal() || HostCheck::isAddrPrivate())) { ?><p> <font size="-1" color="gray">¦±Ìy[WÍvCx[gp̽ßÌVXeÅ·B<br> Modified: p2/trunk/lib/post_options_loader.inc.php =================================================================== --- p2/trunk/lib/post_options_loader.inc.php 2011-01-10 14:49:28 UTC (rev 900) +++ p2/trunk/lib/post_options_loader.inc.php 2011-01-16 07:42:18 UTC (rev 901) @@ -80,7 +80,7 @@ // Be«Ý $htm['be2ch'] = ''; -if (P2Util::isHost2chs($host) and $_conf['be_2ch_code'] && $_conf['be_2ch_mail']) { +if (P2Util::isHost2chs($host) and P2Util::enableBe2ch()) { $htm['be2ch'] = '<input id="submit_beres" type="submit" name="submit_beres" value="BEÅ«Þ" onClick="setHiddenValue(this);">'; } @@ -89,7 +89,7 @@ if (P2Util::isBbsBe2chNet($host, $bbs)) { // âÁÏè³øɵȢB«Ý¸sÉA2ch¤ÅBeOCÖÌU±ª éÌÅB //$res_disabled_at = ' disabled'; - if ($_conf['be_2ch_code'] && $_conf['be_2ch_mail']) { + if (P2Util::enableBe2ch()) { $htm['title_need_be'] = ' title="BeÂÉ«A©®Be«ÝµÜ·"'; } else { $htm['title_need_be'] = ' title="«ÞÉÍBeOCªKvÅ·"'; Modified: p2/trunk/login.php =================================================================== --- p2/trunk/login.php 2011-01-10 14:49:28 UTC (rev 900) +++ p2/trunk/login.php 2011-01-16 07:42:18 UTC (rev 901) @@ -230,12 +230,12 @@ P2Util::printInfoHtml(); ?> -<p id="login_status"> +<div id="login_status"> <?php eh($p_str['autho_user']) ?>: <?php eh($_login->user_u) ?><br> <?php echo $auth_ctl_html, $auth_cookie_html ?> <br> [<a href="./index.php?logout=1" target="_parent">rep2©ç<?php eh($p_str['logout']); ?>·é</a>] -</p> +</div> <?php // FØ[Uo^tH[ Modified: p2/trunk/post.php =================================================================== --- p2/trunk/post.php 2011-01-10 14:49:28 UTC (rev 900) +++ p2/trunk/post.php 2011-01-16 07:42:18 UTC (rev 901) @@ -685,21 +685,32 @@ } // be.2ch FØNbL[ + // Oc[(p2proxy)p if (isset($_POST['MDMD']) && isset($_POST['DMDM'])) { - // Oc[(p2proxy)p - $cookies_to_send .= sprintf(' MDMD=%s;', $_POST['MDMD']); - $cookies_to_send .= sprintf(' DMDM=%s;', $_POST['DMDM']); - // beÂÅÍ©®Be«ÝðÝé + $cookies_to_send .= sprintf(' MDMD=%s;', urlencode($_POST['MDMD'])); + $cookies_to_send .= sprintf(' DMDM=%s;', urlencode($_POST['DMDM'])); + + // be«ÝBbeÂÅÍ©®Be«ÝðÝéB } elseif (P2Util::isBbsBe2chNet($host, $bbs) || !empty($_REQUEST['submit_beres'])) { - $cookies_to_send .= sprintf(' MDMD=%s;', $_conf['be_2ch_code']); // be.2ch.netÌFØR[h - $cookies_to_send .= sprintf(' DMDM=%s;', $_conf['be_2ch_mail']); // be.2ch.netÌo^[AhX + /* + if ($_conf['be_2ch_DMDM'] && $_conf['be_2ch_MDMD']) { + $cookies_to_send .= sprintf(' DMDM=%s;', urlencode(urldecode($_conf['be_2ch_DMDM']))); + $cookies_to_send .= sprintf(' MDMD=%s;', urlencode(urldecode($_conf['be_2ch_MDMD']))); + } else { + */ + $ar = P2Util::getBe2chCodeWithUserConf(); // urlencode³ê½ÜÜÌóÔ + if (is_array($ar)) { + $cookies_to_send .= sprintf(' DMDM=%s;', $ar['DMDM']); + $cookies_to_send .= sprintf(' MDMD=%s;', $ar['MDMD']); + } + //} } - !$cookies_to_send and $cookies_to_send = ' ;'; + if ($cookies_to_send) { + $request .= 'Cookie:' . $cookies_to_send . "\r\n"; + //$request .= 'Cookie: PON='.$SPID.'; NAME='.$FROM.'; MAIL='.$mail."\r\n"; + } - $request .= 'Cookie:' . $cookies_to_send . "\r\n"; - //$request .= 'Cookie: PON='.$SPID.'; NAME='.$FROM.'; MAIL='.$mail."\r\n"; - $request .= 'Connection: Close' . "\r\n"; // {{{ POSTÌÍwb_ðÇÁµÄöÉURLGR[hµ½f[^ðYt Modified: p2/trunk/read_new.php =================================================================== --- p2/trunk/read_new.php 2011-01-10 14:49:28 UTC (rev 900) +++ p2/trunk/read_new.php 2011-01-16 07:42:18 UTC (rev 901) @@ -619,6 +619,9 @@ ?> <div id="ntt<?php eh($_newthre_num); ?>" align="center"> <?php echo $sb_ht; ?> Ì <?php echo $atag; ?> + <?php if (!empty($GLOBALS['_is_matome_shinchaku_naipo'])) { + printf('<div align="right">%s</div>', P2View::getMatomeCacheLinksHtml()); + } ?> </div> </body></html> Modified: p2/trunk/read_new_i.php =================================================================== --- p2/trunk/read_new_i.php 2011-01-10 14:49:28 UTC (rev 900) +++ p2/trunk/read_new_i.php 2011-01-16 07:42:18 UTC (rev 901) @@ -555,7 +555,8 @@ if (!$aThreadList->num) { $GLOBALS['_is_matome_shinchaku_naipo'] = true; - ?>V XÍÈ¢Û<?php + ?><br>V XÍÈ¢Û<br><br><?php + echo P2View::getMatomeCacheLinksHtml(); } $index_uri = UriUtil::buildQueryUri('index.php', array(UA::getQueryKey() => UA::getQueryValue())); Modified: p2/trunk/read_new_k.php =================================================================== --- p2/trunk/read_new_k.php 2011-01-10 14:49:28 UTC (rev 900) +++ p2/trunk/read_new_k.php 2011-01-16 07:42:18 UTC (rev 901) @@ -490,7 +490,15 @@ } ?> -<div><?php echo $ptitle_btm_atag; ?>Ì<?php echo $read_new_atag; ?></div> +<div> +<?php echo $ptitle_btm_atag; ?>Ì<?php echo $read_new_atag; ?> +<?php +if (!empty($GLOBALS['_is_matome_shinchaku_naipo'])) { + echo P2View::getHrHtmlK(); + echo P2View::getMatomeCacheLinksHtml(); +} +?> +</div> <?php echo $hr . P2View::getBackToIndexKATag(); ?> </body></html> Modified: p2/trunk/style/login_css.inc =================================================================== --- p2/trunk/style/login_css.inc 2011-01-10 14:49:28 UTC (rev 900) +++ p2/trunk/style/login_css.inc 2011-01-16 07:42:18 UTC (rev 901) @@ -12,7 +12,7 @@ border-bottom: solid 1px #ccc; } -p#login_status{ +div#login_status{ padding:8px 12px 8px 12px; }