Example #1
0
<?php

/**
 * rep2 - 板メニュー
 * フレーム分割画面、左側部分 PC用
 *
 * menu.php, menu_side.php より読み込まれる
 */
$_login->authorize();
//ユーザ認証
//==============================================================
// 変数設定
//==============================================================
$me_url = P2Util::getMyUrl();
$me_dir_url = dirname($me_url);
// menu_side.php の URL。(ローカルパス指定はできないようだ)
$menu_side_url = $me_dir_url . '/menu_side.php';
$brd_menus = array();
$matome_i = 0;
if (isset($_GET['word'])) {
    $word = $_GET['word'];
} elseif (isset($_POST['word'])) {
    $word = $_POST['word'];
}
$hd = array('word' => '');
$GLOBALS['ita_mikke'] = array('num' => 0);
$msg_ht = '';
// 板検索
if (isset($word) && strlen($word) > 0) {
    if (substr_count($word, '.') == strlen($word)) {
        $word = null;
Example #2
0
function ic2_display($path, $params)
{
    global $_conf, $ini, $thumb, $dpr, $redirect, $id, $uri, $file, $thumbnailer;
    if (P2_OS_WINDOWS) {
        $path = str_replace('\\', '/', $path);
    }
    if (strncmp($path, '/', 1) == 0) {
        $s = empty($_SERVER['HTTPS']) ? '' : 's';
        $to = 'http' . $s . '://' . $_SERVER['HTTP_HOST'] . $path;
    } else {
        $dir = dirname(P2Util::getMyUrl());
        if (strncasecmp($path, './', 2) == 0) {
            $to = $dir . substr($path, 1);
        } elseif (strncasecmp($path, '../', 3) == 0) {
            $to = dirname($dir) . substr($path, 2);
        } else {
            $to = $dir . '/' . $path;
        }
    }
    $name = basename($path);
    $ext = strrchr($name, '.');
    switch ($redirect) {
        case 1:
            header("Location: {$to}");
            exit;
        case 2:
            switch ($ext) {
                case '.jpg':
                    header("Content-Type: image/jpeg; name=\"{$name}\"");
                    break;
                case '.png':
                    header("Content-Type: image/png; name=\"{$name}\"");
                    break;
                case '.gif':
                    header("Content-Type: image/gif; name=\"{$name}\"");
                    break;
                default:
                    if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false || strpos($_SERVER['HTTP_USER_AGENT'], 'Opera') !== false) {
                        header("Content-Type: application/octetstream; name=\"{$name}\"");
                    } else {
                        header("Content-Type: application/octet-stream; name=\"{$name}\"");
                    }
            }
            header("Content-Disposition: inline; filename=\"{$name}\"");
            header('Content-Length: ' . filesize($path));
            readfile($path);
            exit;
        default:
            if (!class_exists('HTML_Template_Flexy', false)) {
                require 'HTML/Template/Flexy.php';
            }
            if (!class_exists('HTML_QuickForm', false)) {
                require 'HTML/QuickForm.php';
            }
            if (!class_exists('HTML_QuickForm_Renderer_ObjectFlexy', false)) {
                require 'HTML/QuickForm/Renderer/ObjectFlexy.php';
            }
            if (isset($uri)) {
                $img_o = 'uri';
                $img_p = $uri;
            } elseif (isset($id)) {
                $img_o = 'id';
                $img_p = $id;
            } else {
                $img_o = 'file';
                $img_p = $file;
            }
            $img_q = $img_o . '=' . rawurlencode($img_p);
            // QuickFormの初期化
            $_size = explode('x', $thumbnailer->calc($params['width'], $params['height']));
            $_constants = array('o' => sprintf('原寸 (%dx%d)', $params['width'], $params['height']), 's' => '作成', 't' => $thumb, 'd' => $dpr, 'u' => $img_p, 'v' => $img_o, 'x' => $_size[0], 'y' => $_size[1]);
            $_defaults = array('q' => $ini["Thumb{$thumb}"]['quality'], 'r' => '0');
            $mobile = Net_UserAgent_Mobile::singleton();
            $qa = 'size=3 maxlength=3';
            if ($mobile->isDoCoMo()) {
                $qa .= ' istyle=4';
            } elseif ($mobile->isEZweb()) {
                $qa .= ' format=*N';
            } elseif ($mobile->isSoftBank()) {
                $qa .= ' mode=numeric';
            }
            $_presets = array('' => 'サイズ・品質');
            foreach ($ini['Dynamic']['presets'] as $_preset_name => $_preset_params) {
                $_presets[$_preset_name] = $_preset_name;
            }
            $qf = new HTML_QuickForm('imgmaker', 'get', 'ic2_mkthumb.php');
            $qf->setConstants($_constants);
            $qf->setDefaults($_defaults);
            $qf->addElement('hidden', 't');
            $qf->addElement('hidden', 'u');
            $qf->addElement('hidden', 'v');
            $qf->addElement('text', 'x', '高さ', $qa);
            $qf->addElement('text', 'y', '横幅', $qa);
            $qf->addElement('text', 'q', '品質', $qa);
            $qf->addElement('select', 'p', 'プリセット', $_presets);
            $qf->addElement('select', 'r', '回転', array('0' => 'なし', '90' => '右に90°', '270' => '左に90°', '180' => '180°'));
            $qf->addElement('checkbox', 'w', 'トリム');
            $qf->addElement('checkbox', 'z', 'DL');
            $qf->addElement('submit', 's');
            $qf->addElement('submit', 'o');
            // FlexyとQurickForm_Rendererの初期化
            $_flexy_options = array('locale' => 'ja', 'charset' => 'cp932', 'compileDir' => $_conf['compile_dir'] . DIRECTORY_SEPARATOR . 'ic2', 'templateDir' => P2EX_LIB_DIR . '/ic2/templates', 'numberFormat' => '');
            $flexy = new HTML_Template_Flexy($_flexy_options);
            $rdr = new HTML_QuickForm_Renderer_ObjectFlexy($flexy);
            $qf->accept($rdr);
            // 表示
            $flexy->setData('p2vid', P2_VERSION_ID);
            $flexy->setData('title', 'IC2::Cached');
            $flexy->setData('pc', !$_conf['ktai']);
            $flexy->setData('iphone', $_conf['iphone']);
            if (!$_conf['ktai']) {
                $flexy->setData('skin', $GLOBALS['skin_name']);
                //$flexy->setData('stylesheets', array('css'));
                //$flexy->setData('javascripts', array('js'));
            } else {
                $flexy->setData('k_color', array('c_bgcolor' => !empty($_conf['mobile.background_color']) ? $_conf['mobile.background_color'] : '#ffffff', 'c_text' => !empty($_conf['mobile.text_color']) ? $_conf['mobile.text_color'] : '#000000', 'c_link' => !empty($_conf['mobile.link_color']) ? $_conf['mobile.link_color'] : '#0000ff', 'c_vlink' => !empty($_conf['mobile.vlink_color']) ? $_conf['mobile.vlink_color'] : '#9900ff'));
            }
            $rank = isset($params['rank']) ? $params['rank'] : 0;
            if ($_conf['iphone']) {
                $img_dir = 'img/iphone/';
                $img_ext = '.png';
            } else {
                $img_dir = 'img/';
                $img_ext = $_conf['ktai'] ? '.gif' : '.png';
            }
            $stars = array();
            $stars[-1] = $img_dir . ($rank == -1 ? 'sn1' : 'sn0') . $img_ext;
            //$stars[0] = $img_dir . (($rank ==  0) ? 'sz1' : 'sz0') . $img_ext;
            $stars[0] = $img_dir . ($_conf['iphone'] ? 'sz0' : 'sz1') . $img_ext;
            for ($i = 1; $i <= 5; $i++) {
                $stars[$i] = $img_dir . ($rank >= $i ? 's1' : 's0') . $img_ext;
            }
            $k_at_a = str_replace('&amp;', '&', $_conf['k_at_a']);
            $setrank_url = "ic2.php?{$img_q}&t={$thumb}&r=0{$k_at_a}";
            $flexy->setData('stars', $stars);
            $flexy->setData('params', $params);
            if ($thumb == 2 && $rank >= 0) {
                if ($ini['General']['inline'] == 1) {
                    $t = 2;
                    $link = null;
                } else {
                    $t = 1;
                    $link = $path;
                }
                $r = $ini['General']['redirect'] == 1 ? 1 : 2;
                $preview = "{$_SERVER['SCRIPT_NAME']}?o=1&r={$r}&t={$t}&{$img_q}{$k_at_a}";
                $flexy->setData('preview', $preview);
                $flexy->setData('link', $link);
                $flexy->setData('info', null);
            } else {
                $flexy->setData('preview', null);
                $flexy->setData('link', $path);
                $flexy->setData('info', null);
            }
            if (!$_conf['ktai'] || $_conf['iphone']) {
                $flexy->setData('backto', null);
            } elseif (isset($_REQUEST['from'])) {
                $flexy->setData('backto', $_REQUEST['from']);
                $setrank_url .= '&from=' . rawurlencode($_REQUEST['from']);
            } elseif (isset($_SERVER['HTTP_REFERER'])) {
                $flexy->setData('backto', $_SERVER['HTTP_REFERER']);
            } else {
                $flexy->setData('backto', null);
            }
            $flexy->setData('stars', $stars);
            $flexy->setData('sertank', $setrank_url . '&rank=');
            if ($_conf['iphone']) {
                $_conf['extra_headers_ht'] .= <<<EOP
<link rel="stylesheet" type="text/css" href="css/ic2_iphone.css?{$_conf['p2_version_id']}">
EOP;
                $_conf['extra_headers_xht'] .= <<<EOP
<link rel="stylesheet" type="text/css" href="css/ic2_iphone.css?{$_conf['p2_version_id']}" />
EOP;
            }
            $flexy->setData('edit', extension_loaded('gd') && $rank >= 0);
            $flexy->setData('form', $rdr->toObject());
            $flexy->setData('doctype', $_conf['doctype']);
            $flexy->setData('extra_headers', $_conf['extra_headers_ht']);
            $flexy->setData('extra_headers_x', $_conf['extra_headers_xht']);
            $flexy->compile('preview.tpl.html');
            P2Util::header_nocache();
            $flexy->output();
    }
    exit;
}
Example #3
0
// <![CDATA[
_EDIT_CONF_USER_JS_PARENT_TABS = {$parent_tabs_js};
_EDIT_CONF_USER_JS_ACTIVE_TAB1 = {$active_tab1_js};
_EDIT_CONF_USER_JS_ACTIVE_TAB2 = {$active_tab2_js};
// ]]>
</script>
EOP;
}
$groups = array();
$keep_old = false;
// }}}
//=====================================================================
// プリント設定
//=====================================================================
$ptitle = 'ユーザ設定編集';
$me = P2Util::getMyUrl();
//=====================================================================
// プリント
//=====================================================================
// ヘッダHTMLをプリント
P2Util::header_nocache();
echo $_conf['doctype'];
echo <<<EOP
<html lang="ja">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
    <meta http-equiv="Content-Style-Type" content="text/css">
    <meta http-equiv="Content-Script-Type" content="text/javascript">
    <meta name="ROBOTS" content="NOINDEX, NOFOLLOW">
    {$_conf['extra_headers_ht']}
    <title>{$ptitle}</title>
