Ejemplo n.º 1
0
 /**
  * 書き込みログの line 一行をパースして、ResArticleオブジェクトを返す
  *
  * @access  public
  * @param   array    $aline
  * @return  object ResArticle
  */
 function lineToRes($aline, $order)
 {
     $ResArticle = new ResArticle();
     $resar = explode('<>', rtrim($aline));
     $ResArticle->name = $resar[0];
     $ResArticle->mail = $resar[1];
     $ResArticle->daytime = $resar[2];
     $ResArticle->msg = $resar[3];
     $ResArticle->ttitle = $resar[4];
     $ResArticle->host = $resar[5];
     $ResArticle->bbs = $resar[6];
     if (!($ResArticle->itaj = P2Util::getItaName($ResArticle->host, $ResArticle->bbs))) {
         $ResArticle->itaj = $ResArticle->bbs;
     }
     $ResArticle->key = $resar[7];
     $ResArticle->resnum = isset($resar[8]) ? $resar[8] : null;
     $ResArticle->order = $order;
     return $ResArticle;
 }
Ejemplo n.º 2
0
 /**
  * 書き込みログの lines をパースして読み込む
  *
  * @param  array    $lines
  * @return void
  */
 public function readLines(array $lines)
 {
     $n = 1;
     foreach ($lines as $aline) {
         $aResArticle = new ResArticle();
         $resar = explode('<>', $aline);
         $aResArticle->name = $resar[0];
         $aResArticle->mail = $resar[1];
         $aResArticle->daytime = $resar[2];
         $aResArticle->msg = $resar[3];
         $aResArticle->ttitle = $resar[4];
         $aResArticle->host = $resar[5];
         $aResArticle->bbs = $resar[6];
         if (!($aResArticle->itaj = P2Util::getItaName($aResArticle->host, $aResArticle->bbs))) {
             $aResArticle->itaj = $aResArticle->bbs;
         }
         $aResArticle->key = $resar[7];
         $aResArticle->resnum = $resar[8];
         $aResArticle->order = $n;
         $this->addRes($aResArticle);
         $n++;
     }
 }
