From 9cdccacaeb5e1c2e4dd94724e215618dc420cf35 Mon Sep 17 00:00:00 2001 From: Burnacid Date: Wed, 1 Jan 2020 15:02:59 +0100 Subject: [PATCH 1/2] #124 Fix regex not working propperly --- admin/modules/config/formcreator.php | 6 ++---- form.php | 4 ++-- inc/plugins/formcreator.php | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/admin/modules/config/formcreator.php b/admin/modules/config/formcreator.php index 5cb6c1b..242dc88 100644 --- a/admin/modules/config/formcreator.php +++ b/admin/modules/config/formcreator.php @@ -539,10 +539,8 @@ $form_container->output_row($lang->fc_required, $lang->fc_field_required_desc, $form->generate_yes_no_radio("required", $field->required)); } if ($field->show_admin_field("regex")) { - $form_container->output_row($lang->fc_regex, $lang->fc_field_regex_desc, "/ ".$form->generate_text_box("settings[regex]", $field-> - regex)." /"); - $form_container->output_row($lang->fc_regex_error, $lang->fc_field_regex_error_desc, $form->generate_text_box("settings[regexerror]", $field-> - regexerror)); + $form_container->output_row($lang->fc_regex, $lang->fc_field_regex_desc, "/ ".$form->generate_text_box("settings[regex]", $field->settings['regex'])." /"); + $form_container->output_row($lang->fc_regex_error, $lang->fc_field_regex_error_desc, $form->generate_text_box("settings[regexerror]", $field->settings['regexerror'])); } if ($field->show_admin_field("size")) { $form_container->output_row($lang->fc_size, $lang->fc_field_size_desc, $form->generate_numeric_field("settings[size]", $field->settings['size'])); diff --git a/form.php b/form.php index d2a5170..3f551fe 100644 --- a/form.php +++ b/form.php @@ -80,9 +80,9 @@ if ($field->settings['regex'] && !preg_match("/" . $field->settings['regex'] . "/", $mybb->input["field_" . $field->fieldid])) { if (!empty($field->settings['regexerror'])) { - + $error_array[] = $field->settings['regexerror']; } else { - $error_array[] = $lang->fc_no_attachment; + $error_array[] = $lang->fc_no_match_regex; } } diff --git a/inc/plugins/formcreator.php b/inc/plugins/formcreator.php index ff90830..736c9e6 100644 --- a/inc/plugins/formcreator.php +++ b/inc/plugins/formcreator.php @@ -22,7 +22,7 @@ function formcreator_info() 'website' => 'https://community.mybb.com/mods.php?action=view&pid=975', 'author' => 'S. Lenders (burnacid)', 'authorsite' => 'http://lenders-it.nl', - 'version' => '2.6.4', + 'version' => '2.6.5', 'compatibility' => '18*', 'codename' => 'formcreator'); } From d0f7c146c67d031590457ab1a86f24f1c83297a5 Mon Sep 17 00:00:00 2001 From: Burnacid Date: Wed, 1 Jan 2020 15:37:40 +0100 Subject: [PATCH 2/2] #125 check for post or pm flooding --- form.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/form.php b/form.php index 3f551fe..f2c54b1 100644 --- a/form.php +++ b/form.php @@ -240,7 +240,6 @@ foreach ($group_members as $user) { $pmhandler = new PMDataHandler(); - $pmhandler->admin_override = true; $pm = array( "subject" => $subject, @@ -258,6 +257,8 @@ "allow_html" => 1); $pmhandler->set_data($pm); + $pmhandler->verify_pm_flooding(); + if ($pmhandler->validate_pm()) { $pmhandler->insert_pm(); } else { @@ -314,7 +315,7 @@ $posthandler = new PostDataHandler(); $posthandler->action = "post"; - $posthandler->admin_override = true; + $posthandler->admin_override = false; $new_post = array( "fid" => $thread['fid'], @@ -334,6 +335,7 @@ "disablesmilies" => '0'); $posthandler->set_data($new_post); + $posthandler->verify_post_flooding(); if ($posthandler->validate_post()) { $post_info = $posthandler->insert_post(); @@ -361,7 +363,6 @@ $posthandler = new PostDataHandler(); $posthandler->action = "thread"; - $posthandler->admin_override = true; if (empty($prefix)) { $prefix = $formcreator->settings['prefix']; @@ -385,6 +386,7 @@ "disablesmilies" => '0'); $posthandler->set_data($new_thread); + $posthandler->verify_post_flooding(); if ($posthandler->validate_thread()) { $thread_info = $posthandler->insert_thread();