Пример #1
0
/**
 * 指定したキーのスレッドログ(idx (,dat))を削除する
 *
 * 通常は、この関数を直接呼び出すことはない。deleteLogs() から呼び出される。
 *
 * @see deleteLogs()
 * @return  integer|false  削除できたら1, 削除対象がなければ2を返す。失敗があればfalse。
 */
function deleteThisKey($host, $bbs, $key)
{
    global $_conf;
    $anidx = P2Util::idxDirOfHostBbs($host, $bbs) . $key . '.idx';
    $adat = P2Util::datDirOfHostBbs($host, $bbs) . $key . '.dat';
    // Fileの削除処理
    // idx(個人用設定)
    if (file_exists($anidx)) {
        if (unlink($anidx)) {
            $deleted_flag = true;
        } else {
            $failed_flag = true;
        }
    }
    // datの削除処理
    if (file_exists($adat)) {
        if (unlink($adat)) {
            $deleted_flag = true;
        } else {
            $failed_flag = true;
        }
    }
    // 失敗があれば
    if (!empty($failed_flag)) {
        return false;
        // 削除できたら
    } elseif (!empty($deleted_flag)) {
        return 1;
        // 削除対象がなければ
    } else {
        return 2;
    }
}
Пример #2
0
/**
 * チェックした書き込み記事を削除する
 *
 * @access  public
 * @return  boolean
 */
function deleMsg($checked_hists)
{
    global $_conf;
    if (!($reslines = file($_conf['p2_res_hist_dat']))) {
        p2die(sprintf('%s を開けませんでした', $_conf['p2_res_hist_dat']));
        return false;
    }
    $reslines = array_map('rtrim', $reslines);
    // ファイルの下に記録されているものが新しいので逆順にする
    $reslines = array_reverse($reslines);
    $neolines = array();
    // チェックして整えて
    if ($reslines) {
        $rmnums = _getRmNums($checked_hists, $reslines);
        $neolines = _rmLine($rmnums, $reslines);
        P2Util::pushInfoHtml("<p>p2 info: " . count($rmnums) . "件のレス記事を削除しました</p>");
    }
    if (is_array($neolines)) {
        // 行順を戻す
        $neolines = array_reverse($neolines);
        $cont = "";
        if ($neolines) {
            $cont = implode("\n", $neolines) . "\n";
        }
        // 書き込み処理
        if (false === FileCtl::filePutRename($_conf['p2_res_hist_dat'], $cont)) {
            $errmsg = sprintf('p2 error: %s(), FileCtl::filePutRename() failed.', __FUNCTION__);
            trigger_error($errmsg, E_USER_WARNING);
            return false;
        }
    }
    return true;
}
Пример #3
0
 /**
  * フォームから送られてきたワードをマッチ関数に適合させる
  *
  * @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;
 }
Пример #4
0
 /**
  * Wiki:Last-Modifiedをチェックしてキャッシュする
  * time:チェックしない期間(unixtime)
  */
 function cacheDownload($url, $path, $time = 0)
 {
     global $_conf;
     $filetime = @filemtime($path);
     // キャッシュ有効期間ならチェックしない
     if ($filetime > 0 && $filetime > time() - $time) {
         return;
     }
     if (!class_exists('HTTP_Request', false)) {
         require 'HTTP/Request.php';
     }
     $req =& new HTTP_Request($url, array('timeout' => $_conf['fsockopen_time_limit']));
     $req->setMethod('HEAD');
     $now = time();
     $req->sendRequest();
     $unixtime = strtotime($req->getResponseHeader('Last-Modified'));
     // 新しければ取得
     if ($unixtime > $filetime) {
         P2Util::fileDownload($url, $path);
         // 最終更新日時を設定
         // touch($path, $unixtime);
     } else {
         // touch($path, $now);
     }
     touch($path, $now);
 }
Пример #5
0
/**
 * チャットちゃんねる cha2.net の dat を読んで保存する関数
 * (差分取得には未対応)
 * ※2ch互換として読み込んでいるので現在この関数は利用はしていない。@see TreadRead->downloadDat()
 *
 * @access  public
 * @return  boolean
 */
function downloadDatCha2(&$ThreadRead)
{
    // {{{ 既得datの取得レス数が適性かどうかを念のためチェック
    if (file_exists($ThreadRead->keydat)) {
        $dls = file($ThreadRead->keydat);
        if (sizeof($dls) != $ThreadRead->gotnum) {
            // echo 'bad size!<br>';
            unlink($ThreadRead->keydat);
            $ThreadRead->gotnum = 0;
        }
    } else {
        $ThreadRead->gotnum = 0;
    }
    // }}}
    if ($ThreadRead->gotnum == 0) {
        $file_append = false;
        $START = 1;
    } else {
        $file_append = true;
        $START = $ThreadRead->gotnum + 1;
    }
    // チャットちゃんねる
    $cha2url = "http://{$ThreadRead->host}/cgi-bin/{$ThreadRead->bbs}/dat/{$ThreadRead->key}.dat";
    $datfile = $ThreadRead->keydat;
    FileCtl::mkdirFor($datfile);
    $cha2url_res = P2Util::fileDownload($cha2url, $datfile);
    if (!$cha2url_res or !$cha2url_res->is_success()) {
        $ThreadRead->diedat = true;
        return false;
    }
    $ThreadRead->isonline = true;
    return true;
}
Пример #6
0
/**
 * コテハンの'#'より後をトリップに変換する
 *
 * @param   string  $name   生のコテハン
 * @return  string  トリップ変換済みのコテハン
 */
function fixed_name_convert_trip($name)
{
    $pos = strpos($name, '#');
    if ($pos === false) {
        return $name;
    }
    return substr($name, 0, $pos) . '◆' . P2Util::mkTrip(substr($name, $pos + 1));
}
Пример #7
0
 /**
  * IDストーカーに対応しているか調べる
  * $boardがなければloadも実行される
  */
 function isEnable()
 {
     if ($this->host) {
         if (!P2Util::isHost2chs($this->host)) {
             return false;
         }
     }
     return preg_match('/plus$/', $this->bbs);
 }
