<?php
/*
    p2 - スレッド表示スクリプト - 新着まとめ読み（携帯）
    フレーム分割画面、右下部分
*/

require_once './conf/conf.inc.php';

require_once P2_LIB_DIR . '/ThreadList.php';
require_once P2_LIB_DIR . '/Thread.php';
require_once P2_LIB_DIR . '/ThreadRead.php';
require_once P2_LIB_DIR . '/NgAbornCtl.php';
require_once P2_LIB_DIR . '/read_new.funcs.php';
require_once P2_LIB_DIR . '/P2Validate.php';

$_login->authorize(); // ユーザ認証

// {{{ 新着まとめよみのキャッシュ読み

if (!empty($_GET['cview'])) {
    $cnum = isset($_GET['cnum']) ? intval($_GET['cnum']) : NULL;
    if ($cont = getMatomeCache($cnum)) {
        echo $cont;
    } else {
        echo 'p2 error: 新着まとめ読みのキャッシュがないよ';
    }
    exit;
}

// }}}

//==================================================================
// 変数
//==================================================================
$GLOBALS['rnum_all_range'] = $_conf['i_rnum_range'];

$GLOBALS['word'] = null;

$sb_view = "shinchaku";
$newtime = date("gis");

$host   = geti($_GET['host'],   geti($_POST['host']));
$bbs    = geti($_GET['bbs'],    geti($_POST['bbs']));
$spmode = geti($_GET['spmode'], geti($_POST['spmode']));

if ((!$host || !isset($bbs)) && !isset($spmode)) {
    p2die('必要な引数が指定されていません');
}

if (
    $host && P2Validate::host($host)
    || $bbs && P2Validate::bbs($bbs)
    || $spmode && P2Validate::spmode($spmode)
) {
    p2die('不正な引数です');
}

$hr = P2View::getHrHtmlK();

$_newthre_num = 0;

//====================================================================
// メイン
//====================================================================

register_shutdown_function('saveMatomeCache');

$GLOBALS['_read_new_html'] = '';
ob_start();

$aThreadList = new ThreadList;

// 板とモードのセット
if ($spmode) {
    if ($spmode == "taborn" or $spmode == "soko") {
        $aThreadList->setIta($host, $bbs, P2Util::getItaName($host, $bbs));
    }
    $aThreadList->setSpMode($spmode);

} else {
    $aThreadList->setIta($host, $bbs, P2Util::getItaName($host, $bbs));

    // スレッドあぼーんリスト読込
    $ta_keys = P2Util::getThreadAbornKeys($host, $bbs);
    $ta_num = sizeOf($ta_keys);
}

// ソースリスト読込
$lines = $aThreadList->readList();

// ページヘッダ表示 ===================================
$ptitle_ht = sprintf('%s の 新着まとめ読み', hs($aThreadList->ptitle));

$ptitle_uri = UriUtil::buildQueryUri($_conf['subject_php'],
    array(
        'host'   => $aThreadList->host,
        'bbs'    => $aThreadList->bbs,
        'spmode' => $aThreadList->spmode,
        UA::getQueryKey() => UA::getQueryValue()
    )
);

$ptitle_atag = P2View::tagA(
    $ptitle_uri,
    hs($aThreadList->ptitle),
    array('class' => 'tbutton itaButton longitaButton')
);

$ptitle_btm_atag = P2View::tagA(
    $ptitle_uri,
    hs($aThreadList->ptitle),
    array(
        $_conf['accesskey_for_k'] => $_conf['k_accesskey']['up']
    )
);

$body_at = '';
//$body_at = P2View::getBodyAttrK();

