Ejemplo n.º 1
0
 /**
  * 必死チェッカー対応板を読み込む
  * 自動で読み込まれるので通常は実行する必要はない
  */
 function load()
 {
     global $_conf;
     // include_once P2_LIB_DIR . '/p2util.class.php';
     $url = 'http://hissi.org/menu.html';
     $path = P2Util::cacheFileForDL($url);
     // メニューのキャッシュ時間の10倍キャッシュ
     P2UtilWiki::cacheDownload($url, $path, $_conf['menu_dl_interval'] * 36000);
     $file = @file_get_contents($path);
     preg_match_all('{<a href=http://hissi\\.org/read\\.php/(\\w+?)/>.+?</a><br>}', $file, $boards);
     $this->boards = $boards[1];
 }
Ejemplo n.º 2
0
 /**
  * 必死チェッカー対応板を読み込む
  * 自動で読み込まれるので通常は実行する必要はない
  */
 public function load()
 {
     global $_conf;
     $path = P2Util::cacheFileForDL($this->menuUrl);
     // メニューのキャッシュ時間の10倍キャッシュ
     P2UtilWiki::cacheDownload($this->menuUrl, $path, $_conf['menu_dl_interval'] * 36000);
     $this->boards = array();
     $file = @file_get_contents($path);
     if ($file) {
         if (preg_match_all($this->readPattern, $file, $boards)) {
             $this->boards = $boards[1];
         }
     }
 }
Ejemplo n.º 3
0
/**
 * オンライン上のrep2-expack最新版をチェックする
 *
 * @return string HTML
 */
function checkUpdatan()
{
    global $_conf, $p2web_url_r, $expack_url_r, $expack_dl_url_r, $expack_hist_url_r;
    $no_p2status_dl_flag = false;
    $ver_txt_url = $_conf['expack.web_url'] . 'version.txt';
    $cachefile = P2Util::cacheFileForDL($ver_txt_url);
    FileCtl::mkdirFor($cachefile);
    if (file_exists($cachefile)) {
        // キャッシュの更新が指定時間以内なら
        if (filemtime($cachefile) > time() - $_conf['p2status_dl_interval'] * 86400) {
            $no_p2status_dl_flag = true;
        }
    }
    if (empty($no_p2status_dl_flag)) {
        P2Util::fileDownload($ver_txt_url, $cachefile);
    }
    $ver_txt = FileCtl::file_read_lines($cachefile, FILE_IGNORE_NEW_LINES);
    $update_ver = $ver_txt[0];
    $kita = 'キタ━━━━(゚∀゚)━━━━!!!!!!';
    //$kita = 'キタ*・゚゚・*:.。..。.:*・゚(゚∀゚)゚・*:.。. .。.:*・゚゚・*!!!!!';
    $newversion_found_html = '';
    if ($update_ver && version_compare($update_ver, $_conf['p2version'], '>')) {
        $newversion_found_html = <<<EOP
<div class="kakomi">
    {$kita}<br>
    オンライン上に 拡張パック の最新バージョンを見つけますた。<br>
    rep2-expack rev.{$update_ver} → <a href="{$expack_dl_url_r}"{$_conf['ext_win_target_at']}>ダウンロード</a> / <a href="{$expack_hist_url_r}"{$_conf['ext_win_target_at']}>更新記録</a>
</div>
<hr class="invisible">
EOP;
    }
    return $newversion_found_html;
}
Ejemplo n.º 4
0
 /**
  * オンライン板リストを読込む
  */
 public static function read_brd_online()
 {
     global $_conf;
     $brd_menus = array();
     $isNewDL = false;
     if ($_conf['brdfile_online']) {
         $cachefile = P2Util::cacheFileForDL($_conf['brdfile_online']);
         $noDL = false;
         $read_html_flag = false;
         // キャッシュがある場合
         if (file_exists($cachefile . '.p2.brd')) {
             // norefreshならDLしない
             if (!empty($_GET['nr'])) {
                 $noDL = true;
                 // キャッシュの更新が指定時間以内ならDLしない
             } elseif (@filemtime($cachefile . '.p2.brd') > time() - 60 * 60 * $_conf['menu_dl_interval']) {
                 $noDL = true;
             }
         }
         // DLしない
         if ($noDL) {
             // DLする
         } else {
             //echo "DL!<br>";//
             $brdfile_online_res = P2Util::fileDownload($_conf['brdfile_online'], $cachefile);
             if ($brdfile_online_res->isSuccess() && $brdfile_online_res->code != 304) {
                 $isNewDL = true;
             }
         }
         // html形式なら
         if (preg_match('/html?$/', $_conf['brdfile_online'])) {
             // 更新されていたら新規キャッシュ作成
             if ($isNewDL) {
                 // 検索結果がキャッシュされるのを回避
                 if (isset($GLOBALS['word']) && strlen($GLOBALS['word']) > 0) {
                     $_tmp = array($GLOBALS['word'], $GLOBALS['word_fm'], $GLOBALS['words_fm']);
                     $GLOBALS['word'] = null;
                     $GLOBALS['word_fm'] = null;
                     $GLOBALS['words_fm'] = null;
                 } else {
                     $_tmp = null;
                 }
                 //echo "NEW!<br>"; //
                 $aBrdMenu = new BrdMenu();
                 // クラス BrdMenu のオブジェクトを生成
                 $aBrdMenu->makeBrdFile($cachefile);
                 // .p2.brdファイルを生成
                 $brd_menus[] = $aBrdMenu;
                 unset($aBrdMenu);
                 if ($_tmp) {
                     list($GLOBALS['word'], $GLOBALS['word_fm'], $GLOBALS['words_fm']) = $_tmp;
                     $brd_menus = array();
                 } else {
                     $read_html_flag = true;
                 }
             }
             if (file_exists($cachefile . '.p2.brd')) {
                 $cache_brd = $cachefile . '.p2.brd';
             } else {
                 $cache_brd = $cachefile;
             }
         } else {
             $cache_brd = $cachefile;
         }
         if (!$read_html_flag) {
             if ($data = FileCtl::file_read_lines($cache_brd)) {
                 $aBrdMenu = new BrdMenu();
                 // クラス BrdMenu のオブジェクトを生成
                 $aBrdMenu->setBrdMatch($cache_brd);
                 // パターンマッチ形式を登録
                 $aBrdMenu->setBrdList($data);
                 // カテゴリーと板をセット
                 if ($aBrdMenu->num) {
                     $brd_menus[] = $aBrdMenu;
                 } else {
                     P2Util::pushInfoHtml("<p>p2 error: {$cache_brd} から板メニューを生成することはできませんでした。</p>");
                 }
                 unset($data, $aBrdMenu);
             } else {
                 P2Util::pushInfoHtml("<p>p2 error: {$cachefile} は読み込めませんでした。</p>");
             }
         }
     }
     return $brd_menus;
 }
