Minor - format code, remove token, if session_id is empty set to 0

1.10.x
jmontoya 10 years ago
parent 9111c61ce6
commit a48a2093d6
  1. 3
      main/course_description/add.php
  2. 10
      main/course_description/course_description_controller.php
  3. 40
      main/course_description/index.php
  4. 3
      main/coursecopy/classes/CourseRestorer.class.php

@ -48,9 +48,6 @@ if ($description_type >= ADD_BLOCK) {
$header = $default_description_titles[ADD_BLOCK];
}
if (!$error) {
$token = Security::get_token();
}
// display form
$form = new FormValidator(
'course_description',

@ -76,11 +76,9 @@ class CourseDescriptionController
$data = array();
$data['id'] = $id;
$affected_rows = null;
$message = array();
if (strtoupper($_SERVER['REQUEST_METHOD']) == "POST") {
if (!empty($_POST['title']) && !empty($_POST['contentDescription'])) {
$check = Security::check_token();
if ($check) {
if (1) {
$title = $_POST['title'];
$content = $_POST['contentDescription'];
$description_type = $_POST['description_type'];
@ -108,7 +106,6 @@ class CourseDescriptionController
} else {
$course_description->insert();
}
Security::clear_token();
Display::addFlash(
Display::return_message(
@ -193,9 +190,7 @@ class CourseDescriptionController
$data = array();
if (strtoupper($_SERVER['REQUEST_METHOD']) == "POST") {
if (!empty($_POST['title']) && !empty($_POST['contentDescription'])) {
$check = Security::check_token();
if ($check) {
if (1) {
$title = $_POST['title'];
$content = $_POST['contentDescription'];
$description_type = $_POST['description_type'];
@ -205,7 +200,6 @@ class CourseDescriptionController
$course_description->set_content($content);
$course_description->insert(api_get_course_int_id());
}
Security::clear_token();
Display::addFlash(
Display::return_message(

@ -42,21 +42,39 @@ if (isset($_GET['isStudentView']) && $_GET['isStudentView'] == 'true') {
}
// interbreadcrumb
$interbreadcrumb[] = array ("url" => "index.php", "name" => get_lang('CourseProgram'));
if ($description_type == 1) $interbreadcrumb[] = array ("url" => "#", "name" => get_lang('GeneralDescription'));
if ($description_type == 2) $interbreadcrumb[] = array ("url" => "#", "name" => get_lang('Objectives'));
if ($description_type == 3) $interbreadcrumb[] = array ("url" => "#", "name" => get_lang('Topics'));
if ($description_type == 4) $interbreadcrumb[] = array ("url" => "#", "name" => get_lang('Methodology'));
if ($description_type == 5) $interbreadcrumb[] = array ("url" => "#", "name" => get_lang('CourseMaterial'));
if ($description_type == 6) $interbreadcrumb[] = array ("url" => "#", "name" => get_lang('HumanAndTechnicalResources'));
if ($description_type == 7) $interbreadcrumb[] = array ("url" => "#", "name" => get_lang('Assessment'));
if ($description_type == 8) $interbreadcrumb[] = array ("url" => "#", "name" => get_lang('ThematicAdvance'));
if ($description_type >= 9) $interbreadcrumb[] = array ("url" => "#", "name" => get_lang('Others'));
$interbreadcrumb[] = array ("url" => "index.php?".api_get_cidreq(), "name" => get_lang('CourseProgram'));
if ($description_type == 1) {
$interbreadcrumb[] = array("url" => "#", "name" => get_lang('GeneralDescription'));
}
if ($description_type == 2) {
$interbreadcrumb[] = array("url" => "#", "name" => get_lang('Objectives'));
}
if ($description_type == 3) {
$interbreadcrumb[] = array("url" => "#", "name" => get_lang('Topics'));
}
if ($description_type == 4) {
$interbreadcrumb[] = array("url" => "#", "name" => get_lang('Methodology'));
}
if ($description_type == 5) {
$interbreadcrumb[] = array("url" => "#", "name" => get_lang('CourseMaterial'));
}
if ($description_type == 6) {
$interbreadcrumb[] = array("url" => "#", "name" => get_lang('HumanAndTechnicalResources'));
}
if ($description_type == 7) {
$interbreadcrumb[] = array("url" => "#", "name" => get_lang('Assessment'));
}
if ($description_type == 8) {
$interbreadcrumb[] = array("url" => "#", "name" => get_lang('ThematicAdvance'));
}
if ($description_type >= 9) {
$interbreadcrumb[] = array("url" => "#", "name" => get_lang('Others'));
}
// course description controller object
$course_description_controller = new CourseDescriptionController();
// distpacher actions to controller
// Actions to controller
switch ($action) {
case 'listing':
$course_description_controller->listing();

@ -1536,10 +1536,9 @@ class CourseRestorer
);
$params = [];
if (!empty($session_id)) {
$session_id = intval($session_id);
$params['session_id'] = $session_id;
}
$params['c_id'] = $this->destination_course_id;
$params['description_type'] = self::DBUTF8($descriptionType);
$params['title'] = self::DBUTF8($title);

Loading…
Cancel
Save