本文整理汇总了PHP中P2Util::isBbsBe2chNet方法的典型用法代码示例。如果您正苦于以下问题:PHP P2Util::isBbsBe2chNet方法的具体用法?PHP P2Util::isBbsBe2chNet怎么用?PHP P2Util::isBbsBe2chNet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类P2Util
的用法示例。
在下文中一共展示了P2Util::isBbsBe2chNet方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _buildRequestForPost
/**
* @return array array($request, $send_host, $send_port)
*/
function _buildRequestForPost($host, $bbs, $key, $post, $bbs_cgi)
{
global $_conf, $_login;
$method = 'POST';
$bbs_cgi_url = 'http://' . $host . $bbs_cgi;
$purl = parse_url($bbs_cgi_url);
$purl['query'] = isset($purl['query']) ? '?' . $purl['query'] : '';
// プロキシ
if ($_conf['proxy_use']) {
$send_host = $_conf['proxy_host'];
$send_port = $_conf['proxy_port'];
$send_path = $bbs_cgi_url;
} else {
$send_host = $purl['host'];
$send_port = isset($purl['port']) ? $purl['port'] : null;
$send_path = $purl['path'] . $purl['query'];
}
!$send_port and $send_port = 80;
$request = $method . ' ' . $send_path . " HTTP/1.0" . "\r\n";
$request .= 'Host: ' . $purl['host'] . "\r\n";
$remote_host = P2Util::getRemoteHost($_SERVER['REMOTE_ADDR']);
$add_user_info = '';
//$add_user_info = "; p2-client-ip: {$_SERVER['REMOTE_ADDR']}";
//$add_user_info .= "; p2-client-host: {$remote_host}";
$request .= sprintf('User-Agent: Monazilla/1.00 (%s/%s%s)', $_conf['p2uaname'], $_conf['p2version'], $add_user_info) . "\r\n";
$request .= 'Referer: http://' . $purl['host'] . '/' . "\r\n";
// クライアントのIPを送信するp2独自のヘッダ
$request .= "X-P2-Client-IP: " . $_SERVER['REMOTE_ADDR'] . "\r\n";
$request .= "X-P2-Client-Host: " . $remote_host . "\r\n";
// クッキー
$cookies_to_send = '';
$p2cookies = _readCookieFile(_cachePathForCookieByHost($host));
if ($p2cookies) {
foreach ($p2cookies as $cname => $cvalue) {
if ($cname != 'expires') {
$cookies_to_send .= " {$cname}={$cvalue};";
}
}
}
// be.2ch 認証クッキー
// be板では自動Be書き込みを試みる
if (P2Util::isBbsBe2chNet($host, $bbs) || !empty($_REQUEST['submit_beres'])) {
$cookies_to_send .= ' MDMD=' . $_conf['be_2ch_code'] . ';';
// be.2ch.netの認証コード(パスワードではない)
$cookies_to_send .= ' DMDM=' . $_conf['be_2ch_mail'] . ';';
// be.2ch.netの登録メールアドレス
}
!$cookies_to_send and $cookies_to_send = ' ;';
$request .= 'Cookie:' . $cookies_to_send . "\r\n";
//$request .= 'Cookie: PON='.$SPID.'; NAME='.$FROM.'; MAIL='.$mail."\r\n";
$request .= 'Connection: Close' . "\r\n";
// {{{ POSTの時はヘッダを追加して末尾にURLエンコードしたデータを添付
if (strtoupper($method) == 'POST') {
$post_enc = array();
while (list($name, $value) = each($post)) {
if (!isset($value)) {
continue;
}
// したらば or be.2ch.netなら、EUCに変換
if (P2Util::isHostJbbsShitaraba($host) || P2Util::isHostBe2chNet($host)) {
$value = mb_convert_encoding($value, 'eucJP-win', 'SJIS-win');
}
$post_enc[] = $name . "=" . urlencode($value);
}
$postdata = implode('&', $post_enc);
$request .= "Content-Type: application/x-www-form-urlencoded\r\n";
$request .= "Content-Length: " . strlen($postdata) . "\r\n";
$request .= "\r\n";
$request .= $postdata;
} else {
$request .= "\r\n";
}
return array($request, $send_host, $send_port);
}
示例2: popUpFootbarFormIPhone
}
$wrap = 'soft';
// 携帯
} else {
$msg_cols_at = '';
$STYLE['post_msg_rows'] = 5;
$wrap = 'soft';
}
// Be書き込み
$htm['be2ch'] = '';
if (P2Util::isHost2chs($host) and $_conf['be_2ch_code'] && $_conf['be_2ch_mail']) {
$htm['be2ch'] = '<input id="submit_beres" type="submit" name="submit_beres" value="BEで書き込む" onClick="setHiddenValue(this); popUpFootbarFormIPhone(1, 1);"><br>';
}
// be板では書き込みを無効にする
$htm['title_need_be'] = '';
if (P2Util::isBbsBe2chNet($host, $bbs)) {
// やっぱり無効にしない。書き込み失敗時に、2ch側でBeログインへの誘導があるので。
//$res_disabled_at = ' disabled';
if ($_conf['be_2ch_code'] && $_conf['be_2ch_mail']) {
$htm['title_need_be'] = ' title="Be板につき、自動Be書き込みします"';
} else {
$htm['title_need_be'] = ' title="書き込むにはBeログインが必要です"';
}
}
// sage checkbox
$on_check_sage = '';
$sage_cb_ht = '';
if (UA::isPC() || UA::isIPhoneGroup()) {
$on_check_sage = ' onChange="checkSage();"';
$sage_cb_ht = '<input id="sage" type="checkbox" onClick="mailSage();">';
}
示例3: postIt
/**
* レスを書き込む or 新規スレッドを立てる
* スレ立ての場合は、$key は空 '' でよい
*
* @return boolean 書き込み成功なら true、失敗なら false
*/
function postIt($host, $bbs, $key, $post)
{
global $_conf, $post_result, $post_error2ch, $popup, $rescount, $ttitle_en, $STYLE;
global $bbs_cgi, $post_cache;
$method = "POST";
$bbs_cgi_url = "http://" . $host . $bbs_cgi;
$purl = parse_url($bbs_cgi_url);
if (isset($purl['query'])) {
$purl['query'] = "?" . $purl['query'];
} else {
$purl['query'] = "";
}
// プロキシ
if ($_conf['proxy_use']) {
$send_host = $_conf['proxy_host'];
$send_port = $_conf['proxy_port'];
$send_path = $bbs_cgi_url;
} else {
$send_host = $purl['host'];
$send_port = $purl['port'];
$send_port = isset($purl['port']) ? $purl['port'] : null;
$send_path = $purl['path'] . $purl['query'];
}
!$send_port and $send_port = 80;
$request = $method . " " . $send_path . " HTTP/1.0" . "\r\n";
$request .= "Host: " . $purl['host'] . "\r\n";
$remote_host = P2Util::getRemoteHost($_SERVER['REMOTE_ADDR']);
$add_user_info = '';
//$add_user_info = "; p2-client-ip: {$_SERVER['REMOTE_ADDR']}";
//$add_user_info .= "; p2-client-host: {$remote_host}";
$request .= "User-Agent: Monazilla/1.00 (" . $_conf['p2name'] . "/" . $_conf['p2version'] . "{$add_user_info})" . "\r\n";
$request .= 'Referer: http://' . $purl['host'] . '/' . "\r\n";
// クライアントのIPを送信するp2独自のヘッダ
$request .= "X-P2-Client-IP: " . $_SERVER['REMOTE_ADDR'] . "\r\n";
$request .= "X-P2-Client-Host: " . $remote_host . "\r\n";
// クッキー
$cookies_to_send = "";
// クッキーの読み込み
$cookie_file = cachePathForCookie($host);
$p2cookies = readCookieFile($cookie_file);
if ($p2cookies) {
foreach ($p2cookies as $cname => $cvalue) {
if ($cname != 'expires') {
$cookies_to_send .= " {$cname}={$cvalue};";
}
}
}
// be.2ch 認証クッキー
// be板では自動Be書き込みを試みる
if (P2Util::isBbsBe2chNet($host, $bbs) || !empty($_REQUEST['submit_beres'])) {
$cookies_to_send .= ' MDMD=' . $_conf['be_2ch_code'] . ';';
// be.2ch.netの認証コード(パスワードではない)
$cookies_to_send .= ' DMDM=' . $_conf['be_2ch_mail'] . ';';
// be.2ch.netの登録メールアドレス
}
!$cookies_to_send and $cookies_to_send = ' ;';
$request .= 'Cookie:' . $cookies_to_send . "\r\n";
//$request .= 'Cookie: PON='.$SPID.'; NAME='.$FROM.'; MAIL='.$mail."\r\n";
$request .= "Connection: Close\r\n";
// {{{ POSTの時はヘッダを追加して末尾にURLエンコードしたデータを添付
if (strtoupper($method) == "POST") {
$post_enc = array();
while (list($name, $value) = each($post)) {
if (!isset($value)) {
continue;
}
// したらば or be.2ch.netなら、EUCに変換
if (P2Util::isHostJbbsShitaraba($host) || P2Util::isHostBe2chNet($host)) {
$value = mb_convert_encoding($value, 'eucJP-win', 'SJIS-win');
}
$post_enc[] = $name . "=" . urlencode($value);
}
$postdata = implode("&", $post_enc);
$request .= "Content-Type: application/x-www-form-urlencoded\r\n";
$request .= "Content-Length: " . strlen($postdata) . "\r\n";
$request .= "\r\n";
$request .= $postdata;
} else {
$request .= "\r\n";
}
// }}}
$maru_kakiko = empty($_POST['maru_kakiko']) ? 0 : 1;
setConfUser('maru_kakiko', $maru_kakiko);
// 書き込みを一時的に保存
$failed_post_file = P2Util::getFailedPostFilePath($host, $bbs, $key);
$cont = serialize($post_cache);
DataPhp::writeDataPhp($failed_post_file, $cont, $_conf['res_write_perm']);
// WEBサーバへ接続
$fp = fsockopen($send_host, $send_port, $errno, $errstr, $_conf['fsockopen_time_limit']);
if (!$fp) {
showPostMsg(false, "サーバ接続エラー: {$errstr} ({$errno})<br>p2 Error: 板サーバへの接続に失敗しました", false);
return false;
}
// HTTPリクエスト送信
//.........这里部分代码省略.........