/*
// ページヘッダ表示 ===================================
$ptitle_hs = hs($aThreadList->ptitle);
$ptitle_ht = "{$ptitle_hs} の 新着まとめ読み";

// &amp;sb_view={$sb_view}
if ($aThreadList->spmode) {
    $sb_ht = <<<EOP
        <a href="{$_conf['subject_php']}?host={$aThreadList->host}&amp;bbs={$aThreadList->bbs}&amp;spmode={$aThreadList->spmode}{$_conf['k_at_a']}">{$ptitle_hs}</a>
EOP;
    $sb_ht_btm = <<<EOP
        <a href="{$_conf['subject_php']}?host={$aThreadList->host}&amp;bbs={$aThreadList->bbs}&amp;spmode={$aThreadList->spmode}{$_conf['k_at_a']}">{$ptitle_hs}</a>
EOP;
} else {
    $sb_ht = <<<EOP
        <a href="{$_conf['subject_php']}?host={$aThreadList->host}&amp;bbs={$aThreadList->bbs}{$_conf['k_at_a']}">{$ptitle_hs}</a>
EOP;
    $sb_ht_btm = <<<EOP
        <a href="{$_conf['subject_php']}?host={$aThreadList->host}&amp;bbs={$aThreadList->bbs}{$_conf['k_at_a']}">{$ptitle_hs}</a>
EOP;
}
*/

// ========================================================
// require_once P2_LIB_DIR . '/read_header.inc.php';

P2View::printDoctypeTag();
?>
<html>
<head>
<?php
P2View::printExtraHeadersHtml();

?><script type="text/javascript" src="js/delelog.js?v=20130612"></script><?php
/*
    <script type="text/javascript" src="js/respopup.js?v=20061206"></script>
    <script type="text/javascript" src="js/setfavjs.js?v=20090428"></script>
*/

$onload_script = '';

?>
	<script type="text/javascript" src="js/basic.js?2012"></script>
	<script type="text/javascript" src="iphone/js/respopup.iPhone.js?v=20090429"></script>
	<script type="text/javascript" src="iphone/js/setfavjs.js?v=20090428"></script>
	<script type="text/javascript" src="iphone/js/iphone.js?2013060918"></script>
	<script type="text/javascript" src="iphone/js/smartpopup.iPhone.js?v=20130612"></script>
	<script type="text/javascript"> 
	<!--
	gExistWord = false;

	// iPhoneのURL編集部分を表示しないようスクロールする
	window.onload = function() { 
		setTimeout(scrollTo, 100, 0, 1);
		initIPhoneGestures();
	}

	// ページ読み込み完了時コールバック関数
	gIsPageLoaded = false;
	addLoadEvent(function() {			// basic.jsのメソッド
		gIsPageLoaded = true;			// ページロード完了フラグ(trueじゃないとお気に入り変更javascriptが動かない)
		{$onload_script}				// ページ読み込み完了時に実行するスクリプト群
	});

	// レス範囲のフォームの内容をリセットしてからページ移行するメソッド
	var onArreyt = 2;
	function formReset() {
		var uriValue = "<?php echo $_conf['read_php']; ?>?"
					 + "offline=1&"
					<?php if (UA::getQueryValue()) { ?>
					 + "<?php echo UA::getQueryKey(); ?>=<?php echo UA::getQueryValue(); ?>&"
					<?php } ?>
					 + "host=" + document.frmresrange.host.value + "&"
					 + "bbs=" + document.frmresrange.bbs.value + "&"
					 + "key=" + document.frmresrange.key.value + "&"
					 + "rescount=" + document.frmresrange.rescount.value + "&"
					 + "ttitle_en=" + document.frmresrange.ttitle_en.value + "&"
					 + "ls=" + document.frmresrange.ls.value + "&";
		//document.frmresrange.reset();
		window.location.assign(uriValue);
	}
	// --> 
	</script>
<?php // ここでは iui.css は読んでいないことに注意  ?>
<link rel="stylesheet" type="text/css" href="./iui/smartphone.css?20140114">
<link rel="stylesheet" type="text/css" href="./iui/read.css?20140114">
<?php

echo "<title>{$ptitle_ht}</title>";
echo <<<EOP
</head>
<body{$body_at}>\n
EOP;

$index_uri = UriUtil::buildQueryUri('index.php', array(UA::getQueryKey() => UA::getQueryValue()));

?>
<p><a id="backButton" class="tbutton" href="<?php eh($index_uri); ?>">TOP</a></p>
<?php echo $ptitle_atag; ?>
<div class="toolbar"><h1 class="pageTitle noShinMatome">の新着まとめ読み</h1></div>
<?php
P2Util::printInfoHtml();

//==============================================================
// それぞれの行解析
//==============================================================

$online_num = 0;

$linesize = sizeof($lines);