Пример #8
0
/**
 * ■スレッドあぼーんを複数一括解除する
 */
function settaborn_off($host, $bbs, $taborn_off_keys)
{
    if (!$taborn_off_keys) {
        return;
    }
    // p2_threads_aborn.idx のパス取得
    $taborn_idx = P2Util::idxDirOfHostBbs($host, $bbs) . 'p2_threads_aborn.idx';
    // p2_threads_aborn.idx がなければ
    if (!file_exists($taborn_idx)) {
        p2die('あぼーんリストが見つかりませんでした。');
    }
    // p2_threads_aborn.idx 読み込み
    $taborn_lines = FileCtl::file_read_lines($taborn_idx, FILE_IGNORE_NEW_LINES);
    // 指定keyを削除
    foreach ($taborn_off_keys as $val) {
        $neolines = array();
        if ($taborn_lines) {
            foreach ($taborn_lines as $line) {
                $lar = explode('<>', $line);
                if ($lar[1] == $val) {
                    // key発見
                    // echo "key:{$val} のスレッドをあぼーん解除しました。<br>";
                    $kaijo_attayo = true;
                    continue;
                }
                if (!$lar[1]) {
                    continue;
                }
                // keyのないものは不正データ
                $neolines[] = $line;
            }
        }
        $taborn_lines = $neolines;
    }
    // 書き込む
    if (file_exists($taborn_idx)) {
        copy($taborn_idx, $taborn_idx . '.bak');
        // 念のためバックアップ
    }
    $cont = '';
    if (is_array($taborn_lines)) {
        foreach ($taborn_lines as $l) {
            $cont .= $l . "\n";
        }
    }
    if (FileCtl::file_write_contents($taborn_idx, $cont) === false) {
        p2die('cannot write file.');
    }
    /*
    if (!$kaijo_attayo) {
        // echo "指定されたスレッドは既にあぼーんリストに載っていないようです。";
    } else {
        // echo "あぼーん解除、完了しました。";
    }
    */
}
Пример #9
0
 /**
  * Wiki:Last-Modifiedをチェックしてキャッシュする
  * time:チェックしない期間(unixtime)
  */
 public static function cacheDownload($url, $path, $time = 0)
 {
     $filetime = @filemtime($path);
     // キャッシュ有効期間ならダウンロードしない
     if ($filetime !== false && $filetime > time() - $time) {
         return;
     }
     // 新しければ取得
     P2Util::fileDownload($url, $path);
 }
Пример #10
0
 /**
  * @access  protected
  * @return  void
  */
 function setBbsNonameName()
 {
     if (P2Util::isHost2chs($this->thread->host)) {
         require_once P2_LIB_DIR . '/SettingTxt.php';
         $SettingTxt = new SettingTxt($this->thread->host, $this->thread->bbs);
         if (array_key_exists('BBS_NONAME_NAME', $SettingTxt->setting_array)) {
             $this->BBS_NONAME_NAME = $SettingTxt->setting_array['BBS_NONAME_NAME'];
         }
     }
 }
Пример #11
0
/**
 * スレを殿堂入りにセットする関数
 *
 * $set は、0(解除), 1(追加), top, up, down, bottom
 *
 * @access  public
 * @return  boolean
 */
function setPalace($host, $bbs, $key, $set)
{
    global $_conf;
    $idxfile = P2Util::getKeyIdxFilePath($host, $bbs, $key);
    // 既に key.idx データがあるなら読み込む
    if (file_exists($idxfile) and $lines = file($idxfile)) {
        $l = rtrim($lines[0]);
        $data = explode('<>', $l);
    }
    if (false === FileCtl::make_datafile($_conf['palace_file'], $_conf['palace_perm'])) {
        return false;
    }
    if (false === ($pallines = file($_conf['palace_file']))) {
        return false;
    }
    $newlines = array();
    $before_line_num = 0;
    // {{{ 最初に重複要素を削除しておく
    if (!empty($pallines)) {
        $i = -1;
        foreach ($pallines as $l) {
            $i++;
            $l = rtrim($l);
            $lar = explode('<>', $l);
            // 重複回避
            if ($lar[1] == $key && $lar[11] == $bbs) {
                $before_line_num = $i;
                // 移動前の行番号をセット
                continue;
                // keyのないものは不正データなのでスキップ
            } elseif (!$lar[1]) {
                continue;
            } else {
                $newlines[] = $l;
            }
        }
    }
    // }}}
    if (!empty($GLOBALS['brazil'])) {
        //$newlines = _removeLargePallistData($newlines);
    }
    // 新規データ設定
    if ($set) {
        $newdata = implode('<>', array(geti($data[0]), $key, geti($data[2]), geti($data[3]), geti($data[4]), geti($data[5]), geti($data[6]), geti($data[7]), geti($data[8]), geti($data[9]), $host, $bbs));
        require_once P2_LIB_DIR . '/getSetPosLines.func.php';
        $rec_lines = getSetPosLines($newlines, $newdata, $before_line_num, $set);
    } else {
        $rec_lines = $newlines;
    }
    if (false === FileCtl::filePutRename($_conf['palace_file'], $rec_lines ? implode("\n", $rec_lines) . "\n" : '')) {
        trigger_error(sprintf('p2 error: %s(), FileCtl::filePutRename() failed.', __FUNCTION__), E_USER_WARNING);
        return false;
    }
    return true;
}
Пример #12
0
 /**
  * subject.txtの並列ダウンロードを実行する
  *
  * @param string $mode
  * @param array $_conf
  * @return bool
  */
 public static function fetchSubjectTxt($mode, array $_conf)
 {
     // コマンド生成
     $args = array(escapeshellarg($_conf['expack.php_cli_path']));
     if ($_conf['expack.dl_pecl_http']) {
         $args[] = '-d';
         $args[] = 'extension=' . escapeshellarg('http.' . PHP_SHLIB_SUFFIX);
     }
     $args[] = escapeshellarg(P2_CLI_DIR . DIRECTORY_SEPARATOR . 'fetch-subject-txt.php');
     switch ($mode) {
         case 'fav':
         case 'recent':
         case 'res_hist':
         case 'merge_favita':
             $args[] = sprintf('--mode=%s', $mode);
             break;
         default:
             return false;
     }
     if ($_conf['expack.misc.multi_favs']) {
         switch ($mode) {
             case 'fav':
                 $args[] = sprintf('--set=%d', $_conf['m_favlist_set']);
                 break;
             case 'merge_favita':
                 $args[] = sprintf('--set=%d', $_conf['m_favita_set']);
                 break;
         }
     }
     // 標準エラー出力を標準出力にリダイレクト
     $args[] = '2>&1';
     $command = implode(' ', $args);
     //P2Util::pushInfoHtml('<p>' . htmlspecialchars($command, ENT_QUOTES) . '</p>');
     // 実行
     $pipe = popen($command, 'r');
     if (!is_resource($pipe)) {
         p2die('コマンドを実行できませんでした。', $command);
     }
     $output = '';
     while (!feof($pipe)) {
         $output .= fgets($pipe);
     }
     $status = pclose($pipe);
     if ($status != 0) {
         P2Util::pushInfoHtml(sprintf('<p>%s(): ERROR(%d)</p>', __METHOD__, $status));
     }
     if ($output !== '') {
         if ($status == 2) {
             P2Util::pushInfoHtml($output);
         } else {
             P2Util::pushInfoHtml('<p>' . nl2br(htmlspecialchars($output, ENT_QUOTES)) . '</p>');
         }
     }
     return $status == 0;
 }