Ejemplo n.º 3
0
             $aThread->getThreadInfoFromExtIdxLine($l);
             $aThread->itaj = P2Util::getItaName($aThread->host, $aThread->bbs);
             if (!$aThread->itaj) {
                 $aThread->itaj = $aThread->bbs;
             }
             break;
         case "merge_favita":
             // お気に板をマージ
             $aThread->isonline = true;
             $aThread->key = $l['key'];
             $aThread->setTtitle($l['ttitle']);
             $aThread->rescount = $l['rescount'];
             $aThread->host = $l['host'];
             $aThread->bbs = $l['bbs'];
             $aThread->torder = $l['torder'];
             $aThread->itaj = P2Util::getItaName($aThread->host, $aThread->bbs);
             if (!$aThread->itaj) {
                 $aThread->itaj = $aThread->bbs;
             }
             break;
     }
     // subject (not spmode つまり普通の板)
 } else {
     $aThread->getThreadInfoFromSubjectTxtLine($l);
     $aThread->host = $aThreadList->host;
     $aThread->bbs = $aThreadList->bbs;
 }
 // メモリ節約(特にmerge_favita)のため
 $lines[$x] = null;
 // hostかbbsかkeyが不明ならスキップ
 if (!($aThread->host && $aThread->bbs && $aThread->key)) {
Ejemplo n.º 4
0
function readNew($aThread)
{
    global $_conf, $newthre_num, $STYLE;
    global $spmode, $word, $newtime;
    $orig_no_label = !empty($_conf['expack.iphone.toolbars.no_label']);
    $_conf['expack.iphone.toolbars.no_label'] = true;
    $newthre_num++;
    //==========================================================
    // idxの読み込み
    //==========================================================
    //hostを分解してidxファイルのパスを求める
    $aThread->setThreadPathInfo($aThread->host, $aThread->bbs, $aThread->key);
    //FileCtl::mkdirFor($aThread->keyidx); // 板ディレクトリが無ければ作る //この操作はおそらく不要
    $aThread->itaj = P2Util::getItaName($aThread->host, $aThread->bbs);
    if (!$aThread->itaj) {
        $aThread->itaj = $aThread->bbs;
    }
    // idxファイルがあれば読み込む
    if ($lines = FileCtl::file_read_lines($aThread->keyidx, FILE_IGNORE_NEW_LINES)) {
        $data = explode('<>', $lines[0]);
    } else {
        $data = array_fill(0, 12, '');
    }
    $aThread->getThreadInfoFromIdx();
    //==================================================================
    // DATのダウンロード
    //==================================================================
    if (!($word and file_exists($aThread->keydat))) {
        $aThread->downloadDat();
    }
    // DATを読み込み
    $aThread->readDat();
    $aThread->setTitleFromLocal();
    // ローカルからタイトルを取得して設定
    //===========================================================
    // 表示レス番の範囲を設定
    //===========================================================
    // 取得済みなら
    if ($aThread->isKitoku()) {
        $from_num = $aThread->readnum + 1 - $_conf['respointer'] - $_conf['before_respointer_new'];
        if ($from_num > $aThread->rescount) {
            $from_num = $aThread->rescount - $_conf['respointer'] - $_conf['before_respointer_new'];
        }
        if ($from_num < 1) {
            $from_num = 1;
        }
        //if (!$aThread->ls) {
        $aThread->ls = "{$from_num}-";
        //}
    }
    $aThread->lsToPoint();
    //==================================================================
    // ヘッダ 表示
    //==================================================================
    $motothre_url = $aThread->getMotoThread();
    $ttitle_en = UrlSafeBase64::encode($aThread->ttitle);
    $ttitle_en_q = '&amp;ttitle_en=' . $ttitle_en;
    $bbs_q = '&amp;bbs=' . $aThread->bbs;
    $key_q = '&amp;key=' . $aThread->key;
    $host_bbs_key_q = 'host=' . $aThread->host . $bbs_q . $key_q;
    $popup_q = '&amp;popup=1';
    $itaj_hd = htmlspecialchars($aThread->itaj, ENT_QUOTES, 'Shift_JIS');
    if ($spmode) {
        $read_header_itaj_ht = "({$itaj_hd})";
    } else {
        $read_header_itaj_ht = '';
    }
    if ($_conf['iphone']) {
        if ($read_header_itaj_ht !== '') {
            $read_header_itaj_ht = "<span class=\"btitle\">{$read_header_itaj_ht}</span>";
        }
        $read_header_ht = <<<EOP
<div class="ntoolbar mtoolbar mtoolbar_top" id="ntt{$newthre_num}">
<h2 class="ttitle">{$aThread->ttitle_hd} {$read_header_itaj_ht}</h2>
EOP;
        $read_header_ht .= '<div class="mover">';
        $read_header_ht .= toolbar_i_standard_button('img/gp2-down.png', '', sprintf('#ntt%d', $newthre_num + 1));
        $read_header_ht .= '</div>';
        $info_ht = P2Util::getInfoHtml();
        if (strlen($info_ht)) {
            $read_header_ht .= "<div class=\"info\">{$info_ht}</div>";
        }
        $read_header_ht .= '</div>';
    } else {
        P2Util::printInfoHtml();
        $read_header_ht = <<<EOP
<hr><div id="ntt{$newthre_num}" name="ntt{$newthre_num}"><font color="{$STYLE['mobile_read_ttitle_color']}"><b>{$aThread->ttitle_hd}</b></font> {$read_header_itaj_ht} <a href="#ntt_bt{$newthre_num}">▼</a></div><hr>
EOP;
    }
    //==================================================================
    // ローカルDatを読み込んでHTML表示
    //==================================================================
    $aThread->resrange['nofirst'] = true;
    $GLOBALS['newres_to_show_flag'] = false;
    $read_cont_ht = '';
    if ($aThread->rescount) {
        $aShowThread = new ShowThreadK($aThread, true);
        if ($_conf['iphone'] && $_conf['expack.spm.enabled']) {
            $read_cont_ht .= $aShowThread->getSpmObjJs();
        }
        $read_cont_ht .= $aShowThread->getDatToHtml();
        unset($aShowThread);
    }
    //==================================================================
    // フッタ 表示
    //==================================================================
    // 表示範囲
    if ($aThread->resrange['start'] == $aThread->resrange['to']) {
        $read_range_on = $aThread->resrange['start'];
    } else {
        $read_range_on = "{$aThread->resrange['start']}-{$aThread->resrange['to']}";
    }
    $read_range_ht = "{$read_range_on}/{$aThread->rescount}";
    // ツールバー部分HTML =======
    if ($spmode) {
        $toolbar_itaj_ht = "(<a href=\"{$_conf['subject_php']}?{$host_bbs_key_q}{$_conf['k_at_a']}\">{$itaj_hd}</a>)";
    } else {
        $toolbar_itaj_ht = '';
    }
    if ($_conf['iphone']) {
        if ($toolbar_itaj_ht !== '') {
            $toolbar_itaj_ht = "<span class=\"btitle\">{$toolbar_itaj_ht}</span>";
        }
        $read_footer_ht = <<<EOP
<div class="ntoolbar mtoolbar mtoolbar_bottom" id="ntt_btm{$newthre_num}">
<table><tbody><tr>
EOP;
        // 情報
        $read_footer_ht .= '<td>';
        $escaped_url = "info.php?{$host_bbs_key_q}{$ttitle_en_q}{$_conf['k_at_a']}";
        $read_footer_ht .= toolbar_i_opentab_button('img/gp5-info.png', '', $escaped_url);
        $read_footer_ht .= '</td>';
        // 表示範囲
        $read_footer_ht .= "<td colspan=\"3\"><span class=\"large\">{$read_range_ht}</span></td>";
        // ツール
        $read_footer_ht .= '<td>';
        $escaped_url = "spm_k.php?{$host_bbs_key_q}&amp;ls={$aThread->ls}&amp;spm_default={$aThread->resrange['to']}{$_conf['k_at_a']}";
        $read_footer_ht .= toolbar_i_opentab_button('img/glyphish/icons2/20-gear2.png', '', $escaped_url);
        $read_footer_ht .= '</td>';
        // タイトル等
        $read_footer_ht .= <<<EOP
</tr></tbody></table>
<div class="ttitle"><a href="{$_conf['read_php']}?{$host_bbs_key_q}&amp;offline=1&amp;rescount={$aThread->rescount}{$_conf['k_at_a']}" target="_blank">{$aThread->ttitle_hd}</a> {$toolbar_itaj_ht}</div>
<div class="mover">
EOP;
        $read_footer_ht .= toolbar_i_standard_button('img/gp1-up.png', '', "#ntt{$newthre_num}");
        $read_footer_ht .= '</div></div>';
    } else {
        $read_footer_ht = <<<EOP
<div id="ntt_bt{$newthre_num}" name="ntt_bt{$newthre_num}" class="read_new_toolbar">
{$read_range_ht}
<a href="info.php?{$host_bbs_key_q}{$ttitle_en_q}{$_conf['k_at_a']}">情</a>
<a href="spm_k.php?{$host_bbs_key_q}&amp;ls={$aThread->ls}&amp;spm_default={$aThread->resrange['to']}&amp;from_read_new=1{$_conf['k_at_a']}">特</a>
<br>
<a href="{$_conf['read_php']}?{$host_bbs_key_q}&amp;offline=1&amp;rescount={$aThread->rescount}{$_conf['k_at_a']}#r{$aThread->rescount}">{$aThread->ttitle_hd}</a> {$toolbar_itaj_ht} <a href="#ntt{$newthre_num}">▲</a>
</div>
<hr>

EOP;
    }
    // 透明あぼーんや表示数制限で新しいレス表示がない場合はスキップ
    if ($GLOBALS['newres_to_show_flag']) {
        echo $read_header_ht;
        echo $read_cont_ht;
        echo $read_footer_ht;
    }
    //==================================================================
    // key.idxの値設定
    //==================================================================
    if ($aThread->rescount) {
        $aThread->readnum = min($aThread->rescount, max(0, $data[5], $aThread->resrange['to']));
        $newline = $aThread->readnum + 1;
        // $newlineは廃止予定だが、旧互換用に念のため
        $sar = array($aThread->ttitle, $aThread->key, $data[2], $aThread->rescount, $aThread->modified, $aThread->readnum, $data[6], $data[7], $data[8], $newline, $data[10], $data[11], $aThread->datochiok);
        P2Util::recKeyIdx($aThread->keyidx, $sar);
        // key.idxに記録
    }
    $_conf['expack.iphone.toolbars.no_label'] = $orig_no_label;
}
Ejemplo n.º 5
0
require_once './conf/conf.inc.php';
require_once P2_LIB_DIR . '/Thread.php';
require_once P2_LIB_DIR . '/ThreadRead.php';
$_login->authorize();
// ユーザ認証
//=====================================================
// 変数の設定
//=====================================================
$host = geti($_GET['host']);
$bbs = geti($_GET['bbs']);
$key = geti($_GET['key']);
$rc = geti($_GET['rc']);
$ttitle_en = geti($_GET['ttitle_en']);
$resnum = geti($_GET['resnum']);
$field = geti($_GET['field']);
$itaj = P2Util::getItaName($host, $bbs);
if (!$itaj) {
    $itaj = $bbs;
}
$ttitle_name = base64_decode($ttitle_en);
$GLOBALS['popup_filter'] = 1;
// 対象レスの対象フィールドから、検索ワードを取得する
$_GET['word'] = _getReadFilterWord($host, $bbs, $key, $resnum, $field);
// read.phpに処理を渡す
include $_conf['read_php'];
//===========================================================================
// 関数(このファイル内でのみ利用)
//===========================================================================
/**
 * 対象レスの対象フィールドから、検索ワードを取得する
 *
Ejemplo n.º 6
0
/**
 * スレッドの新着部分を読み込んで表示する
 */
function _readNew(&$aThread)
{
    global $_conf, $_newthre_num, $STYLE;
    global $spmode;
    $_newthre_num++;
    $hr = P2View::getHrHtmlK();
    //==========================================================
    // idxの読み込み
    //==========================================================
    //hostを分解してidxファイルのパスを求める
    $aThread->setThreadPathInfo($aThread->host, $aThread->bbs, $aThread->key);
    //FileCtl::mkdirFor($aThread->keyidx); //板ディレクトリが無ければ作る //この操作はおそらく不要
    $aThread->itaj = P2Util::getItaName($aThread->host, $aThread->bbs);
    if (!$aThread->itaj) {
        $aThread->itaj = $aThread->bbs;
    }
    // idxファイルがあれば読み込む
    if (is_readable($aThread->keyidx)) {
        $lines = file($aThread->keyidx);
        $data = explode('<>', rtrim($lines[0]));
    }
    $aThread->getThreadInfoFromIdx();
    //$aThread->readDatInfoFromFile();
    // DATのダウンロード
    if (!(strlen(geti($word)) and file_exists($aThread->keydat))) {
        $aThread->downloadDat();
    }
    // DATを読み込み
    $aThread->readDat();
    $aThread->setTitleFromLocal();
    // ローカルからタイトルを取得して設定
    //===========================================================
    // 表示レス番の範囲を設定
    //===========================================================
    // 取得済みなら
    if ($aThread->isKitoku()) {
        $from_num = $aThread->readnum + 1 - $_conf['respointer'] - $_conf['before_respointer_new'];
        if ($from_num > $aThread->rescount) {
            $from_num = $aThread->rescount - $_conf['respointer'] - $_conf['before_respointer_new'];
        }
        if ($from_num < 1) {
            $from_num = 1;
        }
        //if (!$aThread->ls) {
        $aThread->ls = "{$from_num}-";
        //}
    }
    $aThread->lsToPoint();
    //==================================================================
    // ヘッダ 表示
    //==================================================================
    $motothre_url = $aThread->getMotoThread();
    $ttitle_en = base64_encode($aThread->ttitle);
    $ttitle_en_q = "&amp;ttitle_en=" . $ttitle_en;
    $bbs_q = "&amp;bbs=" . $aThread->bbs;
    $key_q = "&amp;key=" . $aThread->key;
    $popup_q = "&amp;popup=1";
    // require_once P2_LIB_DIR . '/read_header.inc.php';
    $prev_thre_num = $_newthre_num - 1;
    $next_thre_num = $_newthre_num + 1;
    if ($prev_thre_num != 0) {
        $prev_thre_ht = "<a href=\"#ntt{$prev_thre_num}\">▲</a>";
    }
    //$next_thre_ht = "<a href=\"#ntt{$next_thre_num}\">▼</a> ";
    $next_thre_ht = "<a class=\"button\" href=\"#ntt_bt{$_newthre_num}\">▼</a> ";
    if ($spmode) {
        $read_header_itaj_ht = sprintf(' (%s)', hs($aThread->itaj));
        if ($_conf['k_save_packet']) {
            $read_header_itaj_ht = mb_convert_kana($read_header_itaj_ht, 'rnsk');
        }
    }
    // スマートポップアップメニュー JavaScriptコード
    if ($_conf['enable_spm']) {
        // フォントサイズ等 conf_user_style.inc.php  をいじるとPCも変わるのでここで書き換え
        $STYLE['respop_color'] = "#FFFFFF";
        // ("#000") レスポップアップのテキスト色
        $STYLE['respop_bgcolor'] = "";
        // ("#ffffcc") レスポップアップの背景色
        $STYLE['respop_fontsize'] = '13px';
        $aThread->showSmartPopUpMenuJs();
    }
    P2Util::printInfoHtml();
    $ttitle_hs = hs($aThread->ttitle_hc);
    if ($_conf['k_save_packet']) {
        $ttitle_hs = mb_convert_kana($ttitle_hs, 'rnsk');
    }
    $read_header_ht = <<<EOP
\t<p id="ntt{$_newthre_num}" name="ntt{$_newthre_num}"><font color="{$STYLE['read_k_thread_title_color']}"><b>{$ttitle_hs}</b></font>{$read_header_itaj_ht} {$next_thre_ht}</p>
\t{$hr}

EOP;
    // {{{ ローカルDatを読み込んでHTML表示
    $aThread->resrange['nofirst'] = true;
    $GLOBALS['newres_to_show_flag'] = false;
    $read_cont_ht = '';
    if ($aThread->rescount) {
        //$aThread->datToHtml(); // dat を html に変換表示
        require_once P2_IPHONE_LIB_DIR . '/ShowThreadK.php';
        $aShowThread = new ShowThreadK($aThread);
        $read_cont_ht = $aShowThread->getDatToHtml();
        unset($aShowThread);
    }
    // }}}
    //==================================================================
    // フッタ 表示
    //==================================================================
    // require_once P2_LIB_DIR . '/read_footer.inc.php';
    //----------------------------------------------
    // $read_footer_navi_new_ht  続きを読む 新着レスの表示
    $newtime = date("gis");
    // リンクをクリックしても再読込しない仕様に対抗するダミークエリー
    $info_st = "情";
    $dele_st = "削";
    $prev_st = "前";
    $next_st = "次";
    // 表示範囲
    if ($aThread->resrange['start'] == $aThread->resrange['to']) {
        $read_range_on = $aThread->resrange['start'];
    } else {
        $read_range_on = "{$aThread->resrange['start']}-{$aThread->resrange['to']}";
    }
    $read_range_ht = "{$read_range_on}/{$aThread->rescount}<br>";
    /*
    $read_footer_navi_new_ht = P2View::tagA(
        UriUtil::buildQueryUri(
            $_conf['read_php'],
            array(
                'host' => $aThread->host,
                'bbs'  => $aThread->bbs,
                'key'  => $aThread->key,
                'ls'   => "$aThread->rescount-",
                'nt'   => $newtime,
                UA::getQueryKey() => UA::getQueryValue()
            ) . "#r{$aThread->rescount}"
        ),
        '新着レスの表示'
    );
    
    $dores_ht _getDoResATag($aThread, $motothre_url);
    */
    // {{{ ツールバー部分HTML
    if ($spmode) {
        $ita_atag = _getItaATag($aThread);
        $toolbar_itaj_ht = " ({$ita_atag})";
        if ($_conf['k_save_packet']) {
            $toolbar_itaj_ht = mb_convert_kana($toolbar_itaj_ht, 'rnsk');
        }
    }
    /*
    $info_atag = _getInfoATag($aThread, $info_st);
    $dele_atag = _getDeleATag($aThread, $dele_st);
    $motothre_atag = P2View::tagA($motothre_url, '元スレ')
    $toolbar_right_ht = "{$info_atag} {$dele_atag} {$motothre_atag}\n";
    */
    // }}}
    $read_atag = _getReadATag($aThread);
    $read_footer_ht = <<<EOP
        <div id="ntt_bt{$_newthre_num}" name="ntt_bt{$_newthre_num}">
            {$read_range_ht} 
            {$read_atag}{$toolbar_itaj_ht} 
            <a href="#ntt{$_newthre_num}">▲</a>
        </div>
EOP;
    // 透明あぼーんや表示数制限で新しいレス表示がない場合はスキップ
    if ($GLOBALS['newres_to_show_flag']) {
        echo $read_header_ht;
        echo $read_cont_ht;
        echo $read_footer_ht;
    }
    // {{{ key.idxの値設定
    if ($aThread->rescount) {
        $aThread->readnum = min($aThread->rescount, max(0, $data[5], $aThread->resrange['to']));
        $newline = $aThread->readnum + 1;
        // $newlineは廃止予定だが、後方互換用に念のため
        $sar = array($aThread->ttitle, $aThread->key, $data[2], $aThread->rescount, '', $aThread->readnum, $data[6], $data[7], $data[8], $newline, $data[10], $data[11], $aThread->datochiok);
        P2Util::recKeyIdx($aThread->keyidx, $sar);
        // key.idxに記録
    }
    // }}}
    unset($aThread);
}
Ejemplo n.º 7
0
/**
 * お気にスレをセットする
 *
 * @param   string      $host
 * @param   string      $bbs
 * @param   string      $key
 * @param   int|string  $setfavita  0(解除), 1(追加), 2(トグル), top, up, down, bottom
 * @param   string      $ttitle
 * @param   int|null    $setnum
 * @return  bool
 */
function setFav($host, $bbs, $key, $setfav, $ttitle = null, $setnum = null)
{
    global $_conf;
    //==================================================================
    // key.idx
    //==================================================================
    // idxfileのパスを求めて
    $idxfile = P2Util::idxDirOfHostBbs($host, $bbs) . $key . '.idx';
    // 板ディレクトリが無ければ作る
    // FileCtl::mkdirFor($idxfile);
    // 既にidxデータがあるなら読み込む
    if ($lines = FileCtl::file_read_lines($idxfile, FILE_IGNORE_NEW_LINES)) {
        $data = explode('<>', $lines[0]);
    } else {
        $data = array_fill(0, 12, '');
        if (is_string($ttitle) && strlen($ttitle)) {
            $data[0] = p2h($ttitle, false);
        }
    }
    // {{{ スレッド.idx 記録
    if (($setfav == '0' || $setfav == '1') && $_conf['favlist_idx'] == $_conf['orig_favlist_idx']) {
        // お気にスレから外した結果、idxの意味がなくなれば削除する
        if ($setfav == '0' and !$data[3] && !$data[4] && $data[9] <= 1) {
            @unlink($idxfile);
        } else {
            $sar = array($data[0], $key, $data[2], $data[3], $data[4], $data[5], $setfav, $data[7], $data[8], $data[9], $data[10], $data[11], $data[12]);
            P2Util::recKeyIdx($idxfile, $sar);
        }
    }
    // }}}
    //==================================================================
    // favlist.idx
    //==================================================================
    if (!is_null($setnum) && $_conf['expack.misc.multi_favs']) {
        if (0 < $setnum && $setnum <= $_conf['expack.misc.favset_num']) {
            $favlist_idx = $_conf['pref_dir'] . sprintf('/p2_favlist%d.idx', $setnum);
        } else {
            $favlist_idx = $_conf['orig_favlist_idx'];
        }
    } else {
        $favlist_idx = $_conf['favlist_idx'];
    }
    // favlistファイルがなければ生成
    FileCtl::make_datafile($favlist_idx);
    // favlist読み込み
    $favlines = FileCtl::file_read_lines($favlist_idx, FILE_IGNORE_NEW_LINES);
    //================================================
    // 処理
    //================================================
    $neolines = array();
    $before_line_num = 0;
    $was_set = false;
    // 最初に重複要素を削除しておく
    if (!empty($favlines)) {
        $i = -1;
        foreach ($favlines as $l) {
            $i++;
            $lar = explode('<>', $l);
            // 重複回避
            if ($lar[1] == $key && $lar[11] == $bbs) {
                $before_line_num = $i;
                // 移動前の行番号をセット
                $was_set = true;
                continue;
                // keyのないものは不正データなのでスキップ
            } elseif (!$lar[1]) {
                continue;
            } else {
                $neolines[] = $l;
            }
        }
    }
    if ($setfav == 2) {
        $setfav = $was_set ? 0 : 1;
    }
    // 記録データ設定
    if ($setfav) {
        if (!function_exists('getSetPosLines')) {
            include P2_LIB_DIR . '/getsetposlines.inc.php';
        }
        $newdata = "{$data[0]}<>{$key}<>{$data[2]}<>{$data[3]}<>{$data[4]}<>{$data[5]}<>1<>{$data[7]}<>{$data[8]}<>{$data[9]}<>{$host}<>{$bbs}";
        $rec_lines = getSetPosLines($neolines, $newdata, $before_line_num, $setfav);
    } else {
        $rec_lines = $neolines;
    }
    $cont = '';
    if (!empty($rec_lines)) {
        foreach ($rec_lines as $l) {
            $cont .= $l . "\n";
        }
    }
    // 書き込む
    if (FileCtl::file_write_contents($favlist_idx, $cont) === false) {
        p2die('cannot write file.');
    }
    //================================================
    // お気にスレ共有
    //================================================
    if ($_conf['join_favrank'] && $_conf['favlist_idx'] == $_conf['orig_favlist_idx']) {
        if ($setfav == "0") {
            $act = "out";
        } elseif ($setfav == "1") {
            $act = "add";
        } else {
            return;
        }
        $itaj = P2Util::getItaName($host, $bbs);
        $post = array("host" => $host, "bbs" => $bbs, "key" => $key, "ttitle" => $data[0], "ita" => $itaj, "act" => $act);
        postFavRank($post);
    }
    return true;
}
Ejemplo n.º 8
0
/**
 * お気にスレ共有
 *
 * @access  private
 * @return  boolean|null
 */
function _setFavRank($host, $bbs, $key, $setfav, $ttitle)
{
    global $_conf;
    if (!$_conf['join_favrank']) {
        return null;
    }
    if ($setfav == '0') {
        $act = 'out';
    } elseif ($setfav == '1') {
        $act = 'add';
    } else {
        return null;
    }
    return _postFavRank(array('host' => $host, 'bbs' => $bbs, 'key' => $key, 'ttitle' => $ttitle, 'ita' => P2Util::getItaName($host, $bbs), 'act' => $act));
}
Ejemplo n.º 9
0
Archivo: Thread.php Proyecto: poppen/p2
 /**
  * ThreadListの情報に応じて、ラインデータを取得セットする
  *
  * @return  void
  */
 function setThreadInfoFromLineWithThreadList($l, $aThreadList, $setItaj = true)
 {
     // spmode
     if ($aThreadList->spmode) {
         switch ($aThreadList->spmode) {
             case 'recent':
                 // 履歴
                 $this->setThreadInfoFromExtIdxLine($l);
                 if ($setItaj) {
                     if (!($this->itaj = P2Util::getItaName($this->host, $this->bbs))) {
                         $this->itaj = $this->bbs;
                     }
                 }
                 break;
             case 'res_hist':
                 // 書き込み履歴
                 $this->setThreadInfoFromExtIdxLine($l);
                 if ($setItaj) {
                     if (!($this->itaj = P2Util::getItaName($this->host, $this->bbs))) {
                         $this->itaj = $this->bbs;
                     }
                 }
                 break;
             case 'fav':
                 // お気に
                 $this->setThreadInfoFromExtIdxLine($l);
                 if ($setItaj) {
                     if (!($this->itaj = P2Util::getItaName($this->host, $this->bbs))) {
                         $this->itaj = $this->bbs;
                     }
                 }
                 break;
             case 'palace':
                 // スレの殿堂
                 $this->setThreadInfoFromExtIdxLine($l);
                 if ($setItaj) {
                     if (!($this->itaj = P2Util::getItaName($this->host, $this->bbs))) {
                         $this->itaj = $this->bbs;
                     }
                 }
                 break;
                 // read_new*では必要ないところ
             // read_new*では必要ないところ
             case 'taborn':
                 // スレッドあぼーん
                 $la = explode('<>', $l);
                 $this->key = $la[1];
                 $this->host = $aThreadList->host;
                 $this->bbs = $aThreadList->bbs;
                 break;
                 // read_new*では必要ないところ
             // read_new*では必要ないところ
             case 'soko':
                 // dat倉庫
                 $la = explode('<>', $l);
                 $this->key = $la[1];
                 $this->host = $aThreadList->host;
                 $this->bbs = $aThreadList->bbs;
                 break;
             case 'news':
                 // ニュースの勢い
                 $this->isonline = true;
                 $this->key = $l['key'];
                 $this->setTtitle($l['ttitle']);
                 $this->rescount = $l['rescount'];
                 $this->host = $l['host'];
                 $this->bbs = $l['bbs'];
                 if ($setItaj) {
                     if (!($this->itaj = P2Util::getItaName($this->host, $this->bbs))) {
                         $this->itaj = $this->bbs;
                     }
                 }
                 break;
         }
         // subject (not spmode つまり普通の板)
     } else {
         $this->setThreadInfoFromSubjectTxtLine($l);
         $this->host = $aThreadList->host;
         $this->bbs = $aThreadList->bbs;
         // itaj は省略している
     }
 }
Ejemplo n.º 10
0
    $threads_num = $threads_num_max;
} elseif ($sb_view == "edit") {
    $threads_num = $threads_num_max;
} elseif (isset($_GET['word'])) {
    $threads_num = $threads_num_max;
} elseif ($_conf['ktai']) {
    $threads_num = $threads_num_max;
}
//============================================================
// メイン
//============================================================
$aThreadList = new ThreadList();
// 板とモードのセット ===================================
if ($spmode) {
    if ($spmode == "taborn" or $spmode == "soko") {
        $aThreadList->setIta($host, $bbs, P2Util::getItaName($host, $bbs));
    }
    $aThreadList->setSpMode($spmode);
} else {
    // if (!$p2_setting['itaj']) { $p2_setting['itaj'] = P2Util::getItaName($host, $bbs); }
    $itaj = isset($p2_setting['itaj']) ? $p2_setting['itaj'] : null;
    $aThreadList->setIta($host, $bbs, $itaj);
    // スレッドあぼーんリスト読込
    $ta_keys = P2Util::getThreadAbornKeys($aThreadList->host, $aThreadList->bbs);
    //$ta_num = sizeOf($ta_keys);
}
// ソースリスト読込
$lines = $aThreadList->readList();
// お気にスレリスト 読込
if (file_exists($_conf['favlist_file'])) {
    $favlines = file($_conf['favlist_file']);
Ejemplo n.º 11
0
function readNew($aThread)
{
    global $_conf, $newthre_num, $STYLE;
    global $word;
    static $favlist_titles = null;
    if ($_conf['expack.misc.multi_favs'] && is_null($favlist_titles)) {
        $favlist_titles = FavSetManager::getFavSetTitles('m_favlist_set');
        if (empty($favlist_titles)) {
            $favlist_titles = array();
        }
        if (!isset($favlist_titles[0]) || $favlist_titles[0] == '') {
            $favlist_titles[0] = 'お気にスレ';
        }
        for ($i = 1; $i <= $_conf['expack.misc.favset_num']; $i++) {
            if (!isset($favlist_titles[$i]) || $favlist_titles[$i] == '') {
                $favlist_titles[$i] = 'お気にスレ' . $i;
            }
        }
    }
    $newthre_num++;
    //==========================================================
    //  idxの読み込み
    //==========================================================
    // hostを分解してidxファイルのパスを求める
    $aThread->setThreadPathInfo($aThread->host, $aThread->bbs, $aThread->key);
    // FileCtl::mkdirFor($aThread->keyidx); // 板ディレクトリが無ければ作る // この操作はおそらく不要
    $aThread->itaj = P2Util::getItaName($aThread->host, $aThread->bbs);
    if (!$aThread->itaj) {
        $aThread->itaj = $aThread->bbs;
    }
    // idxファイルがあれば読み込む
    if ($lines = FileCtl::file_read_lines($aThread->keyidx, FILE_IGNORE_NEW_LINES)) {
        $data = explode('<>', $lines[0]);
    } else {
        $data = array_fill(0, 12, '');
    }
    $aThread->getThreadInfoFromIdx();
    //==================================================================
    // DATのダウンロード
    //==================================================================
    if (!($word and file_exists($aThread->keydat))) {
        $aThread->downloadDat();
    }
    // DATを読み込み
    $aThread->readDat();
    $aThread->setTitleFromLocal();
    // ローカルからタイトルを取得して設定
    //===========================================================
    // 表示レス番の範囲を設定
    //===========================================================
    // 取得済みなら
    if ($aThread->isKitoku()) {
        $from_num = $aThread->readnum + 1 - $_conf['respointer'] - $_conf['before_respointer_new'];
        if ($from_num > $aThread->rescount) {
            $from_num = $aThread->rescount - $_conf['respointer'] - $_conf['before_respointer_new'];
        }
        if ($from_num < 1) {
            $from_num = 1;
        }
        //if (!$aThread->ls) {
        $aThread->ls = "{$from_num}-";
        //}
    }
    $aThread->lsToPoint();
    //==================================================================
    // ヘッダ 表示
    //==================================================================
    $motothre_url = $aThread->getMotoThread(false, '');
    $ttitle_en = UrlSafeBase64::encode($aThread->ttitle);
    $ttitle_en_q = '&amp;ttitle_en=' . $ttitle_en;
    $bbs_q = '&amp;bbs=' . $aThread->bbs;
    $key_q = '&amp;key=' . $aThread->key;
    $host_bbs_key_q = 'host=' . $aThread->host . $bbs_q . $key_q;
    $popup_q = '&amp;popup=1';
    // require_once P2_LIB_DIR . '/read_header.inc.php';
    $prev_thre_num = $newthre_num - 1;
    $next_thre_num = $newthre_num + 1;
    if ($prev_thre_num != 0) {
        $prev_thre_ht = "<a href=\"#ntt{$prev_thre_num}\">▲</a>";
    } else {
        $prev_thre_ht = '';
    }
    $next_thre_ht = "<a id=\"ntta{$next_thre_num}\" href=\"#ntt{$next_thre_num}\">▼</a>";
    P2Util::printInfoHtml();
    // ヘッダ部分HTML
    $read_header_ht = <<<EOP
<table id="ntt{$newthre_num}" class="toolbar">
    <tr>
        <td class="lblock"><h3 class="thread_title">{$aThread->ttitle_hd}</h3></td>
        <td class="rblock">{$prev_thre_ht} {$next_thre_ht}</td>
    </tr>
</table>

EOP;
    //==================================================================
    // ローカルDatを読み込んでHTML表示
    //==================================================================
    $aThread->resrange['nofirst'] = true;
    $GLOBALS['newres_to_show_flag'] = false;
    if ($aThread->rescount) {
        $aShowThread = new ShowThreadPc($aThread, true);
        if ($_conf['expack.spm.enabled']) {
            $read_header_ht .= $aShowThread->getSpmObjJs();
        }
        $res1 = $aShowThread->quoteOne();
        $read_cont_ht = $res1['q'];
        $read_cont_ht .= $aShowThread->getDatToHtml();
        // レス追跡カラー
        if ($_conf['backlink_coloring_track']) {
            $read_cont_ht .= $aShowThread->getResColorJs();
        }
        // IDカラーリング
        if ($_conf['coloredid.enable'] > 0 && $_conf['coloredid.click'] > 0) {
            $read_header_ht .= $aShowThread->getIdColorJs();
        }
        // 外部ツール
        $pluswiki_js = '';
        if ($_conf['wiki.idsearch.spm.mimizun.enabled']) {
            require_once './plugin/mimizun/mimizun.class.php';
            $mimizun = new mimizun();
            $mimizun->host = $aThread->host;
            $mimizun->bbs = $aThread->bbs;
            if ($mimizun->isEnable()) {
                $pluswiki_js .= "WikiTools.addMimizun({$aShowThread->spmObjName});";
            }
        }
        if ($_conf['wiki.idsearch.spm.hissi.enabled']) {
            require_once './plugin/hissi/hissi.class.php';
            $hissi = new hissi();
            $hissi->host = $aThread->host;
            $hissi->bbs = $aThread->bbs;
            if ($hissi->isEnable()) {
                $pluswiki_js .= "WikiTools.addHissi({$aShowThread->spmObjName});";
            }
        }
        if ($_conf['wiki.idsearch.spm.stalker.enabled']) {
            require_once './plugin/stalker/stalker.class.php';
            $stalker = new stalker();
            $stalker->host = $aThread->host;
            $stalker->bbs = $aThread->bbs;
            if ($stalker->isEnable()) {
                $pluswiki_js .= "WikiTools.addStalker({$aShowThread->spmObjName});";
            }
        }
        if ($pluswiki_js) {
            $read_header_ht .= <<<EOP
<script type="text/javascript">
//<![CDATA[
{$pluswiki_js}
//]]>
</script>
EOP;
        }
        unset($aShowThread);
    }
    //==================================================================
    // フッタ 表示
    //==================================================================
    // $read_footer_navi_new  続きを読む 新着レスの表示
    $newtime = date("gis");
    // リンクをクリックしても再読込しない仕様に対抗するダミークエリー
    $info_st = '情報';
    $delete_st = '削除';
    $prev_st = '前';
    $next_st = '次';
    $dores_st = '書込';
    $read_footer_navi_new = "<a href=\"{$_conf['read_php']}?{$host_bbs_key_q}&amp;ls={$aThread->rescount}-&amp;nt={$newtime}#r{$aThread->rescount}\">新着レスの表\示</a>";
    if (!empty($_conf['disable_res'])) {
        $dores_ht = <<<EOP
          <a href="{$motothre_url}" target="_blank">{$dores_st}</a>
EOP;
    } else {
        $dores_ht = <<<EOP
        <a href="post_form.php?{$host_bbs_key_q}&amp;rescount={$aThread->rescount}{$ttitle_en_q}" target='_self' onclick="return OpenSubWin('post_form.php?{$host_bbs_key_q}&amp;rescount={$aThread->rescount}{$ttitle_en_q}{$popup_q}&amp;from_read_new=1',{$STYLE['post_pop_size']},1,0)">{$dores_st}</a>
EOP;
    }
    // ツールバー部分HTML =======
    // お気にマーク設定
    $itaj_hd = htmlspecialchars($aThread->itaj, ENT_QUOTES);
    $similar_q = '&amp;itaj_en=' . UrlSafeBase64::encode($aThread->itaj) . '&amp;method=similar&amp;word=' . rawurlencode($aThread->ttitle_hc);
    if ($_conf['expack.misc.multi_favs']) {
        $toolbar_setfav_ht = 'お気に[';
        $favdo = !empty($aThread->favs[0]) ? 0 : 1;
        $favdo_q = '&amp;setfav=' . $favdo;
        $favmark = $favdo ? '+' : '★';
        $favtitle = $favlist_titles[0] . ($favdo ? 'に追加' : 'から外す');
        $setnum_q = '&amp;setnum=0';
        $toolbar_setfav_ht .= <<<EOP
<span class="favdo set0"><a href="info.php?{$host_bbs_key_q}{$ttitle_en_q}{$favdo_q}{$setnum_q}" target="info" onclick="return setFavJs('{$host_bbs_key_q}{$ttitle_en_q}', '{$favdo}', {$STYLE['info_pop_size']}, 'read_new', this, '0');" title="{$favtitle}">{$favmark}</a></span>
EOP;
        for ($i = 1; $i <= $_conf['expack.misc.favset_num']; $i++) {
            $favdo = !empty($aThread->favs[$i]) ? 0 : 1;
            $favdo_q = '&amp;setfav=' . $favdo;
            $favmark = $favdo ? $i : '★';
            $favtitle = $favlist_titles[$i] . ($favdo ? 'に追加' : 'から外す');
            $setnum_q = '&amp;setnum=' . $i;
            $toolbar_setfav_ht .= <<<EOP
|<span class="favdo set{$i}"><a href="info.php?{$host_bbs_key_q}{$ttitle_en_q}{$favdo_q}{$setnum_q}" target="info" onclick="return setFavJs('{$host_bbs_key_q}{$ttitle_en_q}', '{$favdo}', {$STYLE['info_pop_size']}, 'read_new', this, '{$i}');" title="{$favtitle}">{$favmark}</a></span>
EOP;
        }
        $toolbar_setfav_ht .= ']';
    } else {
        $favdo = !empty($aThread->fav) ? 0 : 1;
        $favdo_q = '&amp;setfav=' . $favdo;
        $favmark = $favdo ? '+' : '★';
        $favtitle = $favdo ? 'お気にスレに追加' : 'お気にスレから外す';
        $toolbar_setfav_ht = <<<EOP
<span class="favdo"><a href="info.php?{$host_bbs_key_q}{$ttitle_en_q}{$favdo_q}" target="info" onclick="return setFavJs('{$host_bbs_key_q}{$ttitle_en_q}', '{$favdo}', {$STYLE['info_pop_size']}, 'read_new', this, '0');" title="{$favtitle}">お気に{$favmark}</a></span>
EOP;
    }
    $toolbar_right_ht = <<<EOTOOLBAR
            <a href="{$_conf['subject_php']}?{$host_bbs_key_q}" target="subject" title="板を開く">{$itaj_hd}</a>
            <a href="info.php?{$host_bbs_key_q}{$ttitle_en_q}" target="info" onclick="return OpenSubWin('info.php?{$host_bbs_key_q}{$ttitle_en_q}{$popup_q}',{$STYLE['info_pop_size']},1,0)" title="スレッド情報を表\示">{$info_st}</a>
            {$toolbar_setfav_ht}
            <span><a href="info.php?{$host_bbs_key_q}{$ttitle_en_q}&amp;dele=true" target="info" onclick="return deleLog('{$host_bbs_key_q}{$ttitle_en_q}', {$STYLE['info_pop_size']}, 'read_new', this);" title="ログを削除する">{$delete_st}</a></span>
<!--            <a href="info.php?{$host_bbs_key_q}{$ttitle_en_q}&amp;taborn=2" target="info" onclick="return OpenSubWin('info.php?{$host_bbs_key_q}{$ttitle_en_q}&amp;popup=2&amp;taborn=2',{$STYLE['info_pop_size']},0,0)" title="スレッドのあぼーん状態をトグルする">あぼん</a> -->
            <a href="{$motothre_url}" title="板サーバ上のオリジナルスレを表\示" onmouseover="showMotoLsPopUp(event, this)" onmouseout="hideMotoLsPopUp()">元スレ</a>
            <a href="{$_conf['subject_php']}?{$host_bbs_key_q}{$similar_q}" target="subject" title="タイトルが似ているスレッドを検索">似スレ</a>
EOTOOLBAR;
    // レスのすばやさ
    $spd_ht = "";
    if ($spd_st = $aThread->getTimePerRes() and $spd_st != "-") {
        $spd_ht = '<span class="spd" title="すばやさ=時間/レス">' . "" . $spd_st . "" . '</span>';
    }
    // datサイズ
    if (file_exists($aThread->keydat) && ($dsize_ht = filesize($aThread->keydat))) {
        $dsize_ht = sprintf('<span class="spd" title="%s">%01.1fKB</span> |', 'datサイズ', $dsize_ht / 1024);
    } else {
        $dsize_ht = '';
    }
    // IC2リンク、件数
    if ($_conf['expack.ic2.enabled'] && $_conf['expack.ic2.thread_imagelink']) {
        $spanid = 'ic2_count_' . sprintf('%u', crc32($aThread->keydat));
        $ic2navi = '<a href="iv2.php?field=memo&amp;key=' . rawurlencode($aThread->ttitle) . '" target="_blank">キャッシュ画像' . ($_conf['expack.ic2.thread_imagecount'] ? '<span id="ic2_count_' . sprintf('%u', crc32($aThread->keydat)) . '"></span>' : '') . '</a> ';
    }
    // フッタ部分HTML
    $read_footer_ht = <<<EOP
<table class="toolbar">
    <tr>
        <td class="lblock">{$res1['body']} | <a href="{$_conf['read_php']}?{$host_bbs_key_q}&amp;offline=1&amp;rescount={$aThread->rescount}#r{$aThread->rescount}">{$aThread->ttitle_hd}</a> | {$dores_ht} {$dsize_ht} {$spd_ht}</td>
        <td class="rblock">{$ic2navi}{$toolbar_right_ht}</td>
        <td class="rblock"><a href="#ntt{$newthre_num}">▲</a></td>
    </tr>
</table>

EOP;
    // 透明あぼーんで表示がない場合はスキップ
    if ($GLOBALS['newres_to_show_flag']) {
        echo '<div style="width:100%;">' . "\n";
        // ほぼIE ActiveXのGray()のためだけに囲ってある
        echo $read_header_ht;
        echo $read_cont_ht;
        echo $read_footer_ht;
        echo '</div>' . "\n\n";
        echo '<hr>' . "\n\n";
    }
    //==================================================================
    // key.idx の値設定
    //==================================================================
    if ($aThread->rescount) {
        $aThread->readnum = min($aThread->rescount, max(0, $data[5], $aThread->resrange['to']));
        $newline = $aThread->readnum + 1;
        // $newlineは廃止予定だが、旧互換用に念のため
        $sar = array($aThread->ttitle, $aThread->key, $data[2], $aThread->rescount, $aThread->modified, $aThread->readnum, $data[6], $data[7], $data[8], $newline, $data[10], $data[11], $aThread->datochiok);
        P2Util::recKeyIdx($aThread->keyidx, $sar);
        // key.idxに記録
    }
}
Ejemplo n.º 12
0
/**
 * スレッド情報を取得する
 *
 * @param   string  $host
 * @param   string  $bbs
 * @param   string  $key
 * @return  object  スレッド情報
 */
function get_thread_info($host, $bbs, $key)
{
    global $_conf;
    $group = P2Util::getHostGroupName($host);
    $info = new stdClass();
    $info->type = 'thread';
    $info->group = $group;
    $info->host = $host;
    $info->bbs = $bbs;
    $info->key = $key;
    $aThread = new Thread();
    // hostを分解してidxファイルのパスを求める
    $aThread->setThreadPathInfo($host, $bbs, $key);
    $key_line = $aThread->getThreadInfoFromIdx();
    // $aThread->length をset
    $aThread->getDatBytesFromLocalDat();
    // 板名を取得
    $aThread->itaj = P2Util::getItaName($host, $bbs);
    if (!$aThread->itaj) {
        if (isset($_GET['itaj_en'])) {
            $aThread->itaj = UrlSafeBase64::decode($_GET['itaj_en']);
        } else {
            $aThread->itaj = $bbs;
        }
    }
    $info->itaj = $aThread->itaj;
    // スレタイトルを取得
    if (!$aThread->ttitle) {
        if (isset($_GET['ttitle_en'])) {
            $aThread->setTtitle(UrlSafeBase64::decode($_GET['ttitle_en']));
        } else {
            $aThread->setTitleFromLocal();
        }
    }
    $info->ttitle = $aThread->ttitle;
    // お気にスレ登録状況を取得
    $favs = array();
    if ($_conf['expack.misc.multi_favs']) {
        $favlist_titles = FavSetManager::getFavSetTitles('m_favlist_set');
        for ($i = 0; $i <= $_conf['expack.misc.favset_num']; $i++) {
            if (!isset($favlist_titles[$i]) || $favlist_titles[$i] == '') {
                if ($i == 0) {
                    $favtitle = 'お気にスレ';
                } else {
                    $favtitle = "お気にスレ{$i}";
                }
            } else {
                $favtitle = $favlist_titles[$i];
            }
            $favs[$i] = array('title' => $favtitle, 'set' => !empty($aThread->favs[$i]));
        }
    } else {
        $favs[0] = array('title' => 'お気にスレ', 'set' => !empty($aThread->fav));
    }
    $info->favs = $favs;
    // 殿堂チェック
    $info->palace = false;
    if ($pallines = FileCtl::file_read_lines($_conf['palace_idx'], FILE_IGNORE_NEW_LINES)) {
        foreach ($pallines as $l) {
            $palarray = explode('<>', $l);
            if ($aThread->key == $palarray[1] && $aThread->bbs == $palarray[11]) {
                if (P2Util::getHostGroupName($palarray[10]) == $group) {
                    $info->palace = true;
                    break;
                }
            }
        }
    }
    // スレッドあぼーんチェック
    $info->taborn = false;
    $taborn_idx = P2Util::idxDirOfHostBbs($host, $bbs) . 'p2_threads_aborn.idx';
    if ($tabornlines = FileCtl::file_read_lines($taborn_idx, FILE_IGNORE_NEW_LINES)) {
        foreach ($tabornlines as $l) {
            $tabornarray = explode('<>', $l);
            if ($key == $tabornarray[1]) {
                $info->taborn = true;
                break;
            }
        }
    }
    // ログ関連
    $hasLog = false;
    if (file_exists($aThread->keydat)) {
        $info->keydat = $aThread->keydat;
        $info->length = $aThread->length;
        $hasLog = true;
    } else {
        $info->keydat = null;
        $info->length = -1;
    }
    if (file_exists($aThread->keyidx)) {
        $info->keyidx = $aThread->keyidx;
        $hasLog = true;
    } else {
        $info->keyidx = null;
    }
    if ($aThread->gotnum) {
        $info->gotnum = $aThread->gotnum;
    } elseif ($hasLog) {
        $info->gotnum = 0;
    } else {
        $info->gotnum = -1;
    }
    return $info;
}
Ejemplo n.º 13
0
require_once P2_LIB_DIR . '/DataPhp.php';
require_once P2_LIB_DIR . '/P2Validate.php';
$_login->authorize();
// ユーザ認証
//==================================================
// 変数
//==================================================
if (empty($_GET['host'])) {
    p2die('host が指定されていません');
}
$host = $_GET['host'];
$bbs = geti($_GET['bbs']);
$key = geti($_GET['key']);
$rescount = (int) geti($_GET['rescount'], 1);
$popup = (int) geti($_GET['popup'], 0);
if (!($itaj = P2Util::getItaName($host, $bbs))) {
    $itaj = $bbs;
}
$ttitle_en = isset($_GET['ttitle_en']) ? $_GET['ttitle_en'] : '';
$ttitle_hs = null;
if (strlen($ttitle_en)) {
    $ttitle_hs = hs(P2Util::htmlEntityDecodeLite(base64_decode($ttitle_en)));
}
if (P2Validate::host($host) || $bbs && P2Validate::bbs($bbs) || $key && P2Validate::key($key)) {
    p2die('不正な引数です');
}
$keyidx = P2Util::getKeyIdxFilePath($host, $bbs, $key);
// フォームのオプション読み込み
require_once P2_LIB_DIR . '/post_options_loader.inc.php';
// 表示指定
$class_ttitle = '';
Ejemplo n.º 14
0
/**
 * スレッドの新着部分を読み込んで表示する
 */
function readNew(&$aThread)
{
    global $_conf, $_newthre_num, $STYLE;
    global $spmode;
    $_newthre_num++;
    //==========================================================
    // idxの読み込み
    //==========================================================
    //hostを分解してidxファイルのパスを求める
    $aThread->setThreadPathInfo($aThread->host, $aThread->bbs, $aThread->key);
    //FileCtl::mkdirFor($aThread->keyidx); //板ディレクトリが無ければ作る //この操作はおそらく不要
    $aThread->itaj = P2Util::getItaName($aThread->host, $aThread->bbs);
    if (!$aThread->itaj) {
        $aThread->itaj = $aThread->bbs;
    }
    // idxファイルがあれば読み込む
    if (is_readable($aThread->keyidx)) {
        $lines = file($aThread->keyidx);
        $data = explode('<>', rtrim($lines[0]));
    }
    $aThread->getThreadInfoFromIdx();
    // DATのダウンロード
    if (!($word and file_exists($aThread->keydat))) {
        $aThread->downloadDat();
    }
    // DATを読み込み
    $aThread->readDat();
    $aThread->setTitleFromLocal();
    // ローカルからタイトルを取得して設定
    //===========================================================
    // 表示レス番の範囲を設定
    //===========================================================
    // 取得済みなら
    if ($aThread->isKitoku()) {
        $from_num = $aThread->readnum + 1 - $_conf['respointer'] - $_conf['before_respointer_new'];
        if ($from_num > $aThread->rescount) {
            $from_num = $aThread->rescount - $_conf['respointer'] - $_conf['before_respointer_new'];
        }
        if ($from_num < 1) {
            $from_num = 1;
        }
        //if (!$aThread->ls) {
        $aThread->ls = "{$from_num}-";
        //}
    }
    $aThread->lsToPoint();
    //==================================================================
    // ヘッダ 表示
    //==================================================================
    $motothre_url = $aThread->getMotoThread();
    $ttitle_en = base64_encode($aThread->ttitle);
    $ttitle_en_q = "&amp;ttitle_en=" . $ttitle_en;
    $bbs_q = "&amp;bbs=" . $aThread->bbs;
    $key_q = "&amp;key=" . $aThread->key;
    $popup_q = "&amp;popup=1";
    // require_once P2_LIB_DIR . '/read_header.inc.php';
    $prev_thre_num = $_newthre_num - 1;
    $next_thre_num = $_newthre_num + 1;
    if ($prev_thre_num != 0) {
        $prev_thre_ht = "<a href=\"#ntt{$prev_thre_num}\">▲</a>";
    }
    //$next_thre_ht = "<a href=\"#ntt{$next_thre_num}\">▼</a> ";
    $next_thre_ht = "<a class=\"button\" href=\"#ntt_bt{$_newthre_num}\">▼</a> ";
    $itaj_hs = htmlspecialchars($aThread->itaj, ENT_QUOTES);
    if ($spmode) {
        $read_header_itaj_ht = " ({$itaj_hs})";
    }
    P2Util::printInfoHtml();
    $read_header_ht = <<<EOP
        <p id="ntt{$_newthre_num}" name="ntt{$_newthre_num}"><font color="{$STYLE['read_k_thread_title_color']}"><b>{$aThread->ttitle_hd}</b></font>{$read_header_itaj_ht} {$next_thre_ht}</p>

EOP;
    //==================================================================
    // ローカルDatを読み込んでHTML表示
    //==================================================================
    $aThread->resrange['nofirst'] = true;
    $GLOBALS['newres_to_show_flag'] = false;
    if ($aThread->rescount) {
        //$aThread->datToHtml(); // dat を html に変換表示
        require_once P2_LIB_DIR . '/showthread.class.php';
        require_once P2_IPHONE_LIB_DIR . '/showthreadk.class.php';
        $aShowThread =& new ShowThreadK($aThread);
        $read_cont_ht .= $aShowThread->getDatToHtml();
        unset($aShowThread);
    }
    //==================================================================
    // フッタ 表示
    //==================================================================
    //include $read_footer_inc;
    //----------------------------------------------
    // $read_footer_navi_new  続きを読む 新着レスの表示
    $newtime = date("gis");
    // リンクをクリックしても再読込しない仕様に対抗するダミークエリー
    $info_st = "情";
    $delete_st = "削";
    $prev_st = "前";
    $next_st = "次";
    // 表示範囲
    if ($aThread->resrange['start'] == $aThread->resrange['to']) {
        $read_range_on = $aThread->resrange['start'];
    } else {
        $read_range_on = "{$aThread->resrange['start']}-{$aThread->resrange['to']}";
    }
    $read_range_ht = "{$read_range_on}/{$aThread->rescount}<br>";
    $read_footer_navi_new = "<a href=\"{$_conf['read_php']}?host={$aThread->host}{$bbs_q}{$key_q}&amp;ls={$aThread->rescount}-&amp;nt={$newtime}{$_conf['k_at_a']}#r{$aThread->rescount}\">新着レスの表\示</a>";
    if (!empty($_conf['disable_res'])) {
        $dores_ht = <<<EOP
          <a href="{$motothre_url}" target="_blank">レス</a>
EOP;
    } else {
        $dores_ht = <<<EOP
        <a href="post_form.php_i?host={$aThread->host}{$bbs_q}{$key_q}&amp;rescount={$aThread->rescount}{$ttitle_en_q}{$_conf['k_at_a']}">レス</a>
EOP;
    }
    // ツールバー部分HTML =======
    if ($spmode) {
        $toolbar_itaj_ht = <<<EOP
(<a href="{$_conf['subject_php']}?host={$aThread->host}{$bbs_q}{$key_q}{$_conf['k_at_a']}">{$itaj_hs}</a>)
EOP;
    }
    $toolbar_right_ht .= <<<EOTOOLBAR
            <a href="info.php_i?host={$aThread->host}{$bbs_q}{$key_q}{$ttitle_en_q}{$_conf['k_at_a']}">{$info_st}</a> 
            <a href="info.php_i?host={$aThread->host}{$bbs_q}{$key_q}{$ttitle_en_q}&amp;dele=true{$_conf['k_at_a']}">{$delete_st}</a> 
            <a href="{$motothre_url}">元スレ</a>

EOTOOLBAR;
    $read_footer_ht = <<<EOP
            <a class="button" id="backbutton"href="{$_conf['read_php']}?host={$aThread->host}{$bbs_q}{$key_q}&amp;offline=1&amp;rescount={$aThread->rescount}{$_conf['k_at_a']}#r{$aThread->rescount}">{$aThread->ttitle_hd}</a>
EOP;
    // 透明あぼーんや表示数制限で新しいレス表示がない場合はスキップ
    if ($GLOBALS['newres_to_show_flag']) {
        echo $read_header_ht;
        echo $read_cont_ht;
        echo $read_footer_ht;
    }
    //==================================================================
    // key.idxの値設定
    //==================================================================
    if ($aThread->rescount) {
        $aThread->readnum = min($aThread->rescount, max(0, $data[5], $aThread->resrange['to']));
        $newline = $aThread->readnum + 1;
        // $newlineは廃止予定だが、旧互換用に念のため
        $sar = array($aThread->ttitle, $aThread->key, $data[2], $aThread->rescount, $aThread->modified, $aThread->readnum, $data[6], $data[7], $data[8], $newline, $data[10], $data[11], $aThread->datochiok);
        P2Util::recKeyIdx($aThread->keyidx, $sar);
        // key.idxに記録
    }
    unset($aThread);
}
Ejemplo n.º 15
0
/**
 * スレッドの新着部分を読み込んで表示する
 *
 * @return  void
 */
function _readNew(&$aThread)
{
    global $_conf, $_newthre_num, $STYLE, $sid_q;
    $_newthre_num++;
    //==========================================================
    // idxの読み込み
    //==========================================================
    // hostを分解してidxファイルのパスを求める
    $aThread->setThreadPathInfo($aThread->host, $aThread->bbs, $aThread->key);
    // FileCtl::mkdirFor($aThread->keyidx); // 板ディレクトリが無ければ作る // この操作はおそらく不要
    $aThread->itaj = P2Util::getItaName($aThread->host, $aThread->bbs);
    if (!$aThread->itaj) {
        $aThread->itaj = $aThread->bbs;
    }
    // idxファイルがあれば読み込む
    if (file_exists($aThread->keyidx)) {
        $lines = file($aThread->keyidx);
        $data = explode('<>', rtrim($lines[0]));
    }
    $aThread->getThreadInfoFromIdx();
    // DATのダウンロード
    if (!(isset($GLOBALS['word']) && file_exists($aThread->keydat))) {
        $aThread->downloadDat();
    }
    // DATを読み込み
    $aThread->readDat();
    $aThread->setTitleFromLocal();
    // ローカルからタイトルを取得して設定
    // {{{ 表示レス番の範囲を設定
    // 取得済みなら
    if ($aThread->isKitoku()) {
        $from_num = $aThread->readnum + 1 - $_conf['respointer'] - $_conf['before_respointer_new'];
        if ($from_num > $aThread->rescount) {
            $from_num = $aThread->rescount - $_conf['respointer'] - $_conf['before_respointer_new'];
        }
        if ($from_num < 1) {
            $from_num = 1;
        }
        //if (!$aThread->ls) {
        $aThread->ls = "{$from_num}-";
        //}
    }
    $aThread->lsToPoint();
    // }}}
    //==================================================================
    // ヘッダ 表示
    //==================================================================
    $motothre_url = $aThread->getMotoThread();
    $ttitle_en = base64_encode($aThread->ttitle);
    $popup_q = "&amp;popup=1";
    // require_once P2_LIB_DIR . '/read_header.inc.php';
    $prev_thre_num = $_newthre_num - 1;
    $next_thre_num = $_newthre_num + 1;
    $prev_thre_ht = '';
    if ($prev_thre_num != 0) {
        $prev_thre_ht = "<a href=\"#ntt{$prev_thre_num}\">▲</a>";
    }
    $next_thre_ht = "<a href=\"#ntt{$next_thre_num}\">▼</a> ";
    // スマートポップアップメニュー
    if ($_conf['enable_spm']) {
        $aThread->showSmartPopUpMenuJs();
    }
    P2Util::printInfoHtml();
    // ヘッダ部分HTML
    $read_header_ht = <<<EOP
\t<table id="ntt{$_newthre_num}" class="toolbar" width="100%" style="padding:0px 10px 0px 0px;">
\t\t<tr>
\t\t\t<td align="left">
\t\t\t\t<h3 class="thread_title">{$aThread->ttitle_hs} </h3>
\t\t\t</td>
\t\t\t<td align="right">
\t\t\t\t{$prev_thre_ht}
\t\t\t\t{$next_thre_ht}
\t\t\t</td>
\t\t</tr>
\t</table>

EOP;
    //==================================================================
    // ローカルDatを読み込んでHTML表示
    //==================================================================
    $aThread->resrange['nofirst'] = true;
    $GLOBALS['newres_to_show_flag'] = false;
    if ($aThread->rescount) {
        // $aThread->datToHtml(); // dat を html に変換表示
        require_once P2_LIB_DIR . '/ShowThreadPc.php';
        $aShowThread = new ShowThreadPc($aThread);
        $res1 = $aShowThread->quoteOne();
        $read_cont_ht = $res1['q'];
        $read_cont_ht .= $aShowThread->getDatToHtml();
        unset($aShowThread);
    }
    //==================================================================
    // フッタ 表示
    //==================================================================
    // require_once P2_LIB_DIR . '/read_footer.inc.php';
    //----------------------------------------------
    // $read_footer_navi_new_ht  続きを読む 新着レスの表示
    $newtime = date("gis");
    // リンクをクリックしても再読込しない仕様に対抗するダミークエリー
    $info_st = "情報";
    $dele_st = "削除";
    $prev_st = "前";
    $next_st = "次";
    $thread_qs = array('host' => $aThread->host, 'bbs' => $aThread->bbs, 'key' => $aThread->key, UA::getQueryKey() => UA::getQueryValue());
    $sid_qs = array();
    if (defined('SID') && strlen(SID)) {
        $sid_qs[session_name()] = session_id();
    }
    /*
    $read_footer_navi_new_ht = P2View::tagA(
        UriUtil::buildQueryUri($_conf['read_php'],
            array_merge($thread_qs, array(
                'ls'   => "$aThread->rescount-",
                'nt'   => $newtime
            ))
        ) . '#r' . rawurlencode($aThread->rescount),
        '新着レスの表示'
    );
    */
    if ($_conf['disable_res']) {
        $dores_ht = P2View::tagA($motothre_url, '書込', array('target' => '_blank'));
    } else {
        $post_form_uri = UriUtil::buildQueryUri('post_form.php', array_merge($thread_qs, array('rescount' => $aThread->rescount, 'ttitle_en' => $ttitle_en)));
        $post_form_uri_hs = hs($post_form_uri);
        $post_from_openwin_uri = UriUtil::buildQueryUri('post_form.php', array_merge($thread_qs, array('rescount' => $aThread->rescount, 'ttitle_en' => $ttitle_en, 'popup' => '1', 'from_read_new' => '1'), $sid_qs));
        $post_from_openwin_uri_hs = hs($post_from_openwin_uri);
        $dores_ht = <<<EOP
        <a href="{$post_form_uri_hs}" target='_self' onClick="return !openSubWin('{$post_from_openwin_uri_hs}',{$STYLE['post_pop_size']},1,0)">書込</a>
EOP;
    }
    $dores_ht = '<span style="white-space: nowrap;">' . $dores_ht . '</span>';
    // ツールバー部分HTML =======
    // お気にマーク設定
    $favmark = !empty($aThread->fav) ? '★' : '+';
    $favvalue = !empty($aThread->fav) ? 0 : 1;
    $favtitle = $favvalue ? 'お気にスレに追加' : 'お気にスレから外す';
    $setfav_q = '&amp;setfav=' . $favvalue;
    $itaj_hs = hs($aThread->itaj);
    $similar_qs = array('detect_hint' => '◎◇', 'itaj_en' => base64_encode($aThread->itaj), 'method' => 'similar', 'word' => $aThread->ttitle_hc);
    $b_qs = array(UA::getQueryKey() => UA::getQueryValue());
    $info_qs = array_merge($thread_qs, $b_qs, array('ttitle_en' => $ttitle_en));
    $ita_atag = P2View::tagA(UriUtil::buildQueryUri($_conf['subject_php'], array_merge($thread_qs, $b_qs)), hs($aThread->itaj), array('style' => 'white-space: nowrap;', 'target' => 'subject', 'title' => '板を開く'));
    $similar_atag = P2View::tagA(UriUtil::buildQueryUri($_conf['subject_php'], array_merge($similar_qs, $thread_qs, $b_qs, array('refresh' => 1))), hs('似スレ'), array('style' => 'white-space: nowrap;', 'target' => 'subject', 'title' => '同じ板からタイトルが似ているスレッドを検索する'));
    $info_url = UriUtil::buildQueryUri('info.php', $info_qs);
    $info_url_hs = hs($info_url);
    $info_hs = hs($info_st);
    $js_q_hs = hs(UriUtil::buildQuery(array_merge($info_qs, $sid_qs)));
    $motothre_atag = P2View::tagA($motothre_url, '元スレ', array('style' => 'white-space: nowrap;', 'title' => '板サーバ上のオリジナルスレを表\示'));
    $toolbar_right_ht = <<<EOTOOLBAR
            {$ita_atag}
            {$similar_atag}

\t\t<a style="white-space: nowrap;" href="{$info_url_hs}" target="info" onClick="return !openSubWin('{$info_url_hs}{$popup_q}{$sid_q}',{$STYLE['info_pop_size']},0,0)" title="スレッド情報を表\示">{$info_hs}</a>

\t\t<span class="setfav" style="white-space: nowrap;"><a href="{$info_url_hs}{$setfav_q}{$sid_q}" target="info" onClick="return setFavJs('{$js_q_hs}', '{$favvalue}', {$STYLE['info_pop_size']}, 'read_new', this);" title="{$favtitle}">お気に{$favmark}</a></span>

\t\t<span style="white-space: nowrap;"><a href="{$info_url_hs}&amp;dele=1" target="info" onClick="return !deleLog('{$js_q_hs}', {$STYLE['info_pop_size']}, 'read_new',  this);" title="ログを削除する。自動で「お気にスレ」「殿堂」からも外れます。">{$dele_st}</a></span>

<!--\t\t<a style="white-space: nowrap;" href="{$info_url_hs}&amp;taborn=2" target="info" onClick="return !openSubWin('{$info_url_hs}&amp;popup=2&amp;taborn=2{$sid_q}',{$STYLE['info_pop_size']},0,0)" title="スレッドのあぼーん状態をトグルする">あぼん</a> -->

\t\t{$motothre_atag}
EOTOOLBAR;
    // レスのすばやさ
    $spd_ht = "";
    if ($spd_st = $aThread->getTimePerRes() and $spd_st != "-") {
        $spd_ht = '<span class="spd" style="white-space: nowrap;" title="すばやさ=時間/レス">' . $spd_st . '</span>';
    }
    // フッタ部分HTML
    $read_atag = P2View::tagA(UriUtil::buildQueryUri($_conf['read_php'], array_merge($thread_qs, array('offline' => '1', 'rescount' => $aThread->rescount))) . '#r' . rawurlencode($aThread->rescount), hs($aThread->ttitle_hc));
    $read_footer_ht = <<<EOP
\t<table class="toolbar" width="100%" style="padding:0px 10px 0px 0px;">
\t\t<tr>
\t\t\t<td align="left">
\t\t\t\t{$res1['body']} | {$read_atag} | {$dores_ht} {$spd_ht}
\t\t\t</td>
\t\t\t<td align="right">
\t\t\t\t{$toolbar_right_ht}
\t\t\t</td>
\t\t\t<td align="right">
\t\t\t\t<a href="#ntt{$_newthre_num}">▲</a>
\t\t\t</td>
\t\t</tr>
\t</table>

EOP;
    // 透明あぼーんで表示がない場合はスキップ
    if ($GLOBALS['newres_to_show_flag']) {
        echo '<div style="width:100%;">' . "\n";
        // ほぼIE ActiveXのGray()のためだけに囲ってある
        echo $read_header_ht;
        echo $read_cont_ht;
        echo $read_footer_ht;
        echo '</div>' . "\n\n";
        echo '<hr>' . "\n\n";
    }
    // key.idx の値設定
    if ($aThread->rescount) {
        $aThread->readnum = min($aThread->rescount, max(0, $data[5], $aThread->resrange['to']));
        $newline = $aThread->readnum + 1;
        // $newlineは廃止予定だが、後方互換用に念のため
        $sar = array($aThread->ttitle, $aThread->key, $data[2], $aThread->rescount, $aThread->modified, $aThread->readnum, $data[6], $data[7], $data[8], $newline, $data[10], $data[11], $aThread->datochiok);
        P2Util::recKeyIdx($aThread->keyidx, $sar);
        // key.idx に記録
    }
    unset($aThread);
}