Passed
Push — 1.10.x ( 07da6d...08890a )
by Yannick
83:27 queued 37:15
created
main/auth/cas/lib/CAS/languages/german.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -8,20 +8,20 @@
 block discarded – undo
8 8
  */
9 9
 
10 10
 $this->_strings = array(
11
- CAS_STR_USING_SERVER 
12
- => 'via Server',
13
- CAS_STR_AUTHENTICATION_WANTED 
14
- => 'CAS Authentifizierung erforderlich!',
15
- CAS_STR_LOGOUT 
16
- => 'CAS Abmeldung!',
17
- CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED 
18
- => 'eigentlich h&auml;ten Sie zum CAS Server weitergeleitet werden sollen. Dr&uuml;cken Sie <a href="%s">hier</a> um fortzufahren.',
19
- CAS_STR_AUTHENTICATION_FAILED 
20
- => 'CAS Anmeldung fehlgeschlagen!',
21
- CAS_STR_YOU_WERE_NOT_AUTHENTICATED 
22
- => '<p>Sie wurden nicht angemeldet.</p><p>Um es erneut zu versuchen klicken Sie <a href="%s">hier</a>.</p><p>Wenn das Problem bestehen bleibt, kontkatieren Sie den <a href="mailto:%s">Administrator</a> dieser Seite.</p>',
23
- CAS_STR_SERVICE_UNAVAILABLE
24
- => 'Der Dienst `<b>%s</b>\' ist nicht verf&uuml;gbar (<b>%s</b>).'
11
+    CAS_STR_USING_SERVER 
12
+    => 'via Server',
13
+    CAS_STR_AUTHENTICATION_WANTED 
14
+    => 'CAS Authentifizierung erforderlich!',
15
+    CAS_STR_LOGOUT 
16
+    => 'CAS Abmeldung!',
17
+    CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED 
18
+    => 'eigentlich h&auml;ten Sie zum CAS Server weitergeleitet werden sollen. Dr&uuml;cken Sie <a href="%s">hier</a> um fortzufahren.',
19
+    CAS_STR_AUTHENTICATION_FAILED 
20
+    => 'CAS Anmeldung fehlgeschlagen!',
21
+    CAS_STR_YOU_WERE_NOT_AUTHENTICATED 
22
+    => '<p>Sie wurden nicht angemeldet.</p><p>Um es erneut zu versuchen klicken Sie <a href="%s">hier</a>.</p><p>Wenn das Problem bestehen bleibt, kontkatieren Sie den <a href="mailto:%s">Administrator</a> dieser Seite.</p>',
23
+    CAS_STR_SERVICE_UNAVAILABLE
24
+    => 'Der Dienst `<b>%s</b>\' ist nicht verf&uuml;gbar (<b>%s</b>).'
25 25
 );
26 26
 
27 27
 ?>
28 28
\ No newline at end of file
Please login to merge, or discard this patch.
main/auth/cas/lib/CAS/languages/catalan.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -8,20 +8,20 @@
 block discarded – undo
8 8
  */
9 9
 
10 10
 $this->_strings = array(
11
- CAS_STR_USING_SERVER 
12
- => 'usant servidor',
13
- CAS_STR_AUTHENTICATION_WANTED 
14
- => 'Autentificació CAS necessària!',
15
- CAS_STR_LOGOUT 
16
- => 'Sortida de CAS necessària!',
17
- CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED 
18
- => 'Ja hauria d\ haver estat redireccionat al servidor CAS. Feu click <a href="%s">aquí</a> per a continuar.',
19
- CAS_STR_AUTHENTICATION_FAILED 
20
- => 'Autentificació CAS fallida!',
21
- CAS_STR_YOU_WERE_NOT_AUTHENTICATED 
22
- => '<p>No estàs autentificat.</p><p>Pots tornar a intentar-ho fent click <a href="%s">aquí</a>.</p><p>Si el problema persisteix hauría de contactar amb l\'<a href="mailto:%s">administrador d\'aquest llocc</a>.</p>',
23
- CAS_STR_SERVICE_UNAVAILABLE
24
- => 'El servei `<b>%s</b>\' no està disponible (<b>%s</b>).'
11
+    CAS_STR_USING_SERVER 
12
+    => 'usant servidor',
13
+    CAS_STR_AUTHENTICATION_WANTED 
14
+    => 'Autentificació CAS necessària!',
15
+    CAS_STR_LOGOUT 
16
+    => 'Sortida de CAS necessària!',
17
+    CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED 
18
+    => 'Ja hauria d\ haver estat redireccionat al servidor CAS. Feu click <a href="%s">aquí</a> per a continuar.',
19
+    CAS_STR_AUTHENTICATION_FAILED 
20
+    => 'Autentificació CAS fallida!',
21
+    CAS_STR_YOU_WERE_NOT_AUTHENTICATED 
22
+    => '<p>No estàs autentificat.</p><p>Pots tornar a intentar-ho fent click <a href="%s">aquí</a>.</p><p>Si el problema persisteix hauría de contactar amb l\'<a href="mailto:%s">administrador d\'aquest llocc</a>.</p>',
23
+    CAS_STR_SERVICE_UNAVAILABLE
24
+    => 'El servei `<b>%s</b>\' no està disponible (<b>%s</b>).'
25 25
 );