for ($x = 0; $x < $linesize; $x++) {

    if (isset($GLOBALS['rnum_all_range']) and $GLOBALS['rnum_all_range'] <= 0) {
        break;
    }

    $l = $lines[$x];
    $aThread = new ThreadRead;
    
    $aThread->torder = $x + 1;

    // ラインデータ読み込み
    $aThread->setThreadInfoFromLineWithThreadList($l, $aThreadList, $setItaj = false);
    
    // hostもbbsも不明ならスキップ
    if (!($aThread->host && $aThread->bbs)) {
        unset($aThread);
        continue;
    }
    
    $aThread->setThreadPathInfo($aThread->host, $aThread->bbs, $aThread->key);
    $aThread->getThreadInfoFromIdx(); // 既得スレッドデータをidxから取得
    //$aThread->readDatInfoFromFile();
    
    // 新着のみ(for subject)
    if (!$aThreadList->spmode and $sb_view == "shinchaku" and !isset($GLOBALS['word'])) { 
        if ($aThread->unum < 1) {
            unset($aThread);
            continue;
        }
    }

    // スレッドあぼーんチェック
    if ($aThreadList->spmode != "taborn" and !empty($ta_keys[$aThread->key])) { 
        unset($ta_keys[$aThread->key]);
        continue; // あぼーんスレはスキップ
    }

    // spmode(殿堂入りを除く)なら ====================================
    if ($aThreadList->spmode && $sb_view != 'edit') { 
        
        // subject.txtが未DLなら落としてデータを配列に格納
        if (empty($subject_txts) || !array_key_exists("$aThread->host/$aThread->bbs", $subject_txts)) {

            require_once P2_LIB_DIR . '/SubjectTxt.php';
            $aSubjectTxt = new SubjectTxt($aThread->host, $aThread->bbs);

            $subject_txts["$aThread->host/$aThread->bbs"] = $aSubjectTxt->subject_lines;
        }
        
        // スレ情報取得
        if ($subject_txts["$aThread->host/$aThread->bbs"]) {
            foreach ($subject_txts["$aThread->host/$aThread->bbs"] as $l) {
                if (preg_match("/^{$aThread->key}/", $l)) {
                    $aThread->setThreadInfoFromSubjectTxtLine($l); // subject.txt からスレ情報取得
                    break;
                }
            }
        }
        
        // 新着のみ(for spmode)
        if ($sb_view == 'shinchaku' and !isset($GLOBALS['word'])) {
            if ($aThread->unum < 1) {
                unset($aThread);
                continue;
            }
        }
    }
    
    if ($aThread->isonline) { $online_num++; } // 生存数set
    
    P2Util::printInfoHtml();
    
    $GLOBALS['_read_new_html'] .= ob_get_flush();
    ob_start();
    
    if (($aThread->readnum < 1) || $aThread->unum) {
         if (!isset($GLOBALS['_read_new_i_order'])) {
            $GLOBALS['_read_new_i_order'] = 1;
         } else {
            $GLOBALS['_read_new_i_order']++;
         }
         if ($GLOBALS['_read_new_i_order'] > 1) {
            echo "{$hr}\n";
         }
        _readNew($aThread);
    } elseif ($aThread->diedat) {
        echo $aThread->getdat_error_msg_ht;
        echo "{$hr}\n";
    }
    
    $GLOBALS['_read_new_html'] .= ob_get_flush();
    ob_start();
    
    // リストに追加
    // $aThreadList->addThread($aThread);
    $aThreadList->num++;
    unset($aThread);
}

//$aThread = new ThreadRead();

