From 7d5284d51b4481515c3a489d325317e829f4a78e Mon Sep 17 00:00:00 2001 From: jmontoyaa Date: Fri, 7 Oct 2016 08:37:27 +0200 Subject: [PATCH] Remove remove_xss and stripslashes while saving. see #1433 --- main/inc/introductionSection.inc.php | 34 ++++++++++++++-------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/main/inc/introductionSection.inc.php b/main/inc/introductionSection.inc.php index 6e4a980dcd6..3c4109466b7 100755 --- a/main/inc/introductionSection.inc.php +++ b/main/inc/introductionSection.inc.php @@ -1,6 +1,8 @@ validate()) { $form_values = $form->exportValues(); - $intro_content = Security::remove_XSS( - stripslashes( - api_html_entity_decode($form_values['intro_content']) - ), - COURSEMANAGERLOWSECURITY - ); + $intro_content = $form_values['intro_content']; $criteria = [ 'cId' => $course_id, @@ -90,8 +85,7 @@ ->findOneBy($criteria); if ($toolIntro) { - $toolIntro - ->setIntroText($intro_content); + $toolIntro->setIntroText($intro_content); } else { $toolIntro = new CToolIntro(); $toolIntro @@ -103,10 +97,12 @@ Database::getManager()->persist($toolIntro); Database::getManager()->flush(); - $introduction_section .= Display::return_message( - get_lang('IntroductionTextUpdated'), - 'confirmation', - false + Display::addFlash( + Display::return_message( + get_lang('IntroductionTextUpdated'), + 'confirmation', + false + ) ); } else { // got to the delete command @@ -125,7 +121,9 @@ id='".Database::escape_string($moduleId)."' AND session_id='".intval($session_id)."'"; Database::query($sql); - $introduction_section .= Display::return_message(get_lang('IntroductionTextDeleted'), 'confirmation'); + Display::addFlash( + Display::return_message(get_lang('IntroductionTextDeleted'), 'confirmation') + ); } } @@ -134,7 +132,7 @@ /* Retrieves the module introduction text, if exist */ /* @todo use a lib to query the $TBL_INTRODUCTION table */ // Getting course intro -$intro_content = null; +$intro_content = ''; $sql = "SELECT intro_text FROM $TBL_INTRODUCTION WHERE c_id = $course_id AND @@ -155,7 +153,7 @@ id = '".Database::escape_string($moduleId)."' AND session_id = '".intval($session_id)."'"; $intro_dbQuery = Database::query($sql); - $introSessionContent = null; + $introSessionContent = ''; if (Database::num_rows($intro_dbQuery) > 0) { $intro_dbResult = Database::fetch_array($intro_dbQuery); $introSessionContent = $intro_dbResult['intro_text']; @@ -166,6 +164,8 @@ } } +$intro_content = Security::remove_XSS($intro_content); + /* Determines the correct display */ if ($intro_cmdEdit || $intro_cmdAdd) {