PluginProbe
Tutor LMS – eLearning and online course solution / 2.0.10
Tutor LMS – eLearning and online course solution v2.0.10
4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 4.0.2 4.0.1 4.0.0 3.9.15 3.9.14 3.9.13 3.9.12 3.9.11 trunk 1.0.0 1.0.0-alpha 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 All 191 releases
← All changes | classes/Course.php +9 -9 2.0.92.0.10 View file →
@@ -463,22 +463,22 @@
463 463 public function tutor_save_topic(){
464 464 tutor_utils()->checking_nonce();
465 465
466 466 // Check required fields
467 - if (empty($_POST['topic_title']) ) {
468 - wp_send_json_error(array('message' => __('Topic title is required!', 'tutor')));
467 + if ( empty( Input::post( 'topic_title' ) ) ) {
468 + wp_send_json_error( array( 'message' => __( 'Topic title is required!', 'tutor' ) ) );
469 469 }
470 470
471 471 // Gather parameters
472 - $course_id = (int) tutor_utils()->avalue_dot('topic_course_id', $_POST);
473 - $topic_id = (int) tutor_utils()->avalue_dot('topic_id', $_POST);
474 - $topic_title = sanitize_text_field( $_POST['topic_title'] );
475 - $topic_summery = wp_kses_post( $_POST['topic_summery'] );
472 + $course_id = Input::post( 'topic_course_id', 0, Input::TYPE_INT );
473 + $topic_id = Input::post( 'topic_id', 0, Input::TYPE_INT );
474 + $topic_title = Input::post( 'topic_title' );
475 + $topic_summery = wp_kses_post( $_POST['topic_summery'] );
476 476 $next_topic_order_id = tutor_utils()->get_next_topic_order_id($course_id, $topic_id);
477 477
478 478 // Validate if user can manage the topic
479 - if(!tutor_utils()->can_user_manage('course', $course_id) || ($topic_id && !tutor_utils()->can_user_manage('topic', $topic_id))) {
480 - wp_send_json_error( array('message'=>__('Access Denied', 'tutor')) );
479 + if ( ! tutor_utils()->can_user_manage( 'course', $course_id ) || ( $topic_id && !tutor_utils()->can_user_manage('topic', $topic_id ) ) ) {
480 + wp_send_json_error( array( 'message' => __( 'Access Denied', 'tutor' ) ) );
481 481 }
482 482
483 483 // Create payload to create/update the topic
484 484 $post_arr = array(
@@ -495,9 +495,9 @@
495 495
496 496 ob_start();
497 497 include tutor()->path.'views/metabox/course-contents.php';
498 498
499 - wp_send_json_success(array(
499 + wp_send_json_success( array(
500 500 'topic_title' => $topic_title,
501 501 'course_contents' => ob_get_clean()
502 502 ));
503 503 }