コード例 #1
0
ファイル: StrCtl.php プロジェクト: poppen/p2
 /**
  * フォームから送られてきたワードをマッチ関数に適合させる
  *
  * @static
  * @access  public
  * @return  string  $word_fm  適合パターン。SJISで返す。
  */
 function wordForMatch($word, $method = 'regex')
 {
     $word_fm = $word;
     // 「そのまま」でなければ、全角空白を半角空白に矯正
     if ($method != 'just') {
         $word_fm = mb_convert_kana($word_fm, 's');
     }
     $word_fm = trim($word_fm);
     $word_fm = htmlspecialchars($word_fm, ENT_NOQUOTES);
     if (in_array($method, array('and', 'or', 'just'))) {
         // preg_quote()で2バイト目が0x5B("[")の"ー"なども変換されてしまうので
         // UTF-8にしてから正規表現の特殊文字をエスケープ
         $word_fm = mb_convert_encoding($word_fm, 'UTF-8', 'SJIS-win');
         if (P2_MBREGEX_AVAILABLE == 1) {
             $word_fm = preg_quote($word_fm);
         } else {
             $word_fm = preg_quote($word_fm, '/');
         }
         $word_fm = mb_convert_encoding($word_fm, 'SJIS-win', 'UTF-8');
         // 他、regex(正規表現)なら
     } else {
         $word_fm = str_replace('/', '\\/', $word_fm);
         $tmp_pattern = '/' . mb_convert_encoding($word_fm, 'UTF-8', 'SJIS-win') . '/u';
         if (false === @preg_match($tmp_pattern, '.')) {
             P2Util::pushInfoHtml(sprintf('p2 warning: フィルタ語句の正規表\現に誤りがあります "%s"', hs($word_fm)));
             $word_fm = '';
         }
         if (P2_MBREGEX_AVAILABLE == 0) {
             $word_fm = str_replace('/', '\\/', $word_fm);
         }
         // 末尾のワイルドカードは除去してしまう
         $word_fm = rtrim($word_fm, '.+*');
     }
     return $word_fm;
 }
コード例 #2
0
ファイル: sb_toolbar_k.funcs.php プロジェクト: poppen/p2
/**
 * 新着まとめ読み <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;
}
コード例 #3
0
ファイル: read_filter_k.funcs.php プロジェクト: poppen/p2
/**
 * フィルタ用に書き換えたフッタ変数を取得する
 * 
 * @access  public
 * @return  array  array(read_navi_previous_btm_ht, read_navi_next_btm_ht, read_footer_navi_new_btm_ht)
 */
