Ejemplo n.º 1
0
/**
 * 新着まとめ読み <a>
 *
 * @return  string  HTML
 */
function getShinchakuMatomeATag($aThreadList, $shinchaku_num)
{
    global $_conf;
    static $upper_toolbar_done_ = false;
    $shinchaku_matome_atag = '';
    // 倉庫なら新着まとめのリンクはなし
    if ($aThreadList->spmode == 'soko') {
        return $shinchaku_matome_atag = '';
    }
    $attrs = array();
    if (UA::isIPhoneGroup()) {
        $attrs['class'] = 'button';
    }
    // 上下あるツールバーの下だけにアクセスキーをつける
    if ($upper_toolbar_done_) {
        $attrs[$_conf['accesskey_for_k']] = $_conf['k_accesskey']['matome'];
    }
    $upper_toolbar_done_ = true;
    $qs = array('host' => $aThreadList->host, 'bbs' => $aThreadList->bbs, 'spmode' => $aThreadList->spmode, 'nt' => date('gis'), UA::getQueryKey() => UA::getQueryValue());
    $label = "{$_conf['k_accesskey']['matome']}.新まとめ";
    if ($shinchaku_num) {
        $shinchaku_matome_atag = P2View::tagA(UriUtil::buildQueryUri($_conf['read_new_k_php'], array_merge($qs, array('norefresh' => '1'))), hs("{$label}({$shinchaku_num})"), $attrs);
    } else {
        $shinchaku_matome_atag = P2View::tagA(UriUtil::buildQueryUri($_conf['read_new_k_php'], $qs), hs($label), $attrs);
    }
    return $shinchaku_matome_atag;
}
Ejemplo n.º 2
0
/**
 * @access  public
 * @return  string  HTML
 */
function getSbToolbarShinchakuMatomeHtml($aThreadList, $shinchaku_num)
{
    global $_conf;
    static $new_matome_i_ = 0;
    $new_matome_i_++;
    $shinchaku_matome_ht = '';
    // 倉庫でなければ
    if ($aThreadList->spmode != 'soko') {
        $shinchaku_num_ht = '';
        if ($shinchaku_num) {
            $shinchaku_num_ht = " (<span id=\"smynum{$new_matome_i_}\" class=\"matome_num\">{$shinchaku_num}</span>)";
        }
        $shinchaku_matome_ht = P2View::tagA(UriUtil::buildQueryUri($_conf['read_new_php'], array('host' => $aThreadList->host, 'bbs' => $aThreadList->bbs, 'spmode' => $aThreadList->spmode, 'norefresh' => 1, 'nt' => date('gis'), UA::getQueryKey() => UA::getQueryValue())), '新着まとめ読み' . $shinchaku_num_ht, array('id' => "smy{$new_matome_i_}", 'class' => 'matome', 'onClick' => 'chNewAllColor();'));
    }
    return $shinchaku_matome_ht;
}
Ejemplo n.º 3
0
/**
 * ファイル内容を読み込んで表示する関数
 *
 * @return  void
 */
function viewTxtFile($file, $encode)
{
    global $_info_msg_ht;
    if ($file == '') {
        die('Error: file が指定されていません');
    }
    $filename = basename($file);
    $ptitle = $filename;
    $cont = file_get_contents($file);
    if ($encode == "EUC-JP") {
        $cont = mb_convert_encoding($cont, 'SJIS-win', 'eucJP-win');
    }
    $cont_area = htmlspecialchars($cont, ENT_QUOTES);
    // HTMLプリント
    ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="ja">
<head>
<?php 
    P2View::printExtraHeadersHtml();
    ?>
	<title><?php 
    eh($ptitle);
    ?>
</title>
</head>
<body onLoad="top.document.title=self.document.title;">
<?php 
    P2Util::printInfoHtml();
    ?>
<pre>
<?php 
    echo $cont_area;
    ?>
</pre>
</body></html>
<?php 
}
Ejemplo n.º 4
0
/**
 * 旧スタイルの携帯ビュー変数 $_conf['ktai'] 等をセット
 *
 * @return  void
 */
function _setOldStyleKtaiQuery()
{
    global $_conf;
    $b = UA::getQueryKey();
    // ?k=1は旧仕様。?b=kが新しい。
    // 後方互換用措置
    if (!empty($_GET['k']) || !empty($_POST['k'])) {
        $_REQUEST[$b] = $_GET[$b] = 'k';
    }
    // $_conf[$b]($_conf['b']) も使わないようにして、UA::getQueryValue()を利用する方向。
    $_conf[$b] = UA::getQueryValue();
    // $_conf['ktai'] は使わない方向。
    // UA::isK(), UA::isPC() を利用する。
    // 強制PCビュー指定(b=pc)
    if (UA::isPCByQuery()) {
        $_conf['ktai'] = false;
        // 強制携帯ビュー指定(b=k)
    } elseif (UA::isMobileByQuery()) {
        $_conf['ktai'] = true;
    }
    // ↓k_at_a, k_at_q, k_input_ht は使わない方向。
    // UA::getQueryKey(), UA::getQueryValue(), P2View::getInputHiddenKTag() を利用する。
    $_conf['k_at_a'] = '';
    $_conf['k_at_q'] = '';
    $_conf['k_input_ht'] = '';
    if ($_conf[$b]) {
        //output_add_rewrite_var($b, htmlspecialchars($_conf[$b], ENT_QUOTES));
        $b_hs = hs($_conf[$b]);
        $_conf['k_at_a'] = "&amp;{$b}={$b_hs}";
        $_conf['k_at_q'] = "?{$b}={$b_hs}";
        $_conf['k_input_ht'] = P2View::getInputHiddenKTag();
    }
}
Ejemplo n.º 5
0
/**
 *  p2 - 最初のログイン画面をHTML表示する関数
 *
 * @access  public
 * @return  void
 */
