Browse Source

Merge pull request #1875 from chamilo/scrutinizer-patch-1

Scrutinizer Auto-Fixes
Julio Montoya 7 years ago
parent
commit
c8995b1005

+ 2 - 2
main/admin/user_information.php

@@ -37,7 +37,7 @@ $interbreadcrumb[] = array("url" => 'index.php', "name" => get_lang('PlatformAdm
 $interbreadcrumb[] = array("url" => 'user_list.php', "name" => get_lang('UserList'));
 
 $userId = $user['user_id'];
-$tool_name = $user['complete_name'].(empty($user['official_code'])?'':' ('.$user['official_code'].')');
+$tool_name = $user['complete_name'].(empty($user['official_code']) ? '' : ' ('.$user['official_code'].')');
 $table_course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER);
 $table_course = Database::get_main_table(TABLE_MAIN_COURSE);
 
@@ -452,7 +452,7 @@ if (Database::num_rows($res) > 0) {
         $tools = '<a href="course_information.php?code='.$courseCode.'">'.
             Display::return_icon('synthese_view.gif', get_lang('Overview')).'</a>'.
             '<a href="'.$courseInfo['course_public_url'].'">'.
-            Display::return_icon('course_home.gif', get_lang('CourseHomepage')).'</a>' .
+            Display::return_icon('course_home.gif', get_lang('CourseHomepage')).'</a>'.
             '<a href="course_edit.php?id='.$course->c_id.'">'.
             Display::return_icon('edit.gif', get_lang('Edit')).'</a>';
         if ($course->status == STUDENT) {

+ 41 - 41
main/dropbox/dropbox_functions.inc.php

@@ -42,7 +42,7 @@ function handle_multiple_actions()
 
     // STEP 2: at least one file has to be selected. If not we return an error message
     $ids = isset($_GET['id']) ? $_GET['id'] : array();
-    if (count($ids)>0) {
+    if (count($ids) > 0) {
         $checked_file_ids = $_POST['id'];
     } else {
         foreach ($_POST as $key => $value) {
@@ -133,7 +133,7 @@ function delete_category($action, $id, $user_id = null)
     }
 
     $cat = get_dropbox_category($id);
-    if (count($cat)==0) {
+    if (count($cat) == 0) {
         return false;
     }
 
@@ -157,7 +157,7 @@ function delete_category($action, $id, $user_id = null)
     }
 
     // step 1: delete the category
-    $sql = "DELETE FROM ". Database::get_course_table(TABLE_DROPBOX_CATEGORY) ."
+    $sql = "DELETE FROM ".Database::get_course_table(TABLE_DROPBOX_CATEGORY)."
             WHERE c_id = $course_id AND cat_id='".intval($id)."' AND $sentreceived='1'";
     Database::query($sql);
 
@@ -241,7 +241,7 @@ function store_move($id, $target, $part)
             $return_message = get_lang('ReceivedFileMoved');
         }
         if ($part == 'sent') {
-            $sql = "UPDATE ". Database::get_course_table(TABLE_DROPBOX_FILE) ."
+            $sql = "UPDATE ".Database::get_course_table(TABLE_DROPBOX_FILE)."
                     SET cat_id = ".intval($target)."
                     WHERE
                         c_id = $course_id AND
@@ -276,7 +276,7 @@ function get_dropbox_categories($filter = '')
     $session_id = api_get_session_id();
     $condition_session = api_get_session_condition($session_id);
 
-    $sql = "SELECT * FROM ". Database::get_course_table(TABLE_DROPBOX_CATEGORY) ."
+    $sql = "SELECT * FROM ".Database::get_course_table(TABLE_DROPBOX_CATEGORY)."
             WHERE c_id = $course_id AND user_id='".$_user['user_id']."' $condition_session";
 
     $result = Database::query($sql);
@@ -298,7 +298,7 @@ function get_dropbox_category($id)
 {
     $course_id = api_get_course_int_id();
     if (empty($id) or $id != intval($id)) { return array(); }
-    $sql = "SELECT * FROM ". Database::get_course_table(TABLE_DROPBOX_CATEGORY) ."
+    $sql = "SELECT * FROM ".Database::get_course_table(TABLE_DROPBOX_CATEGORY)."
             WHERE c_id = $course_id AND cat_id='".$id."'";
     $res = Database::query($sql);
     if ($res === false) {
@@ -347,7 +347,7 @@ function store_addcategory()
     if (!isset($_POST['edit_id'])) {
         $session_id = api_get_session_id();
         // step 3a, we check if the category doesn't already exist
-        $sql = "SELECT * FROM ". Database::get_course_table(TABLE_DROPBOX_CATEGORY) ."
+        $sql = "SELECT * FROM ".Database::get_course_table(TABLE_DROPBOX_CATEGORY)."
                 WHERE
                     c_id = $course_id AND
                     user_id='".$_user['user_id']."' AND
@@ -370,7 +370,7 @@ function store_addcategory()
             ];
             $id = Database::insert(Database::get_course_table(TABLE_DROPBOX_CATEGORY), $params);
             if ($id) {
-                $sql = "UPDATE ". Database::get_course_table(TABLE_DROPBOX_CATEGORY) ." SET cat_id = iid WHERE iid = $id";
+                $sql = "UPDATE ".Database::get_course_table(TABLE_DROPBOX_CATEGORY)." SET cat_id = iid WHERE iid = $id";
                 Database::query($sql);
             }
 
@@ -419,7 +419,7 @@ function display_addcategory_form($category_name = '', $id = '', $action)
 
     if (isset($id) && $id != '') {
         // retrieve the category we are editing
-        $sql = "SELECT * FROM ". Database::get_course_table(TABLE_DROPBOX_CATEGORY) ."
+        $sql = "SELECT * FROM ".Database::get_course_table(TABLE_DROPBOX_CATEGORY)."
                 WHERE c_id = $course_id AND cat_id = ".intval($id);
         $result = Database::query($sql);
         $row = Database::fetch_array($result);
@@ -637,7 +637,7 @@ function display_add_form($viewReceivedCategory, $viewSentCategory, $view, $id =
 
                 $full_name = $userInfo['complete_name'].$groupNameListToString;
                 $current_user_id = $current_user['user_id'];
-                $options['user_' . $current_user_id] = $full_name;
+                $options['user_'.$current_user_id] = $full_name;
             }
         }
     }
@@ -745,8 +745,8 @@ function removeUnusedFiles()
 
     // select all files that aren't referenced anymore
     $sql = "SELECT DISTINCT f.id, f.filename
-            FROM " . Database::get_course_table(TABLE_DROPBOX_FILE) . " f
-            LEFT JOIN " . Database::get_course_table(TABLE_DROPBOX_PERSON) . " p
+            FROM " . Database::get_course_table(TABLE_DROPBOX_FILE)." f
+            LEFT JOIN " . Database::get_course_table(TABLE_DROPBOX_PERSON)." p
             ON (f.id = p.file_id)
             WHERE p.user_id IS NULL AND
                   f.c_id = $course_id
@@ -754,14 +754,14 @@ function removeUnusedFiles()
     $result = Database::query($sql);
     while ($res = Database::fetch_array($result)) {
         //delete the selected files from the post and file tables
-        $sql = "DELETE FROM " . Database::get_course_table(TABLE_DROPBOX_POST) . "
-                WHERE c_id = $course_id AND file_id = '" . $res['id'] . "'";
+        $sql = "DELETE FROM ".Database::get_course_table(TABLE_DROPBOX_POST)."
+                WHERE c_id = $course_id AND file_id = '".$res['id']."'";
         Database::query($sql);
-        $sql = "DELETE FROM " . Database::get_course_table(TABLE_DROPBOX_FILE) . "
-                WHERE c_id = $course_id AND id ='" . $res['id'] . "'";
+        $sql = "DELETE FROM ".Database::get_course_table(TABLE_DROPBOX_FILE)."
+                WHERE c_id = $course_id AND id ='".$res['id']."'";
         Database::query($sql);
         //delete file from server
-        @unlink( api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/dropbox/' . $res['filename']);
+        @unlink(api_get_path(SYS_COURSE_PATH).$_course['path'].'/dropbox/'.$res['filename']);
     }
 }
 
@@ -783,11 +783,11 @@ function getUserOwningThisMailing($mailingPseudoId, $owner = 0, $or_die = '')
 
     $mailingPseudoId = intval($mailingPseudoId);
     $sql = "SELECT f.uploader_id
-            FROM " . Database::get_course_table(TABLE_DROPBOX_FILE) . " f
-            LEFT JOIN " . Database::get_course_table(TABLE_DROPBOX_POST) . " p
+            FROM " . Database::get_course_table(TABLE_DROPBOX_FILE)." f
+            LEFT JOIN " . Database::get_course_table(TABLE_DROPBOX_POST)." p
             ON (f.id = p.file_id AND f.c_id = $course_id AND p.c_id = $course_id)
             WHERE
-                p.dest_user_id = '" . $mailingPseudoId . "' AND
+                p.dest_user_id = '".$mailingPseudoId."' AND
                 p.c_id = $course_id
             ";
     $result = Database::query($sql);
@@ -813,21 +813,21 @@ function removeMoreIfMailing($file_id)
     //    for all content files, replace mailingPseudoId by owner as uploader
     $file_id = intval($file_id);
     $sql = "SELECT p.dest_user_id
-            FROM " . Database::get_course_table(TABLE_DROPBOX_POST) . " p
-            WHERE c_id = $course_id AND p.file_id = '" . $file_id . "'";
+            FROM " . Database::get_course_table(TABLE_DROPBOX_POST)." p
+            WHERE c_id = $course_id AND p.file_id = '".$file_id."'";
     $result = Database::query($sql);
 
     if ($res = Database::fetch_array($result)) {
         $mailingPseudoId = $res['dest_user_id'];
         $mailId = get_mail_id_base();
         if ($mailingPseudoId > $mailId) {
-            $sql = "DELETE FROM " . Database::get_course_table(TABLE_DROPBOX_PERSON) . "
-                    WHERE c_id = $course_id AND user_id='" . $mailingPseudoId . "'";
+            $sql = "DELETE FROM ".Database::get_course_table(TABLE_DROPBOX_PERSON)."
+                    WHERE c_id = $course_id AND user_id='".$mailingPseudoId."'";
             Database::query($sql);
 
-            $sql = "UPDATE " . Database::get_course_table(TABLE_DROPBOX_FILE) ."
-                    SET uploader_id='" . api_get_user_id() . "'
-                    WHERE c_id = $course_id AND uploader_id='" . $mailingPseudoId . "'";
+            $sql = "UPDATE ".Database::get_course_table(TABLE_DROPBOX_FILE)."
+                    SET uploader_id='" . api_get_user_id()."'
+                    WHERE c_id = $course_id AND uploader_id='".$mailingPseudoId."'";
             Database::query($sql);
         }
     }
@@ -993,7 +993,7 @@ function store_add_dropbox($file = [], $work = null)
             }
         }
     } else {  // rename file to login_filename_uniqueId format
-        $dropbox_filename = $_user['username'] . "_" . $dropbox_filename . "_".uniqid('');
+        $dropbox_filename = $_user['username']."_".$dropbox_filename."_".uniqid('');
     }
 
     if (empty($work)) {
@@ -1038,14 +1038,14 @@ function store_add_dropbox($file = [], $work = null)
                 ),
                 $recipent_temp['email'],
                 get_lang('NewDropboxFileUploaded'),
-                get_lang('NewDropboxFileUploadedContent').' <a href="'.api_get_path(WEB_CODE_PATH).'dropbox/index.php?' . api_get_cidreq() . '">'.get_lang('SeeFile').'</a>'.
+                get_lang('NewDropboxFileUploadedContent').' <a href="'.api_get_path(WEB_CODE_PATH).'dropbox/index.php?'.api_get_cidreq().'">'.get_lang('SeeFile').'</a>'.
                 "\n\n".
                 api_get_person_name(
                     $_user['firstName'],
                     $_user['lastName'],
                     null,
                     PERSON_NAME_EMAIL_ADDRESS
-                )."\n".  get_lang('Email') ." : ".$_user['mail'],
+                )."\n".get_lang('Email')." : ".$_user['mail'],
                 api_get_person_name(
                     $_user['firstName'],
                     $_user['lastName'],
@@ -1156,12 +1156,12 @@ function user_can_download_file($id, $user_id)
     $id = intval($id);
     $user_id = intval($user_id);
 
-    $sql = "SELECT file_id FROM ". Database::get_course_table(TABLE_DROPBOX_PERSON) ."
+    $sql = "SELECT file_id FROM ".Database::get_course_table(TABLE_DROPBOX_PERSON)."
             WHERE c_id = $course_id AND user_id = $user_id AND file_id = ".$id;
     $result = Database::query($sql);
     $number_users_who_see_file = Database::num_rows($result);
 
-    $sql = "SELECT file_id FROM ". Database::get_course_table(TABLE_DROPBOX_POST) ."
+    $sql = "SELECT file_id FROM ".Database::get_course_table(TABLE_DROPBOX_POST)."
             WHERE c_id = $course_id AND dest_user_id = $user_id AND file_id = ".$id;
     $result = Database::query($sql);
     $count = Database::num_rows($result);
@@ -1175,12 +1175,12 @@ function check_if_file_exist($id)
 {
     $id = intval($id);
     $course_id = api_get_course_int_id();
-    $sql = "SELECT file_id FROM ". Database::get_course_table(TABLE_DROPBOX_PERSON) ."
+    $sql = "SELECT file_id FROM ".Database::get_course_table(TABLE_DROPBOX_PERSON)."
             WHERE c_id = $course_id AND file_id = ".$id;
     $result = Database::query($sql);
     $number_users_who_see_file = Database::num_rows($result);
 
-    $sql = "SELECT file_id FROM ". Database::get_course_table(TABLE_DROPBOX_POST) ."
+    $sql = "SELECT file_id FROM ".Database::get_course_table(TABLE_DROPBOX_POST)."
             WHERE c_id = $course_id AND file_id = ".$id;
     $result = Database::query($sql);
     $count = Database::num_rows($result);
@@ -1212,7 +1212,7 @@ function store_feedback()
 
         $id = Database::insert(Database::get_course_table(TABLE_DROPBOX_FEEDBACK), $params);
         if ($id) {
-            $sql = "UPDATE ". Database::get_course_table(TABLE_DROPBOX_FEEDBACK) ." SET feedback_id = iid WHERE iid = $id";
+            $sql = "UPDATE ".Database::get_course_table(TABLE_DROPBOX_FEEDBACK)." SET feedback_id = iid WHERE iid = $id";
             Database::query($sql);
         }
 
@@ -1239,10 +1239,10 @@ function zip_download($fileList)
 
     // note: we also have to add the check if the user has received or sent this file.
     $sql = "SELECT DISTINCT file.filename, file.title, file.author, file.description
-            FROM ". Database::get_course_table(TABLE_DROPBOX_FILE) ." file
-            INNER JOIN ". Database::get_course_table(TABLE_DROPBOX_PERSON) ." person
+            FROM ". Database::get_course_table(TABLE_DROPBOX_FILE)." file
+            INNER JOIN ". Database::get_course_table(TABLE_DROPBOX_PERSON)." person
             ON (person.file_id=file.id AND file.c_id = $course_id AND person.c_id = $course_id)
-            INNER JOIN ". Database::get_course_table(TABLE_DROPBOX_POST) ." post
+            INNER JOIN ".Database::get_course_table(TABLE_DROPBOX_POST)." post
             ON (post.file_id = file.id AND post.c_id = $course_id AND file.c_id = $course_id)
             WHERE
                 file.id IN (".implode(', ', $fileList).") AND
@@ -1339,7 +1339,7 @@ function generate_html_overview($files, $dont_show_columns = array(), $make_link
         // Adding the content.
         $return .= "\n<tr>";
         foreach ($column as $column_key => $column_value) {
-            if (!in_array($column_value,$dont_show_columns)) {
+            if (!in_array($column_value, $dont_show_columns)) {
                 $return .= "\n\t<td>";
                 if (in_array($column_value, $make_link)) {
                     $return .= '<a href="'.$value[$column_value].'">'.$value[$column_value].'</a>';
@@ -1367,11 +1367,11 @@ function get_total_number_feedback($file_id = '')
 {
     $course_id = api_get_course_int_id();
     $sql = "SELECT COUNT(feedback_id) AS total, file_id
-            FROM ". Database::get_course_table(TABLE_DROPBOX_FEEDBACK) ."
+            FROM ". Database::get_course_table(TABLE_DROPBOX_FEEDBACK)."
             WHERE c_id = $course_id GROUP BY file_id";
     $result = Database::query($sql);
     $return = array();
-    while ($row=Database::fetch_array($result)) {
+    while ($row = Database::fetch_array($result)) {
         $return[$row['file_id']] = $row['total'];
     }
     return $return;

+ 9 - 9
main/exercise/adminhp.php

@@ -8,12 +8,12 @@
 */
 require_once __DIR__.'/../inc/global.inc.php';
 
-$this_section=SECTION_COURSES;
+$this_section = SECTION_COURSES;
 
 $_course = api_get_course_info();
 
 if (isset($_REQUEST["cancel"])) {
-    if ($_REQUEST["cancel"]==get_lang('Cancel')) {
+    if ($_REQUEST["cancel"] == get_lang('Cancel')) {
         header("Location: exercise.php");
         exit;
     }
@@ -24,7 +24,7 @@ $hotpotatoesName = !empty($_REQUEST['hotpotatoesName']) ? Security::remove_XSS($
 $is_allowedToEdit = api_is_allowed_to_edit(null, true);
 
 // document path
-$documentPath=api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
+$documentPath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
 
 // picture path
 $picturePath = $documentPath.'/images';
@@ -38,21 +38,21 @@ if (!$is_allowedToEdit) {
 }
 
 if (isset($_SESSION['gradebook'])) {
-    $gradebook=	$_SESSION['gradebook'];
+    $gradebook = $_SESSION['gradebook'];
 }
 
-if (!empty($gradebook) && $gradebook=='view') {
-    $interbreadcrumb[]= array (
+if (!empty($gradebook) && $gradebook == 'view') {
+    $interbreadcrumb[] = array(
         'url' => '../gradebook/'.$_SESSION['gradebook_dest'],
         'name' => get_lang('ToolGradebook'),
     );
 }
 
-$interbreadcrumb[]=array("url" => "exercise.php","name" => get_lang('Exercises'));
+$interbreadcrumb[] = array("url" => "exercise.php", "name" => get_lang('Exercises'));
 
 $nameTools = get_lang('adminHP');
 
-Display::display_header($nameTools,"Exercise");
+Display::display_header($nameTools, "Exercise");
 
 /** @todo probably wrong !!!! */
 require_once api_get_path(SYS_CODE_PATH).'/exercise/hotpotatoes.lib.php';
@@ -62,7 +62,7 @@ require_once api_get_path(SYS_CODE_PATH).'/exercise/hotpotatoes.lib.php';
 </h4>
 <?php
 if (isset($newName)) {
-    if ($newName!="") {
+    if ($newName != "") {
         //alter database record for that test
         SetComment($hotpotatoesName, $newName);
         echo "<script> window.location='exercise.php'; </script>";

+ 11 - 11
main/exercise/exercise.php

@@ -97,7 +97,7 @@ if (!empty($_GET['gradebook']) && $_GET['gradebook'] == 'view') {
 
 if (!empty($gradebook) && $gradebook == 'view') {
     $interbreadcrumb[] = array(
-        'url' => '../gradebook/' . $_SESSION['gradebook_dest'],
+        'url' => '../gradebook/'.$_SESSION['gradebook_dest'],
         'name' => get_lang('ToolGradebook')
     );
 }
@@ -687,7 +687,7 @@ if (!empty($exerciseList)) {
                     $title = $cut_title;
                 }
 
-                $count_exercise_not_validated = (int)Event::count_exercise_result_not_validated(
+                $count_exercise_not_validated = (int) Event::count_exercise_result_not_validated(
                     $my_exercise_id,
                     $courseId,
                     $session_id
@@ -733,7 +733,7 @@ if (!empty($exerciseList)) {
                     );
 
                     // Exercise results
-                    $actions .='<a href="exercise_report.php?'.api_get_cidreq().'&exerciseId='.$row['id'].'">'.
+                    $actions .= '<a href="exercise_report.php?'.api_get_cidreq().'&exerciseId='.$row['id'].'">'.
                         Display::return_icon('test_results.png', get_lang('Results'), '', ICON_SIZE_SMALL).'</a>';
 
                     // Export
@@ -815,7 +815,7 @@ if (!empty($exerciseList)) {
                         }
                     }
 
-                    $actions .='<a href="exercise_report.php?'.api_get_cidreq().'&exerciseId='.$row['id'].'">'.
+                    $actions .= '<a href="exercise_report.php?'.api_get_cidreq().'&exerciseId='.$row['id'].'">'.
                         Display::return_icon('test_results.png', get_lang('Results'), '', ICON_SIZE_SMALL).'</a>';
                     $actions .= Display::url(Display::return_icon('cd.gif', get_lang('CopyExercise')), '', array('onclick' => "javascript:if(!confirm('".addslashes(api_htmlentities(get_lang('AreYouSureToCopy'), ENT_QUOTES, $charset))." ".addslashes($row['title'])."?"."')) return false;", 'href' => 'exercise.php?'.api_get_cidreq().'&choice=copy_exercise&sec_token='.$token.'&exerciseId='.$row['id']));
                 }
@@ -1014,7 +1014,7 @@ if (!empty($exerciseList)) {
                 $item .= Display::tag('td', $actions, array('class' => 'td_actions'));
             } else {
                 if ($isDrhOfCourse) {
-                    $actions ='<a href="exercise_report.php?'.api_get_cidreq().'&exerciseId='.$row['id'].'">'.
+                    $actions = '<a href="exercise_report.php?'.api_get_cidreq().'&exerciseId='.$row['id'].'">'.
                         Display::return_icon('test_results.png', get_lang('Results'), '', ICON_SIZE_SMALL).'</a>';
                     $item .= Display::tag('td', $actions, array('class' => 'td_actions'));
                 }
@@ -1024,7 +1024,7 @@ if (!empty($exerciseList)) {
                 'tr',
                 $item,
                 array(
-                    'id' => 'exercise_list_' . $my_exercise_id,
+                    'id' => 'exercise_list_'.$my_exercise_id,
                 )
             );
         }
@@ -1090,7 +1090,7 @@ if (isset($attribute['path']) && is_array($attribute['path'])) {
                     Display::return_icon('hotpotatoes_s.png', "HotPotatoes"),
                     Display::url(
                         $title,
-                        'showinframes.php?' . api_get_cidreq() . '&' . http_build_query([
+                        'showinframes.php?'.api_get_cidreq().'&'.http_build_query([
                             'file' => $path,
                             'uid' => $userId
                         ]),
@@ -1105,7 +1105,7 @@ if (isset($attribute['path']) && is_array($attribute['path'])) {
                 'adminhp.php?'.api_get_cidreq().'&hotpotatoesName='.$path
             );
 
-            $actions .='<a href="hotpotatoes_exercise_report.php?'.api_get_cidreq().'&path='.$path.'">'.
+            $actions .= '<a href="hotpotatoes_exercise_report.php?'.api_get_cidreq().'&path='.$path.'">'.
                 Display::return_icon('test_results.png', get_lang('Results'), '', ICON_SIZE_SMALL).'</a>';
 
             // if active
@@ -1114,7 +1114,7 @@ if (isset($attribute['path']) && is_array($attribute['path'])) {
                 $actions .= '      <a href="'.$exercisePath.'?'.api_get_cidreq().'&hpchoice=disable&page='.$page.'&file='.$path.'">'.
                     Display::return_icon('visible.png', get_lang('Deactivate'), '', ICON_SIZE_SMALL).'</a>';
             } else { // else if not active
-                $actions .='    <a href="'.$exercisePath.'?'.api_get_cidreq().'&hpchoice=enable&page='.$page.'&file='.$path.'">'.
+                $actions .= '    <a href="'.$exercisePath.'?'.api_get_cidreq().'&hpchoice=enable&page='.$page.'&file='.$path.'">'.
                     Display::return_icon('invisible.png', get_lang('Activate'), '', ICON_SIZE_SMALL).'</a>';
             }
             $actions .= '<a href="'.$exercisePath.'?'.api_get_cidreq().'&hpchoice=delete&file='.$path.'" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('AreYouSureToDeleteJS'), ENT_QUOTES, $charset).' '.$title."?").'\')) return false;">'.
@@ -1136,7 +1136,7 @@ if (isset($attribute['path']) && is_array($attribute['path'])) {
                     'td',
                     Display::url(
                         $title,
-                        'showinframes.php?' . api_get_cidreq() . '&' . http_build_query([
+                        'showinframes.php?'.api_get_cidreq().'&'.http_build_query([
                             'file' => $path,
                             'cid' => api_get_course_id(),
                             'uid' => $userId
@@ -1157,7 +1157,7 @@ if (isset($attribute['path']) && is_array($attribute['path'])) {
                 $item .= Display::tag('td', $attemptText);
 
                 if ($isDrhOfCourse) {
-                    $actions ='<a href="hotpotatoes_exercise_report.php?'.api_get_cidreq().'&path='.$path.'">'.
+                    $actions = '<a href="hotpotatoes_exercise_report.php?'.api_get_cidreq().'&path='.$path.'">'.
                         Display::return_icon('test_results.png', get_lang('Results'), '', ICON_SIZE_SMALL).'</a>';
 
                     $item .= Display::tag('td', $actions, array('class' => 'td_actions'));

+ 7 - 7
main/exercise/question_create.php

@@ -8,21 +8,21 @@
 require_once __DIR__.'/../inc/global.inc.php';
 
 // the section (tabs)
-$this_section=SECTION_COURSES;
+$this_section = SECTION_COURSES;
 
 // notice for unauthorized people.
 api_protect_course_script(true);
 
 // breadcrumbs
-$interbreadcrumb[]=array("url" => "exercise.php","name" => get_lang('Exercises'));
+$interbreadcrumb[] = array("url" => "exercise.php", "name" => get_lang('Exercises'));
 
 // Tool name
-$nameTools=get_lang('AddQuestionToExercise');
+$nameTools = get_lang('AddQuestionToExercise');
 
 // The form
-$form = new FormValidator('add_question','post',api_get_self().'?'.api_get_cidreq());
+$form = new FormValidator('add_question', 'post', api_get_self().'?'.api_get_cidreq());
 // form title
-$form->addElement('header','',get_lang('AddQuestionToExercise'));
+$form->addElement('header', '', get_lang('AddQuestionToExercise'));
 
 $question_list = Question::get_question_type_list();
 $question_list_options = array();
@@ -38,7 +38,7 @@ $form->addElement(
 );
 
 //session id
-$session_id  = api_get_session_id();
+$session_id = api_get_session_id();
 
 // the exercises
 $tbl_exercises = Database::get_course_table(TABLE_QUIZ_TEST);
@@ -98,7 +98,7 @@ if ($form->validate()) {
     Display::display_header($nameTools);
 
     echo '<div class="actions">';
-    echo '<a href="exercise.php?show=test">'.Display::return_icon('back.png', get_lang('BackToExercisesList'),'',ICON_SIZE_MEDIUM).'</a>';
+    echo '<a href="exercise.php?show=test">'.Display::return_icon('back.png', get_lang('BackToExercisesList'), '', ICON_SIZE_MEDIUM).'</a>';
     echo '</div>';
 
     // displaying the form

+ 6 - 6
main/gradebook/gradebook_showlog_eval.php

@@ -11,15 +11,15 @@ GradebookUtils::block_students();
 
 $selectCat = isset($_GET['selectcat']) ? (int) $_GET['selectcat'] : 0;
 
-$interbreadcrumb[] = array (
+$interbreadcrumb[] = array(
     'url' => $_SESSION['gradebook_dest'].'?',
     'name' => get_lang('Gradebook'
 ));
-$interbreadcrumb[] = array (
+$interbreadcrumb[] = array(
     'url' => $_SESSION['gradebook_dest'].'?selectcat='.$selectCat,
     'name' => get_lang('Details'
 ));
-$interbreadcrumb[] = array (
+$interbreadcrumb[] = array(
     'url' => 'gradebook_showlog_eval.php?visiblelog='.Security::remove_XSS($_GET['visiblelog']).'&amp;selectcat='.$selectCat,
     'name' => get_lang('GradebookQualifyLog')
 );
@@ -30,7 +30,7 @@ echo Display::page_header(get_lang('GradebookQualifyLog'));
 
 $t_linkeval_log = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINKEVAL_LOG);
 $t_user = Database::get_main_table(TABLE_MAIN_USER);
-$visible_log=Security::remove_XSS($_GET['visiblelog']);
+$visible_log = Security::remove_XSS($_GET['visiblelog']);
 
 $evaledit = Evaluation :: load($visible_log);
 $sql = "SELECT le.name,le.description,le.weight,le.visible,le.type,le.created_at,us.username
@@ -45,8 +45,8 @@ while ($row = Database::fetch_row($result)) {
 }
 
 foreach ($list_info as $key => $info_log) {
-    $list_info[$key][5]=($info_log[5]) ? api_convert_and_format_date($info_log[5]) : 'N/A';
-    $list_info[$key][3]=($info_log[3]==1) ? get_lang('GradebookVisible') : get_lang('GradebookInvisible');
+    $list_info[$key][5] = ($info_log[5]) ? api_convert_and_format_date($info_log[5]) : 'N/A';
+    $list_info[$key][3] = ($info_log[3] == 1) ? get_lang('GradebookVisible') : get_lang('GradebookInvisible');
 }
 
 $parameters = array(

+ 3 - 3
main/gradebook/lib/be/attendancelink.class.php

@@ -164,7 +164,7 @@ class AttendanceLink extends AbstractLink
             }
         } else {
             // all students -> get average
-            $students = array();  // user list, needed to make sure we only
+            $students = array(); // user list, needed to make sure we only
             // take first attempts into account
             $rescount = 0;
             $sum = 0;
@@ -239,7 +239,7 @@ class AttendanceLink extends AbstractLink
         $this->get_attendance_data();
         $attendance_title = isset($this->attendance_data['name']) ? $this->attendance_data['name'] : '';
         $attendance_qualify_title = isset($this->attendance_data['attendance_qualify_title']) ? $this->attendance_data['attendance_qualify_title'] : '';
-        if ( isset($attendance_qualify_title) && $attendance_qualify_title != '') {
+        if (isset($attendance_qualify_title) && $attendance_qualify_title != '') {
             return $this->attendance_data['attendance_qualify_title'];
         } else {
             return $attendance_title;
@@ -279,7 +279,7 @@ class AttendanceLink extends AbstractLink
         $sql = 'SELECT * FROM '.$this->get_attendance_table().' att
                 WHERE att.c_id = '.$this->course_id.' AND att.id = '.intval($this->get_ref_id()).' ';
         $result = Database::query($sql);
-        $row = Database::fetch_array($result,'ASSOC');
+        $row = Database::fetch_array($result, 'ASSOC');
         $attendance_id = $row['id'];
         $url = api_get_path(WEB_PATH).'main/attendance/index.php?action=attendance_sheet_list&gradebook=view&attendance_id='.$attendance_id.'&'.api_get_cidreq_params($this->get_course_code(), $session_id);
 

+ 2 - 2
main/help/faq.php

@@ -29,7 +29,7 @@ if (!empty($_GET['edit']) && $_GET['edit'] == 'true' && api_is_platform_admin())
         array('ToolbarSet' => 'FAQ', 'Width' => '100%', 'Height' => '300')
     );
     $form->addButtonSave(get_lang('Ok'), 'faq_submit');
-    $faq_content = @(string)file_get_contents(api_get_path(SYS_APP_PATH).'home/faq.html');
+    $faq_content = @(string) file_get_contents(api_get_path(SYS_APP_PATH).'home/faq.html');
     $faq_content = api_to_system_encoding($faq_content, api_detect_encoding(strip_tags($faq_content)));
     $form->setDefaults(array('faq_content' => $faq_content));
     if ($form->validate()) {
@@ -47,7 +47,7 @@ if (!empty($_GET['edit']) && $_GET['edit'] == 'true' && api_is_platform_admin())
         $form->display();
     }
 } else {
-    $faq_content = @(string)file_get_contents(api_get_path(SYS_APP_PATH).'home/'.$faq_file);
+    $faq_content = @(string) file_get_contents(api_get_path(SYS_APP_PATH).'home/'.$faq_file);
     $faq_content = api_to_system_encoding($faq_content, api_detect_encoding(strip_tags($faq_content)));
     echo $faq_content;
 }

+ 13 - 13
main/lp/lp_add_audio.php

@@ -13,8 +13,8 @@ api_protect_course_script();
 
 $is_allowed_to_edit = api_is_allowed_to_edit(null, true);
 
-$isStudentView = isset($_REQUEST['isStudentView']) ? (int)$_REQUEST['isStudentView'] : null;
-$learnpath_id = (int)$_REQUEST['lp_id'];
+$isStudentView = isset($_REQUEST['isStudentView']) ? (int) $_REQUEST['isStudentView'] : null;
+$learnpath_id = (int) $_REQUEST['lp_id'];
 $submit = isset($_POST['submit_button']) ? $_POST['submit_button'] : null;
 
 $type = isset($_GET['type']) ? $_GET['type'] : null;
@@ -32,7 +32,7 @@ if (isset($_SESSION['gradebook'])) {
 }
 
 if (!empty($gradebook) && $gradebook == 'view') {
-    $interbreadcrumb[] = array (
+    $interbreadcrumb[] = array(
         'url' => '../gradebook/'.$_SESSION['gradebook_dest'],
         'name' => get_lang('ToolGradebook')
     );
@@ -56,12 +56,12 @@ switch ($type) {
         );
         break;
     default:
-        $interbreadcrumb[]= array('url' => '#', 'name' => get_lang('NewStep'));
+        $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('NewStep'));
         break;
 }
 
 if ($action == 'add_item' && $type == 'document') {
-    $interbreadcrumb[]= array ('url' => '#', 'name' => get_lang('NewDocumentCreated'));
+    $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('NewDocumentCreated'));
 }
 
 // Theme calls.
@@ -77,7 +77,7 @@ $lp_item = new learnpathItem($lp_item_id);
 $form = new FormValidator(
     'add_audio',
     'post',
-    api_get_self() . '?action=add_audio&id=' . $lp_item_id . '&' . api_get_cidreq().'&lp_id='.$learnpath_id,
+    api_get_self().'?action=add_audio&id='.$lp_item_id.'&'.api_get_cidreq().'&lp_id='.$learnpath_id,
     null,
     array('enctype' => 'multipart/form-data')
 );
@@ -91,8 +91,8 @@ if (isset($lp_item->audio) && !empty($lp_item->audio)) {
     $urlFile = api_get_path(WEB_COURSE_PATH).$courseInfo['path'].'/document/audio/'.$lp_item->audio.'?'.api_get_cidreq();
 
     if (!file_exists($file)) {
-        $file = api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/document'.$lpPathInfo['dir'] . '/' . $lp_item->audio;
-        $urlFile = api_get_path(WEB_COURSE_PATH).$courseInfo['path'].'/document'.$lpPathInfo['dir'] . '/' . $lp_item->audio.'?'.api_get_cidreq();
+        $file = api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/document'.$lpPathInfo['dir'].'/'.$lp_item->audio;
+        $urlFile = api_get_path(WEB_COURSE_PATH).$courseInfo['path'].'/document'.$lpPathInfo['dir'].'/'.$lp_item->audio.'?'.api_get_cidreq();
     }
 }
 
@@ -108,10 +108,10 @@ $recordVoiceForm = Display::page_subheader(get_lang('RecordYourVoice'));
 
 $page .= '<div id="doc_form" class="col-md-8">';
 
-$htmlHeadXtra[] = '<script src="' . api_get_path(WEB_LIBRARY_JS_PATH) . 'rtc/RecordRTC.js"></script>';
-$htmlHeadXtra[] = '<script src="' . api_get_path(WEB_LIBRARY_PATH) . 'wami-recorder/recorder.js"></script>';
-$htmlHeadXtra[] = '<script src="' . api_get_path(WEB_LIBRARY_PATH) . 'wami-recorder/gui.js"></script>';
-$htmlHeadXtra[] = '<script type="text/javascript" src="' . api_get_path(WEB_LIBRARY_PATH) . 'swfobject/swfobject.js"></script>';
+$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_JS_PATH).'rtc/RecordRTC.js"></script>';
+$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'wami-recorder/recorder.js"></script>';
+$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'wami-recorder/gui.js"></script>';
+$htmlHeadXtra[] = '<script type="text/javascript" src="'.api_get_path(WEB_LIBRARY_PATH).'swfobject/swfobject.js"></script>';
 
 $tpl = new Template(null);
 $tpl->assign('unique_file_id', api_get_unique_id());
@@ -133,7 +133,7 @@ if (!empty($file)) {
         Display::getMediaPlayer($file, array('url' => $urlFile)).
         "</div>";
     $form->addElement('label', get_lang('Listen'), $audioPlayer);
-    $url = api_get_path(WEB_CODE_PATH) . 'lp/lp_controller.php?lp_id='.$_SESSION['oLP']->get_id().'&action=add_audio&id='.$lp_item_id.'&delete_file=1&'.api_get_cidreq();
+    $url = api_get_path(WEB_CODE_PATH).'lp/lp_controller.php?lp_id='.$_SESSION['oLP']->get_id().'&action=add_audio&id='.$lp_item_id.'&delete_file=1&'.api_get_cidreq();
     $form->addElement('label', null, Display::url(get_lang('RemoveAudio'), $url, array('class' => 'btn btn-danger')));
 } else {
     $form->addElement('file', 'file');

+ 15 - 15
main/session/add_many_session_to_category.php

@@ -16,7 +16,7 @@ $xajax->registerFunction('search_courses');
 $this_section = SECTION_PLATFORM_ADMIN;
 
 // setting breadcrumbs
-$interbreadcrumb[] = array('url' => 'session_list.php','name' => get_lang('SessionList'));
+$interbreadcrumb[] = array('url' => 'session_list.php', 'name' => get_lang('SessionList'));
 
 // Database Table Definitions
 $tbl_session_rel_course_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
@@ -38,7 +38,7 @@ if (isset($_GET['add_type']) && $_GET['add_type'] != '') {
 }
 
 if (!api_is_platform_admin() && !api_is_session_admin()) {
-    $sql = 'SELECT session_admin_id FROM ' . Database::get_main_table(TABLE_MAIN_SESSION) . ' WHERE id=' . $id_session;
+    $sql = 'SELECT session_admin_id FROM '.Database::get_main_table(TABLE_MAIN_SESSION).' WHERE id='.$id_session;
     $rs = Database::query($sql);
     if (Database::result($rs, 0, 0) != $_user['user_id']) {
         api_not_allowed(true);
@@ -100,7 +100,7 @@ if (isset($_POST['formSent']) && $_POST['formSent']) {
 
         $sql = "UPDATE $tbl_session SET session_category_id = $categoryId WHERE id in ($session_id) ";
         Database::query($sql);
-        header('Location: add_many_session_to_category.php?id_category=' . $categoryId . '&msg=ok');
+        header('Location: add_many_session_to_category.php?id_category='.$categoryId.'&msg=ok');
         exit;
     } else {
         header('Location: add_many_session_to_category.php?msg=error');
@@ -128,8 +128,8 @@ $where = '';
 $rows_category_session = array();
 if ((isset($_POST['CategorySessionId']) && $_POST['formSent'] == 0) || isset($_GET['id_category'])) {
 
-    $where = 'WHERE session_category_id != ' . $categoryId .' OR session_category_id IS NULL';
-    $sql = 'SELECT id, name  FROM ' . $tbl_session . ' WHERE session_category_id =' . $categoryId . ' ORDER BY name';
+    $where = 'WHERE session_category_id != '.$categoryId.' OR session_category_id IS NULL';
+    $sql = 'SELECT id, name  FROM '.$tbl_session.' WHERE session_category_id ='.$categoryId.' ORDER BY name';
     $result = Database::query($sql);
     $rows_category_session = Database::store_result($result);
 }
@@ -142,13 +142,13 @@ if (empty($rows_session_category)) {
 }
 
 if (api_get_multiple_access_url()) {
-    $table_access_url_rel_session= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
+    $table_access_url_rel_session = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
     $access_url_id = api_get_current_access_url_id();
     $sql = "SELECT s.id, s.name  FROM $tbl_session s INNER JOIN $table_access_url_rel_session u ON s.id = u.session_id $where AND u.access_url_id = $access_url_id ORDER BY name";
 } else {
     $sql = "SELECT id, name  FROM $tbl_session $where ORDER BY name";
 }
-$result=Database::query($sql);
+$result = Database::query($sql);
 $rows_session = Database::store_result($result);
 ?>
 <form name="formulaire" method="post"
@@ -156,7 +156,7 @@ $rows_session = Database::store_result($result);
 if (!empty($_GET['add'])) {
     echo '&add=true';
 } ?>" style="margin:0px;">
-<?php echo '<legend>' . $tool_name . '</legend>'; ?>
+<?php echo '<legend>'.$tool_name.'</legend>'; ?>
 <input type="hidden" name="formSent" value="1"/>
 <?php
 if (!empty($errorMsg)) {
@@ -194,8 +194,8 @@ if (!empty($OkMsg)) {
         <option value="0" ></option>
         <?php
         if (!empty($rows_session_category)) {
-            foreach($rows_session_category as $category) {
-                if($category['id'] == $categoryId)
+            foreach ($rows_session_category as $category) {
+                if ($category['id'] == $categoryId)
                         echo '<option value="'.$category['id'].'" selected>'.$category['name'].'</option>';
                     else
                         echo '<option value="'.$category['id'].'">'.$category['name'].'</option>';
@@ -211,7 +211,7 @@ if (!empty($OkMsg)) {
   <td align="center" width="45%"><b><?php echo get_lang('SessionListInCategory') ?> :</b></td>
 </tr>
 
-<?php if($add_type == 'multiple') { ?>
+<?php if ($add_type == 'multiple') { ?>
 <tr>
 <td>&nbsp;</td></tr>
 <?php } ?>
@@ -220,9 +220,9 @@ if (!empty($OkMsg)) {
     <div id="ajax_list_courses_multiple">
     <select id="origin" name="NoSessionCategoryList[]" multiple="multiple" size="20" style="width:320px;">
     <?php
-    foreach($rows_session as $enreg) {
+    foreach ($rows_session as $enreg) {
     ?>
-        <option value="<?php echo $enreg['id']; ?>" <?php echo 'title="'.htmlspecialchars($enreg['name'],ENT_QUOTES).'"'; if(in_array($enreg['id'],$CourseList)) echo 'selected="selected"'; ?>><?php echo $enreg['name']; ?></option>
+        <option value="<?php echo $enreg['id']; ?>" <?php echo 'title="'.htmlspecialchars($enreg['name'], ENT_QUOTES).'"'; if (in_array($enreg['id'], $CourseList)) echo 'selected="selected"'; ?>><?php echo $enreg['name']; ?></option>
     <?php } ?>
     </select></div>
 <?php unset($nosessionCourses); ?>
@@ -243,8 +243,8 @@ if (!empty($OkMsg)) {
   <td width="45%" align="center">
   <select id='destination' name="SessionCategoryList[]" multiple="multiple" size="20" style="width:320px;">
     <?php
-    foreach($rows_category_session as $enreg) { ?>
-        <option value="<?php echo $enreg['id']; ?>" <?php echo 'title="'.htmlspecialchars($enreg['name'],ENT_QUOTES).'"'; if(in_array($enreg['id'],$CourseList)) echo 'selected="selected"'; ?>><?php echo $enreg['name']; ?></option>
+    foreach ($rows_category_session as $enreg) { ?>
+        <option value="<?php echo $enreg['id']; ?>" <?php echo 'title="'.htmlspecialchars($enreg['name'], ENT_QUOTES).'"'; if (in_array($enreg['id'], $CourseList)) echo 'selected="selected"'; ?>><?php echo $enreg['name']; ?></option>
     <?php } ?>
   </select></td>
 </tr>

+ 2 - 2
main/survey/preview.php

@@ -154,7 +154,7 @@ if (api_is_course_admin() ||
 						survey_question_option.c_id = $course_id
 					WHERE
 					    survey_question.survey_id = '".intval($survey_id)."' AND
-						survey_question.question_id IN (".Database::escape_string(implode(',',$paged_questions[$_GET['show']]), null, false).") AND
+						survey_question.question_id IN (".Database::escape_string(implode(',', $paged_questions[$_GET['show']]), null, false).") AND
 						survey_question.c_id =  $course_id
 					ORDER BY survey_question.sort, survey_question_option.sort ASC";
 
@@ -191,7 +191,7 @@ if (api_is_course_admin() ||
 
 	// Displaying the form with the questions
 	if (isset($_GET['show'])) {
-		$show = (int)$_GET['show'] + 1;
+		$show = (int) $_GET['show'] + 1;
 	} else {
 		$show = 0;
 	}

+ 4 - 4
main/survey/question.php

@@ -47,13 +47,13 @@ if ($surveyData['survey_type'] == 1) {
     $sql = 'SELECT id FROM '.Database::get_course_table(TABLE_SURVEY_QUESTION_GROUP).'
             WHERE
                 c_id = '.$course_id.' AND
-                survey_id = '.(int)$_GET['survey_id'].' LIMIT 1';
+                survey_id = '.(int) $_GET['survey_id'].' LIMIT 1';
     $rs = Database::query($sql);
-    if (Database::num_rows($rs)===0) {
+    if (Database::num_rows($rs) === 0) {
         Display::addFlash(
             Display::return_message(get_lang('YouNeedToCreateGroups'))
         );
-        header('Location: '.api_get_path(WEB_CODE_PATH).'survey/survey.php?survey_id='.(int)$_GET['survey_id']);
+        header('Location: '.api_get_path(WEB_CODE_PATH).'survey/survey.php?survey_id='.(int) $_GET['survey_id']);
         exit;
     }
 }
@@ -93,7 +93,7 @@ $possible_types = array(
 // Actions
 $actions = '<div class="actions">';
 $actions .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey.php?survey_id='.intval($_GET['survey_id']).'">'.
-	Display::return_icon('back.png', get_lang('BackToSurvey'),'',ICON_SIZE_MEDIUM).'</a>';
+	Display::return_icon('back.png', get_lang('BackToSurvey'), '', ICON_SIZE_MEDIUM).'</a>';
 $actions .= '</div>';
 // Checking if it is a valid type
 if (!in_array($_GET['type'], $possible_types)) {

+ 4 - 4
main/survey/survey_invite.php

@@ -125,7 +125,7 @@ $form->addElement(
 );
 
 $form->addElement('html', '<div id="check_mail">');
-$form->addElement('checkbox', 'send_mail','', get_lang('SendMail'));
+$form->addElement('checkbox', 'send_mail', '', get_lang('SendMail'));
 $form->addElement('html', '</div>');
 
 $form->addElement('html', '<div id="mail_text_wrapper">');
@@ -213,8 +213,8 @@ if ($form->validate()) {
 	);
 
 	// Saving the invitations for the additional users
-	$values['additional_users'] = $values['additional_users'].';'; 	// This is for the case when you enter only one email
-	$temp = str_replace(',', ';', $values['additional_users']);		// This is to allow , and ; as email separators
+	$values['additional_users'] = $values['additional_users'].';'; // This is for the case when you enter only one email
+	$temp = str_replace(',', ';', $values['additional_users']); // This is to allow , and ; as email separators
 	$additional_users = explode(';', $temp);
 	for ($i = 0; $i < count($additional_users); $i++) {
 		$additional_users[$i] = trim($additional_users[$i]);
@@ -250,7 +250,7 @@ if ($form->validate()) {
 			$total_invited.'</a> ';
     	$message .= get_lang('WereInvited');
 
-    	echo Display::return_message($message,  'normal', false);
+    	echo Display::return_message($message, 'normal', false);
 
     	if ($sendMail) {
     	    echo Display::return_message($total_count.' '.get_lang('InvitationsSend'), 'success', false);

+ 23 - 23
main/user/resume_session.php

@@ -11,7 +11,7 @@ require_once __DIR__.'/../inc/global.inc.php';
 
 // setting the section (for the tabs)
 $this_section = SECTION_PLATFORM_ADMIN;
-$id_session = (int)$_GET['id_session'];
+$id_session = (int) $_GET['id_session'];
 SessionManager::protect_teacher_session_edit($id_session);
 
 $tool_name = get_lang('SessionOverview');
@@ -59,7 +59,7 @@ if ($allowTutors === 'true') {
     $rs = Database::query($sql);
     $session_category = '';
 
-    if (Database::num_rows($rs)>0) {
+    if (Database::num_rows($rs) > 0) {
         $rows_session_category = Database::store_result($rs);
         $rows_session_category = $rows_session_category[0];
         $session_category = $rows_session_category['name'];
@@ -84,25 +84,25 @@ if ($allowTutors === 'true') {
             break;
         case 'delete':
             $idChecked = $_GET['idChecked'];
-            if(is_array($idChecked)) {
+            if (is_array($idChecked)) {
                 $my_temp = array();
-                foreach ($idChecked as $id){
+                foreach ($idChecked as $id) {
                     $courseInfo = api_get_course_info($id);
-                    $my_temp[]= $courseInfo['real_id'];// forcing the escape_string
+                    $my_temp[] = $courseInfo['real_id']; // forcing the escape_string
                 }
                 $idChecked = $my_temp;
                 $idChecked = "'".implode("','", $idChecked)."'";
 
                 $result = Database::query("DELETE FROM $tbl_session_rel_course WHERE session_id='$id_session' AND c_id IN($idChecked)");
-                $nbr_affected_rows=Database::affected_rows($result);
+                $nbr_affected_rows = Database::affected_rows($result);
 
                 Database::query("DELETE FROM $tbl_session_rel_course_rel_user WHERE session_id='$id_session' AND c_id IN($idChecked)");
                 Database::query("UPDATE $tbl_session SET nbr_courses=nbr_courses-$nbr_affected_rows WHERE id='$id_session'");
             }
 
-            if (!empty($_GET['class'])){
+            if (!empty($_GET['class'])) {
                 $result = Database::query("DELETE FROM $tbl_session_rel_class WHERE session_id='$id_session' AND class_id=".intval($_GET['class']));
-                $nbr_affected_rows=Database::affected_rows($result);
+                $nbr_affected_rows = Database::affected_rows($result);
                 Database::query("UPDATE $tbl_session SET nbr_classes=nbr_classes-$nbr_affected_rows WHERE id='$id_session'");
             }
 
@@ -112,7 +112,7 @@ if ($allowTutors === 'true') {
                 Database::query("UPDATE $tbl_session SET nbr_users=nbr_users-$nbr_affected_rows WHERE id='$id_session'");
 
                 $result = Database::query("DELETE FROM $tbl_session_rel_course_rel_user WHERE session_id ='$id_session' AND user_id=".intval($_GET['user']));
-                $nbr_affected_rows=Database::affected_rows($result);
+                $nbr_affected_rows = Database::affected_rows($result);
 
                 Database::query("UPDATE $tbl_session_rel_course SET nbr_users=nbr_users-$nbr_affected_rows WHERE session_id ='$id_session'");
             }
@@ -130,28 +130,28 @@ if ($allowTutors === 'true') {
     	<td><?php echo get_lang('GeneralCoach'); ?> :</td>
     	<td><?php echo api_get_person_name($session['firstname'], $session['lastname']).' ('.$session['username'].')' ?></td>
     </tr>
-    <?php if(!empty($session_category)) { ?>
+    <?php if (!empty($session_category)) { ?>
     <tr>
     	<td><?php echo get_lang('SessionCategory') ?></td>
-    	<td><?php echo $session_category;  ?></td>
+    	<td><?php echo $session_category; ?></td>
     </tr>
     <?php } ?>
     <tr>
     	<td><?php echo get_lang('Date'); ?> :</td>
     	<td>
     	<?php
-            if ($session['access_start_date'] == '00-00-0000' && $session['access_end_date']== '00-00-0000' ) {
+            if ($session['access_start_date'] == '00-00-0000' && $session['access_end_date'] == '00-00-0000') {
                 echo get_lang('NoTimeLimits');
             }
             else {
                 if ($session['access_start_date'] != '00-00-0000') {
                     //$session['date_start'] = Display::tag('i', get_lang('NoTimeLimits'));
-                    $session['access_start_date'] =  get_lang('From').' '.$session['access_start_date'];
+                    $session['access_start_date'] = get_lang('From').' '.$session['access_start_date'];
                 } else {
                     $session['access_start_date'] = '';
                 }
                 if ($session['access_end_date'] == '00-00-0000') {
-                    $session['access_end_date'] ='';
+                    $session['access_end_date'] = '';
                 } else {
                     $session['access_end_date'] = get_lang('Until').' '.$session['access_end_date'];
                 }
@@ -182,7 +182,7 @@ if ($allowTutors === 'true') {
     		<?php echo api_ucfirst(get_lang('SessionVisibility')) ?> :
     	</td>
     	<td>
-    		<?php if ($session['visibility']==1) echo get_lang('ReadOnly'); elseif($session['visibility']==2) echo get_lang('Visible');elseif($session['visibility']==3) echo api_ucfirst(get_lang('Invisible'))  ?>
+    		<?php if ($session['visibility'] == 1) echo get_lang('ReadOnly'); elseif ($session['visibility'] == 2) echo get_lang('Visible'); elseif ($session['visibility'] == 3) echo api_ucfirst(get_lang('Invisible'))  ?>
     	</td>
     </tr>
     <?php
@@ -194,7 +194,7 @@ if ($allowTutors === 'true') {
         echo '</td>';
         echo '<td>';
         $url_list = UrlManager::get_access_url_from_session($id_session);
-        foreach($url_list as $url_data) {
+        foreach ($url_list as $url_data) {
             echo $url_data['url'].'<br />';
         }
         echo '</td></tr>';
@@ -224,8 +224,8 @@ if ($allowTutors === 'true') {
     			WHERE c.id = sc.c_id
     			AND	session_id='$id_session'
     			ORDER BY title";
-        $result=Database::query($sql);
-        $courses=Database::store_result($result);
+        $result = Database::query($sql);
+        $courses = Database::store_result($result);
         foreach ($courses as $course) {
             //select the number of users
 
@@ -238,7 +238,7 @@ if ($allowTutors === 'true') {
                         srcru.session_id = '".intval($id_session)."'";
 
             $rs = Database::query($sql);
-            $course['nbr_users'] = Database::result($rs,0,0);
+            $course['nbr_users'] = Database::result($rs, 0, 0);
 
             // Get coachs of the courses in session
 
@@ -264,7 +264,7 @@ if ($allowTutors === 'true') {
             }
 
             if (count($coachs) > 0) {
-                $coach = implode('<br />',$coachs);
+                $coach = implode('<br />', $coachs);
             } else {
                 $coach = get_lang('None');
             }
@@ -274,7 +274,7 @@ if ($allowTutors === 'true') {
             // name of the course, that appeared in the default $interbreadcrumb
             echo '
     		<tr>
-    			<td>'.Display::url($course['title'].' ('.$course['visual_code'].')', api_get_path(WEB_COURSE_PATH).$course['code'].'/?id_session='.$id_session),'</td>
+    			<td>'.Display::url($course['title'].' ('.$course['visual_code'].')', api_get_path(WEB_COURSE_PATH).$course['code'].'/?id_session='.$id_session), '</td>
     			<td>'.$coach.'</td>
     			<td>'.$course['nbr_users'].'</td>
 
@@ -299,7 +299,7 @@ if ($allowTutors === 'true') {
         </tr>
     <?php
 
-    if ($session['nbr_users']==0) {
+    if ($session['nbr_users'] == 0) {
         echo '<tr>
     			<td colspan="2">'.get_lang('NoUsersForThisSession').'</td>
     		</tr>';
@@ -330,7 +330,7 @@ if ($allowTutors === 'true') {
             $user_link = '';
             if (!empty($user['user_id'])) {
                 $user_link = '<a href="'.api_get_path(WEB_CODE_PATH).'admin/user_information.php?user_id='.intval($user['user_id']).'">'.
-                    api_htmlentities(api_get_person_name($user['firstname'], $user['lastname']),ENT_QUOTES,$charset).' ('.$user['username'].')</a>';
+                    api_htmlentities(api_get_person_name($user['firstname'], $user['lastname']), ENT_QUOTES, $charset).' ('.$user['username'].')</a>';
             }
 
             $link_to_add_user_in_url = '';

+ 2 - 2
src/Chamilo/CoreBundle/Entity/Skill.php

@@ -229,14 +229,14 @@ class Skill
                 return \Display::return_icon('badges-default.png', null, null, ICON_SIZE_BIG, null, true);
             }
 
-            return api_get_path(WEB_UPLOAD_PATH) . 'badges/' . sha1($this->name) . '-small.png';
+            return api_get_path(WEB_UPLOAD_PATH).'badges/'.sha1($this->name).'-small.png';
         }
 
         if (empty($this->icon)) {
             return \Display::return_icon('badges-default.png', null, null, ICON_SIZE_HUGE, null, true);
         }
 
-        return api_get_path(WEB_UPLOAD_PATH) . "badges/{$this->icon}";
+        return api_get_path(WEB_UPLOAD_PATH)."badges/{$this->icon}";
     }
 
     /**

+ 2 - 2
whoisonlinesession.php

@@ -77,7 +77,7 @@ Display::display_header(get_lang('UserOnlineListSession'));
             $time_limit = 60;
         }
 
-        $online_time    = time() - $time_limit*60;
+        $online_time    = time() - $time_limit * 60;
         $current_date   = api_get_utc_datetime($online_time);
 
         $students_online = array();
@@ -97,7 +97,7 @@ Display::display_header(get_lang('UserOnlineListSession'));
 
             $result = Database::query($sql);
 
-            while($user_list = Database::fetch_array($result)) {
+            while ($user_list = Database::fetch_array($result)) {
                 $students_online[$user_list['access_user_id']] = $user_list;
             }
         }