|
12 | 12 | $user_course_categories = CourseManager::get_user_course_categories(api_get_user_id());
|
13 | 13 | $courses_in_category = $auth->getCoursesInCategory(false);
|
14 | 14 |
|
15 |
| -$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : ''; |
| 15 | +$action = isset($_REQUEST['action']) ? Security::remove_XSS($_REQUEST['action']) : ''; |
16 | 16 | $currentUrl = api_get_self();
|
17 | 17 |
|
18 | 18 | $interbreadcrumb[] = [
|
|
22 | 22 |
|
23 | 23 | // We are moving the course of the user to a different user defined course category (=Sort My Courses).
|
24 | 24 | if (isset($_POST['submit_change_course_category'])) {
|
25 |
| - $result = $auth->updateCourseCategory($_POST['course_2_edit_category'], $_POST['course_categories']); |
| 25 | + $course2EditCategory = Security::remove_XSS($_POST['course_2_edit_category']); |
| 26 | + $courseCategories = Security::remove_XSS($_POST['course_categories']); |
| 27 | + $result = $auth->updateCourseCategory($course2EditCategory, $courseCategories); |
26 | 28 | if ($result) {
|
27 | 29 | Display::addFlash(
|
28 | 30 | Display::return_message(get_lang('EditCourseCategorySucces'))
|
|
36 | 38 | if (isset($_POST['submit_edit_course_category']) &&
|
37 | 39 | isset($_POST['title_course_category'])
|
38 | 40 | ) {
|
39 |
| - $result = $auth->store_edit_course_category($_POST['title_course_category'], $_POST['category_id']); |
| 41 | + $titleCourseCategory = Security::remove_XSS($_POST['title_course_category']); |
| 42 | + $categoryId = Security::remove_XSS($_POST['category_id']); |
| 43 | + $result = $auth->store_edit_course_category($titleCourseCategory, $categoryId); |
40 | 44 | if ($result) {
|
41 | 45 | Display::addFlash(
|
42 | 46 | Display::return_message(get_lang('CourseCategoryEditStored'))
|
|
52 | 56 | isset($_POST['title_course_category']) &&
|
53 | 57 | strlen(trim($_POST['title_course_category'])) > 0
|
54 | 58 | ) {
|
55 |
| - $result = $auth->store_course_category($_POST['title_course_category']); |
| 59 | + $titleCourseCategory = Security::remove_XSS($_POST['title_course_category']); |
| 60 | + $result = $auth->store_course_category($titleCourseCategory); |
56 | 61 | if ($result) {
|
57 | 62 | Display::addFlash(
|
58 | 63 | Display::return_message(get_lang('CourseCategoryStored'))
|
|
71 | 76 |
|
72 | 77 | // We are moving a course or category of the user up/down the list (=Sort My Courses).
|
73 | 78 | if (isset($_GET['move'])) {
|
74 |
| - if (isset($_GET['course'])) { |
75 |
| - $result = $auth->move_course($_GET['move'], $_GET['course'], $_GET['category']); |
| 79 | + $getCourse = isset($_GET['course']) ? Security::remove_XSS($_GET['course']) : ''; |
| 80 | + $getMove = Security::remove_XSS($_GET['move']); |
| 81 | + $getCategory = isset($_GET['category']) ? Security::remove_XSS($_GET['category']) : ''; |
| 82 | + if (!empty($getCourse)) { |
| 83 | + $result = $auth->move_course($getMove, $getCourse, $getCategory); |
76 | 84 | if ($result) {
|
77 | 85 | Display::addFlash(
|
78 | 86 | Display::return_message(get_lang('CourseSortingDone'))
|
79 | 87 | );
|
80 | 88 | }
|
81 | 89 | }
|
82 |
| - if (isset($_GET['category']) && !isset($_GET['course'])) { |
83 |
| - $result = $auth->move_category($_GET['move'], $_GET['category']); |
| 90 | + if (!empty($getCategory) && empty($getCourse)) { |
| 91 | + $result = $auth->move_category($getMove, $getCategory); |
84 | 92 | if ($result) {
|
85 | 93 | Display::addFlash(
|
86 | 94 | Display::return_message(get_lang('CategorySortingDone'))
|
|
152 | 160 | // we are deleting a course category
|
153 | 161 | if (isset($_GET['id'])) {
|
154 | 162 | if (Security::check_token('get')) {
|
155 |
| - $result = $auth->delete_course_category($_GET['id']); |
| 163 | + $getId = Security::remove_XSS($_GET['id']); |
| 164 | + $result = $auth->delete_course_category($getId); |
156 | 165 | if ($result) {
|
157 | 166 | Display::addFlash(
|
158 | 167 | Display::return_message(get_lang('CourseCategoryDeleted'))
|
|
182 | 191 | $userId = api_get_user_id();
|
183 | 192 | $categoryId = isset($_REQUEST['categoryid']) ? (int) $_REQUEST['categoryid'] : 0;
|
184 | 193 | $option = isset($_REQUEST['option']) ? (int) $_REQUEST['option'] : 0;
|
185 |
| - $redirect = isset($_REQUEST['redirect']) ? $_REQUEST['redirect'] : 0; |
| 194 | + $redirect = isset($_REQUEST['redirect']) ? Security::remove_XSS($_REQUEST['redirect']) : 0; |
186 | 195 |
|
187 | 196 | if (empty($userId) || empty($categoryId)) {
|
188 | 197 | api_not_allowed(true);
|
|
0 commit comments