function printLoginFirst(&$_login)
{
    global $STYLE, $_conf;
    global $_login_failed_flag, $_p2session;
    // データ保存ディレクトリに書き込み権限がなければ注意を表示セットする
    P2Util::checkDirsWritable(array($_conf['dat_dir'], $_conf['idx_dir'], $_conf['pref_dir']));
    // 前処理
    $_login->cleanInvalidAuthUserFile();
    clearstatcache();
    // 外部からの変数
    $post['form_login_id'] = isset($_POST['form_login_id']) ? $_POST['form_login_id'] : null;
    $post['form_login_pass'] = isset($_POST['form_login_pass']) ? $_POST['form_login_pass'] : null;
    //=========================================================
    // 書き出し用変数
    //=========================================================
    if (UA::isIPhoneGroup()) {
        $ptitle = $_conf['p2name'] . 'iPhone';
    } else {
        $ptitle = $_conf['p2name'];
    }
    $ptitle_ht = hs($ptitle);
    if (!empty($GLOBALS['brazil'])) {
        $ptitle_ht = 'p2.2ch.net';
        if (!(UA::isK() || UA::isIPhoneGroup())) {
            $ptitle_ht = '<a href="http://p2.2ch.net/">' . $ptitle_ht . '</a>';
        }
    }
    $myname = basename($_SERVER['SCRIPT_NAME']);
    $body_ht = '';
    $show_login_form_flag = false;
    $p_str = array('user' => 'ユーザ', 'password' => 'パスワード');
    if (!empty($GLOBALS['brazil'])) {
        $p_str['user'] = '******';
    }
    // 携帯用表示文字列全角→半角変換
    if (!UA::isIPhoneGroup() && UA::isK() && function_exists('mb_convert_kana')) {
        foreach ($p_str as $k => $v) {
            $p_str[$k] = mb_convert_kana($v, 'rnsk');
        }
    }
    // 補助認証
    require_once P2_LIB_DIR . '/HostCheck.php';
    $mobile = Net_UserAgent_Mobile::singleton();
    $auth_sub_input_ht = _getAuthSubInputHtml($mobile);
    // ログインフォームからの指定
    $form_login_id_hs = '';
    if ($_login->validLoginId($_login->user_u)) {
        $form_login_id_hs = hs($_login->user_u);
    } elseif ($_login->validLoginId($post['form_login_id'])) {
        $form_login_id_hs = hs($post['form_login_id']);
    }
    $form_login_pass_hs = '';
    if ($_login->validLoginPass($post['form_login_pass'])) {
        $form_login_pass_hs = hs($post['form_login_pass']);
    }
    // docomoの固有端末認証(セッション利用時のみ有効)
    $docomo_utn_ht = '';
    //if ($_conf['use_session'] && $_login->user_u && $mobile->isDoCoMo()) {
    if ($_conf['use_session'] && $mobile->isDoCoMo()) {
        $uri = $myname . '?guid=ON&user='******'<p><a href="' . hs($uri) . '" utn>docomo固有端末認証</a></p>';
    }
    // docomoならリトライ時にパスワード入力を password → text とする
    // (docomoはpassword入力が完全マスクされるUIで、入力エラーがわかりにく過ぎる)
    if (isset($post['form_login_pass']) and $mobile->isDoCoMo()) {
        $type = "text";
    } else {
        $type = "password";
    }
    // {{{ ログイン用フォームを生成
    $ruri = $_SERVER['REQUEST_URI'];
    if (UA::isDoCoMo()) {
        $ruri = UriUtil::addQueryToUri($ruri, array('guid' => 'ON'));
    }
    $REQUEST_URI_hs = hs($ruri);
    if (!empty($GLOBALS['brazil']) or file_exists($_conf['auth_user_file'])) {
        $submit_ht = '<input type="submit" name="submit_userlogin" value="ユーザログイン">';
    } else {
        $submit_ht = '<input type="submit" name="submit_newuser" value="新規登録">';
    }
    $login_form_ht = <<<EOP
{$docomo_utn_ht}
<form id="login" method="POST" action="{$REQUEST_URI_hs}" target="_self" utn>
    {$_conf['k_input_ht']}
    {$p_str['user']}: <input type="text" name="form_login_id" value="{$form_login_id_hs}" istyle="3" size="32" autocorrect="off" autocapitalize="off"><br>
    {$p_str['password']}: <input type="{$type}" name="form_login_pass" value="{$form_login_pass_hs}" istyle="3" autocorrect="off" autocapitalize="off"><br>
    {$auth_sub_input_ht}
    <br>
    {$submit_ht}
</form>

EOP;
    // }}}
    //=================================================================
    // 新規ユーザ登録処理
    //=================================================================
    $isAllowedNewUser = empty($GLOBALS['brazil']) ? true : false;
    if ($isAllowedNewUser and !file_exists($_conf['auth_user_file']) && !$_login_failed_flag and !empty($_POST['submit_newuser']) && $post['form_login_id'] && $post['form_login_pass']) {
        // {{{ 入力エラーをチェック、判定
        if (!$_login->validLoginId($post['form_login_id']) || !$_login->validLoginPass($post['form_login_pass'])) {
            P2Util::pushInfoHtml(sprintf('<p class="infomsg">p2 error: 「%s」名と「%s」は半角英数字で入力して下さい。</p>', hs($p_str['user']), hs($p_str['password'])));
            $show_login_form_flag = true;
            // }}}
            // {{{ 登録処理
        } else {
            $_login->makeUser($post['form_login_id'], $post['form_login_pass']);
            // 新規登録成功
            $form_login_id_hs = hs($post['form_login_id']);
            $body_ht .= "<p class=\"infomsg\">○ 認証{$p_str['user']}「{$form_login_id_hs}」を登録しました</p>";
            $body_ht .= "<p><a href=\"{$myname}?form_login_id={$form_login_id_hs}{$_conf['k_at_a']}\">{$_conf['p2name']} start</a></p>";
            $_login->setUser($post['form_login_id']);
            $_login->setPassX(sha1($post['form_login_pass']));
            // セッションが利用されているなら、セッションを更新
            if (isset($_p2session)) {
                // ユーザ名とパスXを更新
                $_SESSION['login_user'] = $_login->user_u;
                $_SESSION['login_pass_x'] = $_login->pass_x;
            }
            // 要求があれば、補助認証を登録
            $_login->registCookie();
            $_login->registKtaiId();
        }
        // }}}
        // {{{ ログインエラーがある
    } else {
        if (isset($_POST['submit_newuser']) || isset($_POST['submit_userlogin'])) {
            $msg_ht = '<p class="infomsg">';
            if (!$post['form_login_id']) {
                $msg_ht .= "p2 error: 「{$p_str['user']}」が入力されていません。" . "<br>";
            } elseif (!$_login->validLoginId($post['form_login_id'])) {
                $msg_ht .= "p2 error: 「{$p_str['user']}」文字列が不正です。" . "<br>";
            }
            if (!$post['form_login_pass']) {
                $msg_ht .= "p2 error: 「{$p_str['password']}」が入力されていません。";
            }
            $msg_ht .= '</p>';
            P2Util::pushInfoHtml($msg_ht);
        }
        $show_login_form_flag = true;
    }
    // }}}
    //=========================================================
    // HTML表示出力
    //=========================================================
    P2Util::headerNoCache();
    P2View::printDoctypeTag();
    ?>
<html lang="ja">
<head>
<?php 
    P2View::printExtraHeadersHtml();
    ?>
	<title><?php 
    eh($ptitle);
    ?>
</title>
    <?php 
    if (UA::isIPhoneGroup()) {
        ?>
<style type="text/css" media="screen">@import "./iui/iui.css";</style><?php 
    }
    if (UA::isPC() && !UA::isIPhoneGroup()) {
        // ユーザは未決定
        //P2View::printIncludeCssHtml('style');
        //P2View::printIncludeCssHtml('login_first');
        ?>
	<link rel="stylesheet" href="style/login_first.css" type="text/css">
	<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
	<?php 
    }
    ?>
	</head><body><?php 
    if (UA::isIPhoneGroup()) {
        ?>
<div class="toolbar"><h1 id="pageTitle"><?php 
        echo $ptitle_ht;
        ?>
</h1></div><?php 
        ?>
<div id="usage" class="panel"><filedset><?php 
    } else {
        ?>
<h3><?php 
        echo $ptitle_ht;
        ?>
</h3><?php 
    }
    P2Util::printInfoHtml();
    echo $body_ht;
    if ($show_login_form_flag) {
        echo $login_form_ht;
        if (empty($GLOBALS['brazil']) and !(HostCheck::isAddrLocal() || HostCheck::isAddrPrivate())) {
            ?>
<p>
	<font size="-1" color="gray">※このページはプライベート利用のためのシステムです。<br>
	部外者によるログイン試行は、<br>
	不正アクセスとして記録されます。<br>
	このページへのアクセスURLを部外者が<br>
	不特定多数に公知することを禁止します。</font></p><?php 
        }
    }
    if (!empty($GLOBALS['brazil']) and UA::isK() || UA::isIPhoneGroup()) {
        ?>
<br><hr size="1"><div align="center"><a href="http://p2.2ch.net/">p2.2ch.net</a></div><?php 
    }
    if (UA::isIPhoneGroup()) {
        ?>
<br><br><br><br><br><br></filedset></div><?php 
    }
    ?>
</body></html><?php 
}
Ejemplo n.º 6
0
/**
 * メニュー項目のリンクHTMLを取得する
 *
 * @access  private
 * @param   array   $menuKIni  メニュー項目 標準設定
 * @param   boolean $noLink    リンクをつけないのならtrue
 * @return  string  HTML
 */
