GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — rev.080916.0800 · unpush/p2-php@5671fde

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • conf
    • conf.inc.php
    • conf_admin.inc.php
  • lib
    • P2HttpExt.php
    • SettingTxt.php
    • SubjectTxt.php
    • ThreadRead.php
    • setfav.inc.php
  • post.php
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎conf/conf.inc.php‎

Copy file name to clipboardExpand all lines: conf/conf.inc.php
+4-2Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@
77
// バージョン情報
88
$_conf = array(
99
'p2version' => '1.7.29+1.8.14', // rep2のバージョン
10-
'p2expack' => '080915.0800', // 拡張パックのバージョン
10+
'p2expack' => '080916.0800', // 拡張パックのバージョン
1111
'p2name' => 'expack', // rep2の名前
1212
);
1313

14-
define('P2_VERSION_ID', sprintf('%u', crc32($_conf['p2version'] . ';' . $_conf['p2expack'])));
14+
$_conf['p2ua'] = "{$_conf['p2name']}/{$_conf['p2version']}+{$_conf['p2expack']}";
15+
16+
define('P2_VERSION_ID', sprintf('%u', crc32($_conf['p2ua'])));
1517

1618
// {{{ グローバル変数を初期化
1719

Collapse file

‎conf/conf_admin.inc.php‎

Copy file name to clipboardExpand all lines: conf/conf_admin.inc.php
-6Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,6 @@
5353
// 書き込みを掲示板サーバで直接行うように (する:1, しない:0)
5454
$_conf['disable_res'] = 0; // (0)
5555

56-
// 2chに書き込む際の固定パラメータ (hana=mogera, kiri=tanpo)
57-
$_conf['post_fixed_params'] = array(
58-
'hana' => 'mogera',
59-
'kiri' => 'tanpo',
60-
);
61-
6256
// 書き込んだレスの最大記録数 // この設定は現在は機能していない
6357
//$_conf['posted_rec_num'] = 1000; // (1000)
6458

Collapse file

‎lib/P2HttpExt.php‎

Copy file name to clipboardExpand all lines: lib/P2HttpExt.php
+1-5Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -212,11 +212,7 @@ public function __construct($url,
212212
}
213213

214214
if (!isset($options['useragent'])) {
215-
$options['useragent'] = sprintf('Monazilla/1.00 (%s/%s; expack-%s)',
216-
$_conf['p2name'],
217-
$_conf['p2version'],
218-
$_conf['p2expack']
219-
);
215+
$options['useragent'] = "Monazilla/1.00 ({$_conf['p2ua']})";
220216
}
221217

222218
if ($_conf['proxy_use'] && !isset($options['proxyhost']) && !empty($_conf['proxy_host'])) {
Collapse file

‎lib/SettingTxt.php‎

Copy file name to clipboardExpand all lines: lib/SettingTxt.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public function downloadSettingTxt()
106106
}
107107
$req = new HTTP_Request($this->_url, $params);
108108
$modified && $req->addHeader("If-Modified-Since", $modified);
109-
$req->addHeader('User-Agent', 'Monazilla/1.00 (' . $_conf['p2name'] . '/' . $_conf['p2version'] . ')');
109+
$req->addHeader('User-Agent', "Monazilla/1.00 ({$_conf['p2ua']})");
110110

111111
$response = $req->sendRequest();
112112

Collapse file

‎lib/SubjectTxt.php‎

Copy file name to clipboardExpand all lines: lib/SubjectTxt.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public function downloadSubject()
121121
}
122122
$req = new HTTP_Request($this->subject_url, $params);
123123
$modified && $req->addHeader("If-Modified-Since", $modified);
124-
$req->addHeader('User-Agent', 'Monazilla/1.00 (' . $_conf['p2name'] . '/' . $_conf['p2version'] . ')');
124+
$req->addHeader('User-Agent', "Monazilla/1.00 ({$_conf['p2ua']})");
125125

126126
$response = $req->sendRequest();
127127

Collapse file

‎lib/ThreadRead.php‎

Copy file name to clipboardExpand all lines: lib/ThreadRead.php
+26-37Lines changed: 26 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ public function __construct()
5151
public function downloadDat()
5252
{
5353
global $_conf;
54-
global $uaMona, $SID2ch; // require_once P2_LIB_DIR . '/login2ch.inc.php';
5554

5655
// まちBBS
5756
if (P2Util::isHostMachiBbs($this->host)) {
@@ -128,20 +127,16 @@ private function _downloadDat2ch($from_bytes)
128127
$from_bytes = $from_bytes - 1;
129128
}
130129

131-
$method = "GET";
132-
$uaMona = "Monazilla/1.00";
133-
134-
$p2ua_fmt = " (%s/%s; expack-%s)";
135-
$p2ua = $uaMona . sprintf($p2ua_fmt, $_conf['p2name'], $_conf['p2version'], $_conf['p2expack']);
130+
$method = 'GET';
136131

137-
$url = 'http://' . $this->host . "/{$this->bbs}/dat/{$this->key}.dat";
132+
$url = "http://{$this->host}/{$this->bbs}/dat/{$this->key}.dat";
138133
//$url="http://news2.2ch.net/test/read.cgi?bbs=newsplus&key=1038486598";
139134

140135
$purl = parse_url($url); // URL分解
141136
if (isset($purl['query'])) { // クエリー
142-
$purl['query'] = "?".$purl['query'];
137+
$purl['query'] = '?' . $purl['query'];
143138
} else {
144-
$purl['query'] = "";
139+
$purl['query'] = '';
145140
}
146141

147142
// プロキシ
@@ -152,20 +147,20 @@ private function _downloadDat2ch($from_bytes)
152147
} else {
153148
$send_host = $purl['host'];
154149
$send_port = isset($purl['port']) ? $purl['port'] : 80;
155-
$send_path = $purl['path'].$purl['query'];
150+
$send_path = $purl['path'] . $purl['query'];
156151
}
157152