function getResetReadNaviFooterK($aThread, $params)
{
    global $_conf;
    global $_filter_hits, $_filter_range;
    // $prev_st, $next_st, $filter_page, $res_filter
    extract($params);
    // {{{ 検索クエリ
    $filter_qs = array('detect_hint' => '◎◇', 'host' => $aThread->host, 'bbs' => $aThread->bbs, 'key' => $aThread->key, 'offline' => 1, 'word' => $GLOBALS['word'], 'ls' => 'all', UA::getQueryKey() => UA::getQueryValue());
    foreach ($res_filter as $key => $value) {
        $filter_qs[$key] = $value;
    }
    // }}}
    if ($filter_page > 1) {
        $qs = array_merge($filter_qs, array('filter_page' => $filter_page - 1));
        $read_navi_previous_url = UriUtil::buildQueryUri($_conf['read_php'], $qs);
        $read_navi_previous_btm_ht = sprintf('<a %1$s="%2$s" href="%3$s">%2$s.%4$s</a>', hs($_conf['accesskey_for_k']), hs($_conf['k_accesskey']['prev']), hs($read_navi_previous_url), hs($prev_st));
    }
    if ($_filter_range['to'] < $_filter_hits) {
        $qs = array_merge($filter_qs, array('filter_page' => $filter_page + 1));
        $read_navi_next_url = UriUtil::buildQueryUri($_conf['read_php'], $qs);
        $read_navi_next_btm_ht = sprintf('<a %1$s="%2$s" href="%3$s">%2$s.%4$s</a>', hs($_conf['accesskey_for_k']), hs($_conf['k_accesskey']['next']), hs($read_navi_next_url), hs($next_st));
    }
    $read_footer_navi_new_btm_ht = '';
    /*
    // ※メモ:「6.新着」(新着レスの表示)と「3.新20」(最新N件)は異なる。
    $read_footer_navi_new_btm_ht = str_replace(
        " {$_conf['accesskey_for_k']}=\"{$_conf['k_accesskey']['next']}\"", '', $read_footer_navi_new_btm_ht
    );
    $read_footer_navi_new_btm_ht = str_replace(">{$_conf['k_accesskey']['next']}.", '>', $read_footer_navi_new_btm_ht);
    */
    return array('read_navi_previous_btm_ht' => $rread_navi_previous_btm_ht, 'read_navi_next_btm_ht' => $read_navi_next_btm_ht, 'read_footer_navi_new_btm_ht' => $read_footer_navi_new_btm_ht);
}
コード例 #4
0
ファイル: editpref.php プロジェクト: poppen/p2
/**
 * 新着まとめ読みのキャッシュリンク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";
        }
    }
}
コード例 #5
0
ファイル: read_res_hist.php プロジェクト: poppen/p2
// レス記事 HTML表示
//==================================================================
if (UA::isK()) {
    $ResHist->printArticlesHtmlK($datlines);
} else {
    $ResHist->printArticlesHtml($datlines);
}
//==================================================================
// フッタHTML表示
//==================================================================
// 携帯用表示
if (UA::isK()) {
    ?>
<div id="footer" name="footer"><?php 
    $ResHist->showNaviK('footer', $datlines_num);
    $atag = P2View::tagA('#header', hs($_conf['k_accesskey']['above'] . '.▲'), array($_conf['accesskey_for_k'] => $_conf['k_accesskey']['above']));
    echo " {$atag}<br>";
    echo "</div>";
    ?>
<p><?php 
    echo P2View::getBackToIndexKATag();
    ?>
</p><?php 
    // PC用表示
} else {
    ?>
<hr>
<table id="footer" width="100%" style="padding:0px 10px 0px 0px;">
    <tr>
        <td align="right"><?php 
    echo $toolbar_ht;
コード例 #6
0
ファイル: info_i.php プロジェクト: poppen/p2
/**
 * なんかいまいちだけど、横幅が長くなるのに対策。
 *
 * @return  string  HTML
 */
function _addBrHtml($str, $num = 28)
{
    $html = '';
    for ($i = 0; $i < strlen($str); $i++) {
        $html .= hs($str[$i]);
        if ($i && !($i % $num)) {
            $html .= '<br>';
        }
    }
    return $html;
}
コード例 #7
0
ファイル: login_first.inc.php プロジェクト: poppen/p2
/**
 *  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 
}
コード例 #8
0
ファイル: phpminiadmin.php プロジェクト: AlvaCorp/maxon
function eo($s)
{
    //echo+escape
    echo hs($s);
}
コード例 #9
0
ファイル: index_print_k.inc.php プロジェクト: poppen/p2
/**
 * メニュー項目のリンク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;
}
コード例 #10
0
ファイル: viewtxt.php プロジェクト: poppen/p2
        if ($i != 0) {
            $files_st .= "と";
        }
        $files_st .= "「" . $afile . "」";
        $i++;
    }
    p2die('ファイルの指定が正しくありません', hs(sprintf('%s 先生の読めるファイルは、%sだけ!', basename($_SERVER['SCRIPT_NAME']), $files_st)));
}
//=========================================================
// HTMLプリント
//=========================================================
// 読み込むファイルは拡張子.txtだけ
if (preg_match("/\\.txt\$/i", $file)) {
    viewTxtFile($file, $encode);
} else {
    p2die('cannot view - "' . hs($file) . '"');
}
//===================================================================
// 関数(このファイル内でのみ利用)
//===================================================================
/**
 * ファイル内容を読み込んで表示する関数
 *
 * @return  void
 */