function _getMenuKLinkHtml($code, $menuKIni, $noLink = false)
{
    global $_conf, $_login;
    static $accesskey_ = 0;
    // 無効なコード指定なら
    if (!isset($menuKIni[$code][0]) || !isset($menuKIni[$code][1])) {
        return false;
    }
    $accesskey = ++$accesskey_;
    if ($_conf['index_menu_k_from1']) {
        $accesskey = $accesskey + 1;
        if ($accesskey == 10) {
            $accesskey = 0;
        }
    }
    if ($accesskey > 9) {
        $accesskey = null;
    }
    $href = $menuKIni[$code][0] . '&user='******'&' . UA::getQueryKey() . '=' . UA::getQueryValue();
    $name = $menuKIni[$code][1];
    /*if (!is_null($accesskey)) {
          $name = $accesskey . '.' . $name;
      }*/
    if ($noLink) {
        $linkHtml = hs($name);
    } else {
        $accesskeyAt = is_null($accesskey) ? '' : " {$_conf['accesskey_for_k']}=\"{$accesskey}\"";
        $linkHtml = "<a href=\"" . hs($href) . '">' . hs($name) . "</a>";
    }
    // 特別 - #.ログ
    if ($code == 'res_hist') {
        $name = 'ログ';
        if ($noLink) {
            $logHt = hs($name);
        } else {
            $newtime = date('gis');
            $logHt = P2View::tagA(UriUtil::buildQueryUri('read_res_hist.php', array('nt' => $newtime, UA::getQueryKey() => UA::getQueryValue())), hs($name), array($_conf['accesskey_for_k'] => '#'));
        }
        $linkHtml .= ' </li><li>' . $logHt;
    }
    return $linkHtml;
}
Ejemplo n.º 7
0
/**
 * @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())) . '#r' . rawurlencode($aThread->rescount), $ttitle_hs);
}
Ejemplo n.º 8
0
Archivo: login.php Proyecto: poppen/p2
の変更<br>
    <?php 
echo P2View::getInputHiddenKTag();
?>
    新しい<?php 
eh($p_str['password']);
?>
: <input type="password" name="form_login_pass">
    <br>
    <input type="submit" name="submit" value="変更登録">
</form>

<?php 
if (UA::isK()) {
    echo "{$hr}\n";
    echo P2View::getBackToIndexKATag();
}
?>
</body></html>
<?php 
exit;
//================================================================================
// 関数(このファイル内でのみ利用)
//================================================================================
/**
 * パスワード変更登録処理
 *
 * @return  void or P2Util::pushInfoHtml() or die
 */
function _preExecChangePass()
{
Ejemplo n.º 9
0
    /**
     * お気に板をHTML表示する for 携帯
     *
     * @access  public
     * @return  void
     */
    function printFavItaHtml()
    {
        global $_conf;
        $csrfid = P2Util::getCsrfId();
        $hr = P2View::getHrHtmlK();
        $show_flag = false;
        if (file_exists($_conf['favita_path']) and $lines = file($_conf['favita_path'])) {
            echo 'お気に板 [<a href="editfavita.php?b=k">編集</a>]' . $hr;
            $i = 0;
            foreach ($lines as $l) {
                $i++;
                $l = rtrim($l);
                if (preg_match("/^\t?(.+)\t(.+)\t(.+)\$/", $l, $matches)) {
                    $itaj = rtrim($matches[3]);
                    $attr = array();
                    $key_num_st = '';
                    if ($i <= 9) {
                        $attr[$_conf['accesskey_for_k']] = $i;
                        $key_num_st = "{$i}.";
                    }
                    $atag = P2View::tagA(UriUtil::buildQueryUri($_conf['subject_php'], array('host' => $matches[1], 'bbs' => $matches[2], 'itaj_en' => base64_encode($itaj), UA::getQueryKey() => UA::getQueryValue())), UA::isIPhoneGroup() ? hs($itaj) : hs("{$key_num_st}{$itaj}"), $attr);
                    if (UA::isIPhoneGroup()) {
                        echo '<li>' . $atag . '</li>';
                    } else {
                        echo $atag . '<br>';
                    }
                    //  [<a href="{$_SERVER['SCRIPT_NAME']}?host={$matches[1]}&amp;bbs={$matches[2]}&amp;setfavita=0&amp;csrfid={$csrfid}&amp;view=favita{$_conf['k_at_a']}">削</a>]
                    $show_flag = true;
                }
            }
            if (UA::isIPhoneGroup()) {
                ?>
</ul><?php 
            }
        }
        if (!$show_flag) {
            ?>
<p>お気に板はまだないようだ</p><?php 
        }
    }
Ejemplo n.º 10
0
Archivo: P2View.php Proyecto: poppen/p2
 /**
  * @static
  * @access  public
  * @return  void  HTML出力
  */
 function printExtraHeadersHtml($frameset = false)
 {
     P2View::printHeadMetasHtml($frameset);
 }
Ejemplo n.º 11
0
Archivo: index.php Proyecto: poppen/p2
} else {
    // {{{ PC用 変数
    $title_page = 'title.php';
    $read_page = _getReadPage();
    $sidebar = isset($_GET['sidebar']) ? $_GET['sidebar'] : null;
    $ptitle = "rep2";
    // }}}
    // {{{ PC用 HTMLプリント
    P2Util::headerNoCache();
    ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
        "http://www.w3.org/TR/html4/frameset.dtd">
<html lang="ja">
<head>
<?php 
    P2View::printExtraHeadersHtml($frameset = true);
    ?>
	<title><?php 
    eh($ptitle);
    ?>
</title>
	<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
</head>
	<?php 
    if (!$sidebar) {
        ?>
	<frameset cols="
		<?php 
        if (!$_conf['pane_mode']) {
            eh($_conf['frame_menu_width']);
            ?>
Ejemplo n.º 12
0
 /**
  * レス記事をHTML表示する 携帯用
  *
  * @access  public
  * @param   array
  * @return  void
  */
 function printArticlesHtmlK($datlines)
 {
     global $_conf;
     $hr = P2View::getHrHtmlK();
     $n = 0;
     foreach ($datlines as $aline) {
         $n++;
         if ($n < $this->resrange['start'] or $n > $this->resrange['to']) {
             continue;
         }
         $aline = rtrim($aline);
         $ResArticle = $this->lineToRes($aline, $n);
         $daytime_hs = hs($ResArticle->daytime);
         $ttitle = html_entity_decode($ResArticle->ttitle, ENT_COMPAT, 'Shift_JIS');
         $ttitle_hs = hs($ttitle);
         $msg_ht = $ResArticle->msg;
         // 大きさ制限
         if (empty($_GET['k_continue'])) {
             if ($_conf['ktai_res_size'] && strlen($msg_ht) > $_conf['ktai_res_size']) {
                 $msg_ht = substr($msg_ht, 0, $_conf['ktai_ryaku_size']);
                 // 末尾に<br>があれば取り除く(不完全なものも含めて)
                 $brtag = '<br>';
                 for ($i = 0; $i < strlen($brtag); $i++) {
                     if (substr($msg_ht, -1) == $brtag[strlen($brtag) - $i - 1]) {
                         $msg_ht = substr($msg_ht, 0, strlen($msg_ht) - 1);
                     }
                 }
                 $msg_ht .= ' ' . P2View::tagA(UriUtil::buildQueryUri('read_res_hist.php', array('from' => $ResArticle->order, 'end' => $ResArticle->order, 'k_continue' => '1', UA::getQueryKey() => UA::getQueryValue())), hs('略'));
             }
         }
         // 番号
         $res_ht = "[{$ResArticle->order}]";
         // 名前
         $array = explode('#', $ResArticle->name, 2);
         if (count($array) == 2) {
             $name_ht = sprintf('%s◆%s', $array[0], P2Util::mkTrip($array[1]));
         } else {
             $name_ht = hs($ResArticle->name);
         }
         $res_ht .= $name_ht . ':';
         // メール
         if ($ResArticle->mail) {
             $res_ht .= hs($ResArticle->mail) . ':';
         }
         // 日付とID
         $res_ht .= "{$daytime_hs}<br>\n";
         // 板名
         $res_ht .= P2View::tagA(UriUtil::buildQueryUri($_conf['subject_php'], array('host' => $ResArticle->host, 'bbs' => $ResArticle->bbs, UA::getQueryKey() => UA::getQueryValue())), hs($ResArticle->itaj)) . ' / ';
         if ($ResArticle->key) {
             if (empty($ResArticle->resnum) || $ResArticle->resnum == 1) {
                 $ls_qs = array();
                 $footer_anchor = '#footer';
             } else {
                 $lf = max(1, $ResArticle->resnum - 0);
                 $ls_qs = array('ls' => "{$lf}-");
                 $footer_anchor = "#r{$lf}";
             }
             $time = time();
             $ttitle_qs = array_merge(array('host' => $ResArticle->host, 'bbs' => $ResArticle->bbs, 'key' => $ResArticle->key, UA::getQueryKey() => UA::getQueryValue(), 'nt' => time()), $ls_qs);
             $res_ht .= P2View::tagA(UriUtil::buildQueryUri($_conf['read_php'], $ttitle_qs) . $footer_anchor, "{$ttitle_hs} ");
         } else {
             $res_ht .= "{$ttitle_hs}\n";
         }
         // 削除
         // $res_ht = "<dt><input name=\"checked_hists[]\" type=\"checkbox\" value=\"{$ResArticle->order},,,,{$daytime_hs}\"> ";
         $from_q = isset($_GET['from']) ? '&amp;from=' . intval($_GET['from']) : '';
         $dele_ht = "[<a href=\"read_res_hist.php?checked_hists[]={$ResArticle->order},,,," . hs(urlencode($ResArticle->daytime)) . "{$from_q}{$_conf['k_at_a']}\">削除</a>]";
         $res_ht .= $dele_ht;
         $res_ht .= '<br>';
         // 内容
         $res_ht .= "{$msg_ht}{$hr}\n";
         if ($_conf['k_save_packet']) {
             $res_ht = mb_convert_kana($res_ht, 'rnsk');
         }
         echo $res_ht;
     }
 }
Ejemplo n.º 13
0
/**
 * 書 <a>
 *
 * @return  string  HTML
 */
function _getDoResATag($aThread, $dores_st, $motothre_url)
{
    global $_conf;
    $dores_atag = null;
    if ($_conf['disable_res']) {
        $dores_atag = P2View::tagA($motothre_url, hs("{$_conf['k_accesskey']['res']}.{$dores_st}"), array('target' => '_blank', $_conf['accesskey_for_k'] => $_conf['k_accesskey']['res']));
    } 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())), hs("{$_conf['k_accesskey']['res']}.{$dores_st}"), array($_conf['accesskey_for_k'] => $_conf['k_accesskey']['res']));
    }
    return $dores_atag;
}
Ejemplo n.º 14
0
/**
 * @return  void  HTML出力
 */
