@@ -9,5 +9,5 @@ |
||
9 | 9 | require_once('authcas.php'); |
10 | 10 | global $cas_auth_ver, $cas_auth_server, $cas_auth_port, $cas_auth_uri; |
11 | 11 | |
12 | -phpCAS::client($cas_auth_ver,$cas_auth_server,$cas_auth_port,$cas_auth_uri); |
|
12 | +phpCAS::client($cas_auth_ver, $cas_auth_server, $cas_auth_port, $cas_auth_uri); |
|
13 | 13 | phpCAS::logout(); |
@@ -39,7 +39,7 @@ |
||
39 | 39 | $firstpage = $_GET['firstpage']; |
40 | 40 | setcookie("GotoCourse", $firstpage); |
41 | 41 | } |
42 | - if (!is_object($PHPCAS_CLIENT) ) { |
|
42 | + if (!is_object($PHPCAS_CLIENT)) { |
|
43 | 43 | phpCAS::client( |
44 | 44 | $cas_auth_ver, |
45 | 45 | $cas_auth_server, |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | $limit |
204 | 204 | ); |
205 | 205 | } else { |
206 | - header('Location: ' . api_get_self()); |
|
206 | + header('Location: '.api_get_self()); |
|
207 | 207 | } |
208 | 208 | break; |
209 | 209 | case 'display_random_courses': |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | $continueWithSubscription = SequenceResourceManager::checkSequenceAreCompleted($requirementsData); |
279 | 279 | |
280 | 280 | if (!$continueWithSubscription) { |
281 | - header('Location: ' . api_get_path(WEB_CODE_PATH) . 'auth/courses.php'); |
|
281 | + header('Location: '.api_get_path(WEB_CODE_PATH).'auth/courses.php'); |
|
282 | 282 | exit; |
283 | 283 | } |
284 | 284 | } |
@@ -296,16 +296,16 @@ discard block |
||
296 | 296 | |
297 | 297 | if ($count <= 0) { |
298 | 298 | // no course in session -> return to catalog |
299 | - $url = api_get_path(WEB_CODE_PATH) . 'auth/courses.php'; |
|
299 | + $url = api_get_path(WEB_CODE_PATH).'auth/courses.php'; |
|
300 | 300 | } elseif ($count == 1) { |
301 | 301 | // only one course, so redirect directly to this course |
302 | 302 | foreach ($coursesList as $course) { |
303 | - $url = api_get_path(WEB_COURSE_PATH) . $course['directory'] . '/index.php?id_session=' . intval($_GET['session_id']); |
|
303 | + $url = api_get_path(WEB_COURSE_PATH).$course['directory'].'/index.php?id_session='.intval($_GET['session_id']); |
|
304 | 304 | } |
305 | 305 | } else { |
306 | - $url = api_get_path(WEB_CODE_PATH) . 'session/index.php?session_id=' . intval($_GET['session_id']); |
|
306 | + $url = api_get_path(WEB_CODE_PATH).'session/index.php?session_id='.intval($_GET['session_id']); |
|
307 | 307 | } |
308 | - header('Location: ' . $url); |
|
308 | + header('Location: '.$url); |
|
309 | 309 | exit; |
310 | 310 | } |
311 | 311 | //else show error message? |
@@ -171,28 +171,53 @@ discard block |
||
171 | 171 | } |
172 | 172 | |
173 | 173 | switch ($action) { |
174 | - case 'subscribe_user_with_password': |
|
175 | - $courses_controller->subscribe_user( |
|
176 | - isset($_POST['subscribe_user_with_password']) ? $_POST['subscribe_user_with_password'] : '', |
|
177 | - isset($_POST['search_term']) ? $_POST['search_term'] : '', |
|
178 | - isset($_POST['category_code']) ? $_POST['category_code'] : '' |
|
179 | - ); |
|
180 | - break; |
|
181 | - case 'createcoursecategory': |
|
182 | - $courses_controller->categories_list($action); |
|
183 | - break; |
|
184 | - case 'deletecoursecategory': |
|
185 | - $courses_controller->courses_list($action); |
|
186 | - break; |
|
187 | - case 'sortmycourses': |
|
188 | - $courses_controller->courses_list($action); |
|
189 | - break; |
|
190 | - case 'subscribe': |
|
191 | - if (!$user_can_view_page) { |
|
192 | - api_not_allowed(true); |
|
193 | - } |
|
194 | - |
|
195 | - if (!CoursesAndSessionsCatalog::is(CATALOG_SESSIONS)) { |
|
174 | + case 'subscribe_user_with_password': |
|
175 | + $courses_controller->subscribe_user( |
|
176 | + isset($_POST['subscribe_user_with_password']) ? $_POST['subscribe_user_with_password'] : '', |
|
177 | + isset($_POST['search_term']) ? $_POST['search_term'] : '', |
|
178 | + isset($_POST['category_code']) ? $_POST['category_code'] : '' |
|
179 | + ); |
|
180 | + break; |
|
181 | + case 'createcoursecategory': |
|
182 | + $courses_controller->categories_list($action); |
|
183 | + break; |
|
184 | + case 'deletecoursecategory': |
|
185 | + $courses_controller->courses_list($action); |
|
186 | + break; |
|
187 | + case 'sortmycourses': |
|
188 | + $courses_controller->courses_list($action); |
|
189 | + break; |
|
190 | + case 'subscribe': |
|
191 | + if (!$user_can_view_page) { |
|
192 | + api_not_allowed(true); |
|
193 | + } |
|
194 | + |
|
195 | + if (!CoursesAndSessionsCatalog::is(CATALOG_SESSIONS)) { |
|
196 | + $courses_controller->courses_categories( |
|
197 | + $action, |
|
198 | + $categoryCode, |
|
199 | + null, |
|
200 | + null, |
|
201 | + null, |
|
202 | + $limit |
|
203 | + ); |
|
204 | + } else { |
|
205 | + header('Location: ' . api_get_self()); |
|
206 | + exit; |
|
207 | + } |
|
208 | + break; |
|
209 | + case 'display_random_courses': |
|
210 | + if (!$user_can_view_page) { |
|
211 | + api_not_allowed(true); |
|
212 | + } |
|
213 | + |
|
214 | + $courses_controller->courses_categories($action); |
|
215 | + break; |
|
216 | + case 'display_courses': |
|
217 | + if (!$user_can_view_page) { |
|
218 | + api_not_allowed(true); |
|
219 | + } |
|
220 | + |
|
196 | 221 | $courses_controller->courses_categories( |
197 | 222 | $action, |
198 | 223 | $categoryCode, |
@@ -201,127 +226,102 @@ discard block |
||
201 | 226 | null, |
202 | 227 | $limit |
203 | 228 | ); |
204 | - } else { |
|
205 | - header('Location: ' . api_get_self()); |
|
206 | - exit; |
|
207 | - } |
|
208 | - break; |
|
209 | - case 'display_random_courses': |
|
210 | - if (!$user_can_view_page) { |
|
211 | - api_not_allowed(true); |
|
212 | - } |
|
213 | - |
|
214 | - $courses_controller->courses_categories($action); |
|
215 | - break; |
|
216 | - case 'display_courses': |
|
217 | - if (!$user_can_view_page) { |
|
218 | - api_not_allowed(true); |
|
219 | - } |
|
220 | - |
|
221 | - $courses_controller->courses_categories( |
|
222 | - $action, |
|
223 | - $categoryCode, |
|
224 | - null, |
|
225 | - null, |
|
226 | - null, |
|
227 | - $limit |
|
228 | - ); |
|
229 | - break; |
|
230 | - case 'display_sessions': |
|
231 | - if (!$user_can_view_page) { |
|
232 | - api_not_allowed(true); |
|
233 | - } |
|
234 | - |
|
235 | - $courses_controller->sessionsList($action, $nameTools, $limit); |
|
236 | - break; |
|
237 | - case 'subscribe_to_session': |
|
238 | - if (!$user_can_view_page) { |
|
239 | - api_not_allowed(true); |
|
240 | - } |
|
241 | - |
|
242 | - $userId = api_get_user_id(); |
|
243 | - $confirmed = isset($_GET['confirm']); |
|
244 | - $sessionId = intval($_GET['session_id']); |
|
245 | - |
|
246 | - if (empty($userId)) { |
|
247 | - api_not_allowed(); |
|
248 | - exit; |
|
249 | - } |
|
250 | - |
|
251 | - if (!$confirmed) { |
|
252 | - $template = new Template(null, false, false, false, false, false); |
|
253 | - $template->assign('session_id', $sessionId); |
|
254 | - |
|
255 | - $layout = $template->get_template('auth/confirm_session_subscription.tpl'); |
|
256 | - |
|
257 | - echo $template->fetch($layout); |
|
258 | - exit; |
|
259 | - } |
|
260 | - |
|
261 | - $registrationAllowed = api_get_setting('catalog_allow_session_auto_subscription'); |
|
262 | - if ($registrationAllowed === 'true') { |
|
263 | - $entityManager = Database::getManager(); |
|
264 | - $repository = $entityManager->getRepository('ChamiloCoreBundle:SequenceResource'); |
|
265 | - |
|
266 | - $sequences = $repository->getRequirements( |
|
267 | - $sessionId, |
|
268 | - SequenceResource::SESSION_TYPE |
|
269 | - ); |
|
229 | + break; |
|
230 | + case 'display_sessions': |
|
231 | + if (!$user_can_view_page) { |
|
232 | + api_not_allowed(true); |
|
233 | + } |
|
234 | + |
|
235 | + $courses_controller->sessionsList($action, $nameTools, $limit); |
|
236 | + break; |
|
237 | + case 'subscribe_to_session': |
|
238 | + if (!$user_can_view_page) { |
|
239 | + api_not_allowed(true); |
|
240 | + } |
|
241 | + |
|
242 | + $userId = api_get_user_id(); |
|
243 | + $confirmed = isset($_GET['confirm']); |
|
244 | + $sessionId = intval($_GET['session_id']); |
|
270 | 245 | |
271 | - if (count($sequences) > 0) { |
|
272 | - $requirementsData = SequenceResourceManager::checkRequirementsForUser( |
|
273 | - $sequences, |
|
274 | - SequenceResource::SESSION_TYPE, |
|
275 | - $userId |
|
246 | + if (empty($userId)) { |
|
247 | + api_not_allowed(); |
|
248 | + exit; |
|
249 | + } |
|
250 | + |
|
251 | + if (!$confirmed) { |
|
252 | + $template = new Template(null, false, false, false, false, false); |
|
253 | + $template->assign('session_id', $sessionId); |
|
254 | + |
|
255 | + $layout = $template->get_template('auth/confirm_session_subscription.tpl'); |
|
256 | + |
|
257 | + echo $template->fetch($layout); |
|
258 | + exit; |
|
259 | + } |
|
260 | + |
|
261 | + $registrationAllowed = api_get_setting('catalog_allow_session_auto_subscription'); |
|
262 | + if ($registrationAllowed === 'true') { |
|
263 | + $entityManager = Database::getManager(); |
|
264 | + $repository = $entityManager->getRepository('ChamiloCoreBundle:SequenceResource'); |
|
265 | + |
|
266 | + $sequences = $repository->getRequirements( |
|
267 | + $sessionId, |
|
268 | + SequenceResource::SESSION_TYPE |
|
276 | 269 | ); |
277 | 270 | |
278 | - $continueWithSubscription = SequenceResourceManager::checkSequenceAreCompleted($requirementsData); |
|
271 | + if (count($sequences) > 0) { |
|
272 | + $requirementsData = SequenceResourceManager::checkRequirementsForUser( |
|
273 | + $sequences, |
|
274 | + SequenceResource::SESSION_TYPE, |
|
275 | + $userId |
|
276 | + ); |
|
277 | + |
|
278 | + $continueWithSubscription = SequenceResourceManager::checkSequenceAreCompleted($requirementsData); |
|
279 | 279 | |
280 | - if (!$continueWithSubscription) { |
|
281 | - header('Location: ' . api_get_path(WEB_CODE_PATH) . 'auth/courses.php'); |
|
282 | - exit; |
|
280 | + if (!$continueWithSubscription) { |
|
281 | + header('Location: ' . api_get_path(WEB_CODE_PATH) . 'auth/courses.php'); |
|
282 | + exit; |
|
283 | + } |
|
283 | 284 | } |
284 | - } |
|
285 | 285 | |
286 | - SessionManager::subscribe_users_to_session( |
|
287 | - $_GET['session_id'], |
|
288 | - array($userId), |
|
289 | - SESSION_VISIBLE_READ_ONLY, |
|
290 | - false |
|
291 | - ); |
|
286 | + SessionManager::subscribe_users_to_session( |
|
287 | + $_GET['session_id'], |
|
288 | + array($userId), |
|
289 | + SESSION_VISIBLE_READ_ONLY, |
|
290 | + false |
|
291 | + ); |
|
292 | 292 | |
293 | - $coursesList = SessionManager::get_course_list_by_session_id($_GET['session_id']); |
|
294 | - $count = count($coursesList); |
|
295 | - $url = ''; |
|
296 | - |
|
297 | - if ($count <= 0) { |
|
298 | - // no course in session -> return to catalog |
|
299 | - $url = api_get_path(WEB_CODE_PATH) . 'auth/courses.php'; |
|
300 | - } elseif ($count == 1) { |
|
301 | - // only one course, so redirect directly to this course |
|
302 | - foreach ($coursesList as $course) { |
|
303 | - $url = api_get_path(WEB_COURSE_PATH) . $course['directory'] . '/index.php?id_session=' . intval($_GET['session_id']); |
|
293 | + $coursesList = SessionManager::get_course_list_by_session_id($_GET['session_id']); |
|
294 | + $count = count($coursesList); |
|
295 | + $url = ''; |
|
296 | + |
|
297 | + if ($count <= 0) { |
|
298 | + // no course in session -> return to catalog |
|
299 | + $url = api_get_path(WEB_CODE_PATH) . 'auth/courses.php'; |
|
300 | + } elseif ($count == 1) { |
|
301 | + // only one course, so redirect directly to this course |
|
302 | + foreach ($coursesList as $course) { |
|
303 | + $url = api_get_path(WEB_COURSE_PATH) . $course['directory'] . '/index.php?id_session=' . intval($_GET['session_id']); |
|
304 | + } |
|
305 | + } else { |
|
306 | + $url = api_get_path(WEB_CODE_PATH) . 'session/index.php?session_id=' . intval($_GET['session_id']); |
|
304 | 307 | } |
305 | - } else { |
|
306 | - $url = api_get_path(WEB_CODE_PATH) . 'session/index.php?session_id=' . intval($_GET['session_id']); |
|
308 | + header('Location: ' . $url); |
|
309 | + exit; |
|
307 | 310 | } |
308 | - header('Location: ' . $url); |
|
309 | - exit; |
|
310 | - } |
|
311 | - //else show error message? |
|
312 | - break; |
|
313 | - case 'search_tag': |
|
314 | - if (!$user_can_view_page) { |
|
315 | - api_not_allowed(true); |
|
316 | - } |
|
317 | - |
|
318 | - $courses_controller->sessionsListByCoursesTag($limit); |
|
319 | - break; |
|
320 | - case 'search_session': |
|
321 | - if (!$user_can_view_page) { |
|
322 | - api_not_allowed(true); |
|
323 | - } |
|
324 | - |
|
325 | - $courses_controller->sessionListBySearch($limit); |
|
326 | - break; |
|
311 | + //else show error message? |
|
312 | + break; |
|
313 | + case 'search_tag': |
|
314 | + if (!$user_can_view_page) { |
|
315 | + api_not_allowed(true); |
|
316 | + } |
|
317 | + |
|
318 | + $courses_controller->sessionsListByCoursesTag($limit); |
|
319 | + break; |
|
320 | + case 'search_session': |
|
321 | + if (!$user_can_view_page) { |
|
322 | + api_not_allowed(true); |
|
323 | + } |
|
324 | + |
|
325 | + $courses_controller->sessionListBySearch($limit); |
|
326 | + break; |
|
327 | 327 | } |
@@ -41,7 +41,7 @@ |
||
41 | 41 | |
42 | 42 | $msg .= '<div class="well_login">'; |
43 | 43 | $msg .= $form->return_form(); |
44 | - $msg .='</div>'; |
|
44 | + $msg .= '</div>'; |
|
45 | 45 | if (api_is_cas_activated()) { |
46 | 46 | $msg .= "</div>"; |
47 | 47 | } |
@@ -5,7 +5,7 @@ |
||
5 | 5 | $url = api_get_path(WEB_PATH).'main/auth/conditional_login/complete_phone_number.php'; |
6 | 6 | |
7 | 7 | if (! isset($_SESSION['conditional_login']['uid'])) |
8 | - die("Not Authorised"); |
|
8 | + die("Not Authorised"); |
|
9 | 9 | ?> |
10 | 10 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
11 | 11 | <html lang="fr" xml:lang="fr" xmlns="http://www.w3.org/1999/xhtml"> |
@@ -2,9 +2,9 @@ discard block |
||
2 | 2 | /* For licensing terms, see /license.txt */ |
3 | 3 | |
4 | 4 | require_once dirname(__FILE__).'/../../inc/global.inc.php'; |
5 | -$url = api_get_path(WEB_PATH).'main/auth/conditional_login/complete_phone_number.php'; |
|
5 | +$url = api_get_path(WEB_PATH).'main/auth/conditional_login/complete_phone_number.php'; |
|
6 | 6 | |
7 | -if (! isset($_SESSION['conditional_login']['uid'])) |
|
7 | +if (!isset($_SESSION['conditional_login']['uid'])) |
|
8 | 8 | die("Not Authorised"); |
9 | 9 | ?> |
10 | 10 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | </body> |
21 | 21 | </html> |
22 | 22 | <?php |
23 | -if (isset($_POST['submit'])){ |
|
23 | +if (isset($_POST['submit'])) { |
|
24 | 24 | $u = api_get_user_info($_SESSION['conditional_login']['uid']); |
25 | 25 | $u['phone'] = $_POST['phone_number']; |
26 | 26 | $password = null; // we don't want to change the password |
@@ -4,8 +4,9 @@ |
||
4 | 4 | require_once dirname(__FILE__).'/../../inc/global.inc.php'; |
5 | 5 | $url = api_get_path(WEB_PATH).'main/auth/conditional_login/complete_phone_number.php'; |
6 | 6 | |
7 | -if (! isset($_SESSION['conditional_login']['uid'])) |
|
7 | +if (! isset($_SESSION['conditional_login']['uid'])) { |
|
8 | 8 | die("Not Authorised"); |
9 | +} |
|
9 | 10 | ?> |
10 | 11 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
11 | 12 | <html lang="fr" xml:lang="fr" xmlns="http://www.w3.org/1999/xhtml"> |
@@ -54,16 +54,16 @@ discard block |
||
54 | 54 | } |
55 | 55 | $course_info = api_get_course_info_by_id($result['c_id']); |
56 | 56 | $course_image = '<img src="'.$course_info['course_image_large'].'">'; |
57 | - $dates .= '<li><a href="#'.$login.'">' . api_convert_and_format_date($login, DATE_FORMAT_SHORT) . '</a></li>'; |
|
57 | + $dates .= '<li><a href="#'.$login.'">'.api_convert_and_format_date($login, DATE_FORMAT_SHORT).'</a></li>'; |
|
58 | 58 | $issues .= '<li id ="'.$login.'">'; |
59 | 59 | $issues .= '<div class="img-course">'.$course_image.'</div>'; |
60 | 60 | |
61 | 61 | $issues .= '<div class="text-course">'; |
62 | - $issues .= '<p>' . sprintf( |
|
62 | + $issues .= '<p>'.sprintf( |
|
63 | 63 | get_lang('YouHaveEnteredTheCourseXInY'), |
64 | - '" '. $courseInfo['name'] .' "', |
|
64 | + '" '.$courseInfo['name'].' "', |
|
65 | 65 | api_convert_and_format_date($login, DATE_TIME_FORMAT_LONG) |
66 | - ) . '</p>'; |
|
66 | + ).'</p>'; |
|
67 | 67 | $issues .= '</div>'; |
68 | 68 | $issues .= '</li>'; |
69 | 69 | $count++; |
@@ -82,8 +82,8 @@ discard block |
||
82 | 82 | $content .= '<div class="row">'; |
83 | 83 | $content .= '<div class="col-md-12">'; |
84 | 84 | $content .= '<div id="my_timeline">'; |
85 | - $content .= '<ul id="dates">' . $dates . '</ul>'; |
|
86 | - $content .= '<ul id="issues">' . $issues . '</ul>'; |
|
85 | + $content .= '<ul id="dates">'.$dates.'</ul>'; |
|
86 | + $content .= '<ul id="issues">'.$issues.'</ul>'; |
|
87 | 87 | $content .= '<div id="grad_left"></div>'; |
88 | 88 | $content .= '<div id="grad_right"></div>'; |
89 | 89 | $content .= '<a href="#" id="prev"></a>'; |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | |
8 | 8 | use ChamiloSession as Session; |
9 | 9 | |
10 | -require_once(dirname(__FILE__) . '/functions.inc.php'); |
|
10 | +require_once(dirname(__FILE__).'/functions.inc.php'); |
|
11 | 11 | |
12 | 12 | //MAIN CODE |
13 | 13 | //$uData variable is set in local.inc.php |
@@ -36,6 +36,6 @@ discard block |
||
36 | 36 | //User cannot login |
37 | 37 | $loginFailed = true; |
38 | 38 | Session::erase('_uid'); |
39 | - header('Location: ' . api_get_path(WEB_PATH) . 'index.php?loginFailed=1&error=user_password_incorrect'); |
|
39 | + header('Location: '.api_get_path(WEB_PATH).'index.php?loginFailed=1&error=user_password_incorrect'); |
|
40 | 40 | exit; |
41 | 41 | } |
@@ -10,7 +10,7 @@ |
||
10 | 10 | |
11 | 11 | use ChamiloSession as Session; |
12 | 12 | |
13 | -require_once(dirname(__FILE__) . '/functions.inc.php'); |
|
13 | +require_once(dirname(__FILE__).'/functions.inc.php'); |
|
14 | 14 | |
15 | 15 | //MAIN CODE |
16 | 16 | //$login and $password variables are setted in main/inc/local.inc.php |
@@ -13,9 +13,9 @@ |
||
13 | 13 | } |
14 | 14 | use \ChamiloSession as Session; |
15 | 15 | |
16 | -require dirname(__FILE__) . '/../../inc/global.inc.php'; |
|
17 | -require dirname(__FILE__) . '/ldap.inc.php'; |
|
18 | -require dirname(__FILE__) . '/../../inc/conf/auth.conf.php'; |
|
16 | +require dirname(__FILE__).'/../../inc/global.inc.php'; |
|
17 | +require dirname(__FILE__).'/ldap.inc.php'; |
|
18 | +require dirname(__FILE__).'/../../inc/conf/auth.conf.php'; |
|
19 | 19 | /** |
20 | 20 | * Code execution |
21 | 21 | */ |