26 26
 
27 27
 ?>
Please login to merge, or discard this patch.
main/auth/cas/lib/CAS/languages/english.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -8,20 +8,20 @@
 block discarded – undo
8 8
  */
9 9
 
10 10
 $this->_strings = array(
11
- CAS_STR_USING_SERVER 
12
- => 'using server',
13
- CAS_STR_AUTHENTICATION_WANTED 
14
- => 'CAS Authentication wanted!',
15
- CAS_STR_LOGOUT 
16
- => 'CAS logout wanted!',
17
- CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED 
18
- => 'You should already have been redirected to the CAS server. Click <a href="%s">here</a> to continue.',
19
- CAS_STR_AUTHENTICATION_FAILED 
20
- => 'CAS Authentication failed!',
21
- CAS_STR_YOU_WERE_NOT_AUTHENTICATED 
22
- => '<p>You were not authenticated.</p><p>You may submit your request again by clicking <a href="%s">here</a>.</p><p>If the problem persists, you may contact <a href="mailto:%s">the administrator of this site</a>.</p>',
23
- CAS_STR_SERVICE_UNAVAILABLE
24
- => 'The service `<b>%s</b>\' is not available (<b>%s</b>).'
11
+    CAS_STR_USING_SERVER 
12
+    => 'using server',
13
+    CAS_STR_AUTHENTICATION_WANTED 
14
+    => 'CAS Authentication wanted!',
15
+    CAS_STR_LOGOUT 
16
+    => 'CAS logout wanted!',
17
+    CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED 
18
+    => 'You should already have been redirected to the CAS server. Click <a href="%s">here</a> to continue.',
19
+    CAS_STR_AUTHENTICATION_FAILED 
20
+    => 'CAS Authentication failed!',
21
+    CAS_STR_YOU_WERE_NOT_AUTHENTICATED 
22
+    => '<p>You were not authenticated.</p><p>You may submit your request again by clicking <a href="%s">here</a>.</p><p>If the problem persists, you may contact <a href="mailto:%s">the administrator of this site</a>.</p>',
23
+    CAS_STR_SERVICE_UNAVAILABLE
24
+    => 'The service `<b>%s</b>\' is not available (<b>%s</b>).'
25 25
 );
26 26
 
27 27
 ?>
28 28
\ No newline at end of file
Please login to merge, or discard this patch.
main/auth/cas/lib/CAS/languages/japanese.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -8,20 +8,20 @@
 block discarded – undo
8 8
  **/
9 9
 