function _printEditSortTrHtml($host, $bbs, $itaj)
{
    global $_conf;
    $itaj_en = base64_encode($itaj);
    ?>
    <tr>
    <td>
    <?php 
    echo P2View::tagA(UriUtil::buildQueryUri($_conf['subject_php'], array('host' => $host, 'bbs' => $bbs, UA::getQueryKey() => UA::getQueryValue())), hs($itaj), array('title' => "{$host}/{$bbs}"));
    ?>
    </td>
    <td>[ 
    <?php 
    echo P2View::tagA(UriUtil::buildQueryUri($_SERVER['SCRIPT_NAME'], array('host' => $host, 'bbs' => $bbs, 'itaj_en' => $itaj_en, 'setfavita' => 'top', 'csrfid' => P2Util::getCsrfId(), UA::getQueryKey() => UA::getQueryValue())), hs('▲'), array('class' => 'te', 'title' => '一番上に移動'));
    ?>
    </td>
    <td>
    <?php 
    echo P2View::tagA(UriUtil::buildQueryUri($_SERVER['SCRIPT_NAME'], array('host' => $host, 'bbs' => $bbs, 'itaj_en' => $itaj_en, 'setfavita' => 'up', 'csrfid' => P2Util::getCsrfId(), UA::getQueryKey() => UA::getQueryValue())), hs('↑'), array('class' => 'te', 'title' => '一つ上に移動'));
    ?>
    </td>
    <td>
    <?php 
    echo P2View::tagA(UriUtil::buildQueryUri($_SERVER['SCRIPT_NAME'], array('host' => $host, 'bbs' => $bbs, 'itaj_en' => $itaj_en, 'setfavita' => 'down', 'csrfid' => P2Util::getCsrfId(), UA::getQueryKey() => UA::getQueryValue())), hs('↓'), array('class' => 'te', 'title' => '一つ下に移動'));
    ?>
    </td>
    <td>
    <?php 
    echo P2View::tagA(UriUtil::buildQueryUri($_SERVER['SCRIPT_NAME'], array('host' => $host, 'bbs' => $bbs, 'itaj_en' => $itaj_en, 'setfavita' => 'bottom', 'csrfid' => P2Util::getCsrfId(), UA::getQueryKey() => UA::getQueryValue())), hs('▼'), array('class' => 'te', 'title' => '一番下に移動'));
    ?>
     ]</td>
    <td>[<?php 
    echo P2View::tagA(UriUtil::buildQueryUri($_SERVER['SCRIPT_NAME'], array('host' => $host, 'bbs' => $bbs, 'setfavita' => '0', 'csrfid' => P2Util::getCsrfId(), UA::getQueryKey() => UA::getQueryValue())), hs('削除'), array('title' => '削除'));
    ?>
]</td>
    </tr>
    <?php 
}
Ejemplo n.º 15
0
Archivo: post.php Proyecto: poppen/p2
/**
 * 書き込み処理結果をHTML表示する
 *
 * @param   boolean  $is_done       書き込み完了したならtrue
 * @param   string   $msg_ht        結果メッセージHTML
 * @param   boolean  $reload_opener opener画面を自動で更新するならtrue
 * @return  void
 */