Example #4
0
//=========================================================
// 書き出し用変数
//=========================================================
$p_htm = array();
// 表示文字
$p_str = array('ptitle' => 'rep2認証ユーザ管理', 'autho_user' => '認証ユーザ', 'logout' => 'ログアウト', 'password' => 'パスワード', 'login' => 'ログイン', 'user' => 'ユーザ');
// 携帯用表示文字列変換
if ($_conf['ktai'] && function_exists('mb_convert_kana')) {
    foreach ($p_str as $k => $v) {
        $p_str[$k] = mb_convert_kana($v, 'rnsk');
    }
}
// (携帯)ログイン用URL
//$user_u_q = $_conf['ktai'] ? "?user={$_login->user_u}" : '';
//$url = rtrim(dirname(P2Util::getMyUrl()), '/') . '/' . $user_u_q . '&amp;b=k';
$url = rtrim(dirname(P2Util::getMyUrl()), '/') . '/?b=k';
$p_htm['ktai_url'] = '携帯' . $p_str['login'] . '用URL <a href="' . $url . '" target="_blank">' . $url . '</a><br>';
//====================================================
// ユーザ登録処理
//====================================================
if (isset($_POST['form_new_login_pass'])) {
    if (!isset($_POST['csrfid']) or $_POST['csrfid'] != $csrfid) {
        p2die('不正なポストです');
    }
    $new_login_pass = $_POST['form_new_login_pass'];
    // 入力チェック
    if (!preg_match('/^[0-9A-Za-z_]+$/', $new_login_pass)) {
        P2Util::pushInfoHtml("<p>rep2 error: {$p_str['password']}を半角英数字で入力して下さい。</p>");
    } elseif ($new_login_pass != $_POST['form_new_login_pass2']) {
        P2Util::pushInfoHtml("<p>rep2 error: {$p_str['password']} と {$p_str['password']} (確認) が一致しませんでした。</p>");
        // パスワード変更登録処理を行う
Example #5
0
 /**
  * HTMLポップアップ変換
  *
  * @access  private
  * @return  string
  */
 function iframe_popup($url, $str, $attr = '', $mode = NULL)
 {
     global $_conf;
     // リンク用URLとポップアップ用URL
     if (is_array($url)) {
         $link_url = $url[0];
         $pop_url = $url[1];
     } else {
         $link_url = $url;
         $pop_url = $url;
     }
     // リンク文字列とポップアップの印
     if (is_array($str)) {
         $link_str = $str[0];
         $pop_str = $str[1];
     } else {
         $link_str = $str;
         $pop_str = NULL;
     }
     // リンクの属性
     if (is_array($attr)) {
         $_attr = $attr;
         $attr = '';
         foreach ($_attr as $key => $value) {
             $attr .= ' ' . $key . '="' . htmlspecialchars($value, ENT_QUOTES) . '"';
         }
     } elseif ($attr !== '' && substr($attr, 0, 1) != ' ') {
         $attr = ' ' . $attr;
     }
     // リンクの属性にHTMLポップアップ用のイベントハンドラを加える
     $pop_attr = $attr;
     $pop_attr .= " onmouseover=\"showHtmlPopUp('{$pop_url}',event,{$_conf['iframe_popup_delay']})\"";
     $pop_attr .= " onmouseout=\"offHtmlPopUp()\"";
     // 最終調整
     if (is_null($mode)) {
         $mode = $_conf['iframe_popup'];
     }
     if ($mode == 2 && !is_null($pop_str)) {
         $mode = 3;
     } elseif ($mode == 3 && is_null($pop_str)) {
         global $skin, $STYLE;
         $custom_pop_img = "skin/{$skin}/pop.png";
         if (file_exists($custom_pop_img)) {
             $pop_img = htmlspecialchars($custom_pop_img, ENT_QUOTES);
             $x = $STYLE['iframe_popup_mark_width'];
             $y = $STYLE['iframe_popup_mark_height'];
         } else {
             $pop_img = 'img/pop.png';
             $y = $x = 12;
         }
         $pop_str = "<img src=\"{$pop_img}\" width=\"{$x}\" height=\"{$y}\" hspace=\"2\" vspace=\"0\" border=\"0\" align=\"top\">";
     }
     // (p)IDポップアップで同じURLの連続呼び出しなら(p)にしない
     if (!empty($_GET['idpopup']) and isset($_SERVER['QUERY_STRING'])) {
         if (htmlspecialchars(basename(P2Util::getMyUrl()) . '?' . $_SERVER['QUERY_STRING']) == $link_url) {
             $mode = 0;
         }
     }
     // リンク作成
     switch ($mode) {
         // マーク無し
         case 1:
             return "<a href=\"{$link_url}\"{$pop_attr}>{$link_str}</a>";
             // (p)マーク
         // (p)マーク
         case 2:
             return "(<a href=\"{$link_url}\"{$pop_attr}>p</a>)<a href=\"{$link_url}\"{$attr}>{$link_str}</a>";
             // [p]画像、サムネイルなど
         // [p]画像、サムネイルなど
         case 3:
             return "<a href=\"{$link_url}\"{$pop_attr}>{$pop_str}</a><a href=\"{$link_url}\"{$attr}>{$link_str}</a>";
             // ポップアップしない
         // ポップアップしない
         default:
             return "<a href=\"{$link_url}\"{$attr}>{$link_str}</a>";
     }
 }
Example #6
0
        require_once P2_LIB_DIR . '/login2ch.inc.php';
        login2ch();
    }
}
//=========================================================
// プリント設定
//=========================================================
// 最新版チェック
$newversion_found = '';
if (!empty($_conf['updatan_haahaa'])) {
    $newversion_found = checkUpdatan();
}
// ログインユーザ情報
$htm['auth_user'] = "******" . date("Y/m/d (D) G:i") . "</p>\n";
// (携帯)ログイン用URL
$base_url = rtrim(dirname(P2Util::getMyUrl()), '/') . '/';
$url_b = $base_url . '?user='******'&b=';
$url_b_ht = p2h($url_b);
// 携帯用ビューを開くブックマークレット
$bookmarklet = <<<JS
(function (u, w, v, x, y) {
    var t;
    if (typeof window.outerHeight === 'number') {
        t = y + window.outerHeight;
        if (v < t){
            v = t;
        }
    }
    t = window.open(u, '', 'width=' + w + ',height=' + v + ',' +
        'scrollbars=yes,resizable=yes,toolbar=no,menubar=no,status=no'
    );
Example #7
0
/**
 * スレタイとURLのコピペ用のフォームHTMLを取得する
 *
 * @return  string
 */
function getCopypaFormHtml($url, $ttitle_name_hd)
{
    global $_conf;
    $url_hs = htmlspecialchars($url, ENT_QUOTES);
    $me_url = $me_url = P2Util::getMyUrl();
    // $_SERVER['REQUEST_URI']
    if ($_conf['ktai']) {
        $htm = <<<EOP
<form action="{$me_url}">
 <textarea name="copy" rows="5" cols="50">{$ttitle_name_hd}&#10;{$url_hs}</textarea>
</form>
EOP;
    } else {
        //  onMouseover="select();"
        $htm = <<<EOP
<div title="コピペ用フォーム">
<form action="{$me_url}" style="display:inline">
 <textarea name="copy" cols="56">{$ttitle_name_hd}&#10;{$url_hs}</textarea>
</form>
</div>
EOP;
    }
    // <input type="text" name="url" value="{$url_hs}">
    // <textarea name="msg_txt">{$msg_txt}</textarea><br>
    return $htm;
}
Example #8
0
/**
 * p2 - 携帯用インデックスをHTMLプリントする関数
 */
function index_print_k()
{
    global $_conf, $_login;
    $newtime = date('gis');
    $body = "";
    $ptitle = "rep2phone";
    // ログインユーザ情報
    $htm['auth_user'] = "******" . date("Y/m/d (D) G:i:s") . "</p>\n";
    // p2ログイン用URL
    $login_url = rtrim(dirname(P2Util::getMyUrl()), '/') . '/';
    $login_url_pc = $login_url . '?b=pc';
    $login_url_pc_hs = hs($login_url_pc);
    $login_url_k = $login_url . '?b=k&user='******'login_log_rec'] && $_conf['last_login_log_show']) {
        if (($log = P2Util::getLastAccessLog($_conf['login_log_file'])) !== false) {
            $log_hd = array_map('htmlspecialchars', $log);
            $htm['last_login'] = <<<EOP
<font color="#888888">
前回のログイン情報 - {$log_hd['date']}<br>
ユーザ:   {$log_hd['user']}<br>
IP:     {$log_hd['ip']}<br>
HOST:   {$log_hd['host']}<br>
UA:     {$log_hd['ua']}<br>
REFERER: {$log_hd['referer']}
</font>
EOP;
        }
    }
    // 古いセッションIDがキャッシュされていることを考慮して、ユーザ情報を付加しておく
    // (リファラを考慮して、つけないほうがいい場合もあるので注意)
    $user_at_a = '&amp;user='******'?user='******'/brdctl.class.php';
    $search_form_htm = BrdCtl::getMenuKSearchFormHtml('menu_k.php');
    //=========================================================
    // 携帯用 HTML プリント
    //=========================================================
    P2Util::header_nocache();
    echo $_conf['doctype'];
    echo <<<EOP
<html>
<head>
    {$_conf['meta_charset_ht']}
<meta name="ROBOTS" content="NOINDEX, NOFOLLOW">
<script type="text/javascript"> 
<!-- 
window.onload = function() { 
setTimeout(scrollTo, 100, 0, 1); 
} 
// --> 
</script> 
<style type="text/css" media="screen">@import "./iui/iui.css";@import "./iui/index.css";</style>
    <title>{$ptitle}</title>
</head>
<body>
    <div class="toolbar">
<h1 id="pageTitle">{$ptitle}</h1>
<a class="button" href="editpref_i.php?dummy=1{$user_at_a}{$_conf['k_at_a']}">設定管理 </a>
</div>
EOP;
    P2Util::printInfoHtml();
    echo <<<EOP
<ul id="other" class="hidden">
    <li class="group">その他</li>
    <li><a href="subject.php?spmode=res_hist{$_conf['k_at_a']}{$user_at_a}">書込履歴</a> </li>
    <li><a href="read_res_hist.php?nt={$newtime}{$_conf['k_at_a']}">ログ</a></li>
    <li><a href="subject.php?spmode=palace&amp;norefresh=1{$_conf['k_at_a']}{$user_at_a}">スレの殿堂</a></li>
    <li><a href="editfavita_i.php?k=1">お気に入り編集</a></li>
    <li><a href="setting.php?dummy=1{$user_at_a}{$_conf['k_at_a']}">ログイン管理</a></li>
<li class="group">板検索</li>
{$search_form_htm} 
</ul>
<ul id="fav" class="hidden">
EOP;
    printFavItaHtml();
    echo <<<EOP

</ul>
    
<ul id="home">
    <li class="group">メニュー</li>
    <li><a href="menu_k.php?view=cate{$_conf['k_at_a']}{$user_at_a}">板リスト</a></li>
     <li><a href="subject.php?spmode=fav&amp;norefresh=1{$_conf['k_at_a']}{$user_at_a}">お気にスレの全て</a></li>
    <li><a href="subject.php?spmode=fav&amp;sb_view=shinchaku{$_conf['k_at_a']}{$user_at_a}">お気にスレの新着</a></li>
    <li><a href="subject.php?spmode=recent&amp;sb_view=shinchaku{$_conf['k_at_a']}{$user_at_a}">最近読んだスレの新着</a></li>
    <li><a href="subject.php?spmode=recent&amp;norefresh=1{$_conf['k_at_a']}{$user_at_a}">最近読んだスレの全て</a></li>
</ul>
<div id="foot">
 <div class="foot_index">
<span class="top"><a onclick="all.item('home').style.visibility='visible';all.item('other').style.visibility='hidden';all.item('fav').style.visibility='hidden'">Top</a></span>
<span class="fav"><a onclick="all.item('fav').style.visibility='visible';all.item('home').style.visibility='hidden';all.item('other').style.visibility='hidden'">Top</a></span>
<span class="other"><a onclick="all.item('other').style.visibility='visible';all.item('home').style.visibility='hidden';all.item('fav').style.visibility='hidden'">Top</a></span>
 </div>
</div>
</body>
</html>
EOP;
}
Example #9
0
 /**
  * 認証を行う
  */
 public function authorize()
 {
     global $_conf, $_p2session;
     // {{{ 認証チェック
     $auth_result = $this->_authCheck();
     if (!$auth_result) {
         // ログイン失敗
         if (!function_exists('printLoginFirst')) {
             include P2_LIB_DIR . '/login_first.inc.php';
         }
         printLoginFirst($this);
         exit;
     }
     // }}}
     // ■ログインOKなら
     // {{{ ログアウトの指定があれば
     if (!empty($_REQUEST['logout'])) {
         // セッションをクリア(アクティブ、非アクティブを問わず)
         Session::unSession();
         // 補助認証をクリア
         $this->clearCookieAuth();
         $url = rtrim(dirname(P2Util::getMyUrl()), '/') . '/';
         // . $user_u_q;
         header('Location: ' . $url);
         exit;
     }
     // }}}
     // {{{ セッションが利用されているなら、セッション変数の更新
     if (isset($_p2session)) {
         // ユーザ名とパスXを更新
         $_SESSION['login_user'] = $this->user_u;
         $_SESSION['login_pass_x'] = $this->pass_x;
         if (!array_key_exists('login_microtime', $_SESSION)) {
             $_SESSION['login_microtime'] = microtime();
         }
         // devicePixelRatio指定があれば保持
         if (!empty($_REQUEST['device_pixel_ratio'])) {
             $device_pixel_ratio = floatval($_REQUEST['device_pixel_ratio']);
             if ($device_pixel_ratio === 1.5 || $device_pixel_ratio === 2.0) {
                 $_SESSION['device_pixel_ratio'] = $device_pixel_ratio;
             }
         }
     }
     // }}}
     // {{{ 要求があれば、補助認証を登録
     $this->registerCookie();
     // }}}
     // セッションを認証以外に使わない場合は閉じる
     if (P2_SESSION_CLOSE_AFTER_AUTHENTICATION) {
         session_write_close();
     }
     // _authCheck() が文字列を返したときは、URLと見なしてリダイレクト
     if (is_string($auth_result)) {
         header('Location: ' . $auth_result);
         exit;
     }
     return true;
 }
