Quellcode durchsuchen

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

Scrutinizer Auto-Fixes
Julio Montoya vor 8 Jahren
Ursprung
Commit
c9e7812e7e

+ 1 - 1
certificates/index.php

@@ -39,7 +39,7 @@ switch ($action) {
 
             $pageFormat = $pdfParams['orientation'] === 'landscape' ? 'A4-L' : 'A4';
             $userInfo = api_get_user_info($certificate->user_id);
-            $pdfName = api_replace_dangerous_char(get_lang('Certificate') . ' ' . $userInfo['username']);
+            $pdfName = api_replace_dangerous_char(get_lang('Certificate').' '.$userInfo['username']);
 
             $pdf = new PDF($pageFormat, $pdfParams['orientation'], $pdfParams);
             $pdf->html_to_pdf(

+ 3 - 3
main/admin/legal_add.php

@@ -47,7 +47,7 @@ if ($form->validate()) {
         } else {
             $changes = '';
         }
-        $submit  = $values['send'];
+        $submit = $values['send'];
 
         $default['content'] = $content;
         if (isset($values['language'])) {
@@ -66,7 +66,7 @@ if ($form->validate()) {
                 Display::addFlash(Display::return_message($message));
                 header('Location: legal_list.php?sec_token='.$tok);
                 exit();
-            } elseif ($submit=='preview') {
+            } elseif ($submit == 'preview') {
                 $defaults['type'] = $type;
                 $defaults['content'] = $content;
                 $defaults['changes'] = $changes;
@@ -143,7 +143,7 @@ if (isset($_POST['language'])) {
 }
 
 $tool_name = get_lang('AddTermsAndConditions');
-$interbreadcrumb[] = array ("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = array("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
 Display :: display_header($tool_name);
 
 echo '<script>

+ 8 - 8
main/admin/special_exports.php

@@ -17,7 +17,7 @@ $cidReset = true;
 require_once __DIR__.'/../inc/global.inc.php';
 
 $this_section = SECTION_PLATFORM_ADMIN;
-$interbreadcrumb[] = array ("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = array("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
 // Access restrictions
 api_protect_admin_script(true);
 $nameTools = get_lang('SpecialExports');
@@ -39,7 +39,7 @@ echo Display::page_header($nameTools);
 if (count($_POST) == 0) {
     Display::display_normal_message(get_lang('SpecialExportsIntroduction'));
 }
-$error =0;
+$error = 0;
 $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
 $tbl_session_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
 
@@ -157,9 +157,9 @@ function form_special_export()
     $form = new FormValidator('special_exports', 'post');
     $renderer = $form->defaultRenderer();
     $renderer->setCustomElementTemplate('<div>{element}</div> ');
-    $form->addElement('radio', 'backup_option', '',  get_lang('SpecialCreateFullBackup'), 'full_backup');
-    $form->addElement('radio', 'backup_option', '',  get_lang('SpecialLetMeSelectItems'), 'select_items');
-    $form->addElement('html','<br />');
+    $form->addElement('radio', 'backup_option', '', get_lang('SpecialCreateFullBackup'), 'full_backup');
+    $form->addElement('radio', 'backup_option', '', get_lang('SpecialLetMeSelectItems'), 'select_items');
+    $form->addElement('html', '<br />');
     $form->addButtonExport(get_lang('CreateBackup'));
     $form->addProgress();
     $values['backup_option'] = 'full_backup';
@@ -183,7 +183,7 @@ function create_zip()
         $handle = opendir($temp_zip_dir);
         while (false !== ($file = readdir($handle))) {
             if ($file != "." && $file != "..") {
-                $Diff = (time() - filemtime("$temp_zip_dir/$file")) / 60 / 60;  //the "age" of the file in hours
+                $Diff = (time() - filemtime("$temp_zip_dir/$file")) / 60 / 60; //the "age" of the file in hours
                 if ($Diff > 4) {
                     unlink("$temp_zip_dir/$file");
                 }   //delete files older than 4 hours
@@ -191,7 +191,7 @@ function create_zip()
         }
         closedir($handle);
     }
-    $temp_zip_file = $temp_zip_dir."/".md5(time()).".zip";  //create zipfile of given directory
+    $temp_zip_file = $temp_zip_dir."/".md5(time()).".zip"; //create zipfile of given directory
     return array(
         'PATH' => $path,
         'PATH_TEMP_ARCHIVE' => $temp_zip_dir,
@@ -240,7 +240,7 @@ function fullexportspecial()
     if (count($list_course) > 0) {
         foreach ($list_course as $_course) {
             if ($FileZip['PATH'] == '/') {
-                $querypath=''; // to prevent ...path LIKE '//%'... in query
+                $querypath = ''; // to prevent ...path LIKE '//%'... in query
             } else {
                 $querypath = $FileZip['PATH'];
             }

+ 15 - 15
main/admin/subscribe_user2course.php

@@ -30,7 +30,7 @@ $tbl_user = Database :: get_main_table(TABLE_MAIN_USER);
 
 /* Header */
 $tool_name = get_lang('AddUsersToACourse');
-$interbreadcrumb[] = array ("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
+$interbreadcrumb[] = array("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
 
 $htmlHeadXtra[] = '<script>
 function validate_filter() {
@@ -142,12 +142,12 @@ if (is_array($extra_field_list)) {
                 if (isset($_POST[$varname]) && $_POST[$varname] != '0') {
                     $use_extra_fields = true;
                     if ($fieldtype == ExtraField::FIELD_TYPE_TAG) {
-                        $extra_field_result[]= UserManager::get_extra_user_data_by_tags(
+                        $extra_field_result[] = UserManager::get_extra_user_data_by_tags(
                             intval($_POST['field_id']),
                             $_POST[$varname]
                         );
                     } else {
-                        $extra_field_result[]= UserManager::get_extra_user_data_by_value(
+                        $extra_field_result[] = UserManager::get_extra_user_data_by_value(
                             $new_field['variable'],
                             $_POST[$varname]
                         );
@@ -163,8 +163,8 @@ if ($use_extra_fields) {
     $final_result = array();
     if (count($extra_field_result) > 1) {
         for ($i = 0; $i < count($extra_field_result) - 1; $i++) {
-            if (is_array($extra_field_result[$i+1])) {
-                $final_result  = array_intersect($extra_field_result[$i], $extra_field_result[$i+1]);
+            if (is_array($extra_field_result[$i + 1])) {
+                $final_result = array_intersect($extra_field_result[$i], $extra_field_result[$i + 1]);
             }
         }
     } else {
@@ -172,14 +172,14 @@ if ($use_extra_fields) {
     }
 
     if (api_is_multiple_url_enabled()) {
-        if (is_array($final_result) && count($final_result)>0) {
-            $where_filter = " AND u.user_id IN  ('".implode("','",$final_result)."') ";
+        if (is_array($final_result) && count($final_result) > 0) {
+            $where_filter = " AND u.user_id IN  ('".implode("','", $final_result)."') ";
         } else {
             //no results
             $where_filter = " AND u.user_id  = -1";
         }
     } else {
-        if (is_array($final_result) && count($final_result)>0) {
+        if (is_array($final_result) && count($final_result) > 0) {
             $where_filter = " AND user_id IN  ('".implode("','", $final_result)."') ";
         } else {
             //no results
@@ -200,10 +200,10 @@ if ($orderListByOfficialCode === 'true') {
 $sql = "SELECT user_id, lastname, firstname, username, official_code
         FROM $tbl_user
         WHERE user_id<>2 AND ".$target_name." LIKE '".$first_letter_user."%' $where_filter
-        ORDER BY ". (count($users) > 0 ? "(user_id IN(".implode(',', $users).")) DESC," : "")." ".$orderBy;
+        ORDER BY ".(count($users) > 0 ? "(user_id IN(".implode(',', $users).")) DESC," : "")." ".$orderBy;
 
 if (api_is_multiple_url_enabled()) {
-    $tbl_user_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
+    $tbl_user_rel_access_url = 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 u.user_id,lastname,firstname,username, official_code
@@ -215,7 +215,7 @@ if (api_is_multiple_url_enabled()) {
                     access_url_id =  $access_url_id AND
                     (".$target_name." LIKE '".$first_letter_user."%' )
                     $where_filter
-                ORDER BY ". (count($users) > 0 ? "(u.user_id IN(".implode(',', $users).")) DESC," : "")." ".$orderBy;
+                ORDER BY ".(count($users) > 0 ? "(u.user_id IN(".implode(',', $users).")) DESC," : "")." ".$orderBy;
     }
 }
 
@@ -258,8 +258,8 @@ if (is_array($extra_field_list)) {
             $fieldtype = $new_field['type'];
             echo '&nbsp;<select name="'.$varname.'">';
             echo '<option value="0">--'.get_lang('Select').'--</option>';
-            foreach	($new_field['data'] as $option) {
-                $checked='';
+            foreach ($new_field['data'] as $option) {
+                $checked = '';
                 if ($fieldtype == ExtraField::FIELD_TYPE_TAG) {
                     if (isset($_POST[$varname])) {
                         if ($_POST[$varname] == $option['tag']) {
@@ -317,7 +317,7 @@ if (is_array($extra_field_list)) {
     <td width="40%" align="center">
      <select name="UserList[]" multiple="multiple" size="20" style="width:300px;">
     <?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
         $userName = $user['lastname'].' '.$user['firstname'].' ('.$user['username'].')';
         if ($showOfficialCode) {
@@ -338,7 +338,7 @@ if (is_array($extra_field_list)) {
    <td width="40%" align="center">
     <select name="CourseList[]" multiple="multiple" size="20" style="width:300px;">
     <?php foreach ($db_courses as $course) { ?>
-         <option value="<?php echo $course['code']; ?>" <?php if(in_array($course['code'],$courses)) echo 'selected="selected"'; ?>>
+         <option value="<?php echo $course['code']; ?>" <?php if (in_array($course['code'], $courses)) echo 'selected="selected"'; ?>>
              <?php echo '('.$course['visual_code'].') '.$course['title']; ?>
          </option>
     <?php } ?>

+ 6 - 6
main/admin/user_add.php

@@ -135,7 +135,7 @@ if (api_get_setting('registration', 'email') == 'true') {
 }
 
 if (api_get_setting('login_is_email') == 'true') {
-    $form->addRule('email', sprintf(get_lang('UsernameMaxXCharacters'), (string)USERNAME_MAX_LENGTH), 'maxlength', USERNAME_MAX_LENGTH);
+    $form->addRule('email', sprintf(get_lang('UsernameMaxXCharacters'), (string) USERNAME_MAX_LENGTH), 'maxlength', USERNAME_MAX_LENGTH);
     $form->addRule('email', get_lang('UserTaken'), 'username_available');
 }
 
@@ -155,7 +155,7 @@ $form->addRule('picture', get_lang('OnlyImagesAllowed').' ('.implode(',', $allow
 if (api_get_setting('login_is_email') != 'true') {
     $form->addElement('text', 'username', get_lang('LoginName'), array('id'=> 'username', 'maxlength' => USERNAME_MAX_LENGTH, 'autocomplete' => 'off'));
     $form->addRule('username', get_lang('ThisFieldIsRequired'), 'required');
-    $form->addRule('username', sprintf(get_lang('UsernameMaxXCharacters'), (string)USERNAME_MAX_LENGTH), 'maxlength', USERNAME_MAX_LENGTH);
+    $form->addRule('username', sprintf(get_lang('UsernameMaxXCharacters'), (string) USERNAME_MAX_LENGTH), 'maxlength', USERNAME_MAX_LENGTH);
     $form->addRule('username', get_lang('OnlyLettersAndNumbersAllowed'), 'username');
     $form->addRule('username', get_lang('UserTaken'), 'username_available');
 }
@@ -243,7 +243,7 @@ $form->addElement(
 );
 
 //drh list (display only if student)
-$display = isset($_POST['status']) && $_POST['status'] == STUDENT  || !isset($_POST['status']) ? 'block' : 'none';
+$display = isset($_POST['status']) && $_POST['status'] == STUDENT || !isset($_POST['status']) ? 'block' : 'none';
 
 //@todo remove the drh list here. This code is unused
 $form->addElement('html', '<div id="drh_list" style="display:'.$display.';">');
@@ -277,7 +277,7 @@ $group[] = $form->createElement('radio', 'send_mail', null, get_lang('No'), 0);
 $form->addGroup($group, 'mail', get_lang('SendMailToNewUser'));
 // Expiration Date
 $form->addElement('radio', 'radio_expiration_date', get_lang('ExpirationDate'), get_lang('NeverExpires'), 0);
-$group = array ();
+$group = array();
 $group[] = $form->createElement('radio', 'radio_expiration_date', null, get_lang('Enabled'), 1);
 $group[] = $form->createElement(
     'DateTimePicker',
@@ -306,7 +306,7 @@ $returnParams = $extraField->addElements(
 $jquery_ready_content = $returnParams['jquery_ready_content'];
 
 // the $jquery_ready_content variable collects all functions that will be load in the $(document).ready javascript function
-$htmlHeadXtra[] ='<script>
+$htmlHeadXtra[] = '<script>
 $(document).ready(function(){
 	'.$jquery_ready_content.'
 });
@@ -464,7 +464,7 @@ if ($form->validate()) {
     $form->setConstants(array('sec_token' => $token));
 }
 
-if (!empty($message)){
+if (!empty($message)) {
 	$message = Display::return_message(stripslashes($message));
 }
 $content = $form->returnForm();

+ 1 - 1
main/admin/user_update_import.php

@@ -261,7 +261,7 @@ function element_start($parser, $data)
     global $current_tag;
     switch ($data) {
         case 'Contact':
-            $user = array ();
+            $user = array();
             break;
         default:
             $current_tag = $data;

+ 35 - 37
main/document/document.php

@@ -76,10 +76,10 @@ if (
 $_user = api_get_user_info();
 $courseInfo = api_get_course_info();
 $courseId = $courseInfo['real_id'];
-$course_dir = $courseInfo['directory'] . '/document';
+$course_dir = $courseInfo['directory'].'/document';
 $sys_course_path = api_get_path(SYS_COURSE_PATH);
-$base_work_dir = $sys_course_path . $course_dir;
-$http_www = api_get_path(WEB_COURSE_PATH).$courseInfo['directory'] . '/document';
+$base_work_dir = $sys_course_path.$course_dir;
+$http_www = api_get_path(WEB_COURSE_PATH).$courseInfo['directory'].'/document';
 $document_path = $base_work_dir;
 $usePpt2lp = api_get_setting('service_ppt2lp', 'active') == 'true';
 $course_dir = $courseInfo['directory'].'/document';
@@ -279,7 +279,7 @@ switch ($action) {
                             $certificateId
                         );
                         Display::addFlash(Display::return_message(
-                            get_lang('DocDeleted') . ': ' . $documentInfo['title'],
+                            get_lang('DocDeleted').': '.$documentInfo['title'],
                             'success'
                         ));
                     } else {
@@ -482,11 +482,9 @@ switch ($action) {
     case 'convertToPdf':
         // PDF format as target by default
         $formatTarget = $_REQUEST['formatTarget'] ?
-            strtolower(Security::remove_XSS($_REQUEST['formatTarget'])) :
-            'pdf';
+            strtolower(Security::remove_XSS($_REQUEST['formatTarget'])) : 'pdf';
         $formatType = $_REQUEST['formatType'] ?
-            strtolower(Security::remove_XSS($_REQUEST['formatType'])) :
-            'text';
+            strtolower(Security::remove_XSS($_REQUEST['formatType'])) : 'text';
         // Get the document data from the ID
         $document_info = DocumentManager::get_document_data_by_id(
             $document_id,
@@ -494,8 +492,8 @@ switch ($action) {
             true,
             $session_id
         );
-        $file = $sys_course_path . $courseInfo['directory'] .
-            '/document' . $document_info['path'];
+        $file = $sys_course_path.$courseInfo['directory'].
+            '/document'.$document_info['path'];
         $fileInfo = pathinfo($file);
         if ($fileInfo['extension'] == $formatTarget) {
             Display::addFlash(Display::return_message(
@@ -526,9 +524,9 @@ switch ($action) {
                 'warning'
             ));
         } else {
-            $convertedFile = $fileInfo['dirname'] . DIRECTORY_SEPARATOR .
-                $fileInfo['filename'] . '_from_' . $fileInfo['extension'] .
-                '.' . $formatTarget;
+            $convertedFile = $fileInfo['dirname'].DIRECTORY_SEPARATOR.
+                $fileInfo['filename'].'_from_'.$fileInfo['extension'].
+                '.'.$formatTarget;
             $convertedTitle = $document_info['title'];
             $obj = new OpenofficePresentation(true);
             if (file_exists($convertedFile)) {
@@ -553,11 +551,11 @@ switch ($action) {
                     $gidReq = Security::remove_XSS($_GET['gidReq']);
                     $file_link = Display::url(
                         get_lang('SeeFile'),
-                        api_get_path(WEB_CODE_PATH) .
-                        'document/showinframes.php?'.api_get_cidreq_params($cidReq, $id_session, $gidReq).'&id=' . current($result)
+                        api_get_path(WEB_CODE_PATH).
+                        'document/showinframes.php?'.api_get_cidreq_params($cidReq, $id_session, $gidReq).'&id='.current($result)
                     );
                     Display::addFlash(Display::return_message(
-                        get_lang('CopyMade') . ' ' . $file_link,
+                        get_lang('CopyMade').' '.$file_link,
                         'confirmation',
                         false
                     ));
@@ -719,7 +717,7 @@ if (isset($_GET['curdirpath']) &&
             $new_content_html
         );
         $new_content_html = str_replace(
-            SYS_CODE_PATH . 'img/',
+            SYS_CODE_PATH.'img/',
             api_get_path(WEB_IMG_PATH),
             $new_content_html
         );
@@ -776,11 +774,11 @@ function convertModal (id, format) {
     $("#convertSelect").change(function() {
         var formatTarget = $(this).val();
         window.location.href = "'.
-            api_get_self() . '?' . api_get_cidreq() .
-            '&curdirpath=' . $curdirpath .
-            '&action=convertToPdf&formatTarget=' .
-            '" + formatTarget + "&id=" + id + "&' .
-            api_get_cidreq() . '&formatType=" + format;
+            api_get_self().'?'.api_get_cidreq().
+            '&curdirpath='.$curdirpath.
+            '&action=convertToPdf&formatTarget='.
+            '" + formatTarget + "&id=" + id + "&'.
+            api_get_cidreq().'&formatType=" + format;
     });
     $("#convertModal").on("hidden", function(){
         $("." + format + "FormatType").hide();
@@ -1120,7 +1118,7 @@ if ($isAllowedToEdit ||
                 DocumentManager::updateDbInfo(
                     'update',
                     $document_to_move['path'],
-                    $moveTo . '/' . basename($document_to_move['path'])
+                    $moveTo.'/'.basename($document_to_move['path'])
                 );
 
                 //update database item property
@@ -1238,7 +1236,7 @@ if ($isAllowedToEdit ||
                         )) {
                             $messages .= Display::return_message(get_lang('VisibilityChanged').': '.$data['title'], 'confirmation');
                         } else {
-                            $messages .=  Display::return_message(get_lang('ViModProb'), 'error');
+                            $messages .= Display::return_message(get_lang('ViModProb'), 'error');
                         }
                         break;
                     case 'delete':
@@ -1350,7 +1348,7 @@ if ($isAllowedToEdit ||
 
             if (!empty($newFolderData)) {
                 $message = Display::return_message(
-                    get_lang('DirCr') . ' ' . $newFolderData['title'],
+                    get_lang('DirCr').' '.$newFolderData['title'],
                     'confirmation'
                 );
             } else {
@@ -1433,27 +1431,27 @@ if ($isAllowedToEdit ||
         $document_id_for_template = intval($_GET['add_as_template']);
         // Create the form that asks for the directory name
         $templateForm .= '
-            <form name="set_document_as_new_template" class="form-horizontal" enctype="multipart/form-data" action="' . api_get_self() . '?add_as_template=' . $document_id_for_template . '" method="post">
+            <form name="set_document_as_new_template" class="form-horizontal" enctype="multipart/form-data" action="' . api_get_self().'?add_as_template='.$document_id_for_template.'" method="post">
                 <fieldset>
-                    <legend>' . get_lang('AddAsTemplate') . '</legend>
+                    <legend>' . get_lang('AddAsTemplate').'</legend>
                     <div class="form-group">
-                        <label for="template_title" class="col-sm-2 control-label">' . get_lang('TemplateName') . '</label>
+                        <label for="template_title" class="col-sm-2 control-label">' . get_lang('TemplateName').'</label>
                         <div class="col-sm-10">
                             <input type="text" class="form-control" id="template_title" name="template_title">
                         </div>
                     </div>
                     <div class="form-group">
-                        <label for="template_image" class="col-sm-2 control-label">' . get_lang('TemplateImage') . '</label>
+                        <label for="template_image" class="col-sm-2 control-label">' . get_lang('TemplateImage').'</label>
                         <div class="col-sm-10">
                             <input type="file" name="template_image" id="template_image">
                         </div>
                     </div>
                     <div class="form-group">
                         <div class="col-sm-offset-2 col-sm-10">
-                            <button type="submit" name="create_template" class="btn btn-primary">' . get_lang('CreateTemplate') . '</button>
+                            <button type="submit" name="create_template" class="btn btn-primary">' . get_lang('CreateTemplate').'</button>
                         </div>
                     </div>
-                    <input type="hidden" name="curdirpath" value="' . $curdirpath . '" />
+                    <input type="hidden" name="curdirpath" value="' . $curdirpath.'" />
                 </fieldset>
             </form>
             <hr>
@@ -1658,7 +1656,7 @@ if ($isAllowedToEdit ||
         if (api_get_setting('enable_record_audio') === 'true') {
             $actionsLeft .= Display::url(
                 Display::return_icon('new_recording.png', get_lang('RecordMyVoice'), '', ICON_SIZE_MEDIUM),
-                api_get_path(WEB_CODE_PATH) . 'document/record_audio.php?' . api_get_cidreq() . '&id=' . $document_id
+                api_get_path(WEB_CODE_PATH).'document/record_audio.php?'.api_get_cidreq().'&id='.$document_id
             );
         }
 
@@ -2129,18 +2127,18 @@ echo '
         <div class="modal-dialog">
             <div class="modal-content">
                 <div class="modal-header" style="text-align: center;">
-                <button type="button" class="close" data-dismiss="modal" aria-label="' . get_lang('Close') . '">
+                <button type="button" class="close" data-dismiss="modal" aria-label="' . get_lang('Close').'">
                     <span aria-hidden="true">&times;</span>
                 </button>
-                <h4 class="modal-title">' . get_lang('Convert') . '</h4>
+                <h4 class="modal-title">' . get_lang('Convert').'</h4>
             </div>
             <div class="modal-body">
               <form action="#" class="form-horizontal">
                   <div class="form-group">
-                      <label class="col-sm-4 control-label" for="convertSelect">' . get_lang('ConvertFormats') . '</label>
+                      <label class="col-sm-4 control-label" for="convertSelect">' . get_lang('ConvertFormats').'</label>
                       <div class="col-sm-8">
                           <select id="convertSelect">
-                              <option value="">' . get_lang('Select') . '</option>
+                              <option value="">' . get_lang('Select').'</option>
                               <option value="pdf">
                                   PDF - Portable Document File
                               </option>
@@ -2159,7 +2157,7 @@ echo '
               </form>
             </div>
             <div class="modal-footer">
-              <button type="button" class="btn btn-default" data-dismiss="modal">' . get_lang('Close') . '</button>
+              <button type="button" class="btn btn-default" data-dismiss="modal">' . get_lang('Close').'</button>
             </div>
         </div>
     </div>';

+ 14 - 14
main/exercise/answer.class.php

@@ -78,7 +78,7 @@ class Answer
         $objExercise->read($exerciseId);
 
         if ($objExercise->random_answers == '1' && $this->getQuestionType() != CALCULATED_ANSWER) {
-            $this->readOrderedBy('rand()', '');// randomize answers
+            $this->readOrderedBy('rand()', ''); // randomize answers
         } else {
             $this->read(); // natural order
         }
@@ -119,7 +119,7 @@ class Answer
                 ORDER BY position";
 
         $result = Database::query($sql);
-        $i=1;
+        $i = 1;
 
         // while a record is found
         while ($object = Database::fetch_object($result)) {
@@ -136,7 +136,7 @@ class Answer
             $this->iid[$i] = $object->iid;
             $i++;
         }
-        $this->nbrAnswers = $i-1;
+        $this->nbrAnswers = $i - 1;
     }
 
     /**
@@ -148,7 +148,7 @@ class Answer
     {
         foreach ($this->autoId as $key => $autoId) {
             if ($autoId == $id) {
-                $result =  [
+                $result = [
                     'answer' => $this->answer[$key],
                     'correct' => $this->correct[$key],
                     'comment' => $this->comment[$key],
@@ -172,7 +172,7 @@ class Answer
         $TBL_ANSWER = Database::get_course_table(TABLE_QUIZ_ANSWER);
         $questionId = $this->questionId;
 
-        $sql="SELECT id FROM
+        $sql = "SELECT id FROM
               $TBL_ANSWER
               WHERE c_id = {$this->course_id} AND question_id ='".$questionId."'";
 
@@ -195,14 +195,14 @@ class Answer
      * @param string $field
      * @author 	Frederic Vauthier
      */
-    public function readOrderedBy($field, $order='ASC')
+    public function readOrderedBy($field, $order = 'ASC')
     {
 		$field = Database::escape_string($field);
 		if (empty($field)) {
 			$field = 'position';
 		}
 
-		if ($order != 'ASC' && $order!='DESC') {
+		if ($order != 'ASC' && $order != 'DESC') {
 			$order = 'ASC';
 		}
 
@@ -238,7 +238,7 @@ class Answer
                     c_id = {$this->course_id} AND
                     question_id='".$questionId."'
                 ORDER BY $field $order";
-		$result=Database::query($sql);
+		$result = Database::query($sql);
 
 		$i = 1;
 		// while a record is found
@@ -274,7 +274,7 @@ class Answer
             $this->iid[$i] = $doubt_data->iid;
             $i++;
 	    }
-        $this->nbrAnswers = $i-1;
+        $this->nbrAnswers = $i - 1;
 	}
 
 	/**
@@ -418,8 +418,8 @@ class Answer
     public function getGradesList()
      {
 	 	$list = array();
-	 	for ($i = 0; $i<$this->nbrAnswers;$i++){
-	 		if(!empty($this->answer[$i])){
+	 	for ($i = 0; $i < $this->nbrAnswers; $i++) {
+	 		if (!empty($this->answer[$i])) {
 	 			$list[$i] = $this->weighting[$i];
 	 		}
 	 	}
@@ -437,7 +437,7 @@ class Answer
 	 	$sql = "SELECT type FROM $TBL_QUESTIONS
 	 	        WHERE c_id = {$this->course_id} AND id = '".$this->questionId."'";
 	 	$res = Database::query($sql);
-	 	if (Database::num_rows($res)<=0){
+	 	if (Database::num_rows($res) <= 0) {
 	 		return null;
 	 	}
 	 	$row = Database::fetch_array($res);
@@ -614,7 +614,7 @@ class Answer
         $correctList = [];
         $answerList = [];
 
-		for ($i=1; $i <= $this->new_nbrAnswers; $i++) {
+		for ($i = 1; $i <= $this->new_nbrAnswers; $i++) {
 			$answer = $this->new_answer[$i];
 			$correct = isset($this->new_correct[$i]) ? $this->new_correct[$i] : '';
 			$comment = isset($this->new_comment[$i]) ? $this->new_comment[$i] : '';
@@ -787,7 +787,7 @@ class Answer
             );
             $i = 0;
             if (!empty($destination_options)) {
-                foreach($destination_options as $item) {
+                foreach ($destination_options as $item) {
                     $fixed_list[$new_option_list[$i]] = $item['id'];
                     $i++;
                 }

+ 15 - 15
main/exercise/oral_expression.class.php

@@ -105,7 +105,7 @@ class OralExpression extends Question
         }
         $this->storePath = $this->generateDirectory();
         $this->fileName = $this->generateFileName();
-        $this->filePath = $this->storePath . $this->fileName;
+        $this->filePath = $this->storePath.$this->fileName;
     }
 
     /**
@@ -114,26 +114,26 @@ class OralExpression extends Question
      */
     private function generateDirectory()
     {
-        $this->storePath = api_get_path(SYS_COURSE_PATH) . $this->course['path'] . '/exercises/';
+        $this->storePath = api_get_path(SYS_COURSE_PATH).$this->course['path'].'/exercises/';
 
         if (!is_dir($this->storePath)) {
             mkdir($this->storePath);
         }
 
-        if (!is_dir($this->storePath . $this->sessionId)) {
-            mkdir($this->storePath . $this->sessionId);
+        if (!is_dir($this->storePath.$this->sessionId)) {
+            mkdir($this->storePath.$this->sessionId);
         }
 
-        if (!empty($this->exerciseId) && !is_dir($this->storePath . $this->sessionId . '/' . $this->exerciseId)) {
-            mkdir($this->storePath . $this->sessionId . '/' . $this->exerciseId);
+        if (!empty($this->exerciseId) && !is_dir($this->storePath.$this->sessionId.'/'.$this->exerciseId)) {
+            mkdir($this->storePath.$this->sessionId.'/'.$this->exerciseId);
         }
 
-        if (!empty($this->id) && !is_dir($this->storePath . $this->sessionId . '/' . $this->exerciseId . '/' . $this->id)) {
-            mkdir($this->storePath . $this->sessionId . '/' . $this->exerciseId . '/' . $this->id);
+        if (!empty($this->id) && !is_dir($this->storePath.$this->sessionId.'/'.$this->exerciseId.'/'.$this->id)) {
+            mkdir($this->storePath.$this->sessionId.'/'.$this->exerciseId.'/'.$this->id);
         }
 
-        if (!empty($this->userId) && !is_dir($this->storePath . $this->sessionId . '/' . $this->exerciseId . '/' . $this->id . '/' . $this->userId)) {
-            mkdir($this->storePath . $this->sessionId . '/' . $this->exerciseId . '/' . $this->id . '/' . $this->userId);
+        if (!empty($this->userId) && !is_dir($this->storePath.$this->sessionId.'/'.$this->exerciseId.'/'.$this->id.'/'.$this->userId)) {
+            mkdir($this->storePath.$this->sessionId.'/'.$this->exerciseId.'/'.$this->id.'/'.$this->userId);
         }
 
         $params = [
@@ -192,7 +192,7 @@ class OralExpression extends Question
      */
     public function returnRecorder()
     {
-        $directory = '/..' . $this->generateRelativeDirectory();
+        $directory = '/..'.$this->generateRelativeDirectory();
         $recordAudioView = new Template(
             '',
             false,
@@ -246,7 +246,7 @@ class OralExpression extends Question
                     return '';
                 }
 
-                return $this->storePath . $result->getFilename();
+                return $this->storePath.$result->getFilename();
             }
         }
 
@@ -305,12 +305,12 @@ class OralExpression extends Question
             $items[5] = 'temp_exe';
             $filename = implode('-', $items);
 
-            if (is_file($this->storePath . $filename . '.' . $extension)) {
-                $old_name = $this->storePath . $filename . '.' . $extension;
+            if (is_file($this->storePath.$filename.'.'.$extension)) {
+                $old_name = $this->storePath.$filename.'.'.$extension;
                 $items = explode('-', $this->fileName);
                 $items[5] = $exe_id;
                 $filename = $filename = implode('-', $items);
-                $new_name = $this->storePath . $filename . '.' . $extension;
+                $new_name = $this->storePath.$filename.'.'.$extension;
                 rename($old_name, $new_name);
                 break;
             }

+ 8 - 8
main/exercise/stats.php

@@ -68,13 +68,13 @@ if (!empty($question_list)) {
         $data[$question_id]['type'] = $question_obj->get_question_type_name();
         $percentange = 0;
         if ($count_students) {
-            $percentange = $count_users / $count_students*100;
+            $percentange = $count_users / $count_students * 100;
         }
 
         $data[$question_id]['students_who_try_exercise'] = Display::bar_progress(
             $percentange,
             false,
-            $count_users .' / '.$count_students
+            $count_users.' / '.$count_students
         );
         $data[$question_id]['lowest_score'] = round($exercise_stats['min'], 2);
         $data[$question_id]['average_score'] = round($exercise_stats['average'], 2);
@@ -152,7 +152,7 @@ if (!empty($question_list)) {
                         $data[$id]['answer'] = $answer_item;
 
                         $answer_item = api_substr($answer_item, 1);
-                        $answer_item = api_substr($answer_item, 0, api_strlen($answer_item) -1);
+                        $answer_item = api_substr($answer_item, 0, api_strlen($answer_item) - 1);
 
                         $data[$id]['answer'] = $answer_item;
                         $data[$id]['correct'] = '-';
@@ -162,7 +162,7 @@ if (!empty($question_list)) {
 
                         $percentage = 0;
                         if (!empty($count_students)) {
-                            $percentage = $count/$count_students*100;
+                            $percentage = $count / $count_students * 100;
                         }
                         $data[$id]['attempts'] = Display::bar_progress(
                             $percentage,
@@ -203,7 +203,7 @@ if (!empty($question_list)) {
                         );
                         $percentage = 0;
                         if (!empty($count_students)) {
-                            $percentage = $count/$count_students*100;
+                            $percentage = $count / $count_students * 100;
                         }
                         $data[$id]['attempts'] = Display::bar_progress(
                             $percentage,
@@ -230,7 +230,7 @@ if (!empty($question_list)) {
                     );
                     $percentage = 0;
                     if (!empty($count_students)) {
-                        $percentage = $count/$count_students*100;
+                        $percentage = $count / $count_students * 100;
                     }
                     $data[$id]['attempts'] = Display::bar_progress(
                         $percentage,
@@ -256,7 +256,7 @@ if (!empty($question_list)) {
                     );
                     $percentage = 0;
                     if (!empty($count_students)) {
-                        $percentage = $count/$count_students*100;
+                        $percentage = $count / $count_students * 100;
                     }
                     $data[$id]['attempts'] = Display::bar_progress(
                         $percentage,
@@ -300,7 +300,7 @@ $interbreadcrumb[] = array(
 );
 
 $tpl = new Template(get_lang('ReportByQuestion'));
-$actions = '<a href="exercise_report.php?exerciseId='.intval($_GET['exerciseId']).'&'.api_get_cidreq().'">' .
+$actions = '<a href="exercise_report.php?exerciseId='.intval($_GET['exerciseId']).'&'.api_get_cidreq().'">'.
     Display:: return_icon(
         'back.png',
         get_lang('GoBackToQuestionList'),

+ 5 - 5
main/gradebook/exercise_jump.php

@@ -23,7 +23,7 @@ $type = Security::remove_XSS($_GET['type']);
 $doExerciseUrl = '';
 
 if (isset($_GET['doexercise'])) {
-    $doExerciseUrl = api_get_path(WEB_CODE_PATH) . 'exercise/overview.php?' . http_build_query([
+    $doExerciseUrl = api_get_path(WEB_CODE_PATH).'exercise/overview.php?'.http_build_query([
         'session_id' => $session_id,
         'cidReq' => $cidReq,
         'gradebook' => $gradebook,
@@ -38,7 +38,7 @@ if (isset($_GET['doexercise'])) {
 if ($type == LINK_HOTPOTATOES) {
     $exerciseId = $_GET['exerciseId'];
     $path = Security::remove_XSS($_GET['path']);
-    $doExerciseUrl = api_get_path(WEB_CODE_PATH) . 'exercise/showinframes.php?'.http_build_query([
+    $doExerciseUrl = api_get_path(WEB_CODE_PATH).'exercise/showinframes.php?'.http_build_query([
         'session_id' => $session_id,
         'cidReq' => Security::remove_XSS($cidReq),
         'file' => $path,
@@ -53,7 +53,7 @@ if (isset($_GET['doexercise'])) {
     header('Location: '.$doExerciseUrl);
     exit;
 } else {
-    $url = api_get_path(WEB_CODE_PATH) . 'exercise/overview.php?session_id='.$session_id.'&cidReq='.Security::remove_XSS($cidReq);
+    $url = api_get_path(WEB_CODE_PATH).'exercise/overview.php?session_id='.$session_id.'&cidReq='.Security::remove_XSS($cidReq);
     if (isset($_GET['gradebook'])) {
         $url .= '&gradebook=view&exerciseId='.intval($_GET['exerciseId']);
 
@@ -69,11 +69,11 @@ if (isset($_GET['doexercise'])) {
                         // If the exercise was added once redirect to the LP
                         $firstLp = current($exercise->lpList);
                         if (isset($firstLp['lp_id'])) {
-                            $url = api_get_path(WEB_CODE_PATH) . 'lp/lp_controller.php?' . api_get_cidreq() . '&lp_id=' . $firstLp['lp_id'] . '&action=view&isStudentView=true';
+                            $url = api_get_path(WEB_CODE_PATH).'lp/lp_controller.php?'.api_get_cidreq().'&lp_id='.$firstLp['lp_id'].'&action=view&isStudentView=true';
                         }
                     } else {
                         // If the exercise was added multiple times show the LP list
-                        $url = api_get_path(WEB_CODE_PATH) . 'lp/lp_controller.php?' . api_get_cidreq().'&action=list';
+                        $url = api_get_path(WEB_CODE_PATH).'lp/lp_controller.php?'.api_get_cidreq().'&action=list';
                     }
                 }
             }

+ 2 - 2
main/gradebook/gradebook_edit_cat.php

@@ -80,12 +80,12 @@ if ($form->validate()) {
         $cat->setIsRequirement(false);
     }
     $cat->save();
-    header('Location: '.Security::remove_XSS($_SESSION['gradebook_dest']).'?editcat=&selectcat=' . $cat->get_parent_id().'&'.api_get_cidreq());
+    header('Location: '.Security::remove_XSS($_SESSION['gradebook_dest']).'?editcat=&selectcat='.$cat->get_parent_id().'&'.api_get_cidreq());
     exit;
 }
 $selectcat = isset($_GET['selectcat']) ? (int) $_GET['selectcat'] : '';
 $interbreadcrumb[] = array(
-    'url' => Security::remove_XSS($_SESSION['gradebook_dest']) . '?selectcat=' . $selectcat . '&' . api_get_cidreq(),
+    'url' => Security::remove_XSS($_SESSION['gradebook_dest']).'?selectcat='.$selectcat.'&'.api_get_cidreq(),
     'name' => get_lang('Gradebook')
 );
 $this_section = SECTION_COURSES;

+ 3 - 3
main/gradebook/gradebook_edit_eval.php

@@ -20,7 +20,7 @@ $form = new EvalForm(
     null,
     'edit_eval_form',
     null,
-    api_get_self() . '?editeval=' . intval($_GET['editeval']).'&'.api_get_cidreq()
+    api_get_self().'?editeval='.intval($_GET['editeval']).'&'.api_get_cidreq()
 );
 if ($form->validate()) {
     $values = $form->exportValues();
@@ -44,10 +44,10 @@ if ($form->validate()) {
     }
     $eval->set_visible($visible);
     $eval->save();
-    header('Location: '.$_SESSION['gradebook_dest'].'?editeval=&selectcat=' . $eval->get_category_id().'&'.api_get_cidreq());
+    header('Location: '.$_SESSION['gradebook_dest'].'?editeval=&selectcat='.$eval->get_category_id().'&'.api_get_cidreq());
     exit;
 }
-$selectcat_inter=isset($_GET['selectcat']) ? (int) $_GET['selectcat'] : 0;
+$selectcat_inter = isset($_GET['selectcat']) ? (int) $_GET['selectcat'] : 0;
 $interbreadcrumb[] = array(
     'url' => $_SESSION['gradebook_dest'].'?selectcat='.$selectcat_inter,
     'name' => get_lang('Gradebook'

+ 9 - 9
main/gradebook/lib/be/exerciselink.class.php

@@ -51,8 +51,8 @@ class ExerciseLink extends AbstractLink
 
         $result = Database::query($sql);
         $cats = array();
-        while ($data=Database::fetch_array($result)) {
-            $cats[] = array ($data['id'], $data['title']);
+        while ($data = Database::fetch_array($result)) {
+            $cats[] = array($data['id'], $data['title']);
         }
 
         return $cats;
@@ -124,8 +124,8 @@ class ExerciseLink extends AbstractLink
         $cats = array();
         if (isset($result)) {
             if (Database::num_rows($result) > 0) {
-                while ($data=Database::fetch_array($result)) {
-                    $cats[] = array ($data['id'], $data['title']);
+                while ($data = Database::fetch_array($result)) {
+                    $cats[] = array($data['id'], $data['title']);
                 }
             }
         }
@@ -182,9 +182,9 @@ class ExerciseLink extends AbstractLink
                 WHERE
                     session_id = $session_id AND
                     c_id = $course_id AND
-                    exe_exo_id   = ".(int)$this->get_ref_id();
+                    exe_exo_id   = ".(int) $this->get_ref_id();
         $result = Database::query($sql);
-        $number=Database::fetch_row($result);
+        $number = Database::fetch_row($result);
 
         return ($number[0] != 0);
     }
@@ -270,7 +270,7 @@ class ExerciseLink extends AbstractLink
         } else {
             // all students -> get average
             // normal way of getting the info
-            $students = array();  // user list, needed to make sure we only
+            $students = array(); // user list, needed to make sure we only
             // take first attempts into account
             $student_count = 0;
             $sum = 0;
@@ -305,7 +305,7 @@ class ExerciseLink extends AbstractLink
                         if (empty($count)) {
                             return array(0, $weight);
                         }
-                        return array($sumResult/$count , $weight);
+                        return array($sumResult / $count, $weight);
                         break;
                     case 'ranking':
                         return AbstractLink::getCurrentUserRanking($stud_id, $students);
@@ -385,7 +385,7 @@ class ExerciseLink extends AbstractLink
                 FROM '.$this->get_exercise_table().'
                 WHERE 
                     c_id = '.$this->course_id.' AND 
-                    id = '.(int)$this->get_ref_id().' ';
+                    id = '.(int) $this->get_ref_id().' ';
         $result = Database::query($sql);
         $number = Database::fetch_row($result);
 

+ 4 - 4
main/gradebook/lib/fe/linkaddeditform.class.php

@@ -130,9 +130,9 @@ class LinkAddEditForm extends FormValidator
                 //var_dump($global_weight, $link->get_weight(), $parent_cat[0]->get_weight());
                 //$weight = $parent_cat[0]->get_weight()* $link->get_weight() / $global_weight;
                 //$values['weight'] = $weight;
-                $values['weight'] = $link->get_weight() ;
+                $values['weight'] = $link->get_weight();
             }
-            $defaults['weight_mask'] = $values['weight'] ;
+            $defaults['weight_mask'] = $values['weight'];
             $defaults['select_gradebook'] = $link->get_category_id();
 
         }
@@ -150,7 +150,7 @@ class LinkAddEditForm extends FormValidator
                     )
                 );
             } else {
-                $this->addText('max', get_lang('QualificationNumeric'), true, array ('size' => '4','maxlength' => '5'));
+                $this->addText('max', get_lang('QualificationNumeric'), true, array('size' => '4', 'maxlength' => '5'));
                 $this->addRule('max', get_lang('OnlyNumbers'), 'numeric');
                 $this->addRule('max', get_lang('NegativeValue'), 'compare', '>=');
             }
@@ -196,7 +196,7 @@ class LinkAddEditForm extends FormValidator
             if (isset($setting['gradebook']) && $setting['gradebook'] == 'false') {
                 $visibility_default = 0;
             }
-            $defaults['visible']  = $visibility_default;
+            $defaults['visible'] = $visibility_default;
         }
 
         // set default values

+ 4 - 4
main/inc/ajax/chat.ajax.php

@@ -5,7 +5,7 @@
  * Responses to AJAX calls
  */
 
-$_dont_save_user_course_access  = true;
+$_dont_save_user_course_access = true;
 
 require_once __DIR__.'/../global.inc.php';
 
@@ -26,7 +26,7 @@ if (api_get_setting('allow_global_chat') == 'false') {
 }
 
 $to_user_id = isset($_REQUEST['to']) ? $_REQUEST['to'] : null;
-$message	= isset($_REQUEST['message']) ? $_REQUEST['message'] : null;
+$message = isset($_REQUEST['message']) ? $_REQUEST['message'] : null;
 
 if (!isset($_SESSION['chatHistory'])) {
     $_SESSION['chatHistory'] = array();
@@ -77,9 +77,9 @@ switch ($action) {
             $room = VideoChat::getChatRoomByUsers(api_get_user_id(), $to_user_id);
         }
 
-        $videoChatUrl = api_get_path(WEB_LIBRARY_JS_PATH) . "chat/video.php?room={$room['id']}";
+        $videoChatUrl = api_get_path(WEB_LIBRARY_JS_PATH)."chat/video.php?room={$room['id']}";
         $videoChatLink = Display::url(
-            Display::returnFontAwesomeIcon('video-camera') . get_lang('StartVideoChat'),
+            Display::returnFontAwesomeIcon('video-camera').get_lang('StartVideoChat'),
             $videoChatUrl
         );
 

+ 13 - 13
main/inc/ajax/exercise.ajax.php

@@ -32,10 +32,10 @@ switch ($action) {
         $exercise_id = intval($_GET['exercise_id']);
         $page = intval($_REQUEST['page']); //page
         $limit = intval($_REQUEST['rows']); //quantity of rows
-        $sidx = $_REQUEST['sidx'];         //index to filter
-        $sord = $_REQUEST['sord'];         //asc or desc
+        $sidx = $_REQUEST['sidx']; //index to filter
+        $sord = $_REQUEST['sord']; //asc or desc
 
-        if (!in_array($sord, array('asc','desc'))) {
+        if (!in_array($sord, array('asc', 'desc'))) {
             $sord = 'desc';
         }
         // get index row - i.e. user click to sort $sord = $_GET['sord'];
@@ -64,7 +64,7 @@ switch ($action) {
         $total_pages = 0;
         if ($count > 0) {
             if (!empty($limit)) {
-                $total_pages = ceil($count/$limit);
+                $total_pages = ceil($count / $limit);
             }
         }
 
@@ -126,7 +126,7 @@ switch ($action) {
         $response->page = $page;
         $response->total = $total_pages;
         $response->records = $count;
-        $i=0;
+        $i = 0;
 
         if (!empty($results)) {
             foreach ($results as $row) {
@@ -149,16 +149,16 @@ switch ($action) {
                 $row['count_questions'] = $count_questions;
 
                 $response->rows[$i]['id'] = $row['exe_id'];
-                $remaining = strtotime($row['start_date'])+($oExe->expired_time*60) - strtotime(api_get_utc_datetime(time()));
-                $h = floor($remaining/3600);
-                $m = floor(($remaining - ($h*3600))/60);
-                $s = ($remaining - ($h*3600) - ($m*60));
+                $remaining = strtotime($row['start_date']) + ($oExe->expired_time * 60) - strtotime(api_get_utc_datetime(time()));
+                $h = floor($remaining / 3600);
+                $m = floor(($remaining - ($h * 3600)) / 60);
+                $s = ($remaining - ($h * 3600) - ($m * 60));
                 $array = array(
                     $row['firstname'],
                     $row['lastname'],
-                    api_format_date($row['start_date'], DATE_TIME_FORMAT_LONG).' ['.($h>0?$h.':':'').sprintf("%02d",$m).':'.sprintf("%02d",$s).']',
+                    api_format_date($row['start_date'], DATE_TIME_FORMAT_LONG).' ['.($h > 0 ? $h.':' : '').sprintf("%02d", $m).':'.sprintf("%02d", $s).']',
                     $row['count_questions'],
-                    round($row['score']*100).'%'
+                    round($row['score'] * 100).'%'
                 );
                 $response->rows[$i]['cell'] = $array;
                 $i++;
@@ -363,7 +363,7 @@ switch ($action) {
 
                 // Getting free choice data.
                 if (
-                    ($objQuestionTmp->type  == FREE_ANSWER || $objQuestionTmp->type  == ORAL_EXPRESSION)
+                    ($objQuestionTmp->type == FREE_ANSWER || $objQuestionTmp->type == ORAL_EXPRESSION)
                     && $type == 'all'
                 ) {
                     $my_choice = isset($_REQUEST['free_choice'][$my_question_id]) && !empty($_REQUEST['free_choice'][$my_question_id])
@@ -531,7 +531,7 @@ switch ($action) {
         $objQuestion = Question::read($questionId);
         $objQuestion->get_question_type_name();
 
-        echo '<p class="lead">' . $objQuestion->get_question_type_name() . '</p>';
+        echo '<p class="lead">'.$objQuestion->get_question_type_name().'</p>';
         //echo get_lang('Level').': '.$objQuestionTmp->selectLevel();
         ExerciseLib::showQuestion(
             $questionId,

+ 1 - 1
main/lp/download.php

@@ -24,7 +24,7 @@ $doc_url = str_replace(' ', '+', $doc_url);
 
 $doc_url = str_replace(array('../', '\\..', '\\0', '..\\'), array('', '', '', ''), $doc_url); //echo $doc_url;
 
-if (strpos($doc_url,'../') || strpos($doc_url,'/..')) {
+if (strpos($doc_url, '../') || strpos($doc_url, '/..')) {
     $doc_url = '';
 }
 $sys_course_path = api_get_path(SYS_COURSE_PATH).$_course['path'].'/scorm';

+ 3 - 3
main/lp/learnpathList.class.php

@@ -117,8 +117,8 @@ class LearnpathList
             // it prevents ' to be slashed and the input (done by learnpath.class.php::toggle_visibility())
             // is done using domesticate()
             $name = domesticate($row->getName());
-            $link = 'lp/lp_controller.php?action=view&lp_id=' . $row->getId() . '&id_session='.$session_id;
-            $oldLink = 'newscorm/lp_controller.php?action=view&lp_id=' . $row->getId() . '&id_session='.$session_id;
+            $link = 'lp/lp_controller.php?action=view&lp_id='.$row->getId().'&id_session='.$session_id;
+            $oldLink = 'newscorm/lp_controller.php?action=view&lp_id='.$row->getId().'&id_session='.$session_id;
 
             $sql2 = "SELECT * FROM $tbl_tool
                      WHERE
@@ -236,7 +236,7 @@ class LearnpathList
 
         $lessons = array();
         while ($row = Database::fetch_array($result)) {
-            if (api_get_item_visibility($course, 'learnpath', $row['id'],  $session_id)) {
+            if (api_get_item_visibility($course, 'learnpath', $row['id'], $session_id)) {
                 $lessons[$row['id']] = $row;
             }
         }

+ 14 - 14
main/mySpace/lp_tracking.php

@@ -17,7 +17,7 @@ if (isset($_GET['from']) && $_GET['from'] == 'myspace') {
 	$this_section = SECTION_COURSES;
 }
 
-$session_id  = isset($_REQUEST['id_session']) && !empty($_REQUEST['id_session']) ? intval($_REQUEST['id_session']) : api_get_session_id();
+$session_id = isset($_REQUEST['id_session']) && !empty($_REQUEST['id_session']) ? intval($_REQUEST['id_session']) : api_get_session_id();
 $export_csv = isset($_GET['export']) && $_GET['export'] == 'csv' ? true : false;
 $user_id = isset($_GET['student_id']) ? intval($_GET['student_id']) : api_get_user_id();
 $courseCode = isset($_GET['course']) ? Security::remove_XSS($_GET['course']) : api_get_course_id();
@@ -40,15 +40,15 @@ if (!api_is_platform_admin(true) &&
 }
 
 if ($origin == 'user_course') {
-	$interbreadcrumb[] = array ("url" => api_get_path(WEB_COURSE_PATH).$course_info['directory'], 'name' => $course_info['name']);
-	$interbreadcrumb[] = array ("url" => "../user/user.php?cidReq=".$courseCode, "name" => get_lang("Users"));
-} else if($origin == 'tracking_course') {
-	$interbreadcrumb[] = array ("url" => "../tracking/courseLog.php?cidReq=".$courseCode.'&id_session='.$session_id, "name" => get_lang("Tracking"));
+	$interbreadcrumb[] = array("url" => api_get_path(WEB_COURSE_PATH).$course_info['directory'], 'name' => $course_info['name']);
+	$interbreadcrumb[] = array("url" => "../user/user.php?cidReq=".$courseCode, "name" => get_lang("Users"));
+} else if ($origin == 'tracking_course') {
+	$interbreadcrumb[] = array("url" => "../tracking/courseLog.php?cidReq=".$courseCode.'&id_session='.$session_id, "name" => get_lang("Tracking"));
 } else {
-	$interbreadcrumb[] = array ("url" => "index.php", "name" => get_lang('MySpace'));
-	$interbreadcrumb[] = array ("url" => "student.php", "name" => get_lang("MyStudents"));
- 	$interbreadcrumb[] = array ("url" => "myStudents.php?student=".$user_id, "name" => get_lang("StudentDetails"));
- 	$nameTools=get_lang("DetailsStudentInCourse");
+	$interbreadcrumb[] = array("url" => "index.php", "name" => get_lang('MySpace'));
+	$interbreadcrumb[] = array("url" => "student.php", "name" => get_lang("MyStudents"));
+ 	$interbreadcrumb[] = array("url" => "myStudents.php?student=".$user_id, "name" => get_lang("StudentDetails"));
+ 	$nameTools = get_lang("DetailsStudentInCourse");
 }
 
 $interbreadcrumb[] = array(
@@ -63,19 +63,19 @@ $lp_title = Database::result($rs, 0, 0);
 
 $origin = 'tracking';
 
-$output = require_once api_get_path(SYS_CODE_PATH) . 'lp/lp_stats.php';
+$output = require_once api_get_path(SYS_CODE_PATH).'lp/lp_stats.php';
 
 Display :: display_header($nameTools);
 echo '<div class ="actions">';
-echo '<a href="javascript:history.back();">'.Display::return_icon('back.png',get_lang('Back'),'',ICON_SIZE_MEDIUM).'</a>';
+echo '<a href="javascript:history.back();">'.Display::return_icon('back.png', get_lang('Back'), '', ICON_SIZE_MEDIUM).'</a>';
 echo '<a href="javascript: void(0);" onclick="javascript: window.print();">
-        '.Display::return_icon('printer.png',get_lang('Print'),'',ICON_SIZE_MEDIUM).'</a>';
+        '.Display::return_icon('printer.png', get_lang('Print'), '', ICON_SIZE_MEDIUM).'</a>';
 echo '<a href="'.api_get_self().'?export=csv&'.Security::remove_XSS($_SERVER['QUERY_STRING']).'">
-        '.Display::return_icon('export_csv.png',get_lang('ExportAsCSV'),'',ICON_SIZE_MEDIUM).'</a>';
+        '.Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), '', ICON_SIZE_MEDIUM).'</a>';
 echo '</div>';
 echo '<div class="clear"></div>';
 $session_name = api_get_session_name($session_id);
-$table_title = ($session_name? Display::return_icon('session.png', get_lang('Session'), array(), ICON_SIZE_SMALL).' '.$session_name.' ':' ').
+$table_title = ($session_name ? Display::return_icon('session.png', get_lang('Session'), array(), ICON_SIZE_SMALL).' '.$session_name.' ' : ' ').
     Display::return_icon('course.png', get_lang('Course'), array(), ICON_SIZE_SMALL).' '.$course_info['name'].' '.
     Display::return_icon('user.png', get_lang('User'), array(), ICON_SIZE_SMALL).' '.$name;
 echo Display::page_header($table_title);

+ 5 - 5
main/session/about.php

@@ -167,8 +167,8 @@ $courseController = new CoursesController();
 
 /* View */
 $template = new Template($session->getName(), true, true, false, true, false);
-$template->assign('show_tutor', (api_get_setting('show_session_coach')==='true' ? true : false));
-$template->assign('page_url', api_get_path(WEB_PATH) . "session/{$session->getId()}/about/");
+$template->assign('show_tutor', (api_get_setting('show_session_coach') === 'true' ? true : false));
+$template->assign('page_url', api_get_path(WEB_PATH)."session/{$session->getId()}/about/");
 $template->assign('session', $session);
 $template->assign('session_date', $sessionDates);
 $template->assign(
@@ -213,15 +213,15 @@ if ($checker) {
 }
 
 $redirectToSession = api_get_configuration_value('allow_redirect_to_session_after_inscription_about');
-$redirectToSession = $redirectToSession ? '?s=' . $sessionId : false;
+$redirectToSession = $redirectToSession ? '?s='.$sessionId : false;
 
 $coursesInThisSession = SessionManager::get_course_list_by_session_id($sessionId);
 $coursesCount = count($coursesInThisSession);
-$redirectToSession = $coursesCount == 1 && $redirectToSession ? $redirectToSession . '&cr=' . array_values($coursesInThisSession)[0]['directory'] : $redirectToSession;
+$redirectToSession = $coursesCount == 1 && $redirectToSession ? $redirectToSession.'&cr='.array_values($coursesInThisSession)[0]['directory'] : $redirectToSession;
 
 $template->assign('redirect_to_session', $redirectToSession);
 $template->assign('courses', $courses);
-$essence =  Essence\Essence::instance();
+$essence = Essence\Essence::instance();
 $template->assign('essence', $essence);
 $template->assign(
     'session_extra_fields',

+ 6 - 6
main/session/resume_session.php

@@ -30,7 +30,7 @@ SessionManager::protectSession($sessionId);
 $tool_name = get_lang('SessionOverview');
 
 //$interbreadcrumb[] = array('url' => 'index.php','name' => get_lang('PlatformAdmin'));
-$interbreadcrumb[] = array('url' => 'session_list.php','name' => get_lang('SessionList'));
+$interbreadcrumb[] = array('url' => 'session_list.php', 'name' => get_lang('SessionList'));
 
 $orig_param = '&origin=resume_session';
 
@@ -184,7 +184,7 @@ if ($sessionInfo['nbr_courses'] == 0) {
 
         $coachs = array();
         if (Database::num_rows($rs) > 0) {
-            while($info_coach = Database::fetch_array($rs)) {
+            while ($info_coach = Database::fetch_array($rs)) {
                 $coachs[] = api_get_person_name(
                         $info_coach['firstname'],
                         $info_coach['lastname']
@@ -195,7 +195,7 @@ if ($sessionInfo['nbr_courses'] == 0) {
         }
 
         if (count($coachs) > 0) {
-            $coach = implode('<br />',$coachs);
+            $coach = implode('<br />', $coachs);
         } else {
             $coach = get_lang('None');
         }
@@ -218,7 +218,7 @@ if ($sessionInfo['nbr_courses'] == 0) {
         $downIcon = 'down.png';
         $downUrl = api_get_self().'?id_session='.$sessionId.'&course_id='.$course->getId().'&action=move_down';
 
-        if ($count +1 == count($courses)) {
+        if ($count + 1 == count($courses)) {
             $downIcon = 'down_na.png';
             $downUrl = '#';
         }
@@ -245,7 +245,7 @@ if ($sessionInfo['nbr_courses'] == 0) {
 			<td>'.$coach.'</td>
 			<td>'.$numberOfUsers.'</td>
 			<td>
-                <a href="'. $courseUrl . '">'.
+                <a href="'. $courseUrl.'">'.
                 Display::return_icon('course_home.gif', get_lang('Course')).'</a>
                 '.$orderButtons.'
                 <a href="session_course_user_list.php?id_session='.$sessionId.'&course_code='.$course->getCode().'">'.
@@ -317,7 +317,7 @@ if (!empty($userList)) {
             array('onclick' => "javascript:if(!confirm('".get_lang('ConfirmYourChoice')."')) return false;")
         );
 
-        $addUserToUrlLink= '';
+        $addUserToUrlLink = '';
         if ($multiple_url_is_on) {
             if ($user['access_url_id'] != $url_id) {
                 $userLink .= ' '.Display::return_icon(

+ 59 - 59
main/social/profile.php

@@ -58,9 +58,9 @@ if (!empty($_POST['social_wall_new_msg_main']) || !empty($_FILES['picture']['tmp
 
     Display::addFlash(Display::return_message(get_lang('MessageSent')));
 
-    $url = api_get_path(WEB_CODE_PATH) . 'social/profile.php';
+    $url = api_get_path(WEB_CODE_PATH).'social/profile.php';
     $url .= empty($_SERVER['QUERY_STRING']) ? '' : '?'.Security::remove_XSS($_SERVER['QUERY_STRING']);
-    header('Location: ' . $url);
+    header('Location: '.$url);
     exit;
 
 } else if (!empty($_POST['social_wall_new_msg']) && !empty($_POST['messageId'])) {
@@ -75,9 +75,9 @@ if (!empty($_POST['social_wall_new_msg_main']) || !empty($_FILES['picture']['tmp
         MESSAGE_STATUS_WALL
     );
     Display::addFlash(Display::return_message(get_lang('MessageSent')));
-    $url = api_get_path(WEB_CODE_PATH) . 'social/profile.php';
+    $url = api_get_path(WEB_CODE_PATH).'social/profile.php';
     $url .= empty($_SERVER['QUERY_STRING']) ? '' : '?'.Security::remove_XSS($_SERVER['QUERY_STRING']);
-    header('Location: ' . $url);
+    header('Location: '.$url);
     exit;
 
 } else if (isset($_GET['messageId'])) {
@@ -89,7 +89,7 @@ if (!empty($_POST['social_wall_new_msg_main']) || !empty($_FILES['picture']['tmp
             $status = SocialManager::deleteMessage($messageId);
 
             Display::addFlash(Display::return_message(get_lang('MessageDeleted')));
-            header('Location: ' . api_get_path(WEB_CODE_PATH) . 'social/profile.php');
+            header('Location: '.api_get_path(WEB_CODE_PATH).'social/profile.php');
             exit;
         }
     }
@@ -153,16 +153,16 @@ $libpath = api_get_path(LIBRARY_PATH);
 
 $ajax_url = api_get_path(WEB_AJAX_PATH).'message.ajax.php';
 $socialAjaxUrl = api_get_path(WEB_AJAX_PATH).'social.ajax.php';
-$javascriptDir = api_get_path(LIBRARY_PATH) . 'javascript/';
+$javascriptDir = api_get_path(LIBRARY_PATH).'javascript/';
 api_block_anonymous_users();
 $locale = api_get_language_isocode();
 // Add Jquery scroll pagination plugin
 $htmlHeadXtra[] = api_get_js('jscroll/jquery.jscroll.js');
 // Add Jquery Time ago plugin
 $htmlHeadXtra[] = api_get_asset('jquery-timeago/jquery.timeago.js');
-$timeAgoLocaleDir = $javascriptDir . 'jquery-timeago/locales/jquery.timeago.' . $locale . '.js';
+$timeAgoLocaleDir = $javascriptDir.'jquery-timeago/locales/jquery.timeago.'.$locale.'.js';
 if (file_exists($timeAgoLocaleDir)) {
-    $htmlHeadXtra[] = api_get_js('jquery-timeago/locales/jquery.timeago.' . $locale . '.js');
+    $htmlHeadXtra[] = api_get_js('jquery-timeago/locales/jquery.timeago.'.$locale.'.js');
 }
 
 $htmlHeadXtra[] = '<script>
@@ -170,7 +170,7 @@ $htmlHeadXtra[] = '<script>
 $(document).ready(function (){
     var container = $("#wallMessages");
     container.jscroll({
-        loadingHtml: "<div class=\"well_border\">' . get_lang('Loading') . ' </div>",
+        loadingHtml: "<div class=\"well_border\">' . get_lang('Loading').' </div>",
         nextSelector: "a.nextPage:last",
         contentSelector: "",
         callback: timeAgo
@@ -200,8 +200,8 @@ $interbreadcrumb[] = array(
 );
 
 if (isset($_GET['u']) && is_numeric($_GET['u']) && $_GET['u'] != api_get_user_id()) {
-    $info_user =   api_get_user_info($_GET['u']);
-    $interbreadcrumb[]= array(
+    $info_user = api_get_user_info($_GET['u']);
+    $interbreadcrumb[] = array(
         'url' => '#',
         'name' => $info_user['complete_name']
     );
@@ -224,7 +224,7 @@ $i = 1;
 $list = [];
 if (is_array($personal_course_list)) {
     foreach ($personal_course_list as $my_course) {
-        if ($i<=10) {
+        if ($i <= 10) {
             $list[] = SocialManager::get_logged_user_course_html($my_course, $i);
             $course_list_code[] = array('code' => $my_course['code']);
         } else {
@@ -262,13 +262,13 @@ $wallSocialAddPost = SocialManager::getWallForm($show_full_profile);
 $social_wall_block = $wallSocialAddPost;
 
 // Social Post Wall
-$posts = SocialManager::getWallMessagesByUser($my_user_id, $friendId) ;
+$posts = SocialManager::getWallMessagesByUser($my_user_id, $friendId);
 
 $social_post_wall_block = empty($posts) ? '<p>'.get_lang("NoPosts").'</p>' : $posts;
 
 $socialAutoExtendLink = Display::url(
     get_lang('SeeMore'),
-    $socialAjaxUrl . '?u='. $my_user_id . '&a=list_wall_message&start=10&length=5',
+    $socialAjaxUrl.'?u='.$my_user_id.'&a=list_wall_message&start=10&length=5',
     array(
         'class' => 'nextPage next',
     )
@@ -290,12 +290,12 @@ $(document).ready(function() {
                 $(".spinner").html("'.
                     '<div class=\'text-center\'>'.
                         '<em class=\'fa fa-spinner fa-pulse fa-1x\'></em>'.
-                        '<p>'. get_lang('Loading') . ' ' . get_lang('Preview') .'</p>'.
+                        '<p>'.get_lang('Loading').' '.get_lang('Preview').'</p>'.
                     '</div>'.
                 '");
             },
             type: "POST",
-            url: "'. api_get_path(WEB_AJAX_PATH) .'social.ajax.php?a=read_url_with_open_graph",
+            url: "'. api_get_path(WEB_AJAX_PATH).'social.ajax.php?a=read_url_with_open_graph",
             data: "social_wall_new_msg_main=" + e.originalEvent.clipboardData.getData("text"),
             success: function(response) {
                 $("[name=\'wall_post_button\']").prop( "disabled", false );
@@ -390,7 +390,7 @@ if ($show_full_profile) {
                                 .$tags['tag']
                                 .'</a>';
                         }
-                        if (is_array($user_tags) && count($user_tags)>0) {
+                        if (is_array($user_tags) && count($user_tags) > 0) {
                             $extra_information_value .= '<li class="list-group-item">'.ucfirst($extraFieldInfo['display_text']).': '
                                 .' '.implode('', $tag_tmp).'</li>';
                         }
@@ -414,7 +414,7 @@ if ($show_full_profile) {
                         $extra_information_value .= '<li class="list-group-item">'.$data.'</li>';
                         break;
                     default:
-                        $extra_information_value .= '<li class="list-group-item">'.ucfirst($extraFieldInfo['display_text']) . ': ' . $data . '</li>';
+                        $extra_information_value .= '<li class="list-group-item">'.ucfirst($extraFieldInfo['display_text']).': '.$data.'</li>';
                         break;
                 }
             }
@@ -423,7 +423,7 @@ if ($show_full_profile) {
         // if there are information to show
         if (!empty($extra_information_value)) {
 
-            $extra_information_value = '<ul class="list-group">' . $extra_information_value . '</ul>';
+            $extra_information_value = '<ul class="list-group">'.$extra_information_value.'</ul>';
 
             $extra_information .= Display::panelCollapse(
                 get_lang('ExtraInformation'),
@@ -503,10 +503,10 @@ if ($show_full_profile) {
 
         if ($i > $max_numbers_of_group) {
             if (api_get_user_id() == $user_id) {
-                $my_groups .=  '<div class="box_shared_profile_group_actions">'
+                $my_groups .= '<div class="box_shared_profile_group_actions">'
                     .'<a href="groups.php?#tab_browse-1">'.get_lang('SeeAllMyGroups').'</a></div>';
             } else {
-                $my_groups .=  '<div class="box_shared_profile_group_actions">'
+                $my_groups .= '<div class="box_shared_profile_group_actions">'
                     .'<a href="'.api_get_path(WEB_CODE_PATH).'social/profile_friends_and_groups.inc.php'
                     .'?view=mygroups&height=390&width=610&user_id='.$user_id.'"'
                     .' class="ajax" title="'.get_lang('SeeAll').'" >'
@@ -519,7 +519,7 @@ if ($show_full_profile) {
         $i = 1;
         foreach ($grid_my_groups as $group) {
             $my_groups .= '<div class="panel-body">';
-            $my_groups .=  $group[0];
+            $my_groups .= $group[0];
             $my_groups .= '</div>';
             $i++;
         }
@@ -542,7 +542,7 @@ if ($show_full_profile) {
                 $i++;
             }
         }
-        $social_course_block .=  $my_courses;
+        $social_course_block .= $my_courses;
     }
 
     // Block Social Sessions
@@ -563,7 +563,7 @@ if ($show_full_profile) {
 
     // Images uploaded by course
     $file_list = '';
-    if (is_array($course_list_code) && count($course_list_code)>0) {
+    if (is_array($course_list_code) && count($course_list_code) > 0) {
         foreach ($course_list_code as $course) {
             $file_list .= UserManager::get_user_upload_files_by_course(
                 $user_id,
@@ -575,7 +575,7 @@ if ($show_full_profile) {
 
     $count_pending_invitations = 0;
     if (!isset($_GET['u']) ||
-        (isset($_GET['u']) && $_GET['u']==api_get_user_id())
+        (isset($_GET['u']) && $_GET['u'] == api_get_user_id())
     ) {
         $pending_invitations = SocialManager::get_list_invitation_of_friends_by_user_id(api_get_user_id());
         $list_get_path_web = SocialManager::get_list_web_path_user_invitation_by_user_id(api_get_user_id());
@@ -584,23 +584,23 @@ if ($show_full_profile) {
 
     if (!empty($production_list) || !empty($file_list) || $count_pending_invitations > 0) {
         // Pending invitations
-        if (!isset($_GET['u']) || (isset($_GET['u']) && $_GET['u']==api_get_user_id())) {
+        if (!isset($_GET['u']) || (isset($_GET['u']) && $_GET['u'] == api_get_user_id())) {
             if ($count_pending_invitations > 0) {
-                $invitations =  '<ul class="list-group">';
+                $invitations = '<ul class="list-group">';
                 for ($i = 0; $i < $count_pending_invitations; $i++) {
                     $user_invitation_id = $pending_invitations[$i]['user_sender_id'];
-                    $invitations .=  '<li id="dpending_'.$user_invitation_id.'" class="list-group-item">';
-                    $invitations .=  '<img class="img-rounded" '
+                    $invitations .= '<li id="dpending_'.$user_invitation_id.'" class="list-group-item">';
+                    $invitations .= '<img class="img-rounded" '
                                 .' src="'.$list_get_path_web[$i]['dir'].'/'.$list_get_path_web[$i]['file'].'"'
                                 .' width="40px">';
                     $userInfo = api_get_user_info($user_invitation_id);
                     $invitations .= '<a href="'.api_get_path(WEB_PATH).'main/social/profile.php?u='.$user_invitation_id.'">'
-                                 .api_get_person_name($userInfo['firstname'],$userInfo['lastname']).'</a>';
+                                 .api_get_person_name($userInfo['firstname'], $userInfo['lastname']).'</a>';
 
-                    $invitations .='<div class="pull-right">';
+                    $invitations .= '<div class="pull-right">';
                     $invitations .= Display::toolbarButton(
                         get_lang('SocialAddToFriends'),
-                        api_get_path(WEB_AJAX_PATH) . 'social.ajax.php?' . http_build_query([
+                        api_get_path(WEB_AJAX_PATH).'social.ajax.php?'.http_build_query([
                             'a' => 'add_friend',
                             'friend_id' => $user_invitation_id,
                             'is_my_friend' => 'friend'
@@ -611,8 +611,8 @@ if ($show_full_profile) {
                         false
                     );
                     $invitations .= '</div>';
-                    $invitations .=  '<div id="id_response"></div>';
-                    $invitations .=  '</li>';
+                    $invitations .= '<div id="id_response"></div>';
+                    $invitations .= '</li>';
                 }
                 $invitations .= '</ul>';
                 $listInvitations = Display::panelCollapse(
@@ -627,51 +627,51 @@ if ($show_full_profile) {
         }
 
         // Productions
-        $production_list =  UserManager::build_production_list($user_id);
+        $production_list = UserManager::build_production_list($user_id);
         $product_content = '';
         if (!empty($production_list)) {
             $product_content .= '<div><h3>'.get_lang('MyProductions').'</h3></div>';
-            $product_content .=  $production_list;
-            $socialRightInformation .=  SocialManager::social_wrapper_div($product_content, 4);
+            $product_content .= $production_list;
+            $socialRightInformation .= SocialManager::social_wrapper_div($product_content, 4);
         }
 
         $images_uploaded = null;
         // Images uploaded by course
         if (!empty($file_list)) {
-            $images_uploaded .=  '<div><h3>'.get_lang('ImagesUploaded').'</h3></div>';
-            $images_uploaded .=  '<div class="social-content-information">';
-            $images_uploaded .=  $file_list;
-            $images_uploaded .=  '</div>';
-            $socialRightInformation .=  SocialManager::social_wrapper_div($images_uploaded, 4);
+            $images_uploaded .= '<div><h3>'.get_lang('ImagesUploaded').'</h3></div>';
+            $images_uploaded .= '<div class="social-content-information">';
+            $images_uploaded .= $file_list;
+            $images_uploaded .= '</div>';
+            $socialRightInformation .= SocialManager::social_wrapper_div($images_uploaded, 4);
         }
     }
 
     if (!empty($user_info['competences']) || !empty($user_info['diplomas'])
-        || !empty($user_info['openarea']) || !empty($user_info['teach']) ) {
+        || !empty($user_info['openarea']) || !empty($user_info['teach'])) {
 
-        $more_info .=  '<div><h3>'.get_lang('MoreInformation').'</h3></div>';
+        $more_info .= '<div><h3>'.get_lang('MoreInformation').'</h3></div>';
         if (!empty($user_info['competences'])) {
-            $more_info .=  '<br />';
-                $more_info .=  '<div class="social-actions-message"><strong>'.get_lang('MyCompetences').'</strong></div>';
-                $more_info .=  '<div class="social-profile-extended">'.$user_info['competences'].'</div>';
-            $more_info .=  '<br />';
+            $more_info .= '<br />';
+                $more_info .= '<div class="social-actions-message"><strong>'.get_lang('MyCompetences').'</strong></div>';
+                $more_info .= '<div class="social-profile-extended">'.$user_info['competences'].'</div>';
+            $more_info .= '<br />';
         }
         if (!empty($user_info['diplomas'])) {
-            $more_info .=  '<div class="social-actions-message"><strong>'.get_lang('MyDiplomas').'</strong></div>';
-            $more_info .=  '<div class="social-profile-extended">'.$user_info['diplomas'].'</div>';
-            $more_info .=  '<br />';
+            $more_info .= '<div class="social-actions-message"><strong>'.get_lang('MyDiplomas').'</strong></div>';
+            $more_info .= '<div class="social-profile-extended">'.$user_info['diplomas'].'</div>';
+            $more_info .= '<br />';
         }
         if (!empty($user_info['openarea'])) {
-            $more_info .=  '<div class="social-actions-message"><strong>'.get_lang('MyPersonalOpenArea').'</strong></div>';
-            $more_info .=  '<div class="social-profile-extended">'.$user_info['openarea'].'</div>';
-            $more_info .=  '<br />';
+            $more_info .= '<div class="social-actions-message"><strong>'.get_lang('MyPersonalOpenArea').'</strong></div>';
+            $more_info .= '<div class="social-profile-extended">'.$user_info['openarea'].'</div>';
+            $more_info .= '<br />';
         }
         if (!empty($user_info['teach'])) {
-            $more_info .=  '<div class="social-actions-message"><strong>'.get_lang('MyTeach').'</strong></div>';
-            $more_info .=  '<div class="social-profile-extended">'.$user_info['teach'].'</div>';
-            $more_info .=  '<br />';
+            $more_info .= '<div class="social-actions-message"><strong>'.get_lang('MyTeach').'</strong></div>';
+            $more_info .= '<div class="social-profile-extended">'.$user_info['teach'].'</div>';
+            $more_info .= '<br />';
         }
-        $socialRightInformation .=  SocialManager::social_wrapper_div($more_info, 4);
+        $socialRightInformation .= SocialManager::social_wrapper_div($more_info, 4);
     }
 }
 
@@ -699,7 +699,7 @@ $tpl->assign('invitations', $listInvitations);
 $tpl->assign('social_right_information', $socialRightInformation);
 $tpl->assign('social_auto_extend_link', $socialAutoExtendLink);
 
-$formModalTpl =  new Template();
+$formModalTpl = new Template();
 $formModalTpl->assign('invitation_form', MessageManager::generate_invitation_form('send_invitation'));
 $template = $formModalTpl->get_template('social/form_modals.tpl');
 $formModals = $formModalTpl->fetch($template);

+ 13 - 13
main/social/search.php

@@ -22,13 +22,13 @@ $interbreadcrumb[] = array(
     'name' => get_lang('SocialNetwork'),
 );
 
-$query = isset($_GET['q']) ? Security::remove_XSS($_GET['q']): null;
-$query_search_type = isset($_GET['search_type']) && in_array($_GET['search_type'], array('0','1','2')) ? $_GET['search_type'] : null;
+$query = isset($_GET['q']) ? Security::remove_XSS($_GET['q']) : null;
+$query_search_type = isset($_GET['search_type']) && in_array($_GET['search_type'], array('0', '1', '2')) ? $_GET['search_type'] : null;
 $extra_fields = UserManager::get_extra_filtrable_fields();
 $query_vars = array('q' => $query, 'search_type' => $query_search_type);
 if (!empty($extra_fields)) {
     foreach ($extra_fields as $extra_field) {
-        $field_name = 'field_' . $extra_field['variable'];
+        $field_name = 'field_'.$extra_field['variable'];
         if (isset($_GET[$field_name]) && $_GET[$field_name] != '0') {
             $query_vars[$field_name] = $_GET[$field_name];
         }
@@ -47,10 +47,10 @@ $totalUsers = array();
 $usergroup = new UserGroup();
 
 // I'm searching something
-if ($query != '' || ($query_vars['search_type']=='1' && count($query_vars)>2)) {
+if ($query != '' || ($query_vars['search_type'] == '1' && count($query_vars) > 2)) {
     $itemPerPage = 6;
 
-    if ($_GET['search_type']=='0' || $_GET['search_type']=='1') {
+    if ($_GET['search_type'] == '0' || $_GET['search_type'] == '1') {
         $page = isset($_GET['users_page_nr']) ? intval($_GET['users_page_nr']) : 1;
         $totalUsers = UserManager::get_all_user_tags(
             $_GET['q'],
@@ -65,7 +65,7 @@ if ($query != '' || ($query_vars['search_type']=='1' && count($query_vars)>2)) {
         $users = UserManager::get_all_user_tags($_GET['q'], 0, $from, $itemPerPage);
     }
 
-    if ($_GET['search_type']=='0' || $_GET['search_type']=='2') {
+    if ($_GET['search_type'] == '0' || $_GET['search_type'] == '2') {
         $pageGroup = isset($_GET['groups_page_nr']) ? intval($_GET['groups_page_nr']) : 1;
         // Groups
         $fromGroups = intval(($pageGroup - 1) * $itemPerPage);
@@ -90,7 +90,7 @@ if ($query != '' || ($query_vars['search_type']=='1' && count($query_vars)>2)) {
 
             // Show send invitation icon if they are not friends yet
             if ($relation_type != 3 && $relation_type != 4 && $user_info['user_id'] != api_get_user_id()) {
-                $sendInvitation = '<a href="#" class="'.$buttonClass.' btn-to-send-invitation" data-send-to="' . $user_info['user_id'] . '">
+                $sendInvitation = '<a href="#" class="'.$buttonClass.' btn-to-send-invitation" data-send-to="'.$user_info['user_id'].'">
                              <em class="fa fa-user"></em> '.get_lang('SendInvitation').'</a>';
             }
 
@@ -186,7 +186,7 @@ if ($query != '' || ($query_vars['search_type']=='1' && count($query_vars)>2)) {
             $tags = null;
             $group['picture'] = '<img class="img-responsive img-circle" src="'.$picture['file'].'" />';
 
-            $members = Display::returnFontAwesomeIcon('user') . '( ' .$count_users_group . ' )';
+            $members = Display::returnFontAwesomeIcon('user').'( '.$count_users_group.' )';
             $item_1  = Display::tag('p', $url_open.$name.$url_close);
 
             $block_groups .= '
@@ -197,10 +197,10 @@ if ($query != '' || ($query_vars['search_type']=='1' && count($query_vars)>2)) {
                         </div>
                         <div class="user-info">
                             '.$item_1.'
-                            <p>' . $members . '</p>    
-                            <p>' . $group['description'] . '</p>
-                            <p>' . $tags . '</p>
-                            <p>' . $url_open.get_lang('SeeMore') . $url_close . '</p>
+                            <p>' . $members.'</p>    
+                            <p>' . $group['description'].'</p>
+                            <p>' . $tags.'</p>
+                            <p>' . $url_open.get_lang('SeeMore').$url_close.'</p>
                         </div>
                     </div>
                 </div>';
@@ -240,7 +240,7 @@ $tpl->assign('social_menu_block', $social_menu_block);
 $tpl->assign('social_search', $block_search);
 $tpl->assign('search_form', $searchForm);
 
-$formModalTpl =  new Template();
+$formModalTpl = new Template();
 $formModalTpl->assign('invitation_form', MessageManager::generate_invitation_form('send_invitation'));
 $template = $formModalTpl->get_template('social/form_modals.tpl');
 $formModals = $formModalTpl->fetch($template);

+ 1 - 1
main/survey/survey_invitation.php

@@ -52,7 +52,7 @@ if ($survey_data['anonymous'] == 1) {
 }
 
 if (!isset($_GET['view']) || $_GET['view'] == 'invited') {
-	echo get_lang('ViewInvited'). ' | ';
+	echo get_lang('ViewInvited').' | ';
 } else {
 	echo '	<a href="'.api_get_self().'?survey_id='.$survey_id.'&amp;view=invited">'.get_lang('ViewInvited').'</a> |';
 }

+ 2 - 2
main/ticket/priorities.php

@@ -65,7 +65,7 @@ switch ($action) {
         $form = TicketManager::getPriorityForm($url);
         $formToString = $form->returnForm();
         if ($form->validate()) {
-            $values =$form->getSubmitValues();
+            $values = $form->getSubmitValues();
 
             $params = [
                 'name' => $values['name'],
@@ -95,7 +95,7 @@ switch ($action) {
         );
         $formToString = $form->returnForm();
         if ($form->validate()) {
-            $values =$form->getSubmitValues();
+            $values = $form->getSubmitValues();
             $params = [
                 'name' => $values['name'],
                 'description' => $values['description']

+ 1 - 1
main/ticket/settings.php

@@ -17,7 +17,7 @@ Display::display_header(get_lang('Settings'));
 echo '<div class="actions">';
 echo Display::url(
     Display::return_icon('back.png', get_lang('Tickets'), [], ICON_SIZE_MEDIUM),
-    api_get_path(WEB_CODE_PATH) . 'ticket/tickets.php'
+    api_get_path(WEB_CODE_PATH).'ticket/tickets.php'
 );
 echo '</div>';
 

+ 26 - 26
main/ticket/ticket_details.php

@@ -26,10 +26,10 @@ $(document).ready(function() {
 		width: 600,
 		modal: true,
 		buttons: {
-            ' . get_lang('Accept') . ': function(){
+            ' . get_lang('Accept').': function(){
                 $("#frmResponsable").submit()
             },
-            ' . ucfirst(get_lang('Close')) . ': function() {
+            ' . ucfirst(get_lang('Close')).': function() {
                 $(this).dialog("close");
             }
             }
@@ -40,13 +40,13 @@ $(document).ready(function() {
         });
 
         $(".responseyes").click(function () {
-            if(!confirm("' . get_lang('AreYouSure') . ' : ' . strtoupper(get_lang('Yes')) . '. ' . get_lang('IfYouAreSureTheTicketWillBeClosed') . '")){
+            if(!confirm("' . get_lang('AreYouSure').' : '.strtoupper(get_lang('Yes')).'. '.get_lang('IfYouAreSureTheTicketWillBeClosed').'")){
                 return false;
             }
         });
 
         $("input#responseno").click(function () {
-            if(!confirm("' . get_lang('AreYouSure') . ' : ' . strtoupper(get_lang('No')) . '")){
+            if(!confirm("' . get_lang('AreYouSure').' : '.strtoupper(get_lang('No')).'")){
                 return false;
             }
         });     
@@ -179,13 +179,13 @@ if (isset($_POST['response'])) {
             $user_id
         );
         Display::addFlash(Display::return_message(get_lang('Updated')));
-        header("Location:" . api_get_self() . "?ticket_id=" . $ticket_id);
+        header("Location:".api_get_self()."?ticket_id=".$ticket_id);
         exit;
 
     }
 }
 
-$title = 'Ticket #' . $ticket['ticket']['code'];
+$title = 'Ticket #'.$ticket['ticket']['code'];
 
 if (!isset($_POST['compose'])) {
     if (isset($_REQUEST['close'])) {
@@ -199,7 +199,7 @@ if (!isset($_POST['compose'])) {
     echo '<div class="actions">';
     echo Display::url(
         Display::return_icon('back.png', get_lang('Tickets'), [], ICON_SIZE_MEDIUM),
-        api_get_path(WEB_CODE_PATH) . 'ticket/tickets.php?project_id='.$projectId
+        api_get_path(WEB_CODE_PATH).'ticket/tickets.php?project_id='.$projectId
     );
     echo '</div>';
     $bold = '';
@@ -212,9 +212,9 @@ if (!isset($_POST['compose'])) {
               </style>";
     }
     if ($isAdmin) {
-        $senderData = get_lang('AddedBy'). ' '.$ticket['ticket']['user_url'].' (' . $ticket['usuario']['username'] . ').';
+        $senderData = get_lang('AddedBy').' '.$ticket['ticket']['user_url'].' ('.$ticket['usuario']['username'].').';
     } else {
-        $senderData = get_lang('AddedBy'). ' '.$ticket['usuario']['complete_name'].' (' . $ticket['usuario']['username']. ').';
+        $senderData = get_lang('AddedBy').' '.$ticket['usuario']['complete_name'].' ('.$ticket['usuario']['username'].').';
     }
 
     echo '<table width="100%" >
@@ -223,8 +223,8 @@ if (!isset($_POST['compose'])) {
               <h1>'.$title.'</h1>
               <h2>'.$ticket['ticket']['subject'].'</h2>
               <p>
-                '.$senderData.' ' .
-                get_lang('Created') . ' '.
+                '.$senderData.' '.
+                get_lang('Created').' '.
                 Display::url(
                     date_to_str_ago($ticket['ticket']['start_date_from_db']),
                     '#',
@@ -240,37 +240,37 @@ if (!isset($_POST['compose'])) {
               </td>
             </tr>
             <tr>
-               <td><p><b>' . get_lang('Category') . ': </b>' . $ticket['ticket']['name'] . '</p></td>
+               <td><p><b>' . get_lang('Category').': </b>'.$ticket['ticket']['name'].'</p></td>
             </tr>
             <tr>
-               <td><p ' . $bold . '><b>' . get_lang('Status') . ':</b> ' . $ticket['ticket']['status'] . '</p></td>
+               <td><p ' . $bold.'><b>'.get_lang('Status').':</b> '.$ticket['ticket']['status'].'</p></td>
             </tr>
             <tr>
-                <td><p><b>' . get_lang('Priority') . ': </b>' . $ticket['ticket']['priority'] . '<p></td>
+                <td><p><b>' . get_lang('Priority').': </b>'.$ticket['ticket']['priority'].'<p></td>
             </tr>';
 
     if (!empty($ticket['ticket']['assigned_last_user'])) {
         $assignedUser = api_get_user_info($ticket['ticket']['assigned_last_user']);
         echo '<tr>
-                <td><p><b>' . get_lang('AssignedTo') . ': </b>' . $assignedUser['complete_name'] . '<p></td>
+                <td><p><b>' . get_lang('AssignedTo').': </b>'.$assignedUser['complete_name'].'<p></td>
             </tr>';
     } else {
         echo '<tr>
-                <td><p><b>' . get_lang('AssignedTo') . ': </b>-<p></td>
+                <td><p><b>' . get_lang('AssignedTo').': </b>-<p></td>
             </tr>';
     }
     if ($ticket['ticket']['course_url'] != null) {
         if (!empty($ticket['ticket']['session_id'])) {
             $sessionInfo = api_get_session_info($ticket['ticket']['session_id']);
             echo '<tr>
-				<td><b>' . get_lang('Session') . ':</b> ' . $sessionInfo['name'] . ' </td>
+				<td><b>' . get_lang('Session').':</b> '.$sessionInfo['name'].' </td>
 			    <td></td>
 	            <td colspan="2"></td>
 	          </tr>';
         }
 
         echo '<tr>
-				<td><b>' . get_lang('Course') . ':</b> ' . $ticket['ticket']['course_url'] . ' </td>
+				<td><b>' . get_lang('Course').':</b> '.$ticket['ticket']['course_url'].' </td>
 			    <td></td>
 	            <td colspan="2"></td>
 	          </tr>';
@@ -278,7 +278,7 @@ if (!isset($_POST['compose'])) {
     echo '<tr>
             <td>
             <hr />
-            <b>' . get_lang('Description') . ':</b> <br />
+            <b>' . get_lang('Description').':</b> <br />
             '.$ticket['ticket']['message'].'
             <hr />
             </td>            
@@ -296,7 +296,7 @@ if (!isset($_POST['compose'])) {
 
         $receivedMessage = '';
         if (!empty($message['subject'])) {
-            $receivedMessage = '<b>'.get_lang('Subject') . ': </b> '.$message['subject'].'<br/>';
+            $receivedMessage = '<b>'.get_lang('Subject').': </b> '.$message['subject'].'<br/>';
         }
 
         if (!empty($message['message'])) {
@@ -313,9 +313,9 @@ if (!isset($_POST['compose'])) {
             }
         }
 
-        $entireMessage = $receivedMessage . $attachmentLinks;
+        $entireMessage = $receivedMessage.$attachmentLinks;
         $counterLink = Display::url('#'.$counter, api_get_self().'?ticket_id='.$ticket_id.'#note-'.$counter);
-        echo '<a id="note-'.$counter.'"> </a><h4>' . sprintf(get_lang('UpdatedByX'), $message['user_created']).' '.$date.
+        echo '<a id="note-'.$counter.'"> </a><h4>'.sprintf(get_lang('UpdatedByX'), $message['user_created']).' '.$date.
             ' <span class="pull-right">'.$counterLink.'</span></h4>';
         echo '<hr />';
 
@@ -329,7 +329,7 @@ if (!isset($_POST['compose'])) {
         $counter++;
     }
 
-    $subject = get_lang('ReplyShort') .': '.$ticket['ticket']['subject'];
+    $subject = get_lang('ReplyShort').': '.$ticket['ticket']['subject'];
 
     if ($ticket['ticket']['status_id'] != TicketManager::STATUS_FORWARDED &&
         $ticket['ticket']['status_id'] != TicketManager::STATUS_CLOSE
@@ -451,7 +451,7 @@ if (!isset($_POST['compose'])) {
     );
 
     Display::addFlash(Display::return_message(get_lang('Saved')));
-    header("Location:" . api_get_self() . "?ticket_id=" . $ticket_id);
+    header("Location:".api_get_self()."?ticket_id=".$ticket_id);
     exit;
 }
 
@@ -466,7 +466,7 @@ function show_form_send_message($ticket)
     $form = new FormValidator(
         'send_ticket',
         'POST',
-        api_get_self() . '?ticket_id=' . $ticket['id'],
+        api_get_self().'?ticket_id='.$ticket['id'],
         '',
         array(
             'enctype' => 'multipart/form-data',
@@ -553,7 +553,7 @@ function show_form_send_message($ticket)
     $form->addLabel(
         '',
         '<span id="link-more-attach">
-         <span class="btn btn-success" onclick="return add_image_form()">' . get_lang('AddOneMoreFile') . '</span>
+         <span class="btn btn-success" onclick="return add_image_form()">' . get_lang('AddOneMoreFile').'</span>
          </span>
          ('.sprintf(get_lang('MaximunFileSizeX'), format_file_size(api_get_setting('message_max_upload_filesize'))).')
     ');

+ 5 - 5
main/upload/upload_ppt.php

@@ -21,9 +21,9 @@ if (isset($_POST['convert'])) {
     if (isset($_FILES['user_file'])) {
         $allowed_extensions = array('odp', 'sxi', 'ppt', 'pps', 'sxd', 'pptx');
         if (in_array(strtolower(pathinfo($_FILES['user_file']['name'], PATHINFO_EXTENSION)), $allowed_extensions)) {
-            require_once api_get_path(SYS_CODE_PATH) . 'lp/lp_upload.php';
+            require_once api_get_path(SYS_CODE_PATH).'lp/lp_upload.php';
             if (isset($o_ppt) && $first_item_id != 0) {
-                if (api_get_setting('search_enabled')=='true') {
+                if (api_get_setting('search_enabled') == 'true') {
                     require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php';
                     $specific_fields = get_specific_field_list();
                     foreach ($specific_fields as $specific_field) {
@@ -62,7 +62,7 @@ if (!$is_allowed_to_edit) {
     api_not_allowed(true);
 }
 
-$interbreadcrumb[]= array ("url"=>"../lp/lp_controller.php?action=list", "name"=> get_lang("Doc"));
+$interbreadcrumb[] = array("url"=>"../lp/lp_controller.php?action=list", "name"=> get_lang("Doc"));
 
 $nameTools = get_lang("OogieConversionPowerPoint");
 Display :: display_header($nameTools);
@@ -74,7 +74,7 @@ if (!empty($errorMessage)) {
 
 $div_upload_limit = get_lang('UploadMaxSize').' : '.ini_get('post_max_size');
 
-$form = new FormValidator('upload_ppt', 'POST', '?' . api_get_cidreq(), '');
+$form = new FormValidator('upload_ppt', 'POST', '?'.api_get_cidreq(), '');
 $form->addElement('header', get_lang("WelcomeOogieSubtitle"));
 $form->addElement('html', Display::return_message($message, 'info', false));
 $form->addElement('file', 'user_file', array(Display::return_icon('powerpoint_big.gif'), $div_upload_limit));
@@ -82,7 +82,7 @@ $form->addElement('checkbox', 'take_slide_name', '', get_lang('TakeSlideName'));
 $options = ChamiloApi::getDocumentConversionSizes();
 $form->addElement('select', 'slide_size', get_lang('SlideSize'), $options);
 if (api_get_setting('search_enabled') === 'true') {
-    require_once(api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php');
+    require_once(api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php');
     $specific_fields = get_specific_field_list();
     $form->addElement('checkbox', 'index_document', '', get_lang('SearchFeatureDoIndexDocument'));
     $form->addSelectLanguage('language', get_lang('SearchFeatureDocumentLanguage'));

+ 18 - 18
main/user/user.php

@@ -13,7 +13,7 @@
  */
 $use_anonymous = true;
 require_once __DIR__.'/../inc/global.inc.php';
-$current_course_tool  = TOOL_USER;
+$current_course_tool = TOOL_USER;
 $this_section = SECTION_COURSES;
 
 // notice for unauthorized people.
@@ -41,7 +41,7 @@ $type = isset($_REQUEST['type']) ? intval($_REQUEST['type']) : STUDENT;
 
 //Can't auto unregister from a session
 if (!empty($sessionId)) {
-    $course_info['unsubscribe']  = 0;
+    $course_info['unsubscribe'] = 0;
 }
 
 /* Unregistering a user section	*/
@@ -180,7 +180,7 @@ if (api_is_allowed_to_edit(null, true)) {
                             '#',
                             get_lang('UserPicture'),
                             get_lang('OfficialCode'),
-                            get_lang('FirstName') . ', ' . get_lang('LastName'),
+                            get_lang('FirstName').', '.get_lang('LastName'),
                             get_lang('Email'),
                             get_lang('Phone')
                         );
@@ -189,7 +189,7 @@ if (api_is_allowed_to_edit(null, true)) {
                             '#',
                             get_lang('UserPicture'),
                             get_lang('OfficialCode'),
-                            get_lang('LastName') . ', ' . get_lang('FirstName'),
+                            get_lang('LastName').', '.get_lang('FirstName'),
                             get_lang('Email'),
                             get_lang('Phone')
                         );
@@ -214,7 +214,7 @@ if (api_is_allowed_to_edit(null, true)) {
                     if (api_is_multiple_url_enabled()) {
                         $sql .= ' , '.Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER).' au ';
                     }
-                    $sql .=" WHERE c_id = '$courseId' AND session_course_user.user_id = user.user_id ";
+                    $sql .= " WHERE c_id = '$courseId' AND session_course_user.user_id = user.user_id ";
                     $sql .= ' AND session_id = '.$sessionId;
 
                     if (api_is_multiple_url_enabled()) {
@@ -262,7 +262,7 @@ if (api_is_allowed_to_edit(null, true)) {
                                     $counter,
                                     $user_image,
                                     $user['official_code'],
-                                    $user['firstname'] . ', ' . $user['lastname'],
+                                    $user['firstname'].', '.$user['lastname'],
                                     $user['email'],
                                     $user['phone']
                                 );
@@ -271,7 +271,7 @@ if (api_is_allowed_to_edit(null, true)) {
                                     $counter,
                                     $user_image,
                                     $user['official_code'],
-                                    $user['lastname'] . ', ' . $user['firstname'],
+                                    $user['lastname'].', '.$user['firstname'],
                                     $user['email'],
                                     $user['phone']
                                 );
@@ -350,7 +350,7 @@ if (api_is_allowed_to_edit(null, true)) {
                                     $counter,
                                     $user_image,
                                     $user['official_code'],
-                                    $user['firstname'] . ', ' . $user['lastname'],
+                                    $user['firstname'].', '.$user['lastname'],
                                     $user['email'],
                                     $user['phone']
                                 );
@@ -359,7 +359,7 @@ if (api_is_allowed_to_edit(null, true)) {
                                     $counter,
                                     $user_image,
                                     $user['official_code'],
-                                    $user['lastname'] . ', ' . $user['firstname'],
+                                    $user['lastname'].', '.$user['firstname'],
                                     $user['email'],
                                     $user['phone']
                                 );
@@ -530,7 +530,7 @@ if (api_is_allowed_to_edit(null, true)) {
 
     // Actions column
     $table->set_header($header_nr++, get_lang('Action'), false);
-    $table->set_column_filter($header_nr-1, 'modify_filter');
+    $table->set_column_filter($header_nr - 1, 'modify_filter');
 
     if (api_get_setting('allow_user_course_subscription_by_course_admin') == 'true') {
         $table->set_form_actions(array('unsubscribe' => get_lang('Unreg')), 'user');
@@ -538,7 +538,7 @@ if (api_is_allowed_to_edit(null, true)) {
 } else {
     if ($course_info['unsubscribe'] == 1) {
         $table->set_header($header_nr++, get_lang('Action'), false);
-        $table->set_column_filter($header_nr-1, 'modify_filter');
+        $table->set_column_filter($header_nr - 1, 'modify_filter');
     }
 }
 
@@ -590,19 +590,19 @@ if (api_is_allowed_to_edit(null, true)) {
     echo '<div class="col-md-6">';
     echo $icon;
     $actions .= '<a href="user.php?'.api_get_cidreq().'&action=export&format=csv&type='.$type.'">'.
-        Display::return_icon('export_csv.png', get_lang('ExportAsCSV'),'',ICON_SIZE_MEDIUM).'</a> ';
+        Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), '', ICON_SIZE_MEDIUM).'</a> ';
     $actions .= '<a href="user.php?'.api_get_cidreq().'&action=export&format=xls&type='.$type.'">'.
-        Display::return_icon('export_excel.png', get_lang('ExportAsXLS'),'',ICON_SIZE_MEDIUM).'</a> ';
+        Display::return_icon('export_excel.png', get_lang('ExportAsXLS'), '', ICON_SIZE_MEDIUM).'</a> ';
 
     if (api_get_setting('allow_user_course_subscription_by_course_admin') == 'true' ||
         api_is_platform_admin()
     ) {
         $actions .= '<a href="user_import.php?'.api_get_cidreq().'&action=import">'.
-            Display::return_icon('import_csv.png', get_lang('ImportUsersToACourse'),'',ICON_SIZE_MEDIUM).'</a> ';
+            Display::return_icon('import_csv.png', get_lang('ImportUsersToACourse'), '', ICON_SIZE_MEDIUM).'</a> ';
     }
 
     $actions .= '<a href="user.php?'.api_get_cidreq().'&action=export&format=pdf&type='.$type.'">'.
-        Display::return_icon('pdf.png', get_lang('ExportToPDF'),'',ICON_SIZE_MEDIUM).'</a> ';
+        Display::return_icon('pdf.png', get_lang('ExportToPDF'), '', ICON_SIZE_MEDIUM).'</a> ';
     echo $actions;
 
     echo '</div>';
@@ -897,7 +897,7 @@ function get_user_data($from, $number_of_items, $column, $direction)
                 $userInfo = api_get_user_info($user_id);
                 $userPicture = $userInfo['avatar'];
 
-                $photo= '<img src="'.$userPicture.'" alt="'.$userInfo['complete_name'].'" width="22" height="22" title="'.$userInfo['complete_name'].'" />';
+                $photo = '<img src="'.$userPicture.'" alt="'.$userInfo['complete_name'].'" width="22" height="22" title="'.$userInfo['complete_name'].'" />';
 
                 $temp[] = $user_id;
                 $temp[] = $photo;
@@ -1022,7 +1022,7 @@ function modify_filter($user_id, $row, $data)
         if (api_get_setting('allow_user_course_subscription_by_course_admin') === 'true' or api_is_platform_admin()) {
             // unregister
             if ($user_id != $current_user_id || api_is_platform_admin()) {
-                $result .= '<a class="btn btn-small btn-danger" href="'.api_get_self().'?'.api_get_cidreq().'&type='.$type.'&unregister=yes&user_id='.$user_id.'" title="'.get_lang('Unreg').' " onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'),ENT_QUOTES,$charset)).'\')) return false;">'.
+                $result .= '<a class="btn btn-small btn-danger" href="'.api_get_self().'?'.api_get_cidreq().'&type='.$type.'&unregister=yes&user_id='.$user_id.'" title="'.get_lang('Unreg').' " onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES, $charset)).'\')) return false;">'.
                     get_lang('Unreg').'</a>&nbsp;';
             }
         }
@@ -1030,7 +1030,7 @@ function modify_filter($user_id, $row, $data)
         // Show buttons for unsubscribe
         if ($course_info['unsubscribe'] == 1) {
             if ($user_id == $current_user_id) {
-                $result .= '<a class="btn btn-small btn-danger" href="'.api_get_self().'?'.api_get_cidreq().'&type='.$type.'&unregister=yes&user_id='.$user_id.'" title="'.get_lang('Unreg').' " onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'),ENT_QUOTES,$charset)).'\')) return false;">'.
+                $result .= '<a class="btn btn-small btn-danger" href="'.api_get_self().'?'.api_get_cidreq().'&type='.$type.'&unregister=yes&user_id='.$user_id.'" title="'.get_lang('Unreg').' " onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES, $charset)).'\')) return false;">'.
                     get_lang('Unreg').'</a>&nbsp;';
             }
         }

+ 12 - 12
main/user/user_export.php

@@ -40,7 +40,7 @@ if (!empty($export['session'])) {
 if (is_array($courseSessionValue) && isset($courseSessionValue[1])) {
     $courseSessionCode = $courseSessionValue[0];
     $sessionId = $courseSessionValue[1];
-    $courseSessionInfo= api_get_course_info($courseSessionCode);
+    $courseSessionInfo = api_get_course_info($courseSessionCode);
     $courseSessionId = $courseSessionInfo['real_id'];
     $sessionInfo = api_get_session_info($sessionId);
 }
@@ -51,7 +51,7 @@ $sql = "SELECT
 				u.firstname 	AS FirstName,
 				u.email 		AS Email,
 				u.username	AS UserName,
-				".(($_configuration['password_encryption']!='none')?" ":"u.password AS Password, ")."
+				".(($_configuration['password_encryption'] != 'none') ? " " : "u.password AS Password, ")."
 				u.auth_source	AS AuthSource,
 				u.status		AS Status,
 				u.official_code	AS OfficialCode,
@@ -82,10 +82,10 @@ if (strlen($course_code) > 0) {
     $filename = 'export_users_'.$sessionInfo['name'].'_'.api_get_local_time();
 } else {
     if (api_is_multiple_url_enabled()) {
-        $tbl_user_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
+        $tbl_user_rel_access_url = 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.= " FROM $user_table u
+            $sql .= " FROM $user_table u
 					INNER JOIN $tbl_user_rel_access_url as user_rel_url
 				ON (u.user_id= user_rel_url.user_id)
 				WHERE access_url_id = $access_url_id
@@ -97,8 +97,8 @@ if (strlen($course_code) > 0) {
     $filename = 'export_users_'.api_get_local_time();
 }
 $data = array();
-$extra_fields = UserManager::get_extra_fields(0, 0, 5, 'ASC',false);
-if ($export['addcsvheader']=='1' AND $export['file_type']=='csv') {
+$extra_fields = UserManager::get_extra_fields(0, 0, 5, 'ASC', false);
+if ($export['addcsvheader'] == '1' AND $export['file_type'] == 'csv') {
     if ($_configuration['password_encryption'] != 'none') {
         $data[] = array(
             'UserId',
@@ -128,27 +128,27 @@ if ($export['addcsvheader']=='1' AND $export['file_type']=='csv') {
         );
     }
 
-    foreach($extra_fields as $extra) {
-        $data[0][]=$extra[1];
+    foreach ($extra_fields as $extra) {
+        $data[0][] = $extra[1];
     }
 }
 
 $res = Database::query($sql);
-while($user = Database::fetch_array($res,'ASSOC')) {
+while ($user = Database::fetch_array($res, 'ASSOC')) {
     $student_data = UserManager:: get_extra_user_data(
         $user['UserId'],
         true,
         false
     );
-    foreach($student_data as $key=>$value) {
+    foreach ($student_data as $key=>$value) {
         $key = substr($key, 6);
         if (is_array($value)) {
-            $user[$key] = $value['extra_' . $key];
+            $user[$key] = $value['extra_'.$key];
         } else {
             $user[$key] = $value;
         }
     }
-    $data[] = $user	;
+    $data[] = $user;
 }
 
 switch ($file_type) {

+ 23 - 23
plugin/buycourses/src/buycourses.ajax.php

@@ -56,20 +56,20 @@ switch ($action) {
 
         $userInfo = api_get_user_info($sale['user_id']);
 
-        $html = '<h2>' . $sale['product_name'] .'</h2>';
+        $html = '<h2>'.$sale['product_name'].'</h2>';
         $html .= '<div class="row">';
         $html .= '<div class="col-sm-6 col-md-6">';
         $html .= '<ul>';
-        $html .= '<li><b>'. $plugin->get_lang('OrderPrice') . ':</b> '. $sale['price'] . '</li>';
-        $html .= '<li><b>'. $plugin->get_lang('CurrencyType') . ':</b> '. $currency['iso_code'] . '</li>';
-        $html .= '<li><b>'. $plugin->get_lang('ProductType') . ':</b> '. $productType . '</li>';
-        $html .= '<li><b>'. $plugin->get_lang('OrderDate') . ':</b> '. api_format_date($sale['date'], DATE_TIME_FORMAT_LONG_24H) . '</li>';
-        $html .= '<li><b>'. $plugin->get_lang('Buyer') . ':</b> '. $userInfo['complete_name'] . '</li>';
-        $html .= '<li><b>'. $plugin->get_lang('PaymentMethods') . ':</b> '. $paymentType . '</li>';
+        $html .= '<li><b>'.$plugin->get_lang('OrderPrice').':</b> '.$sale['price'].'</li>';
+        $html .= '<li><b>'.$plugin->get_lang('CurrencyType').':</b> '.$currency['iso_code'].'</li>';
+        $html .= '<li><b>'.$plugin->get_lang('ProductType').':</b> '.$productType.'</li>';
+        $html .= '<li><b>'.$plugin->get_lang('OrderDate').':</b> '.api_format_date($sale['date'], DATE_TIME_FORMAT_LONG_24H).'</li>';
+        $html .= '<li><b>'.$plugin->get_lang('Buyer').':</b> '.$userInfo['complete_name'].'</li>';
+        $html .= '<li><b>'.$plugin->get_lang('PaymentMethods').':</b> '.$paymentType.'</li>';
         $html .= '</ul>';
         $html .= '</div>';
         $html .= '<div class="col-sm-6 col-md-6">';
-        $html .= '<img class="thumbnail" src="'. $productImage .'" >';
+        $html .= '<img class="thumbnail" src="'.$productImage.'" >';
         $html .= '</div>';
         $html .= '</div>';
 
@@ -114,9 +114,9 @@ switch ($action) {
         $html = '<div class="row">'
         . '<p>'
             . '<ul>'
-                . '<li>'. get_plugin_lang("PayoutsTotalCompleted", "BuyCoursesPlugin") .' <b>'. $stats['completed_count'] .'</b> - '. get_plugin_lang("TotalAmount", "BuyCoursesPlugin") .' <b>'. $stats['completed_total_amount'] .' '. $currency['iso_code'] . '</b></li>'
-                . '<li>'. get_plugin_lang("PayoutsTotalPending", "BuyCoursesPlugin") .' <b>'. $stats['pending_count'] .'</b> - '. get_plugin_lang("TotalAmount", "BuyCoursesPlugin") .' <b>'. $stats['pending_total_amount'] .' '. $currency['iso_code'] . '</b></li>'
-                . '<li>'. get_plugin_lang("PayoutsTotalCanceled", "BuyCoursesPlugin") .' <b>'. $stats['canceled_count'] .'</b> - '. get_plugin_lang("TotalAmount", "BuyCoursesPlugin") .' <b>'. $stats['canceled_total_amount'] .' '. $currency['iso_code'] . '</b></li>'
+                . '<li>'.get_plugin_lang("PayoutsTotalCompleted", "BuyCoursesPlugin").' <b>'.$stats['completed_count'].'</b> - '.get_plugin_lang("TotalAmount", "BuyCoursesPlugin").' <b>'.$stats['completed_total_amount'].' '.$currency['iso_code'].'</b></li>'
+                . '<li>'.get_plugin_lang("PayoutsTotalPending", "BuyCoursesPlugin").' <b>'.$stats['pending_count'].'</b> - '.get_plugin_lang("TotalAmount", "BuyCoursesPlugin").' <b>'.$stats['pending_total_amount'].' '.$currency['iso_code'].'</b></li>'
+                . '<li>'.get_plugin_lang("PayoutsTotalCanceled", "BuyCoursesPlugin").' <b>'.$stats['canceled_count'].'</b> - '.get_plugin_lang("TotalAmount", "BuyCoursesPlugin").' <b>'.$stats['canceled_total_amount'].' '.$currency['iso_code'].'</b></li>'
             . '</ul>'
         . '</p>';
         $html .= '</div>';
@@ -154,15 +154,15 @@ switch ($action) {
 
         $currentCurrency = $plugin->getSelectedCurrency();
         $isoCode = $currentCurrency['iso_code'];
-        $html .= '<p>'. get_plugin_lang("VerifyTotalAmountToProceedPayout", "BuyCoursesPlugin") .'</p>';
+        $html .= '<p>'.get_plugin_lang("VerifyTotalAmountToProceedPayout", "BuyCoursesPlugin").'</p>';
         $html .= ''
         . '<p>'
             . '<ul>'
-                . '<li>'. get_plugin_lang("TotalAcounts", "BuyCoursesPlugin") .' <b>'. $totalAccounts .'</b></li>'
-                . '<li>'. get_plugin_lang("TotalPayout", "BuyCoursesPlugin") .' <b>'. $isoCode .' '. $totalPayout .'</b></li>'
+                . '<li>'.get_plugin_lang("TotalAcounts", "BuyCoursesPlugin").' <b>'.$totalAccounts.'</b></li>'
+                . '<li>'.get_plugin_lang("TotalPayout", "BuyCoursesPlugin").' <b>'.$isoCode.' '.$totalPayout.'</b></li>'
             . '</ul>'
         . '</p>';
-        $html .= '<p>'. get_plugin_lang("CautionThisProcessCantBeCanceled", "BuyCoursesPlugin") .'</p>';
+        $html .= '<p>'.get_plugin_lang("CautionThisProcessCantBeCanceled", "BuyCoursesPlugin").'</p>';
         $html .= '<br /><br />';
         $html .= '<div id="spinner" class="text-center"></div>';
 
@@ -207,7 +207,7 @@ switch ($action) {
 
             echo Display::return_message(get_plugin_lang("PayoutSuccess", "BuyCoursesPlugin"), 'success', false);
         } else {
-            echo Display::return_message('<b>'.$result['L_SEVERITYCODE0'].' '.$result['L_ERRORCODE0'].'</b> - '.$result['L_SHORTMESSAGE0'].'<br /><ul><li>'. $result['L_LONGMESSAGE0'].'</li></ul>', 'error', false);
+            echo Display::return_message('<b>'.$result['L_SEVERITYCODE0'].' '.$result['L_ERRORCODE0'].'</b> - '.$result['L_SHORTMESSAGE0'].'<br /><ul><li>'.$result['L_LONGMESSAGE0'].'</li></ul>', 'error', false);
         }
 
         break;
@@ -411,8 +411,8 @@ switch ($action) {
             break;
         }
 
-        $ajaxCallFile = $plugin->getPath('SRC') . 'buycourses.ajax.php';
-        $serviceImg = $plugin->getPath('SERVICE_IMAGES') . $serviceSale['service']['image'];
+        $ajaxCallFile = $plugin->getPath('SRC').'buycourses.ajax.php';
+        $serviceImg = $plugin->getPath('SERVICE_IMAGES').$serviceSale['service']['image'];
         $html = "<img class='img-responsive text-center' src='$serviceImg'>";
         $html .= "<br />";
         $html .= "<legend>{$plugin->get_lang('ServiceInformation')}</legend>";
@@ -434,7 +434,7 @@ switch ($action) {
         }
         $html .= "<li><b>{$plugin->get_lang('AppliesTo')}:</b> $nodeType</li> ";
         $html .= "<li><b>{$plugin->get_lang('Price')}:</b> {$serviceSale['service']['price']} {$serviceSale['currency']}</li> ";
-        $duration = $serviceSale['service']['duration_days'] . ' ' . $plugin->get_lang('Days');
+        $duration = $serviceSale['service']['duration_days'].' '.$plugin->get_lang('Days');
         $html .= "</ul>";
         $html .= "<legend>{$plugin->get_lang('SaleInfo')}</legend>";
         $html .= "<ul>";
@@ -513,10 +513,10 @@ switch ($action) {
                 'success'
             );
         } else {
-            $html .= Display::return_message('Error - ' . $plugin->get_lang('ErrorContactPlatformAdmin'), 'error');
+            $html .= Display::return_message('Error - '.$plugin->get_lang('ErrorContactPlatformAdmin'), 'error');
         }
 
-        $html .= "<a id='finish-button' class='btn btn-primary'>" . $plugin->get_lang('ClickHereToFinish') . "</a>";
+        $html .= "<a id='finish-button' class='btn btn-primary'>".$plugin->get_lang('ClickHereToFinish')."</a>";
         $html .= "</div>";
         $html .= "<script>";
         $html .= "$('#finish-button').click(function() {";
@@ -539,10 +539,10 @@ switch ($action) {
                 'warning'
             );
         } else {
-            $html .= Display::return_message('Error - ' . $plugin->get_lang('ErrorContactPlatformAdmin'), 'error');
+            $html .= Display::return_message('Error - '.$plugin->get_lang('ErrorContactPlatformAdmin'), 'error');
         }
 
-        $html .= "<a id='finish-button' class='btn btn-primary'>" . $plugin->get_lang('ClickHereToFinish') . "</a>";
+        $html .= "<a id='finish-button' class='btn btn-primary'>".$plugin->get_lang('ClickHereToFinish')."</a>";
         $html .= "</div>";
         $html .= "<script>";
         $html .= "$('#finish-button').click(function() {";

+ 5 - 5
plugin/buycourses/src/configure_course.php

@@ -21,7 +21,7 @@ $plugin = BuyCoursesPlugin::create();
 $commissionsEnable = $plugin->get('commissions_enable');
 
 if ($commissionsEnable == 'true') {
-    $htmlHeadXtra[] = '<script type="text/javascript" src="' . api_get_path(WEB_PLUGIN_PATH) . 'buycourses/resources/js/commissions.js"></script>';
+    $htmlHeadXtra[] = '<script type="text/javascript" src="'.api_get_path(WEB_PLUGIN_PATH).'buycourses/resources/js/commissions.js"></script>';
     $defaultCommissions = [];
     $commissions = '';
 }
@@ -165,9 +165,9 @@ if ($commissionsEnable === 'true') {
     . '<script>'
         . '$(function(){'
             . 'if ($("[name=\'commissions\']").val() === "") {'
-                . '$("#panelSliders").html("<button id=\"setCommissionsButton\" class=\"btn btn-warning\">' . get_plugin_lang("SetCommissions", "BuyCoursesPlugin") . '</button>");'
+                . '$("#panelSliders").html("<button id=\"setCommissionsButton\" class=\"btn btn-warning\">'.get_plugin_lang("SetCommissions", "BuyCoursesPlugin").'</button>");'
             . '} else {'
-                . 'showSliders(100, "default", "' . $commissions . '");'
+                . 'showSliders(100, "default", "'.$commissions.'");'
             . '}'
         . '});'
 
@@ -225,7 +225,7 @@ if ($commissionsEnable === 'true') {
                 . '</label>'
                 . '<div class="col-sm-8">'
                     . Display::return_message(
-                        sprintf($plugin->get_lang('TheActualPlatformCommissionIsX'), $platformCommission['commission']. '%'),
+                        sprintf($plugin->get_lang('TheActualPlatformCommissionIsX'), $platformCommission['commission'].'%'),
                         'info',
                         false
                     )
@@ -283,7 +283,7 @@ if ($form->validate()) {
         $plugin->deleteItem($productItem['id']);
     }
 
-    header('Location: ' . api_get_path(WEB_PLUGIN_PATH) . 'buycourses/src/configuration.php');
+    header('Location: '.api_get_path(WEB_PLUGIN_PATH).'buycourses/src/configuration.php');
     exit;
 }
 

+ 31 - 31
src/Chamilo/CourseBundle/Component/CourseCopy/CourseArchiver.php

@@ -71,49 +71,49 @@ class CourseArchiver
         $backupDirectory = self::getBackupDir();
 
         // Create a temp directory
-        $backup_dir = $backupDirectory . 'CourseArchiver_' . api_get_unique_id() . '/';
+        $backup_dir = $backupDirectory.'CourseArchiver_'.api_get_unique_id().'/';
 
         // All course-information will be stored in course_info.dat
-        $course_info_file = $backup_dir . 'course_info.dat';
+        $course_info_file = $backup_dir.'course_info.dat';
 
         $user = api_get_user_info();
         $date = new \DateTime(api_get_local_time());
-        $zipFileName = $user['user_id'] . '_' . $course->code . '_' . $date->format('Ymd-His') . '.zip';
-        $zipFilePath = $backupDirectory. $zipFileName;
+        $zipFileName = $user['user_id'].'_'.$course->code.'_'.$date->format('Ymd-His').'.zip';
+        $zipFilePath = $backupDirectory.$zipFileName;
 
         $php_errormsg = '';
         $res = @mkdir($backup_dir, $perm_dirs);
         if ($res === false) {
             //TODO set and handle an error message telling the user to review the permissions on the archive directory
-            error_log(__FILE__ . ' line ' . __LINE__ . ': ' . (ini_get('track_errors') != false ? $php_errormsg : 'error not recorded because track_errors is off in your php.ini') . ' - This error, occuring because your archive directory will not let this script write data into it, will prevent courses backups to be created', 0);
+            error_log(__FILE__.' line '.__LINE__.': '.(ini_get('track_errors') != false ? $php_errormsg : 'error not recorded because track_errors is off in your php.ini').' - This error, occuring because your archive directory will not let this script write data into it, will prevent courses backups to be created', 0);
         }
         // Write the course-object to the file
         $fp = @fopen($course_info_file, 'w');
         if ($fp === false) {
-            error_log(__FILE__ . ' line ' . __LINE__ . ': ' . (ini_get('track_errors') != false ? $php_errormsg : 'error not recorded because track_errors is off in your php.ini'), 0);
+            error_log(__FILE__.' line '.__LINE__.': '.(ini_get('track_errors') != false ? $php_errormsg : 'error not recorded because track_errors is off in your php.ini'), 0);
         }
 
         $res = @fwrite($fp, base64_encode(serialize($course)));
         if ($res === false) {
-            error_log(__FILE__ . ' line ' . __LINE__ . ': ' . (ini_get('track_errors') != false ? $php_errormsg : 'error not recorded because track_errors is off in your php.ini'), 0);
+            error_log(__FILE__.' line '.__LINE__.': '.(ini_get('track_errors') != false ? $php_errormsg : 'error not recorded because track_errors is off in your php.ini'), 0);
         }
 
         $res = @fclose($fp);
         if ($res === false) {
-            error_log(__FILE__ . ' line ' . __LINE__ . ': ' . (ini_get('track_errors') != false ? $php_errormsg : 'error not recorded because track_errors is off in your php.ini'), 0);
+            error_log(__FILE__.' line '.__LINE__.': '.(ini_get('track_errors') != false ? $php_errormsg : 'error not recorded because track_errors is off in your php.ini'), 0);
         }
 
         // Copy all documents to the temp-dir
         if (isset($course->resources[RESOURCE_DOCUMENT]) && is_array($course->resources[RESOURCE_DOCUMENT])) {
             foreach ($course->resources[RESOURCE_DOCUMENT] as $document) {
                 if ($document->file_type == DOCUMENT) {
-                    $doc_dir = $backup_dir . $document->path;
+                    $doc_dir = $backup_dir.$document->path;
                     @mkdir(dirname($doc_dir), $perm_dirs, true);
-                    if (file_exists($course->path . $document->path)) {
-                        copy($course->path . $document->path, $doc_dir);
+                    if (file_exists($course->path.$document->path)) {
+                        copy($course->path.$document->path, $doc_dir);
                     }
                 } else {
-                    @mkdir($backup_dir . $document->path, $perm_dirs, true);
+                    @mkdir($backup_dir.$document->path, $perm_dirs, true);
                 }
             }
         }
@@ -121,59 +121,59 @@ class CourseArchiver
         // Copy all scorm documents to the temp-dir
         if (isset($course->resources[RESOURCE_SCORM]) && is_array($course->resources[RESOURCE_SCORM])) {
             foreach ($course->resources[RESOURCE_SCORM] as $document) {
-                $doc_dir = dirname($backup_dir . $document->path);
+                $doc_dir = dirname($backup_dir.$document->path);
                 @mkdir($doc_dir, $perm_dirs, true);
-                copyDirTo($course->path . $document->path, $doc_dir, false);
+                copyDirTo($course->path.$document->path, $doc_dir, false);
             }
         }
 
         // Copy calendar attachments.
 
         if (isset($course->resources[RESOURCE_EVENT]) && is_array($course->resources[RESOURCE_EVENT])) {
-            $doc_dir = dirname($backup_dir . '/upload/calendar/');
+            $doc_dir = dirname($backup_dir.'/upload/calendar/');
             @mkdir($doc_dir, $perm_dirs, true);
-            copyDirTo($course->path . 'upload/calendar/', $doc_dir, false);
+            copyDirTo($course->path.'upload/calendar/', $doc_dir, false);
         }
 
         // Copy Learning path author image.
         if (isset($course->resources[RESOURCE_LEARNPATH]) && is_array($course->resources[RESOURCE_LEARNPATH])) {
-            $doc_dir = dirname($backup_dir . '/upload/learning_path/');
+            $doc_dir = dirname($backup_dir.'/upload/learning_path/');
             @mkdir($doc_dir, $perm_dirs, true);
-            copyDirTo($course->path . 'upload/learning_path/', $doc_dir, false);
+            copyDirTo($course->path.'upload/learning_path/', $doc_dir, false);
         }
 
         // Copy announcements attachments.
         if (isset($course->resources[RESOURCE_ANNOUNCEMENT]) && is_array($course->resources[RESOURCE_ANNOUNCEMENT])) {
-            $doc_dir = dirname($backup_dir . '/upload/announcements/');
+            $doc_dir = dirname($backup_dir.'/upload/announcements/');
             @mkdir($doc_dir, $perm_dirs, true);
-            copyDirTo($course->path . 'upload/announcements/', $doc_dir, false);
+            copyDirTo($course->path.'upload/announcements/', $doc_dir, false);
         }
 
         // Copy work folders (only folders)
         if (isset($course->resources[RESOURCE_WORK]) && is_array($course->resources[RESOURCE_WORK])) {
-            $doc_dir = dirname($backup_dir . '/upload/work/');
+            $doc_dir = dirname($backup_dir.'/upload/work/');
             @mkdir($doc_dir, $perm_dirs, true);
             // @todo: adjust to only create subdirs, but not copy files
-            copyDirTo($course->path . 'upload/work/', $doc_dir, false);
+            copyDirTo($course->path.'upload/work/', $doc_dir, false);
         }
 
         if (isset($course->resources[RESOURCE_ASSET]) && is_array($course->resources[RESOURCE_ASSET])) {
             /** @var Asset $asset */
             foreach ($course->resources[RESOURCE_ASSET] as $asset) {
-                $doc_dir = $backup_dir . $asset->path;
+                $doc_dir = $backup_dir.$asset->path;
                 @mkdir(dirname($doc_dir), $perm_dirs, true);
-                $assetPath = $course->path . $asset->path;
+                $assetPath = $course->path.$asset->path;
 
                 if (!file_exists($assetPath)) {
                     continue;
                 }
 
-                if (is_dir($course->path . $asset->path)) {
-                    copyDirTo($course->path . $asset->path, $doc_dir);
+                if (is_dir($course->path.$asset->path)) {
+                    copyDirTo($course->path.$asset->path, $doc_dir);
                     continue;
                 }
 
-                copy($course->path . $asset->path, $doc_dir);
+                copy($course->path.$asset->path, $doc_dir);
             }
         }
 
@@ -209,7 +209,7 @@ class CourseArchiver
                     $date = $file_parts[0];
                     $ext = isset($file_parts[1]) ? $file_parts[1] : null;
                     if ($ext == 'zip' && ($user_id != null && $owner_id == $user_id || $user_id == null)) {
-                        $date = substr($date, 0, 4) . '-' . substr($date, 4, 2) . '-' . substr($date, 6, 2) . ' ' . substr($date, 9, 2) . ':' . substr($date, 11, 2) . ':' . substr($date, 13, 2);
+                        $date = substr($date, 0, 4).'-'.substr($date, 4, 2).'-'.substr($date, 6, 2).' '.substr($date, 9, 2).':'.substr($date, 11, 2).':'.substr($date, 13, 2);
                         $backup_files[] = array(
                             'file' => $file,
                             'date' => $date,
@@ -230,7 +230,7 @@ class CourseArchiver
      */
     public static function importUploadedFile($file)
     {
-        $new_filename = uniqid('') . '.zip';
+        $new_filename = uniqid('').'.zip';
         $new_dir = self::getBackupDir();
         if (!is_dir($new_dir)) {
             $fs = new Filesystem();
@@ -264,11 +264,11 @@ class CourseArchiver
         @mkdir($unzip_dir, api_get_permissions_for_new_directories(), true);
         @copy(
             $filePath,
-            $unzip_dir . '/backup.zip'
+            $unzip_dir.'/backup.zip'
         );
 
         // unzip the archive
-        $zip = new \PclZip($unzip_dir . '/backup.zip');
+        $zip = new \PclZip($unzip_dir.'/backup.zip');
         @chdir($unzip_dir);
         $zip->extract(PCLZIP_OPT_TEMP_FILE_ON);
         // remove the archive-file