Skip to content

Commit

Permalink
Merge pull request #193 from JWardee/v2.1.7
Browse files Browse the repository at this point in the history
v2.1.7
  • Loading branch information
JWardee authored Jan 21, 2024
2 parents 2b8d3dc + 409d39a commit 5623d05
Show file tree
Hide file tree
Showing 8 changed files with 158 additions and 208 deletions.
2 changes: 1 addition & 1 deletion WpMailCatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
Domain Path: /languages
Description: Logging your mail will stop you from ever losing your emails again! This fast, lightweight plugin (under 140kb in size!) is also useful for debugging or backing up your messages.
Author: James Ward
Version: 2.1.6
Version: 2.1.7
Author URI: https://jamesward.io
Donate link: https://paypal.me/jamesmward
*/
Expand Down
2 changes: 1 addition & 1 deletion build/grunt/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "WpMailCatcher",
"version": "2.1.6",
"version": "2.1.7",
"lang_po_directory": "../../languages",
"build_directory": "./..",
"dist_directory": "../../assets",
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
},
"require-dev": {
"phpunit/phpunit": "^8.0",
"yoast/phpunit-polyfills": "^1.0",
"yoast/phpunit-polyfills": "^1.1",
"phpstan/phpstan": "^1.8",
"szepeviktor/phpstan-wordpress": "^1.1",
"phpstan/extension-installer": "^1.1",
Expand Down
327 changes: 126 additions & 201 deletions composer.lock

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Tags: mail logging, email log, email logger, logging, email logging, mail, crm
Requires at least: 4.7
Tested up to: 6.4
Requires PHP: 7.4
Stable tag: 2.1.6
Stable tag: 2.1.7
License: GNU General Public License v3.0
License URI: https://raw.githubusercontent.com/JWardee/wp-mail-catcher/master/LICENSE
Donate link: https://paypal.me/jamesmward
Expand Down Expand Up @@ -94,6 +94,10 @@ Great! Please leave a note in our (GitHub tracker)

== Changelog ==

= 2.1.7 =

- Security: Added additional nonce checks to setting actions

= 2.1.6 =

- Fix: Logs not appearing in WP versions under 6.2
Expand Down
12 changes: 12 additions & 0 deletions src/Bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ public function route()
if (current_user_can(Settings::get('default_view_role'))) {
/** Perform database upgrade */
if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'upgrade-database') {
if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'upgrade-database')) {
wp_die(GeneralHelper::$failedNonceMessage);
}

DatabaseUpgradeManager::getInstance()->doUpgrade();
GeneralHelper::redirectToThisHomeScreen();
}
Expand Down Expand Up @@ -231,6 +235,10 @@ public function route()

if (current_user_can(Settings::get('default_settings_role'))) {
if (isset($_REQUEST['action']) && $_REQUEST['action'] === 'rerun-migrations') {
if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'rerun_migrations')) {
wp_die(GeneralHelper::$failedNonceMessage);
}

DatabaseUpgradeManager::getInstance()->doUpgrade(true);
GeneralHelper::redirectToThisHomeScreen([
'trigger-rerun-migration-success' => true,
Expand All @@ -239,6 +247,10 @@ public function route()
}

if (isset($_REQUEST['action']) && $_REQUEST['action'] === 'trigger-auto-delete') {
if (!wp_verify_nonce($_REQUEST['_wpnonce'], 'trigger_auto_delete')) {
wp_die(GeneralHelper::$failedNonceMessage);
}

ExpiredLogManager::removeExpiredLogs();
GeneralHelper::redirectToThisHomeScreen([
'trigger-auto-delete-success' => true,
Expand Down
5 changes: 4 additions & 1 deletion src/Views/Log.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@
to perform the upgrade.</strong>',
'WpMailCatcher'
),
'?page=' . GeneralHelper::$adminPageSlug . '&action=upgrade-database'
wp_nonce_url(
'?page=' . GeneralHelper::$adminPageSlug . '&action=upgrade-database',
'upgrade-database'
)
);
?>
</p>
Expand Down
10 changes: 8 additions & 2 deletions src/Views/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,10 @@
</span>
</label>
<?php if (isset($cronJobs[0])) :
$href = '?page=' . GeneralHelper::$adminPageSlug . '&action=trigger-auto-delete';
$href = wp_nonce_url(
'?page=' . GeneralHelper::$adminPageSlug . '&action=trigger-auto-delete',
'trigger_auto_delete'
);
?>
<p class="description">
<?php
Expand All @@ -158,7 +161,10 @@
<td>
<p class="description">
<?php
$href = '?page=' . GeneralHelper::$adminPageSlug . '&action=rerun-migrations';
$href = wp_nonce_url(
'?page=' . GeneralHelper::$adminPageSlug . '&action=rerun-migrations',
'rerun_migrations'
);
printf(
__(
'%s. <a href="' . $href . '">Rerun migrations</a>',
Expand Down

0 comments on commit 5623d05

Please sign in to comment.