Completed
Push — 1.10.x ( f2aaaf...ef00db )
by Yannick
241:15 queued 197:35
created
main/admin/ldap_import_students.php 3 patches
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  * Code
10 10
  */
11 11
 // resetting the course id
12
-$cidReset=true;
12
+$cidReset = true;
13 13
 require_once('../inc/global.inc.php');
14 14
 // setting the section (for the tabs)
15 15
 $this_section = SECTION_PLATFORM_ADMIN;
@@ -18,11 +18,11 @@  discard block
 block discarded – undo
18 18
 api_protect_admin_script();
19 19
 require('../auth/ldap/authldap.php');
20 20
 
21
-$annee_base=date('Y');
21
+$annee_base = date('Y');
22 22
 
23 23
 $tool_name = get_lang('LDAPImport');
24 24
 // setting breadcrumbs
25
-$interbreadcrumb[]=array('url' => 'index.php','name' => get_lang('PlatformAdmin'));
25
+$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
26 26
 
27 27
 $htmlHeadXtra[] = '<script language="JavaScript" type="text/javascript">
28 28
 var buttoncheck = 1;
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 
49 49
 $annee = $_GET['annee'];
50 50
 $composante = $_GET['composante'];
51
-$etape =  $_GET['etape'];
51
+$etape = $_GET['etape'];
52 52
 $course = $_POST['course'];
53 53
 
54 54
 
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 	echo '</div>';
199 199
 }
200 200
 */