10 10
 $this->_strings = array(
11
- CAS_STR_USING_SERVER 
12
- => 'using server',
13
- CAS_STR_AUTHENTICATION_WANTED 
14
- => 'CAS�ˤ��ǧ�ڤ�Ԥ��ޤ�',
15
- CAS_STR_LOGOUT 
16
- => 'CAS����?�����Ȥ��ޤ�!',
17
- CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED 
18
- => 'CAS�����Ф˹Ԥ�ɬ�פ�����ޤ�����ưŪ��ž������ʤ����� <a href="%s">������</a> �
Please login to merge, or discard this patch.
main/auth/cas/lib/CAS/languages/languages.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -12,13 +12,13 @@
 block discarded – undo
12 12
 /**
13 13
  * a phpCAS string index
14 14
  */
15
-define("CAS_STR_USING_SERVER",                1);
16
-define("CAS_STR_AUTHENTICATION_WANTED",       2);
17
-define("CAS_STR_LOGOUT",                      3);
15
+define("CAS_STR_USING_SERVER", 1);
16
+define("CAS_STR_AUTHENTICATION_WANTED", 2);
17
+define("CAS_STR_LOGOUT", 3);
18 18
 define("CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED", 4);
19
-define("CAS_STR_AUTHENTICATION_FAILED",       5);
20
-define("CAS_STR_YOU_WERE_NOT_AUTHENTICATED",  6);
21
-define("CAS_STR_SERVICE_UNAVAILABLE",         7);
19
+define("CAS_STR_AUTHENTICATION_FAILED", 5);
20
+define("CAS_STR_YOU_WERE_NOT_AUTHENTICATED", 6);
21
+define("CAS_STR_SERVICE_UNAVAILABLE", 7);
22 22
 //@}
23 23
 
24 24
 ?>
25 25
\ No newline at end of file
Please login to merge, or discard this patch.
main/auth/cas/lib/CAS/languages/greek.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -8,20 +8,20 @@
 block discarded – undo
8 8
  */
9 9
 
10 10
 $this->_strings = array(
11
- CAS_STR_USING_SERVER 
12
- => '��������������� � ������������',
13
- CAS_STR_AUTHENTICATION_WANTED 
14
- => '���������� � ����������� CAS!',
15
- CAS_STR_LOGOUT 
16
- => '���������� � ���������� ��� CAS!',
17
- CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED 
18
- => '�� ������ �� ������ �������������� ���� ����������� CAS. ����� ���� <a href="%s">���</a> ��� �� ����������.',
19
- CAS_STR_AUTHENTICATION_FAILED 
20
- => '� ����������� CAS �������!',
21
- CAS_STR_YOU_WERE_NOT_AUTHENTICATED 
22
- => '<p>��� ���������������.</p><p>�������� �� ����������������, �������� ���� <a href="%s">���</a>.</p><p>��� �� �������� ���������, ����� �� ����� �� ��� <a href="mailto:%s">�����������</a>.</p>',
23
- CAS_STR_SERVICE_UNAVAILABLE
24
- => '� �������� `<b>%s</b>\' ��� ����� ��������� (<b>%s</b>).'
11
+    CAS_STR_USING_SERVER 
12
+    => '��������������� � ������������',
13
+    CAS_STR_AUTHENTICATION_WANTED 
14
+    => '���������� � ����������� CAS!',
15
+    CAS_STR_LOGOUT 
16
+    => '���������� � ���������� ��� CAS!',
17
+    CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED 
18
+    => '�� ������ �� ������ �������������� ���� ����������� CAS. ����� ���� <a href="%s">���</a> ��� �� ����������.',
19
+    CAS_STR_AUTHENTICATION_FAILED 
20
+    => '� ����������� CAS �������!',
21
+    CAS_STR_YOU_WERE_NOT_AUTHENTICATED 
22
+    => '<p>��� ���������������.</p><p>�������� �� ����������������, �������� ���� <a href="%s">���</a>.</p><p>��� �� �������� ���������, ����� �� ����� �� ��� <a href="mailto:%s">�����������</a>.</p>',
23
+    CAS_STR_SERVICE_UNAVAILABLE
24
+    => '� �������� `<b>%s</b>\' ��� ����� ��������� (<b>%s</b>).'
25 25
 );
26 26
 
27 27
 ?>
28 28
\ No newline at end of file
Please login to merge, or discard this patch.
main/auth/cas/lib/CAS/languages/french.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -8,20 +8,20 @@
 block discarded – undo
8 8
  */
9 9
 
10 10
 $this->_strings = array(
11
- CAS_STR_USING_SERVER 
12
- => 'utilisant le serveur',
13
- CAS_STR_AUTHENTICATION_WANTED 
14
- => 'Authentication CAS n�cessaire&nbsp;!',
15
- CAS_STR_LOGOUT 
16
- => 'D�connexion demand�e&nbsp;!',
17
- CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED 
18
- => 'Vous auriez du etre redirig�(e) vers le serveur CAS. Cliquez <a href="%s">ici</a> pour continuer.',
19
- CAS_STR_AUTHENTICATION_FAILED 
20
- => 'Authentification CAS infructueuse&nbsp;!',
21
- CAS_STR_YOU_WERE_NOT_AUTHENTICATED 
22
- => '<p>Vous n\'avez pas �t� authentifi�(e).</p><p>Vous pouvez soumettre votre requete � nouveau en cliquant <a href="%s">ici</a>.</p><p>Si le probl�me persiste, vous pouvez contacter <a href="mailto:%s">l\'administrateur de ce site</a>.</p>',
23
- CAS_STR_SERVICE_UNAVAILABLE
24
- => 'Le service `<b>%s</b>\' est indisponible (<b>%s</b>)'
11
+    CAS_STR_USING_SERVER 
12
+    => 'utilisant le serveur',
13
+    CAS_STR_AUTHENTICATION_WANTED 
14
+    => 'Authentication CAS n�cessaire&nbsp;!',
15
+    CAS_STR_LOGOUT 
16
+    => 'D�connexion demand�e&nbsp;!',
17
+    CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED 
18
+    => 'Vous auriez du etre redirig�(e) vers le serveur CAS. Cliquez <a href="%s">ici</a> pour continuer.',
19
+    CAS_STR_AUTHENTICATION_FAILED 
20
+    => 'Authentification CAS infructueuse&nbsp;!',
21
+    CAS_STR_YOU_WERE_NOT_AUTHENTICATED 
22
+    => '<p>Vous n\'avez pas �t� authentifi�(e).</p><p>Vous pouvez soumettre votre requete � nouveau en cliquant <a href="%s">ici</a>.</p><p>Si le probl�me persiste, vous pouvez contacter <a href="mailto:%s">l\'administrateur de ce site</a>.</p>',
23
+    CAS_STR_SERVICE_UNAVAILABLE
24
+    => 'Le service `<b>%s</b>\' est indisponible (<b>%s</b>)'
25 25
 
26 26
 );
27 27
 
Please login to merge, or discard this patch.
main/auth/cas/lib/CAS/languages/spanish.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -8,20 +8,20 @@
 block discarded – undo
8 8
  */
9 9
 
10 10
 $this->_strings = array(
11
- CAS_STR_USING_SERVER 
12
- => 'usando servidor',
13
- CAS_STR_AUTHENTICATION_WANTED 
14
- => '¡Autentificación CAS necesaria!',
15
- CAS_STR_LOGOUT 
16
- => '¡Salida CAS necesaria!',
17
- CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED 
18
- => 'Ya debería haber sido redireccionado al servidor CAS. Haga click <a href="%s">aquí</a> para continuar.',
19
- CAS_STR_AUTHENTICATION_FAILED 
20
- => '¡Autentificación CAS fallida!',
21
- CAS_STR_YOU_WERE_NOT_AUTHENTICATED 
22
- => '<p>No estás autentificado.</p><p>Puedes volver a intentarlo haciendo click <a href="%s">aquí</a>.</p><p>Si el problema persiste debería contactar con el <a href="mailto:%s">administrador de este sitio</a>.</p>',
23
- CAS_STR_SERVICE_UNAVAILABLE
24
- => 'El servicio `<b>%s</b>\' no está disponible (<b>%s</b>).'
11
+    CAS_STR_USING_SERVER 
12
+    => 'usando servidor',
13
+    CAS_STR_AUTHENTICATION_WANTED 
14
+    => '¡Autentificación CAS necesaria!',
15
+    CAS_STR_LOGOUT 
16
+    => '¡Salida CAS necesaria!',
17
+    CAS_STR_SHOULD_HAVE_BEEN_REDIRECTED 
18
+    => 'Ya debería haber sido redireccionado al servidor CAS. Haga click <a href="%s">aquí</a> para continuar.',
19
+    CAS_STR_AUTHENTICATION_FAILED 
20
+    => '¡Autentificación CAS fallida!',
21
+    CAS_STR_YOU_WERE_NOT_AUTHENTICATED 
22
+    => '<p>No estás autentificado.</p><p>Puedes volver a intentarlo haciendo click <a href="%s">aquí</a>.</p><p>Si el problema persiste debería contactar con el <a href="mailto:%s">administrador de este sitio</a>.</p>',
23
+    CAS_STR_SERVICE_UNAVAILABLE
24
+    => 'El servicio `<b>%s</b>\' no está disponible (<b>%s</b>).'
25 25
 );
26 26
 
27 27
 ?>
Please login to merge, or discard this patch.
main/auth/courses.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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?
Please login to merge, or discard this patch.
Switch Indentation   +135 added lines, -135 removed lines patch added patch discarded remove patch
@@ -171,28 +171,52 @@  discard block
 block discarded – undo
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
+            }
207
+            break;
208
+        case 'display_random_courses':
209
+            if (!$user_can_view_page) {
210
+                api_not_allowed(true);
211
+            }
212
+
213
+            $courses_controller->courses_categories($action);
214
+            break;
215
+        case 'display_courses':
216
+            if (!$user_can_view_page) {
217
+                api_not_allowed(true);
218
+            }
219
+
196 220
             $courses_controller->courses_categories(
197 221
                 $action,
198 222
                 $categoryCode,
@@ -201,126 +225,102 @@  discard block
 block discarded – undo
201 225
                 null,
202 226
                 $limit
203 227
             );
