Skip to content
Permalink
Browse files

Remove XSS #2757

  • Loading branch information...
AngelFQC committed Dec 17, 2018
1 parent e3181cf commit ae7f2d5bd215b049cdd731742e660e43e826d003
@@ -348,7 +348,7 @@
}
break;
case 'delete_attachment':
$id = $_GET['id_attach'];
$id = (int) $_GET['id_attach'];
if (api_is_allowed_to_edit()) {
AnnouncementManager::delete_announcement_attachment_file($id);
@@ -371,11 +371,11 @@
}
if (!api_is_session_general_coach() ||
api_is_element_in_the_session(TOOL_ANNOUNCEMENT, $_GET['id'])
api_is_element_in_the_session(TOOL_ANNOUNCEMENT, (int) $_GET['id'])

This comment has been minimized.

Copy link
@jmontoyaa

jmontoyaa Dec 18, 2018

Member

No es necesario hacer el casting ahi, la función "api_is_element_in_the_session" ya limpia esa variable dentro.

) {
AnnouncementManager::change_visibility_announcement(
$_course,
$_GET['id']
(int) $_GET['id']
);
Display::addFlash(Display::return_message(get_lang('VisibilityChanged')));
header('Location: '.$homeUrl);
@@ -15,7 +15,7 @@
api_protect_course_script(true);
}
$action = isset($_GET['action']) ? $_GET['action'] : null;
$action = isset($_GET['action']) ? Security::remove_XSS($_GET['action']) : null;
$this_section = SECTION_COURSES;
$url = null;
@@ -6,11 +6,13 @@
*/
require_once __DIR__.'/../inc/global.inc.php';
$action = isset($_GET['action']) ? Security::remove_XSS($_GET['action']) : 'calendar_list';
$logInfo = [
'tool' => TOOL_CALENDAR_EVENT,
'tool_id' => 0,
'tool_id_detail' => 0,
'action' => isset($_GET['action']) ? $_GET['action'] : 'calendar_list',
'action' => $action,
'info' => '',
];
Event::registerLog($logInfo);
@@ -92,7 +94,7 @@
$tpl->assign('is_allowed_to_edit', api_is_allowed_to_edit());
if (api_is_allowed_to_edit()) {
if (isset($_GET['action']) && $_GET['action'] == 'change_visibility') {
if ($action == 'change_visibility') {
$courseInfo = api_get_course_info();
$courseCondition = '';
// This happens when list agenda is not inside a course
@@ -18,25 +18,20 @@
// current section
$this_section = SECTION_COURSES;
$action = !empty($_GET['action']) ? Security::remove_XSS($_GET['action']) : 'listing';
$logInfo = [
'tool' => TOOL_COURSE_DESCRIPTION,
'tool_id' => 0,
'tool_id_detail' => 0,
'action' => !empty($_GET['action']) ? $_GET['action'] : 'listing',
'action' => $action,
'info' => '',
];
Event::registerLog($logInfo);
// protect a course script
api_protect_course_script(true);
// get actions
$actions = ['listing', 'add', 'edit', 'delete', 'history'];
$action = 'listing';
if (isset($_GET['action']) && in_array($_GET['action'], $actions)) {
$action = $_GET['action'];
}
$description_type = '';
if (isset($_GET['description_type'])) {
$description_type = intval($_GET['description_type']);
@@ -93,9 +88,6 @@
// Actions to controller
switch ($action) {
case 'listing':
$descriptionController->listing();
break;
case 'history':
$descriptionController->listing(true);
break;
@@ -108,6 +100,8 @@
case 'delete':
$descriptionController->destroy($id);
break;
case 'listing':
//no break
default:
$descriptionController->listing();
}
@@ -138,7 +138,9 @@
}
}
if (isset($_GET['action']) && $_GET['action'] == 'subscribe') {
$action = !empty($_GET['action']) ? Security::remove_XSS($_GET['action']) : '';
if ($action == 'subscribe') {
if (Security::check_token('get')) {
Security::clear_token();
$result = CourseManager::autoSubscribeToCourse($course_code);
@@ -166,7 +168,7 @@
'tool' => 'course-main',
'tool_id' => 0,
'tool_id_detail' => 0,
'action' => isset($_GET['action']) ? $_GET['action'] : '',
'action' => $action,
'info' => '',
];
Event::registerLog($logInfo);
@@ -18,6 +18,7 @@
}
$postAction = isset($_POST['action']) ? $_POST['action'] : null;
$action = isset($_GET['action']) ? Security::remove_XSS($_GET['action']) : null;
$view = isset($_GET['view']) ? Security::remove_XSS($_GET['view']) : null;
$viewReceivedCategory = isset($_GET['view_received_category']) ? Security::remove_XSS($_GET['view_received_category']) : null;
$viewSentCategory = isset($_GET['view_sent_category']) ? Security::remove_XSS($_GET['view_sent_category']) : null;
@@ -56,7 +57,6 @@
}
$sort_params = Security::remove_XSS(implode('&', $sort_params));
$action = isset($_GET['action']) ? $_GET['action'] : null;
// Display the form for adding a new dropbox item.
if ($action == 'add') {
@@ -142,10 +142,8 @@
if ($origin != 'learnpath') {
//so we are not in learnpath tool
Display :: display_header($nameTools, get_lang('Exercise'));
if (isset($_GET['message'])) {
if (in_array($_GET['message'], ['ExerciseEdited'])) {
echo Display::return_message(get_lang($_GET['message']), 'confirmation');
}
if (isset($_GET['message']) && in_array($_GET['message'], ['ExerciseEdited'])) {
echo Display::return_message(get_lang('ExerciseEdited'), 'confirmation');
}
} else {
Display::display_reduced_header();

0 comments on commit ae7f2d5

Please sign in to comment.
You can’t perform that action at this time.