201
-elseif(!empty($annee) && empty($course))
201
+elseif (!empty($annee) && empty($course))
202 202
 {
203 203
 	Display::display_header($tool_name);
204 204
 	echo '<div style="align:center">';
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 	echo '<form method="post" action="'.api_get_self().'?annee='.Security::remove_XSS($annee).'"><br />';
207 207
 	echo '<select name="course">';
208 208
 	$courses = CourseManager::get_courses_list();
209
-	foreach($courses as $row)
209
+	foreach ($courses as $row)
210 210
 	{
211 211
 		echo '<option value="'.$row['code'].'">'.api_htmlentities($row['title']).'</option>';
212 212
 	}
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 
240 240
 		$info = ldap_get_entries($ds, $sr);
241 241
 
242
-		for ($key = 0; $key < $info["count"]; $key ++) {
242
+		for ($key = 0; $key < $info["count"]; $key++) {
243 243
 			$nom_form[] = $info[$key]["sn"][0];
244 244
 			$prenom_form[] = $info[$key]["givenname"][0];
245 245
 			$email_form[] = $info[$key]["mail"][0];
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 		asort($nom_form);
260 260
 		reset($nom_form);
261 261
 
262
-		$statut=5;
262
+		$statut = 5;
263 263
 		include ('ldap_form_add_users_group.php');
264 264
 	} else {
265 265
 		echo '<h4>'.get_lang('UnableToConnectTo').' '.$host.'</h4>';
@@ -270,25 +270,25 @@  discard block
 block discarded – undo
270 270
     echo '</div>';
271 271
 
272 272
 }
273
-elseif (!empty($annee) && !empty($course) && ($_POST['confirmed']=='yes'))
273
+elseif (!empty($annee) && !empty($course) && ($_POST['confirmed'] == 'yes'))
274 274
 {
275
-	$id=$_POST['username_form'];
276
-	$UserList=array();
275
+	$id = $_POST['username_form'];
276
+	$UserList = array();
277 277
 	$userid_match_login = array();
278 278
 	foreach ($id as $form_index=>$user_id)
279 279
 	{
280
-		if(is_array($_POST['checkboxes']) && in_array($form_index,array_values($_POST['checkboxes'])))
280
+		if (is_array($_POST['checkboxes']) && in_array($form_index, array_values($_POST['checkboxes'])))
281 281
 		{
282 282
 			$tmp = ldap_add_user($user_id);
283
-			$UserList[]= $tmp;
283
+			$UserList[] = $tmp;
284 284
 			$userid_match_login[$tmp] = $user_id;
285 285
 		}
286 286
 	}
287 287
 	if (!empty($_POST['course']))
288 288
 	{
289
-		foreach($UserList as $user_id)
289
+		foreach ($UserList as $user_id)
290 290
 		{
291
-			CourseManager::add_user_to_course($user_id,$_POST['course']);
291
+			CourseManager::add_user_to_course($user_id, $_POST['course']);
292 292
 		}
293 293
 		header('Location: course_information.php?code='.Security::remove_XSS($_POST['course']));
294 294
 	}
@@ -314,8 +314,8 @@  discard block
 block discarded – undo
314 314
 	else
315 315
 	{
316 316
 		Display::display_header($tool_name);
317
-		$message=get_lang('NoUserAdded');
318
-		Display :: display_normal_message($message,false);
317
+		$message = get_lang('NoUserAdded');
318
+		Display :: display_normal_message($message, false);
319 319
 	}
320 320
 	echo '<br /><br />';
321 321
     echo '<a href="ldap_import_students.php?annee=&composante=&etape=">'.get_lang('BackToNewSearch').'</a>';
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -269,8 +269,7 @@
 block discarded – undo
269 269
     echo '<br /><br />';
270 270
     echo '</div>';
271 271
 
272
-}
273
-elseif (!empty($annee) && !empty($course) && ($_POST['confirmed']=='yes'))
272
+} elseif (!empty($annee) && !empty($course) && ($_POST['confirmed']=='yes'))
274 273
 {
275 274
 	$id=$_POST['username_form'];
276 275
 	$UserList=array();
Please login to merge, or discard this patch.
Indentation   +101 added lines, -101 removed lines patch added patch discarded remove patch
@@ -56,19 +56,19 @@  discard block
 block discarded – undo
56 56
 //if ($annee == "" && $composante == "" && $etape == "") {
57 57
 if (empty($annee) && empty($course))
58 58
 {
59
-		Display::display_header($tool_name);
60
-		echo '<div style="align:center">';
61
-		Display::display_icon('group.gif', get_lang('LDAPSelectFilterOnUsersOU'));
62
-		echo get_lang('LDAPSelectFilterOnUsersOU');
63
-		//echo '<em>'.get_lang('ToDoThisYouMustEnterYearComponentAndComponentStep').'</em><br />';
64
-		///echo get_lang('FollowEachOfTheseStepsStepByStep').'<br />';
65
-
66
-		echo '<form method="get" action="'.api_get_self().'"><br />';
67
-		echo '<em>'.get_lang('LDAPOUAttributeFilter').' :</em> ';
68
-		echo '<input  type="text" name="annee" size="4" maxlength="30" value="'.$annee_base.'"><br />';
69
-		echo '<input type="submit" value="'.get_lang('Submit').'">';
70
-		echo '</form>';
71
-		echo '</div>';
59
+        Display::display_header($tool_name);
60
+        echo '<div style="align:center">';
61
+        Display::display_icon('group.gif', get_lang('LDAPSelectFilterOnUsersOU'));
62
+        echo get_lang('LDAPSelectFilterOnUsersOU');
63
+        //echo '<em>'.get_lang('ToDoThisYouMustEnterYearComponentAndComponentStep').'</em><br />';
64
+        ///echo get_lang('FollowEachOfTheseStepsStepByStep').'<br />';
65
+
66
+        echo '<form method="get" action="'.api_get_self().'"><br />';
67
+        echo '<em>'.get_lang('LDAPOUAttributeFilter').' :</em> ';
68
+        echo '<input  type="text" name="annee" size="4" maxlength="30" value="'.$annee_base.'"><br />';
69
+        echo '<input type="submit" value="'.get_lang('Submit').'">';
70
+        echo '</form>';
71
+        echo '</div>';
72 72
 
73 73
 }
74 74
 /*
@@ -200,71 +200,71 @@  discard block
 block discarded – undo
200 200
 */
201 201
 elseif(!empty($annee) && empty($course))
202 202
 {
203
-	Display::display_header($tool_name);
204
-	echo '<div style="align:center">';
205
-	echo Display::return_icon('course.png', get_lang('SelectCourseToImportUsersTo')).' '.get_lang('SelectCourseToImportUsersTo').'<br />';
206
-	echo '<form method="post" action="'.api_get_self().'?annee='.Security::remove_XSS($annee).'"><br />';
207
-	echo '<select name="course">';
208
-	$courses = CourseManager::get_courses_list();
209
-	foreach($courses as $row)
210
-	{
211
-		echo '<option value="'.$row['code'].'">'.api_htmlentities($row['title']).'</option>';
212
-	}
213
-	echo '</select>';
214
-	echo '<input type="submit" value="'.get_lang('Submit').'">';
215
-	echo '</form>';
216
-	echo '</div>';
203
+    Display::display_header($tool_name);
204
+    echo '<div style="align:center">';
205
+    echo Display::return_icon('course.png', get_lang('SelectCourseToImportUsersTo')).' '.get_lang('SelectCourseToImportUsersTo').'<br />';
206
+    echo '<form method="post" action="'.api_get_self().'?annee='.Security::remove_XSS($annee).'"><br />';
207
+    echo '<select name="course">';
208
+    $courses = CourseManager::get_courses_list();
209
+    foreach($courses as $row)
210
+    {
211
+        echo '<option value="'.$row['code'].'">'.api_htmlentities($row['title']).'</option>';
212
+    }
213
+    echo '</select>';
214
+    echo '<input type="submit" value="'.get_lang('Submit').'">';
215
+    echo '</form>';
216
+    echo '</div>';
217 217
 }
218 218
 // form4  annee != 0; composante != 0 etape != 0
219 219
 //elseif ($annee <> "" && $composante <> "" && $etape <> "" && $listeok != 'yes') {
220 220
 elseif (!empty($annee) && !empty($course) && empty($_POST['confirmed']))
221 221
 {
222
-	Display::display_header($tool_name);
223
-	echo '<div style="align: center;">';
224
-	echo '<br />';
225
-	echo '<br />';
226
-	echo '<h3>'.Display::return_icon('group.gif', get_lang('SelectStudents')).' '.get_lang('SelectStudents').'</h3>';
227
-	//echo "Connection ...";
228
-	$ds = ldap_connect($ldap_host, $ldap_port) or die(get_lang('LDAPConnectionError'));
229
-	ldap_set_version($ds);
230
-
231
-	if ($ds) {
232
-
233
-		$r = false;
234
-		$res = ldap_handle_bind($ds, $r);
235
-
236
-		//$sr = @ ldap_search($ds, "ou=people,$LDAPbasedn", "(|(edupersonprimaryorgunitdn=ou=$etape,ou=$annee,ou=diploma,o=Paris1,$LDAPbasedn)(edupersonprimaryorgunitdn=ou=02PEL,ou=$annee,ou=diploma,o=Paris1,$LDAPbasedn))");
237
-		//echo "(ou=*$annee,ou=$composante)";
238
-		$sr = @ ldap_search($ds, $ldap_basedn, "(ou=*$annee)");
239
-
240
-		$info = ldap_get_entries($ds, $sr);
241
-
242
-		for ($key = 0; $key < $info["count"]; $key ++) {
243
-			$nom_form[] = $info[$key]["sn"][0];
244
-			$prenom_form[] = $info[$key]["givenname"][0];
245
-			$email_form[] = $info[$key]["mail"][0];
246
-			// Get uid from dn
247
-			//$dn_array=ldap_explode_dn($info[$key]["dn"],1);
248
-			//$username_form[] = $dn_array[0]; // uid is first key
249
-			$username_form[] = $info[$key]['uid'][0];
250
-			$outab[] = $info[$key]["eduPersonPrimaryAffiliation"][0]; // Ici "student"
251
-			//$val = ldap_get_values_len($ds, $entry, "userPassword");
252
-			//$password_form[] = $val[0];
253
-			$password_form[] = $info[$key]['userPassword'][0];
254
-		}
255
-		ldap_unbind($ds);
256
-
257
-		/*-----------------------------------------------*/
258
-
259
-		asort($nom_form);
260
-		reset($nom_form);
261
-
262
-		$statut=5;
263
-		include ('ldap_form_add_users_group.php');
264
-	} else {
265
-		echo '<h4>'.get_lang('UnableToConnectTo').' '.$host.'</h4>';
266
-	}
267
-	echo '<br /><br />';
222
+    Display::display_header($tool_name);
223
+    echo '<div style="align: center;">';
224
+    echo '<br />';
225
+    echo '<br />';
226
+    echo '<h3>'.Display::return_icon('group.gif', get_lang('SelectStudents')).' '.get_lang('SelectStudents').'</h3>';
227
+    //echo "Connection ...";
228
+    $ds = ldap_connect($ldap_host, $ldap_port) or die(get_lang('LDAPConnectionError'));
229
+    ldap_set_version($ds);
230
+
231
+    if ($ds) {
232
+
233
+        $r = false;
234
+        $res = ldap_handle_bind($ds, $r);
235
+
236
+        //$sr = @ ldap_search($ds, "ou=people,$LDAPbasedn", "(|(edupersonprimaryorgunitdn=ou=$etape,ou=$annee,ou=diploma,o=Paris1,$LDAPbasedn)(edupersonprimaryorgunitdn=ou=02PEL,ou=$annee,ou=diploma,o=Paris1,$LDAPbasedn))");
237
+        //echo "(ou=*$annee,ou=$composante)";
238
+        $sr = @ ldap_search($ds, $ldap_basedn, "(ou=*$annee)");
239
+
240
+        $info = ldap_get_entries($ds, $sr);
241
+
242
+        for ($key = 0; $key < $info["count"]; $key ++) {
243
+            $nom_form[] = $info[$key]["sn"][0];
244
+            $prenom_form[] = $info[$key]["givenname"][0];
245
+            $email_form[] = $info[$key]["mail"][0];
246
+            // Get uid from dn
247
+            //$dn_array=ldap_explode_dn($info[$key]["dn"],1);
248
+            //$username_form[] = $dn_array[0]; // uid is first key
249
+            $username_form[] = $info[$key]['uid'][0];
250
+            $outab[] = $info[$key]["eduPersonPrimaryAffiliation"][0]; // Ici "student"
251
+            //$val = ldap_get_values_len($ds, $entry, "userPassword");
252
+            //$password_form[] = $val[0];
253
+            $password_form[] = $info[$key]['userPassword'][0];
254
+        }
255
+        ldap_unbind($ds);
256
+
257
+        /*-----------------------------------------------*/
258
+
259
+        asort($nom_form);
260
+        reset($nom_form);
261
+
262
+        $statut=5;
263
+        include ('ldap_form_add_users_group.php');
264
+    } else {
265
+        echo '<h4>'.get_lang('UnableToConnectTo').' '.$host.'</h4>';
266
+    }
267
+    echo '<br /><br />';
268 268
     echo '<a href="ldap_import_students.php?annee=&composante=&etape=">'.get_lang('BackToNewSearch').'</a>';
269 269
     echo '<br /><br />';
270 270
     echo '</div>';
@@ -272,27 +272,27 @@  discard block
 block discarded – undo
272 272
 }
273 273
 elseif (!empty($annee) && !empty($course) && ($_POST['confirmed']=='yes'))
274 274
 {
275
-	$id=$_POST['username_form'];
276
-	$UserList=array();
277
-	$userid_match_login = array();
278
-	foreach ($id as $form_index=>$user_id)
279
-	{
280
-		if(is_array($_POST['checkboxes']) && in_array($form_index,array_values($_POST['checkboxes'])))
281
-		{
282
-			$tmp = ldap_add_user($user_id);
283
-			$UserList[]= $tmp;
284
-			$userid_match_login[$tmp] = $user_id;
285
-		}
286
-	}
287
-	if (!empty($_POST['course']))
288
-	{
289
-		foreach($UserList as $user_id)
290
-		{
291
-			CourseManager::add_user_to_course($user_id,$_POST['course']);
292
-		}
293
-		header('Location: course_information.php?code='.Security::remove_XSS($_POST['course']));
294
-	}
295
-	/*
275
+    $id=$_POST['username_form'];
276
+    $UserList=array();
277
+    $userid_match_login = array();
278
+    foreach ($id as $form_index=>$user_id)
279
+    {
280
+        if(is_array($_POST['checkboxes']) && in_array($form_index,array_values($_POST['checkboxes'])))
281
+        {
282
+            $tmp = ldap_add_user($user_id);
283
+            $UserList[]= $tmp;
284
+            $userid_match_login[$tmp] = $user_id;
285
+        }
286
+    }
287
+    if (!empty($_POST['course']))
288
+    {
289
+        foreach($UserList as $user_id)
290
+        {
291
+            CourseManager::add_user_to_course($user_id,$_POST['course']);
292
+        }
293
+        header('Location: course_information.php?code='.Security::remove_XSS($_POST['course']));
294
+    }
295
+    /*
296 296
 	else
297 297
 	{
298 298
 		Display :: display_header($tool_name);
@@ -311,13 +311,13 @@  discard block
 block discarded – undo
311 311
 		Display :: display_normal_message($message,false);
312 312
 	}
313 313
 	*/
314
-	else
315
-	{
316
-		Display::display_header($tool_name);
317
-		$message=get_lang('NoUserAdded');
318
-		Display :: display_normal_message($message,false);
319
-	}
320
-	echo '<br /><br />';
314
+    else
315
+    {
316
+        Display::display_header($tool_name);
317
+        $message=get_lang('NoUserAdded');
318
+        Display :: display_normal_message($message,false);
319
+    }
320
+    echo '<br /><br />';
321 321
     echo '<a href="ldap_import_students.php?annee=&composante=&etape=">'.get_lang('BackToNewSearch').'</a>';
322 322
     echo '<br /><br />';
323 323
 }
Please login to merge, or discard this patch.
main/admin/access_url_add_usergroup_to_url.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -87,7 +87,7 @@
 block discarded – undo
87 87
                   <?php
88 88
                     echo Display::get_alphabet_options($firstLetterUserGroup);
89 89
                     echo Display::get_numeric_options(0, 9, $firstLetterUserGroup);
90
-                  ?>
90
+                    ?>
91 91
             </select>
92 92
         </td>
93 93
         <td width="20%">&nbsp;</td>
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -30,8 +30,8 @@  discard block
 block discarded – undo
30 30
 $tbl_course = Database:: get_main_table(TABLE_MAIN_COURSE);
31 31
 
32 32
 $tool_name = get_lang('AddUserGroupToURL');
33
-$interbreadcrumb[] = array ('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
34
-$interbreadcrumb[] = array ('url' => 'access_urls.php', 'name' => get_lang('MultipleAccessURLs'));
33
+$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
34
+$interbreadcrumb[] = array('url' => 'access_urls.php', 'name' => get_lang('MultipleAccessURLs'));
35 35
 
36 36
 Display::display_header($tool_name);
37 37
 
@@ -46,8 +46,8 @@  discard block
 block discarded – undo
46 46
 
47 47
 if (isset($_POST['form_sent']) && $_POST['form_sent']) {
48 48
     $form_sent = $_POST['form_sent'];
49
-    $userGroups = is_array($_POST['user_group_list']) ? $_POST['user_group_list'] : array() ;
50
-    $urlList = is_array($_POST['url_list']) ? $_POST['url_list'] : array() ;
49
+    $userGroups = is_array($_POST['user_group_list']) ? $_POST['user_group_list'] : array();
50
+    $urlList = is_array($_POST['url_list']) ? $_POST['url_list'] : array();
51 51
     $firstLetterUserGroup = $_POST['first_letter_user_group'];
52 52
 
53 53
     if ($form_sent == 1) {
Please login to merge, or discard this patch.
Braces   +8 added lines, -2 removed lines patch added patch discarded remove patch
@@ -99,7 +99,10 @@  discard block
 block discarded – undo
99 99
         <td width="40%" align="center">
100 100
         <select name="user_group_list[]" multiple="multiple" size="20" style="width:400px;">
101 101
 		<?php foreach ($dbUserGroups as $item) { ?>
102
-			<option value="<?php echo $item['id']; ?>" <?php if (in_array($item['id'], $courses)) echo 'selected="selected"'; ?>><?php echo $item['name']; ?>
102
+			<option value="<?php echo $item['id']; ?>" <?php if (in_array($item['id'], $courses)) {
103
+    echo 'selected="selected"';
104
+}
105
+?>><?php echo $item['name']; ?>
103 106
             </option>
104 107
         <?php } ?>
105 108
     </select>
@@ -110,7 +113,10 @@  discard block
 block discarded – undo
110 113
    <td width="40%" align="center">
111 114
     <select name="url_list[]" multiple="multiple" size="20" style="width:300px;">
112 115
 		<?php foreach ($db_urls as $url_obj) { ?>
113
-        <option value="<?php echo $url_obj['id']; ?>" <?php if (in_array($url_obj['id'], $url_list)) echo 'selected="selected"'; ?>><?php echo $url_obj['url']; ?>
116
+        <option value="<?php echo $url_obj['id']; ?>" <?php if (in_array($url_obj['id'], $url_list)) {
117
+    echo 'selected="selected"';
118
+}
119
+?>><?php echo $url_obj['url']; ?>
114 120
         </option>
115 121
 		<?php } ?>
116 122
     </select>
Please login to merge, or discard this patch.
main/admin/legal_add.php 2 patches
Indentation   +104 added lines, -104 removed lines patch added patch discarded remove patch
@@ -18,93 +18,93 @@  discard block
 block discarded – undo
18 18
 
19 19
 $defaults = array();
20 20
 $term_preview = array(
21
-	'type' => 0,
22
-	'content' => '',
23
-	'changes' => '',
21
+    'type' => 0,
22
+    'content' => '',
23
+    'changes' => '',
24 24
 );
25 25
 if ($form->validate()) {
26
-	$check = Security::check_token('post');
27
-	if ($check) {
28
-		$values  = $form->getSubmitValues();
29
-		$lang 	 = $values['language'];
30
-		//language id
31
-		$lang = api_get_language_id($lang);
32
-
33
-		if (isset($values['type'])) {
34
-			$type 	 = $values['type'];
35
-		} else {
36
-			$type = 0;
37
-		}
38
-		if (isset($values['content'])) {
39
-			$content = $values['content'];
40
-		} else {
41
-			$content = '';
42
-		}
43
-		if (isset($values['changes'])) {
44
-			$changes = $values['changes'];
45
-		} else {
46
-			$changes = '';
47
-		}
48
-		$navigator_info = api_get_navigator();
49
-
50
-		if ($navigator_info['name']=='Internet Explorer' &&  $navigator_info['version']=='6') {
51
-			if (isset($values['preview'])) {
52
-				$submit	='preview';
53
-			} elseif (isset($values['save'])) {
54
-				$submit	='save';
55
-			} elseif (isset($values['back'])) {
56
-				$submit	='back';
57
-			}
58
-		} else {
59
-			$submit  = $values['send'];
60
-		}
61
-
62
-		$default['content'] = $content;
63
-		if (isset($values['language'])) {
64
-			if ($submit == 'back') {
65
-				header('Location: legal_add.php');
66
-				exit;
67
-			} elseif ($submit == 'save') {
68
-				$insert_result = LegalManager::add($lang, $content, $type, $changes);
69
-				if ($insert_result ) {
70
-					$message = get_lang('TermAndConditionSaved');
71
-				} else {
72
-					$message = get_lang('TermAndConditionNotSaved');
73
-				}
74
-				Security::clear_token();
75
-				$tok = Security::get_token();
76
-				header('Location: legal_list.php?action=show_message&message='.urlencode($message).'&sec_token='.$tok);
77
-				exit();
78
-			} elseif ($submit=='preview') {
79
-				$defaults['type'] = $type;
80
-				$defaults['content'] = $content;
81
-				$defaults['changes'] = $changes;
82
-				$term_preview = $defaults;
83
-				$term_preview['type'] = intval($_POST['type']);
84
-			} else {
85
-				$my_lang = $_POST['language'];
86
-				if (isset($_POST['language'])){
87
-					$all_langs = api_get_languages();
88
-					if (in_array($my_lang, $all_langs['folder'])){
89
-						$language = api_get_language_id($my_lang);
90
-						$term_preview = LegalManager::get_last_condition($language);
91
-						$defaults = $term_preview;
92
-						if (!$term_preview) {
93
-							// there are not terms and conditions
94
-							$term_preview['type']=-1;
95
-							$defaults['type']=0;
96
-						}
97
-					}
98
-				}
99
-			}
100
-		}
101
-	}
26
+    $check = Security::check_token('post');
27
+    if ($check) {
28
+        $values  = $form->getSubmitValues();
29
+        $lang 	 = $values['language'];
30
+        //language id
31
+        $lang = api_get_language_id($lang);
32
+
33
+        if (isset($values['type'])) {
34
+            $type 	 = $values['type'];
35
+        } else {
36
+            $type = 0;
37
+        }
38
+        if (isset($values['content'])) {
39
+            $content = $values['content'];
40
+        } else {
41
+            $content = '';
42
+        }
43
+        if (isset($values['changes'])) {
44
+            $changes = $values['changes'];
45
+        } else {
46
+            $changes = '';
47
+        }
48
+        $navigator_info = api_get_navigator();
49
+
50
+        if ($navigator_info['name']=='Internet Explorer' &&  $navigator_info['version']=='6') {
51
+            if (isset($values['preview'])) {
52
+                $submit	='preview';
53
+            } elseif (isset($values['save'])) {
54
+                $submit	='save';
55
+            } elseif (isset($values['back'])) {
56
+                $submit	='back';
57
+            }
58
+        } else {
59
+            $submit  = $values['send'];
60
+        }
61
+
62
+        $default['content'] = $content;
63
+        if (isset($values['language'])) {
64
+            if ($submit == 'back') {
65
+                header('Location: legal_add.php');
66
+                exit;
67
+            } elseif ($submit == 'save') {
68
+                $insert_result = LegalManager::add($lang, $content, $type, $changes);
69
+                if ($insert_result ) {
70
+                    $message = get_lang('TermAndConditionSaved');
71
+                } else {
72
+                    $message = get_lang('TermAndConditionNotSaved');
73
+                }
74
+                Security::clear_token();
75
+                $tok = Security::get_token();
76
+                header('Location: legal_list.php?action=show_message&message='.urlencode($message).'&sec_token='.$tok);
77
+                exit();
78
+            } elseif ($submit=='preview') {
79
+                $defaults['type'] = $type;
80
+                $defaults['content'] = $content;
81
+                $defaults['changes'] = $changes;
82
+                $term_preview = $defaults;
83
+                $term_preview['type'] = intval($_POST['type']);
84
+            } else {
85
+                $my_lang = $_POST['language'];
86
+                if (isset($_POST['language'])){
87
+                    $all_langs = api_get_languages();
88
+                    if (in_array($my_lang, $all_langs['folder'])){
89
+                        $language = api_get_language_id($my_lang);
90
+                        $term_preview = LegalManager::get_last_condition($language);
91
+                        $defaults = $term_preview;
92
+                        if (!$term_preview) {
93
+                            // there are not terms and conditions
94
+                            $term_preview['type']=-1;
95
+                            $defaults['type']=0;
96
+                        }
97
+                    }
98
+                }
99
+            }
100
+        }
101
+    }
102 102
 }
103 103
 
104 104
 $form->setDefaults($defaults);
105 105
 
106 106
 if (isset($_POST['send'])) {
107
-	Security::clear_token();
107
+    Security::clear_token();
108 108
 }
109 109
 $token = Security::get_token();
110 110
 
@@ -115,34 +115,34 @@  discard block
 block discarded – undo
115 115
 
116 116
 if (isset($_POST['language'])) {
117 117
 
118
-	$form->addElement('static', Security::remove_XSS($_POST['language']));
119
-	$form->addElement('hidden', 'language',Security::remove_XSS($_POST['language']));
120
-	$form->addHtmlEditor('content', get_lang('Content'), true, false, array('ToolbarSet' => 'terms_and_conditions', 'Width' => '100%', 'Height' => '250'));
118
+    $form->addElement('static', Security::remove_XSS($_POST['language']));
119
+    $form->addElement('hidden', 'language',Security::remove_XSS($_POST['language']));
120
+    $form->addHtmlEditor('content', get_lang('Content'), true, false, array('ToolbarSet' => 'terms_and_conditions', 'Width' => '100%', 'Height' => '250'));
121 121
 
122
-	$form->addElement('radio', 'type', '', get_lang('HTMLText') ,'0');
123
-	$form->addElement('radio', 'type', '', get_lang('PageLink') ,'1');
124
-	$form->addElement('textarea', 'changes', get_lang('ExplainChanges'),array('width'=>'20'));
122
+    $form->addElement('radio', 'type', '', get_lang('HTMLText') ,'0');
123
+    $form->addElement('radio', 'type', '', get_lang('PageLink') ,'1');
124
+    $form->addElement('textarea', 'changes', get_lang('ExplainChanges'),array('width'=>'20'));
125 125
 
126
-	$preview = LegalManager::show_last_condition($term_preview);
126
+    $preview = LegalManager::show_last_condition($term_preview);
127 127
 
128
-	if ($term_preview['type']!=-1) {
129
-		$form->addElement('label', get_lang('Preview'),  $preview);
130
-	}
128
+    if ($term_preview['type']!=-1) {
129
+        $form->addElement('label', get_lang('Preview'),  $preview);
130
+    }
131 131
 
132
-	// Submit & preview button
132
+    // Submit & preview button
133 133
     $navigator_info = api_get_navigator();
134 134
 
135 135
     //ie6 fix
136
-	if ($navigator_info['name']=='Internet Explorer' &&  $navigator_info['version']=='6') {
137
-		$buttons = '<div class="row" align="center">
136
+    if ($navigator_info['name']=='Internet Explorer' &&  $navigator_info['version']=='6') {
137
+        $buttons = '<div class="row" align="center">
138 138
 				<div class="formw">
139 139
 				<input type="submit" name="back"  value="'.get_lang('Back').'"/>
140 140
 				<input type="submit" name="preview"  value="'.get_lang('Preview').'"/>
141 141
 				<input type="submit" name="save"  value="'.get_lang('Save').'"/>
142 142
 				</div>
143 143
 			</div>';
144
-			$form->addElement('html',$buttons);
145
-	} else {
144
+            $form->addElement('html',$buttons);
145
+    } else {
146 146
         $buttons = '<div class="row" align="center">
147 147
 					<div class="formw">
148 148
 					<button type="submit" class="back" 	 name="send" value="back">'.get_lang('Back').'</button>
@@ -150,11 +150,11 @@  discard block
 block discarded – undo
150 150
 					<button type="submit" class="save" 	 name="send" value="save">'.get_lang('Save').'</button>
151 151
 					</div>
152 152
 				</div>';
153
-		$form->addElement('html',$buttons);
154
-	}
153
+        $form->addElement('html',$buttons);
154
+    }
155 155
 } else {
156
-	$form->addElement('select_language', 'language', get_lang('Language'),null,array());
157
-	$form->addElement('button', 'send', get_lang('Load'));
156
+    $form->addElement('select_language', 'language', get_lang('Language'),null,array());
157
+    $form->addElement('button', 'send', get_lang('Load'));
158 158
 
159 159
 }
160 160
 
@@ -176,11 +176,11 @@  discard block
 block discarded – undo
176 176
 echo '</div>';
177 177
 
178 178
 if (isset ($_GET['action'])) {
179
-	switch ($_GET['action']) {
180
-		case 'show_message' :
181
-			Display :: display_normal_message(stripslashes($_GET['message']));
182
-			break;
183
-	}
179
+    switch ($_GET['action']) {
180
+        case 'show_message' :
181
+            Display :: display_normal_message(stripslashes($_GET['message']));
182
+            break;
183
+    }
184 184
 }
185 185
 
186 186
 $form->setDefaults($defaults);
Please login to merge, or discard this patch.
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -25,13 +25,13 @@  discard block
 block discarded – undo
25 25
 if ($form->validate()) {
26 26
 	$check = Security::check_token('post');
27 27
 	if ($check) {
28
-		$values  = $form->getSubmitValues();
29
-		$lang 	 = $values['language'];
28
+		$values = $form->getSubmitValues();
29
+		$lang = $values['language'];
30 30
 		//language id
31 31
 		$lang = api_get_language_id($lang);
32 32
 
33 33
 		if (isset($values['type'])) {
34
-			$type 	 = $values['type'];
34
+			$type = $values['type'];
35 35
 		} else {
36 36
 			$type = 0;
37 37
 		}
@@ -47,13 +47,13 @@  discard block
 block discarded – undo
47 47
 		}
48 48
 		$navigator_info = api_get_navigator();
49 49
 
50
-		if ($navigator_info['name']=='Internet Explorer' &&  $navigator_info['version']=='6') {
50
+		if ($navigator_info['name'] == 'Internet Explorer' && $navigator_info['version'] == '6') {
51 51
 			if (isset($values['preview'])) {
52
-				$submit	='preview';
52
+				$submit	= 'preview';
53 53
 			} elseif (isset($values['save'])) {
54
-				$submit	='save';
54
+				$submit	= 'save';
55 55
 			} elseif (isset($values['back'])) {
56
-				$submit	='back';
56
+				$submit	= 'back';
57 57
 			}
58 58
 		} else {
59 59
 			$submit  = $values['send'];
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 				exit;
67 67
 			} elseif ($submit == 'save') {
68 68
 				$insert_result = LegalManager::add($lang, $content, $type, $changes);
69
-				if ($insert_result ) {
69
+				if ($insert_result) {
70 70
 					$message = get_lang('TermAndConditionSaved');
71 71
 				} else {
72 72
 					$message = get_lang('TermAndConditionNotSaved');
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 				$tok = Security::get_token();
76 76
 				header('Location: legal_list.php?action=show_message&message='.urlencode($message).'&sec_token='.$tok);
77 77
 				exit();
78
-			} elseif ($submit=='preview') {
78
+			} elseif ($submit == 'preview') {
79 79
 				$defaults['type'] = $type;
80 80
 				$defaults['content'] = $content;
81 81
 				$defaults['changes'] = $changes;
@@ -83,16 +83,16 @@  discard block
 block discarded – undo
83 83
 				$term_preview['type'] = intval($_POST['type']);
84 84
 			} else {
85 85
 				$my_lang = $_POST['language'];
86
-				if (isset($_POST['language'])){
86
+				if (isset($_POST['language'])) {
87 87
 					$all_langs = api_get_languages();
88
-					if (in_array($my_lang, $all_langs['folder'])){
88
+					if (in_array($my_lang, $all_langs['folder'])) {
89 89
 						$language = api_get_language_id($my_lang);
90 90
 						$term_preview = LegalManager::get_last_condition($language);
91 91
 						$defaults = $term_preview;
92 92
 						if (!$term_preview) {
93 93
 							// there are not terms and conditions
94
-							$term_preview['type']=-1;
95
-							$defaults['type']=0;
94
+							$term_preview['type'] = -1;
95
+							$defaults['type'] = 0;
96 96
 						}
97 97
 					}
98 98
 				}
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 }
109 109
 $token = Security::get_token();
110 110
 
111
-$form->addElement('hidden','sec_token');
111
+$form->addElement('hidden', 'sec_token');
112 112
 //$form->setConstants(array('sec_token' => $token));
113 113
 $defaults['sec_token'] = $token;
114 114
 $form->addElement('header', get_lang('DisplayTermsConditions'));
@@ -116,24 +116,24 @@  discard block
 block discarded – undo
116 116
 if (isset($_POST['language'])) {
117 117
 
118 118
 	$form->addElement('static', Security::remove_XSS($_POST['language']));
119
-	$form->addElement('hidden', 'language',Security::remove_XSS($_POST['language']));
119
+	$form->addElement('hidden', 'language', Security::remove_XSS($_POST['language']));
120 120
 	$form->addHtmlEditor('content', get_lang('Content'), true, false, array('ToolbarSet' => 'terms_and_conditions', 'Width' => '100%', 'Height' => '250'));
121 121
 
122
-	$form->addElement('radio', 'type', '', get_lang('HTMLText') ,'0');
123
-	$form->addElement('radio', 'type', '', get_lang('PageLink') ,'1');
124
-	$form->addElement('textarea', 'changes', get_lang('ExplainChanges'),array('width'=>'20'));
122
+	$form->addElement('radio', 'type', '', get_lang('HTMLText'), '0');
123
+	$form->addElement('radio', 'type', '', get_lang('PageLink'), '1');
124
+	$form->addElement('textarea', 'changes', get_lang('ExplainChanges'), array('width'=>'20'));
125 125
 
126 126
 	$preview = LegalManager::show_last_condition($term_preview);
127 127
 
128
-	if ($term_preview['type']!=-1) {
129
-		$form->addElement('label', get_lang('Preview'),  $preview);
128
+	if ($term_preview['type'] != -1) {
129
+		$form->addElement('label', get_lang('Preview'), $preview);
130 130
 	}
131 131
 
132 132
 	// Submit & preview button
133 133
     $navigator_info = api_get_navigator();
134 134
 
135 135
     //ie6 fix
136
-	if ($navigator_info['name']=='Internet Explorer' &&  $navigator_info['version']=='6') {
136
+	if ($navigator_info['name'] == 'Internet Explorer' && $navigator_info['version'] == '6') {
137 137
 		$buttons = '<div class="row" align="center">
138 138
 				<div class="formw">
139 139
 				<input type="submit" name="back"  value="'.get_lang('Back').'"/>
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 				<input type="submit" name="save"  value="'.get_lang('Save').'"/>
142 142
 				</div>
143 143
 			</div>';
144
-			$form->addElement('html',$buttons);
144
+			$form->addElement('html', $buttons);
145 145
 	} else {
146 146
         $buttons = '<div class="row" align="center">
147 147
 					<div class="formw">
@@ -150,16 +150,16 @@  discard block
 block discarded – undo
150 150
 					<button type="submit" class="save" 	 name="send" value="save">'.get_lang('Save').'</button>
151 151
 					</div>
152 152
 				</div>';
153
-		$form->addElement('html',$buttons);
153
+		$form->addElement('html', $buttons);
154 154
 	}
155 155
 } else {
156
-	$form->addElement('select_language', 'language', get_lang('Language'),null,array());
156
+	$form->addElement('select_language', 'language', get_lang('Language'), null, array());
157 157
 	$form->addElement('button', 'send', get_lang('Load'));
158 158
 
159 159
 }
160 160
 
161 161
 $tool_name = get_lang('AddTermsAndConditions');
162
-$interbreadcrumb[] = array ("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
162
+$interbreadcrumb[] = array("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
163 163
 Display :: display_header($tool_name);
164 164
 
165 165
 echo '<script>
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 
173 173
 // action menu
174 174
 echo '<div class="actions">';
175
-echo '<a href="'.api_get_path(WEB_CODE_PATH).'admin/legal_list.php">'.Display::return_icon('search.gif',get_lang('EditTermsAndConditions'),'').get_lang('AllVersions').'</a>';
175
+echo '<a href="'.api_get_path(WEB_CODE_PATH).'admin/legal_list.php">'.Display::return_icon('search.gif', get_lang('EditTermsAndConditions'), '').get_lang('AllVersions').'</a>';
176 176
 echo '</div>';
177 177
 
178 178
 if (isset ($_GET['action'])) {
Please login to merge, or discard this patch.
main/admin/configure_plugin.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 $message = null;
29 29
 $content = null;
30 30
 
31
-$currentUrl = api_get_self() . "?name=$pluginName";
31
+$currentUrl = api_get_self()."?name=$pluginName";
32 32
 
33 33
 if (isset($pluginInfo['settings_form'])) {
34 34
     $form = $pluginInfo['settings_form'];
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 
65 65
         foreach ($values as $key => $value) {
66 66
             api_add_setting(
67
-                $value, Database::escape_string($pluginName . '_' . $key),
67
+                $value, Database::escape_string($pluginName.'_'.$key),
68 68
                 $pluginName,
69 69
                 'setting',
70 70
                 'Plugins',
@@ -99,11 +99,11 @@  discard block
 block discarded – undo
99 99
 }
100 100
 
101 101
 $interbreadcrumb[] = array(
102
-    'url' => api_get_path(WEB_CODE_PATH) . 'admin/index.php',
102
+    'url' => api_get_path(WEB_CODE_PATH).'admin/index.php',
103 103
     'name' => get_lang('PlatformAdmin')
104 104
 );
105 105
 $interbreadcrumb[] = array(
106
-    'url' => api_get_path(WEB_CODE_PATH) . 'admin/settings.php?category=Plugins',
106
+    'url' => api_get_path(WEB_CODE_PATH).'admin/settings.php?category=Plugins',
107 107
     'name' => get_lang('Plugins')
108 108
 );
109 109
 
Please login to merge, or discard this patch.
main/admin/course_request_rejected.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -114,7 +114,7 @@
 block discarded – undo
114 114
     $from = intval($from);
115 115
     $number_of_items = intval($number_of_items);
116 116
     $column = intval($column);
117
-    $direction = !in_array(strtolower(trim($direction)), ['asc','desc']) ? 'asc' : $direction;
117
+    $direction = !in_array(strtolower(trim($direction)), ['asc', 'desc']) ? 'asc' : $direction;
118 118
 
119 119
     $sql = "SELECT
120 120
                 id AS col0,
Please login to merge, or discard this patch.
main/admin/sub_language_ajax.inc.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -9,9 +9,9 @@  discard block
 block discarded – undo
9 9
 
10 10
 api_protect_admin_script();
11 11
 
12
-$new_language        = Security::remove_XSS($_REQUEST['new_language']);
13
-$language_variable    = Security::remove_XSS($_REQUEST['variable_language']);
14
-$file_id            = intval($_REQUEST['file_id']);
12
+$new_language = Security::remove_XSS($_REQUEST['new_language']);
13
+$language_variable = Security::remove_XSS($_REQUEST['variable_language']);
14
+$file_id = intval($_REQUEST['file_id']);
15 15
 /**
16 16
  * Code
17 17
  */
@@ -27,10 +27,10 @@  discard block
 block discarded – undo
27 27
 
28 28
     //update variable language
29 29
     // Replace double quotes to avoid parse errors
30
-    $new_language = str_replace('"', '\"',$new_language);
30
+    $new_language = str_replace('"', '\"', $new_language);
31 31
     // Replace new line signs to avoid parse errors - see #6773
32
-    $new_language = str_replace("\n","\\n",$new_language);
33
-    $all_file_of_directory[$language_variable]="\"".$new_language."\";";
32
+    $new_language = str_replace("\n", "\\n", $new_language);
33
+    $all_file_of_directory[$language_variable] = "\"".$new_language."\";";
34 34
     $result_array = array();
35 35
 
36 36
     foreach ($all_file_of_directory as $key_value=>$value_info) {
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
     if (!empty($result_array)) {
41 41
         foreach ($result_array as $key => $result) {
42 42
             if ($result == false) {
43
-                $variables_with_problems .=$key.' <br />';
43
+                $variables_with_problems .= $key.' <br />';
44 44
             }
45 45
         }
46 46
     }
Please login to merge, or discard this patch.
main/admin/subscribe_class2course.php 3 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -90,8 +90,8 @@  discard block
 block discarded – undo
90 90
     <select name="firstLetterClass" onchange="javascript:document.formulaire.formSent.value='2'; document.formulaire.submit();">
91 91
      <option value="">--</option>
92 92
      <?php
93
-     echo Display::get_alphabet_options($first_letter_class);
94
-     ?>
93
+        echo Display::get_alphabet_options($first_letter_class);
94
+        ?>
95 95
     </select>
96 96
    </td>
97 97
    <td width="20%">&nbsp;</td>
@@ -102,8 +102,8 @@  discard block
 block discarded – undo
102 102
     <select name="firstLetterCourse" onchange="javascript:document.formulaire.formSent.value='2'; document.formulaire.submit();">
103 103
      <option value="">--</option>
104 104
      <?php
105
-     echo Display::get_alphabet_options($first_letter_course);
106
-     ?>
105
+        echo Display::get_alphabet_options($first_letter_course);
106
+        ?>
107 107
     </select>
108 108
    </td>
109 109
   </tr>
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 $cidReset = true;
10 10
 
11 11
 require_once '../inc/global.inc.php';
12
-$this_section=SECTION_PLATFORM_ADMIN;
12
+$this_section = SECTION_PLATFORM_ADMIN;
13 13
 
14 14
 api_protect_admin_script();
15 15
 
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 $error_message = '';
19 19
 $first_letter_class = '';
20 20
 $first_letter_course = '';
21
-$courses = array ();
21
+$courses = array();
22 22
 $classes = array();
23 23
 
24 24
 $tbl_course = Database :: get_main_table(TABLE_MAIN_COURSE);
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 
27 27
 $tool_name = get_lang('AddClassesToACourse');
28 28
 
29
-$interbreadcrumb[] = array ("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
29
+$interbreadcrumb[] = array("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
30 30
 
31 31
 Display :: display_header($tool_name);
32 32
 
@@ -68,10 +68,10 @@  discard block
 block discarded – undo
68 68
     }
69 69
 }
70 70
 
71
-$sql = "SELECT id,name FROM $tbl_class WHERE name LIKE '".$first_letter_class."%' ORDER BY ". (count($classes) > 0 ? "(id IN('".implode("','", $classes)."')) DESC," : "")." name";
71
+$sql = "SELECT id,name FROM $tbl_class WHERE name LIKE '".$first_letter_class."%' ORDER BY ".(count($classes) > 0 ? "(id IN('".implode("','", $classes)."')) DESC," : "")." name";
72 72
 $result = Database::query($sql);
73 73
 $db_classes = Database::store_result($result);
74
-$sql = "SELECT code,visual_code,title FROM $tbl_course WHERE visual_code LIKE '".$first_letter_course."%' ORDER BY ". (count($courses) > 0 ? "(code IN('".implode("','", $courses)."')) DESC," : "")." visual_code";
74
+$sql = "SELECT code,visual_code,title FROM $tbl_course WHERE visual_code LIKE '".$first_letter_course."%' ORDER BY ".(count($courses) > 0 ? "(code IN('".implode("','", $courses)."')) DESC," : "")." visual_code";
75 75
 $result = Database::query($sql);
76 76
 $db_courses = Database::store_result($result);
77 77
 if (!empty ($error_message))
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 foreach ($db_classes as $class)
115 115
 {
116 116
 ?>
117
-    <option value="<?php echo $class['id']; ?>" <?php if(in_array($class['id'],$classes)) echo 'selected="selected"'; ?>><?php echo $class['name']; ?></option>
117
+    <option value="<?php echo $class['id']; ?>" <?php if (in_array($class['id'], $classes)) echo 'selected="selected"'; ?>><?php echo $class['name']; ?></option>
118 118
 <?php
119 119
 }
120 120
 ?>
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 foreach ($db_courses as $course)
132 132
 {
133 133
 ?>
134
-    <option value="<?php echo $course['code']; ?>" <?php if(in_array($course['code'],$courses)) echo 'selected="selected"'; ?>><?php echo '('.$course['visual_code'].') '.$course['title']; ?></option>
134
+    <option value="<?php echo $course['code']; ?>" <?php if (in_array($course['code'], $courses)) echo 'selected="selected"'; ?>><?php echo '('.$course['visual_code'].') '.$course['title']; ?></option>
135 135
 <?php
136 136
 }
137 137
 ?>
Please login to merge, or discard this patch.
Braces   +11 added lines, -4 removed lines patch added patch discarded remove patch
@@ -46,14 +46,15 @@  discard block
 block discarded – undo
46 46
         if (count($classes) == 0 || count($courses) == 0)
47 47
         {
48 48
             Display::display_error_message(get_lang('AtLeastOneClassAndOneCourse'));
49
-        }
50
-        elseif (api_substr($_POST['formSubmit'], -2) == '>>') // add classes to courses
49
+        } elseif (api_substr($_POST['formSubmit'], -2) == '>>') {
50
+            // add classes to courses
51 51
         {
52 52
             foreach ($courses as $course_code)
53 53
             {
54 54
                 foreach ($classes as $class_id)
55 55
                 {
56 56
                     ClassManager :: subscribe_to_course($class_id, $course_code);
57
+        }
57 58
                 }
58 59
             }
59 60
             Display::display_normal_message(get_lang('ClassesSubscribed'));
@@ -114,7 +115,10 @@  discard block
 block discarded – undo
114 115
 foreach ($db_classes as $class)
115 116
 {
116 117
 ?>
117
-    <option value="<?php echo $class['id']; ?>" <?php if(in_array($class['id'],$classes)) echo 'selected="selected"'; ?>><?php echo $class['name']; ?></option>
118
+    <option value="<?php echo $class['id']; ?>" <?php if(in_array($class['id'],$classes)) {
119
+    echo 'selected="selected"';
120
+}
121
+?>><?php echo $class['name']; ?></option>
118 122
 <?php
119 123
 }
120 124
 ?>
@@ -131,7 +135,10 @@  discard block
 block discarded – undo
131 135
 foreach ($db_courses as $course)
132 136
 {
133 137
 ?>
134
-    <option value="<?php echo $course['code']; ?>" <?php if(in_array($course['code'],$courses)) echo 'selected="selected"'; ?>><?php echo '('.$course['visual_code'].') '.$course['title']; ?></option>
138
+    <option value="<?php echo $course['code']; ?>" <?php if(in_array($course['code'],$courses)) {
139
+    echo 'selected="selected"';
140
+}
141
+?>><?php echo '('.$course['visual_code'].') '.$course['title']; ?></option>
135 142
 <?php
136 143
 }
137 144
 ?>
Please login to merge, or discard this patch.
main/admin/event_controller.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -67,12 +67,12 @@  discard block
 block discarded – undo
67 67
 
68 68
 //Column config
69 69
 $column_model   = array(
70
-                        array('name'=>'subject',        'index'=>'subject',        'width'=>'80',   'align'=>'left'),
70
+                        array('name'=>'subject', 'index'=>'subject', 'width'=>'80', 'align'=>'left'),
71 71
 //                        array('name'=>'message',        'index'=>'message', 'width'=>'500',  'align'=>'left','sortable'=>'false'),
72
-                        array('name'=>'event_type_name',        'index'=>'event_type_name',        'width'=>'80',   'align'=>'left'),
73
-                        array('name'=>'language_id',        'index'=>'language_id',        'width'=>'80',   'align'=>'left'),
74
-                        array('name'=>'activated',        'index'=>'activated',        'width'=>'80',   'align'=>'left'),
75
-                        array('name'=>'actions',        'index'=>'actions',     'width'=>'100')
72
+                        array('name'=>'event_type_name', 'index'=>'event_type_name', 'width'=>'80', 'align'=>'left'),
73
+                        array('name'=>'language_id', 'index'=>'language_id', 'width'=>'80', 'align'=>'left'),
74
+                        array('name'=>'activated', 'index'=>'activated', 'width'=>'80', 'align'=>'left'),
75
+                        array('name'=>'actions', 'index'=>'actions', 'width'=>'100')
76 76
                        );
77 77
 //Autowidth
78 78
 $extra_params['autowidth'] = 'true';
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 $htmlHeadXtra[] = api_get_jqgrid_js();
83 83
 $htmlHeadXtra[] = '<script>
84 84
 $(function() {
85
-    '.Display::grid_js('event_email_template',  $url,$columns,$column_model,$extra_params, array(), $action_links,true).'
85
+    '.Display::grid_js('event_email_template', $url, $columns, $column_model, $extra_params, array(), $action_links, true).'
86 86
 });
87 87
 </script>';
88 88
 
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
     }
32 32
 
33 33
     public function deleteAction($id) {
34
-         $event_email_template = new EventEmailTemplate();
34
+            $event_email_template = new EventEmailTemplate();
35 35
         return $event_email_template->delete($id);
36 36
     }
37 37
 }
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
                         array('name'=>'language_id',        'index'=>'language_id',        'width'=>'80',   'align'=>'left'),
74 74
                         array('name'=>'activated',        'index'=>'activated',        'width'=>'80',   'align'=>'left'),
75 75
                         array('name'=>'actions',        'index'=>'actions',     'width'=>'100')
76
-                       );
76
+                        );
77 77
 //Autowidth
78 78
 $extra_params['autowidth'] = 'true';
79 79
 //height auto
Please login to merge, or discard this patch.
main/admin/course_intro_pdf_import.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -90,26 +90,26 @@
 block discarded – undo
90 90
 {
91 91
     $baseDir = api_get_path(SYS_ARCHIVE_PATH);
92 92
     $uploadPath = 'pdfimport/';
93
-    $errors = array ();
93
+    $errors = array();
94 94
     if (!is_dir($baseDir.$uploadPath)) {
95 95
         @mkdir($baseDir.$uploadPath);
96 96
     }
97
-    if (!unzip_uploaded_file($_FILES['import_file'], $uploadPath, $baseDir, 1024*1024*1024)) {
97
+    if (!unzip_uploaded_file($_FILES['import_file'], $uploadPath, $baseDir, 1024 * 1024 * 1024)) {
98 98
         error_log('Could not unzip uploaded file in '.__FILE__.', line '.__LINE__);
99 99
         return $errors;
100 100
     }
101 101
     $list = scandir($baseDir.$uploadPath);
102 102
     $i = 0;
103 103
     foreach ($list as $file) {
104
-        if (substr($file,0,1) == '.' or !is_file($baseDir.$uploadPath.$file)) {
104
+        if (substr($file, 0, 1) == '.' or !is_file($baseDir.$uploadPath.$file)) {
105 105
             continue;
106 106
         }
107
-        $parts = preg_split('/_/',$file);
107
+        $parts = preg_split('/_/', $file);
108 108
         $course = api_get_course_info($parts[0]);
109 109
         if (count($course) > 0) {
110 110
             // Build file info because handle_uploaded_document() needs it (name, type, size, tmp_name)
111 111
             $fileSize = filesize($baseDir.$uploadPath.$file);
112
-            $docId = add_document($course, $subDir.'/'.$file, 'file', $fileSize, $parts[1].' '.substr($parts[2],0,-4));
112
+            $docId = add_document($course, $subDir.'/'.$file, 'file', $fileSize, $parts[1].' '.substr($parts[2], 0, -4));
113 113
             if ($docId > 0) {
114 114
                 if (!is_file($baseDir.$uploadPath.$file)) {
115 115
                     error_log($baseDir.$uploadPath.$file.' does not exists in '.__FILE__);
Please login to merge, or discard this patch.