From 2dce14872e139adde47018e278ae82e8a83c5d68 Mon Sep 17 00:00:00 2001 From: Scrutinizer Auto-Fixer Date: Thu, 11 May 2017 07:48:59 +0000 Subject: [PATCH] Scrutinizer Auto-Fixes This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com --- ...access_url_edit_course_category_to_url.php | 12 +- main/admin/add_sessions_to_promotion.php | 28 ++-- main/admin/dashboard_add_sessions_to_user.php | 30 ++-- main/admin/skills_import.php | 2 +- main/auth/inscription.php | 24 +-- main/cron/import_csv.php | 26 +-- main/dropbox/update.php | 2 +- main/exercise/Hpdownload.php | 24 +-- main/exercise/export/qti2/qti2_export.php | 38 ++--- main/exercise/hotspot_actionscript.as.php | 2 +- main/exercise/upload_exercise.php | 2 +- main/forum/forumsearch.php | 6 +- main/forum/index.php | 72 ++++---- main/forum/viewthread_flat.inc.php | 48 +++--- ...ss_url_edit_users_to_url_functions.lib.php | 8 +- main/inc/lib/course_request.lib.php | 28 ++-- main/inc/lib/display.lib.php | 139 ++++++++------- main/inc/lib/formvalidator/Rule/HTML.php | 4 +- main/inc/lib/groupmanager.lib.php | 50 +++--- .../lib/search/xapian/XapianIndexer.class.php | 4 +- main/inc/lib/search/xapian/XapianQuery.php | 4 +- main/inc/lib/sub_language.class.php | 50 +++--- main/inc/lib/tracking.lib.php | 12 +- main/inc/lib/usermanager.lib.php | 76 ++++----- main/lp/scorm.class.php | 38 ++--- main/reports/modules/scorm.php | 158 +++++++++--------- main/reports/templates/courseTime.reports.php | 28 ++-- main/reports/templates/generic.reports.php | 30 ++-- main/search/search_suggestions.php | 12 +- main/session/index.php | 62 +++---- main/ticket/tickets.php | 28 ++-- .../azure_active_directory/src/callback.php | 6 +- plugin/bbb/cron.php | 2 +- plugin/jcapture/applet.php | 6 +- .../lib/olpc_peru_filter_plugin.class.php | 8 +- plugin/vchamilo/cli/cron.php | 2 +- .../CourseCopy/Resources/ScormDocument.php | 2 +- 37 files changed, 536 insertions(+), 537 deletions(-) diff --git a/main/admin/access_url_edit_course_category_to_url.php b/main/admin/access_url_edit_course_category_to_url.php index be698c3c75..45189837f1 100755 --- a/main/admin/access_url_edit_course_category_to_url.php +++ b/main/admin/access_url_edit_course_category_to_url.php @@ -113,7 +113,7 @@ if ($ajax_search) { foreach ($userGroups as $item) { if ($item['access_url_id'] == $access_url_id) { - $userGroupList[$item['id']] = $item ; + $userGroupList[$item['id']] = $item; } } $noUserGroupList = CourseCategory::getCourseCategoryNotInList(array_keys($userGroupList)); @@ -151,11 +151,11 @@ $url_list = UrlManager::get_url_data(); if (!empty($access_url_id)) { if ($url_obj[0] == $access_url_id) { $checked = 'selected=true'; - $url_selected=$url_obj[1]; + $url_selected = $url_obj[1]; } } - if ($url_obj['active']==1) { ?> - : - + @@ -208,7 +208,7 @@ $url_list = UrlManager::get_url_data(); '; echo ''; foreach ($new_field['data'] as $option) { - $checked=''; + $checked = ''; if (isset($_POST[$varname])) { if ($_POST[$varname] == $option[1]) { $checked = 'selected="true"'; @@ -170,7 +170,7 @@ if (!empty($errorMsg)) { : - + : @@ -188,7 +188,7 @@ if (!empty($errorMsg)) {
@@ -196,7 +196,7 @@ if (!empty($errorMsg)) { } else { ?>
- 'width:360px', 'multiple'=>'multiple','id'=>'session_not_in_promotion','size'=>'15px'),false); ?> + 'width:360px', 'multiple'=>'multiple', 'id'=>'session_not_in_promotion', 'size'=>'15px'), false); ?>
'width:360px', 'multiple'=>'multiple','id'=>'session_in_promotion','size'=>'15px'), + array('style'=>'width:360px', 'multiple'=>'multiple', 'id'=>'session_in_promotion', 'size'=>'15px'), false ); unset($sessionUsersList); @@ -341,7 +341,7 @@ function search_sessions($needle, $type) } } $return .= ''; - $xajax_response -> addAssign('ajax_list_multiple','innerHTML',api_utf8_encode($return)); + $xajax_response -> addAssign('ajax_list_multiple', 'innerHTML', api_utf8_encode($return)); } return $xajax_response; diff --git a/main/admin/dashboard_add_sessions_to_user.php b/main/admin/dashboard_add_sessions_to_user.php index 78f051e0a9..e29ef6f9ca 100755 --- a/main/admin/dashboard_add_sessions_to_user.php +++ b/main/admin/dashboard_add_sessions_to_user.php @@ -46,7 +46,7 @@ if (UserManager::is_admin($user_id)) { } $add_type = 'multiple'; -if (isset($_GET['add_type']) && $_GET['add_type']!='') { +if (isset($_GET['add_type']) && $_GET['add_type'] != '') { $add_type = Security::remove_XSS($_REQUEST['add_type']); } @@ -82,10 +82,10 @@ function search_sessions($needle, $type) $sql = "SELECT s.id, s.name FROM $tbl_session s WHERE s.name LIKE '$needle%' $without_assigned_sessions "; } - $rs = Database::query($sql); + $rs = Database::query($sql); $return .= ''; $xajax_response->addAssign( @@ -174,10 +174,10 @@ Display::display_header($tool_name); // Actions if ($user_info['status'] != SESSIONADMIN) { - $actionsLeft = '' . - Display::return_icon('add-user.png', get_lang('AssignUsers'), null, ICON_SIZE_MEDIUM ) . ''; - $actionsLeft .= '' . - Display::return_icon('course-add.png', get_lang('AssignCourses'), null, ICON_SIZE_MEDIUM) . ''; + $actionsLeft = ''. + Display::return_icon('add-user.png', get_lang('AssignUsers'), null, ICON_SIZE_MEDIUM).''; + $actionsLeft .= ''. + Display::return_icon('course-add.png', get_lang('AssignCourses'), null, ICON_SIZE_MEDIUM).''; echo Display::toolbarAction('toolbar-dashboard', array($actionsLeft)); } @@ -193,7 +193,7 @@ $assigned_sessions_id = array_keys($assigned_sessions_to_hrm); $without_assigned_sessions = ''; if (count($assigned_sessions_id) > 0) { - $without_assigned_sessions = " AND s.id NOT IN (".implode(',',$assigned_sessions_id).") "; + $without_assigned_sessions = " AND s.id NOT IN (".implode(',', $assigned_sessions_id).") "; } $needle = '%'; @@ -214,9 +214,9 @@ if (api_is_multiple_url_enabled()) { WHERE s.name LIKE '$needle%' $without_assigned_sessions ORDER BY s.name"; } -$result = Database::query($sql); +$result = Database::query($sql); ?> -
> +>
@@ -227,7 +227,7 @@ $result = Database::query($sql); - @@ -237,7 +237,7 @@ $result = Database::query($sql);
-

:

+

:

- ' . $toolbar . '
'; +$actions = '
'.$toolbar.'
'; echo $actions; diff --git a/main/auth/inscription.php b/main/auth/inscription.php index f6f30135d4..253a821be0 100755 --- a/main/auth/inscription.php +++ b/main/auth/inscription.php @@ -34,7 +34,7 @@ $geolocalization = $gMapsPlugin->get('enable_api') === 'true'; if ($geolocalization) { $gmapsApiKey = $gMapsPlugin->get('api_key'); - $htmlHeadXtra[] = ''; + $htmlHeadXtra[] = ''; } $htmlHeadXtra[] = api_get_password_checker_js('#username', '#pass1'); @@ -109,7 +109,7 @@ if ($user_already_registered_show_terms === false) { if (api_get_setting('registration', 'email') != 'true') { $form->addRule('email', get_lang('ThisFieldIsRequired'), 'required'); } - $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'); } @@ -151,7 +151,7 @@ if ($user_already_registered_show_terms === false) { ); $form->applyFilter('username', 'trim'); $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('UsernameWrong'), 'username'); $form->addRule('username', get_lang('UserTaken'), 'username_available'); } @@ -399,7 +399,7 @@ if (!CustomPages::enabled()) { } } - $tool_name = get_lang('Registration', null, (!empty($_POST['language'])?$_POST['language']: $_user['language'])); + $tool_name = get_lang('Registration', null, (!empty($_POST['language']) ? $_POST['language'] : $_user['language'])); if (api_get_setting('allow_terms_conditions') === 'true' && $user_already_registered_show_terms) { $tool_name = get_lang('TermsAndConditions'); @@ -420,7 +420,7 @@ if (!CustomPages::enabled()) { } if (file_exists($home.'register_top_'.$user_selected_language.'.html')) { - $home_top_temp = @(string)file_get_contents($home.'register_top_'.$user_selected_language.'.html'); + $home_top_temp = @(string) file_get_contents($home.'register_top_'.$user_selected_language.'.html'); $open = str_replace('{rel_path}', api_get_path(REL_PATH), $home_top_temp); $open = api_to_system_encoding($open, api_detect_encoding(strip_tags($open))); if (!empty($open)) { @@ -449,7 +449,7 @@ if (api_get_setting('allow_terms_conditions') == 'true') { if (api_get_setting('show_terms_if_profile_completed') === 'true') { $userInfo = api_get_user_info(); if ($userInfo && $userInfo['status'] != ANONYMOUS) { - if ((int)$userInfo['profile_completed'] !== 1) { + if ((int) $userInfo['profile_completed'] !== 1) { api_not_allowed(true); } } @@ -676,7 +676,7 @@ if ($form->validate()) { Database::query($sql); // 2. Send mail to all platform admin - $emailsubject = get_lang('ApprovalForNewAccount', null, $values['language']).': '.$values['username']; + $emailsubject = get_lang('ApprovalForNewAccount', null, $values['language']).': '.$values['username']; $emailbody = get_lang('ApprovalForNewAccount', null, $values['language'])."\n"; $emailbody .= get_lang('UserName', null, $values['language']).': '.$values['username']."\n"; @@ -820,14 +820,14 @@ if ($form->validate()) { } } else { if (!empty($values['email'])) { - $text_after_registration.= '

'.get_lang('MailHasBeenSent', null, $_user['language']).'.

'; + $text_after_registration .= '

'.get_lang('MailHasBeenSent', null, $_user['language']).'.

'; } if ($is_allowedCreateCourse) { if ($usersCanCreateCourse) { - $form_data['message'] = '

'. get_lang('NowGoCreateYourCourse', null, $_user['language']). "

"; + $form_data['message'] = '

'.get_lang('NowGoCreateYourCourse', null, $_user['language'])."

"; } - $form_data['action'] = api_get_path(WEB_CODE_PATH).'create_course/add_course.php'; + $form_data['action'] = api_get_path(WEB_CODE_PATH).'create_course/add_course.php'; if (api_get_setting('course_validation') === 'true') { $form_data['button'] = Display::button( @@ -850,7 +850,7 @@ if ($form->validate()) { } else { if (api_get_setting('allow_students_to_browse_courses') == 'true') { $form_data['action'] = 'courses.php?action=subscribe'; - $form_data['message'] = '

'. get_lang('NowGoChooseYourCourses', null, $_user['language']). ".

"; + $form_data['message'] = '

'.get_lang('NowGoChooseYourCourses', null, $_user['language']).".

"; } else { $form_data['action'] = api_get_path(WEB_PATH).'user_portal.php'; } @@ -863,7 +863,7 @@ if ($form->validate()) { } if ($sessionPremiumChecker && $sessionId) { - header('Location:' . api_get_path(WEB_PLUGIN_PATH) . 'buycourses/src/process.php?i=' . $sessionId . '&t=2'); + header('Location:'.api_get_path(WEB_PLUGIN_PATH).'buycourses/src/process.php?i='.$sessionId.'&t=2'); Session::erase('SessionIsPremium'); Session::erase('sessionId'); exit; diff --git a/main/cron/import_csv.php b/main/cron/import_csv.php index 513569294b..8731705009 100755 --- a/main/cron/import_csv.php +++ b/main/cron/import_csv.php @@ -478,7 +478,7 @@ class ImportCsv $result = UserManager::update_user( $userInfo['user_id'], $row['firstname'], // <<-- changed - $row['lastname'], // <<-- changed + $row['lastname'], // <<-- changed $userInfo['username'], null, //$password = null, $row['auth_source'], @@ -636,7 +636,7 @@ class ImportCsv if (isset($row['action']) && $row['action'] === 'delete') { // Inactive one year later - $userInfo['expiration_date'] = api_get_utc_datetime(api_strtotime(time() + 365*24*60*60)); + $userInfo['expiration_date'] = api_get_utc_datetime(api_strtotime(time() + 365 * 24 * 60 * 60)); } $password = $row['password']; // change password @@ -698,8 +698,8 @@ class ImportCsv $result = UserManager::update_user( $userInfo['user_id'], $row['firstname'], // <<-- changed - $row['lastname'], // <<-- changed - $row['username'], // <<-- changed + $row['lastname'], // <<-- changed + $row['username'], // <<-- changed $password, //$password = null, $row['auth_source'], $email, @@ -750,7 +750,7 @@ class ImportCsv } $timeEnd = microtime(true); - $executionTime = round(($timeEnd - $timeStart)/60, 2); + $executionTime = round(($timeEnd - $timeStart) / 60, 2); $this->logger->addInfo("Execution Time for process students: $executionTime Min"); if ($moveFile) { @@ -1088,7 +1088,7 @@ class ImportCsv api_format_date($start, TIME_NO_SEC_FORMAT).' '. api_format_date($end, TIME_NO_SEC_FORMAT).')'; } else { - $date = api_format_date($start,DATE_TIME_FORMAT_LONG_24H).' - '. + $date = api_format_date($start, DATE_TIME_FORMAT_LONG_24H).' - '. api_format_date($end, DATE_TIME_FORMAT_LONG_24H); } @@ -1147,7 +1147,7 @@ class ImportCsv if ($announcementId) { $this->logger->addInfo( - "Announcement added: ".(int)($announcementId)." in $info" + "Announcement added: ".(int) ($announcementId)." in $info" ); $this->logger->addInfo( "<<--SENDING MAIL-->>" @@ -1535,7 +1535,7 @@ class ImportCsv ); $this->logger->addError( - "User '$chamiloUserName' was remove from Session: #$chamiloSessionId - Course: " . $courseInfo['code'] + "User '$chamiloUserName' was remove from Session: #$chamiloSessionId - Course: ".$courseInfo['code'] ); } @@ -1609,7 +1609,7 @@ class ImportCsv } $this->logger->addError( - "User '$chamiloUserName' with status $type was added to session: #$chamiloSessionId - Course: " . $courseInfo['code'] + "User '$chamiloUserName' with status $type was added to session: #$chamiloSessionId - Course: ".$courseInfo['code'] ); } } @@ -1647,7 +1647,7 @@ class ImportCsv ); } if (!in_array('SessionName', $tag_names) || - !in_array('DateStart',$tag_names) || !in_array('DateEnd', $tag_names) + !in_array('DateStart', $tag_names) || !in_array('DateEnd', $tag_names) ) { $error_message = get_lang('NoNeededData'); break; @@ -1944,7 +1944,7 @@ class ImportCsv $data = Import::csv_reader($file); if (!empty($data)) { - $this->logger->addInfo(count($data) . " records found."); + $this->logger->addInfo(count($data)." records found."); foreach ($data as $row) { $chamiloUserName = $row['UserName']; $chamiloCourseCode = $row['CourseCode']; @@ -1991,7 +1991,7 @@ class ImportCsv } $this->logger->addError( - "User '$chamiloUserName' with status $type was added to session: #$chamiloSessionId - Course: " . $courseInfo['code'] + "User '$chamiloUserName' with status $type was added to session: #$chamiloSessionId - Course: ".$courseInfo['code'] ); } } @@ -2010,7 +2010,7 @@ class ImportCsv $data = Import::csv_reader($file); if (!empty($data)) { - $this->logger->addInfo(count($data) . " records found."); + $this->logger->addInfo(count($data)." records found."); foreach ($data as $row) { $chamiloUserName = $row['UserName']; $chamiloCourseCode = $row['CourseCode']; diff --git a/main/dropbox/update.php b/main/dropbox/update.php index b5caa1dbee..849c6e3887 100644 --- a/main/dropbox/update.php +++ b/main/dropbox/update.php @@ -8,7 +8,7 @@ if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { api_not_allowed(true); } -$id = isset($_GET['id']) ? (int)$_GET['id'] : 0; +$id = isset($_GET['id']) ? (int) $_GET['id'] : 0; if (empty($id)) { api_not_allowed(true); } diff --git a/main/exercise/Hpdownload.php b/main/exercise/Hpdownload.php index c0b674e80b..5877022038 100755 --- a/main/exercise/Hpdownload.php +++ b/main/exercise/Hpdownload.php @@ -16,7 +16,7 @@ $this_section = SECTION_COURSES; $tbl_document = Database::get_course_table(TABLE_DOCUMENT); -$doc_url = str_replace(array('../','\\..','\\0','..\\'),array('','','',''),urldecode($_GET['doc_url'])); +$doc_url = str_replace(array('../', '\\..', '\\0', '..\\'), array('', '', '', ''), urldecode($_GET['doc_url'])); $filename = basename($doc_url); // launch event @@ -33,14 +33,14 @@ if (!is_file($full_file_name)) { exit; } -if (!Security::check_abs_path($full_file_name, $course_path . '/')) { +if (!Security::check_abs_path($full_file_name, $course_path.'/')) { exit; } $extension = explode('.', $filename); $extension = strtolower($extension[sizeof($extension) - 1]); -switch($extension) { +switch ($extension) { case 'gz': $content_type = 'application/x-gzip'; break; @@ -73,10 +73,10 @@ switch($extension) { break; } -header('Content-disposition: filename=' . $filename); -header('Content-Type: ' . $content_type); -header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 10) . ' GMT'); -header('Last-Modified: ' . gmdate('D, d M Y H:i:s', time() + 10) . ' GMT'); +header('Content-disposition: filename='.$filename); +header('Content-Type: '.$content_type); +header('Expires: '.gmdate('D, d M Y H:i:s', time() + 10).' GMT'); +header('Last-Modified: '.gmdate('D, d M Y H:i:s', time() + 10).' GMT'); /* Dynamic parsing section @@ -90,21 +90,21 @@ header('Last-Modified: ' . gmdate('D, d M Y H:i:s', time() + 10) . ' GMT'); if ($content_type == 'text/html') { $directory_name = dirname($full_file_name); $coursePath = api_get_path(SYS_COURSE_PATH); - $dir=str_replace(array('\\', $coursePath . $_course['path'] . '/document'), array('/', ''), $directory_name); + $dir = str_replace(array('\\', $coursePath.$_course['path'].'/document'), array('/', ''), $directory_name); - if ($dir[strlen($dir)-1] != '/') { + if ($dir[strlen($dir) - 1] != '/') { $dir .= '/'; } //Parse whole file at one $fp = fopen($full_file_name, "r"); - $file_content = fread ($fp, filesize ($full_file_name)); + $file_content = fread($fp, filesize($full_file_name)); fclose($fp); $exercisePath = api_get_self(); $exfile = explode('/', $exercisePath); $exfile = $exfile[sizeof($exfile) - 1]; - $exercisePath = substr($exercisePath,0,strpos($exercisePath, $exfile)); + $exercisePath = substr($exercisePath, 0, strpos($exercisePath, $exfile)); $content = $file_content; $mit = "function Finish(){"; @@ -131,7 +131,7 @@ if ($content_type == 'text/html') { $newcontent = str_replace($mit, $js_content, $content); $prehref = "javascript:void(0);"; - $posthref = api_get_path(WEB_CODE_PATH) . "main/exercise/Hpdownload.php?doc_url=" . $doc_url . "&cid=" . $cid . "&uid=" . $uid; + $posthref = api_get_path(WEB_CODE_PATH)."main/exercise/Hpdownload.php?doc_url=".$doc_url."&cid=".$cid."&uid=".$uid; $newcontent = str_replace($prehref, $posthref, $newcontent); diff --git a/main/exercise/export/qti2/qti2_export.php b/main/exercise/export/qti2/qti2_export.php index aa98919ef6..847799b199 100755 --- a/main/exercise/export/qti2/qti2_export.php +++ b/main/exercise/export/qti2/qti2_export.php @@ -80,7 +80,7 @@ class ImsAssessmentItem */ function start_item_body() { - return ' ' . "\n"; + return ' '."\n"; } /** @@ -98,7 +98,7 @@ class ImsAssessmentItem */ function add_response_processing() { - return ' ' . "\n"; + return ' '."\n"; } /** @@ -114,7 +114,7 @@ class ImsAssessmentItem $head = $foot = ''; if ($standalone) { - $head = '' . "\n"; + $head = ''."\n"; } //TODO understand why answer might be a non-object sometimes @@ -172,8 +172,8 @@ class ImsSection function start_section() { $out = '
' . "\n"; return $out; } @@ -189,7 +189,7 @@ class ImsSection // return exercise duration in ISO8601 format. $minutes = floor($max_time / 60); $seconds = $max_time % 60; - return 'PT' . $minutes . 'M' . $seconds . "S\n"; + return 'PT'.$minutes.'M'.$seconds."S\n"; } else { return ''; } @@ -202,7 +202,7 @@ class ImsSection function export_presentation() { $out = "\n" - . " exercise->selectDescription()) . "]]>\n" + . " exercise->selectDescription())."]]>\n" . "\n"; return $out; } @@ -216,14 +216,14 @@ class ImsSection { $out = ''; if ($n = $this->exercise->getShuffle()) { - $out.= "" + $out .= "" . " \n" - . " " . $n . "\n" + . " ".$n."\n" . " \n" . ' ' . "\n\n"; } else { - $out.= '' . "\n" + $out .= ''."\n" . " \n" . "\n"; } @@ -255,8 +255,8 @@ class ImsSection { $head = $foot = ''; if ($standalone) { - $head = '' . "\n" - . '' . "\n" + $head = ''."\n" + . ''."\n" . "\n"; $foot = "\n"; } @@ -317,7 +317,7 @@ class ImsItem { $this->question = $question; $this->answer = $question->answer; - $this->questionIdent = "QST_" . $question->selectId(); + $this->questionIdent = "QST_".$question->selectId(); } /** @@ -329,7 +329,7 @@ class ImsItem */ function start_item() { - return '' . "\n"; + return ''."\n"; } /** @@ -352,8 +352,8 @@ class ImsItem */ function start_presentation() { - return '' . "\n" - . '' . formatExerciseQtiDescription($this->question->selectDescription()) . "\n"; + return ''."\n" + . ''.formatExerciseQtiDescription($this->question->selectDescription())."\n"; } /** @@ -373,7 +373,7 @@ class ImsItem */ function start_processing() { - return '' . "\n"; + return ''."\n"; } /** @@ -401,8 +401,8 @@ class ImsItem $head = $foot = ""; if ($standalone) { - $head = '' . "\n" - . '' . "\n" + $head = ''."\n" + . ''."\n" . "\n"; $foot = "\n"; } diff --git a/main/exercise/hotspot_actionscript.as.php b/main/exercise/hotspot_actionscript.as.php index 391769514c..86108bb739 100755 --- a/main/exercise/hotspot_actionscript.as.php +++ b/main/exercise/hotspot_actionscript.as.php @@ -13,7 +13,7 @@ use ChamiloSession as Session; session_cache_limiter("none"); require_once __DIR__.'/../inc/global.inc.php'; -require api_get_path(LIBRARY_PATH) . 'geometry.lib.php'; +require api_get_path(LIBRARY_PATH).'geometry.lib.php'; // set vars $questionId = intval($_GET['modifyAnswers']); diff --git a/main/exercise/upload_exercise.php b/main/exercise/upload_exercise.php index f23a52db6d..d4ecc90ff0 100755 --- a/main/exercise/upload_exercise.php +++ b/main/exercise/upload_exercise.php @@ -388,7 +388,7 @@ function lp_upload_quiz_action_handling() $comment = isset($feedbackTrueList[$i]) ? $feedbackTrueList[$i] : ''; } else { $comment = isset($feedbackFalseList[$i]) ? $feedbackFalseList[$i] : ''; - $floatVal = (float)$answer_data['extra']; + $floatVal = (float) $answer_data['extra']; if (is_numeric($floatVal)) { $score = $answer_data['extra']; } diff --git a/main/forum/forumsearch.php b/main/forum/forumsearch.php index 3da7a165fb..ed92bb1a1d 100755 --- a/main/forum/forumsearch.php +++ b/main/forum/forumsearch.php @@ -41,12 +41,12 @@ $nameTools = get_lang('ToolForum'); // Breadcrumbs -if (isset($_SESSION['gradebook'])){ +if (isset($_SESSION['gradebook'])) { $gradebook = $_SESSION['gradebook']; } if (!empty($gradebook) && $gradebook == 'view') { - $interbreadcrumb[] = array ( + $interbreadcrumb[] = array( 'url' => '../gradebook/'.$_SESSION['gradebook_dest'], 'name' => get_lang('ToolGradebook') ); @@ -59,7 +59,7 @@ if ($origin == 'group') { $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'group/group.php?'.api_get_cidreq(), 'name' => get_lang('Groups')); $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'group/group_space.php?'.api_get_cidreq(), 'name' => get_lang('GroupSpace').' ('.$group_properties['name'].')'); $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'forum/viewforum.php?origin='.$origin.'&forum='.intval($_GET['forum']).'&'.api_get_cidreq(), 'name' => prepare4display($current_forum['forum_title'])); - $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'forum/forumsearch.php?'.api_get_cidreq(),'name' => get_lang('ForumSearch')); + $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'forum/forumsearch.php?'.api_get_cidreq(), 'name' => get_lang('ForumSearch')); } else { $interbreadcrumb[] = array('url' => api_get_path(WEB_CODE_PATH).'forum/index.php?'.api_get_cidreq(), 'name' => $nameTools); $nameTools = get_lang('ForumSearch'); diff --git a/main/forum/index.php b/main/forum/index.php index f0920d79b6..f6808d1d90 100755 --- a/main/forum/index.php +++ b/main/forum/index.php @@ -64,7 +64,7 @@ if (!empty($_GET['gradebook']) && $_GET['gradebook'] == 'view') { if (!empty($gradebook) && $gradebook == 'view') { $interbreadcrumb[] = array( - 'url' => '../gradebook/' . $_SESSION['gradebook_dest'], + 'url' => '../gradebook/'.$_SESSION['gradebook_dest'], 'name' => get_lang('ToolGradebook'), ); } @@ -79,7 +79,7 @@ if ($actions === 'add') { switch ($_GET['content']) { case 'forum': $interbreadcrumb[] = array( - 'url' => 'index.php?search=' . $search_forum . '&' . api_get_cidreq(), + 'url' => 'index.php?search='.$search_forum.'&'.api_get_cidreq(), 'name' => get_lang('Forum'), ); $interbreadcrumb[] = array( @@ -89,7 +89,7 @@ if ($actions === 'add') { break; case 'forumcategory': $interbreadcrumb[] = array( - 'url' => 'index.php?search=' . $search_forum . '&' . api_get_cidreq(), + 'url' => 'index.php?search='.$search_forum.'&'.api_get_cidreq(), 'name' => get_lang('Forum'), ); $interbreadcrumb[] = array( @@ -182,7 +182,7 @@ if (!empty($_GET['lp_id']) || !empty($_POST['lp_id'])) { . "&gradebook=&action=add_item&type=step&lp_id=$lp_id#resource_tab-5\">" . Display::return_icon( 'back.png', - get_lang("BackTo") . ' ' . get_lang("LearningPaths"), + get_lang("BackTo").' '.get_lang("LearningPaths"), '', ICON_SIZE_MEDIUM ) @@ -194,8 +194,8 @@ if (!empty($forum_list)) { if (api_is_allowed_to_edit(false, true)) { echo ' ' . + . api_get_self().'?'.api_get_cidreq() + . '&action=add&content=forumcategory&lp_id='.$lp_id.'"> '. Display::return_icon( 'new_folder.png', get_lang('AddForumCategory'), '', ICON_SIZE_MEDIUM ) @@ -245,7 +245,7 @@ if (is_array($forumCategories)) { ); if (empty($sessionId) && !empty($forumCategory['session_name'])) { - $session_displayed = ' (' . Security::remove_XSS($forumCategory['session_name']) . ')'; + $session_displayed = ' ('.Security::remove_XSS($forumCategory['session_name']).')'; } else { $session_displayed = ''; } @@ -257,7 +257,7 @@ if (is_array($forumCategories)) { $html = ''; $iconsEdit = ''; $idCategory = $forumCategory['cat_id']; - $urlCategory = 'viewforumcategory.php?' . api_get_cidreq() . '&forumcategory=' . intval($idCategory); + $urlCategory = 'viewforumcategory.php?'.api_get_cidreq().'&forumcategory='.intval($idCategory); $titleCategory = Display::tag( 'a', $forumCategory['cat_title'], @@ -275,9 +275,9 @@ if (is_array($forumCategories)) { !($forumCategory['session_id'] == 0 && intval($sessionId) != 0) ) { - $iconsEdit .= '' . Display::return_icon( + $iconsEdit .= ''.Display::return_icon( 'edit.png', get_lang('Edit'), array(), @@ -285,8 +285,8 @@ if (is_array($forumCategories)) { ) . ''; - $iconsEdit .=''; - $iconsEdit .= return_visible_invisible_icon( + $iconsEdit .= return_visible_invisible_icon( 'forumcategory', strval(intval($idCategory)), strval(intval($forumCategory['visibility'])) @@ -334,7 +334,7 @@ if (is_array($forumCategories)) { array(), ICON_SIZE_MEDIUM ); - $html .= '

' . $icoCategory . $titleCategory . '

'; + $html .= '

'.$icoCategory.$titleCategory.'

'; if ($descriptionCategory != '' && trim($descriptionCategory) != ' ') { $html .= '
'.$descriptionCategory.'
'; @@ -405,7 +405,7 @@ if (is_array($forumCategories)) { $imgForum = ''; // Showing the image if (!empty($forum['forum_image'])) { - $image_path = api_get_path(WEB_COURSE_PATH). api_get_course_path(). '/upload/forum/images/'. $forum['forum_image']; + $image_path = api_get_path(WEB_COURSE_PATH).api_get_course_path().'/upload/forum/images/'.$forum['forum_image']; $image_size = api_getimagesize($image_path); $img_attributes = ''; if (!empty($image_size)) { @@ -452,15 +452,15 @@ if (is_array($forumCategories)) { 30 ); $forum_title_group_addition = ' (
' . get_lang('GoTo') . ' ' . $group_title . ')' + . api_get_cidreq().'&gidReq='.$forum['forum_of_group'] + . '" class="forum_group_link">'.get_lang('GoTo').' '.$group_title.')' . $session_img; } else { $forum_title_group_addition = ''; } if (empty($sessionId) && !empty($forum['session_name'])) { - $session_displayed = ' (' . $forum['session_name'] . ')'; + $session_displayed = ' ('.$forum['session_name'].')'; } else { $session_displayed = ''; } @@ -475,7 +475,7 @@ if (is_array($forumCategories)) { $html .= '
'; $html .= '
'; $html .= '
'.Display::url($forum_image, $linkForum); - $html .= '

'.$number_threads.' ' . get_lang('ForumThreads') . '

' + $html .= '

'.$number_threads.' '.get_lang('ForumThreads').'

' . '
'; $html .= '
'; @@ -491,7 +491,7 @@ if (is_array($forumCategories)) { 'a', $forum['forum_title'], [ - 'href' => $linkForum , + 'href' => $linkForum, 'class' => empty($forum['visibility']) ? 'text-muted' : null ] ); @@ -503,7 +503,7 @@ if (is_array($forumCategories)) { } } - $html .= '

' . $iconForum . $linkForum . '

'; + $html .= '

'.$iconForum.$linkForum.'

'; $html .= Display::tag( 'p', Security::remove_XSS($forum['forum_comment']), @@ -519,7 +519,7 @@ if (is_array($forumCategories)) { ); if (!empty($waitingCount)) { $html .= Display::label( - get_lang('PostsPendingModeration'). ': '.$waitingCount, + get_lang('PostsPendingModeration').': '.$waitingCount, 'warning' ); } @@ -532,9 +532,9 @@ if (is_array($forumCategories)) { // The number of topics and posts. if ($forum['forum_of_group'] !== '0') { - $newPost=''; + $newPost = ''; if (is_array($mywhatsnew_post_info) && !empty($mywhatsnew_post_info)) { - $newPost = ' ' . Display::return_icon( + $newPost = ' '.Display::return_icon( 'alert.png', get_lang('Forum'), null, @@ -545,7 +545,7 @@ if (is_array($forumCategories)) { } } else { if (is_array($mywhatsnew_post_info) && !empty($mywhatsnew_post_info)) { - $newPost = ' ' . Display::return_icon( + $newPost = ' '.Display::return_icon( 'alert.png', get_lang('Forum'), null, @@ -589,9 +589,9 @@ if (is_array($forumCategories)) { null, ICON_SIZE_TINY ) - . ' ' . + . ' '. api_convert_and_format_date($forum['last_post_date']) - . '
' . get_lang('By') . ' ' . + . '
'.get_lang('By').' '. display_user_link( $poster_id, $name, @@ -605,13 +605,13 @@ if (is_array($forumCategories)) { if (api_is_allowed_to_edit(false, true) && !($forum['session_id'] == 0 && intval($sessionId) != 0) ) { - $html .= '' + $html .= '' . Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL) . ''; - $html .= '" @@ -652,8 +652,8 @@ if (is_array($forumCategories)) { !api_is_anonymous() && api_is_allowed_to_session_edit(false, true) ) { - $html .= '' + $html .= '' . Display::return_icon($iconnotify, get_lang('NotifyMe'), null, ICON_SIZE_SMALL) . ''; } @@ -670,7 +670,7 @@ if (is_array($forumCategories)) { } } } else { - echo '
' . get_lang('NoForumInThisCategory') . '
' + echo '
'.get_lang('NoForumInThisCategory').'
' . (api_is_allowed_to_edit(false, true) ? '
' : '
') . '
'; } diff --git a/main/forum/viewthread_flat.inc.php b/main/forum/viewthread_flat.inc.php index 2d5cabcd9e..4a8bea2cf4 100755 --- a/main/forum/viewthread_flat.inc.php +++ b/main/forum/viewthread_flat.inc.php @@ -56,7 +56,7 @@ if (isset($current_thread['thread_id'])) { if (!api_is_anonymous() && api_is_allowed_to_session_edit(false, true)) { $buttonReply = Display::toolbarButton( get_lang('ReplyToMessage'), - 'reply.php?' . api_get_cidreq() . '&' . http_build_query([ + 'reply.php?'.api_get_cidreq().'&'.http_build_query([ 'forum' => $clean_forum_id, 'thread' => $clean_thread_id, 'post' => $row['post_id'], @@ -69,7 +69,7 @@ if (isset($current_thread['thread_id'])) { $buttonQuote = Display::toolbarButton( get_lang('QuoteMessage'), - 'reply.php?' . api_get_cidreq() . '&' . http_build_query([ + 'reply.php?'.api_get_cidreq().'&'.http_build_query([ 'forum' => $clean_forum_id, 'thread' => $clean_thread_id, 'post' => $row['post_id'], @@ -85,21 +85,21 @@ if (isset($current_thread['thread_id'])) { if (($current_forum_category && $current_forum_category['locked'] == 1)) { $closedPost = Display::tag( 'div', - ' ' . get_lang('ForumcategoryLocked'), + ' '.get_lang('ForumcategoryLocked'), array('class' => 'alert alert-warning post-closed') ); } if ($current_forum['locked'] == 1) { $closedPost = Display::tag( 'div', - ' ' . get_lang('ForumLocked'), + ' '.get_lang('ForumLocked'), array('class' => 'alert alert-warning post-closed') ); } if ($current_thread['locked'] == 1) { $closedPost = Display::tag( 'div', - ' ' . get_lang('ThreadLocked'), + ' '.get_lang('ThreadLocked'), array('class' => 'alert alert-warning post-closed') ); } @@ -113,7 +113,7 @@ if (isset($current_thread['thread_id'])) { if ($origin != 'learnpath') { if (api_get_course_setting('allow_user_image_forum')) { - $html .= '
' . display_user_image($row['user_id'], $name, $origin) . '
'; + $html .= '
'.display_user_image($row['user_id'], $name, $origin).'
'; } $html .= Display::tag( 'h4', @@ -122,9 +122,9 @@ if (isset($current_thread['thread_id'])) { ); } else { if (api_get_course_setting('allow_user_image_forum')) { - $html .= '
' . display_user_image($row['user_id'], $name, $origin) . '
'; + $html .= '
'.display_user_image($row['user_id'], $name, $origin).'
'; } - $name = Display::tag('strong', "#" . $postCount--, ['class' => 'text-info']) . " | $name"; + $name = Display::tag('strong', "#".$postCount--, ['class' => 'text-info'])." | $name"; $html .= Display::tag( 'p', $name, @@ -167,10 +167,10 @@ if (isset($current_thread['thread_id'])) { ) { if (api_is_allowed_to_session_edit(false, true)) { if ($locked == false && postIsEditableByStudent($current_forum, $row)) { - $iconEdit .= "" - . Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL) . ""; + $iconEdit .= "" + . Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL).""; } } } @@ -181,7 +181,7 @@ if (isset($current_thread['thread_id'])) { !(api_is_course_coach() && $current_forum['session_id'] != $sessionId) ) { if ($locked === false) { - $deleteUrl = api_get_self() . '?' . api_get_cidreq() . '&' . http_build_query([ + $deleteUrl = api_get_self().'?'.api_get_cidreq().'&'.http_build_query([ 'forum' => $clean_forum_id, 'thread' => $clean_thread_id, 'action' => 'delete', @@ -220,8 +220,8 @@ if (isset($current_thread['thread_id'])) { ); if ($increment > 0) { - $iconEdit .= "" + $iconEdit .= "" . Display::return_icon('move.png', get_lang('MovePost'), array(), ICON_SIZE_SMALL) . ""; } @@ -247,10 +247,10 @@ if (isset($current_thread['thread_id'])) { } if ($increment > 0 && $locked == false && $userCanEdit) { - $iconEdit .= "" + $iconEdit .= "" . Display::return_icon('quiz.png', get_lang('Qualify')) . " "; } @@ -315,26 +315,26 @@ if (isset($current_thread['thread_id'])) { $realname = $attachment['path']; $user_filename = $attachment['filename']; $html .= Display::return_icon('attachment.gif', get_lang('Attachment')); - $html .= ' ' . $user_filename . ' '; + $html .= ' '.$user_filename.' '; if (($current_forum['allow_edit'] == 1 && $row['user_id'] == $_user['user_id']) || (api_is_allowed_to_edit(false, true) && !(api_is_course_coach() && $current_forum['session_id'] != $sessionId)) ) { - $html .= '  ' . Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL) . '
'; } - $html .= '' . $attachment['comment'] . ''; + $html .= ''.$attachment['comment'].''; } } $html .= '
'; $html .= '
'; - $html .= $buttonReply . ' ' . $buttonQuote; + $html .= $buttonReply.' '.$buttonQuote; $html .= '
'; $html .= '
'; diff --git a/main/inc/lib/access_url_edit_users_to_url_functions.lib.php b/main/inc/lib/access_url_edit_users_to_url_functions.lib.php index b82994866e..e347c08ab8 100755 --- a/main/inc/lib/access_url_edit_users_to_url_functions.lib.php +++ b/main/inc/lib/access_url_edit_users_to_url_functions.lib.php @@ -43,22 +43,22 @@ class Accessurledituserstourl ' WHERE (username LIKE "'.$needle.'%" '. ' OR firstname LIKE "'.$needle.'%" '. ' OR lastname LIKE "'.$needle.'%") '. - $order_clause . + $order_clause. ' LIMIT 11'; $rs = Database::query($sql); - $i=0; + $i = 0; while ($user = Database::fetch_array($rs)) { $i++; - if ($i<=10) { + if ($i <= 10) { $return .= ''.api_get_person_name($user['firstname'], $user['lastname']).' ('.$user['username'].')
'; } else { $return .= '...
'; } } } - $xajax_response -> addAssign('ajax_list_users','innerHTML',api_utf8_encode($return)); + $xajax_response -> addAssign('ajax_list_users', 'innerHTML', api_utf8_encode($return)); return $xajax_response; } } diff --git a/main/inc/lib/course_request.lib.php b/main/inc/lib/course_request.lib.php index 8c1a1878e9..a7ca0e33ba 100755 --- a/main/inc/lib/course_request.lib.php +++ b/main/inc/lib/course_request.lib.php @@ -65,8 +65,8 @@ class CourseRequestManager $exemplary_content ) { $wanted_code = trim($wanted_code); - $user_id = (int)$user_id; - $exemplary_content = (bool)$exemplary_content ? 1 : 0; + $user_id = (int) $user_id; + $exemplary_content = (bool) $exemplary_content ? 1 : 0; if ($wanted_code == '') { return false; @@ -252,10 +252,10 @@ class CourseRequestManager $user_id, $exemplary_content ) { - $id = (int)$id; + $id = (int) $id; $wanted_code = trim($wanted_code); - $user_id = (int)$user_id; - $exemplary_content = (bool)$exemplary_content ? 1 : 0; + $user_id = (int) $user_id; + $exemplary_content = (bool) $exemplary_content ? 1 : 0; if ($wanted_code == '') { return false; @@ -358,7 +358,7 @@ class CourseRequestManager */ public static function delete_course_request($id) { - $id = (int)$id; + $id = (int) $id; $sql = "DELETE FROM ".Database::get_main_table(TABLE_MAIN_COURSE_REQUEST)." WHERE id = ".$id; $result = Database::query($sql); @@ -376,7 +376,7 @@ class CourseRequestManager if (is_null($status)) { $sql = "SELECT COUNT(id) AS number FROM ".$course_table; } else { - $status = (int)$status; + $status = (int) $status; $sql = "SELECT COUNT(id) AS number FROM ".$course_table." WHERE status = ".$status; } @@ -395,7 +395,7 @@ class CourseRequestManager */ public static function get_course_request_info($id) { - $id = (int)$id; + $id = (int) $id; $sql = "SELECT * FROM ".Database::get_main_table(TABLE_MAIN_COURSE_REQUEST)." WHERE id = ".$id; @@ -413,7 +413,7 @@ class CourseRequestManager */ public static function get_course_request_code($id) { - $id = (int)$id; + $id = (int) $id; $sql = "SELECT code FROM ".Database::get_main_table(TABLE_MAIN_COURSE_REQUEST)." WHERE id = ".$id; @@ -434,7 +434,7 @@ class CourseRequestManager */ public static function accept_course_request($id) { - $id = (int)$id; + $id = (int) $id; // Retrieve request's data $course_request_info = self::get_course_request_info($id); @@ -447,7 +447,7 @@ class CourseRequestManager return false; }*/ - $user_id = (int)$course_request_info['user_id']; + $user_id = (int) $course_request_info['user_id']; if ($user_id <= 0) { return false; } @@ -538,7 +538,7 @@ class CourseRequestManager */ public static function reject_course_request($id) { - $id = (int)$id; + $id = (int) $id; // Retrieve request's data $course_request_info = self::get_course_request_info($id); if (!is_array($course_request_info)) { @@ -616,7 +616,7 @@ class CourseRequestManager */ public static function ask_for_additional_info($id) { - $id = (int)$id; + $id = (int) $id; // Retrieve request's data $course_request_info = self::get_course_request_info($id); @@ -707,7 +707,7 @@ class CourseRequestManager */ public static function additional_info_asked($id) { - $id = (int)$id; + $id = (int) $id; $sql = "SELECT id FROM ".Database::get_main_table(TABLE_MAIN_COURSE_REQUEST)." WHERE (id = ".$id." AND info > 0)"; $result = Database::num_rows(Database::query($sql)); diff --git a/main/inc/lib/display.lib.php b/main/inc/lib/display.lib.php index d38d7e22a1..36f98034c1 100755 --- a/main/inc/lib/display.lib.php +++ b/main/inc/lib/display.lib.php @@ -56,7 +56,7 @@ class Display * @param string Optional help file name * @param string $page_header */ - public static function display_header($tool_name ='', $help = null, $page_header = null) + public static function display_header($tool_name = '', $help = null, $page_header = null) { $origin = api_get_origin(); $showHeader = true; @@ -345,7 +345,7 @@ class Display $grid_class = array(), $elementCount = 0 ) { - $column = 0; + $column = 0; $default_items_per_page = isset($paging_options['per_page']) ? $paging_options['per_page'] : 20; $table = new SortableTableFromArray($content, $column, $default_items_per_page, $name); @@ -507,7 +507,7 @@ class Display * @param string $type * @param bool $filter */ - public static function return_message_and_translate($message, $type='normal', $filter = true) + public static function return_message_and_translate($message, $type = 'normal', $filter = true) { $message = get_lang($message); echo self::return_message($message, $type, $filter); @@ -574,14 +574,14 @@ class Display } // Encrypt email $hmail = ''; - for ($i = 0; $i < strlen($email); $i ++) { + for ($i = 0; $i < strlen($email); $i++) { $hmail .= '&#'.ord($email { $i }).';'; } $hclickable_text = null; // Encrypt clickable text if @ is present if (strpos($clickable_text, '@')) { - for ($i = 0; $i < strlen($clickable_text); $i ++) { + for ($i = 0; $i < strlen($clickable_text); $i++) { $hclickable_text .= '&#'.ord($clickable_text { $i }).';'; } @@ -613,7 +613,7 @@ class Display } // Encrypt email $hmail = ''; - for ($i = 0; $i < strlen($email); $i ++) { + for ($i = 0; $i < strlen($email); $i++) { $hmail .= '&#'.ord($email { $i }).';'; } @@ -633,7 +633,7 @@ class Display public static function get_alphabet_options($selected_letter = '') { $result = ''; - for ($i = 65; $i <= 90; $i ++) { + for ($i = 65; $i <= 90; $i++) { $letter = chr($i); $result .= ''; } } $html .= ''; @@ -1019,7 +1019,7 @@ class Display */ public static function tabs($headers, $items, $id = 'tabs', $attributes = array(), $ul_attributes = array()) { - if (empty($headers) || count($headers) == 0 ) { + if (empty($headers) || count($headers) == 0) { return ''; } @@ -1072,7 +1072,7 @@ class Display $attributes ); - return $main_div ; + return $main_div; } /** @@ -1120,8 +1120,8 @@ class Display */ public static function grid_html($div_id) { - $table = self::tag('table','', array('id' => $div_id)); - $table .= self::tag('div','', array('id' => $div_id.'_pager')); + $table = self::tag('table', '', array('id' => $div_id)); + $table .= self::tag('div', '', array('id' => $div_id.'_pager')); return $table; } @@ -1182,7 +1182,7 @@ class Display $obj->colNames = $column_names; $obj->colModel = $column_model; $obj->pager = '#'.$div_id.'_pager'; - $obj->datatype = 'json'; + $obj->datatype = 'json'; $obj->viewrecords = 'true'; $all_value = 10000000; @@ -1243,10 +1243,10 @@ class Display // Adding static data. if (!empty($data)) { $data_var = $div_id.'_data'; - $json.=' var '.$data_var.' = '.json_encode($data).';'; + $json .= ' var '.$data_var.' = '.json_encode($data).';'; $obj->data = $data_var; $obj->datatype = 'local'; - $json.="\n"; + $json .= "\n"; } $obj->end = 'end'; @@ -1260,12 +1260,12 @@ class Display } // Fixing true/false js values that doesn't need the "" - $json_encode = str_replace(':"true"',':true',$json_encode); + $json_encode = str_replace(':"true"', ':true', $json_encode); // wrap_cell is not a valid jqgrid attributes is a hack to wrap a text $json_encode = str_replace('"wrap_cell":true', 'cellattr : function(rowId, value, rowObject, colModel, arrData) { return \'class = "jqgrid_whitespace"\'; }', $json_encode); - $json_encode = str_replace(':"false"',':false',$json_encode); + $json_encode = str_replace(':"false"', ':false', $json_encode); $json_encode = str_replace('"formatter":"action_formatter"', 'formatter:action_formatter', $json_encode); - $json_encode = str_replace(array('{"first":"first",','"end":"end"}'), '', $json_encode); + $json_encode = str_replace(array('{"first":"first",', '"end":"end"}'), '', $json_encode); // Creating the jqgrid element. $json .= '$("#'.$div_id.'").jqGrid({'; @@ -1280,22 +1280,22 @@ class Display $groups = ''; foreach ($extra_params['groupHeaders'] as $group) { //{ "startColumnName" : "courses", "numberOfColumns" : 1, "titleText" : "Order Info" }, - $groups .= '{ "startColumnName" : "' . $group['startColumnName'] . '", "numberOfColumns" : ' . $group['numberOfColumns'] . ', "titleText" : "' . $group['titleText'] . '" },'; + $groups .= '{ "startColumnName" : "'.$group['startColumnName'].'", "numberOfColumns" : '.$group['numberOfColumns'].', "titleText" : "'.$group['titleText'].'" },'; } $json .= '$("#'.$div_id.'").jqGrid("setGroupHeaders", { "useColSpanStyle" : false, "groupHeaders" : [ - ' . $groups . ' + ' . $groups.' ] });'; } $all_text = addslashes(get_lang('All')); $json .= '$("'.$obj->pager.' option[value='.$all_value.']").text("'.$all_text.'");'; - $json.= "\n"; + $json .= "\n"; // Adding edit/delete icons. - $json.= $formatter; + $json .= $formatter; return $json; } @@ -1326,7 +1326,7 @@ class Display } if (!empty($rows)) { - foreach($rows as $content) { + foreach ($rows as $content) { $table->setCellContents($row, $column, $content); $row++; } @@ -1439,7 +1439,7 @@ class Display lastedit_user_id != $user_id $sessionCondition AND visibility != 2 AND (to_user_id IN ('$user_id', '0') OR to_user_id IS NULL) AND - (to_group_id IN ('".implode("','",$group_ids)."') OR to_group_id IS NULL) + (to_group_id IN ('".implode("','", $group_ids)."') OR to_group_id IS NULL) ORDER BY lastedit_date DESC LIMIT 1"; $result = Database::query($sql); @@ -1457,9 +1457,8 @@ class Display $return = ' '; foreach ($notifications as $notification) { $toolName = $notification['tool']; - if (! - ( - $notification['visibility'] == '1' || + if (!( + $notification['visibility'] == '1' || ($status == '1' && $notification['visibility'] == '0') || !isset($notification['visibility']) ) @@ -1543,9 +1542,9 @@ class Display $main_user_table = Database::get_main_table(TABLE_MAIN_USER); $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION); // Request for the name of the general coach - $sql ='SELECT tu.lastname, tu.firstname, ts.* + $sql = 'SELECT tu.lastname, tu.firstname, ts.* FROM '.$tbl_session.' ts - LEFT JOIN '.$main_user_table .' tu + LEFT JOIN '.$main_user_table.' tu ON ts.id_coach = tu.user_id WHERE ts.id = '.intval($session_id); $rs = Database::query($sql); @@ -1557,7 +1556,7 @@ class Display $session['title'] = $session_info['name']; $session['id_coach'] = $session_info['id_coach']; $session['coach'] = ''; - $session['dates'] = ''; + $session['dates'] = ''; if (api_get_setting('show_session_coach') === 'true') { $session['coach'] = get_lang('GeneralCoach').': '.api_get_person_name($session_info['firstname'], $session_info['lastname']); @@ -1617,7 +1616,7 @@ class Display $session['dates'] = $dates['access']; - if (api_get_setting('show_session_coach') === 'true' ) { + if (api_get_setting('show_session_coach') === 'true') { $session['coach'] = api_get_person_name( $session_info['firstname'], $session_info['lastname'] @@ -1675,9 +1674,9 @@ class Display $percentage = isset($point_info['point_average']) ? $point_info['point_average'] : 0; if (!empty($percentage)) { - $percentage = $percentage*125/100; + $percentage = $percentage * 125 / 100; } - $accesses = isset($point_info['accesses']) ? $point_info['accesses'] : 0; + $accesses = isset($point_info['accesses']) ? $point_info['accesses'] : 0; $star_label = sprintf(get_lang('XStarsOutOf5'), $point_info['point_average_star']); $html = '
    @@ -1691,15 +1690,15 @@ class Display $labels = array(); - $labels[]= $number_of_users_who_voted == 1 ? $number_of_users_who_voted.' '.get_lang('Vote') : $number_of_users_who_voted.' '.get_lang('Votes'); - $labels[]= $accesses == 1 ? $accesses.' '.get_lang('Visit') : $accesses.' '.get_lang('Visits'); - $labels[]= $point_info['user_vote'] ? get_lang('YourVote').' ['.$point_info['user_vote'].']' : get_lang('YourVote'). ' [?] '; + $labels[] = $number_of_users_who_voted == 1 ? $number_of_users_who_voted.' '.get_lang('Vote') : $number_of_users_who_voted.' '.get_lang('Votes'); + $labels[] = $accesses == 1 ? $accesses.' '.get_lang('Visit') : $accesses.' '.get_lang('Visits'); + $labels[] = $point_info['user_vote'] ? get_lang('YourVote').' ['.$point_info['user_vote'].']' : get_lang('YourVote').' [?] '; if (!$add_div_wrapper && api_is_anonymous()) { - $labels[]= self::tag('span', get_lang('LoginToVote'), array('class' => 'error')); + $labels[] = self::tag('span', get_lang('LoginToVote'), array('class' => 'error')); } - $html .= self::div(implode(' | ', $labels) , array('id' => 'vote_label_'.$id, 'class' => 'vote_label_info')); + $html .= self::div(implode(' | ', $labels), array('id' => 'vote_label_'.$id, 'class' => 'vote_label_info')); $html .= ' '.self::span(' ', array('id' => 'vote_label2_'.$id)); if ($add_div_wrapper) { @@ -1772,8 +1771,8 @@ class Display if (!empty($list)) { $html = '
    '; foreach ($list as $item) { - $html .= '
    ' . $item['title'] . '
    '; - $html .= '
    ' . $item['content'] . '
    '; + $html .= '
    '.$item['title'].'
    '; + $html .= '
    '.$item['content'].'
    '; } $html .= '
    '; } @@ -1815,7 +1814,7 @@ class Display * @param string $type * @return null|string */ - public static function badge($count, $type ="warning") + public static function badge($count, $type = "warning") { $class = ''; @@ -1891,7 +1890,7 @@ class Display if (!empty($content)) { $html = ''; $html .= $content; - $html .=''; + $html .= ''; } return $html; @@ -1912,7 +1911,7 @@ class Display $class = 'class ="active"'; } - if (basename($_SERVER['REQUEST_URI']) == basename($value['url']) ) { + if (basename($_SERVER['REQUEST_URI']) == basename($value['url'])) { $class = 'class ="active"'; } $html .= "
  • "; @@ -2010,7 +2009,7 @@ class Display -