Skip to content

Commit 731310e

Browse files
committed
3.9.6 security issue fixes
1 parent e28919b commit 731310e

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

classes/Course_List.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,6 @@ protected static function count_course( string $status, $category_slug = '', $co
273273
$the_query = self::course_list_query( $args, $user_id, $status );
274274

275275
return ! is_null( $the_query ) && isset( $the_query->found_posts ) ? $the_query->found_posts : $the_query;
276-
277276
}
278277

279278
/**
@@ -291,6 +290,8 @@ public function course_list_bulk_action() {
291290

292291
// Check if user is privileged.
293292
if ( ! current_user_can( 'administrator' ) ) {
293+
$course_ids = explode( ',', $bulk_ids );
294+
294295
if ( current_user_can( 'edit_tutor_course' ) ) {
295296
$can_publish_course = tutor_utils()->get_option( 'instructor_can_publish_course' );
296297

@@ -300,6 +301,17 @@ public function course_list_bulk_action() {
300301
} else {
301302
wp_send_json_error( tutor_utils()->error_message() );
302303
}
304+
305+
// Check if the course ids are instructors own course.
306+
$course_ids = array_filter(
307+
$course_ids,
308+
function ( $course_id ) {
309+
return tutor_utils()->is_instructor_of_this_course( get_current_user_id(), $course_id );
310+
}
311+
);
312+
313+
$bulk_ids = implode( ',', $course_ids );
314+
303315
}
304316

305317
if ( '' === $action || '' === $bulk_ids ) {

ecommerce/CouponController.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -659,6 +659,8 @@ public function ajax_coupon_details() {
659659
$this->json_response( tutor_utils()->error_message( 'nonce' ), null, HttpHelper::STATUS_BAD_REQUEST );
660660
}
661661

662+
tutor_utils()->check_current_user_capability();
663+
662664
$coupon_id = Input::post( 'id' );
663665

664666
if ( empty( $coupon_id ) ) {

0 commit comments

Comments
 (0)