Пример #13
0
 /**
  * 必死チェッカーに対応しているか調べる
  * $boardがなければloadも実行される
  */
 function isEnable()
 {
     if ($this->host) {
         if (!P2Util::isHost2chs($this->host)) {
             return false;
         }
     }
     if (!isset($this->boards)) {
         $this->load();
     }
     $this->enabled = in_array($this->bbs, $this->boards) ? true : false;
     return $this->enabled;
 }
Пример #14
0
Файл: css.php Проект: poppen/p2
/**
 * @return  string
 */
function _getSkinFilePath($skin = null)
{
    global $_conf;
    $skinFilePath = '';
    if ($skin) {
        $skinFilePath = P2Util::getSkinFilePathBySkinName($skin);
    } elseif ($skin_setting_path = _getSkinSettingPath()) {
        $skinFilePath = P2Util::getSkinFilePathBySkinName($skin_setting_path);
    }
    if (!$skinFilePath || !is_file($skinFilePath)) {
        $skinFilePath = $_conf['conf_user_style_inc_php'];
    }
    return $skinFilePath;
}
Пример #15
0
function _read_filter_setup()
{
    $host = $_GET['host'];
    $bbs = $_GET['bbs'];
    $key = $_GET['key'];
    $resnum = (int) $_GET['resnum'];
    $field = $_GET['field'];
    $aThread = new ThreadRead();
    $aThread->setThreadPathInfo($host, $bbs, $key);
    $aThread->readDat($aThread->keydat);
    $i = $resnum - 1;
    if (!($i >= 0 && $i < count($aThread->datlines) && isset($_GET['rf']) && is_array($_GET['rf']))) {
        P2Util::pushInfoHtml('<p>フィルタリングの指定が変です。</p>');
        unset($_GET['rf'], $_REQUEST['rf']);
        return;
    }
    $ares = $aThread->datlines[$i];
    $resar = $aThread->explodeDatLine($ares);
    $name = $resar[0];
    $mail = $resar[1];
    $date_id = $resar[2];
    $msg = $resar[3];
    $params = $_GET['rf'];
    $include = ResFilter::INCLUDE_NONE;
    $fields = explode(':', $field);
    $field = array_shift($fields);
    if (in_array('refs', $fields)) {
        $include |= ResFilter::INCLUDE_REFERENCES;
    }
    if (in_array('refed', $fields)) {
        $include |= ResFilter::INCLUDE_REFERENCED;
    }
    $params['field'] = $field;
    $params['include'] = $include;
    $resFilter = ResFilter::configure($params);
    $target = $resFilter->getTarget($ares, $resnum, $name, $mail, $date_id, $msg);
    if ($field == 'date') {
        $date_part = explode(' ', trim($target));
        $word = $date_part[0];
    } else {
        $word = $target;
    }
    $params['word'] = $word;
    $_REQUEST['rf'] = $params;
}
Пример #16
0
 public function replaceLinkToHTML($url, $str)
 {
     $this->setup();
     $src = false;
     foreach ($this->data as $v) {
         if (preg_match('{' . $v['match'] . '}', $url)) {
             $src = @preg_replace('{' . $v['match'] . '}', $v['replace'], $url);
             if (strstr($v['replace'], '$ime_url')) {
                 $src = str_replace('$ime_url', P2Util::throughIme($url), $src);
             }
             if (strstr($v['replace'], '$str')) {
                 $src = str_replace('$str', $str, $src);
             }
             break;
         }
     }
     return $src;
 }
Пример #17
0
/**
 * ファイル内容を読み込んで表示する関数
 */