function _showPostMsg($is_done, $msg_ht, $reload_opener)
{
    global $_conf, $location_url, $location_sid_url, $popup, $STYLE, $ttitle, $ptitle;
    $body_at = P2View::getBodyAttrK();
    $class_ttitle = '';
    if (!$_conf['ktai']) {
        $class_ttitle = ' class="thre_title"';
    }
    $ttitle_ht = "<b{$class_ttitle}>{$ttitle}</b>";
    // 2005/04/25 rsk: <script>タグ内もCDATAとして扱われるため、&amp;にしてはいけない
    $popup_ht = '';
    $meta_refresh_ht = '';
    if ($popup) {
        $reload_js = $reload_opener ? 'opener.location.href="' . $location_sid_url . '"' : '';
        $popup_ht = <<<EOJS
<script language="JavaScript">
<!--
    resizeTo({$STYLE['post_pop_size']});
    {$reload_js}
    var delay = 3*1000;
    var closeid = setTimeout("window.close()", delay);
// -->
</script>
EOJS;
        $body_at .= ' onUnload="clearTimeout(closeid)"';
    } else {
        // 2005/03/01 aki: jigブラウザに対応するため、&amp; ではなく & で
        // 2007/10/17 ↑今もそうなのかな。hs()するように変更してみた。
        $meta_refresh_ht = '<meta http-equiv="refresh" content="1;URL=' . hs($location_sid_url) . '">';
    }
    // HTMLプリント
    P2View::printDoctypeTag();
    ?>
<html lang="ja">
<head>
<?php 
    P2View::printExtraHeadersHtml();
    echo $meta_refresh_ht;
    if ($is_done) {
        echo "<title>p2 - 書きこみました。</title>";
    } else {
        echo "<title>{$ptitle}</title>";
    }
    $kakunin_ht = '';
    // PC向け
    if (!$_conf['ktai']) {
        P2View::printIncludeCssHtml('style');
        P2View::printIncludeCssHtml('post');
        ?>
	<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
<?php 
        echo $popup_ht;
        // 携帯向け
    } else {
        $kakunin_ht = '<p><a href="' . hs($location_url) . '">確認</a></p>';
    }
    echo "</head><body{$body_at}>\n";
    P2Util::printInfoHtml();
    echo <<<EOP
<p>{$ttitle_ht}</p>
<p>{$msg_ht}</p>
{$kakunin_ht}
</body>
</html>
EOP;
}
Ejemplo n.º 16
0
}
?>
</table>
<a class='whiteButton' href="<?php 
eh($_SERVER['SCRIPT_NAME']);
?>
?setdef=1<?php 
echo $_conf['k_at_a'];
?>
">デフォルトに戻す</a>
</filedset>
</div>
<?php 
// フッタHTMLを表示する
if (UA::isK() && !UA::isIPhoneGroup()) {
    echo $hr . P2View::getBackToIndexKATag();
}
?>
</body></html><?php 
exit;
//======================================================================
// 関数(このファイル内でのみ利用)
//======================================================================
/**
 * 携帯TOPメニューの順番を変更する関数
 *
 * @access  public
 * @param   string  $code
 * @param   string  $set  top, up, down, bottom
 * @return  boolean
 */
Ejemplo n.º 17
0
EOP;
// }}}
$bookmarkletUrl = "javascript:location='" . dirname(UriUtil::getMyUri()) . "/" . $_conf['read_php'] . "?url='+escape(location);";
//=============================================================
// HTMLプリント
//=============================================================
P2View::printDoctypeTag();
?>
<html lang="ja">
<head>
<?php 
P2View::printExtraHeadersHtml();
?>
	<title>rep2</title>
<?php 
P2View::printIncludeCssHtml('style');
//P2View::printIncludeCssHtml('first_cont');
?>
</head>
<body id="first_cont">
<br>
<div class="container">
	<?php 
echo $htm['urlform'];
?>
	<hr>
	<ul>
		<li><a href="http://akid.s17.xrea.com/p2puki/pukiwiki.php?Bookmarklet" target="_blank">ブックマークレット</a> 「<a href="<?php 
eh($bookmarkletUrl);
?>
">p2で読む</a>」</li>
Ejemplo n.º 18
0
/**
 * 新着まとめ読みのキャッシュリンクHTMLを表示する
 *
 * @return  void
 */
function _printMatomeCacheLinksHtml()
{
    global $_conf;
    $max = $_conf['matome_cache_max'];
    $links = array();
    for ($i = 0; $i <= $max; $i++) {
        $dnum = $i ? '.' . $i : '';
        $file = $_conf['matome_cache_path'] . $dnum . $_conf['matome_cache_ext'];
        //echo '<!-- ' . $file . ' -->';
        if (file_exists($file)) {
            $filemtime = filemtime($file);
            $date = date('Y/m/d G:i:s', $filemtime);
            $b = filesize($file) / 1024;
            $kb = round($b, 0);
            $atag = P2View::tagA(UriUtil::buildQueryUri('read_new.php', array('cview' => '1', 'cnum' => "{$i}", 'filemtime' => $filemtime)), hs($date), array('target' => 'read'));
            $links[] = sprintf('%s %dKB', $atag, $kb);
        }
    }
    if ($links) {
        echo '<ul><li class="group">新着まとめ読みの前回キャッシュ</li></ul><div id="usage" class="panel"><filedset>' . implode('<br>', $links) . '</fildset></div>' . "\n";
    }
}
Ejemplo n.º 19
0
/**
 * @return  string  <a>
 */
function _getDatSokoATag($aThreadList)
{
    global $_conf;
    $dat_soko_atag = '';
    if (!$aThreadList->spmode or $aThreadList->spmode == 'taborn') {
        $uri = UriUtil::buildQueryUri($_conf['subject_php'], array('host' => $aThreadList->host, 'bbs' => $aThreadList->bbs, 'norefresh' => '1', 'spmode' => 'soko', UA::getQueryKey() => UA::getQueryValue()));
        $dat_soko_atag = P2View::tagA($uri, hs('dat倉庫'));
    }
    return $dat_soko_atag;
}
Ejemplo n.º 20
0
/**
 * @return  string  HTML
 */
function _getPostLinkATag($aThread, $ttitle_en)
{
    return $post_link_atag = P2View::tagA(UriUtil::buildQueryUri('post_form.php', array('host' => $aThread->host, 'bbs' => $aThread->bbs, 'key' => $aThread->key, 'rescount' => $aThread->rescount, 'ttitle_en' => $ttitle_en, UA::getQueryKey() => UA::getQueryValue())), '書');
}
Ejemplo n.º 21
0
 /**
  * SETTING.TXT をダウンロードして、パースして、キャッシュする
  *
  * @access  public
  * @return  true|null|false  成功|更新なし(キャッシュ)|失敗
  */
 function downloadSettingTxt()
 {
     global $_conf;
     $perm = $_conf['dl_perm'] ? $_conf['dl_perm'] : 0606;
     FileCtl::mkdirFor($this->setting_txt);
     // 板ディレクトリが無ければ作る
     $modified = null;
     if (file_exists($this->setting_srd) && file_exists($this->setting_txt)) {
         // 更新しない場合は、その場で抜けてしまう
         if (!empty($_GET['norefresh']) || isset($_REQUEST['word'])) {
             return null;
             // キャッシュが新しい場合も抜ける
         } elseif ($this->isSettingSrdCacheFresh()) {
             return null;
         }
         $modified = gmdate('D, d M Y H:i:s', filemtime($this->setting_txt)) . ' GMT';
     }
     // DL
     /*
     // PHP5
     if (!class_exists('HTTP_Request', false)) {
         require 'HTTP/Request.php';
     }
     */
     require_once 'HTTP/Request.php';
     $params = array();
     $params['timeout'] = $_conf['fsockopen_time_limit'];
     if ($_conf['proxy_use']) {
         $params['proxy_host'] = $_conf['proxy_host'];
         $params['proxy_port'] = $_conf['proxy_port'];
     }
     $req = new HTTP_Request($this->url, $params);
     $modified && $req->addHeader('If-Modified-Since', $modified);
     $req->addHeader('User-Agent', 'Monazilla/1.00 (' . $_conf['p2uaname'] . '/' . $_conf['p2version'] . ')');
     $response = $req->sendRequest();
     $error_msg = null;
     if (PEAR::isError($response)) {
         $error_msg = $response->getMessage();
     } else {
         $code = $req->getResponseCode();
         if ($code == 302) {
             // ホストの移転を追跡
             require_once P2_LIB_DIR . '/BbsMap.php';
             $new_host = BbsMap::getCurrentHost($this->host, $this->bbs);
             if ($new_host != $this->host) {
                 $aNewSettingTxt = new SettingTxt($new_host, $this->bbs);
                 return $aNewSettingTxt->downloadSettingTxt();
             }
         }
         if (!($code == 200 || $code == 206 || $code == 304)) {
             //var_dump($req->getResponseHeader());
             $error_msg = $code;
         }
     }
     // DLエラー
     if (strlen($error_msg)) {
         P2Util::pushInfoHtml(sprintf('<div>Error: %s<br>p2 info - %s に接続できませんでした。</div>', hs($error_msg), P2View::tagA(P2Util::throughIme($this->url), hs($this->url), array('target' => $_conf['ext_win_target']))));
         touch($this->setting_txt);
         // DL失敗した場合(404)も touch する
         touch($this->setting_srd);
         return false;
     }
     $body = $req->getResponseBody();
     // DL成功して かつ 更新されていたら保存
     if ($body && $code != 304) {
         // したらば or be.2ch.net ならEUCをSJISに変換
         if (P2Util::isHostJbbsShitaraba($this->host) || P2Util::isHostBe2chNet($this->host)) {
             $body = mb_convert_encoding($body, 'SJIS-win', 'eucJP-win');
         }
         if (false === FileCtl::filePutRename($this->setting_txt, $body)) {
             die('Error: cannot write file');
         }
         chmod($this->setting_txt, $perm);
         // パースして
         if (!$this->setSettingArrayFromSettingTxt()) {
             return false;
         }
         // srd保存する
         if (!$this->saveSettingSrd($this->setting_array)) {
             return false;
         }
     } else {
         // touchすることで更新インターバルが効くので、しばらく再チェックされなくなる
         touch($this->setting_txt);
         // 同時にキャッシュもtouchしないと、setting_txtとsetting_srdで更新時間がずれて、
         // 毎回ここまで処理が来る(サーバへのヘッダリクエストが飛ぶ)場合がある。
         touch($this->setting_srd);
     }
     return true;
 }
