|
137 | 137 | }
|
138 | 138 |
|
139 | 139 | // parameters passed via GET
|
140 |
| -$logout = isset($_GET['logout']) ? $_GET['logout'] : ''; |
| 140 | +$logout = $_GET['logout'] ?? ''; |
141 | 141 | $gidReq = isset($_GET['gidReq']) ? (int) $_GET['gidReq'] : '';
|
142 | 142 |
|
143 | 143 | // Keep a trace of the course and session from which we are getting out, to
|
|
167 | 167 |
|
168 | 168 | // $cDir is a special url param sent from a redirection from /courses/[DIR]/index.php...
|
169 | 169 | // It replaces cidReq in some opportunities
|
170 |
| -$cDir = isset($_GET['cDir']) && !empty($_GET['cDir']) ? $_GET['cDir'] : ''; |
| 170 | +$cDir = !empty($_GET['cDir']) ? $_GET['cDir'] : ''; |
171 | 171 |
|
172 | 172 | // if there is a cDir parameter in the URL and $cidReq could not be determined
|
173 | 173 | if (!empty($cDir) && empty($cidReq)) {
|
|
189 | 189 | $cidReq = null;
|
190 | 190 | }
|
191 | 191 |
|
192 |
| -$gidReset = isset($gidReset) ? $gidReset : ''; |
| 192 | +$gidReset = $gidReset ?? ''; |
193 | 193 | // $gidReset can be set in URL-parameter
|
194 | 194 |
|
195 | 195 | // parameters passed via POST
|
196 |
| -$login = isset($_POST["login"]) ? $_POST["login"] : ''; |
| 196 | +$login = $_POST["login"] ?? ''; |
197 | 197 | // register if the user is just logging in, in order to redirect him
|
198 | 198 | $logging_in = false;
|
199 | 199 |
|
|
484 | 484 | // Check captcha
|
485 | 485 | $captchaText = $_POST['captcha'];
|
486 | 486 | /** @var Text_CAPTCHA $obj */
|
487 |
| - $obj = isset($_SESSION['template.lib']) ? $_SESSION['template.lib'] : null; |
| 487 | + $obj = $_SESSION['template.lib'] ?? null; |
488 | 488 | if ($obj) {
|
489 | 489 | $obj->getPhrase();
|
490 | 490 | if ($obj->getPhrase() != $captchaText) {
|
|
500 | 500 | }
|
501 | 501 |
|
502 | 502 | // Redirect to login page
|
503 |
| - if ($captchaValidated == false) { |
| 503 | + if (!$captchaValidated) { |
504 | 504 | $loginFailed = true;
|
505 | 505 | Session::erase('_uid');
|
506 | 506 | Session::write('loginFailed', '1');
|
|
512 | 512 | // Check if account is blocked by captcha user extra field see function api_block_account_captcha()
|
513 | 513 | $blockedUntilDate = api_get_user_blocked_by_captcha($login);
|
514 | 514 |
|
515 |
| - if (isset($blockedUntilDate) && !empty($blockedUntilDate)) { |
| 515 | + if (!empty($blockedUntilDate)) { |
516 | 516 | if (time() > api_strtotime($blockedUntilDate, 'UTC')) {
|
517 | 517 | api_clean_account_captcha($login);
|
518 | 518 | } else {
|
|
541 | 541 | if ($validPassword === false) {
|
542 | 542 | // Use external webservice to
|
543 | 543 | $options = api_get_configuration_value('webservice_validation');
|
544 |
| - if (!empty($options) && isset($options['options']) && !empty($options['options'])) { |
| 544 | + if (!empty($options) && !empty($options['options'])) { |
545 | 545 | $options = $options['options'];
|
546 | 546 | $soapclient = new nusoap_client($options['wsdl']);
|
547 | 547 | $function = $options['check_login_function'];
|
|
588 | 588 | 'update_type'
|
589 | 589 | );
|
590 | 590 |
|
591 |
| - $update_type = isset($update_type['update_type']) ? $update_type['update_type'] : ''; |
| 591 | + $update_type = $update_type['update_type'] ?? ''; |
592 | 592 | if (!empty($extAuthSource[$update_type]['updateUser'])
|
593 | 593 | && file_exists($extAuthSource[$update_type]['updateUser'])
|
594 | 594 | ) {
|
|
1084 | 1084 |
|
1085 | 1085 | // if the requested course is different from the course in session
|
1086 | 1086 | if (!empty($cidReq) && (!isset($_SESSION['_cid']) ||
|
1087 |
| - (isset($_SESSION['_cid']) && $cidReq != $_SESSION['_cid'])) |
| 1087 | + ($cidReq != $_SESSION['_cid'])) |
1088 | 1088 | ) {
|
1089 | 1089 | $cidReset = true;
|
1090 | 1090 | $gidReset = true; // As groups depend from courses, group id is reset
|
|
1141 | 1141 | Session::write('is_allowedCreateCourse', $is_allowedCreateCourse);
|
1142 | 1142 | } else { // continue with the previous values
|
1143 | 1143 | $_user = $_SESSION['_user'];
|
1144 |
| - $is_platformAdmin = isset($_SESSION['is_platformAdmin']) ? $_SESSION['is_platformAdmin'] : false; |
1145 |
| - $is_allowedCreateCourse = isset($_SESSION['is_allowedCreateCourse']) ? $_SESSION['is_allowedCreateCourse'] : false; |
| 1144 | + $is_platformAdmin = $_SESSION['is_platformAdmin'] ?? false; |
| 1145 | + $is_allowedCreateCourse = $_SESSION['is_allowedCreateCourse'] ?? false; |
1146 | 1146 | }
|
1147 | 1147 |
|
1148 | 1148 | $logoutCourseCalled = false;
|
|
1153 | 1153 | // The value $_dont_save_user_course_access should be added before
|
1154 | 1154 | // the call of global.inc.php see the main/inc/chat.ajax.php file
|
1155 | 1155 | // Disables the updates in the TRACK_E_COURSE_ACCESS table
|
1156 |
| - if (isset($_dont_save_user_course_access) && $_dont_save_user_course_access == true) { |
| 1156 | + if (isset($_dont_save_user_course_access) && $_dont_save_user_course_access) { |
1157 | 1157 | $save_course_access = false;
|
1158 | 1158 | } else {
|
1159 | 1159 | $logoutCourseCalled = true;
|
|
1238 | 1238 | }
|
1239 | 1239 | } else {
|
1240 | 1240 | // Leave a logout time in the track_e_course_access table if we were in a course
|
1241 |
| - if ($logoutCourseCalled == false) { |
| 1241 | + if (!$logoutCourseCalled) { |
1242 | 1242 | Event::courseLogout($logoutInfo);
|
1243 | 1243 | }
|
1244 | 1244 | Session::erase('_cid');
|
|
1319 | 1319 |
|
1320 | 1320 | /* COURSE / USER REL. INIT */
|
1321 | 1321 | $session_id = api_get_session_id();
|
1322 |
| -$user_id = isset($_user['user_id']) ? $_user['user_id'] : null; |
| 1322 | +$user_id = $_user['user_id'] ?? null; |
1323 | 1323 |
|
1324 | 1324 | //Course permissions
|
1325 | 1325 | //if this code is uncommented in some platforms the is_courseAdmin is not correctly saved see BT#5789
|
|
1734 | 1734 |
|
1735 | 1735 | if (!$is_platformAdmin) {
|
1736 | 1736 | if (!$is_courseMember &&
|
1737 |
| - isset($_course['registration_code']) && |
1738 | 1737 | !empty($_course['registration_code']) &&
|
1739 | 1738 | !Session::read('course_password_'.$_course['real_id'], false)
|
1740 | 1739 | ) {
|
|
1793 | 1792 | Session::write('is_sessionAdmin', $is_sessionAdmin);
|
1794 | 1793 | } else {
|
1795 | 1794 | // Continue with the previous values
|
1796 |
| - $is_courseAdmin = isset($_SESSION['is_courseAdmin']) ? $_SESSION['is_courseAdmin'] : false; |
1797 |
| - $is_courseTutor = isset($_SESSION['is_courseTutor']) ? $_SESSION['is_courseTutor'] : false; |
1798 |
| - $is_session_general_coach = isset($_SESSION['is_session_general_coach']) ? $_SESSION['is_session_general_coach'] : false; |
1799 |
| - $is_courseMember = isset($_SESSION['is_courseMember']) ? $_SESSION['is_courseMember'] : false; |
1800 |
| - $is_allowed_in_course = isset($_SESSION['is_allowed_in_course']) ? $_SESSION['is_allowed_in_course'] : false; |
| 1795 | + $is_courseAdmin = $_SESSION['is_courseAdmin'] ?? false; |
| 1796 | + $is_courseTutor = $_SESSION['is_courseTutor'] ?? false; |
| 1797 | + $is_session_general_coach = $_SESSION['is_session_general_coach'] ?? false; |
| 1798 | + $is_courseMember = $_SESSION['is_courseMember'] ?? false; |
| 1799 | + $is_allowed_in_course = $_SESSION['is_allowed_in_course'] ?? false; |
1801 | 1800 | }
|
1802 | 1801 |
|
1803 | 1802 | //set variable according to student_view_enabled choices
|
1804 | 1803 | if (api_get_setting('student_view_enabled') == "true") {
|
1805 | 1804 | $changed = false;
|
1806 | 1805 | if (isset($_GET['isStudentView'])) {
|
1807 | 1806 | if ($_GET['isStudentView'] == 'true') {
|
1808 |
| - if (isset($_SESSION['studentview'])) { |
1809 |
| - if (!empty($_SESSION['studentview'])) { |
1810 |
| - // switching to studentview |
1811 |
| - $_SESSION['studentview'] = 'studentview'; |
1812 |
| - $changed = true; |
1813 |
| - } |
| 1807 | + if (!empty($_SESSION['studentview'])) { |
| 1808 | + // switching to studentview |
| 1809 | + $_SESSION['studentview'] = 'studentview'; |
| 1810 | + $changed = true; |
1814 | 1811 | }
|
1815 | 1812 | } elseif ($_GET['isStudentView'] == 'false') {
|
1816 |
| - if (isset($_SESSION['studentview'])) { |
1817 |
| - if (!empty($_SESSION['studentview'])) { |
1818 |
| - // switching to teacherview |
1819 |
| - $_SESSION['studentview'] = 'teacherview'; |
1820 |
| - $changed = true; |
1821 |
| - } |
| 1813 | + if (!empty($_SESSION['studentview'])) { |
| 1814 | + // switching to teacherview |
| 1815 | + $_SESSION['studentview'] = 'teacherview'; |
| 1816 | + $changed = true; |
1822 | 1817 | }
|
1823 | 1818 | }
|
1824 | 1819 | } elseif (!empty($_SESSION['studentview'])) {
|
|
0 commit comments