function viewTxtFile($file, $encode)
{
    if ($file == '') {
        p2die('file が指定されていません');
    }
    $filename = basename($file);
    $ptitle = $filename;
    //ファイル内容読み込み
    $cont = FileCtl::file_read_contents($file);
    if ($cont === false) {
        $cont_area = '';
    } else {
        if ($encode == 'EUC-JP') {
            $cont = mb_convert_encoding($cont, 'CP932', 'CP51932');
        } elseif ($encode == 'UTF-8') {
            $cont = mb_convert_encoding($cont, 'CP932', 'UTF-8');
        }
        $cont_area = htmlspecialchars($cont, ENT_QUOTES);
    }
    // プリント
    echo <<<EOHEADER
<!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">
    {$_conf['extra_headers_ht']}
    <title>{$ptitle}</title>
    <link rel="shortcut icon" type="image/x-icon" href="favicon.ico">
</head>
<body onload="top.document.title=self.document.title;">

EOHEADER;
    P2Util::printInfoHtml();
    echo "<pre>";
    echo $cont_area;
    echo "</pre>";
    echo '</body></html>';
    return TRUE;
}
Пример #18
0
/**
 * チェックした書き込み記事を削除する
 */
function deleMsg($checked_hists)
{
    global $_conf;
    $lock = new P2Lock($_conf['res_hist_dat'], false);
    // 読み込んで
    $reslines = FileCtl::file_read_lines($_conf['res_hist_dat'], FILE_IGNORE_NEW_LINES);
    if ($reslines === false) {
        p2die("{$_conf['res_hist_dat']} を開けませんでした");
    }
    // ファイルの下に記録されているものが新しいので逆順にする
    $reslines = array_reverse($reslines);
    $neolines = array();
    // チェックして整えて
    if ($reslines) {
        $n = 1;
        foreach ($reslines as $ares) {
            $rar = explode("<>", $ares);
            // 番号と日付が一致するかをチェックする
            if (checkMsgID($checked_hists, $n, $rar[2])) {
                $rmnums[] = $n;
                // 削除する番号を登録
            }
            $n++;
        }
        $neolines = rmLine($rmnums, $reslines);
        P2Util::pushInfoHtml('<p>p2 info: ' . count($rmnums) . '件のレス記事を削除しました</p>');
    }
    if (is_array($neolines)) {
        // 行順を戻す
        $neolines = array_reverse($neolines);
        $cont = "";
        if ($neolines) {
            $cont = implode("\n", $neolines) . "\n";
        }
        // 書き込む
        if (FileCtl::file_write_contents($_conf['res_hist_dat'], $cont) === false) {
            p2die('cannot write file.');
        }
    }
}
Пример #19
0
/**
 * ファイル内容を読み込んで表示する関数
 */
function viewTxtFile($file, $encode)
{
    if (!$file) {
        p2die('file が指定されていません');
    }
    $filename = basename($file);
    $ptitle = $filename;
    //ファイル内容読み込み
    $cont = FileCtl::file_read_contents(P2_BASE_DIR . DIRECTORY_SEPARATOR . $file);
    if ($cont === false) {
        $cont_area = '';
    } else {
        if (strcasecmp($encode, 'EUC-JP') === 0) {
            $cont = mb_convert_encoding($cont, 'CP932', 'CP51932');
        } elseif (strcasecmp($encode, 'UTF-8') === 0) {
            $cont = mb_convert_encoding($cont, 'CP932', 'UTF-8');
        }
        $cont_area = p2h($cont);
    }
    // プリント
    echo <<<EOHEADER
<!DOCTYPE html>
<html lang="ja">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS">
    <meta name="ROBOTS" content="NOINDEX, NOFOLLOW">
    {$_conf['extra_headers_ht']}
    <title>{$ptitle}</title>
    <link rel="shortcut icon" type="image/x-icon" href="favicon.ico">
</head>
<body onload="top.document.title=self.document.title;">

EOHEADER;
    P2Util::printInfoHtml();
    echo "<pre>";
    echo $cont_area;
    echo "</pre>";
    echo '</body></html>';
    return true;
}
Пример #20
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 
}
Пример #21
0
/**
 * @return  string  HTML
 */
function _getAuthSubInputHtml($mobile)
{
    $auth_sub_input_ht = '';
    // EZ認証
    if (!empty($_SERVER['HTTP_X_UP_SUBNO'])) {
        //if (!$_login->hasRegistedAuthCarrier('EZWEB')) {
        $auth_sub_input_ht = '<input type="hidden" name="ctl_regist_ez" value="1">' . "\n" . '<input type="checkbox" name="regist_ez" value="1" checked>EZ端末IDで認証を登録<br>';
        //}
        // SoftBank認証
        // http://www.dp.j-phone.com/dp/tool_dl/web/useragent.php
    } elseif (HostCheck::isAddrSoftBank() and P2Util::getSoftBankID()) {
        //if (!$_login->hasRegistedAuthCarrier('SOFTBANK')) {
        $auth_sub_input_ht = '<input type="hidden" name="ctl_regist_jp" value="1">' . "\n" . '<input type="checkbox" name="regist_jp" value="1" checked>SoftBank端末IDで認証を登録<br>';
        //}
        // docomo認証
    } elseif ($mobile->isDoCoMo()) {
        //if (!$_login->hasRegistedAuthCarrier('DOCOMO')) {
        $auth_sub_input_ht = '<input type="hidden" name="ctl_regist_docomo" value="1">' . "\n" . '<input type="checkbox" name="regist_docomo" value="1" checked>docomo端末IDで認証を登録<br>';
        //}
        // Cookie認証
    } else {
        $regist_cookie_checked = ' checked';
        if (isset($_POST['submit_newuser']) || isset($_POST['submit_userlogin'])) {
            if (empty($_POST['regist_cookie'])) {
                $regist_cookie_checked = '';
            }
        }
        $ignore_cip_checked = '';
        if (isset($_POST['submit_newuser']) || isset($_POST['submit_userlogin'])) {
            if (geti($_POST['ignore_cip']) == '1') {
                $ignore_cip_checked = ' checked';
            }
        } else {
            if (geti($_COOKIE['ignore_cip']) == '1') {
                $ignore_cip_checked = ' checked';
            }
        }
        $auth_sub_input_ht = '<input type="hidden" name="ctl_regist_cookie" value="1">' . sprintf('<input type="checkbox" id="regist_cookie" name="regist_cookie" value="1"%s><label for="regist_cookie">ログイン情報をCookieに保存する(推奨)</label><br>', $regist_cookie_checked) . sprintf('<input type="checkbox" id="ignore_cip" name="ignore_cip" value="1"%s><label for="ignore_cip">Cookie認証時にIPの同一性をチェックしない</label><br>', $ignore_cip_checked);
    }
    return $auth_sub_input_ht;
}
Пример #22
0
/**
 * rep2 - デザイン用 設定ファイル
 *
 * コメント冒頭の() 内はデフォルト値
 * 設定は style/*_css.inc と連動
 *
 * このファイルの設定は、お好みに応じて変更してください
 */