Ejemplo n.º 22
0
 /**
  * >>1のみをプレビュー表示するためのHTMLを取得する(オンザフライに対応)
  *
  * @access  public
  * @return  string|false
  */
 function previewOne()
 {
     global $_conf, $ptitle_ht;
     if (!($this->host && $this->bbs && $this->key)) {
         return false;
     }
     $first_line = '';
     // ローカルdatから取得
     if (is_readable($this->keydat)) {
         $fd = fopen($this->keydat, "rb");
         $first_line = fgets($fd, 32800);
         fclose($fd);
     }
     if ($first_line) {
         // be.2ch.net ならEUC→SJIS変換
         if (P2Util::isHostBe2chNet($this->host)) {
             $first_line = mb_convert_encoding($first_line, 'SJIS-win', 'eucJP-win');
         }
         $first_datline = rtrim($first_line);
         if (strstr($first_datline, "<>")) {
             $datline_sepa = "<>";
         } else {
             $datline_sepa = ",";
             $this->dat_type = "2ch_old";
         }
         $d = explode($datline_sepa, $first_datline);
         $this->setTtitle($d[4]);
         // 便宜上
         if (!$this->readnum) {
             $this->readnum = 1;
         }
     }
     // ローカルdatなければオンラインから
     if (!$first_line) {
         $url = $this->getDatUrl($this->host, $this->bbs, $this->key);
         $purl = parse_url($url);
         $purl['query'] = isset($purl['query']) ? '?' . $purl['query'] : '';
         // プロキシ
         if ($_conf['proxy_use']) {
             $send_host = $_conf['proxy_host'];
             $send_port = $_conf['proxy_port'];
             $send_path = $url;
         } else {
             $send_host = $purl['host'];
             $send_port = isset($purl['port']) ? $purl['port'] : null;
             $send_path = $purl['path'] . $purl['query'];
         }
         // デフォルトを80
         !$send_port and $send_port = 80;
         $request = 'GET ' . $send_path . " HTTP/1.0\r\n";
         $request .= "Host: " . $purl['host'] . "\r\n";
         $request .= 'User-Agent: ' . P2Util::getP2UA($withMonazilla = true) . "\r\n";
         // $request .= "Range: bytes={$from_bytes}-\r\n";
         // Basic認証用のヘッダ
         if (isset($purl['user']) && isset($purl['pass'])) {
             $request .= "Authorization: Basic " . base64_encode($purl['user'] . ":" . $purl['pass']) . "\r\n";
         }
         $request .= "Connection: Close\r\n";
         $request .= "\r\n";
         // WEBサーバへ接続
         $fp = fsockopen($send_host, $send_port, $errno, $errstr, $_conf['fsockopen_time_limit']);
         if (!$fp) {
             P2Util::pushInfoHtml(sprintf('<p>サーバ接続エラー: %s (%s)<br>p2 info - %s に接続できませんでした。</p>', $errstr, $errno, P2View::tagA(P2Util::throughIme($url), hs($url), array('target' => $_conf['ext_win_target']))));
             $this->diedat = true;
             return false;
         }
         // HTTPリクエスト送信
         fputs($fp, $request);
         // HTTPヘッダレスポンスを取得する
         $h = $this->freadHttpHeader($fp);
         if ($h === false) {
             fclose($fp);
             $this->_pushInfoHtmlFreadHttpHeaderError($url);
             $this->diedat = true;
             return false;
         }
         // {{{ HTTPコードをチェック
         $code = $h['code'];
         // Partial Content
         if ($code == "200") {
             // OK。何もしない
             // 予期しないHTTPコード。なかったと判断する
         } else {
             fclose($fp);
             $this->previewOneNotFound();
             return false;
         }
         // }}}
         if (isset($h['headers']['Content-Length'])) {
             if (preg_match("/^([0-9]+)/", $h['headers']['Content-Length'], $matches)) {
                 $onbytes = $h['headers']['Content-Length'];
             }
         }
         // bodyを一行目だけ読む
         $first_line = fgets($fp, 32800);
         fclose($fp);
         // be.2ch.net ならEUC→SJIS変換
         if (P2Util::isHostBe2chNet($this->host)) {
             $first_line = mb_convert_encoding($first_line, 'SJIS-win', 'eucJP-win');
         }
         $first_datline = rtrim($first_line);
         if (strstr($first_datline, '<>')) {
             $datline_sepa = '<>';
         } else {
             $datline_sepa = ',';
             $this->dat_type = '2ch_old';
         }
         $d = explode($datline_sepa, $first_datline);
         $this->setTtitle($d[4]);
         $this->onthefly = true;
     }
     // 厳密にはオンザフライではないが、個人にとっては(既読記録がされないという意味で)オンザフライ
     if (!$this->isKitoku()) {
         $this->onthefly = true;
     }
     $body = '';
     if (!empty($this->onthefly)) {
         // PC
         if (UA::isPC()) {
             $body .= '<div><span class="onthefly">プレビュー</span></div>';
             // 携帯
         } else {
             $body .= '<div><font size="-1" color="#00aa00">プレビュー</font></div>';
         }
     }
     UA::isPC() and $body .= '<dl>';
     require_once P2_LIB_DIR . '/ShowThread.php';
     // PC
     if (UA::isPC()) {
         require_once P2_LIB_DIR . '/ShowThreadPc.php';
         $aShowThread = new ShowThreadPc($this);
         // 携帯
     } else {
         require_once P2_LIB_DIR . '/ShowThreadK.php';
         $aShowThread = new ShowThreadK($this);
     }
     $body .= $aShowThread->transRes($first_line, 1);
     // 1を表示
     UA::isPC() and $body .= "</dl>\n";
     return $body;
 }
