/** * ホスト名からクッキーファイルパスを返す * * @return string */ function _cachePathForCookieByHost($host) { global $_conf; $cachefile = $_conf['cookie_dir'] . DIRECTORY_SEPARATOR . P2Util::escapeDirPath($host) . DIRECTORY_SEPARATOR . $_conf['cookie_file_name']; FileCtl::mkdirFor($cachefile); return $cachefile; }
/** * hostからrep2の各種データ保存ディレクトリを返す * * @access private * @param string $base_dir * @param string $host * @param bool $dir_sep * @return string */ function _p2DirOfHost($base_dir, $host, $dir_sep = true) { static $hostDirs_ = array(); $key = $base_dir . DIRECTORY_SEPARATOR . $host; if (array_key_exists($key, $hostDirs_)) { if ($dir_sep) { return $hostDirs_[$key] . DIRECTORY_SEPARATOR; } return $hostDirs_[$key]; } $host = P2Util::normalizeHostName($host); // 2channel or bbspink if (P2Util::isHost2chs($host)) { $host_dir = $base_dir . DIRECTORY_SEPARATOR . '2channel'; // machibbs.com } elseif (P2Util::isHostMachiBbs($host)) { $host_dir = $base_dir . DIRECTORY_SEPARATOR . 'machibbs.com'; // jbbs.livedoor.jp (livedoor レンタル掲示板) } elseif (P2Util::isHostJbbsShitaraba($host)) { /* if (DIRECTORY_SEPARATOR == '/') { $host_dir = $base_dir . DIRECTORY_SEPARATOR . $host; } else { $host_dir = $base_dir . DIRECTORY_SEPARATOR . str_replace('/', DIRECTORY_SEPARATOR, $host); } */ $host_dir = $base_dir . DIRECTORY_SEPARATOR . P2Util::escapeDirPath($host); // livedoor レンタル掲示板以外でスラッシュ等の文字を含むとき } elseif (preg_match('/[^0-9A-Za-z.\\-_]/', $host)) { $host_dir = $base_dir . DIRECTORY_SEPARATOR . P2Util::escapeDirPath($host); /* if (DIRECTORY_SEPARATOR == '/') { $old_host_dir = $base_dir . DIRECTORY_SEPARATOR . $host; } else { $old_host_dir = $base_dir . DIRECTORY_SEPARATOR . str_replace('/', DIRECTORY_SEPARATOR, $host); } if (is_dir($old_host_dir)) { rename($old_host_dir, $host_dir); clearstatcache(); } */ // その他 } else { $host_dir = $base_dir . DIRECTORY_SEPARATOR . P2Util::escapeDirPath($host); } // キャッシュする $hostDirs_[$key] = $host_dir; // ディレクトリ区切り文字を追加 if ($dir_sep) { $host_dir .= DIRECTORY_SEPARATOR; } return $host_dir; }