Ejemplo n.º 1
0
$post_backup_key = PostDataStore::getKeyForBackup($host, $bbs, $key, !empty($_REQUEST['newthread']));
$post_config_key = PostDataStore::getKeyForConfig($host, $bbs);
// 設定を保存
PostDataStore::set($post_config_key, array('beres' => !empty($_REQUEST['beres']), 'p2res' => !empty($_REQUEST['p2res'])));
//================================================================
// 書き込み処理
//================================================================
// 書き込みを一時的に保存
PostDataStore::set($post_backup_key, $post_cache);
// ポスト実行
if (!empty($_POST['p2res']) && empty($_POST['newthread'])) {
    // 公式p2で書き込み
    $posted = postIt2($host, $bbs, $key, $FROM, $mail, $MESSAGE);
} else {
    // cookie 読み込み
    $cookie_key = $_login->user_u . '/' . P2Util::normalizeHostName($host);
    if ($p2cookies = CookieDataStore::get($cookie_key)) {
        if (is_array($p2cookies)) {
            if (array_key_exists('expires', $p2cookies)) {
                // 期限切れなら破棄
                if (time() > strtotime($p2cookies['expires'])) {
                    CookieDataStore::delete($cookie_key);
                    $p2cookies = null;
                }
            }
        } else {
            CookieDataStore::delete($cookie_key);
            $p2cookies = null;
        }
    } else {
        $p2cookies = null;
Ejemplo n.º 2
0
Archivo: P2Util.php Proyecto: poppen/p2
 /**
  * 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;
 }
Ejemplo n.º 3
0
$post_backup_key = PostDataStore::getKeyForBackup($host, $bbs, $key, !empty($_REQUEST['newthread']));
$post_config_key = PostDataStore::getKeyForConfig($host, $bbs);
// 設定を保存
PostDataStore::set($post_config_key, array('beres' => !empty($_REQUEST['beres']), 'p2res' => !empty($_REQUEST['p2res'])));
//================================================================
// 書き込み処理
//================================================================
// 書き込みを一時的に保存
PostDataStore::set($post_backup_key, $post_cache);
// ポスト実行
if (!empty($_POST['p2res']) && empty($_POST['newthread'])) {
    // 公式p2で書き込み
    $posted = postIt2($host, $bbs, $key, $FROM, $mail, $MESSAGE);
} else {
    // cookie 読み込み
    $cookie_key = $_login->user_u . '/' . P2Util::normalizeHostName(P2Util::isHostBbsPink($host) ? 'www.bbspink.com' : P2Util::isHost2chs($host) ? 'www.2ch.net' : $host);
    // 忍法帳対応
    if ($p2cookies = CookieDataStore::get($cookie_key)) {
        if (is_array($p2cookies)) {
            if (array_key_exists('expires', $p2cookies)) {
                // 期限切れなら破棄
                if (time() > strtotime($p2cookies['expires'])) {
                    CookieDataStore::delete($cookie_key);
                    $p2cookies = null;
                }
            }
        } else {
            CookieDataStore::delete($cookie_key);
            $p2cookies = null;
        }
    } else {