Minor - format code.

1.9.x
Julio Montoya 12 years ago
parent 1666086de4
commit 6476142497
  1. 90
      main/inc/introductionSection.inc.php

@ -40,9 +40,9 @@ $intro_cmdAdd = empty($_GET['intro_cmdAdd']) ? '' : $_GET['intro_cmdAdd'];
$courseId = api_get_course_id(); $courseId = api_get_course_id();
if (!empty($courseId)) { if (!empty($courseId)) {
$form = new FormValidator('introduction_text', 'post', api_get_self().'?'.api_get_cidreq()); $form = new FormValidator('introduction_text', 'post', api_get_self().'?'.api_get_cidreq());
} else { } else {
$form = new FormValidator('introduction_text'); $form = new FormValidator('introduction_text');
} }
$renderer =& $form->defaultRenderer(); $renderer =& $form->defaultRenderer();
@ -55,29 +55,29 @@ $height = '300';
// The global variable $fck_attribute has been deprecated. It stays here for supporting old external code. // The global variable $fck_attribute has been deprecated. It stays here for supporting old external code.
global $fck_attribute; global $fck_attribute;
if (is_array($fck_attribute)) { if (is_array($fck_attribute)) {
if (isset($fck_attribute['ToolbarSet'])) { if (isset($fck_attribute['ToolbarSet'])) {
$toolbar_set = $fck_attribute['ToolbarSet']; $toolbar_set = $fck_attribute['ToolbarSet'];
} }
if (isset($fck_attribute['Width'])) { if (isset($fck_attribute['Width'])) {
$toolbar_set = $fck_attribute['Width']; $toolbar_set = $fck_attribute['Width'];
} }
if (isset($fck_attribute['Height'])) { if (isset($fck_attribute['Height'])) {
$toolbar_set = $fck_attribute['Height']; $toolbar_set = $fck_attribute['Height'];
} }
} }
if (is_array($editor_config)) { if (is_array($editor_config)) {
if (!isset($editor_config['ToolbarSet'])) { if (!isset($editor_config['ToolbarSet'])) {
$editor_config['ToolbarSet'] = $toolbar_set; $editor_config['ToolbarSet'] = $toolbar_set;
} }
if (!isset($editor_config['Width'])) { if (!isset($editor_config['Width'])) {
$editor_config['Width'] = $width; $editor_config['Width'] = $width;
} }
if (!isset($editor_config['Height'])) { if (!isset($editor_config['Height'])) {
$editor_config['Height'] = $height; $editor_config['Height'] = $height;
} }
} else { } else {
$editor_config = array('ToolbarSet' => $toolbar_set, 'Width' => $width, 'Height' => $height); $editor_config = array('ToolbarSet' => $toolbar_set, 'Width' => $width, 'Height' => $height);
} }
$form->add_html_editor('intro_content', null, null, false, $editor_config); $form->add_html_editor('intro_content', null, null, false, $editor_config);
@ -87,30 +87,30 @@ $form->addElement('style_submit_button', 'intro_cmdUpdate', get_lang('SaveIntroT
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
if ($intro_editAllowed) { if ($intro_editAllowed) {
$moduleId = Database::escape_string($moduleId); $moduleId = Database::escape_string($moduleId);
/* Replace command */ /* Replace command */
if ($intro_cmdUpdate) { if ($intro_cmdUpdate) {
if ($form->validate()) { if ($form->validate()) {
$form_values = $form->exportValues(); $form_values = $form->exportValues();
$intro_content = Security::remove_XSS(stripslashes(api_html_entity_decode($form_values['intro_content'])), COURSEMANAGERLOWSECURITY); $intro_content = Security::remove_XSS(stripslashes(api_html_entity_decode($form_values['intro_content'])), COURSEMANAGERLOWSECURITY);
if (!empty($intro_content)) { if (!empty($intro_content)) {
$sql = "REPLACE $TBL_INTRODUCTION SET c_id = $course_id, id='$moduleId',intro_text='".Database::escape_string($intro_content)."', session_id='".intval($session_id)."'"; $sql = "REPLACE $TBL_INTRODUCTION SET c_id = $course_id, id='$moduleId',intro_text='".Database::escape_string($intro_content)."', session_id='".intval($session_id)."'";
Database::query($sql); Database::query($sql);
$introduction_section .= Display::return_message(get_lang('IntroductionTextUpdated'),'confirmation', false); $introduction_section .= Display::return_message(get_lang('IntroductionTextUpdated'),'confirmation', false);
} else { } else {
$intro_cmdDel = true; // got to the delete command $intro_cmdDel = true; // got to the delete command
} }
} else { } else {
$intro_cmdEdit = true; $intro_cmdEdit = true;
} }
} }
/* Delete Command */ /* Delete Command */
if ($intro_cmdDel) { if ($intro_cmdDel) {
Database::query("DELETE FROM $TBL_INTRODUCTION WHERE c_id = $course_id AND id='".$moduleId."' AND session_id='".intval($session_id)."'"); Database::query("DELETE FROM $TBL_INTRODUCTION WHERE c_id = $course_id AND id='".$moduleId."' AND session_id='".intval($session_id)."'");
$introduction_section .= Display::return_message(get_lang('IntroductionTextDeleted'), 'confirmation'); $introduction_section .= Display::return_message(get_lang('IntroductionTextDeleted'), 'confirmation');
} }
} }

Loading…
Cancel
Save