Ejemplo n.º 5
0
Archivo: title.php Proyecto: poppen/p2
/**
 * オンライン上のrep2最新版をチェックする
 *
 * @return  string  HTML
 */
function _checkUpdatan()
{
    global $_conf, $p2web_url_r;
    $no_p2status_dl_flag = false;
    $ver_txt_url = $_conf['p2web_url'] . 'p2status.txt';
    $cachefile = P2Util::cacheFileForDL($ver_txt_url);
    FileCtl::mkdirFor($cachefile);
    if (file_exists($cachefile)) {
        // キャッシュの更新が指定時間以内なら
        if (filemtime($cachefile) > time() - $_conf['p2status_dl_interval'] * 60) {
            $no_p2status_dl_flag = true;
        }
    }
    if (empty($no_p2status_dl_flag)) {
        P2Util::fileDownload($ver_txt_url, $cachefile);
    }
    $ver_txt = file($cachefile);
    $update_ver = $ver_txt[0];
    $kita = 'キタ━━━━(゚∀゚)━━━━!!!!!!';
    //$kita = 'キタ*・゚゚・*:.。..。.:*・゚(゚∀゚)゚・*:.。. .。.:*・゚゚・*!!!!!';
    $newversion_found_html = '';
    if ($update_ver && version_compare($update_ver, $_conf['p2version'], '>')) {
        $update_ver_hs = hs($update_ver);
        $p2web_url_r_hs = hs($p2web_url_r);
        $newversion_found_html = <<<EOP
<div class="kakomi">
    {$kita}<br>
    オンライン上に rep2 の最新バージョンを見つけますた。<br>
    rep2<!-- version {$update_ver_hs}--> → <a href="{$p2web_url_r_hs}cgi/dl/dl.php?dl=p2">ダウンロード</a> / <a href="{$p2web_url_r_hs}p2/doc/ChangeLog.txt"{$_conf['ext_win_target_at']}>更新記録</a>
</div>
<hr class="invisible">
EOP;
    }
    return $newversion_found_html;
}
Ejemplo n.º 6
0
Archivo: P2Util.php Proyecto: poppen/p2
 /**
  * @access  private
  * @return  integer|false
  */
 function getSamba24Time($host, $bbs)
 {
     // http://pc11.2ch.net/software/
     $url = sprintf('http://%s/%s/index.html', $host, $bbs);
     $cachefile = P2Util::cacheFileForDL($url);
     $r = P2Util::fileDownload($url, $cachefile, array('disp_error' => true, 'use_tmp_file' => true));
     if (!$r->is_success()) {
         return false;
     }
     // <br><a href="http://www.2ch.net/">2ちゃんねる</a> BBS.CGI - 2007/11/14 (SpeedyCGI) +<a href="http://bbq.uso800.net/">BBQ</a> +BBM +Rock54/54M +Samba24=30 +ByeSaru=ON<br> ページのおしまいだよ。。と</body></html>
     //$lines = preg_split("/\n/", trim($html));
     if (!($lines = file($cachefile))) {
         return false;
     }
     $count = count($lines);
     $lasti = $count - 1;
     if (preg_match('/ \\+Samba24=(\\d+) /', $lines[$lasti], $m)) {
         return (int) $m[1];
     }
     return 0;
 }