$STYLE['a_underline_none'] = "2";
// ("2") リンクに下線を(つける:0, つけない:1, スレタイトル一覧だけつけない:2)
// {{{ フォント
$STYLE['fontfamily'] = "ヒラギノ角ゴ Pro W3";
// ("ヒラギノ角ゴ Pro W3") 基本のフォント
if (strpos($_SERVER['HTTP_USER_AGENT'], 'Mac') !== false) {
    if (!P2Util::isBrowserSafariGroup()) {
        /* ブラウザが Macで Safari 以外 なら */
        $STYLE['fontfamily_bold'] = "ヒラギノ角ゴ Pro W6";
        // ("ヒラギノ角ゴ Pro W6") 基本ボールド用フォント(普通に太字にしたい場合は指定しない(""))
    }
    /* Mac用フォントサイズ */
    $STYLE['fontsize'] = "12px";
    // ("12px") 基本フォントの大きさ
    $STYLE['menu_fontsize'] = "11px";
    // ("11px") 板メニューのフォントの大きさ
    $STYLE['sb_fontsize'] = "11px";
    // ("11px") スレ一覧のフォントの大きさ
    $STYLE['read_fontsize'] = "12px";
    // ("12px") スレッド内容表示のフォントの大きさ
    $STYLE['respop_fontsize'] = "11px";
    // ("11px") 引用レスポップアップ表示のフォントの大きさ
Пример #23
0
    gFade = {$fade};
    gExistWord = {$existWord};
    gShowKossoriHeadbarTimerID = null;
    gIsPageLoaded = false;
    addLoadEvent(function() {
        gIsPageLoaded = true;
        {$onload_script}
    });
    //-->
    </script>

</head>
<body{$body_at} >

EOP;
P2Util::printInfoHtml();
// スマートポップアップメニュー JavaScriptコード
//フォントサイズ等 conf_user_style.inc.php  をいじるとPCも変わるのでここで書き換え
if ($_conf['enable_spm']) {
    $STYLE['respop_color'] = "#FFFFFF";
    // ("#000") レスポップアップのテキスト色
    $STYLE['respop_bgcolor'] = "";
    // ("#ffffcc") レスポップアップの背景色
    $STYLE['respop_fontsize'] = '13px';
    $aThread->showSmartPopUpMenuJs();
}
// スレが板サーバになければ
if ($aThread->diedat) {
    if ($aThread->getdat_error_msg_ht) {
        $diedat_msg = $aThread->getdat_error_msg_ht;
    } else {
Пример #24
0
    $dat_soko_ht = <<<EOP
<a href="{$_conf['subject_php']}?host={$aThreadList->host}{$bbs_q}{$norefresh_q}&amp;spmode=soko{$_conf['k_at_a']}">dat倉庫</a>
EOP;
} else {
    $dat_soko_ht = '';
}
// あぼーん中のスレッド
if (!empty($ta_num)) {
    $taborn_link_ht = <<<EOP
\t<a href="{$_conf['subject_php']}?host={$aThreadList->host}{$bbs_q}{$norefresh_q}&amp;spmode=taborn{$_conf['k_at_a']}">アボン中({$ta_num})</a> 
EOP;
} else {
    $taborn_link_ht = '';
}
// 新規スレッド作成
if (!$aThreadList->spmode and !P2Util::isHostKossoriEnq($aThreadList->host)) {
    $buildnewthread_ht = <<<EOP
\t<a href="post_form_i.php?host={$aThreadList->host}{$bbs_q}&amp;newthread=1{$_conf['k_at_a']}">スレ立て</a>
EOP;
} else {
    $buildnewthread_ht = '';
}
// {{{ ソート変更 (新着 レス No. タイトル 板 すばやさ 勢い Birthday ☆)
$sorts = array('midoku' => '新着', 'res' => 'レス', 'no' => 'No.', 'title' => 'タイトル');
if ($aThreadList->spmode and $aThreadList->spmode != 'taborn' and $aThreadList->spmode != 'soko') {
    $sorts['ita'] = '板';
}
if ($_conf['sb_show_spd']) {
    $sorts['spd'] = 'すばやさ';
}
if ($_conf['sb_show_ikioi']) {
Пример #25
0
/**
 * スレタイ(と本文)でマッチしたらtrueを返す
 */
function matchSbFilter(Thread $aThread)
{
    // 全文検索でdatがあれば、内容を読み込む
    if (!empty($_REQUEST['find_cont'])) {
        if (file_exists($aThread->keydat)) {
            $subject = file_get_contents($aThread->keydat);
            // be.2ch.net はEUC
            if (P2Util::isHostBe2chNet($aThread->host)) {
                $subject = mb_convert_encoding($subject, 'CP932', 'CP51932');
            }
        } else {
            return false;
        }
    } else {
        $subject = $aThread->ttitle;
    }
    if ($GLOBALS['sb_filter']['method'] == 'and') {
        foreach ($GLOBALS['words_fm'] as $word) {
            if (!StrCtl::filterMatch($word, $subject)) {
                return false;
            }
        }
    } else {
        if (!StrCtl::filterMatch($GLOBALS['word_fm'], $subject)) {
            return false;
        }
    }
    return true;
}
Пример #26
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;
}
Пример #27
0
function readNew($aThread)
{
    global $_conf, $newthre_num, $STYLE;
    global $spmode, $word, $newtime;
    $orig_no_label = !empty($_conf['expack.iphone.toolbars.no_label']);
    $_conf['expack.iphone.toolbars.no_label'] = true;
    $newthre_num++;
    //==========================================================
    // idxの読み込み
    //==========================================================
    //hostを分解してidxファイルのパスを求める
    $aThread->setThreadPathInfo($aThread->host, $aThread->bbs, $aThread->key);
    //FileCtl::mkdirFor($aThread->keyidx); // 板ディレクトリが無ければ作る //この操作はおそらく不要
    $aThread->itaj = P2Util::getItaName($aThread->host, $aThread->bbs);
    if (!$aThread->itaj) {
        $aThread->itaj = $aThread->bbs;
    }
    // idxファイルがあれば読み込む
    if ($lines = FileCtl::file_read_lines($aThread->keyidx, FILE_IGNORE_NEW_LINES)) {
        $data = explode('<>', $lines[0]);
    } else {
        $data = array_fill(0, 12, '');
    }
    $aThread->getThreadInfoFromIdx();
    //==================================================================
    // DATのダウンロード
    //==================================================================
    if (!($word and file_exists($aThread->keydat))) {
        $aThread->downloadDat();
    }
    // DATを読み込み
    $aThread->readDat();
    $aThread->setTitleFromLocal();
    // ローカルからタイトルを取得して設定
    //===========================================================
    // 表示レス番の範囲を設定
    //===========================================================
    // 取得済みなら
    if ($aThread->isKitoku()) {
        $from_num = $aThread->readnum + 1 - $_conf['respointer'] - $_conf['before_respointer_new'];
        if ($from_num > $aThread->rescount) {
            $from_num = $aThread->rescount - $_conf['respointer'] - $_conf['before_respointer_new'];
        }
        if ($from_num < 1) {
            $from_num = 1;
        }
        //if (!$aThread->ls) {
        $aThread->ls = "{$from_num}-";
        //}
    }
    $aThread->lsToPoint();
    //==================================================================
    // ヘッダ 表示
    //==================================================================
    $motothre_url = $aThread->getMotoThread();
    $ttitle_en = UrlSafeBase64::encode($aThread->ttitle);
    $ttitle_en_q = '&amp;ttitle_en=' . $ttitle_en;
    $bbs_q = '&amp;bbs=' . $aThread->bbs;
    $key_q = '&amp;key=' . $aThread->key;
    $host_bbs_key_q = 'host=' . $aThread->host . $bbs_q . $key_q;
    $popup_q = '&amp;popup=1';
    $itaj_hd = htmlspecialchars($aThread->itaj, ENT_QUOTES, 'Shift_JIS');
    if ($spmode) {
        $read_header_itaj_ht = "({$itaj_hd})";
    } else {
        $read_header_itaj_ht = '';
    }
    if ($_conf['iphone']) {
        if ($read_header_itaj_ht !== '') {
            $read_header_itaj_ht = "<span class=\"btitle\">{$read_header_itaj_ht}</span>";
        }
        $read_header_ht = <<<EOP
<div class="ntoolbar mtoolbar mtoolbar_top" id="ntt{$newthre_num}">
<h2 class="ttitle">{$aThread->ttitle_hd} {$read_header_itaj_ht}</h2>
EOP;
        $read_header_ht .= '<div class="mover">';
        $read_header_ht .= toolbar_i_standard_button('img/gp2-down.png', '', sprintf('#ntt%d', $newthre_num + 1));
        $read_header_ht .= '</div>';
        $info_ht = P2Util::getInfoHtml();
        if (strlen($info_ht)) {
            $read_header_ht .= "<div class=\"info\">{$info_ht}</div>";
        }
        $read_header_ht .= '</div>';
    } else {
        P2Util::printInfoHtml();
        $read_header_ht = <<<EOP
<hr><div id="ntt{$newthre_num}" name="ntt{$newthre_num}"><font color="{$STYLE['mobile_read_ttitle_color']}"><b>{$aThread->ttitle_hd}</b></font> {$read_header_itaj_ht} <a href="#ntt_bt{$newthre_num}">▼</a></div><hr>
EOP;
    }
    //==================================================================
    // ローカルDatを読み込んでHTML表示
    //==================================================================
    $aThread->resrange['nofirst'] = true;
    $GLOBALS['newres_to_show_flag'] = false;
    $read_cont_ht = '';
    if ($aThread->rescount) {
        $aShowThread = new ShowThreadK($aThread, true);
        if ($_conf['iphone'] && $_conf['expack.spm.enabled']) {
            $read_cont_ht .= $aShowThread->getSpmObjJs();
        }
        $read_cont_ht .= $aShowThread->getDatToHtml();
        unset($aShowThread);
    }
    //==================================================================
    // フッタ 表示
    //==================================================================
    // 表示範囲
    if ($aThread->resrange['start'] == $aThread->resrange['to']) {
        $read_range_on = $aThread->resrange['start'];
    } else {
        $read_range_on = "{$aThread->resrange['start']}-{$aThread->resrange['to']}";
    }
    $read_range_ht = "{$read_range_on}/{$aThread->rescount}";
    // ツールバー部分HTML =======
    if ($spmode) {
        $toolbar_itaj_ht = "(<a href=\"{$_conf['subject_php']}?{$host_bbs_key_q}{$_conf['k_at_a']}\">{$itaj_hd}</a>)";
    } else {
        $toolbar_itaj_ht = '';
    }
    if ($_conf['iphone']) {
        if ($toolbar_itaj_ht !== '') {
            $toolbar_itaj_ht = "<span class=\"btitle\">{$toolbar_itaj_ht}</span>";
        }
        $read_footer_ht = <<<EOP
<div class="ntoolbar mtoolbar mtoolbar_bottom" id="ntt_btm{$newthre_num}">
<table><tbody><tr>
EOP;
        // 情報
        $read_footer_ht .= '<td>';
        $escaped_url = "info.php?{$host_bbs_key_q}{$ttitle_en_q}{$_conf['k_at_a']}";
        $read_footer_ht .= toolbar_i_opentab_button('img/gp5-info.png', '', $escaped_url);
        $read_footer_ht .= '</td>';
        // 表示範囲
        $read_footer_ht .= "<td colspan=\"3\"><span class=\"large\">{$read_range_ht}</span></td>";
        // ツール
        $read_footer_ht .= '<td>';
        $escaped_url = "spm_k.php?{$host_bbs_key_q}&amp;ls={$aThread->ls}&amp;spm_default={$aThread->resrange['to']}{$_conf['k_at_a']}";
        $read_footer_ht .= toolbar_i_opentab_button('img/glyphish/icons2/20-gear2.png', '', $escaped_url);
        $read_footer_ht .= '</td>';
        // タイトル等
        $read_footer_ht .= <<<EOP
</tr></tbody></table>
<div class="ttitle"><a href="{$_conf['read_php']}?{$host_bbs_key_q}&amp;offline=1&amp;rescount={$aThread->rescount}{$_conf['k_at_a']}" target="_blank">{$aThread->ttitle_hd}</a> {$toolbar_itaj_ht}</div>
<div class="mover">
EOP;
        $read_footer_ht .= toolbar_i_standard_button('img/gp1-up.png', '', "#ntt{$newthre_num}");
        $read_footer_ht .= '</div></div>';
    } else {
        $read_footer_ht = <<<EOP
<div id="ntt_bt{$newthre_num}" name="ntt_bt{$newthre_num}" class="read_new_toolbar">
{$read_range_ht}
<a href="info.php?{$host_bbs_key_q}{$ttitle_en_q}{$_conf['k_at_a']}">情</a>
<a href="spm_k.php?{$host_bbs_key_q}&amp;ls={$aThread->ls}&amp;spm_default={$aThread->resrange['to']}&amp;from_read_new=1{$_conf['k_at_a']}">特</a>
<br>
<a href="{$_conf['read_php']}?{$host_bbs_key_q}&amp;offline=1&amp;rescount={$aThread->rescount}{$_conf['k_at_a']}#r{$aThread->rescount}">{$aThread->ttitle_hd}</a> {$toolbar_itaj_ht} <a href="#ntt{$newthre_num}">▲</a>
</div>
<hr>

EOP;
    }
    // 透明あぼーんや表示数制限で新しいレス表示がない場合はスキップ
    if ($GLOBALS['newres_to_show_flag']) {
        echo $read_header_ht;
        echo $read_cont_ht;
        echo $read_footer_ht;
    }
    //==================================================================
    // key.idxの値設定
    //==================================================================
    if ($aThread->rescount) {
        $aThread->readnum = min($aThread->rescount, max(0, $data[5], $aThread->resrange['to']));
        $newline = $aThread->readnum + 1;
        // $newlineは廃止予定だが、旧互換用に念のため
        $sar = array($aThread->ttitle, $aThread->key, $data[2], $aThread->rescount, $aThread->modified, $aThread->readnum, $data[6], $data[7], $data[8], $newline, $data[10], $data[11], $aThread->datochiok);
        P2Util::recKeyIdx($aThread->keyidx, $sar);
        // key.idxに記録
    }
    $_conf['expack.iphone.toolbars.no_label'] = $orig_no_label;
}
Пример #28
0
         $dores_atag = P2View::tagA($dores_uri, hs($dores_st), array_merge(array('accesskey' => $_conf['pc_accesskey']['dores'], 'title' => 'アクセスキー[' . $_conf['pc_accesskey']['dores'] . ']', 'target' => '_self', 'onClick' => sprintf("return !openSubWin('%s',%s,1,0)", str_replace("'", "\\'", $dores_onclick_uri), $STYLE['post_pop_size'])), $onmouse_showform_attrs));
     }
     $dores_html = '<span style="white-space: nowrap;">' . $dores_atag . '</span>';
     $res_form_html_pb = $res_form_html;
 }
 $q_ichi_ht = '';
 if (isset($res1['body'])) {
     $q_ichi_ht = $res1['body'] . " | ";
 }
 // レスのすばやさ
 $spd_ht = '';
 if ($spd_st = $aThread->getTimePerRes() and $spd_st != '-') {
     $spd_ht = '<span class="spd" style="white-space: nowrap;" title="すばやさ=時間/レス">' . $spd_st . '</span>';
 }
 // DAT容量
 $datsize_ht = sprintf('<span class="datsize" style="white-space: nowrap;" title="DAT容量">%s</span>', P2Util::getTranslatedUnitFileSize($aThread->getDatBytesFromLocalDat(false), 'KB'));
 // 500KB以上で強調表示
 if ($datsize / 1024 >= 500) {
     $datsize_ht = '<b>' . $datsize_ht . '</b>';
 }
 // {{{ フィルタヒットがあった場合、次Xと続きを読むを更新する
 if (!empty($GLOBALS['last_hit_resnum'])) {
     $read_navi_next_anchor = "";
     if ($GLOBALS['last_hit_resnum'] == $aThread->rescount) {
         $read_navi_next_anchor = "#r{$aThread->rescount}";
     }
     $after_rnum = $GLOBALS['last_hit_resnum'] + $rnum_range;
     $read_navi_next_ht = P2View::tagA(UriUtil::buildQueryUri($_conf['read_php'], array_merge(array('host' => $aThread->host, 'bbs' => $aThread->bbs, 'key' => $aThread->key, 'ls' => "{$GLOBALS['last_hit_resnum']}-{$after_rnum}", 'nt' => date('gis')), $offline_range_qs)) . $read_navi_next_anchor, hs("{$next_st}{$rnum_range}"));
     // 「続きを読む」
     $read_footer_navi_new_ht = _getTudukiATag($aThread, $tuduki_st);
 }
