diff --git a/main/badge/assign.php b/main/badge/assign.php index c77648e0f5..7d217bad44 100644 --- a/main/badge/assign.php +++ b/main/badge/assign.php @@ -17,7 +17,9 @@ if (!api_is_platform_admin(false, true) && !api_is_student_boss()) { api_not_allowed(true); } -if (!isset($_REQUEST['user'])) { +$userId = isset($_REQUEST['user']) ? (int) $_REQUEST['user'] : 0; + +if (empty($userId)) { api_not_allowed(true); } @@ -26,7 +28,7 @@ $skillRepo = $entityManager->getRepository('ChamiloCoreBundle:Skill'); $skillRelSkill = $entityManager->getRepository('ChamiloCoreBundle:SkillRelSkill'); $skillLevelRepo = $entityManager->getRepository('ChamiloSkillBundle:Level'); $skillUserRepo = $entityManager->getRepository('ChamiloCoreBundle:SkillRelUser'); -$user = $entityManager->find('ChamiloUserBundle:User', $_REQUEST['user']); +$user = $entityManager->find('ChamiloUserBundle:User', $userId); if (!$user) { Display::addFlash( @@ -41,7 +43,7 @@ $skills = $skillRepo->findBy([ 'status' => Skill::STATUS_ENABLED ]); -$url = api_get_path(WEB_CODE_PATH)."badge/assign.php?user=".$_REQUEST['user']."&id="; +$url = api_get_path(WEB_CODE_PATH).'badge/assign.php?user='.$userId.'&id='; $htmlHeadXtra[] = '