aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/message_parser.php
diff options
context:
space:
mode:
authorMarc Alexander <admin@m-a-styles.de>2019-06-30 22:40:34 +0200
committerMarc Alexander <admin@m-a-styles.de>2019-08-24 22:23:38 +0200
commit56477a8f7c1421ecc01f15258f0739ce8438db32 (patch)
tree2361500844ecae27a61ce2b9e481fd79c6c059db /phpBB/includes/message_parser.php
parent525c940385ef8efb57fb812a8317833d7790e30a (diff)
downloadforums-56477a8f7c1421ecc01f15258f0739ce8438db32.tar
forums-56477a8f7c1421ecc01f15258f0739ce8438db32.tar.gz
forums-56477a8f7c1421ecc01f15258f0739ce8438db32.tar.bz2
forums-56477a8f7c1421ecc01f15258f0739ce8438db32.tar.xz
forums-56477a8f7c1421ecc01f15258f0739ce8438db32.zip
[ticket/security/244] Add form token check to plupload
SECURTIY-244
Diffstat (limited to 'phpBB/includes/message_parser.php')
-rw-r--r--phpBB/includes/message_parser.php29
1 files changed, 29 insertions, 0 deletions
diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php
index 0b79cca864..e1c28223dc 100644
--- a/phpBB/includes/message_parser.php
+++ b/phpBB/includes/message_parser.php
@@ -1525,6 +1525,35 @@ class parse_message extends bbcode_firstpass
}
/**
+ * Check attachment form token depending on submit type
+ *
+ * @param \phpbb\language\language $language Language
+ * @param \phpbb\request\request_interface $request Request
+ * @param string $form_name Form name for checking form key
+ *
+ * @return bool True if form token is not needed or valid, false if needed and invalid
+ */
+ function check_attachment_form_token(\phpbb\language\language $language, \phpbb\request\request_interface $request, $form_name)
+ {
+ $add_file = $request->is_set_post('add_file');
+ $delete_file = $request->is_set_post('delete_file');
+
+ if (($add_file || $delete_file) && !check_form_key($form_name))
+ {
+ $this->warn_msg[] = $language->lang('FORM_INVALID');
+
+ if ($request->is_ajax() && $this->plupload)
+ {
+ $this->plupload->emit_error(-400, 'FORM_INVALID');
+ }
+
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
* Parse Attachments
*/
function parse_attachments($form_name, $mode, $forum_id, $submit, $preview, $refresh, $is_message = false)