/**
 * スレッドの新着部分を読み込んで表示する
 */
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_i'] - $_conf['before_respointer_new_i'];
        if ($from_num > $aThread->rescount) {
            $from_num = $aThread->rescount - $_conf['respointer_i'] -  $_conf['before_respointer_new_i'];
        }
        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>";
    }
    $anchorId = "ntt_bt{$_newthre_num}"; // ntt{$next_thre_num}
    $next_thre_ht = "<a href=\"#{$anchorId}\">▼</a> ";
    //$next_thre_ht = "<a class=\"tbutton buttonW\" href=\"#{$anchorId}\">▼</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
	<div id="ntt{$_newthre_num}" name="ntt{$_newthre_num}" class="thread_title"><span class="thread_title"><b>{$ttitle_hs}</b></span>{$read_header_itaj_ht} {$next_thre_ht}</div>\n
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');
        }
    }
    
    $dele_atag = _getDeleATag($aThread, $dele_st);
    
    /*
    $info_atag = _getInfoATag($aThread, $info_st);
    $motothre_atag = P2View::tagA($motothre_url, '元ｽﾚ')
    $toolbar_right_ht = "{$info_atag} {$dele_atag} {$motothre_atag}\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->readnum, $data[6], $data[7], $data[8], $newline,
            $data[10], $data[11], $aThread->datochiok
        );
        P2Util::recKeyIdx($aThread->keyidx, $sar); // key.idxに記録
    }
    
    // }}}
    
    $read_atag = _getReadATag($aThread);

    $read_footer_ht = <<<EOP
		<div class="read_new_thre_footer" id="ntt_bt{$_newthre_num}" name="ntt_bt{$_newthre_num}">
			$read_range_ht 
			$read_atag{$toolbar_itaj_ht} 
			<span style="white-space: nowrap;">[<span>$dele_atag</span>]</span>
			<a href="#ntt{$_newthre_num}">▲</a>
		</div>
EOP;

    // 透明あぼーんや表示数制限で新しいレス表示がない場合はスキップ
    if ($GLOBALS['newres_to_show_flag']) {
        echo $read_header_ht;
        echo $read_cont_ht;
        echo $hr;
        echo $read_footer_ht;
    }
    
    unset($aThread);
}

//==================================================================
// ページフッタ HTML表示
//==================================================================
$_newthre_num++;

if (!$aThreadList->num) {
    $GLOBALS['_is_matome_shinchaku_naipo'] = true;
    ?><br><div>新着レスはないぽ</div><br><?php
    echo P2View::getMatomeCacheLinksHtml();
}

?>
<div id="footToolbar" class="footbar">
<span class="home"><a name="ntt_bt1" href="<?php eh($index_uri); ?>">TOP</a></span>
<span class="other" id="etcButoon" title="off"><a onclick="popUpFootbarFormIPhone(2);">その他</a></span>
<?php
if (!isset($GLOBALS['rnum_all_range']) or $GLOBALS['rnum_all_range'] > 0 or !empty($GLOBALS['_is_eq_limit_to_and_to'])) {
    if (!empty($GLOBALS['_is_eq_limit_to_and_to'])) {
        $str = '新着まとめの更新or続き';
    } else {
        $str = '新まとめを更新';
    }
    ?><span class="next_disabled"></span><?php
    echo <<<EOP
	<span class="new"><a href="{$_conf['read_new_k_php']}?host={$aThreadList->host}&bbs={$aThreadList->bbs}&spmode={$aThreadList->spmode}&nt={$newtime}{$_conf['k_at_a']}">{$str}</a></span>
EOP;
} else {
    echo <<<EOP
	<span class="next"><a href="{$_conf['read_new_k_php']}?host={$aThreadList->host}&bbs={$aThreadList->bbs}&spmode={$aThreadList->spmode}&nt={$newtime}&amp;norefresh=1{$_conf['k_at_a']}">新まとめの続き</a></span>
EOP;
    ?><span class="new_disabled"></span><?php

}
//{$sb_ht_btm}の
//echo '<hr>' . P2View::getBackToIndexKATag() . "\n";
//iphone 080801
?>
</div>

<?php // 「その他」のポップアップメニュー ?>
<div id="footbarEtc">
<filedset>
 <ul>
 <li class="whiteButton"><?php echo $ptitle_btm_atag; ?></li> 
 <li class="grayButton" onclick="popUpFootbarFormIPhone(2,1);">キャンセル</li>
 </ul>
</filedset>
</div>

</body></html>
<?php
$GLOBALS['_read_new_html'] .= ob_get_flush();

// 後処理

// NGあぼーんを記録
NgAbornCtl::saveNgAborns();

exit;


//==========================================================================
// 関数（このファイル内でのみ利用）
//==========================================================================
/**
 * @return  string  HTML
 */
