Skip to content

Commit 0dad5ba

Browse files
authored
Merge branch 'dev' into remove-sql-calc-found-rows
2 parents 99e2e76 + d2157f9 commit 0dad5ba

38 files changed

+132
-50
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
significance: patch
2+
type: changed
3+
entry: Using standard WP nonce check functions instead of llms_verify_nonce.

includes/abstracts/abstract.llms.admin.metabox.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ public function register() {
466466
*/
467467
protected function save( $post_id ) {
468468

469-
if ( ! llms_verify_nonce( 'lifterlms_meta_nonce', 'lifterlms_save_data' ) || ! current_user_can( $this->capability, $post_id ) ) {
469+
if ( ! isset( $_REQUEST['lifterlms_meta_nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_REQUEST['lifterlms_meta_nonce'] ) ), 'lifterlms_save_data' ) || ! current_user_can( $this->capability, $post_id ) ) {
470470
return -1;
471471
}
472472

includes/abstracts/llms-abstract-admin-wizard.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ public function save(): ?WP_Error {
377377
$nonce = "llms_{$this->id}_nonce";
378378
$action = "llms_{$this->id}_save";
379379

380-
if ( ! isset( $_POST[ $nonce ] ) || ! llms_verify_nonce( $nonce, $action ) || ! current_user_can( 'manage_lifterlms' ) ) {
380+
if ( ! isset( $_POST[ $nonce ] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST[ $nonce ] ) ), $action ) || ! current_user_can( 'manage_lifterlms' ) ) {
381381
return null;
382382
}
383383

includes/abstracts/llms-abstract-controller-user-engagements.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -158,11 +158,8 @@ public function maybe_handle_awarded_engagement_sync_actions() {
158158
}
159159

160160
// Verify nonce.
161-
if ( ! llms_verify_nonce(
162-
"_llms_{$this->engagement_type}_sync_actions_nonce",
163-
"llms-{$this->engagement_type}-sync-actions",
164-
'GET'
165-
) ) {
161+
$nonce_field = "_llms_{$this->engagement_type}_sync_actions_nonce";
162+
if ( ! isset( $_REQUEST[ $nonce_field ] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_REQUEST[ $nonce_field ] ) ), "llms-{$this->engagement_type}-sync-actions" ) ) {
166163
$result = new WP_Error(
167164
"llms-sync-awarded-{$this->engagement_type}s-invalid-nonce",
168165
$this->get_text( self::TEXT_SYNC_AWARDED_ENGAGEMENTS_INVALID_NONCE )

includes/abstracts/llms-abstract-email-provider.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,8 @@ public function ajax_callback_remote_install_verify() {
253253
*/
254254
protected function can_remote_install() {
255255

256-
if ( ! llms_verify_nonce( '_llms_' . $this->id . '_nonce', 'llms-' . $this->id . '-install' ) ) {
256+
$nonce_field = '_llms_' . $this->id . '_nonce';
257+
if ( ! isset( $_REQUEST[ $nonce_field ] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_REQUEST[ $nonce_field ] ) ), 'llms-' . $this->id . '-install' ) ) {
257258
return array(
258259
'code' => 'llms_' . $this->id . '_install_nonce_failure',
259260
'message' => esc_html__( 'Security check failed.', 'lifterlms' ),

includes/admin/class-llms-admin-export-download.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function maybe_serve_export() {
4545
}
4646

4747
// Verify nonce.
48-
if ( ! llms_verify_nonce( 'llms_dl_export_nonce', LLMS_Abstract_Exportable_Admin_Table::EXPORT_NONCE_ACTION, 'GET' ) ) {
48+
if ( ! isset( $_REQUEST['llms_dl_export_nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_REQUEST['llms_dl_export_nonce'] ) ), LLMS_Abstract_Exportable_Admin_Table::EXPORT_NONCE_ACTION ) ) {
4949
wp_die( esc_html__( 'Cheatin’ huh?', 'lifterlms' ) );
5050
}
5151

includes/admin/class-llms-admin-review.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public function admin_footer( $text ) {
123123
*/
124124
public function dismiss() {
125125

126-
if ( ! current_user_can( 'manage_lifterlms' ) || ! llms_verify_nonce( 'nonce', 'llms-admin-review-request-dismiss' ) ) {
126+
if ( ! current_user_can( 'manage_lifterlms' ) || ! isset( $_REQUEST['nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_REQUEST['nonce'] ) ), 'llms-admin-review-request-dismiss' ) ) {
127127
wp_die();
128128
}
129129

includes/admin/class.llms.admin.addons.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ private function get_products_for_cat( $cat, $include_bundles = true ) {
239239
public function handle_actions() {
240240

241241
// Activate & deactivate addons.
242-
if ( llms_verify_nonce( '_llms_manage_addon_nonce', 'llms_manage_addon' ) ) {
242+
if ( isset( $_REQUEST['_llms_manage_addon_nonce'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_REQUEST['_llms_manage_addon_nonce'] ) ), 'llms_manage_addon' ) ) {
243243

244244
$this->handle_manage_addons();
245245
LLMS_Admin_Notices::output_notices();

includes/admin/class.llms.admin.import.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public function add_help_tabs() {
8181
*/
8282
public function cloud_import() {
8383

84-
if ( ! llms_verify_nonce( 'llms_cloud_importer_nonce', 'llms-cloud-importer' ) || ! current_user_can( 'manage_lifterlms' ) ) {
84+
if ( ! isset( $_REQUEST['llms_cloud_importer_nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_REQUEST['llms_cloud_importer_nonce'] ) ), 'llms-cloud-importer' ) || ! current_user_can( 'manage_lifterlms' ) ) {
8585
return false;
8686
}
8787

@@ -277,7 +277,7 @@ protected function show_error( $error ) {
277277
*/
278278
public function upload_import() {
279279

280-
if ( ! llms_verify_nonce( 'llms_importer_nonce', 'llms-importer' ) || ! current_user_can( 'manage_lifterlms' ) || empty( $_FILES['llms_import'] ) ) {
280+
if ( ! isset( $_REQUEST['llms_importer_nonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_REQUEST['llms_importer_nonce'] ) ), 'llms-importer' ) || ! current_user_can( 'manage_lifterlms' ) || empty( $_FILES['llms_import'] ) ) {
281281
return false;
282282
}
283283

includes/admin/class.llms.admin.notices.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ public static function has_notice( $notice_id ) {
246246
*/
247247
public static function hide_notices() {
248248
if ( ( isset( $_GET['llms-hide-notice'] ) || isset( $_GET['llms-remind-notice'] ) ) && isset( $_GET['_llms_notice_nonce'] ) ) {
249-
if ( ! llms_verify_nonce( '_llms_notice_nonce', 'llms_hide_notices_nonce', 'GET' ) ) {
249+
if ( ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_GET['_llms_notice_nonce'] ) ), 'llms_hide_notices_nonce' ) ) {
250250
wp_die( esc_html__( 'Action failed. Please refresh the page and retry.', 'lifterlms' ) );
251251
}
252252
if ( ! current_user_can( 'manage_options' ) ) {

0 commit comments

Comments
 (0)