Ejemplo n.º 23
0
/**
 * 新着まとめ読みのキャッシュリンクHTMLを表示する
 *
 * @return  void
 */
function _printMatomeCacheLinksHtml()
{
    global $_conf;
    $max = $_conf['matome_cache_max'];
    $links = array();
    for ($i = 0; $i <= $max; $i++) {
        $dnum = $i ? '.' . $i : '';
        $file = $_conf['matome_cache_path'] . $dnum . $_conf['matome_cache_ext'];
        //echo '<!-- ' . $file . ' -->';
        if (file_exists($file)) {
            $filemtime = filemtime($file);
            $date = date('Y/m/d G:i:s', $filemtime);
            $b = filesize($file) / 1024;
            $kb = round($b, 0);
            $atag = P2View::tagA(UriUtil::buildQueryUri('read_new.php', array('cview' => '1', 'cnum' => "{$i}", 'filemtime' => $filemtime)), hs($date), array('target' => 'read'));
            $links[] = sprintf('%s %dKB', $atag, $kb);
        }
    }
    if ($links) {
        echo '<p>新着まとめ読みの前回キャッシュを表\示<br>' . implode('<br>', $links) . '</p>' . "\n";
        if ($_conf['ktai']) {
            $hr = P2View::getHrHtmlK();
            echo $hr . "\n";
        }
    }
}
Ejemplo n.º 24
0
Archivo: info_i.php Proyecto: poppen/p2
/**
 * @return  string  HTML
 */
function _getOffRecentATag($aThread, $offrecent_accesskey, $ttitle_en)
{
    global $_conf;
    $preKey = '';
    if (UA::isK() && $offrecent_accesskey) {
        $preKey = $offrecent_accesskey . '.';
    }
    return P2View::tagA(UriUtil::buildQueryUri('info_i.php', array('host' => $aThread->host, 'bbs' => $aThread->bbs, 'key' => $aThread->key, 'offrecent' => '1', 'popup' => (int) (bool) geti($_GET['popup']), 'ttitle_en' => $ttitle_en, UA::getQueryKey() => UA::getQueryValue())), sprintf('%s履歴から外す', hs($preKey)), array('title' => 'このスレを「最近読んだスレ」と「書き込み履歴」から外します', 'accesskey' => $offrecent_accesskey));
}
Ejemplo n.º 25
0
// 検索結果
if (!empty($GLOBALS['sb_mikke_num'])) {
    $hit_ht = "<div class=\"panel\"><h2>\"{$word}\" {$GLOBALS['sb_mikke_num']}hit!</h2></div>";
} else {
    $hit_ht = '';
}
//=================================================
// ヘッダHTMLをプリント
//=================================================
P2Util::headerNoCache();
P2View::printDoctypeTag();
?>
<html>
<head>
<?php 
P2View::printExtraHeadersHtml();
?>
<style type="text/css" media="screen">@import "./iui/iui.css";</style>
<script type="text/javascript" src="iphone/js/setfavjs.iphone.js?v=20061206"></script>
	<script type="text/javascript" src="js/basic.js?v=20090429"></script>

<script type="text/javascript"> 
<!-- 
window.onload = function() { 
setTimeout(scrollTo, 100, 0, 1); 
} 
// --> 
</script> 
<title><?php 
eh($aThreadList->ptitle);
?>
Ejemplo n.º 26
0
 /**
  * 画像ポップアップ変換
  *
  * @access  private
  * @return  string|false  HTML
  */
 function plugin_viewImage($url, $purl, $html)
 {
     global $_conf;
     // 表示制限
     if (!isset($GLOBALS['pre_thumb_limit']) && $_conf['pre_thumb_limit']) {
         $GLOBALS['pre_thumb_limit'] = $_conf['pre_thumb_limit'];
     }
     if (!$_conf['preview_thumbnail'] || empty($GLOBALS['pre_thumb_limit'])) {
         return false;
     }
     if (preg_match('{^https?://.+?\\.(jpe?g|gif|png)$}i', $url) && empty($purl['query'])) {
         $GLOBALS['pre_thumb_limit']--;
         $img_tag = sprintf('<img class="thumbnail" src="%s" height="%s" weight="%s" hspace="4" vspace="4" align="middle">', hs($url), hs($_conf['pre_thumb_height']), hs($_conf['pre_thumb_width']));
         switch ($_conf['iframe_popup']) {
             case 1:
                 $view_img_ht = $this->iframePopup($url, $img_tag . $html, array('target' => $_conf['ext_win_target']));
                 break;
             case 2:
                 // (p)の設定だが、画像サムネイルを利用する
                 $view_img_ht = $this->iframePopup($url, array($html, $img_tag), array('target' => $_conf['ext_win_target']));
                 break;
             case 3:
                 // p画像の設定だが、画像サムネイルを利用する
                 $view_img_ht = $this->iframePopup($url, array($html, $img_tag), array('target' => $_conf['ext_win_target']));
                 break;
             default:
                 $view_img_ht = P2View::tagA($url, "{$img_tag}{$html}", array('target' => $_conf['ext_win_target']));
         }
         // ブラクラチェッカ (プレビューとは相容れないのでコメントアウト)
         /*
         if ($_conf['brocra_checker_use']) {
             $link_url_en = rawurlencode($url);
             $atag = P2View::tagA(
                 "{$_conf['brocra_checker_url']}?{$_conf['brocra_checker_query']}={$link_url_en}",
                 hs('チェック')
                 array('target' => $_conf['ext_win_target'])
             );
             $view_img_ht .= " [$atag]";
         }
         */
         return $view_img_ht;
     }
     return false;
 }
Ejemplo n.º 27
0
 /**
  * datのレスメッセージをHTML表示用メッセージに変換して返す
  *
  * @access  private
  * @param   string    $msg
  * @param   integer   $resnum  レス番号
  * @param   ref bool  $has_aa  AAを含んでいるかどうか。この渡し方はイマイチぽ。レス単位でオブジェクトにした方がいいかな。
  * @return  string  HTML
  */
 function transMsg($msg, $resnum, &$has_aa)
 {
     global $_conf;
     global $res_filter, $word_fm;
     $this->str_to_link_rest = $this->str_to_link_limit;
     $ryaku = false;
     // 2ch旧形式のdat
     if ($this->thread->dat_type == '2ch_old') {
         $msg = str_replace('@`', ',', $msg);
         $msg = preg_replace('/&amp([^;])/', '&$1', $msg);
     }
     // DAT中にある>>1のリンクHTMLを取り除く
     $msg = $this->removeResAnchorTagInDat($msg);
     // AAチェック
     $has_aa = $this->detectAA($msg);
     // {{{ 大きさ制限
     // AAの強制省略。
     $aa_ryaku_flag = false;
     if ($_conf['k_aa_ryaku_size'] && strlen($msg) > $_conf['k_aa_ryaku_size'] and $has_aa == 2) {
         $aa_ryaku_flag = true;
     }
     if (!(UA::isIPhoneGroup() && !$aa_ryaku_flag) and empty($_GET['k_continue']) and $_conf['ktai_res_size'] && strlen($msg) > $_conf['ktai_res_size'] || $aa_ryaku_flag) {
         // <br>以外のタグを除去し、長さを切り詰める
         $msg = strip_tags($msg, '<br>');
         if ($aa_ryaku_flag) {
             $ryaku_size = min($_conf['k_aa_ryaku_size'], $_conf['ktai_ryaku_size']);
             $ryaku_st = 'AA略';
         } else {
             $ryaku_size = $_conf['ktai_ryaku_size'];
             $ryaku_st = '略';
         }
         $msg = mb_strcut($msg, 0, $ryaku_size);
         $msg = preg_replace('/ *<[^>]*$/i', '', $msg);
         // >>1, >1, >1, >>1を引用レスポップアップリンク化
         $msg = preg_replace_callback($this->getAnchorRegex('/%full%/'), array($this, 'quote_msg_callback'), $msg);
         $msg .= P2View::tagA(UriUtil::buildQueryUri($_conf['read_php'], array('host' => $this->thread->host, 'bbs' => $this->thread->bbs, 'key' => $this->thread->key, 'ls' => $resnum, 'k_continue' => '1', 'offline' => '1', UA::getQueryKey() => UA::getQueryValue())), $ryaku_st);
         return $msg;
     }
     // }}}
     // 引用やURLなどをリンク
     $msg = preg_replace_callback($this->str_to_link_regex, array($this, 'link_callback'), $msg, $this->str_to_link_limit);
     // 2ch BEアイコン
     if (in_array($_conf['show_be_icon'], array(1, 3))) {
         $msg = preg_replace('{sssp://(img\\.2ch\\.net/ico/[\\w\\d()\\-]+\\.[a-z]+)}', '<img src="http://$1" border="0">', $msg);
     }
     return $msg;
 }
