svnno****@sourc*****
svnno****@sourc*****
2009年 12月 31日 (木) 22:39:08 JST
Revision: 753 http://sourceforge.jp/projects/p2-php/svn/view?view=rev&revision=753 Author: rsk Date: 2009-12-31 22:39:08 +0900 (Thu, 31 Dec 2009) Log Message: ----------- expack: - post.php ã®å ¬å¼p2ã使ã£ãæ¸ãè¾¼ã¿ã postIt2() é¢æ°ã«éç´ã - FileCtl::mkdir_r() ã¡ã½ããã追å ã Modified Paths: -------------- p2ex/trunk/conf/conf.inc.php p2ex/trunk/edit_user_font.php p2ex/trunk/ic2.php p2ex/trunk/iv2.php p2ex/trunk/lib/FileCtl.php p2ex/trunk/post.php p2ex/trunk/tgrepc.php -------------- next part -------------- Modified: p2ex/trunk/conf/conf.inc.php =================================================================== --- p2ex/trunk/conf/conf.inc.php 2009-12-31 10:03:05 UTC (rev 752) +++ p2ex/trunk/conf/conf.inc.php 2009-12-31 13:39:08 UTC (rev 753) @@ -917,7 +917,7 @@ if ($_conf['session_save'] == 'p2' and session_module_name() == 'files') { if (!is_dir($_conf['session_dir'])) { - FileCtl::mkdir_for($_conf['session_dir'] . '/dummy_filename'); + FileCtl::mkdir_r($_conf['session_dir']); } elseif (!is_writable($_conf['session_dir'])) { p2die("ZbVf[^Û¶fBNg ({$_conf['session_dir']}) É«Ý Àª èܹñB"); } Modified: p2ex/trunk/edit_user_font.php =================================================================== --- p2ex/trunk/edit_user_font.php 2009-12-31 10:03:05 UTC (rev 752) +++ p2ex/trunk/edit_user_font.php 2009-12-31 13:39:08 UTC (rev 753) @@ -87,7 +87,7 @@ // }}} if (!is_dir($_conf['compile_dir'])) { - FileCtl::mkdir_for($_conf['compile_dir'] . '/__dummy__'); + FileCtl::mkdir_r($_conf['compile_dir']); } // ev[gðRpC Modified: p2ex/trunk/ic2.php =================================================================== --- p2ex/trunk/ic2.php 2009-12-31 10:03:05 UTC (rev 752) +++ p2ex/trunk/ic2.php 2009-12-31 13:39:08 UTC (rev 753) @@ -56,7 +56,7 @@ } if (!is_dir($_conf['tmp_dir'])) { - FileCtl::mkdir_for($_conf['tmp_dir'] . '/__dummy__'); + FileCtl::mkdir_r($_conf['tmp_dir']); } if (!empty($uri)) { Modified: p2ex/trunk/iv2.php =================================================================== --- p2ex/trunk/iv2.php 2009-12-31 10:03:05 UTC (rev 752) +++ p2ex/trunk/iv2.php 2009-12-31 13:39:08 UTC (rev 753) @@ -310,7 +310,7 @@ ); if (!is_dir($_conf['compile_dir'])) { - FileCtl::mkdir_for($_conf['compile_dir'] . '/__dummy__'); + FileCtl::mkdir_r($_conf['compile_dir']); } $flexy = new HTML_Template_Flexy($_flexy_options); Modified: p2ex/trunk/lib/FileCtl.php =================================================================== --- p2ex/trunk/lib/FileCtl.php 2009-12-31 10:03:05 UTC (rev 752) +++ p2ex/trunk/lib/FileCtl.php 2009-12-31 13:39:08 UTC (rev 753) @@ -112,6 +112,21 @@ } // }}} + // {{{ mkdir_r() + + /** + * fBNgªÈ¯ê欵Äp[~bVð²®·é + * + * @param string $apath + * @param int $perm + * @return bool + */ + static public function mkdir_r($apath, $perm = null) + { + return self::mkdir_for($apath . DIRECTORY_SEPARATOR . '_', $perm); + } + + // }}} // {{{ get_gzfile_contents() /** Modified: p2ex/trunk/post.php =================================================================== --- p2ex/trunk/post.php 2009-12-31 10:03:05 UTC (rev 752) +++ p2ex/trunk/post.php 2009-12-31 13:39:08 UTC (rev 753) @@ -60,7 +60,7 @@ // ^uðXy[XÉ $MESSAGE = tab2space($MESSAGE); // Áê¶ðÀÌQÆÉ - $MESSAGE = htmlspecialchars($MESSAGE, ENT_QUOTES); + $MESSAGE = htmlspecialchars($MESSAGE, ENT_QUOTES, 'Shift_JIS'); // ©®URLNñð $MESSAGE = str_replace('tp://', 'tp://', $MESSAGE); // sªÌXy[XðÀÌQÆÉ @@ -183,42 +183,17 @@ // |XgÀs if (!empty($_POST['p2res']) && empty($_POST['newthread'])) { - // ö®p2Å|Xg - if (!class_exists('P2Client', false)) { - include P2_LIB_DIR . '/P2Client.php'; - } - if (!is_dir($_conf['cookie_dir'])) { - FileCtl::mkdir_for($_conf['cookie_dir'] . '/dummy_filename'); - } - if (P2Util::isHostBe2chNet($host) || !empty($_REQUEST['beres'])) { - $beres = true; - } else { - $beres = false; - } - - try { - $client = new P2Client($_conf['p2_2ch_mail'], $_conf['p2_2ch_pass'], $_conf['cookie_dir']); - $posted = $client->post($host, $bbs, $key, $FROM, $mail, $MESSAGE, $beres, $response); - } catch (P2Exception $e) { - p2die('ö®p2|Xg¸s', $e->getMessage()); - } - - if ($posted) { - $reload = empty($_POST['from_read_new']); - showPostMsg(true, '«±ÝªIíèܵ½B', $reload); - } else { - $result_msg = 'ö®p2|Xg¸s</p>' - . '<pre>' . htmlspecialchars($response['body'], ENT_QUOTES, 'Shift_JIS') . '</pre>' - . '<p>-'; - showPostMsg(false, $result_msg, false); - } + // ö®p2Å«Ý + $posted = postIt2($host, $bbs, $key, $FROM, $mail, $MESSAGE); } else { - // Êí|Xg + // ¼Ú«Ý $posted = postIt($host, $bbs, $key, $post); // cookie Û¶ FileCtl::make_datafile($cookie_file, $_conf['p2_perm']); // ȯêζ¬ - if ($p2cookies) {$cookie_cont = serialize($p2cookies);} + if ($p2cookies) { + $cookie_cont = serialize($p2cookies); + } if ($cookie_cont) { if (FileCtl::file_write_contents($cookie_file, $cookie_cont) === false) { p2die('cannot write file.'); @@ -552,6 +527,51 @@ } // }}} +// {{{ postIt2() + +/** + * ö®p2ÅXð«Þ + * + * @return boolean «Ý¬÷Èç trueA¸sÈç false + */ +function postIt2($host, $bbs, $key, $FROM, $mail, $MESSAGE) +{ + global $_conf; + + if (!class_exists('P2Client', false)) { + include P2_LIB_DIR . '/P2Client.php'; + } + if (!is_dir($_conf['cookie_dir'])) { + FileCtl::mkdir_r($_conf['cookie_dir']); + } + + if (P2Util::isHostBe2chNet($host) || !empty($_REQUEST['beres'])) { + $beRes = true; + } else { + $beRes = false; + } + + try { + $client = new P2Client($_conf['p2_2ch_mail'], $_conf['p2_2ch_pass'], $_conf['cookie_dir']); + $posted = $client->post($host, $bbs, $key, $FROM, $mail, $MESSAGE, $beRes, $response); + } catch (P2Exception $e) { + p2die('ö®p2|Xg¸s', $e->getMessage()); + } + + if ($posted) { + $reload = empty($_POST['from_read_new']); + showPostMsg(true, '«±ÝªIíèܵ½B', $reload); + } else { + $result_msg = 'ö®p2|Xg¸s</p>' + . '<pre>' . htmlspecialchars($response['body'], ENT_QUOTES, 'Shift_JIS') . '</pre>' + . '<p>-'; + showPostMsg(false, $result_msg, false); + } + + return $posted; +} + +// }}} // {{{ showPostMsg() /** Modified: p2ex/trunk/tgrepc.php =================================================================== --- p2ex/trunk/tgrepc.php 2009-12-31 10:03:05 UTC (rev 752) +++ p2ex/trunk/tgrepc.php 2009-12-31 13:39:08 UTC (rev 753) @@ -67,7 +67,7 @@ 'automaticSerialization' => true, ); if (!is_dir($cache_options['cacheDir'])) { - FileCtl::mkdir_for($cache_options['cacheDir'] . '__dummy__'); + FileCtl::mkdir_r($cache_options['cacheDir']); } $cache = new Cache_Lite($cache_options); $cache_id_result = md5($query);