Example #10
0
/**
 * スレタイとURLのコピペ用のフォームを取得する
 */
function getCopypaFormHtml($url, $ttitle_name_hd)
{
    $url_hd = htmlspecialchars($url, ENT_QUOTES);
    $me_url = $me_url = P2Util::getMyUrl();
    // $_SERVER['REQUEST_URI']
    $htm = <<<EOP
<form action="{$me_url}">
 <textarea name="copy">{$ttitle_name_hd}&#10;{$url_hd}</textarea>
</form>
EOP;
    // <input type="text" name="url" value="{$url_hd}">
    // <textarea name="msg_txt">{$msg_txt}</textarea><br>
    return $htm;
}
Example #11
0
 /**
  * 認証を行う
  */
 public function authorize()
 {
     global $_conf, $_p2session;
     // {{{ 認証チェック
     $auth_result = $this->_authCheck();
     if (!$auth_result) {
         // ログイン失敗
         if (!function_exists('printLoginFirst')) {
             include P2_LIB_DIR . '/login_first.inc.php';
         }
         printLoginFirst($this);
         exit;
     }
     // }}}
     // ■ログインOKなら
     // {{{ ログアウトの指定があれば
     if (!empty($_REQUEST['logout'])) {
         // セッションをクリア(アクティブ、非アクティブを問わず)
         Session::unSession();
         // 補助認証をクリア
         $this->clearCookieAuth();
         $mobile = Net_UserAgent_Mobile::singleton();
         if ($mobile->isEZweb()) {
             $this->_registAuthOff($_conf['auth_ez_file']);
         } elseif ($mobile->isSoftBank()) {
             $this->_registAuthOff($_conf['auth_jp_file']);
             /* docomoはログイン画面が表示されるので、補助認証情報を自動破棄しない
                } elseif ($mobile->isDoCoMo()) {
                    $this->_registAuthOff($_conf['auth_imodeid_file']);
                    $this->_registAuthOff($_conf['auth_docomo_file']);
                */
         }
         // $user_u_q = $_conf['ktai'] ? "?user={$this->user_u}" : '';
         $url = rtrim(dirname(P2Util::getMyUrl()), '/') . '/';
         // . $user_u_q;
         header('Location: ' . $url);
         exit;
     }
     // }}}
     // {{{ セッションが利用されているなら、セッション変数の更新
     if (isset($_p2session)) {
         // ユーザ名とパスXを更新
         $_SESSION['login_user'] = $this->user_u;
         $_SESSION['login_pass_x'] = $this->pass_x;
         if (!array_key_exists('login_microtime', $_SESSION)) {
             $_SESSION['login_microtime'] = microtime();
         }
     }
     // }}}
     // {{{ 要求があれば、補助認証を登録
     $this->registCookie();
     $this->registKtaiId();
     // }}}
     // セッションを認証以外に使わない場合は閉じる
     if (P2_SESSION_CLOSE_AFTER_AUTHENTICATION) {
         session_write_close();
     }
     // _authCheck() が文字列を返したときは、URLと見なしてリダイレクト
     if (is_string($auth_result)) {
         header('Location: ' . $auth_result);
         exit;
     }
     return true;
 }