function viewTxtFile($file, $encode)
{
    global $_info_msg_ht;
    if ($file == '') {
        die('Error: file が指定されていません');
    }
コード例 #11
0
ファイル: sb_footer_k.inc.php プロジェクト: poppen/p2
/**
 * @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;
}
コード例 #12
0
ファイル: read_header.inc.php プロジェクト: poppen/p2
/**
 * @return  string  HTML
 */
function _getP2FrameHtml($motothre_url)
{
    $atag = P2View::tagA(UriUtil::buildQueryUri('index.php', array('url' => $motothre_url, 'offline' => '1')), hs('3ペインで開く'), array('title' => 'p2フレーム 3ペインで開く'));
    // Chrome, Safariで動作が変?なので、とりあえず条件から外しておく。
    // もうちょっとまっとうなJavaScript処理に変えたいところ。
    return $p2frame_ht = <<<EOP
<span class="open">
<script type="text/javascript">
<!--
if (top == self && !isChrome() && !isSafari()) {
//if (top == self) {
\tdocument.writeln('{$atag} | ');
}
//-->
</script>
</span>


EOP;
}
コード例 #13
0
ファイル: mkdir.php プロジェクト: anboto/xtreamer-web-sdk
 * Nickolay Shestakov <*****@*****.**>
 *
 * This program is free software, distributed under the terms of
 * the GNU General Public License Version 2. See the LICENSE file
 * at the top of the source tree.
 */
session_start();
if (!$_SESSION['fm_entry']) {
    die('Not a Valid Entry');
}
include_once "../lang/" . $_SESSION['lang'] . ".lang.php";
include_once "../lib/func.php";
include_once "../lib/sysfunc.php";
$dir = stripslashes_r($_POST['dir']);
setenvlang();
$com = which("mkdir");
if ($com) {
    exec($com . " -p " . escapeshellarg($dir) . " 2>&1", $out);
    if (!empty($out)) {
        echo $strMkDirFailed . ": " . hc($dir) . "<br>" . hs($out[0]);
    } else {
        echo "success";
    }
    exit;
}
if (@mkdir($dir)) {
    echo "success";
} else {
    echo $strMkDirFailed . ": " . hc($dir);
}
exit;
コード例 #14
0
ファイル: editfile.php プロジェクト: poppen/p2
/**
 * ファイル内容を読み込んで編集のためのHTMLを表示する
 *
 * @return  void
 */
function _printEditFileHtml($path, $encode)
{
    global $_conf, $modori_url, $rows, $cols;
    $info_msg_ht = P2Util::getInfoHtml();
    if ($path == '') {
        die('Error: path が指定されていません');
    }
    $filename = basename($path);
    $ptitle = "Edit: " . $filename;
    if (false === FileCtl::make_datafile($path)) {
        die(sprintf("Error: cannot make file. ( %s )", hs($path)));
    }
    $cont = file_get_contents($path);
    if ($encode == 'EUC-JP') {
        $cont = mb_convert_encoding($cont, 'SJIS-win', 'eucJP-win');
    }
    $cont_area_ht = htmlspecialchars($cont, ENT_QUOTES);
    $modori_url_ht = '';
    if ($modori_url) {
        $modori_url_ht = sprintf('<p><a href="%s">Back</a></p>', hs($modori_url));
    }
    ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="ja">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
    <meta name="ROBOTS" content="NOINDEX, NOFOLLOW">
    <title><?php 
    eh($ptitle);
    ?>
</title>
</head>
<body onLoad="top.document.title=self.document.title;">

<?php 
    echo $modori_url_ht;
    ?>
Edit: <?php 
    eh($path);
    ?>
<form action="<?php 
    eh($_SERVER['SCRIPT_NAME']);
    ?>
" method="post" accept-charset="<?php 
    eh($_conf['accept_charset']);
    ?>
">
    <input type="hidden" name="detect_hint" value="◎◇">
    <input type="hidden" name="path" value="<?php 
    eh($path);
    ?>
">
    <input type="hidden" name="modori_url" value="<?php 
    eh($modori_url);
    ?>
">
    <input type="hidden" name="encode" value="<?php 
    eh($encode);
    ?>
">
    <input type="hidden" name="rows" value="<?php 
    eh($rows);
    ?>
">
    <input type="hidden" name="cols" value="<?php 
    eh($cols);
    ?>
">
    <input type="submit" name="submit" value="Save"> <?php 
    echo $info_msg_ht;
    ?>
<br>
    <textarea style="font-size:9pt;" id="filecont" name="filecont" rows="<?php 
    eh($rows);
    ?>
" cols="<?php 
    eh($cols);
    ?>
" wrap="off"><?php 
    eh($cont);
    ?>
</textarea>
</form>

</body></html>
<?php 
}
コード例 #15
0
ファイル: ShowBrdMenuPc.php プロジェクト: poppen/p2
    /**
     * お気に板を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";
    }
コード例 #16
0
ファイル: ShowThreadPc.php プロジェクト: poppen/p2
 /**
  * 画像ポップアップ変換
  *
  * @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;
 }
コード例 #17
0
ファイル: httpcmd.php プロジェクト: poppen/p2
        if (empty($r)) {
            $r_msg_ht = '0';
            // 失敗
        } elseif ($r == 1) {
            $r_msg_ht = '1';
            // 完了
        }
    }
    // }}}
    // {{{ 書き込みフォームのオートセーブ(※これは使っていない。通信負荷を避けて、クッキーにまかせた)
} elseif ($cmd == 'auto_save_post_form') {
    // 未実装のテスト
    ob_start();
    var_dump($_POST);
    $r_msg = ob_get_clean();
    $r_msg_ht = hs($r_msg);
}
// }}}
if (UA::isSafariGroup()) {
    $r_msg_ht = mb_convert_encoding($r_msg_ht, 'UTF-8', 'SJIS-win');
}
// 結果出力
echo $xmldecTag;
echo $r_msg_ht;
/*
 * Local Variables:
 * mode: php
 * coding: cp932
 * tab-width: 4
 * c-basic-offset: 4
 * indent-tabs-mode: nil
コード例 #18
0
ファイル: read.php プロジェクト: poppen/p2
/**
 * preview >>1
 *
 * @return  void  HTML出力
 */
function _printPreview1Html(&$aThread, $params)
{
    global $_conf, $STYLE, $_login;
    global $_filter_hits;
    // $res_filter
    extract($params);
    $aThread->ls = '1';
    // 必ずしも正確ではないが便宜的に
    if (!isset($aThread->rescount) and !empty($_GET['rc'])) {
        $aThread->rescount = intval($_GET['rc']);
        $aThread->lsToPoint();
    }
    $body = $aThread->previewOne();
    $ptitle_ht = hs($aThread->itaj) . ' / ' . hs($aThread->ttitle_hc);
    if (UA::isIPhoneGroup()) {
        $read_header_inc_php = P2_IPHONE_LIB_DIR . '/read_header_k.inc.php';
        $read_footer_inc_php = P2_IPHONE_LIB_DIR . '/read_footer_k.inc.php';
    } elseif (UA::isK()) {
        $read_header_inc_php = P2_LIB_DIR . '/read_header_k.inc.php';
        $read_footer_inc_php = P2_LIB_DIR . '/read_footer_k.inc.php';
    } else {
        $read_header_inc_php = P2_LIB_DIR . '/read_header.inc.php';
        $read_footer_inc_php = P2_LIB_DIR . '/read_footer.inc.php';
    }
    require_once $read_header_inc_php;
    echo $body;
    require_once $read_footer_inc_php;
}
コード例 #19
0
ファイル: read_new_i.php プロジェクト: poppen/p2
/**
 * @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);
}
コード例 #20
0
    $files = array($files);
}
setenvlang();
$com = which("rm");
if ($com) {
    foreach ($files as $f) {
        if (is_dir($f)) {
            exec($com . " -r -f " . escapeshellarg($f) . " 2>&1", $out);
            if (!empty($out)) {
                echo "{$strRmDirFailed} " . hc($f) . "<br>" . hs($out[0]) . "...";
                exit;
            }
        } else {
            exec($com . " -f " . escapeshellarg($f) . " 2>&1", $out);
            if (!empty($out)) {
                echo "{$strDeleteFileError} " . hc($f) . "<br>" . hs($out[0]) . "...";
                exit;
            }
        }
    }
    echo "success";
    exit;
}
foreach ($files as $f) {
    if (is_dir($f)) {
        rm_dir($f);
        if (is_dir($f)) {
            echo "{$strRmDirFailed} " . hc($f) . "...";
            exit;
        }
    } elseif (!@unlink($f)) {
コード例 #21
0
ファイル: BrdMenu.php プロジェクト: poppen/p2
 /**
  * brdファイルを生成する
  *
  * @access  public
  * @return  string|false  成功したら生成したbrdファイルのパスを返す
  */
 function makeBrdFile($cachefile)
 {
     global $_conf;
     $cont = '';
     $data = file($cachefile);
     $this->setBrdMatch($cachefile);
     // パターンマッチ形式を登録
     $this->setBrdList($data);
     // カテゴリーと板をセット
     if ($this->categories) {
         foreach ($this->categories as $cate) {
             if ($cate->num > 0) {
                 $cont .= $cate->name . "\t0\n";
                 foreach ($cate->menuitas as $mita) {
                     $cont .= "\t{$mita->host}\t{$mita->bbs}\t{$mita->itaj}\n";
                 }
             }
         }
     }
     if (!$cont) {
         // 2008/07/14 なぜここでこんな条件が必要だったのか不明。コメントアウトしてみる。
         //if (strlen($GLOBALS['word']) > 0) {
         P2Util::pushInfoHtml(sprintf("<p>p2 error: %s から板メニューを生成することはできませんでした。</p>\n", hs($cachefile)));
         //}
         unlink($cachefile);
         return false;
     }
     $p2brdfile = BrdCtl::getP2BrdFile($cachefile);
     if (false === FileCtl::make_datafile($p2brdfile, $_conf['p2_perm'])) {
         return false;
     }
     if (false === FileCtl::filePutRename($p2brdfile, $cont)) {
         die(sprintf('p2 error: %s を更新できませんでした', hs($p2brdfile)));
         return false;
     }
     return $p2brdfile;
 }
コード例 #22
0
ファイル: rename.php プロジェクト: anboto/xtreamer-web-sdk
    die('Not a Valid Entry');
}
include_once "../lang/" . $_SESSION['lang'] . ".lang.php";
include_once "../lib/func.php";
include_once "../lib/sysfunc.php";
$oldname = stripslashes_r($_POST['oldname']);
$newname = stripslashes_r($_POST['newname']);
if (is_file($newname) || is_dir($newname)) {
    echo $strRenameFailed . ": " . $strFileExists . ": " . hc($newname);
    exit;
}
setenvlang();
$com = which("mv");
if ($com) {
    exec($com . " -f " . escapeshellarg($oldname) . " " . escapeshellarg($newname) . " 2>&1", $out);
    if (!empty($out)) {
        echo $strRenameFailed . "...<br>" . hs($out[0]) . "...";
    } else {
        echo "success";
    }
    exit;
}
if (@rename($oldname, $newname)) {
    echo "success";
} else {
    echo $strRenameFailed;
}
exit;
?>
	