Ejemplo n.º 28
0
    /**
     * お気に板をHTML表示する
     *
     * @access  public
     * @return  void
     */
    function printFavItaHtml()
    {
        global $_conf, $matome_i, $STYLE;
        // favita読み込み
        $favitas = array();
        if (file_exists($_conf['favita_path'])) {
            if ($lines = file($_conf['favita_path'])) {
                foreach ($lines as $l) {
                    if (preg_match("/^\t?(.+)\t(.+)\t(.+)\$/", trim($l), $matches)) {
                        $favitas[] = array('host' => $matches[1], 'bbs' => $matches[2], 'itaj' => $matches[3]);
                    }
                }
            }
        }
        // 空っぽなら
        if (!$favitas) {
            echo <<<EOP
    <div class="menu_cate"><b>お気に板</b> [<a href="editfavita.php" target="subject">編集</a>]<br>
        <div class="itas" id="c_favita">(空っぽ)</div>
    </div>
EOP;
            return;
        }
        // 新着数を表示する場合・まとめてプリフェッチ
        if ($_conf['enable_menu_new'] && !empty($_GET['shownew'])) {
            if ($_conf['expack.use_pecl_http'] == 1) {
                require_once P2_LIB_DIR . '/P2HttpExt.php';
                P2HttpRequestPool::fetchSubjectTxt($favitas);
                $GLOBALS['expack.subject.multi-threaded-download.done'] = true;
            }
        }
        $csrfid = P2Util::getCsrfId();
        echo <<<EOP
<div class="menu_cate"><b><a class="menu_cate" href="javascript:void(0);" onClick="showHide('c_favita', 'itas_hide');" target="_self">お気に板</a></b> [<a href="editfavita.php" target="subject">編集</a>]<br>
    <div class="itas" id="c_favita">
EOP;
        foreach ($favitas as $favita) {
            extract($favita);
            // $host, $bbs, $itaj
            $itaj_en = base64_encode($itaj);
            $uri = UriUtil::buildQueryUri($_SERVER['SCRIPT_NAME'], array('host' => $host, 'bbs' => $bbs, 'setfavita' => '0', 'csrfid' => $csrfid));
            $star_atag = P2View::tagA($uri, '★', array('target' => '_self', 'class' => 'fav', 'title' => "「{$itaj}」をお気に板から外す", 'onClick' => "return confirmSetFavIta('" . str_replace(array("\\", "'"), array("\\\\", "\\'"), $itaj) . "');"));
            // 新着数を表示する場合
            if ($_conf['enable_menu_new'] && !empty($_GET['shownew'])) {
                $matome_i++;
                // $host, $bbs
                $spmode = '';
                $shinchaku_num = 0;
                $_newthre_num = 0;
                include './subject_new.php';
                // $shinchaku_num, $_newthre_num がセットされる
                $newthre_ht = '';
                if ($_newthre_num) {
                    $newthre_ht = "{$_newthre_num}";
                }
                $subject_uri = UriUtil::buildQueryUri($_conf['subject_php'], array('host' => $host, 'bbs' => $bbs, 'itaj_en' => $itaj_en));
                $subject_atag = P2View::tagA($subject_uri, hs($itaj), array('onClick' => "chMenuColor('{$matome_i}');"));
                $read_new_uri = UriUtil::buildQueryUri($_conf['read_new_php'], array('host' => $host, 'bbs' => $bbs));
                $read_new_attr = array('target' => 'read', 'id' => "un{$matome_i}", 'onClick' => "chUnColor('{$matome_i}');");
                if ($shinchaku_num > 0) {
                    $read_new_attr['class'] = 'newres_num';
                } else {
                    $read_new_attr['class'] = 'newres_num_zero';
                }
                $read_new_atag = P2View::tagA($read_new_uri, hs($shinchaku_num), $read_new_attr);
                echo <<<EOP
        {$star_atag} {$subject_atag} <span id="newthre{$matome_i}" class="newthre_num">{$newthre_ht}</span> ({$read_new_atag})<br>
EOP;
                // 新着数を表示しない場合
            } else {
                $subject_uri = UriUtil::buildQueryUri($_conf['subject_php'], array('host' => $host, 'bbs' => $bbs, 'itaj_en' => $itaj_en));
                $subject_atag = P2View::tagA($subject_uri, hs($itaj));
                echo "{$star_atag} {$subject_atag}<br>";
            }
            ob_flush();
            flush();
        }
        // foreach
        echo "    </div>\n";
        echo "</div>\n";
    }
Ejemplo n.º 29
0
/**
 * 「続きを読む」 <a>
 *
 * @return  string  HTML
 */
function _getTudukiATag($aThread, $tuduki_st)
{
    global $_conf;
    return P2View::tagA(UriUtil::buildQueryUri($_conf['read_php'], array('host' => $aThread->host, 'bbs' => $aThread->bbs, 'key' => $aThread->key, 'ls' => $GLOBALS['last_hit_resnum'] . '-', 'offline' => '1')), hs($tuduki_st), array('accesskey' => $_conf['pc_accesskey']['tuduki'], 'title' => sprintf('アクセスキー[%s]', $_conf['pc_accesskey']['tuduki']), 'style' => 'white-space: nowrap;'));
}
Ejemplo n.º 30
0
/**
 * 1- 101- 201- のリンクHTMLを取得する
 * _getHeadBarHtml() から呼ばれる
 *
 * @return  string  HTML
 */
function _getReadNaviRangeHtml($aThread, $rnum_range)
{
    global $_conf;
    static $cache_ = array();
    if (array_key_exists("{$aThread->host}/{$aThread->bbs}/{$aThread->key}", $cache_)) {
        return $cache_["{$aThread->host}/{$aThread->bbs}/{$aThread->key}"];
    }
    $read_navi_range_ht = '';
    for ($i = 1; $i <= $aThread->rescount; $i = $i + $rnum_range) {
        $ito = $i + $rnum_range - 1;
        $qs = array('host' => $aThread->host, 'bbs' => $aThread->bbs, 'key' => $aThread->key, 'ls' => "{$i}-{$ito}", UA::getQueryKey() => UA::getQueryValue());
        if ($ito <= $aThread->gotnum) {
            $qs['offline'] = '1';
        }
        $url = UriUtil::buildQueryUri($_conf['read_php'], $qs);
        $read_navi_range_ht .= P2View::tagA($url, "{$i}-") . "\n";
    }
    return $cache_["{$aThread->host}/{$aThread->bbs}/{$aThread->key}"] = $read_navi_range_ht;
}