Ejemplo n.º 7
0
Archivo: BrdCtl.php Proyecto: poppen/p2
 /**
  * オンライン板リストを読み込む
  *
  * @static
  * @access  private
  * @return  array
  */
 function readBrdOnline()
 {
     global $_conf;
     if (!$_conf['brdfile_online']) {
         return array();
     }
     $brd_menus = array();
     $cachefile = P2Util::cacheFileForDL($_conf['brdfile_online']);
     $noDL = false;
     $isNewDL = false;
     $read_html_flag = false;
     $p2brdfile = BrdCtl::getP2BrdFile($cachefile);
     // キャッシュがある場合
     if (file_exists($p2brdfile)) {
         // norefreshならDLしない
         if (!empty($_GET['nr'])) {
             $noDL = true;
             // キャッシュの更新が指定時間以内ならDLしない
         } elseif (filemtime($p2brdfile) > time() - 60 * 60 * $_conf['menu_dl_interval']) {
             $noDL = true;
         }
     }
     // DLしない
     if ($noDL) {
         // DLする
     } else {
         //echo "DL!<br>";//
         $brdfile_online_res = P2Util::fileDownload($_conf['brdfile_online'], $cachefile, array('disp_error' => true, 'use_tmp_file' => true));
         if ($brdfile_online_res and $brdfile_online_res->is_success() && $brdfile_online_res->code != '304') {
             $isNewDL = true;
         }
     }
     // html形式なら
     if (preg_match('/html?$/', $_conf['brdfile_online'])) {
         // 更新されていたら新規キャッシュ作成
         if ($isNewDL) {
             //echo "NEW!<br>"; //
             $aBrdMenu = new BrdMenu();
             $aBrdMenu->makeBrdFile($cachefile);
             // .p2.brdファイルを生成
             $brd_menus[] = $aBrdMenu;
             $read_html_flag = true;
         }
         if (file_exists($p2brdfile)) {
             $cache_brd = $p2brdfile;
         } else {
             $cache_brd = $cachefile;
         }
     } else {
         $cache_brd = $cachefile;
     }
     if (!$read_html_flag) {
         if ($data = file($cache_brd)) {
             $aBrdMenu = new BrdMenu();
             $aBrdMenu->setBrdMatch($cache_brd);
             // パターンマッチ形式を登録
             $aBrdMenu->setBrdList($data);
             // カテゴリーと板をセット
             if ($aBrdMenu->num) {
                 $brd_menus[] = $aBrdMenu;
             } else {
                 P2Util::pushInfoHtml(sprintf("<p>p2 error: %s から板メニューを生成することはできませんでした。</p>\n", hs($cache_brd)));
             }
         } else {
             P2Util::pushInfoHtml(sprintf("<p>p2 error: %s は読み込めませんでした。</p>\n", hs($cachefile)));
         }
     }
     return $brd_menus;
 }