コード例 #23
0
ファイル: Lib.php プロジェクト: ralf000/myshop
function regUser($name, $login, $password, $email, $phone, $role)
{
    global $db;
    global $error_reg;
    global $user_id;
    $active_key = substr(md5(uniqid()), 0, 13);
    //уникальный ключ для подтверждения регистрации
    if (empty($password)) {
        $password = generate_password(rand(10, 20));
    } else {
        $password = hs($password);
    }
    checkUniq($login, $email);
    if (empty($error_reg)) {
        try {
            $query = $db->prepare("INSERT INTO users (`user_id`, `name`, `login`, `password`, `email`, `phone`, `role`, `activate`) VALUES (:user_id, :name, :login, :password, :email, :phone, :role, :activate)");
            $query->execute(array(':user_id' => $user_id, ':name' => $name, ':login' => $login, ':password' => $password, ':email' => $email, ':phone' => $phone, ':role' => $role, ':activate' => $active_key));
            $user_id = $db->lastInsertID();
            regUserMailer($email, $user_id, $active_key);
            //шлем на мыло пользователю ссылку для активации аккаунта
            return $user_id;
        } catch (PDOException $e) {
            $e->getMessage();
        }
    }
}
コード例 #24
0
//include_once("lang/".$_SESSION['lang'].".lang.php");
include_once "func.php";
include_once "sysfunc.php";
extract(stripslashes_r($_POST));
if (empty($files)) {
    exit;
}
if (!is_array($files)) {
    $files = array($files);
}
setenvlang();
foreach ($files as $f) {
    if (is_dir($f)) {
        exec("rm -r -f " . escapeshellarg($f) . " 2>&1", $out);
        if (!empty($out)) {
            echo hs($out[0]) . "...";
            exit;
        }
    } else {
        exec("rm -f " . escapeshellarg($f) . " 2>&1", $out);
        if (!empty($out)) {
            echo hs($out[0]) . "...";
            exit;
        }
    }
}
echo "success";
exit;
?>

