Browse Source

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

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

+ 8 - 8
main/admin/access_url_add_users_to_url.php

@@ -30,8 +30,8 @@ $tbl_user = Database::get_main_table(TABLE_MAIN_USER);
 
 /*	Header	*/
 $tool_name = get_lang('AddUsersToURL');
-$interbreadcrumb[] = array ('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array ('url' => 'access_urls.php', 'name' => get_lang('MultipleAccessURLs'));
+$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = array('url' => 'access_urls.php', 'name' => get_lang('MultipleAccessURLs'));
 
 Display :: display_header($tool_name);
 
@@ -46,8 +46,8 @@ api_display_tool_title($tool_name);
 
 if ($_POST['form_sent']) {
     $form_sent = $_POST['form_sent'];
-    $users = is_array($_POST['user_list']) ? $_POST['user_list'] : array() ;
-    $url_list = is_array($_POST['url_list']) ? $_POST['url_list'] : array() ;
+    $users = is_array($_POST['user_list']) ? $_POST['user_list'] : array();
+    $url_list = is_array($_POST['url_list']) ? $_POST['url_list'] : array();
     $first_letter_user = $_POST['first_letter_user'];
     foreach ($users as $key => $value) {
         $users[$key] = intval($value);
@@ -70,7 +70,7 @@ if (empty($first_letter_user)) {
     $sql = "SELECT count(*) as nb_users FROM $tbl_user";
     $result = Database::query($sql);
     $num_row = Database::fetch_array($result);
-    if ($num_row['nb_users']>1000) {
+    if ($num_row['nb_users'] > 1000) {
         //if there are too much users to gracefully handle with the HTML select list,
         // assign a default filter on users names
         $first_letter_user = 'A';
@@ -101,7 +101,7 @@ unset($result);
     <td width="40%" align="center">
      <b><?php echo get_lang('UserList'); ?></b>
      <br/><br/>
-     <?php echo get_lang('Select').' ' ; echo $target_name == 'firstname'? get_lang('FirstName') : get_lang('LastName'); ?>
+     <?php echo get_lang('Select').' '; echo $target_name == 'firstname' ? get_lang('FirstName') : get_lang('LastName'); ?>
      <select name="first_letter_user" onchange="javascript:document.formulaire.form_sent.value='2'; document.formulaire.submit();">
       <option value="">--</option>
       <?php
@@ -120,7 +120,7 @@ unset($result);
         <?php
         foreach ($db_users as $user) {
         ?>
-            <option value="<?php echo $user['user_id']; ?>" <?php if(in_array($user['user_id'], $users)) echo 'selected="selected"'; ?>>
+            <option value="<?php echo $user['user_id']; ?>" <?php if (in_array($user['user_id'], $users)) echo 'selected="selected"'; ?>>
             <?php echo api_get_person_name($user['firstname'], $user['lastname']).' ('.$user['username'].')'; ?>
             </option>
         <?php
@@ -136,7 +136,7 @@ unset($result);
 		<?php
         foreach ($db_urls as $url_obj) {
             ?>
-			<option value="<?php echo $url_obj['id']; ?>" <?php if(in_array($url_obj['id'],$url_list)) echo 'selected="selected"'; ?>>
+			<option value="<?php echo $url_obj['id']; ?>" <?php if (in_array($url_obj['id'], $url_list)) echo 'selected="selected"'; ?>>
                 <?php echo $url_obj['url']; ?>
 			</option>
 			<?php

+ 8 - 8
main/admin/access_url_edit.php

@@ -36,19 +36,19 @@ if ($form->validate()) {
             if (substr($url, strlen($url) - 1, strlen($url)) == '/') {
                 UrlManager::update($url_id, $url, $description, $active);
             } else {
-                UrlManager::update($url_id, $url . '/', $description, $active);
+                UrlManager::update($url_id, $url.'/', $description, $active);
             }
             // URL Images
-            $url_images_dir = api_get_path(SYS_PATH) . 'custompages/url-images/';
+            $url_images_dir = api_get_path(SYS_PATH).'custompages/url-images/';
             $image_fields = array("url_image_1", "url_image_2", "url_image_3");
             foreach ($image_fields as $image_field) {
                 if ($_FILES[$image_field]['error'] == 0) {
                     // Hardcoded: only PNG files allowed
                     $fileFields = explode('.', $_FILES[$image_field]['name']);
                     if (end($fileFields) == 'png') {
-                        if (file_exists($url_images_dir . $url_id . '_' . $image_field . '.png')) {
+                        if (file_exists($url_images_dir.$url_id.'_'.$image_field.'.png')) {
                             // if the file exists, we have to remove it before move_uploaded_file
-                            unlink($url_images_dir . $url_id . '_' . $image_field . '.png');
+                            unlink($url_images_dir.$url_id.'_'.$image_field.'.png');
                         }
                         move_uploaded_file(
                             $_FILES[$image_field]['tmp_name'],
@@ -69,7 +69,7 @@ if ($form->validate()) {
                     UrlManager::add($url, $description, $active);
                 } else {
                     //create
-                    UrlManager::add($url . '/', $description, $active);
+                    UrlManager::add($url.'/', $description, $active);
                 }
                 $message = get_lang('URLAdded');
                 $url_to_go = 'access_urls.php';
@@ -80,14 +80,14 @@ if ($form->validate()) {
             // URL Images
             $url .= (substr($url, strlen($url) - 1, strlen($url)) == '/') ? '' : '/';
             $url_id = UrlManager::get_url_id($url);
-            $url_images_dir = api_get_path(SYS_PATH) . 'custompages/url-images/';
+            $url_images_dir = api_get_path(SYS_PATH).'custompages/url-images/';
             $image_fields = array("url_image_1", "url_image_2", "url_image_3");
             foreach ($image_fields as $image_field) {
                 if ($_FILES[$image_field]['error'] == 0) {
                     // Hardcoded: only PNG files allowed
                     $fileFields = explode('.', $_FILES[$image_field]['name']);
                     if (end($fileFields) == 'png') {
-                        move_uploaded_file($_FILES[$image_field]['tmp_name'], $url_images_dir . $url_id . '_' . $image_field . '.png');
+                        move_uploaded_file($_FILES[$image_field]['tmp_name'], $url_images_dir.$url_id.'_'.$image_field.'.png');
                     }
                     // else fail silently
                 }
@@ -97,7 +97,7 @@ if ($form->validate()) {
         Security::clear_token();
         $tok = Security::get_token();
         Display::addFlash(Display::return_message($message));
-        header('Location: ' . $url_to_go . '?sec_token=' . $tok);
+        header('Location: '.$url_to_go.'?sec_token='.$tok);
         exit();
     }
 } else {

+ 18 - 18
main/admin/add_sessions_to_usergroup.php

@@ -21,16 +21,16 @@ $this_section = SECTION_PLATFORM_ADMIN;
 api_protect_admin_script(true);
 
 // setting breadcrumbs
-$interbreadcrumb[]=array('url' => 'index.php','name' => get_lang('PlatformAdmin'));
-$interbreadcrumb[]=array('url' => 'usergroups.php','name' => get_lang('Classes'));
+$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = array('url' => 'usergroups.php', 'name' => get_lang('Classes'));
 
 // Database Table Definitions
 
 // setting the name of the tool
-$tool_name=get_lang('SubscribeClassToSessions');
+$tool_name = get_lang('SubscribeClassToSessions');
 
 $add_type = 'multiple';
-if(isset($_REQUEST['add_type']) && $_REQUEST['add_type']!=''){
+if (isset($_REQUEST['add_type']) && $_REQUEST['add_type'] != '') {
     $add_type = Security::remove_XSS($_REQUEST['add_type']);
 }
 
@@ -65,10 +65,10 @@ function remove_item(origin) {
 function display_advanced_search () {
         if ($("#advancedSearch").css("display") == "none") {
                 $("#advancedSearch").css("display","block");
-                $("#img_plus_and_minus").html(\'&nbsp;'.Display::return_icon('div_hide.gif',get_lang('Hide'),array('style'=>'vertical-align:middle')).'&nbsp;'.get_lang('AdvancedSearch').'\');
+                $("#img_plus_and_minus").html(\'&nbsp;'.Display::return_icon('div_hide.gif', get_lang('Hide'), array('style'=>'vertical-align:middle')).'&nbsp;'.get_lang('AdvancedSearch').'\');
         } else {
                 $("#advancedSearch").css("display","none");
-                $("#img_plus_and_minus").html(\'&nbsp;'.Display::return_icon('div_show.gif',get_lang('Show'),array('style'=>'vertical-align:middle')).'&nbsp;'.get_lang('AdvancedSearch').'\');
+                $("#img_plus_and_minus").html(\'&nbsp;'.Display::return_icon('div_show.gif', get_lang('Show'), array('style'=>'vertical-align:middle')).'&nbsp;'.get_lang('AdvancedSearch').'\');
         }
 }
 
@@ -82,7 +82,7 @@ function validate_filter() {
 
 $form_sent  = 0;
 $errorMsg   = '';
-$sessions=array();
+$sessions = array();
 $usergroup = new UserGroup();
 $id = intval($_GET['id']);
 if (isset($_POST['form_sent']) && $_POST['form_sent']) {
@@ -117,7 +117,7 @@ $ajax_search = $add_type == 'unique' ? true : false;
 
 //checking for extra field with filter on
 
-function search_usergroup_sessions($needle,$type) {
+function search_usergroup_sessions($needle, $type) {
     global $elements_in;
     $xajax_response = new xajaxResponse();
     $return = '';
@@ -155,24 +155,24 @@ Display::display_header($tool_name);
 
 $add = (empty($_GET['add']) ? '' : Security::remove_XSS($_GET['add']));
 if ($add_type == 'multiple') {
-    $link_add_type_unique = '<a href="' . api_get_self() . '?add=' . $add . '&add_type=unique">'.
+    $link_add_type_unique = '<a href="'.api_get_self().'?add='.$add.'&add_type=unique">'.
         Display::return_icon('single.gif').get_lang('SessionAddTypeUnique').'</a>';
     $link_add_type_multiple = Display::return_icon('multiple.gif').get_lang('SessionAddTypeMultiple');
 } else {
     $link_add_type_unique = Display::return_icon('single.gif').get_lang('SessionAddTypeUnique');
-    $link_add_type_multiple = '<a href="' . api_get_self() . '?add=' . $add . '&add_type=multiple">'.
+    $link_add_type_multiple = '<a href="'.api_get_self().'?add='.$add.'&add_type=multiple">'.
         Display::return_icon('multiple.gif').get_lang('SessionAddTypeMultiple').'</a>';
 }
 
 echo '<div class="actions">';
-echo '<a href="usergroups.php">'.Display::return_icon('back.png',get_lang('Back'),'',ICON_SIZE_MEDIUM).'</a>';
+echo '<a href="usergroups.php">'.Display::return_icon('back.png', get_lang('Back'), '', ICON_SIZE_MEDIUM).'</a>';
 echo '<a href="javascript://" class="advanced_parameters" style="margin-top: 8px" onclick="display_advanced_search();"><span id="img_plus_and_minus">&nbsp;'.
-    Display::return_icon('div_show.gif',get_lang('Show'),array('style'=>'vertical-align:middle')).' '.get_lang('AdvancedSearch').'</span></a>';
+    Display::return_icon('div_show.gif', get_lang('Show'), array('style'=>'vertical-align:middle')).' '.get_lang('AdvancedSearch').'</span></a>';
 echo '</div>';
-echo '<div id="advancedSearch" style="display: none">'. get_lang('SearchSessions'); ?> :
+echo '<div id="advancedSearch" style="display: none">'.get_lang('SearchSessions'); ?> :
      <input name="SearchSession" onchange = "xajax_search_usergroup_sessions(this.value,'searchbox')" onkeyup="this.onchange()">
      </div>
-<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?id=<?php echo $id; if(!empty($_GET['add'])) echo '&add=true' ; ?>" style="margin:0px;" <?php if($ajax_search){echo ' onsubmit="valide();"';}?>>
+<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?id=<?php echo $id; if (!empty($_GET['add'])) echo '&add=true'; ?>" style="margin:0px;" <?php if ($ajax_search) {echo ' onsubmit="valide();"'; }?>>
 <?php
 echo '<legend>'.$data['name'].': '.$tool_name.'</legend>';
 echo Display::input('hidden', 'id', $id);
@@ -191,7 +191,7 @@ if (!empty($errorMsg)) {
   <td align="center"><b><?php echo get_lang('SessionsInGroup') ?> :</b></td>
 </tr>
 
-<?php if ($add_type=='multiple') { ?>
+<?php if ($add_type == 'multiple') { ?>
 <tr>
 <td align="center">
 <?php echo get_lang('FirstLetterSessions'); ?> :
@@ -210,7 +210,7 @@ if (!empty($errorMsg)) {
   <td align="center">
   <div id="content_source">
       <?php
-      if (!($add_type=='multiple')) {
+      if (!($add_type == 'multiple')) {
         ?>
         <input type="text" id="user_to_add" onkeyup="xajax_search_users(this.value,'single')" />
         <div id="ajax_list_users_single"></div>
@@ -218,7 +218,7 @@ if (!empty($errorMsg)) {
       } else {
       ?>
       <div id="ajax_list_multiple">
-        <?php echo Display::select('elements_not_in_name',$elements_not_in, '',array('style'=>'width:360px', 'multiple'=>'multiple','id'=>'elements_not_in','size'=>'15px'),false); ?>
+        <?php echo Display::select('elements_not_in_name', $elements_not_in, '', array('style'=>'width:360px', 'multiple'=>'multiple', 'id'=>'elements_not_in', 'size'=>'15px'), false); ?>
       </div>
     <?php
       }
@@ -249,7 +249,7 @@ if (!empty($errorMsg)) {
   </td>
   <td align="center">
 <?php
-    echo Display::select('elements_in_name[]', $elements_in, '', array('style'=>'width:360px', 'multiple'=>'multiple','id'=>'elements_in','size'=>'15px'),false );
+    echo Display::select('elements_in_name[]', $elements_in, '', array('style'=>'width:360px', 'multiple'=>'multiple', 'id'=>'elements_in', 'size'=>'15px'), false);
     unset($sessionUsersList);
 ?>
  </td>

+ 2 - 2
main/admin/event_type.php

@@ -48,7 +48,7 @@ if ($action == 'modEventType') {
 
 $ets = Event::get_all_event_types();
 $languages = api_get_languages();
-$ajaxPath = api_get_path(WEB_CODE_PATH) . 'inc/ajax/events.ajax.php';
+$ajaxPath = api_get_path(WEB_CODE_PATH).'inc/ajax/events.ajax.php';
 
 $action_array = array(
     array(
@@ -324,7 +324,7 @@ echo Display::actions($action_array);
         <select class="col-md-6" multiple="1" id="eventList" onchange="confirmMessage(this.name); return false;" name="eventList">
         <?php
         foreach ($event_config as $key => $config) {
-            echo '<option value="' . $key . '">' . $config['name_lang_var'] . '</option>';
+            echo '<option value="'.$key.'">'.$config['name_lang_var'].'</option>';
         }
         ?>
         </select>

+ 2 - 2
main/admin/settings.php

@@ -67,7 +67,7 @@ if (isset($_GET['delete_watermark'])) {
     Display::addFlash(Display::return_message(get_lang('FileDeleted')));
 }
 
-if (isset($_GET['action']) &&  $_GET['action'] == 'delete_grading') {
+if (isset($_GET['action']) && $_GET['action'] == 'delete_grading') {
     $id = intval($_GET['id']);
     api_delete_setting_option($id);
 }
@@ -233,7 +233,7 @@ if (!empty($_GET['category']) &&
         // Set true for allow_message_tool variable if social tool is actived
         foreach ($convert_byte_to_mega_list as $item) {
             if (isset($values[$item])) {
-                $values[$item] = round($values[$item]*1024*1024);
+                $values[$item] = round($values[$item] * 1024 * 1024);
             }
         }
 

+ 2 - 2
main/admin/statistics.php

@@ -5,13 +5,13 @@
 *   @package chamilo.admin
 */
 
-$cidReset=true;
+$cidReset = true;
 require_once __DIR__.'/../inc/global.inc.php';
 $this_section = SECTION_PLATFORM_ADMIN;
 
 api_protect_admin_script();
 
-$interbreadcrumb[]=array('url' => 'index.php',"name" => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = array('url' => 'index.php', "name" => get_lang('PlatformAdmin'));
 $tool_name = get_lang('Statistics');
 Display::display_header($tool_name);
 Display::display_footer();

+ 6 - 6
main/admin/teachers_time_by_session_report.php

@@ -13,7 +13,7 @@ use Chamilo\CourseBundle\Entity\Repository\CStudentPublicationRepository;
 $cidReset = true;
 
 require_once __DIR__.'/../inc/global.inc.php';
-require_once api_get_path(SYS_CODE_PATH) . 'work/work.lib.php';
+require_once api_get_path(SYS_CODE_PATH).'work/work.lib.php';
 
 if (!api_is_platform_admin(true) && !api_is_teacher()) {
     api_not_allowed(true);
@@ -53,7 +53,7 @@ if ($session) {
 
     foreach ($sessionCourses as $sessionCourse) {
         $course = $sessionCourse->getCourse();
-        $coursesInfo[$course->getId()] =  $course->getCode();
+        $coursesInfo[$course->getId()] = $course->getCode();
         $criteria = Criteria::create()->where(
             Criteria::expr()->eq('status', Session::COACH)
         );
@@ -167,9 +167,9 @@ if (isset($_GET['export']) && $session && ($coursesInfo && $usersInfo)) {
 }
 
 $this_section = SECTION_PLATFORM_ADMIN;
-$interbreadcrumb[] = ['url' => api_get_path(WEB_CODE_PATH) . 'mySpace/', 'name' => get_lang('Reporting')];
+$interbreadcrumb[] = ['url' => api_get_path(WEB_CODE_PATH).'mySpace/', 'name' => get_lang('Reporting')];
 $interbreadcrumb[] = [
-    'url' => api_get_path(WEB_CODE_PATH) . 'mySpace/session.php',
+    'url' => api_get_path(WEB_CODE_PATH).'mySpace/session.php',
     'name' => get_lang('FollowedSessions')
 ];
 
@@ -183,11 +183,11 @@ if ($session) {
 
     $actions = Display::url(
         Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), [], ICON_SIZE_MEDIUM),
-        api_get_self() . '?' . http_build_query(['export' => 'csv', 'session' => $session->getId()])
+        api_get_self().'?'.http_build_query(['export' => 'csv', 'session' => $session->getId()])
     );
     $actions .= Display::url(
         Display::return_icon('export_excel.png', get_lang('ExportAsXLS'), [], ICON_SIZE_MEDIUM),
-        api_get_self() . '?' . http_build_query(['export' => 'xls', 'session' => $session->getId()])
+        api_get_self().'?'.http_build_query(['export' => 'xls', 'session' => $session->getId()])
     );
 
     $view->assign(

+ 1 - 1
main/admin/update_schema.php

@@ -60,5 +60,5 @@ if (!empty($sqlList)) {
 }
 
 Display::display_header(get_lang('SyncDatabaseWithSchema'));
-echo $content ;
+echo $content;
 Display::display_footer();

+ 1 - 1
main/auth/set_temp_password.php

@@ -12,7 +12,7 @@ use ChamiloSession as Session;
 $cidReset = true;
 require_once __DIR__.'/../inc/global.inc.php';
 $this_section = SECTION_COURSES;
-$course_id = isset($_GET['course_id'])  ? intval($_GET['course_id']) : null;
+$course_id = isset($_GET['course_id']) ? intval($_GET['course_id']) : null;
 $session_id = isset($_GET['session_id']) ? intval($_GET['session_id']) : null;
 $user_id = api_get_user_id();
 

+ 2 - 2
main/cron/document/index_all_docs.php

@@ -33,7 +33,7 @@ $allowed_extensions = array(
     'html',
     'htm',
 );
-$courses_list =  CourseManager::get_courses_list();
+$courses_list = CourseManager::get_courses_list();
 
 // Simulating empty specific fields (this is necessary for indexing)
 require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php';
@@ -49,7 +49,7 @@ foreach ($courses_list as $course) {
     $title = Database::escape_string($_GET['doc']);
     $sql = "SELECT id, path, session_id FROM $td WHERE c_id = ".$course['id']." AND path LIKE '%$title%' or title LIKE '%$title%'";
     $res = Database::query($sql);
-    if (Database::num_rows($res)>0) {
+    if (Database::num_rows($res) > 0) {
     while ($row = Database::fetch_array($res)) {
         $doc_path = api_get_path(SYS_COURSE_PATH).$course_dir.$row['path'];
         $extensions = preg_split("/[\/\\.]/", $doc_path);

+ 3 - 3
main/document/exit_pixlr.php

@@ -23,13 +23,13 @@ unset($_SESSION['paint_file']);
 unset($_SESSION['whereami']);
 unset($_SESSION['temp_realpath_image']);
 
-if (!isset($_SESSION['exit_pixlr'])){
-    $location=api_get_path(WEB_CODE_PATH).'document/document.php';
+if (!isset($_SESSION['exit_pixlr'])) {
+    $location = api_get_path(WEB_CODE_PATH).'document/document.php';
     echo '<script>window.parent.location.href="'.$location.'"</script>';
     api_not_allowed(true);
 } else {
     echo '<div align="center" style="padding-top:150; font-family:Arial, Helvetica, Sans-serif;font-size:25px;color:#aaa;font-weight:bold;">'.get_lang('PleaseStandBy').'</div>';
-    $location=api_get_path(WEB_CODE_PATH).'document/document.php?id='.Security::remove_XSS($_SESSION['exit_pixlr']);
+    $location = api_get_path(WEB_CODE_PATH).'document/document.php?id='.Security::remove_XSS($_SESSION['exit_pixlr']);
     echo '<script>window.parent.location.href="'.$location.'"</script>';
     unset($_SESSION['exit_pixlr']);
 }

+ 21 - 21
main/exercise/question_pool.php

@@ -48,7 +48,7 @@ if (empty($objExercise) && !empty($fromExercise)) {
 }
 
 $nameTools = get_lang('QuestionPool');
-$interbreadcrumb[] = array("url" => "exercise.php","name" => get_lang('Exercises'));
+$interbreadcrumb[] = array("url" => "exercise.php", "name" => get_lang('Exercises'));
 
 if (!empty($objExercise)) {
     $interbreadcrumb[] = array(
@@ -73,7 +73,7 @@ if ($is_allowedToEdit) {
 
         if ($old_question_obj) {
             $old_question_obj->updateTitle(
-                $old_question_obj->selectTitle() . ' - ' . get_lang('Copy')
+                $old_question_obj->selectTitle().' - '.get_lang('Copy')
             );
             //Duplicating the source question, in the current course
             $new_id = $old_question_obj->duplicate($current_course);
@@ -107,7 +107,7 @@ if ($is_allowedToEdit) {
         }
         // destruction of the Question object
         unset($objQuestionTmp);
-    } elseif($recup && $fromExercise) {
+    } elseif ($recup && $fromExercise) {
         // gets an existing question and copies it into a new exercise
         $objQuestionTmp = Question :: read($recup);
         // if the question exists
@@ -139,7 +139,7 @@ if ($is_allowedToEdit) {
                 $old_question_obj = Question::read($old_question_id, $origin_course_id);
                 if ($old_question_obj) {
                     $old_question_obj->updateTitle(
-                        $old_question_obj->selectTitle() . ' - ' . get_lang('Copy')
+                        $old_question_obj->selectTitle().' - '.get_lang('Copy')
                     );
 
                     //Duplicating the source question, in the current course
@@ -167,16 +167,16 @@ if ($is_allowedToEdit) {
                 }
             }
         }
-        Session::write('objExercise',$objExercise);
+        Session::write('objExercise', $objExercise);
     }
 }
 
-if (isset($_SESSION['gradebook'])){
-	$gradebook=	$_SESSION['gradebook'];
+if (isset($_SESSION['gradebook'])) {
+	$gradebook = $_SESSION['gradebook'];
 }
 
-if (!empty($gradebook) && $gradebook=='view') {
-	$interbreadcrumb[]= array ('url' => '../gradebook/'.Security::remove_XSS($_SESSION['gradebook_dest']),'name' => get_lang('ToolGradebook'));
+if (!empty($gradebook) && $gradebook == 'view') {
+	$interbreadcrumb[] = array('url' => '../gradebook/'.Security::remove_XSS($_SESSION['gradebook_dest']), 'name' => get_lang('ToolGradebook'));
 }
 
 // if admin of course
@@ -216,11 +216,11 @@ if (isset($type)) {
 }
 if (isset($fromExercise) && $fromExercise > 0) {
     echo '<a href="admin.php?'.api_get_cidreq().'&exerciseId='.$fromExercise.'">'.
-            Display::return_icon('back.png', get_lang('GoBackToQuestionList'),'',ICON_SIZE_MEDIUM).'</a>';
+            Display::return_icon('back.png', get_lang('GoBackToQuestionList'), '', ICON_SIZE_MEDIUM).'</a>';
     $titleAdd = get_lang('AddQuestionToTest');
 } else {
     echo '<a href="exercise.php?'.api_get_cidreq().'">'.
-        Display::return_icon('back.png', get_lang('BackToExercisesList'),'',ICON_SIZE_MEDIUM).'</a>';
+        Display::return_icon('back.png', get_lang('BackToExercisesList'), '', ICON_SIZE_MEDIUM).'</a>';
     echo "<a href='admin.php?exerciseId=0'>".Display::return_icon('add_question.gif', get_lang('NewQu'), '', ICON_SIZE_MEDIUM)."</a>";
     $titleAdd = get_lang('ManageAllQuestions');
 }
@@ -249,7 +249,7 @@ $session_select_list = array();
 foreach ($sessionList as $item) {
     $session_select_list[$item['session_id']] = $item['session_name'];
 }
-$select_session_html =  Display::select('session_id', $session_select_list, $session_id, $tabAttrParam);
+$select_session_html = Display::select('session_id', $session_select_list, $session_id, $tabAttrParam);
 echo Display::form_row($labelFormRow, $select_session_html);
 
 // Course list, get course list of session, or for course where user is admin
@@ -290,7 +290,7 @@ foreach ($course_list as $item) {
 	$course_select_list[$courseItemId] .= $courseInfo['title'];
 }
 
-$select_course_html =  Display::select(
+$select_course_html = Display::select(
     'selected_course',
     $course_select_list,
     $selected_course,
@@ -346,9 +346,9 @@ $my_exercise_list = array();
 $my_exercise_list['0']  = get_lang('AllExercises');
 $my_exercise_list['-1'] = get_lang('OrphanQuestions');
 if (is_array($exercise_list)) {
-    foreach($exercise_list as $row) {
+    foreach ($exercise_list as $row) {
         $my_exercise_list[$row['id']] = "";
-        if ($row['id'] ==  $fromExercise && $selected_course == api_get_course_int_id()) {
+        if ($row['id'] == $fromExercise && $selected_course == api_get_course_int_id()) {
             $my_exercise_list[$row['id']] = ">&nbsp;&nbsp;&nbsp;&nbsp;";
         }
         $my_exercise_list[$row['id']] .= $row['title'];
@@ -358,7 +358,7 @@ if (is_array($exercise_list)) {
 if ($exercise_id_changed == 1) {
 	reset_menu_lvl_type();
 }
-$select_exercise_html =  Display::select(
+$select_exercise_html = Display::select(
     'exerciseId',
     $my_exercise_list,
     $exerciseId,
@@ -391,7 +391,7 @@ echo Display::form_row(get_lang('Difficulty'), $select_difficulty_html);
 $question_list = Question::get_question_type_list();
 
 $new_question_list = array();
-$new_question_list['-1']  = get_lang('All');
+$new_question_list['-1'] = get_lang('All');
 if (!empty($_course)) {
     $objExercise = new Exercise();
     $objExercise->read($fromExercise);
@@ -464,7 +464,7 @@ if ($exerciseId > 0) {
             ORDER BY question_order";
 
     $result = Database::query($sql);
-    while($row = Database::fetch_array($result, 'ASSOC')) {
+    while ($row = Database::fetch_array($result, 'ASSOC')) {
         $mainQuestionList[] = $row;
     }
 } elseif ($exerciseId == -1) {
@@ -477,11 +477,11 @@ if ($exerciseId > 0) {
 		        crc.c_id = $selected_course AND
 		        crc.category_id = $courseCategoryId";
 	}
-	if (isset($exerciseLevel) && $exerciseLevel!= -1 ) {
+	if (isset($exerciseLevel) && $exerciseLevel != -1) {
 		$level_where = ' AND level='.$exerciseLevel;
 	}
 	$answer_where = '';
-	if (isset($answerType) && $answerType >0 -1 ) {
+	if (isset($answerType) && $answerType > 0 - 1) {
 		$answer_where = ' AND type='.$answerType;
 	}
 
@@ -521,7 +521,7 @@ if ($exerciseId > 0) {
                     $level_where $answer_where
              )";
     $result = Database::query($sql);
-    while($row = Database::fetch_array($result, 'ASSOC')) {
+    while ($row = Database::fetch_array($result, 'ASSOC')) {
         $mainQuestionList[] = $row;
     }
 } else {

+ 14 - 14
main/gradebook/lib/fe/resulttable.class.php

@@ -18,7 +18,7 @@ class ResultTable extends SortableTable
     /**
      * Constructor
      */
-    public function __construct($evaluation, $results = array(), $iscourse, $addparams = null,$forprint = false)
+    public function __construct($evaluation, $results = array(), $iscourse, $addparams = null, $forprint = false)
     {
         parent:: __construct(
             'resultlist',
@@ -37,10 +37,10 @@ class ResultTable extends SortableTable
             $this->set_additional_parameters($addparams);
         }
         $scoredisplay = ScoreDisplay::instance();
-        $column= 0;
+        $column = 0;
         if ($this->iscourse == '1') {
             $this->set_header($column++, '', false);
-            $this->set_form_actions(array (
+            $this->set_form_actions(array(
                     'delete' => get_lang('Delete')
             ));
         }
@@ -63,7 +63,7 @@ class ResultTable extends SortableTable
     /**
      * Function used by SortableTable to get total number of items in the table
      */
-    public function get_total_number_of_items ()
+    public function get_total_number_of_items()
     {
         return $this->datagen->get_total_results_count();
     }
@@ -116,7 +116,7 @@ class ResultTable extends SortableTable
         // generate the data to display
         $sortable_data = array();
         foreach ($data_array as $item) {
-            $row = array ();
+            $row = array();
             if ($this->iscourse == '1') {
                  $row[] = $item['result_id'];
             }
@@ -128,13 +128,13 @@ class ResultTable extends SortableTable
                 $row[] = $item['firstname'];
             }
 
-            $row[] =  Display::bar_progress($item['percentage_score'], false, $item['score']);
+            $row[] = Display::bar_progress($item['percentage_score'], false, $item['score']);
             //$row[] =  Display::bar_progress($item['percentage_score'], true);
             if ($scoredisplay->is_custom()) {
                 $row[] = $item['display'];
             }
             if (!$this->forprint) {
-                $row[] = $this->build_edit_column ($item);
+                $row[] = $this->build_edit_column($item);
             }
             $sortable_data[] = $row;
         }
@@ -147,17 +147,17 @@ class ResultTable extends SortableTable
         $locked_status = $this->evaluation->get_locked();
         if (api_is_allowed_to_edit(null, true) && $locked_status == 0) {
             //api_is_course_admin()
-            $edit_column = '<a href="' . api_get_self() . '?editres=' . $item['result_id'] . '&selecteval=' . $this->evaluation->get_id().'&'.api_get_cidreq().'">'.
-                Display::return_icon('edit.png', get_lang('Modify'),'','22').'</a>';
-            $edit_column .= ' <a href="' . api_get_self() . '?delete_mark=' . $item['result_id'] . '&selecteval=' . $this->evaluation->get_id().'&'.api_get_cidreq().'">'.
-                Display::return_icon('delete.png', get_lang('Delete'),'','22').'</a>';
+            $edit_column = '<a href="'.api_get_self().'?editres='.$item['result_id'].'&selecteval='.$this->evaluation->get_id().'&'.api_get_cidreq().'">'.
+                Display::return_icon('edit.png', get_lang('Modify'), '', '22').'</a>';
+            $edit_column .= ' <a href="'.api_get_self().'?delete_mark='.$item['result_id'].'&selecteval='.$this->evaluation->get_id().'&'.api_get_cidreq().'">'.
+                Display::return_icon('delete.png', get_lang('Delete'), '', '22').'</a>';
         }
 
         if ($this->evaluation->get_course_code() == null) {
-            $edit_column .= '&nbsp;<a href="' . api_get_self() . '?resultdelete=' . $item['result_id'] . '&selecteval=' . $this->evaluation->get_id() . '" onclick="return confirmationuser();">';
+            $edit_column .= '&nbsp;<a href="'.api_get_self().'?resultdelete='.$item['result_id'].'&selecteval='.$this->evaluation->get_id().'" onclick="return confirmationuser();">';
             $edit_column .= Display::return_icon('delete.png', get_lang('Delete'));
             $edit_column .= '</a>';
-            $edit_column .= '&nbsp;<a href="user_stats.php?userid=' . $item['id'] . '&selecteval=' . $this->evaluation->get_id() . '&'.api_get_cidreq().'">';
+            $edit_column .= '&nbsp;<a href="user_stats.php?userid='.$item['id'].'&selecteval='.$this->evaluation->get_id().'&'.api_get_cidreq().'">';
             $edit_column .= Display::return_icon('statistics.gif', get_lang('Statistics'));
             $edit_column .= '</a>';
         }
@@ -168,7 +168,7 @@ class ResultTable extends SortableTable
             $doc_url = $link->get_view_url($item['id']);
 
             if ($doc_url != null) {
-                $edit_column .= '&nbsp;<a href="'. $doc_url . '" target="_blank">';
+                $edit_column .= '&nbsp;<a href="'.$doc_url.'" target="_blank">';
                 $edit_column .= Display::return_icon('link.gif', get_lang('OpenDocument')).'</a>';
             }
         }

+ 25 - 25
main/gradebook/lib/fe/scoredisplayform.class.php

@@ -14,28 +14,28 @@ class ScoreDisplayForm extends FormValidator
 	 * @param $form_name
 	 * @param null $action
 	 */
-	public function __construct($form_name, $action= null)
+	public function __construct($form_name, $action = null)
 	{
 		parent::__construct($form_name, 'post', $action);
 		$displayscore = ScoreDisplay::instance();
 		$customdisplays = $displayscore->get_custom_score_display_settings();
 
-		$nr_items = (count($customdisplays)!='0') ? count($customdisplays) : '1';
-		$this->setDefaults(array (
+		$nr_items = (count($customdisplays) != '0') ? count($customdisplays) : '1';
+		$this->setDefaults(array(
             'scorecolpercent' => $displayscore->get_color_split_value()
 		));
 
 		$this->addElement('hidden', 'maxvalue', '100');
 		$this->addElement('hidden', 'minvalue', '0');
-		$counter= 1;
+		$counter = 1;
 
         //setting the default values
 
         if (is_array($customdisplays)) {
             foreach ($customdisplays as $customdisplay) {
-                $this->setDefaults(array (
-                    'endscore[' . $counter . ']' => $customdisplay['score'],
-                    'displaytext[' . $counter . ']' => $customdisplay['display']
+                $this->setDefaults(array(
+                    'endscore['.$counter.']' => $customdisplay['score'],
+                    'displaytext['.$counter.']' => $customdisplay['display']
                 ));
                 $counter++;
             }
@@ -46,7 +46,7 @@ class ScoreDisplayForm extends FormValidator
         $this->addElement('header', get_lang('ScoreEdit'));
 
         if ($displayscore->is_coloring_enabled()) {
-            $this->addElement('html', '<b>'.get_lang('ScoreColor') . '</b>');
+            $this->addElement('html', '<b>'.get_lang('ScoreColor').'</b>');
             $this->addElement(
                 'text',
                 'scorecolpercent',
@@ -63,14 +63,14 @@ class ScoreDisplayForm extends FormValidator
             }
 
             $this->addRule('scorecolpercent', get_lang('OnlyNumbers'), 'numeric');
-            $this->addRule(array('scorecolpercent','maxvalue'), get_lang('Over100'), 'compare', '<=');
-            $this->addRule(array('scorecolpercent','minvalue'), get_lang('UnderMin'), 'compare', '>');
+            $this->addRule(array('scorecolpercent', 'maxvalue'), get_lang('Over100'), 'compare', '<=');
+            $this->addRule(array('scorecolpercent', 'minvalue'), get_lang('UnderMin'), 'compare', '>');
         }
 
 		//Settings for the scoring system
 
         if ($displayscore->is_custom()) {
-            $this->addElement('html', '<br /><b>' . get_lang('ScoringSystem') . '</b>');
+            $this->addElement('html', '<br /><b>'.get_lang('ScoringSystem').'</b>');
             $this->addElement('static', null, null, get_lang('ScoreInfo'));
             $this->setDefaults(array(
                 'beginscore' => '0'
@@ -82,10 +82,10 @@ class ScoreDisplayForm extends FormValidator
                 'input-size' => 2
             ));
 
-            for ($counter= 1; $counter <= 20; $counter++) {
-                $renderer =& $this->defaultRenderer();
+            for ($counter = 1; $counter <= 20; $counter++) {
+                $renderer = & $this->defaultRenderer();
                 $elementTemplateTwoLabel =
-                '<div id=' . $counter . ' style="display: '.(($counter<=$nr_items)?'inline':'none').';">
+                '<div id='.$counter.' style="display: '.(($counter <= $nr_items) ? 'inline' : 'none').';">
     
                 <!-- BEGIN required --><span class="form_required">*</span> <!-- END required -->
     
@@ -110,23 +110,23 @@ class ScoreDisplayForm extends FormValidator
     
                 ';
 
-                $elementTemplateTwoLabel2 ='
+                $elementTemplateTwoLabel2 = '
                 <div class="col-sm-2">
                     <!-- BEGIN error --><span class="form_error">{error}</span>
                     <!-- END error -->
                     {element}
                 </div>
                 <div class="col-sm-1">
-                    <a href="javascript:plusItem(' . ($counter+1) . ')">
-                    <img style="display: '.(($counter>=$nr_items)?'inline':'none').';" id="plus-' . ($counter+1) . '" src="'.Display::returnIconPath('add.png').'" alt="'.get_lang('Add').'" title="'.get_lang('Add').'"></a>
-                    <a href="javascript:minItem(' . ($counter) . ')">
-                    <img style="display: '.(($counter>=$nr_items && $counter!=1)?'inline':'none').';" id="min-' . $counter . '" src="'.Display::returnIconPath('delete.png').'" alt="'.get_lang('Delete').'" title="'.get_lang('Delete').'"></a>
+                    <a href="javascript:plusItem(' . ($counter + 1).')">
+                    <img style="display: '.(($counter >= $nr_items) ? 'inline' : 'none').';" id="plus-'.($counter + 1).'" src="'.Display::returnIconPath('add.png').'" alt="'.get_lang('Add').'" title="'.get_lang('Add').'"></a>
+                    <a href="javascript:minItem(' . ($counter).')">
+                    <img style="display: '.(($counter >= $nr_items && $counter != 1) ? 'inline' : 'none').';" id="min-'.$counter.'" src="'.Display::returnIconPath('delete.png').'" alt="'.get_lang('Delete').'" title="'.get_lang('Delete').'"></a>
                 </div>
                 </div>
                 </div>';
 
                 $scorebetw = array();
-                $this->addElement('text', 'endscore[' . $counter . ']', null, array (
+                $this->addElement('text', 'endscore['.$counter.']', null, array(
                     'size' => 5,
                     'maxlength' => 5,
                     'id' => 'txta-'.$counter,
@@ -143,11 +143,11 @@ class ScoreDisplayForm extends FormValidator
                         'id' => 'txtb-'.$counter,
                     )
                 );
-                $renderer->setElementTemplate($elementTemplateTwoLabel, 'endscore[' . $counter . ']');
-                $renderer->setElementTemplate($elementTemplateTwoLabel2, 'displaytext[' . $counter . ']');
-                $this->addRule('endscore[' . $counter . ']', get_lang('OnlyNumbers'), 'numeric');
-                $this->addRule(array ('endscore[' . $counter . ']', 'maxvalue'), get_lang('Over100'), 'compare', '<=');
-                $this->addRule(array ('endscore[' . $counter . ']', 'minvalue'), get_lang('UnderMin'), 'compare', '>');
+                $renderer->setElementTemplate($elementTemplateTwoLabel, 'endscore['.$counter.']');
+                $renderer->setElementTemplate($elementTemplateTwoLabel2, 'displaytext['.$counter.']');
+                $this->addRule('endscore['.$counter.']', get_lang('OnlyNumbers'), 'numeric');
+                $this->addRule(array('endscore['.$counter.']', 'maxvalue'), get_lang('Over100'), 'compare', '<=');
+                $this->addRule(array('endscore['.$counter.']', 'minvalue'), get_lang('UnderMin'), 'compare', '>');
             }
         }
 

+ 8 - 8
main/gradebook/lib/fe/userform.class.php

@@ -9,7 +9,7 @@
  */
 class UserForm extends FormValidator
 {
-    const TYPE_USER_INFO= 1;
+    const TYPE_USER_INFO = 1;
     const TYPE_SIMPLE_SEARCH = 3;
 
     /**
@@ -20,15 +20,15 @@ class UserForm extends FormValidator
      * @param method
      * @param action
      */
-    public function __construct($form_type, $user, $form_name, $method= 'post', $action= null)
+    public function __construct($form_type, $user, $form_name, $method = 'post', $action = null)
     {
         parent::__construct($form_name, $method, $action);
-        $this->form_type= $form_type;
+        $this->form_type = $form_type;
         if (isset ($user)) {
-            $this->user_info= $user;
+            $this->user_info = $user;
         }
         if (isset ($result_object)) {
-            $this->result_object= $result_object;
+            $this->result_object = $result_object;
         }
         if ($this->form_type == self::TYPE_USER_INFO) {
             $this->build_user_info_form();
@@ -46,7 +46,7 @@ class UserForm extends FormValidator
                 'keyword' => Security::remove_XSS($_GET['search'])
             ));
         }
-        $renderer =& $this->defaultRenderer();
+        $renderer = & $this->defaultRenderer();
         $renderer->setCustomElementTemplate('<span>{element}</span> ');
         $this->addElement('text', 'keyword', '');
         $this->addButtonSearch(get_lang('Search'), 'submit');
@@ -62,7 +62,7 @@ class UserForm extends FormValidator
             $this->addElement('static', 'fname', get_lang('FirstName'), $this->user_info['firstname']);
         }
         $this->addElement('static', 'uname', get_lang('UserName'), $this->user_info['username']);
-        $this->addElement('static', 'email', get_lang('Email'), '<a href="mailto:' . $this->user_info['email'] . '">' . $this->user_info['email'] . '</a>');
+        $this->addElement('static', 'email', get_lang('Email'), '<a href="mailto:'.$this->user_info['email'].'">'.$this->user_info['email'].'</a>');
         $this->addElement('static', 'ofcode', get_lang('OfficialCode'), $this->user_info['official_code']);
         $this->addElement('static', 'phone', get_lang('Phone'), $this->user_info['phone']);
         $this->addButtonSave(get_lang('Back'), 'submit');
@@ -73,7 +73,7 @@ class UserForm extends FormValidator
         parent::display();
     }
 
-    function setDefaults($defaults= array(), $filter = null)
+    function setDefaults($defaults = array(), $filter = null)
     {
         parent::setDefaults($defaults, $filter);
     }

+ 11 - 11
main/gradebook/lib/results_data_generator.class.php

@@ -38,7 +38,7 @@ class ResultsDataGenerator
     /**
      * Get total number of results (rows)
      */
-    public function get_total_results_count ()
+    public function get_total_results_count()
     {
         return count($this->results);
     }
@@ -54,12 +54,12 @@ class ResultsDataGenerator
      * 4 ['score']     : student's score
      * 5 ['display']   : custom score display (only if custom scoring enabled)
      */
-    public function get_data ($sorting = 0, $start = 0, $count = null, $ignore_score_color = false, $pdf=false)
+    public function get_data($sorting = 0, $start = 0, $count = null, $ignore_score_color = false, $pdf = false)
     {
         // do some checks on count, redefine if invalid value
         $number_decimals = api_get_setting('gradebook_number_decimals');
         if (!isset($count)) {
-            $count = count ($this->results) - $start;
+            $count = count($this->results) - $start;
         }
         if ($count < 0) {
             $count = 0;
@@ -67,11 +67,11 @@ class ResultsDataGenerator
         $scoredisplay = ScoreDisplay::instance();
         // generate actual data array
         $table = array();
-        foreach($this->results as $result) {
+        foreach ($this->results as $result) {
             $user = array();
             $info = api_get_user_info($result->get_user_id());
             $user['id'] = $result->get_user_id();
-            if ($pdf){
+            if ($pdf) {
                 $user['username'] = $info['username'];
             }
             $user['result_id'] = $result->get_id();
@@ -93,7 +93,7 @@ class ResultsDataGenerator
                 true
             )
             );
-            if ($pdf && $number_decimals == null){
+            if ($pdf && $number_decimals == null) {
                 $user['scoreletter'] = $result->get_score();
             }
             if ($scoredisplay->is_custom()) {
@@ -134,13 +134,13 @@ class ResultsDataGenerator
      * @param boolean $realscore
      * @result string The score as we want to show it
      */
-    private function get_score_display ($score, $realscore, $ignore_score_color = false)
+    private function get_score_display($score, $realscore, $ignore_score_color = false)
     {
         if ($score != null) {
             $scoredisplay = ScoreDisplay::instance();
             $type = SCORE_CUSTOM;
             if ($realscore === true) {
-                $type = SCORE_DIV_PERCENT ;
+                $type = SCORE_DIV_PERCENT;
             }
 
             return $scoredisplay->display_score(
@@ -174,10 +174,10 @@ class ResultsDataGenerator
         }
     }
 
-    function sort_by_mask ($item1, $item2)
+    function sort_by_mask($item1, $item2)
     {
-        $score1 = (isset($item1['score']) ? array($item1['score'],$this->evaluation->get_max()) : null);
-        $score2 = (isset($item2['score']) ? array($item2['score'],$this->evaluation->get_max()) : null);
+        $score1 = (isset($item1['score']) ? array($item1['score'], $this->evaluation->get_max()) : null);
+        $score2 = (isset($item2['score']) ? array($item2['score'], $this->evaluation->get_max()) : null);
         return ScoreDisplay::compare_scores_by_custom_display($score1, $score2);
     }
 }

+ 18 - 18
main/gradebook/lib/scoredisplay.class.php

@@ -34,7 +34,7 @@ class ScoreDisplay
     /**
      * Compare the custom display of 2 scores, can be useful in sorting
      */
-    public static function compare_scores_by_custom_display ($score1, $score2)
+    public static function compare_scores_by_custom_display($score1, $score2)
     {
         if (!isset($score1)) {
             return (isset($score2) ? 1 : 0);
@@ -47,7 +47,7 @@ class ScoreDisplay
             if ($custom1 == $custom2) {
                 return 0;
             } else {
-                return (($score1[0]/$score1[1]) < ($score2[0]/$score2[1]) ? -1 : 1);
+                return (($score1[0] / $score1[1]) < ($score2[0] / $score2[1]) ? -1 : 1);
             }
         }
     }
@@ -78,7 +78,7 @@ class ScoreDisplay
         //Setting custom enabled
         $value = api_get_setting('gradebook_score_display_custom');
         $value = $value['my_display_custom'];
-        $this->custom_enabled  = $value == 'true' ? true : false;
+        $this->custom_enabled = $value == 'true' ? true : false;
 
         if ($this->custom_enabled) {
             $params = array('category = ?' =>  array('Gradebook'));
@@ -95,10 +95,10 @@ class ScoreDisplay
                 sort($portal_displays);
             }
             $this->custom_display = $portal_displays;
-            if (count($this->custom_display)>0) {
+            if (count($this->custom_display) > 0) {
                 $value = api_get_setting('gradebook_score_display_upperlimit');
                 $value = $value['my_display_upperlimit'];
-                $this->upperlimit_included  = $value == 'true' ? true : false;
+                $this->upperlimit_included = $value == 'true' ? true : false;
                 $this->custom_display_conv = $this->convert_displays($this->custom_display);
             }
         }
@@ -109,7 +109,7 @@ class ScoreDisplay
             //Load course settings
             if ($this->custom_enabled) {
                 $this->custom_display = $this->get_custom_displays();
-                if (count($this->custom_display)> 0) {
+                if (count($this->custom_display) > 0) {
                     $this->custom_display_conv = $this->convert_displays($this->custom_display);
                 }
             }
@@ -180,7 +180,7 @@ class ScoreDisplay
         }
 
         $sql = 'SELECT id FROM '.$tbl_gradebook_category.'
-                WHERE course_code = "'.$curr_course_code.'" '. $session_condition;
+                WHERE course_code = "'.$curr_course_code.'" '.$session_condition;
         $rs  = Database::query($sql);
         $category_id = 0;
         if (Database::num_rows($rs) > 0) {
@@ -249,7 +249,7 @@ class ScoreDisplay
         );
 
         $tbl_display = Database::get_main_table(TABLE_MAIN_GRADEBOOK_SCORE_DISPLAY);
-        foreach($display as $value => $text) {
+        foreach ($display as $value => $text) {
             $params = array(
                 'score' => $value,
                 'display' => $text,
@@ -305,7 +305,7 @@ class ScoreDisplay
         $my_score = $score == 0 ? 1 : $score;
 
         if ($type == SCORE_BAR) {
-            $percentage = $my_score[0]/$my_score[1]*100;
+            $percentage = $my_score[0] / $my_score[1] * 100;
 
             return Display::bar_progress($percentage);
         }
@@ -346,7 +346,7 @@ class ScoreDisplay
             case SCORE_PERCENT:                        // XX %
                 return $this->display_as_percent($score);
             case SCORE_DIV_PERCENT:                    // X / Y (XX %)
-                return $this->display_as_div($score).' (' . $this->display_as_percent($score) . ')';
+                return $this->display_as_div($score).' ('.$this->display_as_percent($score).')';
             case SCORE_AVERAGE:                        // XX %
                 return $this->display_as_percent($score);
             case SCORE_DECIMAL:                        // 0.50  (X/Y)
@@ -356,7 +356,7 @@ class ScoreDisplay
                 if (!empty($custom)) {
                     $custom = ' - '.$custom;
                 }
-                return $this->display_as_div($score).' (' . $this->display_as_percent($score) . ')'.$custom;
+                return $this->display_as_div($score).' ('.$this->display_as_percent($score).')'.$custom;
             case SCORE_DIV_SIMPLE_WITH_CUSTOM:         // X - Good!
                 $custom = $this->display_custom($score);
 
@@ -408,9 +408,9 @@ class ScoreDisplay
      */
     private function display_as_decimal($score)
     {
-        $score_denom = ($score[1]==0) ? 1 : $score[1];
+        $score_denom = ($score[1] == 0) ? 1 : $score[1];
 
-        return $this->format_score($score[0]/$score_denom);
+        return $this->format_score($score[0] / $score_denom);
     }
 
     /**
@@ -418,9 +418,9 @@ class ScoreDisplay
      */
     private function display_as_percent($score)
     {
-        $score_denom = ($score[1]==0) ? 1 : $score[1];
+        $score_denom = ($score[1] == 0) ? 1 : $score[1];
 
-        return $this->format_score($score[0]/$score_denom*100) . ' %';
+        return $this->format_score($score[0] / $score_denom * 100).' %';
     }
 
     /**
@@ -436,7 +436,7 @@ class ScoreDisplay
         } else {
             $score[0] = isset($score[0]) ? $this->format_score($score[0]) : 0;
             $score[1] = isset($score[1]) ? $this->format_score($score[1]) : 0;
-            return  $score[0] . ' / ' . $score[1];
+            return  $score[0].' / '.$score[1];
         }
     }
 
@@ -446,7 +446,7 @@ class ScoreDisplay
      */
     private function display_custom($score)
     {
-        $my_score_denom= ($score[1]==0) ? 1 : $score[1];
+        $my_score_denom = ($score[1] == 0) ? 1 : $score[1];
         $scaledscore = $score[0] / $my_score_denom;
         if ($this->upperlimit_included) {
             foreach ($this->custom_display_conv as $displayitem) {
@@ -510,7 +510,7 @@ class ScoreDisplay
                 ORDER BY score';
         $result = Database::query($sql);
 
-        return Database::store_result($result,'ASSOC');
+        return Database::store_result($result, 'ASSOC');
     }
 
     /**

+ 3 - 3
main/inc/lib/app_view.php

@@ -27,7 +27,7 @@ class View
             if (is_dir($path)) {
                 $this->tool_path = $path;
             } else {
-                throw new Exception('View::__construct() $path directory does not exist ' . $path);
+                throw new Exception('View::__construct() $path directory does not exist '.$path);
             }
         }
     }
@@ -39,7 +39,7 @@ class View
     public function set_data($data)
     {
         if (!is_array($data)) {
-            throw new Exception('View::set_data() $data must to be an array, you have sent a' . gettype( $data ));
+            throw new Exception('View::set_data() $data must to be an array, you have sent a'.gettype($data));
         }
         $this->data = $data;
     }
@@ -49,7 +49,7 @@ class View
      * @param string layout view
      * @param string $layout
      */
-    public function set_layout( $layout )
+    public function set_layout($layout)
     {
         $this->layout = $layout;
     }

+ 117 - 117
main/inc/lib/message.lib.php

@@ -29,7 +29,7 @@ class MessageManager
         if (!isset($count)) {
             $cacheAvailable = api_get_configuration_value('apc');
             if ($cacheAvailable === true) {
-                $var = api_get_configuration_value('apc_prefix') . 'social_messages_unread_u_' . $userId;
+                $var = api_get_configuration_value('apc_prefix').'social_messages_unread_u_'.$userId;
                 if (apcu_exists($var)) {
                     $count = apcu_fetch($var);
                 } else {
@@ -57,7 +57,7 @@ class MessageManager
         $sql = "SELECT COUNT(id) as count 
                 FROM $table
                 WHERE
-                    user_receiver_id=" . api_get_user_id() . " AND
+                    user_receiver_id=".api_get_user_id()." AND
                     msg_status = " . MESSAGE_STATUS_UNREAD;
         $result = Database::query($sql);
         $row = Database::fetch_assoc($result);
@@ -72,9 +72,9 @@ class MessageManager
     {
         $table_message = Database::get_main_table(TABLE_MESSAGE);
         if ($unread) {
-            $condition_msg_status = ' msg_status = ' . MESSAGE_STATUS_UNREAD . ' ';
+            $condition_msg_status = ' msg_status = '.MESSAGE_STATUS_UNREAD.' ';
         } else {
-            $condition_msg_status = ' msg_status IN(' . MESSAGE_STATUS_NEW . ',' . MESSAGE_STATUS_UNREAD . ') ';
+            $condition_msg_status = ' msg_status IN('.MESSAGE_STATUS_NEW.','.MESSAGE_STATUS_UNREAD.') ';
         }
 
         $keyword = Session::read('message_search_keyword');
@@ -87,7 +87,7 @@ class MessageManager
         $sql = "SELECT COUNT(id) as number_messages
                 FROM $table_message
                 WHERE $condition_msg_status AND
-                    user_receiver_id=" . api_get_user_id() . "
+                    user_receiver_id=".api_get_user_id()."
                     $keywordCondition
                 ";
         $result = Database::query($sql);
@@ -135,7 +135,7 @@ class MessageManager
                     msg_status as col4
                 FROM $table_message
                 WHERE
-                  user_receiver_id=" . api_get_user_id() . " AND
+                  user_receiver_id=".api_get_user_id()." AND
                   msg_status IN (0,1)
                   $keywordCondition
                 ORDER BY col$column $direction
@@ -160,10 +160,10 @@ class MessageManager
                 $link = '&f=social';
             }
             $userInfo = api_get_user_info($result[1]);
-            $message[1] = '<a ' . $class . ' href="view_message.php?id=' . $result[0] . $link . '">' . $result[2] . '</a><br />' . $userInfo['complete_name'];
-            $message[3] = '<a href="new_message.php?re_id=' . $result[0] . $link . '">' .
-                Display::return_icon('message_reply.png', get_lang('ReplyToMessage')) . '</a>' .
-                '&nbsp;&nbsp;<a onclick="javascript:if(!confirm(' . "'" . addslashes(api_htmlentities(get_lang('ConfirmDeleteMessage'))) . "'" . ')) return false;" href="inbox.php?action=deleteone&id=' . $result[0] . $link . '">' . Display::return_icon('delete.png', get_lang('DeleteMessage')) . '</a>';
+            $message[1] = '<a '.$class.' href="view_message.php?id='.$result[0].$link.'">'.$result[2].'</a><br />'.$userInfo['complete_name'];
+            $message[3] = '<a href="new_message.php?re_id='.$result[0].$link.'">'.
+                Display::return_icon('message_reply.png', get_lang('ReplyToMessage')).'</a>'.
+                '&nbsp;&nbsp;<a onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmDeleteMessage')))."'".')) return false;" href="inbox.php?action=deleteone&id='.$result[0].$link.'">'.Display::return_icon('delete.png', get_lang('DeleteMessage')).'</a>';
 
             $message[2] = api_convert_and_format_date($result[3], DATE_TIME_FORMAT_LONG); //date stays the same
             foreach ($message as $key => $value) {
@@ -268,7 +268,7 @@ class MessageManager
             //@todo it's possible to edit a message? yes, only for groups
             if ($edit_message_id) {
                 $query = " UPDATE $table_message SET
-                                update_date = '" . $now . "',
+                                update_date = '".$now."',
                                 content = '".Database::escape_string($content)."'
                            WHERE id = '$edit_message_id' ";
                 Database::query($query);
@@ -437,7 +437,7 @@ class MessageManager
                     $message = sprintf(
                             get_lang('CopyOfMessageSentToXUser'),
                             $userInfo['complete_name']
-                        ) . ' <br />' . $message;
+                        ).' <br />'.$message;
 
                     self::send_message_simple(
                         $drhInfo['user_id'],
@@ -485,7 +485,7 @@ class MessageManager
         $row = Database::fetch_array($result);
 
         // update parent_id for other user receiver
-        $sql = "UPDATE $table_message SET parent_id = " . $row['id'] . "
+        $sql = "UPDATE $table_message SET parent_id = ".$row['id']."
                 WHERE id = $message_id";
         Database::query($sql);
     }
@@ -504,7 +504,7 @@ class MessageManager
         $user_receiver_id = intval($user_receiver_id);
         $id = intval($id);
         $sql = "SELECT * FROM $table_message
-                WHERE id=" . $id . " AND msg_status<>4";
+                WHERE id=".$id." AND msg_status<>4";
         $rs = Database::query($sql);
 
         if (Database::num_rows($rs) > 0) {
@@ -514,7 +514,7 @@ class MessageManager
             $query = "UPDATE $table_message 
                       SET msg_status = 3
                       WHERE 
-                        user_receiver_id=" . $user_receiver_id . " AND 
+                        user_receiver_id=".$user_receiver_id." AND 
                         id = " . $id;
             Database::query($query);
 
@@ -604,13 +604,13 @@ class MessageManager
                 $path_user_info['dir'] = UserManager::getUserPathById($message_user_id, 'system');
             }
 
-            $path_message_attach = $path_user_info['dir'] . 'message_attachments/';
+            $path_message_attach = $path_user_info['dir'].'message_attachments/';
 
             // If this directory does not exist - we create it.
             if (!file_exists($path_message_attach)) {
                 @mkdir($path_message_attach, api_get_permissions_for_new_directories(), true);
             }
-            $new_path = $path_message_attach . $new_file_name;
+            $new_path = $path_message_attach.$new_file_name;
             if (is_uploaded_file($file_attach['tmp_name'])) {
                 @copy($file_attach['tmp_name'], $new_path);
             }
@@ -645,7 +645,7 @@ class MessageManager
         while ($row = Database::fetch_array($rs)) {
             $path = $row['path'];
             $attach_id = $row['id'];
-            $new_path = $path . '_DELETED_' . $attach_id;
+            $new_path = $path.'_DELETED_'.$attach_id;
 
             if (!empty($group_id)) {
                 $userGroup = new UserGroup();
@@ -661,9 +661,9 @@ class MessageManager
                 );
             }
 
-            $path_message_attach = $path_user_info['dir'] . 'message_attachments/';
-            if (is_file($path_message_attach . $path)) {
-                if (rename($path_message_attach . $path, $path_message_attach . $new_path)) {
+            $path_message_attach = $path_user_info['dir'].'message_attachments/';
+            if (is_file($path_message_attach.$path)) {
+                if (rename($path_message_attach.$path, $path_message_attach.$new_path)) {
                     $sql = "UPDATE $table_message_attach set path='$new_path'
                             WHERE id ='$attach_id'";
                     Database::query($sql);
@@ -688,8 +688,8 @@ class MessageManager
         $sql = "UPDATE $table_message SET msg_status = '0'
                 WHERE
                     msg_status<>4 AND
-                    user_receiver_id=" . intval($user_id) . " AND
-                    id='" . intval($message_id) . "'";
+                    user_receiver_id=".intval($user_id)." AND
+                    id='" . intval($message_id)."'";
         Database::query($sql);
     }
 
@@ -709,8 +709,8 @@ class MessageManager
         $sql = "UPDATE $table_message SET
                     msg_status = '$type'
                 WHERE
-                    user_receiver_id=" . intval($user_id) . " AND
-                    id='" . intval($message_id) . "'";
+                    user_receiver_id=".intval($user_id)." AND
+                    id='" . intval($message_id)."'";
         Database::query($sql);
     }
 
@@ -727,7 +727,7 @@ class MessageManager
         }
         $table_message = Database::get_main_table(TABLE_MESSAGE);
         $query = "SELECT * FROM $table_message
-                  WHERE user_receiver_id=" . intval($user_id) . " AND id='" . intval($message_id) . "'";
+                  WHERE user_receiver_id=".intval($user_id)." AND id='".intval($message_id)."'";
         $result = Database::query($query);
 
         return $row = Database::fetch_array($result);
@@ -749,7 +749,7 @@ class MessageManager
         $sql = "SELECT * FROM $table_message
                 WHERE
                     group_id= $group_id AND
-                    msg_status NOT IN ('" . MESSAGE_STATUS_OUTBOX . "', '" . MESSAGE_STATUS_DELETED . "')
+                    msg_status NOT IN ('".MESSAGE_STATUS_OUTBOX."', '".MESSAGE_STATUS_DELETED."')
                 ORDER BY id";
         $rs = Database::query($sql);
         $data = array();
@@ -777,7 +777,7 @@ class MessageManager
         $sql = "SELECT * FROM $table_message
                 WHERE
                     group_id = $group_id AND
-                    msg_status NOT IN ('" . MESSAGE_STATUS_OUTBOX . "', '" . MESSAGE_STATUS_DELETED . "')
+                    msg_status NOT IN ('".MESSAGE_STATUS_OUTBOX."', '".MESSAGE_STATUS_DELETED."')
                 ORDER BY id ";
 
         $rs = Database::query($sql);
@@ -826,7 +826,7 @@ class MessageManager
         $sql = "SELECT * FROM $table_message
                 WHERE
                     parent_id='$parent_id' AND
-                    msg_status <> " . MESSAGE_STATUS_OUTBOX . "
+                    msg_status <> ".MESSAGE_STATUS_OUTBOX."
                     $condition_group_id
                 ORDER BY send_date DESC $condition_limit ";
         $rs = Database::query($sql);
@@ -854,8 +854,8 @@ class MessageManager
         $table_message = Database::get_main_table(TABLE_MESSAGE);
         $query = "SELECT id FROM $table_message
                   WHERE
-                    user_receiver_id = " . intval($user_id) . " AND
-                    id = '" . intval($id) . "'";
+                    user_receiver_id = ".intval($user_id)." AND
+                    id = '" . intval($id)."'";
         $result = Database::query($query);
         $num = Database::num_rows($result);
         if ($num > 0) {
@@ -903,8 +903,8 @@ class MessageManager
                     msg_status as col5
                 FROM $table_message
                 WHERE
-                    user_sender_id=" . api_get_user_id() . " AND
-                    msg_status=" . MESSAGE_STATUS_OUTBOX . "
+                    user_sender_id=".api_get_user_id()." AND
+                    msg_status=" . MESSAGE_STATUS_OUTBOX."
                     $keywordCondition
                 ORDER BY col$column $direction
                 LIMIT $from, $number_of_items";
@@ -913,7 +913,7 @@ class MessageManager
         $message_list = array();
         while ($result = Database::fetch_row($sql_result)) {
             if ($request === true) {
-                $message[0] = '<input type="checkbox" value=' . $result[0] . ' name="out[]">';
+                $message[0] = '<input type="checkbox" value='.$result[0].' name="out[]">';
             } else {
                 $message[0] = ($result[0]);
             }
@@ -921,20 +921,20 @@ class MessageManager
             $result[2] = Security::remove_XSS($result[2]);
             $userInfo = api_get_user_info($result[4]);
             if ($request === true) {
-                $message[1] = '<a onclick="show_sent_message(' . $result[0] . ')" href="javascript:void(0)">' . $userInfo['complete_name'] . '</a>';
-                $message[2] = '<a onclick="show_sent_message(' . $result[0] . ')" href="javascript:void(0)">' . str_replace("\\", "", $result[2]) . '</a>';
+                $message[1] = '<a onclick="show_sent_message('.$result[0].')" href="javascript:void(0)">'.$userInfo['complete_name'].'</a>';
+                $message[2] = '<a onclick="show_sent_message('.$result[0].')" href="javascript:void(0)">'.str_replace("\\", "", $result[2]).'</a>';
                 $message[3] = api_convert_and_format_date($result[3], DATE_TIME_FORMAT_LONG); //date stays the same
-                $message[4] = '&nbsp;&nbsp;<a onclick="delete_one_message_outbox(' . $result[0] . ')" href="javascript:void(0)"  >' .
-                    Display::return_icon('delete.png', get_lang('DeleteMessage')) . '</a>';
+                $message[4] = '&nbsp;&nbsp;<a onclick="delete_one_message_outbox('.$result[0].')" href="javascript:void(0)"  >'.
+                    Display::return_icon('delete.png', get_lang('DeleteMessage')).'</a>';
             } else {
                 $link = '';
                 if (isset($_GET['f']) && $_GET['f'] == 'social') {
                     $link = '&f=social';
                 }
-                $message[1] = '<a ' . $class . ' onclick="show_sent_message (' . $result[0] . ')" href="../messages/view_message.php?id_send=' . $result[0] . $link . '">' . $result[2] . '</a><br />' . $userInfo['complete_name'];
+                $message[1] = '<a '.$class.' onclick="show_sent_message ('.$result[0].')" href="../messages/view_message.php?id_send='.$result[0].$link.'">'.$result[2].'</a><br />'.$userInfo['complete_name'];
                 $message[2] = api_convert_and_format_date($result[3], DATE_TIME_FORMAT_LONG); //date stays the same
-                $message[3] = '<a href="outbox.php?action=deleteone&id=' . $result[0] . '&' . $link . '"  onclick="javascript:if(!confirm(' . "'" . addslashes(api_htmlentities(get_lang('ConfirmDeleteMessage'))) . "'" . ')) return false;" >' .
-                    Display::return_icon('delete.png', get_lang('DeleteMessage')) . '</a>';
+                $message[3] = '<a href="outbox.php?action=deleteone&id='.$result[0].'&'.$link.'"  onclick="javascript:if(!confirm('."'".addslashes(api_htmlentities(get_lang('ConfirmDeleteMessage')))."'".')) return false;" >'.
+                    Display::return_icon('delete.png', get_lang('DeleteMessage')).'</a>';
             }
 
             foreach ($message as $key => $value) {
@@ -967,8 +967,8 @@ class MessageManager
         $sql = "SELECT COUNT(id) as number_messages 
                 FROM $table_message
                 WHERE
-                  msg_status=" . MESSAGE_STATUS_OUTBOX . " AND
-                  user_sender_id=" . api_get_user_id() . "
+                  msg_status=".MESSAGE_STATUS_OUTBOX." AND
+                  user_sender_id=" . api_get_user_id()."
                   $keywordCondition
                 ";
         $result = Database::query($sql);
@@ -993,25 +993,25 @@ class MessageManager
             if (isset($message_id) && is_numeric($message_id)) {
                 $query = "SELECT * FROM $table_message
                           WHERE
-                            user_sender_id = " . api_get_user_id() . " AND
-                            id = " . $message_id . " AND
+                            user_sender_id = ".api_get_user_id()." AND
+                            id = " . $message_id." AND
                             msg_status = 4;";
                 $result = Database::query($query);
             }
         } else {
             if (is_numeric($message_id) && !empty($message_id)) {
                 $query = "UPDATE $table_message SET
-                          msg_status = '" . MESSAGE_STATUS_NEW . "'
+                          msg_status = '".MESSAGE_STATUS_NEW."'
                           WHERE
-                            user_receiver_id=" . api_get_user_id() . " AND
-                            id='" . $message_id . "'";
+                            user_receiver_id=" . api_get_user_id()." AND
+                            id='" . $message_id."'";
                 Database::query($query);
 
                 $query = "SELECT * FROM $table_message
                           WHERE
                             msg_status<>4 AND
-                            user_receiver_id=" . api_get_user_id() . " AND
-                            id='" . $message_id . "'";
+                            user_receiver_id=".api_get_user_id()." AND
+                            id='" . $message_id."'";
                 $result = Database::query($query);
             }
         }
@@ -1044,27 +1044,27 @@ class MessageManager
             if ($source == 'outbox') {
                 $message_content .= '<div class="col-md-12">';
                 $message_content .= '<ul class="list-message">';
-                $message_content .= '<li>' . $user_image . '</li>';
-                $message_content .= '<li><a href="' . api_get_path(WEB_PATH) . 'main/social/profile.php?u=' . $user_sender_id . '">' . $name . '</a> ';
-                $message_content .= api_strtolower(get_lang('To')) . '&nbsp;<b>' . $receiverUserInfo['complete_name'].'</b></li>';
-                $message_content .= '<li>' . Display::dateToStringAgoAndLongDate($row['send_date']) . '</li>';
+                $message_content .= '<li>'.$user_image.'</li>';
+                $message_content .= '<li><a href="'.api_get_path(WEB_PATH).'main/social/profile.php?u='.$user_sender_id.'">'.$name.'</a> ';
+                $message_content .= api_strtolower(get_lang('To')).'&nbsp;<b>'.$receiverUserInfo['complete_name'].'</b></li>';
+                $message_content .= '<li>'.Display::dateToStringAgoAndLongDate($row['send_date']).'</li>';
                 $message_content .= '</ul>';
                 $message_content .= '</div>';
             } else {
                 $message_content .= '<div class="col-md-12">';
                 $message_content .= '<ul class="list-message">';
-                $message_content .= '<li>' . $user_image . '</li>';
-                $message_content .= '<li><a href="' . api_get_path(WEB_PATH) . 'main/social/profile.php?u=' . $user_sender_id . '">' . $name . '</a> </li>';
-                $message_content .= '<li>'. Display::dateToStringAgoAndLongDate($row['send_date']) . '</li>';
+                $message_content .= '<li>'.$user_image.'</li>';
+                $message_content .= '<li><a href="'.api_get_path(WEB_PATH).'main/social/profile.php?u='.$user_sender_id.'">'.$name.'</a> </li>';
+                $message_content .= '<li>'.Display::dateToStringAgoAndLongDate($row['send_date']).'</li>';
                 $message_content .= '</ul>';
                 $message_content .= '</div>';
             }
             $message_content .= '</div>';
         } else {
             if ($source == 'outbox') {
-                $message_content .= get_lang('From') . ':&nbsp;' . $name . '</b> ' . api_strtolower(get_lang('To')) . ' <b>' . $receiverUserInfo['complete_name'] . '</b>';
+                $message_content .= get_lang('From').':&nbsp;'.$name.'</b> '.api_strtolower(get_lang('To')).' <b>'.$receiverUserInfo['complete_name'].'</b>';
             } else {
-                $message_content .= get_lang('From') . ':&nbsp;' . $name . '</b> ' . api_strtolower(get_lang('To')) . ' <b>' . get_lang('Me') . '</b>';
+                $message_content .= get_lang('From').':&nbsp;'.$name.'</b> '.api_strtolower(get_lang('To')).' <b>'.get_lang('Me').'</b>';
             }
         }
 
@@ -1072,26 +1072,26 @@ class MessageManager
 		        <hr style="color:#ddd" />
 		        <table width="100%">
 		            <tr>
-		              <td valign=top class="view-message-content">' . str_replace("\\", "", $content) . '</td>
+		              <td valign=top class="view-message-content">' . str_replace("\\", "", $content).'</td>
 		            </tr>
 		        </table>
-		        <div id="message-attach">' . (!empty($files_attachments) ? implode('<br />', $files_attachments) : '') . '</div>
+		        <div id="message-attach">' . (!empty($files_attachments) ? implode('<br />', $files_attachments) : '').'</div>
 		        <div style="padding: 15px 0px 5px 0px">';
         $social_link = '';
         if (isset($_GET['f']) && $_GET['f'] == 'social') {
             $social_link = 'f=social';
         }
         if ($source == 'outbox') {
-            $message_content .= '<a href="outbox.php?' . $social_link . '">' .
-                Display::return_icon('back.png', get_lang('ReturnToOutbox')) . '</a> &nbsp';
+            $message_content .= '<a href="outbox.php?'.$social_link.'">'.
+                Display::return_icon('back.png', get_lang('ReturnToOutbox')).'</a> &nbsp';
         } else {
-            $message_content .= '<a href="inbox.php?' . $social_link . '">' .
-                Display::return_icon('back.png', get_lang('ReturnToInbox')) . '</a> &nbsp';
-            $message_content .= '<a href="new_message.php?re_id=' . $message_id . '&' . $social_link . '">' .
-                Display::return_icon('message_reply.png', get_lang('ReplyToMessage')) . '</a> &nbsp';
+            $message_content .= '<a href="inbox.php?'.$social_link.'">'.
+                Display::return_icon('back.png', get_lang('ReturnToInbox')).'</a> &nbsp';
+            $message_content .= '<a href="new_message.php?re_id='.$message_id.'&'.$social_link.'">'.
+                Display::return_icon('message_reply.png', get_lang('ReplyToMessage')).'</a> &nbsp';
         }
-        $message_content .= '<a href="inbox.php?action=deleteone&id=' . $message_id . '&' . $social_link . '" >' .
-            Display::return_icon('delete.png', get_lang('DeleteMessage')) . '</a>&nbsp';
+        $message_content .= '<a href="inbox.php?action=deleteone&id='.$message_id.'&'.$social_link.'" >'.
+            Display::return_icon('delete.png', get_lang('DeleteMessage')).'</a>&nbsp';
 
         $message_content .= '</div></td>
 		      <td width=10></td>
@@ -1109,8 +1109,8 @@ class MessageManager
     public static function get_user_id_by_email($user_email)
     {
         $tbl_user = Database::get_main_table(TABLE_MAIN_USER);
-        $sql = 'SELECT user_id FROM ' . $tbl_user . '
-                WHERE email="' . Database::escape_string($user_email) . '";';
+        $sql = 'SELECT user_id FROM '.$tbl_user.'
+                WHERE email="' . Database::escape_string($user_email).'";';
         $rs = Database::query($sql);
         $row = Database::fetch_array($rs, 'ASSOC');
         if (isset($row['user_id'])) {
@@ -1170,7 +1170,7 @@ class MessageManager
 
                 $items = $topic['count'];
                 $reply_label = ($items == 1) ? get_lang('GroupReply') : get_lang('GroupReplies');
-                $label = '<i class="fa fa-envelope"></i> ' . $items . ' ' . $reply_label;
+                $label = '<i class="fa fa-envelope"></i> '.$items.' '.$reply_label;
                 $topic['title'] = trim($topic['title']);
 
                 if (empty($topic['title'])) {
@@ -1182,31 +1182,31 @@ class MessageManager
                     'h4',
                     Display::url(
                         Security::remove_XSS($topic['title'], STUDENT, true),
-                        api_get_path(WEB_CODE_PATH) . 'social/group_topics.php?id=' . $group_id . '&topic_id=' . $topic['id']
+                        api_get_path(WEB_CODE_PATH).'social/group_topics.php?id='.$group_id.'&topic_id='.$topic['id']
                     ), array('class' => 'title')
                 );
                 $actions = '';
                 if ($my_group_role == GROUP_USER_PERMISSION_ADMIN ||
                     $my_group_role == GROUP_USER_PERMISSION_MODERATOR
                 ) {
-                    $actions = '<br />' . Display::url(get_lang('Delete'), api_get_path(WEB_CODE_PATH) . 'social/group_topics.php?action=delete&id=' . $group_id . '&topic_id=' . $topic['id'], array('class' => 'btn btn-default'));
+                    $actions = '<br />'.Display::url(get_lang('Delete'), api_get_path(WEB_CODE_PATH).'social/group_topics.php?action=delete&id='.$group_id.'&topic_id='.$topic['id'], array('class' => 'btn btn-default'));
                 }
 
                 $date = '';
                 if ($topic['send_date'] != $topic['update_date']) {
                     if (!empty($topic['update_date'])) {
-                        $date .= '<i class="fa fa-calendar"></i> ' . get_lang('LastUpdate') . ' ' . date_to_str_ago($topic['update_date']);
+                        $date .= '<i class="fa fa-calendar"></i> '.get_lang('LastUpdate').' '.date_to_str_ago($topic['update_date']);
                     }
                 } else {
-                    $date .= '<i class="fa fa-calendar"></i> ' . get_lang('Created') . ' ' . date_to_str_ago($topic['send_date']);
+                    $date .= '<i class="fa fa-calendar"></i> '.get_lang('Created').' '.date_to_str_ago($topic['send_date']);
                 }
-                $html .= '<div class="date">' . $label . ' - ' . $date . $actions . '</div>';
+                $html .= '<div class="date">'.$label.' - '.$date.$actions.'</div>';
                 $html .= '</div>';
 
                 $image = $user_sender_info['avatar'];
 
-                $user_info = '<div class="author"><img class="img-responsive img-circle" src="' . $image . '" alt="' . $name . '"  width="64" height="64" title="' . $name . '" /></div>';
-                $user_info .= '<div class="name"><a href="' . api_get_path(WEB_PATH) . 'main/social/profile.php?u=' . $topic['user_sender_id'] . '">' . $name . '&nbsp;</a></div>';
+                $user_info = '<div class="author"><img class="img-responsive img-circle" src="'.$image.'" alt="'.$name.'"  width="64" height="64" title="'.$name.'" /></div>';
+                $user_info .= '<div class="name"><a href="'.api_get_path(WEB_PATH).'main/social/profile.php?u='.$topic['user_sender_id'].'">'.$name.'&nbsp;</a></div>';
 
                 $html .= '<div class="col-xs-4 col-md-2">';
                 $html .= $user_info;
@@ -1284,7 +1284,7 @@ class MessageManager
                 'group_id' => $group_id,
                 'message_id' => $main_message['id'],
                 'action' => 'edit_message_group',
-                'anchor_topic' => 'topic_' . $main_message['id'],
+                'anchor_topic' => 'topic_'.$main_message['id'],
                 'topics_page_nr' => $topic_page_nr,
                 'items_page_nr' => $items_page_nr,
                 'topic_id' => $main_message['id']
@@ -1292,7 +1292,7 @@ class MessageManager
             if (api_is_platform_admin()) {
                 $links .= Display::url(
                     Display::returnFontAwesomeIcon('trash'),
-                    'group_topics.php?action=delete&id=' . $group_id . '&topic_id=' . $topic_id,
+                    'group_topics.php?action=delete&id='.$group_id.'&topic_id='.$topic_id,
                     [
                         'class' => 'btn btn-default'
                     ]
@@ -1317,7 +1317,7 @@ class MessageManager
             'group_id' => $group_id,
             'message_id' => $main_message['id'],
             'action' => 'reply_message_group',
-            'anchor_topic' => 'topic_' . $main_message['id'],
+            'anchor_topic' => 'topic_'.$main_message['id'],
             'topics_page_nr' => $topic_page_nr,
             'topic_id' => $main_message['id']
         ]);
@@ -1335,31 +1335,31 @@ class MessageManager
         $links .= '</div>';
         $links .= '</div>';
 
-        $title = '<h4>' . Security::remove_XSS($main_message['title'], STUDENT, true) . $links . '</h4>';
+        $title = '<h4>'.Security::remove_XSS($main_message['title'], STUDENT, true).$links.'</h4>';
 
         $userPicture = $user_sender_info['avatar'];
         $main_content .= '<div class="row">';
         $main_content .= '<div class="col-md-2">';
         $main_content .= '<div class="avatar-author">';
-        $main_content .= '<img width="60px" src="' . $userPicture . '" alt="' . $name . '" class="img-responsive img-circle" title="' . $name . '" />';
+        $main_content .= '<img width="60px" src="'.$userPicture.'" alt="'.$name.'" class="img-responsive img-circle" title="'.$name.'" />';
         $main_content .= '</div>';
         $main_content .= '</div>';
 
         $date = '';
         if ($main_message['send_date'] != $main_message['update_date']) {
             if (!empty($main_message['update_date'])) {
-                $date = '<div class="date"> '. Display::returnFontAwesomeIcon('calendar') .' ' . get_lang('LastUpdate') . ' ' . date_to_str_ago($main_message['update_date']) . '</div>';
+                $date = '<div class="date"> '.Display::returnFontAwesomeIcon('calendar').' '.get_lang('LastUpdate').' '.date_to_str_ago($main_message['update_date']).'</div>';
             }
         } else {
-            $date = '<div class="date"> ' . Display::returnFontAwesomeIcon('calendar') .' ' . get_lang('Created') . ' ' . date_to_str_ago($main_message['send_date']) . '</div>';
+            $date = '<div class="date"> '.Display::returnFontAwesomeIcon('calendar').' '.get_lang('Created').' '.date_to_str_ago($main_message['send_date']).'</div>';
         }
-        $attachment = '<div class="message-attach">' . (!empty($files_attachments) ? implode('<br />', $files_attachments) : '') . '</div>';
+        $attachment = '<div class="message-attach">'.(!empty($files_attachments) ? implode('<br />', $files_attachments) : '').'</div>';
         $main_content .= '<div class="col-md-10">';
-        $user_link = '<a href="' . api_get_path(WEB_PATH) . 'main/social/profile.php?u=' . $main_message['user_sender_id'] . '">' . $name . '</a>';
+        $user_link = '<a href="'.api_get_path(WEB_PATH).'main/social/profile.php?u='.$main_message['user_sender_id'].'">'.$name.'</a>';
         $main_content .= '<div class="message-content"> ';
-        $main_content .= '<div class="username">' . $user_link . '</div>';
-        $main_content .= $date ;
-        $main_content .= '<div class="message">'. $main_message['content'] . $attachment . '</div></div>';
+        $main_content .= '<div class="username">'.$user_link.'</div>';
+        $main_content .= $date;
+        $main_content .= '<div class="message">'.$main_message['content'].$attachment.'</div></div>';
         $main_content .= '</div>';
         $main_content .= '</div>';
 
@@ -1380,7 +1380,7 @@ class MessageManager
                 if (empty($topic['id'])) {
                     continue;
                 }
-                $items_page_nr = isset($_GET['items_' . $topic['id'] . '_page_nr']) ? intval($_GET['items_' . $topic['id'] . '_page_nr']) : null;
+                $items_page_nr = isset($_GET['items_'.$topic['id'].'_page_nr']) ? intval($_GET['items_'.$topic['id'].'_page_nr']) : null;
                 $links = '';
                 $links .= '<div class="pull-right">';
                 $html_items = '';
@@ -1390,36 +1390,36 @@ class MessageManager
 
                 $links .= '<div class="btn-group btn-group-sm">';
                 if (($my_group_role == GROUP_USER_PERMISSION_ADMIN || $my_group_role == GROUP_USER_PERMISSION_MODERATOR) || $topic['user_sender_id'] == $current_user_id) {
-                    $links .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'social/message_for_group_form.inc.php?height=400&width=800&&user_friend=' . $current_user_id . '&group_id=' . $group_id . '&message_id=' . $topic['id'] . '&action=edit_message_group&anchor_topic=topic_' . $topic_id . '&topics_page_nr=' . $topic_page_nr . '&items_page_nr=' . $items_page_nr . '&topic_id=' . $topic_id . '" class="ajax btn btn-default" data-size="lg" data-title="' . get_lang('Edit') . '" title="' . get_lang('Edit') . '">' .
-                        Display::returnFontAwesomeIcon('pencil') . '</a>';
+                    $links .= '<a href="'.api_get_path(WEB_CODE_PATH).'social/message_for_group_form.inc.php?height=400&width=800&&user_friend='.$current_user_id.'&group_id='.$group_id.'&message_id='.$topic['id'].'&action=edit_message_group&anchor_topic=topic_'.$topic_id.'&topics_page_nr='.$topic_page_nr.'&items_page_nr='.$items_page_nr.'&topic_id='.$topic_id.'" class="ajax btn btn-default" data-size="lg" data-title="'.get_lang('Edit').'" title="'.get_lang('Edit').'">'.
+                        Display::returnFontAwesomeIcon('pencil').'</a>';
                 }
-                $links .= '<a href="' . api_get_path(WEB_CODE_PATH) . 'social/message_for_group_form.inc.php?height=400&width=800&&user_friend=' . api_get_user_id() . '&group_id=' . $group_id . '&message_id=' . $topic['id'] . '&action=reply_message_group&anchor_topic=topic_' . $topic_id . '&topics_page_nr=' . $topic_page_nr . '&items_page_nr=' . $items_page_nr . '&topic_id=' . $topic_id . '" class="ajax btn btn-default" data-size="lg" data-title="' . get_lang('Reply') . '" title="' . get_lang('Reply') . '">';
-                $links .= Display::returnFontAwesomeIcon('commenting') . '</a>';
+                $links .= '<a href="'.api_get_path(WEB_CODE_PATH).'social/message_for_group_form.inc.php?height=400&width=800&&user_friend='.api_get_user_id().'&group_id='.$group_id.'&message_id='.$topic['id'].'&action=reply_message_group&anchor_topic=topic_'.$topic_id.'&topics_page_nr='.$topic_page_nr.'&items_page_nr='.$items_page_nr.'&topic_id='.$topic_id.'" class="ajax btn btn-default" data-size="lg" data-title="'.get_lang('Reply').'" title="'.get_lang('Reply').'">';
+                $links .= Display::returnFontAwesomeIcon('commenting').'</a>';
                 $links .= '</div>';
                 $links .= '</div>';
 
                 $userPicture = $user_sender_info['avatar'];
-                $user_link = '<a href="' . api_get_path(WEB_PATH) . 'main/social/profile.php?u=' . $topic['user_sender_id'] . '">' . $name . '&nbsp</a>';
+                $user_link = '<a href="'.api_get_path(WEB_PATH).'main/social/profile.php?u='.$topic['user_sender_id'].'">'.$name.'&nbsp</a>';
                 $html_items .= '<div class="row">';
                 $html_items .= '<div class="col-md-2">';
-                $html_items .= '<div class="avatar-author"><img width="60px" src="' . $userPicture . '" alt="' . $name . '" class="img-responsive img-circle" title="' . $name . '" /></div>';
+                $html_items .= '<div class="avatar-author"><img width="60px" src="'.$userPicture.'" alt="'.$name.'" class="img-responsive img-circle" title="'.$name.'" /></div>';
                 $html_items .= '</div>';
 
                 $date = '';
                 if ($topic['send_date'] != $topic['update_date']) {
                     if (!empty($topic['update_date'])) {
-                        $date = '<div class="date"> ' . Display::returnFontAwesomeIcon('calendar') .' '. get_lang('LastUpdate') . ' ' . date_to_str_ago($topic['update_date']) . '</div>';
+                        $date = '<div class="date"> '.Display::returnFontAwesomeIcon('calendar').' '.get_lang('LastUpdate').' '.date_to_str_ago($topic['update_date']).'</div>';
                     }
                 } else {
-                    $date = '<div class="date"> ' . Display::returnFontAwesomeIcon('calendar') . get_lang('Created') . ' ' . date_to_str_ago($topic['send_date']) . '</div>';
+                    $date = '<div class="date"> '.Display::returnFontAwesomeIcon('calendar').get_lang('Created').' '.date_to_str_ago($topic['send_date']).'</div>';
                 }
-                $attachment = '<div class="message-attach">' . (!empty($files_attachments) ? implode('<br />', $files_attachments) : '') . '</div>';
+                $attachment = '<div class="message-attach">'.(!empty($files_attachments) ? implode('<br />', $files_attachments) : '').'</div>';
                 $html_items .= '<div class="col-md-10">';
                 $html_items .= '<div class="message-content">';
                 $html_items .= $links;
-                $html_items .= '<div class="username">' . $user_link . '</div>';
+                $html_items .= '<div class="username">'.$user_link.'</div>';
                 $html_items .= $date;
-                $html_items .=  '<div class="message">' . Security::remove_XSS($topic['content'], STUDENT, true) . '</div>' . $attachment . '</div>';
+                $html_items .= '<div class="message">'.Security::remove_XSS($topic['content'], STUDENT, true).'</div>'.$attachment.'</div>';
                 $html_items .= '</div>';
                 $html_items .= '</div>';
 
@@ -1431,8 +1431,8 @@ class MessageManager
                     $indent = intval($topic['indent_cnt']) * $base_padding + $base_padding;
                 }
 
-                $html_items = Display::div($html_items, array('class' => 'message-post', 'id' => 'msg_' . $topic['id']));
-                $html_items = Display::div($html_items, array('class' => '', 'style' => 'margin-left:' . $indent . 'px'));
+                $html_items = Display::div($html_items, array('class' => 'message-post', 'id' => 'msg_'.$topic['id']));
+                $html_items = Display::div($html_items, array('class' => '', 'style' => 'margin-left:'.$indent.'px'));
                 $array_html_items[] = array($html_items);
             }
 
@@ -1446,7 +1446,7 @@ class MessageManager
             );
             if (!empty($array_html_items)) {
                 $html .= Display::return_sortable_grid(
-                    'items_' . $topic['id'],
+                    'items_'.$topic['id'],
                     array(),
                     $array_html_items,
                     $options,
@@ -1537,14 +1537,14 @@ class MessageManager
             $rs_file = Database::query($sql);
             if (Database::num_rows($rs_file) > 0) {
                 $attach_icon = Display::return_icon('attachment.gif', '');
-                $archiveURL = api_get_path(WEB_CODE_PATH) . 'messages/download.php?type=' . $type . '&file=';
+                $archiveURL = api_get_path(WEB_CODE_PATH).'messages/download.php?type='.$type.'&file=';
                 while ($row_file = Database::fetch_array($rs_file)) {
                     $archiveFile = $row_file['path'];
                     $filename = $row_file['filename'];
                     $filesize = format_file_size($row_file['size']);
                     $filecomment = Security::remove_XSS($row_file['comment']);
                     $filename = Security::remove_XSS($filename);
-                    $links_attach_file[] = $attach_icon . '&nbsp;<a href="' . $archiveURL . $archiveFile . '">' . $filename . '</a>&nbsp;(' . $filesize . ')' . (!empty($filecomment) ? '&nbsp;-&nbsp;<i>' . $filecomment . '</i>' : '');
+                    $links_attach_file[] = $attach_icon.'&nbsp;<a href="'.$archiveURL.$archiveFile.'">'.$filename.'</a>&nbsp;('.$filesize.')'.(!empty($filecomment) ? '&nbsp;-&nbsp;<i>'.$filecomment.'</i>' : '');
                 }
             }
         }
@@ -1563,7 +1563,7 @@ class MessageManager
         $sql = "SELECT * FROM $tbl_message
                 WHERE 
                     id = '$message_id' AND 
-                    msg_status <> '" . MESSAGE_STATUS_DELETED . "' ";
+                    msg_status <> '".MESSAGE_STATUS_DELETED."' ";
         $res = Database::query($sql);
         $item = array();
         if (Database::num_rows($res) > 0) {
@@ -1690,7 +1690,7 @@ class MessageManager
 
         Session::write('message_sent_search_keyword', $keyword);
 
-        $success = get_lang('SelectedMessagesDeleted') . '&nbsp</b><br /><a href="outbox.php?' . $social_link . '">' . get_lang('BackToOutbox') . '</a>';
+        $success = get_lang('SelectedMessagesDeleted').'&nbsp</b><br /><a href="outbox.php?'.$social_link.'">'.get_lang('BackToOutbox').'</a>';
 
         $html = null;
         if (isset($_REQUEST['action'])) {
@@ -1798,7 +1798,7 @@ class MessageManager
                 ON m.user_sender_id = u.user_id
                 WHERE
                     m.user_receiver_id = $userId AND
-                    m.msg_status = " . MESSAGE_STATUS_UNREAD . "
+                    m.msg_status = ".MESSAGE_STATUS_UNREAD."
                     AND m.id > $lastId
                 ORDER BY m.send_date DESC";
 
@@ -1887,11 +1887,11 @@ class MessageManager
         );
         $tplMailBody->assign('user', $user);
         $tplMailBody->assign('is_western_name_order', api_is_western_name_order());
-        $tplMailBody->assign('manageUrl', api_get_path(WEB_CODE_PATH) . 'admin/user_edit.php?user_id=' . $user->getId());
+        $tplMailBody->assign('manageUrl', api_get_path(WEB_CODE_PATH).'admin/user_edit.php?user_id='.$user->getId());
 
         $layoutContent = $tplMailBody->get_template('mail/new_user_mail_to_admin.tpl');
 
-        $emailsubject = '[' . get_lang('UserRegistered') . '] ' . $user->getUsername();
+        $emailsubject = '['.get_lang('UserRegistered').'] '.$user->getUsername();
         $emailbody = $tplMailBody->fetch($layoutContent);
 
         $admins = UserManager::get_all_administrators();
@@ -1922,8 +1922,8 @@ class MessageManager
      */
     public static function failedSentMailErrors()
     {
-        $base = api_get_path(SYS_ARCHIVE_PATH) . 'mail/';
-        $mailq = $base . 'mailq';
+        $base = api_get_path(SYS_ARCHIVE_PATH).'mail/';
+        $mailq = $base.'mailq';
 
         if (!file_exists($mailq) || !is_readable($mailq)) {
             return false;
@@ -1944,7 +1944,7 @@ class MessageManager
                 $mail_queue[$i]['code'] = $codeMatches[2];
             }
 
-            $fullMail = $base . $mail_queue[$i]['code'];
+            $fullMail = $base.$mail_queue[$i]['code'];
             $mailFile = fopen($fullMail, 'r');
 
             //Get the reason of mail fail
@@ -1967,7 +1967,7 @@ class MessageManager
 
             //Get the time of mail fail
             if (preg_match('/^\s?(\d+)(\D+)\s+(.*)$/', $line, $timeMatches)) {
-                $mail_queue[$i]['time'] = $timeMatches[1] . $timeMatches[2];
+                $mail_queue[$i]['time'] = $timeMatches[1].$timeMatches[2];
             } elseif (preg_match('/^(\s+)((.*)@(.*))\s+(.*)$/', $line, $emailMatches)) {
                 $mail_queue[$i]['mail'] = $emailMatches[2];
                 $i++;

+ 20 - 20
main/reports/reports.php

@@ -11,7 +11,7 @@
 $cidReset = true;
 
 // including files
-require_once __DIR__ . '/../inc/global.inc.php';
+require_once __DIR__.'/../inc/global.inc.php';
 require_once 'reports.lib.php';
 require_once 'multiquery.lib.php';
 
@@ -39,16 +39,16 @@ if ($_REQUEST['format'] == 'link') {
     $kv = array();
     foreach ($_POST as $key => $value) {
         if ($key != 'format') {
-            $kv[] = $key . '=' . urlencode($value);
+            $kv[] = $key.'='.urlencode($value);
         }
     }
     $query_string = join("&", $kv);
-    die('<a href="reports.php?format=directlink&' . $query_string . '">' . get_lang('ReportTypeLink') . '</a>');
+    die('<a href="reports.php?format=directlink&'.$query_string.'">'.get_lang('ReportTypeLink').'</a>');
 }
 
 if ($_REQUEST['format'] == 'directlink') {
     foreach (array('jquery.dataTables.min.js') as $js) {
-        $htmlHeadXtra[] = '<script src="' . api_get_path(WEB_LIBRARY_PATH) . 'javascript/' . $js . '" type="text/javascript" language="javascript"></script>' . "\n";
+        $htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/'.$js.'" type="text/javascript" language="javascript"></script>'."\n";
     }
 
     $htmlCSSXtra[] = 'dataTable.css';
@@ -77,11 +77,11 @@ if ($_REQUEST['format'] == 'csv') {
     $kv = array();
     foreach ($_POST as $key => $value) {
         if ($key != 'format') {
-            $kv[] = $key . '=' . urlencode($value);
+            $kv[] = $key.'='.urlencode($value);
         }
     }
     $query_string = join("&", $kv);
-    die('<a href="reports.php?format=downloadcsv&' . $query_string . '">' . get_lang('DownloadFile') . '</a>');
+    die('<a href="reports.php?format=downloadcsv&'.$query_string.'">'.get_lang('DownloadFile').'</a>');
 } else {
     if ($_REQUEST['format'] == 'downloadcsv') {
         if ((strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false) && (strpos($_SERVER['HTTP_USER_AGENT'],
@@ -120,7 +120,7 @@ if (is_array($reports_template[$_REQUEST['type']])) {
         //die(get_lang('NoDataAvailable'));
     }
 } else {
-    die('<b>' . get_lang('ErrorWhileBuildingReport') . '</b>');
+    die('<b>'.get_lang('ErrorWhileBuildingReport').'</b>');
 }
 
 if ($_REQUEST['format'] == 'html' || $_REQUEST['format'] == 'directlink') {
@@ -130,14 +130,14 @@ if ($_REQUEST['format'] == 'html' || $_REQUEST['format'] == 'directlink') {
     echo '<script type="text/javascript" charset="utf-8">
 			$(document).ready(function() {
 
-				$("#reportsData' . $idsuffix . '").dataTable({
+				$("#reportsData' . $idsuffix.'").dataTable({
 					"oLanguage":
 						{
 							"sProcessing":   "Traitement en cours...",
 							"sLengthMenu":   "Afficher _MENU_ éléments",
 							"sZeroRecords":  "Aucun élément à afficher",
-							"sInfo":         "Affichage de l' . "'" . 'élement _START_ à _END_ sur _TOTAL_ éléments",
-							"sInfoEmpty":    "Affichage de l' . "'" . 'élement 0 à 0 sur 0 éléments",
+							"sInfo":         "Affichage de l' . "'".'élement _START_ à _END_ sur _TOTAL_ éléments",
+							"sInfoEmpty":    "Affichage de l' . "'".'élement 0 à 0 sur 0 éléments",
 							"sInfoFiltered": "(filtré de _MAX_ éléments au total)",
 							"sInfoPostFix":  "",
 							"sSearch":       "Rechercher :",
@@ -152,7 +152,7 @@ if ($_REQUEST['format'] == 'html' || $_REQUEST['format'] == 'directlink') {
 				});
 			} );
 		</script>';
-    echo '<table id="reportsData' . $idsuffix . '" class="display">'; // FIXME style
+    echo '<table id="reportsData'.$idsuffix.'" class="display">'; // FIXME style
 
     // counting fields
     $nfields = multiquery_num_fields($result);
@@ -163,7 +163,7 @@ if ($_REQUEST['format'] == 'html' || $_REQUEST['format'] == 'directlink') {
         $columns[$i] = multiquery_field_name($result, $i);
         if (substr($columns[$i], -5, 5) != '_link') {
             $column_islink[$i] = false;
-            echo '<th>' . $columns[$i] . '</th>';
+            echo '<th>'.$columns[$i].'</th>';
         } else {
             $columns_islink[$i] = true;
         }
@@ -173,8 +173,8 @@ if ($_REQUEST['format'] == 'html' || $_REQUEST['format'] == 'directlink') {
     $columns_flip = array_flip($columns);
     $columns_link = array();
     for ($i = 0; $i < $nfields; $i++) {
-        if ($column_islink[$i] == false && array_key_exists($columns[$i] . '_link', $columns_flip)) {
-            $columns_link[$i] = $columns_flip[$columns[$i] . '_link'];
+        if ($column_islink[$i] == false && array_key_exists($columns[$i].'_link', $columns_flip)) {
+            $columns_link[$i] = $columns_flip[$columns[$i].'_link'];
         } else {
             $columns_link[$i] = '';
         }
@@ -187,12 +187,12 @@ if ($_REQUEST['format'] == 'html' || $_REQUEST['format'] == 'directlink') {
                 if ($columns_link[$i] != '') // link is defined
                 {
                     if (substr($columns_link[$i], 0, 10) == 'javascript') {
-                        echo '<td><a href="#" onclick="' . $row[$columns_link[$i]] . '">' . $row[$i] . '</a></td>';
+                        echo '<td><a href="#" onclick="'.$row[$columns_link[$i]].'">'.$row[$i].'</a></td>';
                     } else {
-                        echo '<td><a href="' . $row[$columns_link[$i]] . '">' . $row[$i] . '</a></td>';
+                        echo '<td><a href="'.$row[$columns_link[$i]].'">'.$row[$i].'</a></td>';
                     }
                 } else {
-                    echo '<td>' . $row[$i] . '</td>';
+                    echo '<td>'.$row[$i].'</td>';
                 }
             }
         }
@@ -220,7 +220,7 @@ if ($_REQUEST['format'] == 'html' || $_REQUEST['format'] == 'directlink') {
             $columns[$i] = multiquery_field_name($result, $i);
             if (substr($columns[$i], -5, 5) != '_link') {
                 $column_islink[$i] = false;
-                echo csv_escaping($columns[$i]) . ',';
+                echo csv_escaping($columns[$i]).',';
             } else {
                 $columns_islink[$i] = true;
             }
@@ -231,7 +231,7 @@ if ($_REQUEST['format'] == 'html' || $_REQUEST['format'] == 'directlink') {
             for ($i = 0; $i < $nfields; $i++) {
                 if (!$columns_islink[$i]) // ignore links
                 {
-                    echo csv_escaping($row[$i]) . ',';
+                    echo csv_escaping($row[$i]).',';
                 }
             }  // fixme
             echo "\n";
@@ -245,7 +245,7 @@ function csv_escaping($value, $csv_separator = ',')
 {
     $value = str_replace('"', '""', $value);
     if (strpos($value, '""') or strpos($value, $csv_separator) or $value != trim($value)) {
-        $value = '"' . $value . '"';
+        $value = '"'.$value.'"';
     }
     return $value;
 }

+ 96 - 96
main/session/session_category_edit.php

@@ -33,10 +33,10 @@ if (!$infos = Database::fetch_array($result)) {
     exit();
 }
 
-list($year_start,$month_start,$day_start)=explode('-',$infos['date_start']);
-list($year_end,$month_end,$day_end)=explode('-',$infos['date_end']);
+list($year_start, $month_start, $day_start) = explode('-', $infos['date_start']);
+list($year_end, $month_end, $day_end) = explode('-', $infos['date_end']);
 
-if (!api_is_platform_admin() && $infos['session_admin_id']!=$_user['user_id'] && !api_is_session_admin()) {
+if (!api_is_platform_admin() && $infos['session_admin_id'] != $_user['user_id'] && !api_is_session_admin()) {
     api_not_allowed(true);
 }
 
@@ -73,24 +73,24 @@ $thisDay = date('d');
 // display the header
 Display::display_header($tool_name);
 if (!empty($return)) {
-    Display::display_error_message($return,false);
+    Display::display_error_message($return, false);
 }
 ?>
 <div class="row">
     <div class="col-md-12">
         <form method="post" name="form" action="<?php echo api_get_self(); ?>?id=<?php echo $id; ?>" class="form-horizontal">
         <input type="hidden" name="formSent" value="1">
-        <legend><?php echo $tool_name;?> </legend>
+        <legend><?php echo $tool_name; ?> </legend>
         <div class="form-group">
             <label class="col-sm-3 control-label"><?php echo get_lang('SessionName') ?></label>
             <div class="col-sm-6">
-                <input class="form-control" type="text" name="name" size="50" maxlength="50" value="<?php if($formSent) echo api_htmlentities($name,ENT_QUOTES,$charset); else echo api_htmlentities($infos['name'],ENT_QUOTES,$charset); ?>">
+                <input class="form-control" type="text" name="name" size="50" maxlength="50" value="<?php if ($formSent) echo api_htmlentities($name, ENT_QUOTES, $charset); else echo api_htmlentities($infos['name'], ENT_QUOTES, $charset); ?>">
             </div>
             <div class="col-sm-3"></div>
         </div>
         <div class="form-group">
             <div class="col-sm-offset-3 col-sm-6">
-                <?php echo get_lang('TheTimeLimitsAreReferential');?>
+                <?php echo get_lang('TheTimeLimitsAreReferential'); ?>
                 <a href="javascript://" onclick="if(document.getElementById('options').style.display == 'none'){document.getElementById('options').style.display = 'block';}else{document.getElementById('options').style.display = 'none';}"><?php echo get_lang('EditTimeLimit') ?></a>
             </div>
         </div>
@@ -100,58 +100,58 @@ if (!empty($return)) {
                 <div class="col-sm-6">
                     <select name="day_start">
                         <option value="1">01</option>
-                        <option value="2" <?php if($day_start == 2) echo 'selected="selected"'; ?> >02</option>
-                        <option value="3" <?php if($day_start == 3) echo 'selected="selected"'; ?> >03</option>
-                        <option value="4" <?php if($day_start == 4) echo 'selected="selected"'; ?> >04</option>
-                        <option value="5" <?php if($day_start == 5) echo 'selected="selected"'; ?> >05</option>
-                        <option value="6" <?php if($day_start == 6) echo 'selected="selected"'; ?> >06</option>
-                        <option value="7" <?php if($day_start == 7) echo 'selected="selected"'; ?> >07</option>
-                        <option value="8" <?php if($day_start == 8) echo 'selected="selected"'; ?> >08</option>
-                        <option value="9" <?php if($day_start == 9) echo 'selected="selected"'; ?> >09</option>
-                        <option value="10" <?php if($day_start == 10) echo 'selected="selected"'; ?> >10</option>
-                        <option value="11" <?php if($day_start == 11) echo 'selected="selected"'; ?> >11</option>
-                        <option value="12" <?php if($day_start == 12) echo 'selected="selected"'; ?> >12</option>
-                        <option value="13" <?php if($day_start == 13) echo 'selected="selected"'; ?> >13</option>
-                        <option value="14" <?php if($day_start == 14) echo 'selected="selected"'; ?> >14</option>
-                        <option value="15" <?php if($day_start == 15) echo 'selected="selected"'; ?> >15</option>
-                        <option value="16" <?php if($day_start == 16) echo 'selected="selected"'; ?> >16</option>
-                        <option value="17" <?php if($day_start == 17) echo 'selected="selected"'; ?> >17</option>
-                        <option value="18" <?php if($day_start == 18) echo 'selected="selected"'; ?> >18</option>
-                        <option value="19" <?php if($day_start == 19) echo 'selected="selected"'; ?> >19</option>
-                        <option value="20" <?php if($day_start == 20) echo 'selected="selected"'; ?> >20</option>
-                        <option value="21" <?php if($day_start == 21) echo 'selected="selected"'; ?> >21</option>
-                        <option value="22" <?php if($day_start == 22) echo 'selected="selected"'; ?> >22</option>
-                        <option value="23" <?php if($day_start == 23) echo 'selected="selected"'; ?> >23</option>
-                        <option value="24" <?php if($day_start == 24) echo 'selected="selected"'; ?> >24</option>
-                        <option value="25" <?php if($day_start == 25) echo 'selected="selected"'; ?> >25</option>
-                        <option value="26" <?php if($day_start == 26) echo 'selected="selected"'; ?> >26</option>
-                        <option value="27" <?php if($day_start == 27) echo 'selected="selected"'; ?> >27</option>
-                        <option value="28" <?php if($day_start == 28) echo 'selected="selected"'; ?> >28</option>
-                        <option value="29" <?php if($day_start == 29) echo 'selected="selected"'; ?> >29</option>
-                        <option value="30" <?php if($day_start == 30) echo 'selected="selected"'; ?> >30</option>
-                        <option value="31" <?php if($day_start == 31) echo 'selected="selected"'; ?> >31</option>
+                        <option value="2" <?php if ($day_start == 2) echo 'selected="selected"'; ?> >02</option>
+                        <option value="3" <?php if ($day_start == 3) echo 'selected="selected"'; ?> >03</option>
+                        <option value="4" <?php if ($day_start == 4) echo 'selected="selected"'; ?> >04</option>
+                        <option value="5" <?php if ($day_start == 5) echo 'selected="selected"'; ?> >05</option>
+                        <option value="6" <?php if ($day_start == 6) echo 'selected="selected"'; ?> >06</option>
+                        <option value="7" <?php if ($day_start == 7) echo 'selected="selected"'; ?> >07</option>
+                        <option value="8" <?php if ($day_start == 8) echo 'selected="selected"'; ?> >08</option>
+                        <option value="9" <?php if ($day_start == 9) echo 'selected="selected"'; ?> >09</option>
+                        <option value="10" <?php if ($day_start == 10) echo 'selected="selected"'; ?> >10</option>
+                        <option value="11" <?php if ($day_start == 11) echo 'selected="selected"'; ?> >11</option>
+                        <option value="12" <?php if ($day_start == 12) echo 'selected="selected"'; ?> >12</option>
+                        <option value="13" <?php if ($day_start == 13) echo 'selected="selected"'; ?> >13</option>
+                        <option value="14" <?php if ($day_start == 14) echo 'selected="selected"'; ?> >14</option>
+                        <option value="15" <?php if ($day_start == 15) echo 'selected="selected"'; ?> >15</option>
+                        <option value="16" <?php if ($day_start == 16) echo 'selected="selected"'; ?> >16</option>
+                        <option value="17" <?php if ($day_start == 17) echo 'selected="selected"'; ?> >17</option>
+                        <option value="18" <?php if ($day_start == 18) echo 'selected="selected"'; ?> >18</option>
+                        <option value="19" <?php if ($day_start == 19) echo 'selected="selected"'; ?> >19</option>
+                        <option value="20" <?php if ($day_start == 20) echo 'selected="selected"'; ?> >20</option>
+                        <option value="21" <?php if ($day_start == 21) echo 'selected="selected"'; ?> >21</option>
+                        <option value="22" <?php if ($day_start == 22) echo 'selected="selected"'; ?> >22</option>
+                        <option value="23" <?php if ($day_start == 23) echo 'selected="selected"'; ?> >23</option>
+                        <option value="24" <?php if ($day_start == 24) echo 'selected="selected"'; ?> >24</option>
+                        <option value="25" <?php if ($day_start == 25) echo 'selected="selected"'; ?> >25</option>
+                        <option value="26" <?php if ($day_start == 26) echo 'selected="selected"'; ?> >26</option>
+                        <option value="27" <?php if ($day_start == 27) echo 'selected="selected"'; ?> >27</option>
+                        <option value="28" <?php if ($day_start == 28) echo 'selected="selected"'; ?> >28</option>
+                        <option value="29" <?php if ($day_start == 29) echo 'selected="selected"'; ?> >29</option>
+                        <option value="30" <?php if ($day_start == 30) echo 'selected="selected"'; ?> >30</option>
+                        <option value="31" <?php if ($day_start == 31) echo 'selected="selected"'; ?> >31</option>
                   </select>
                   /
                   <select name="month_start">
                         <option value="1">01</option>
-                        <option value="2" <?php if($month_start == 2) echo 'selected="selected"'; ?> >02</option>
-                        <option value="3" <?php if($month_start == 3) echo 'selected="selected"'; ?> >03</option>
-                        <option value="4" <?php if($month_start == 4) echo 'selected="selected"'; ?> >04</option>
-                        <option value="5" <?php if($month_start == 5) echo 'selected="selected"'; ?> >05</option>
-                        <option value="6" <?php if($month_start == 6) echo 'selected="selected"'; ?> >06</option>
-                        <option value="7" <?php if($month_start == 7) echo 'selected="selected"'; ?> >07</option>
-                        <option value="8" <?php if($month_start == 8) echo 'selected="selected"'; ?> >08</option>
-                        <option value="9" <?php if($month_start == 9) echo 'selected="selected"'; ?> >09</option>
-                        <option value="10" <?php if($month_start == 10) echo 'selected="selected"'; ?> >10</option>
-                        <option value="11" <?php if($month_start == 11) echo 'selected="selected"'; ?> >11</option>
-                        <option value="12" <?php if($month_start == 12) echo 'selected="selected"'; ?> >12</option>
+                        <option value="2" <?php if ($month_start == 2) echo 'selected="selected"'; ?> >02</option>
+                        <option value="3" <?php if ($month_start == 3) echo 'selected="selected"'; ?> >03</option>
+                        <option value="4" <?php if ($month_start == 4) echo 'selected="selected"'; ?> >04</option>
+                        <option value="5" <?php if ($month_start == 5) echo 'selected="selected"'; ?> >05</option>
+                        <option value="6" <?php if ($month_start == 6) echo 'selected="selected"'; ?> >06</option>
+                        <option value="7" <?php if ($month_start == 7) echo 'selected="selected"'; ?> >07</option>
+                        <option value="8" <?php if ($month_start == 8) echo 'selected="selected"'; ?> >08</option>
+                        <option value="9" <?php if ($month_start == 9) echo 'selected="selected"'; ?> >09</option>
+                        <option value="10" <?php if ($month_start == 10) echo 'selected="selected"'; ?> >10</option>
+                        <option value="11" <?php if ($month_start == 11) echo 'selected="selected"'; ?> >11</option>
+                        <option value="12" <?php if ($month_start == 12) echo 'selected="selected"'; ?> >12</option>
                   </select>
                   /
                 <select name="year_start">
                         <?php
-                        for($i=$thisYear-5;$i <= ($thisYear+5);$i++)
+                        for ($i = $thisYear - 5; $i <= ($thisYear + 5); $i++)
                         { ?>
-                                <option value="<?php echo $i; ?>" <?php if($year_start == $i) echo 'selected="selected"'; ?> ><?php echo $i; ?></option>
+                                <option value="<?php echo $i; ?>" <?php if ($year_start == $i) echo 'selected="selected"'; ?> ><?php echo $i; ?></option>
                         <?php
                         } ?>
                 </select>
@@ -163,61 +163,61 @@ if (!empty($return)) {
                 <div class="col-sm-6">
                     <select name="day_end">
                         <option value="0">--</option>
-                        <option value="1" <?php if($day_end == 1) echo 'selected="selected"'; ?> >01</option>
-                        <option value="2" <?php if($day_end == 2) echo 'selected="selected"'; ?> >02</option>
-                        <option value="3" <?php if($day_end == 3) echo 'selected="selected"'; ?> >03</option>
-                        <option value="4" <?php if($day_end == 4) echo 'selected="selected"'; ?> >04</option>
-                        <option value="5" <?php if($day_end == 5) echo 'selected="selected"'; ?> >05</option>
-                        <option value="6" <?php if($day_end == 6) echo 'selected="selected"'; ?> >06</option>
-                        <option value="7" <?php if($day_end == 7) echo 'selected="selected"'; ?> >07</option>
-                        <option value="8" <?php if($day_end == 8) echo 'selected="selected"'; ?> >08</option>
-                        <option value="9" <?php if($day_end == 9) echo 'selected="selected"'; ?> >09</option>
-                        <option value="10" <?php if($day_end == 10) echo 'selected="selected"'; ?> >10</option>
-                        <option value="11" <?php if($day_end == 11) echo 'selected="selected"'; ?> >11</option>
-                        <option value="12" <?php if($day_end == 12) echo 'selected="selected"'; ?> >12</option>
-                        <option value="13" <?php if($day_end == 13) echo 'selected="selected"'; ?> >13</option>
-                        <option value="14" <?php if($day_end == 14) echo 'selected="selected"'; ?> >14</option>
-                        <option value="15" <?php if($day_end == 15) echo 'selected="selected"'; ?> >15</option>
-                        <option value="16" <?php if($day_end == 16) echo 'selected="selected"'; ?> >16</option>
-                        <option value="17" <?php if($day_end == 17) echo 'selected="selected"'; ?> >17</option>
-                        <option value="18" <?php if($day_end == 18) echo 'selected="selected"'; ?> >18</option>
-                        <option value="19" <?php if($day_end == 19) echo 'selected="selected"'; ?> >19</option>
-                        <option value="20" <?php if($day_end == 20) echo 'selected="selected"'; ?> >20</option>
-                        <option value="21" <?php if($day_end == 21) echo 'selected="selected"'; ?> >21</option>
-                        <option value="22" <?php if($day_end == 22) echo 'selected="selected"'; ?> >22</option>
-                        <option value="23" <?php if($day_end == 23) echo 'selected="selected"'; ?> >23</option>
-                        <option value="24" <?php if($day_end == 24) echo 'selected="selected"'; ?> >24</option>
-                        <option value="25" <?php if($day_end == 25) echo 'selected="selected"'; ?> >25</option>
-                        <option value="26" <?php if($day_end == 26) echo 'selected="selected"'; ?> >26</option>
-                        <option value="27" <?php if($day_end == 27) echo 'selected="selected"'; ?> >27</option>
-                        <option value="28" <?php if($day_end == 28) echo 'selected="selected"'; ?> >28</option>
-                        <option value="29" <?php if($day_end == 29) echo 'selected="selected"'; ?> >29</option>
-                        <option value="30" <?php if($day_end == 30) echo 'selected="selected"'; ?> >30</option>
-                        <option value="31" <?php if($day_end == 31) echo 'selected="selected"'; ?> >31</option>
+                        <option value="1" <?php if ($day_end == 1) echo 'selected="selected"'; ?> >01</option>
+                        <option value="2" <?php if ($day_end == 2) echo 'selected="selected"'; ?> >02</option>
+                        <option value="3" <?php if ($day_end == 3) echo 'selected="selected"'; ?> >03</option>
+                        <option value="4" <?php if ($day_end == 4) echo 'selected="selected"'; ?> >04</option>
+                        <option value="5" <?php if ($day_end == 5) echo 'selected="selected"'; ?> >05</option>
+                        <option value="6" <?php if ($day_end == 6) echo 'selected="selected"'; ?> >06</option>
+                        <option value="7" <?php if ($day_end == 7) echo 'selected="selected"'; ?> >07</option>
+                        <option value="8" <?php if ($day_end == 8) echo 'selected="selected"'; ?> >08</option>
+                        <option value="9" <?php if ($day_end == 9) echo 'selected="selected"'; ?> >09</option>
+                        <option value="10" <?php if ($day_end == 10) echo 'selected="selected"'; ?> >10</option>
+                        <option value="11" <?php if ($day_end == 11) echo 'selected="selected"'; ?> >11</option>
+                        <option value="12" <?php if ($day_end == 12) echo 'selected="selected"'; ?> >12</option>
+                        <option value="13" <?php if ($day_end == 13) echo 'selected="selected"'; ?> >13</option>
+                        <option value="14" <?php if ($day_end == 14) echo 'selected="selected"'; ?> >14</option>
+                        <option value="15" <?php if ($day_end == 15) echo 'selected="selected"'; ?> >15</option>
+                        <option value="16" <?php if ($day_end == 16) echo 'selected="selected"'; ?> >16</option>
+                        <option value="17" <?php if ($day_end == 17) echo 'selected="selected"'; ?> >17</option>
+                        <option value="18" <?php if ($day_end == 18) echo 'selected="selected"'; ?> >18</option>
+                        <option value="19" <?php if ($day_end == 19) echo 'selected="selected"'; ?> >19</option>
+                        <option value="20" <?php if ($day_end == 20) echo 'selected="selected"'; ?> >20</option>
+                        <option value="21" <?php if ($day_end == 21) echo 'selected="selected"'; ?> >21</option>
+                        <option value="22" <?php if ($day_end == 22) echo 'selected="selected"'; ?> >22</option>
+                        <option value="23" <?php if ($day_end == 23) echo 'selected="selected"'; ?> >23</option>
+                        <option value="24" <?php if ($day_end == 24) echo 'selected="selected"'; ?> >24</option>
+                        <option value="25" <?php if ($day_end == 25) echo 'selected="selected"'; ?> >25</option>
+                        <option value="26" <?php if ($day_end == 26) echo 'selected="selected"'; ?> >26</option>
+                        <option value="27" <?php if ($day_end == 27) echo 'selected="selected"'; ?> >27</option>
+                        <option value="28" <?php if ($day_end == 28) echo 'selected="selected"'; ?> >28</option>
+                        <option value="29" <?php if ($day_end == 29) echo 'selected="selected"'; ?> >29</option>
+                        <option value="30" <?php if ($day_end == 30) echo 'selected="selected"'; ?> >30</option>
+                        <option value="31" <?php if ($day_end == 31) echo 'selected="selected"'; ?> >31</option>
                   </select>
                   /
                   <select name="month_end">
                         <option value="0">--</option>
-                        <option value="1" <?php if($month_end == 1) echo 'selected="selected"'; ?> >01</option>
-                        <option value="2" <?php if($month_end == 2) echo 'selected="selected"'; ?> >02</option>
-                        <option value="3" <?php if($month_end == 3) echo 'selected="selected"'; ?> >03</option>
-                        <option value="4" <?php if($month_end == 4) echo 'selected="selected"'; ?> >04</option>
-                        <option value="5" <?php if($month_end == 5) echo 'selected="selected"'; ?> >05</option>
-                        <option value="6" <?php if($month_end == 6) echo 'selected="selected"'; ?> >06</option>
-                        <option value="7" <?php if($month_end == 7) echo 'selected="selected"'; ?> >07</option>
-                        <option value="8" <?php if($month_end == 8) echo 'selected="selected"'; ?> >08</option>
-                        <option value="9" <?php if($month_end == 9) echo 'selected="selected"'; ?> >09</option>
-                        <option value="10" <?php if($month_end == 10) echo 'selected="selected"'; ?> >10</option>
-                        <option value="11" <?php if($month_end == 11) echo 'selected="selected"'; ?> >11</option>
-                        <option value="12" <?php if($month_end == 12) echo 'selected="selected"'; ?> >12</option>
+                        <option value="1" <?php if ($month_end == 1) echo 'selected="selected"'; ?> >01</option>
+                        <option value="2" <?php if ($month_end == 2) echo 'selected="selected"'; ?> >02</option>
+                        <option value="3" <?php if ($month_end == 3) echo 'selected="selected"'; ?> >03</option>
+                        <option value="4" <?php if ($month_end == 4) echo 'selected="selected"'; ?> >04</option>
+                        <option value="5" <?php if ($month_end == 5) echo 'selected="selected"'; ?> >05</option>
+                        <option value="6" <?php if ($month_end == 6) echo 'selected="selected"'; ?> >06</option>
+                        <option value="7" <?php if ($month_end == 7) echo 'selected="selected"'; ?> >07</option>
+                        <option value="8" <?php if ($month_end == 8) echo 'selected="selected"'; ?> >08</option>
+                        <option value="9" <?php if ($month_end == 9) echo 'selected="selected"'; ?> >09</option>
+                        <option value="10" <?php if ($month_end == 10) echo 'selected="selected"'; ?> >10</option>
+                        <option value="11" <?php if ($month_end == 11) echo 'selected="selected"'; ?> >11</option>
+                        <option value="12" <?php if ($month_end == 12) echo 'selected="selected"'; ?> >12</option>
                   </select>
                   /
                   <select name="year_end">
                         <option value="0">----</option>
                         <?php
-                        for($i=$thisYear-5;$i <= ($thisYear+5);$i++)
+                        for ($i = $thisYear - 5; $i <= ($thisYear + 5); $i++)
                         { ?>
-                         <option value="<?php echo $i; ?>" <?php if($year_end == $i) echo 'selected="selected"'; ?> ><?php echo $i; ?></option>
+                         <option value="<?php echo $i; ?>" <?php if ($year_end == $i) echo 'selected="selected"'; ?> ><?php echo $i; ?></option>
                         <?php
                         } ?>
                  </select>
@@ -238,7 +238,7 @@ if (!empty($return)) {
 
 
 <script>
-<?php if($year_start=="0000") echo "setDisable(document.form.nolimit);\r\n"; ?>
+<?php if ($year_start == "0000") echo "setDisable(document.form.nolimit);\r\n"; ?>
 function setDisable(select){
 	document.form.day_start.disabled = (select.checked) ? true : false;
 	document.form.month_start.disabled = (select.checked) ? true : false;

+ 7 - 7
main/session/session_edit.php

@@ -56,8 +56,8 @@ $id_coach = $sessionInfo['id_coach'];
 $tool_name = get_lang('EditSession');
 
 //$interbreadcrumb[] = array('url' => 'index.php',"name" => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array('url' => "session_list.php","name" => get_lang('SessionList'));
-$interbreadcrumb[] = array('url' => "resume_session.php?id_session=".$id,"name" => get_lang('SessionOverview'));
+$interbreadcrumb[] = array('url' => "session_list.php", "name" => get_lang('SessionList'));
+$interbreadcrumb[] = array('url' => "resume_session.php?id_session=".$id, "name" => get_lang('SessionOverview'));
 
 if (isset($_POST['formSent']) && $_POST['formSent']) {
     $formSent = 1;
@@ -71,7 +71,7 @@ $sql = "SELECT user_id,lastname,firstname,username
         WHERE status='1'".$order_clause;
 
 if (api_is_multiple_url_enabled()) {
-	$table_access_url_rel_user= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
+	$table_access_url_rel_user = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
 	$access_url_id = api_get_current_access_url_id();
 	if ($access_url_id != -1) {
 		$sql = "SELECT DISTINCT u.user_id,lastname,firstname,username
@@ -87,7 +87,7 @@ $coaches = Database::store_result($result);
 $thisYear = date('Y');
 
 $coachesOption = array(
-    '' => '----- ' . get_lang('None') . ' -----'
+    '' => '----- '.get_lang('None').' -----'
 );
 
 foreach ($coaches as $coach) {
@@ -107,7 +107,7 @@ if ($categoriesList != false) {
     }
 }
 
-$formAction = api_get_self() . '?';
+$formAction = api_get_self().'?';
 $formAction .= http_build_query(array(
     'page' => Security::remove_XSS($_GET['page']),
     'id' => $id
@@ -158,7 +158,7 @@ if ($form->validate()) {
         $duration = null;
     }
     $description = $params['description'];
-    $showDescription = isset($params['show_description']) ? 1: 0;
+    $showDescription = isset($params['show_description']) ? 1 : 0;
     $sendSubscriptionNotification = isset($params['send_subscription_notification']);
     $isThisImageCropped = isset($params['picture_crop_result']);
 
@@ -195,7 +195,7 @@ if ($form->validate()) {
 
     if ($return) {
         Display::addFlash(Display::return_message(get_lang('Updated')));
-        header('Location: resume_session.php?id_session=' . $return);
+        header('Location: resume_session.php?id_session='.$return);
         exit();
     }
 }

+ 3 - 3
main/upload/form.document.php

@@ -12,8 +12,8 @@
  */
 $noPHP_SELF = false;
 $nameTools = get_lang('FileUpload');
-$interbreadcrumb[]= array ("url"=>"../lp/lp_controller.php?action=list", "name"=> get_lang(TOOL_DOCUMENT));
-Display::display_header($nameTools,"Doc");
+$interbreadcrumb[] = array("url"=>"../lp/lp_controller.php?action=list", "name"=> get_lang(TOOL_DOCUMENT));
+Display::display_header($nameTools, "Doc");
 //show the title
 api_display_tool_title($nameTools.$add_group_to_title);
 ?>
@@ -21,7 +21,7 @@ api_display_tool_title($nameTools.$add_group_to_title);
 <div id="dynamic_div" style="display:block;margin-left:40%;margin-top:10px;height:50px;">
 </div>
 <div id="upload_form_div" name="form_div" style="display:block;">
-	<form method="POST" action="upload.php" id="upload_form" enctype="multipart/form-data" onsubmit="javascript: myUpload.start('dynamic_div','progressbar_green.gif','<?php echo(get_lang('Uploading', ''));?>','upload_form_div');">
+	<form method="POST" action="upload.php" id="upload_form" enctype="multipart/form-data" onsubmit="javascript: myUpload.start('dynamic_div','progressbar_green.gif','<?php echo(get_lang('Uploading', '')); ?>','upload_form_div');">
 		<input type="hidden" name="curdirpath" value="<?php echo $path; ?>">
 		<input type="hidden" name="tool" value="<?php echo $my_tool; ?>">
 		<input type="file" name="user_file">