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 — マージ調整(cd70565) · unpush/p2-php@6777eba

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • js
    • post_draft.js
  • post.php
  • post_draft.php
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎js/post_draft.js‎

Copy file name to clipboardExpand all lines: js/post_draft.js
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ var autosave_interval_id = null;
1111
var saveDraftForm = function(form) {
1212
document.getElementById('post_draft_msg').innerHTML =
1313
(autosave_interval_id !== null ? '自動' : '') + '保存中...';
14-
post_draft(form.host.value, form.bbs.value, form.key.value, take_kakiko_data(form),
14+
post_draft(form.host.value, form.bbs.value, form.key.value, form.csrfid.value, take_kakiko_data(form),
1515
function(st) {
1616
setTimeout(function() {
1717
if (st == '1') {
@@ -32,7 +32,7 @@ var saveDraftForm = function(form) {
3232
});
3333
};
3434

35-
var post_draft = function(host, bbs, key, data, fin, err) {
35+
var post_draft = function(host, bbs, key, csrfid, data, fin, err) {
3636
var req = (typeof getXmlHttp === 'undefined') ? new XMLHttpRequest() : getXmlHttp();
3737
if (!req) return;
3838

@@ -54,7 +54,7 @@ var post_draft = function(host, bbs, key, data, fin, err) {
5454
},
5555
(function() {
5656
var ret = [];
57-
var h = {'host' : host, 'bbs' : bbs, 'key' : key};
57+
var h = {'host' : host, 'bbs' : bbs, 'key' : key, 'csrfid' : csrfid};
5858
for (var i in h)
5959
ret.push(i + '=' + encodeURIComponent(h[i]));
6060
return ret;
Collapse file

‎post.php‎

Copy file name to clipboardExpand all lines: post.php
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,9 @@
128128

129129
if ($_POST['savedraft']) {
130130
// 書き込みを一時的に保存
131-
$failed_post_file = P2Util::getFailedPostFilePath($host, $bbs, $key);
132-
$cont = serialize($post_cache);
133-
DataPhp::writeDataPhp($failed_post_file, $cont, $_conf['res_write_perm']);
131+
$post_backup_key = PostDataStore::getKeyForBackup($host, $bbs, $key, !empty($_REQUEST['newthread']));
132+
PostDataStore::set($post_backup_key, $post_cache);
133+
$reload = empty($_POST['from_read_new']);
134134
showPostMsg(false, '下書きを保存しました', $reload);
135135
exit;
136136
}
Collapse file

‎post_draft.php‎

Copy file name to clipboardExpand all lines: post_draft.php
+42-15Lines changed: 42 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,23 @@
99

1010
$_login->authorize();
1111

12+
// 引数エラー
13+
if (empty($_POST['host'])) {
14+
// 引数の指定が変です
15+
echo 'null';
16+
exit;
17+
}
18+
19+
$el = error_reporting(E_ALL & ~E_NOTICE);
20+
$salt = 'post' . $_POST['host'] . $_POST['bbs'] . $_POST['key'];
21+
error_reporting($el);
22+
23+
if (!isset($_POST['csrfid']) or $_POST['csrfid'] != P2Util::getCsrfId($salt)) {
24+
// 不正なポストです
25+
echo 'null';
26+
exit;
27+
}
28+
1229
// }}}
1330
// {{{ HTTPヘッダ
1431

@@ -17,25 +34,35 @@
1734

1835
// }}}
1936
// {{{ 初期化
20-
$host = $_POST['host'];
21-
$bbs = $_POST['bbs'];
22-
$key = $_POST['key'];
23-
$message = $_POST['MESSAGE'];
24-
$from = $_POST['FROM'];
25-
$mail = $_POST['mail'];
26-
$subject = $_POST['subject'];
27-
28-
// パラメータを検証
29-
if (!($host && $bbs && ($message || $from || $mail || $subject))) {
30-
echo 'null';
31-
exit;
37+
$post_param_keys = array('bbs', 'key', 'time', 'FROM', 'mail', 'MESSAGE', 'subject', 'submit');
38+
$post_internal_keys = array('host', 'sub', 'popup', 'rescount', 'ttitle_en');
39+
foreach ($post_param_keys as $pk) {
40+
${$pk} = (isset($_POST[$pk])) ? mb_convert_encoding($_POST[$pk], 'CP932', 'UTF-8') : '';
41+
}
42+
foreach ($post_internal_keys as $pk) {
43+
${$pk} = (isset($_POST[$pk])) ? $_POST[$pk] : '';
44+
}
45+
46+
// したらばのlivedoor移転に対応。post先をlivedoorとする。
47+
$host = P2Util::adjustHostJbbs($host);
48+
49+
// machibbs、JBBS@したらば なら
50+
if (P2Util::isHostMachiBbs($host) or P2Util::isHostJbbsShitaraba($host)) {
51+
/* compact() と array_combine() でPOSTする値の配列を作るので、
52+
$post_param_keys と $post_send_keys の値の順序は揃える! */
53+
//$post_param_keys = array('bbs', 'key', 'time', 'FROM', 'mail', 'MESSAGE', 'subject', 'submit');
54+
$post_send_keys = array('BBS', 'KEY', 'TIME', 'NAME', 'MAIL', 'MESSAGE', 'SUBJECT', 'submit');
55+
// 2ch
56+
} else {
57+
$post_send_keys = $post_param_keys;
3258
}
59+
$post = array_combine($post_send_keys, compact($post_param_keys));
60+
unset($post['submit']);
3361

3462
// }}}
3563
// {{{ execute
36-
DataPhp::writeDataPhp(P2Util::getFailedPostFilePath($host, $bbs, $key),
37-
serialize(array('host'=>$host, 'bbs'=>$bbs, 'key'=>$key, 'FROM'=>$from, 'mail'=>$mail, 'subject'=>$subject, 'MESSAGE'=>$message)),
38-
$_conf['res_write_perm']);
64+
$post_backup_key = PostDataStore::getKeyForBackup($host, $bbs, $key, !empty($_REQUEST['newthread']));
65+
PostDataStore::set($post_backup_key, $post);
3966

4067
echo '1';
4168
exit;

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.