コード例 #25
0
ファイル: ShowThreadK.php プロジェクト: poppen/p2
 /**
  * 画像ポップアップ変換
  *
  * @access  private
  * @return  string|false  HTML
  */
 function plugin_viewImage($url, $purl, $html)
 {
     global $_conf;
     if (preg_match('{^https?://.+?\\.(jpe?g|gif|png)$}i', $url) && empty($purl['query'])) {
         $picto_url = 'http://pic.to/' . $purl['host'] . $purl['path'];
         if ($_conf['through_ime']) {
             $link_url = P2Util::throughIme($url);
             $picto_url = P2Util::throughIme($picto_url);
         } else {
             $link_url = $url;
         }
         $picto_tag = sprintf('<a href="%s">(ピ)</a> ', hs($picto_url));
         return $picto_tag . sprintf('<a href="%s">%s</a>', hs($link_url), $html);
     }
     return false;
 }
コード例 #26
0
ファイル: ShowBrdMenuK.php プロジェクト: poppen/p2
    /**
     * お気に板を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 
        }
    }
コード例 #27
0
ファイル: post_form.inc.php プロジェクト: poppen/p2
 *  p2 書き込みフォーム
 */
// 携帯
if (UA::isK()) {
    $htm['k_br'] = '<br>';
    $htm['kakiko_on_js'] = '';
    // PC
} else {
    $htm['k_br'] = '';
    $htm['kakiko_on_js'] = ' onFocus="adjustTextareaRows(this, 2);" onKeyup="adjustTextareaRows(this, 2);' . " autoSavePostForm('{$host}', '{$bbs}', '{$key}');\"";
}
$htm['subject'] = isset($htm['subject']) ? $htm['subject'] : '';
$popup_hs = isset($popup) ? hs($popup) : '';
$newthread_hidden_ht = isset($newthread_hidden_ht) ? $newthread_hidden_ht : '';
$readnew_hidden_ht = isset($readnew_hidden_ht) ? $readnew_hidden_ht : '';
$ttitle_en_hs = hs($ttitle_en);
// 文字コード判定用文字列を先頭に仕込むことでmb_convert_variables()の自動判定を助ける
$htm['post_form'] = <<<EOP
<form id="resform" method="POST" action="{$_conf['post_php']}" accept-charset="{$_conf['accept_charset']}" onsubmit="disableSubmit(this)">
{$htm['resform_ttitle']}
{$htm['orig_msg']}

    <input type="hidden" name="detect_hint" value="◎◇">
    {$htm['subject']}
    {$htm['maru_kakiko']} 名前: <input id="FROM" name="FROM" type="text" value="{$hs['FROM']}"{$name_size_at}>{$htm['k_br']} 
     E-mail : <input id="mail" name="mail" type="text" value="{$hs['mail']}"{$mail_size_at}{$on_check_sage}>
    {$sage_cb_ht}{$htm['k_br']}
    <textarea id="MESSAGE" name="MESSAGE" rows="{$STYLE['post_msg_rows']}"{$msg_cols_at} wrap="{$wrap}"{$htm['kakiko_on_js']}>{$MESSAGE_hs}</textarea>{$htm['k_br']}
    <input id="submit" type="submit" name="submit" value="{$submit_value}"{$res_disabled_at}{$htm['title_need_be']} onClick="setHiddenValue(this);">
    {$htm['be2ch']}
    <br>