Пример #29
0
/**
 * 無効タグ属性などを消去するコールバック関数
 */
function rss_desc_tag_cleaner($tag)
{
    global $_conf;
    $element = strtolower($tag[1]);
    $attributes = trim($tag[2]);
    $close = trim($tag[3]);
    // HTML 4.01形式で表示するので無視
    // 終了タグなら
    if (!$attributes || substr($element, 0, 1) == '/') {
        return '<' . $element . '>';
    }
    $tag = '<' . $element;
    if (preg_match_all('/(?:^| )([A-Za-z\\-]+)\\s*=\\s*("[^"]*"|\'[^\']*\'|\\w[^ ]*)(?: |$)/', $attributes, $matches, PREG_SET_ORDER)) {
        foreach ($matches as $attr) {
            $key = strtolower($attr[1]);
            $value = $attr[2];
            // JavaScriptイベントハンドラ・スタイルシート・ターゲットなどの属性は禁止
            if (preg_match('/^(on[a-z]+|style|class|id|target)$/', $key)) {
                continue;
            }
            // 値の引用符を削除
            $q = substr($value, 0, 1);
            if ($q == "'") {
                $value = str_replace('"', '&quot;', substr($value, 1, -1));
            } elseif ($q == '"') {
                $value = substr($value, 1, -1);
            }
            // 属性で分岐
            switch ($key) {
                case 'href':
                    if ($element != 'a' || preg_match('/^javascript:/i', $value)) {
                        break;
                        // a要素以外はhref属性禁止
                    }
                    if (preg_match('|^[^/:]*/|', $value)) {
                        $value = rss_url_rel_to_abs($value);
                    }
                    return '<a href="' . P2Util::throughIme($value) . '"' . $_conf['ext_win_target_at'] . '>';
                case 'src':
                    if ($element != 'img' || preg_match('/^javascript:/i', $value)) {
                        break;
                        // img要素以外はsrc属性禁止
                    }
                    if (preg_match('|^[^/:]*/|', $value)) {
                        $value = rss_url_rel_to_abs($value);
                    }
                    if (P2_RSS_IMAGECACHE_AVAILABLE) {
                        $image = rss_get_image($value, $GLOBALS['channel']['title']);
                        if ($image[3] != P2_IMAGECACHE_OK) {
                            if ($_conf['ktai']) {
                                // あぼーん画像 - 携帯
                                switch ($image[3]) {
                                    case P2_IMAGECACHE_ABORN:
                                        return '[p2:あぼーん画像]';
                                    case P2_IMAGECACHE_BROKEN:
                                        return '[p2:壊]';
                                        // これと
                                    // これと
                                    case P2_IMAGECACHE_LARGE:
                                        return '[p2:大]';
                                        // これは現状では無効
                                    // これは現状では無効
                                    case P2_IMAGECACHE_VIRUS:
                                        return '[p2:ウィルス警告]';
                                    default:
                                        return '[p2:unknown error]';
                                        // 予備
                                }
                            } else {
                                // あぼーん画像 - PC
                                return "<img src=\"{$image[0][0]}\" {$image[0][1]}>";
                            }
                        } elseif ($_conf['ktai']) {
                            // インライン表示 - 携帯(PC用サムネイルサイズ)
                            return "<img src=\"{$image[1][0]}\" {$image[1][1]}>";
                        } else {
                            // インライン表示 - PC(フルサイズ)
                            return "<img src=\"{$image[0][0]}\" {$image[0][1]}>";
                        }
                    }
                    // イメージキャッシュが無効のとき画像は表示しない
                    break '';
                case 'alt':
                    if ($element == 'img' && !P2_RSS_IMAGECACHE_AVAILABLE) {
                        return ' [img:' . $value . ']';
                        // 画像はalt属性を代わりに表示
                    }
                    $tag .= ' ="' . $value . '"';
                    break;
                case 'width':
                case 'height':
                    // とりあえず無視
                    break;
                default:
                    $tag .= ' ="' . $value . '"';
            }
        }
        // endforeach
        // 要素で最終確認
        switch ($element) {
            // href属性がなかったa要素
            case 'a':
                return '<a>';
                // alt属性がなかったimg要素
            // alt属性がなかったimg要素
            case 'img':
                return '';
        }
    }
    // endif
    $tag .= '>';
    return $tag;
}
Пример #30
0
}
// }}}
// {{{ 出力
$flexy->setData('skin', $skin_en);
$flexy->setData('php_self', $_SERVER['SCRIPT_NAME']);
$flexy->setData('p2vid', P2_VERSION_ID);
$flexy->setData('info_msg', P2Util::getInfoHtml());
$flexy->setData('pc', !$_conf['ktai']);
$flexy->setData('iphone', $_conf['iphone']);
$flexy->setData('doctype', $_conf['doctype']);
$flexy->setData('extra_headers', $_conf['extra_headers_ht']);
$flexy->setData('extra_headers_x', $_conf['extra_headers_xht']);
if ($db->dsn['phptype'] == 'sqlite' || $viewer_cache_exists) {
    $flexy->setData('enable_optimize_db', true);
} else {
    $flexy->setData('enable_optimize_db', false);
}
P2Util::header_nocache();
$flexy->compile('ic2mng.tpl.html');
$flexy->output();
// }}}
/*
 * Local Variables:
 * mode: php
 * coding: cp932
 * tab-width: 4
 * c-basic-offset: 4
 * indent-tabs-mode: nil
 * End:
 */
// vim: set syn=php fenc=cp932 ai et ts=4 sw=4 sts=4 fdm=marker: