Browse Source

Fix PHP warnings.

Julio Montoya 10 years ago
parent
commit
c48a61dbe9

+ 2 - 4
main/dropbox/dropbox_download.php

@@ -3,9 +3,7 @@
 /**
  * @package chamilo.dropbox
  */
-/**
- * Code
- */
+
 // including the basic Chamilo initialisation file
 require_once '../inc/global.inc.php';
 
@@ -95,7 +93,7 @@ if (!$allowed_to_download) {
     // the user is allowed to download the file
     $_SESSION['_seen'][$_course['id']][TOOL_DROPBOX][] = intval($_GET['id']);
 
-    $work = new Dropbox_work($_GET['id']);
+    $work = new Dropbox_Work($_GET['id']);
     $path = dropbox_cnf('sysPath') . '/' . $work -> filename; //path to file as stored on server
 
     if (!Security::check_abs_path($path, dropbox_cnf('sysPath').'/')) {

+ 3 - 3
main/exercice/exercise_submit.php

@@ -617,8 +617,8 @@ if (!empty ($gradebook) && $gradebook == 'view') {
     $interbreadcrumb[] = array ('url' => '../gradebook/' . Security::remove_XSS($_SESSION['gradebook_dest']),'name' => get_lang('ToolGradebook'));
 }
 
-$interbreadcrumb[] = array ("url" => "exercice.php?gradebook=$gradebook",	"name" => get_lang('Exercices'));
-$interbreadcrumb[] = array ("url" => "#","name" => $objExercise->name);
+$interbreadcrumb[] = array ("url" => "exercice.php?".api_get_cidreq(),	"name" => get_lang('Exercices'));
+$interbreadcrumb[] = array ("url" => "#", "name" => $objExercise->name);
 
 if ($origin != 'learnpath') { //so we are not in learnpath tool
     Display :: display_header(null,'Exercises');
@@ -1002,7 +1002,7 @@ if (!empty($error)) {
         }
     </script>';
 
-    echo '<form id="exercise_form" method="post" action="'.api_get_self().'?'.api_get_cidreq().'&autocomplete=off&gradebook='.$gradebook."&exerciseId=" . $exerciseId .'" name="frm_exercise" '.$onsubmit.'>
+    echo '<form id="exercise_form" method="post" action="'.api_get_self().'?'.api_get_cidreq().'&autocomplete=off&&exerciseId='.$exerciseId .'" name="frm_exercise" '.$onsubmit.'>
          <input type="hidden" name="formSent"				value="1" />
          <input type="hidden" name="exerciseId" 			value="'.$exerciseId . '" />
          <input type="hidden" name="num" 					value="'.$current_question.'" id="num_current_id" />

+ 8 - 2
main/forum/forumfunction.inc.php

@@ -2479,8 +2479,14 @@ function show_add_post_form($current_forum, $forum_setting, $action = '', $id =
         $check = Security::check_token('post');
         if ($check) {
             $values = $form->exportValues();
-            if ($values['thread_qualify_gradebook'] == '1' && empty($values['weight_calification'])) {
-                Display::display_error_message(get_lang('YouMustAssignWeightOfQualification').'&nbsp;<a href="javascript:window.back()">'.get_lang('Back').'</a>', false);
+            if (isset($values['thread_qualify_gradebook']) &&
+                $values['thread_qualify_gradebook'] == '1' &&
+                empty($values['weight_calification'])
+            ) {
+                Display::display_error_message(
+                    get_lang('YouMustAssignWeightOfQualification').'&nbsp;<a href="javascript:window.back()">'.get_lang('Back').'</a>',
+                    false
+                );
 
                 return false;
             }

+ 2 - 2
main/forum/index.php

@@ -86,11 +86,11 @@ $actions = isset($_GET['action']) ? $_GET['action'] : '';
 if ($actions == 'add') {
     switch ($_GET['content']) {
         case 'forum':
-            $interbreadcrumb[] = array('url' => 'index.php?gradebook='.$gradebook.'&search='.$search_forum, 'name' => get_lang('Forum'));
+            $interbreadcrumb[] = array('url' => 'index.php?search='.$search_forum.'&'.api_get_cidreq(), 'name' => get_lang('Forum'));
             $interbreadcrumb[] = array('url' =>'#', 'name' => get_lang('AddForum'));
             break;
         case 'forumcategory':
-            $interbreadcrumb[] = array('url' =>'index.php?gradebook='.$gradebook.'&search='.$search_forum, 'name' => get_lang('Forum'));
+            $interbreadcrumb[] = array('url' =>'index.php?search='.$search_forum.'&'.api_get_cidreq(), 'name' => get_lang('Forum'));
             $interbreadcrumb[] = array('url' =>'#', 'name' => get_lang('AddForumCategory'));
             break;
         default:

+ 3 - 1
main/glossary/index.php

@@ -1,11 +1,12 @@
 <?php
 /* For licensing terms, see /license.txt */
+
 /**
  * @package chamilo.glossary
  * @author Christian Fasanando, initial version
  * @author Bas Wijnen import/export to CSV
  */
-// Including the global initialization file.
+
 require_once '../inc/global.inc.php';
 
 $current_course_tool  = TOOL_GLOSSARY;
@@ -59,6 +60,7 @@ switch ($action) {
         $tool_name =  get_lang('ImportGlossary');
         break;
     case 'changeview':
+    default:
         $tool_name =  get_lang('List');
         break;
 }

+ 5 - 3
main/inc/lib/notebook.lib.php

@@ -53,13 +53,14 @@ class NotebookManager
         // Database table definition
         $t_notebook = Database :: get_course_table(TABLE_NOTEBOOK);
         $course_id = api_get_course_int_id();
+        $sessionId = api_get_session_id();
 
         $sql = "INSERT INTO $t_notebook (c_id, user_id, course, session_id, title, description, creation_date,update_date,status)
 				VALUES(
 					 $course_id,
 					'" . api_get_user_id() . "',
 					'" . Database::escape_string(api_get_course_id()) . "',
-					'" . intval($_SESSION['id_session']) . "',
+					'" . $sessionId . "',
 					'" . Database::escape_string($values['note_title']) . "',
 					'" . Database::escape_string($values['note_comment']) . "',
 					'" . Database::escape_string(date('Y-m-d H:i:s')) . "',
@@ -117,11 +118,12 @@ class NotebookManager
         $t_notebook = Database :: get_course_table(TABLE_NOTEBOOK);
 
         $course_id = api_get_course_int_id();
+        $sessionId = api_get_session_id();
 
         $sql = "UPDATE $t_notebook SET
 					user_id = '" . api_get_user_id() . "',
 					course = '" . Database::escape_string(api_get_course_id()) . "',
-					session_id = '" . intval($_SESSION['id_session']) . "',
+					session_id = '" . $sessionId . "',
 					title = '" . Database::escape_string($values['note_title']) . "',
 					description = '" . Database::escape_string($values['note_comment']) . "',
 					update_date = '" . Database::escape_string(date('Y-m-d H:i:s')) . "'
@@ -162,7 +164,7 @@ class NotebookManager
     {
 
         global $_user;
-        if (!$_GET['direction']) {
+        if (!isset($_GET['direction'])) {
             $sort_direction = 'ASC';
             $link_sort_direction = 'DESC';
         } elseif ($_GET['direction'] == 'ASC') {