コード例 #28
0
ファイル: SettingTxt.php プロジェクト: poppen/p2
 /**
  * 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;
 }
コード例 #29
0
ファイル: read_footer.inc.php プロジェクト: poppen/p2
/**
 * 「続きを読む」 <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;'));
}
コード例 #30
0
ファイル: extract.php プロジェクト: anboto/xtreamer-web-sdk
    die('Not a Valid Entry');
}
include_once "../../lang/" . $_SESSION['lang'] . ".lang.php";
include_once "../../lib/func.php";
include_once "../../lib/sysfunc.php";
include_once "func.php";
extract(stripslashes_r($_POST));
setenvlang();
if (!is_dir($dir) && !@mkdir($dir)) {
    echo "{$strMkDirFailed} " . hc($dir);
    exit;
}
$res = extract_files($archive, $dir, $type);
if ($type != "zip") {
    if (!empty($res)) {
        echo $strExtractFailed . " " . hc($archive) . "<br>" . hs($res[0]);
        exit;
    }
    if ($type == "gz" || $type == "bz2") {
        $bn = substr($archive, 0, strrpos($archive, '.'));
        @rename($bn, $dir . "/" . basename($bn));
    }
    echo "success";
    exit;
} else {
    if (!$res) {
        echo $strExtractFailed . " " . hc($archive) . "<br>" . hc($ar->errorInfo(true));
        exit;
    }
    echo "success";
}