204
-        } else {
205
-            header('Location: ' . api_get_self());
206
-        }
207
-        break;
208
-    case 'display_random_courses':
209
-        if (!$user_can_view_page) {
210
-            api_not_allowed(true);
211
-        }
212
-
213
-        $courses_controller->courses_categories($action);
214
-        break;
215
-    case 'display_courses':
216
-        if (!$user_can_view_page) {
217
-            api_not_allowed(true);
218
-        }
219
-
220
-        $courses_controller->courses_categories(
221
-            $action,
222
-            $categoryCode,
223
-            null,
224
-            null,
225
-            null,
226
-            $limit
227
-        );
228
-        break;
229
-    case 'display_sessions':
230
-        if (!$user_can_view_page) {
231
-            api_not_allowed(true);
232
-        }
233
-
234
-        $courses_controller->sessionsList($action, $nameTools, $limit);
235
-        break;
236
-    case 'subscribe_to_session':
237
-        if (!$user_can_view_page) {
238
-            api_not_allowed(true);
239
-        }
240
-
241
-        $userId = api_get_user_id();
242
-        $confirmed = isset($_GET['confirm']);
243
-        $sessionId = intval($_GET['session_id']);
244
-
245
-        if (empty($userId)) {
246
-            api_not_allowed();
247
-            exit;
248
-        }
249
-
250
-        if (!$confirmed) {
251
-            $template = new Template(null, false, false, false, false, false);
252
-            $template->assign('session_id', $sessionId);
253
-
254
-            $layout = $template->get_template('auth/confirm_session_subscription.tpl');
255
-
256
-            echo $template->fetch($layout);
257
-            exit;
258
-        }
259
-
260
-        $registrationAllowed = api_get_setting('catalog_allow_session_auto_subscription');
261
-        if ($registrationAllowed === 'true') {
262
-            $entityManager = Database::getManager();
263
-            $repository = $entityManager->getRepository('ChamiloCoreBundle:SequenceResource');
264
-
265
-            $sequences = $repository->getRequirements(
266
-                $sessionId,
267
-                SequenceResource::SESSION_TYPE
268
-            );
228
+            break;
229
+        case 'display_sessions':
230
+            if (!$user_can_view_page) {
231
+                api_not_allowed(true);
232
+            }
233
+
234
+            $courses_controller->sessionsList($action, $nameTools, $limit);
235
+            break;
236
+        case 'subscribe_to_session':
237
+            if (!$user_can_view_page) {
238
+                api_not_allowed(true);
239
+            }
240
+
241
+            $userId = api_get_user_id();
242
+            $confirmed = isset($_GET['confirm']);
243
+            $sessionId = intval($_GET['session_id']);
269 244
 
270
-            if (count($sequences) > 0) {
271
-                $requirementsData = SequenceResourceManager::checkRequirementsForUser(
272
-                    $sequences,
273
-                    SequenceResource::SESSION_TYPE,
274
-                    $userId
245
+            if (empty($userId)) {
246
+                api_not_allowed();
247
+                exit;
248
+            }
249
+
250
+            if (!$confirmed) {
251
+                $template = new Template(null, false, false, false, false, false);
252
+                $template->assign('session_id', $sessionId);
253
+
254
+                $layout = $template->get_template('auth/confirm_session_subscription.tpl');
255
+
256
+                echo $template->fetch($layout);
257
+                exit;
258
+            }
259
+
260
+            $registrationAllowed = api_get_setting('catalog_allow_session_auto_subscription');
261
+            if ($registrationAllowed === 'true') {
262
+                $entityManager = Database::getManager();
263
+                $repository = $entityManager->getRepository('ChamiloCoreBundle:SequenceResource');
264
+
265
+                $sequences = $repository->getRequirements(
266
+                    $sessionId,
267
+                    SequenceResource::SESSION_TYPE
275 268
                 );
276 269
 
277
-                $continueWithSubscription = SequenceResourceManager::checkSequenceAreCompleted($requirementsData);
270
+                if (count($sequences) > 0) {
271
+                    $requirementsData = SequenceResourceManager::checkRequirementsForUser(
272
+                        $sequences,
273
+                        SequenceResource::SESSION_TYPE,
274
+                        $userId
275
+                    );
276
+
277
+                    $continueWithSubscription = SequenceResourceManager::checkSequenceAreCompleted($requirementsData);
278 278
 
279
-                if (!$continueWithSubscription) {
280
-                    header('Location: ' .  api_get_path(WEB_CODE_PATH) . 'auth/courses.php');
281
-                    exit;
279
+                    if (!$continueWithSubscription) {
280
+                        header('Location: ' .  api_get_path(WEB_CODE_PATH) . 'auth/courses.php');
281
+                        exit;
282
+                    }
282 283
                 }
283
-            }
284 284
 
285
-            SessionManager::suscribe_users_to_session(
286
-                $_GET['session_id'],
287
-                array($userId),
288
-                SESSION_VISIBLE_READ_ONLY,
289
-                false
290
-            );
285
+                SessionManager::suscribe_users_to_session(
286
+                    $_GET['session_id'],
287
+                    array($userId),
288
+                    SESSION_VISIBLE_READ_ONLY,
289
+                    false
290
+                );
291 291
 
292
-            $coursesList = SessionManager::get_course_list_by_session_id($_GET['session_id']);
293
-            $count = count($coursesList);
294
-            $url = '';
295
-
296
-            if ($count <= 0) {
297
-                // no course in session -> return to catalog
298
-                $url = api_get_path(WEB_CODE_PATH) . 'auth/courses.php';
299
-            } elseif ($count == 1) {
300
-                // only one course, so redirect directly to this course
301
-                foreach ($coursesList as $course) {
302
-                    $url = api_get_path(WEB_COURSE_PATH) . $course['directory'] . '/index.php?id_session=' . intval($_GET['session_id']);
292
+                $coursesList = SessionManager::get_course_list_by_session_id($_GET['session_id']);
293
+                $count = count($coursesList);
294
+                $url = '';
295
+
296
+                if ($count <= 0) {
297
+                    // no course in session -> return to catalog
298
+                    $url = api_get_path(WEB_CODE_PATH) . 'auth/courses.php';
299
+                } elseif ($count == 1) {
300
+                    // only one course, so redirect directly to this course
301
+                    foreach ($coursesList as $course) {
302
+                        $url = api_get_path(WEB_COURSE_PATH) . $course['directory'] . '/index.php?id_session=' . intval($_GET['session_id']);
303
+                    }
304
+                } else {
305
+                    $url = api_get_path(WEB_CODE_PATH) . 'session/index.php?session_id=' . intval($_GET['session_id']);
303 306
                 }
304
-            } else {
305
-                $url = api_get_path(WEB_CODE_PATH) . 'session/index.php?session_id=' . intval($_GET['session_id']);
307
+                header('Location: ' . $url);
308
+                exit;
306 309
             }
307
-            header('Location: ' . $url);
308
-            exit;
309
-        }
310
-        //else show error message?
311
-        break;
312
-    case 'search_tag':
313
-        if (!$user_can_view_page) {
314
-            api_not_allowed(true);
315
-        }
316
-
317
-        $courses_controller->sessionsListByCoursesTag($limit);
318
-        break;
319
-    case 'search_session':
320
-        if (!$user_can_view_page) {
321
-            api_not_allowed(true);
322
-        }
323
-
324
-        $courses_controller->sessionListBySearch($limit);
325
-        break;
310
+            //else show error message?
311
+            break;
312
+        case 'search_tag':
313
+            if (!$user_can_view_page) {
314
+                api_not_allowed(true);
315
+            }
316
+
317
+            $courses_controller->sessionsListByCoursesTag($limit);
318
+            break;
319
+        case 'search_session':
320
+            if (!$user_can_view_page) {
321
+                api_not_allowed(true);
322
+            }
323
+
324
+            $courses_controller->sessionListBySearch($limit);
325
+            break;
326 326
 }
Please login to merge, or discard this patch.