158153
if (!$send_port) {
159154
$send_port = 80; // デフォルトを80
160155
}
161156

162-
$request = $method." ".$send_path." HTTP/1.0\r\n";
163-
$request .= "Host: ".$purl['host']."\r\n";
157+
$request = "{$method} {$send_path} HTTP/1.0\r\n";
158+
$request .= "Host: {$purl['host']}\r\n";
164159
$request .= "Accept: */*\r\n";
165160
//$request .= "Accept-Charset: Shift_JIS\r\n";
166161
//$request .= "Accept-Encoding: gzip, deflate\r\n";
167162
$request .= "Accept-Language: ja, en\r\n";
168-
$request .= "User-Agent: ".$p2ua."\r\n";
163+
$request .= "User-Agent: Monazilla/1.00 ({$_conf['p2ua']})\r\n";
169164
if (!$zero_read) {
170165
$request .= "Range: bytes={$from_bytes}-\r\n";
171166
}
@@ -347,6 +342,7 @@ private function _downloadDat2chNotFound()
347342
*/
348343
private function _downloadDat2chMaru()
349344
{
345+
// $uaMona, $SID2ch → @see lib/login2ch.inc.php
350346
global $_conf, $uaMona, $SID2ch, $_info_msg_ht;
351347

352348
if (!($this->host && $this->bbs && $this->key && $this->keydat)) {
@@ -356,13 +352,10 @@ private function _downloadDat2chMaru()
356352
//unset($datgz_attayo, $start_here, $isGzip, $done_gunzip, $marudatlines, $code);
357353

358354
$method = 'GET';
359-
// $uaMona → @see login2ch.inc.php
360-
$p2ua_fmt = " (%s/%s; expack-%s)";
361-
$p2ua = $uaMona . sprintf($p2ua_fmt, $_conf['p2name'], $_conf['p2version'], $_conf['p2expack']);
362355

363356
// GET /test/offlaw.cgi?bbs=板名&key=スレッド番号&sid=セッションID HTTP/1.1
364-
$SID2ch = rawurlencode($SID2ch);
365-
$url = 'http://' . $this->host . "/test/offlaw.cgi/{$this->bbs}/{$this->key}/?raw=0.0&sid={$SID2ch}";
357+
$url = "http://{$this->host}/test/offlaw.cgi/{$this->bbs}/{$this->key}/?raw=0.0&sid=";
358+
$url .= rawurlencode($SID2ch);
366359

367360
$purl = parse_url($url); // URL分解
368361
if (isset($purl['query'])) { // クエリー
@@ -390,8 +383,8 @@ private function _downloadDat2chMaru()
390383
$request .= "Host: ".$purl['host']."\r\n";
391384
$request .= "Accept-Encoding: gzip, deflate\r\n";
392385
//$request .= "Accept-Language: ja, en\r\n";
393-
$request .= "User-Agent: ".$p2ua."\r\n";
394-
//$request .= "X-2ch-UA: ".$_conf['p2name']."/".$_conf['p2version']."\r\n";
386+
$request .= "User-Agent: {$uaMona} ({$_conf['p2ua']})\r\n";
387+
//$request .= "X-2ch-UA: {$_conf['p2ua']}\r\n";
395388
//$request .= "Range: bytes={$from_bytes}-\r\n";
396389
$request .= "Connection: Close\r\n";
397390
/*
@@ -588,9 +581,7 @@ private function _downloadDat2chKako($uri, $ext)
588581

589582
$url = $uri.$ext;
590583

591-
$method = "GET";
592-
$httpua_fmt = "Monazilla/1.00 (%s/%s; expack-%s)";
593-
$httpua = sprintf($httpua_fmt, $_conf['p2name'], $_conf['p2version'], $_conf['p2expack']);
584+
$method = 'GET';
594585

595586
$purl = parse_url($url); // URL分解
596587
// クエリー
@@ -615,9 +606,9 @@ private function _downloadDat2chKako($uri, $ext)
615606
$send_port = 80;
616607
}
617608

618-
$request = $method." ".$send_path." HTTP/1.0\r\n";
619-
$request .= "Host: ".$purl['host']."\r\n";
620-
$request .= "User-Agent: ".$httpua."\r\n";
609+
$request = "{$method} {$send_path} HTTP/1.0\r\n";
610+
$request .= "Host: {$purl['host']}\r\n";
611+
$request .= "User-Agent: Monazilla/1.00 ({$_conf['p2ua']})\r\n";
621612
$request .= "Connection: Close\r\n";
622613
//$request .= "Accept-Encoding: gzip\r\n";
623614
/*
@@ -784,7 +775,7 @@ public function get2chDatError()
784775
$read_response_html = "";
785776
require_once P2_LIB_DIR . '/Wap.php';
786777
$wap_ua = new UserAgent();
787-
$wap_ua->setAgent($_conf['p2name']."/".$_conf['p2version']."; expack-".$_conf['p2expack']); // ここは、"Monazilla/" をつけるとNG
778+
$wap_ua->setAgent($_conf['p2ua']); // ここは、"Monazilla/" をつけるとNG
788779
$wap_ua->setTimeout($_conf['fsockopen_time_limit']);
789780
$wap_req = new Request();
790781
$wap_req->setUrl($read_url);
@@ -912,14 +903,14 @@ public function previewOne()
912903
// ローカルdatなければオンラインから
913904
if (!$first_line) {
914905

915-
$method = "GET";
916-
$url = "http://" . $this->host . "/{$this->bbs}/dat/{$this->key}.dat";
906+
$method = 'GET';
907+
$url = "http://{$this->host}/{$this->bbs}/dat/{$this->key}.dat";
917908

918909
$purl = parse_url($url); // URL分解
919910
if (isset($purl['query'])) { // クエリー
920-
$purl['query'] = "?".$purl['query'];
911+
$purl['query'] = '?' . $purl['query'];
921912
} else {
922-
$purl['query'] = "";
913+
$purl['query'] = '';
923914
}
924915

925916
// プロキシ
@@ -930,16 +921,14 @@ public function previewOne()
930921
} else {
931922
$send_host = $purl['host'];
932923
$send_port = $purl['port'];
933-
$send_path = $purl['path'].$purl['query'];
924+
$send_path = $purl['path'] . $purl['query'];
934925
}
935926

936927
if (!$send_port) {$send_port = 80;} // デフォルトを80
937928

938-
$request = $method." ".$send_path." HTTP/1.0\r\n";
939-
$request .= "Host: ".$purl['host']."\r\n";
940-
$httpua_fmt = "Monazilla/1.00 (%s/%s; expack-%s)";
941-
$httpua = sprintf($httpua_fmt, $_conf['p2name'], $_conf['p2version'], $_conf['p2expack']);
942-
$request .= "User-Agent: ".$httpua."\r\n";
929+
$request = "{$method} {$send_path} HTTP/1.0\r\n";
930+
$request .= "Host: {$purl['host']}\r\n";
931+
$request .= "User-Agent: Monazilla/1.00 ({$_conf['p2ua']})\r\n";
943932
// $request .= "Range: bytes={$from_bytes}-\r\n";
944933

945934
// Basic認証用のヘッダ
Collapse file

‎lib/setfav.inc.php‎

Copy file name to clipboardExpand all lines: lib/setfav.inc.php
+7-9Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -150,15 +150,13 @@ function postFavRank($post)
150150
{
151151
global $_conf;
152152

153-
$method = "POST";
154-
$httpua_fmt = "Monazilla/1.00 (%s/%s; expack-%s)";
155-
$httpua = sprintf($httpua_fmt, $_conf['p2name'], $_conf['p2version'], $_conf['p2expack']);
153+
$method = 'POST';
156154

157155
$URL = parse_url($_conf['favrank_url']); // URL分解
158156
if (isset($URL['query'])) { // クエリー
159-
$URL['query'] = "?".$URL['query'];
157+
$URL['query'] = '?' . $URL['query'];
160158
} else {
161-
$URL['query'] = "";
159+
$URL['query'] = '';
162160
}
163161

164162
// プロキシ
@@ -169,14 +167,14 @@ function postFavRank($post)
169167
} else {
170168
$send_host = $URL['host'];
171169
$send_port = $URL['port'];
172-
$send_path = $URL['path'].$URL['query'];
170+
$send_path = $URL['path'] . $URL['query'];
173171
}
174172

175173
if (!$send_port) {$send_port = 80;} // デフォルトを80
176174

177-
$request = $method." ".$send_path." HTTP/1.0\r\n";
178-
$request .= "Host: ".$URL['host']."\r\n";
179-
$request .= "User-Agent: ".$httpua."\r\n";
175+
$request = "{$method} {$send_path} HTTP/1.0\r\n";
176+
$request .= "Host: {$URL['host']}\r\n";
177+
$request .= "User-Agent: Monazilla/1.00 ({$_conf['p2ua']})\r\n";
180178
$request .= "Connection: Close\r\n";
181179

182180
/* POSTの時はヘッダを追加して末尾にURLエンコードしたデータを添付 */

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.