function _getItaATag($aThread)
{
    return $ita_atag = P2View::tagA(
        UriUtil::buildQueryUri(
            $GLOBALS['_conf']['subject_php'],
            array(
                'host' => $aThread->host,
                'bbs'  => $aThread->bbs,
                //'key'  => $aThread->key,
                UA::getQueryKey() => UA::getQueryValue()
            )
        ),
        hs($aThread->itaj)
    );
}

/**
 * @return  string  HTML
 */
function _getReadATag($aThread)
{
    global $_conf;
    
    $ttitle_hs = hs($aThread->ttitle_hc);
    if ($_conf['k_save_packet']) {
        $ttitle_hs = mb_convert_kana($ttitle_hs, 'rnsk');
    }
    
    return $read_atag = P2View::tagA(
        UriUtil::buildQueryUri(
            $_conf['read_php'],
            array(
                'host' => $aThread->host,
                'bbs'  => $aThread->bbs,
                'key'  => $aThread->key,
                'offline' => '1',
                'rescount' => $aThread->rescount,
                UA::getQueryKey() => UA::getQueryValue(),
                'jsanc' => 'r' . max(0, min($aThread->rescount, $aThread->readnum + 1) - $_conf['respointer_i'])
            )
        ),
        // iPhoneのポップアップで予期せぬアンカー移動が生じる問題を回避するためにコメントアウト
        // . '#r' . rawurlencode($aThread->rescount),
        $ttitle_hs
    );
}

/**
 * @return  string  HTML
 */
/*
function _getInfoATag($aThread, $info_st)
{
    return $info_atag = P2View::tagA(
        UriUtil::buildQueryUri(
            'info.php',
            array(
                'host' => $aThread->host,
                'bbs'  => $aThread->bbs,
                'key'  => $aThread->key,
                'ttitle_en' => base64_encode($aThread->ttitle),
                UA::getQueryKey() => UA::getQueryValue()
            ),
            hs($info_st)
        )
    );
}
*/

/**
 * @return  string  HTML
 */
function _getDeleATag($aThread, $dele_st)
{
    global $STYLE;
    
    //<span style="white-space: nowrap;"></span>
    
    $info_qs = array(
        'host' => $aThread->host,
        'bbs'  => $aThread->bbs,
        'key'  => $aThread->key,
        'ttitle_en' => base64_encode($aThread->ttitle),
        UA::getQueryKey() => UA::getQueryValue()
    );
    
    $sid_qs = array();
    if (defined('SID') && strlen(SID)) {
        $sid_qs[session_name()] = session_id();
    }
    
    $infoJs_query = UriUtil::buildQuery(array_merge($info_qs, $sid_qs));
    $infoJs_query_es = str_replace("'", "\\'", $infoJs_query);
    
    return $dele_atag = P2View::tagA(
        UriUtil::buildQueryUri(
            'info_i.php',
            array_merge($info_qs, array('dele' => '1'))
        ),
        hs($dele_st),
        array(
            'onClick' => "return !deleLog('{$infoJs_query_es}', {$STYLE['info_pop_size']}, 'read_new_i',  this);",
            'title' => "ログを削除する。自動で「お気にスレ」「殿堂」からも外れます。",
            'target' => 'info'
        )
    );
}

/**
 * @return  string  HTML
 */
/*
function _getDoResATag($aThread, $motothre_url)
{
    global $_conf;
    
    if (!empty($_conf['disable_res'])) {
        $dores_atag = P2View::tagA($motothre_url, '書', array('target' => '_blank'));
    } else {
        $dores_atag = P2View::tagA(
            UriUtil::buildQueryUri(
                'post_form.php',
                array(
                    'host' => $aThread->host,
                    'bbs'  => $aThread->bbs,
                    'key'  => $aThread->key,
                    'rescount' => $aThread->rescount,
                    'ttitle_en' => base64_encode($aThread->ttitle),
                    UA::getQueryKey() => UA::getQueryValue()
                )
            ),
            '書'
        );
    }
    return $dores_atag;
}
*/


/*
 * Local Variables:
 * mode: php
 * coding: cp932
 * tab-width: 4
 * c-basic-offset: 4
 * indent-tabs-mode: nil
 * End:
 */
// vim: set syn=php fenc=cp932 ai et ts=4 sw=4 sts=4 fdm=marker:
