Completed
Push — 1.11.x ( 6c3085...b368fe )
by José
83:26 queued 56:20
created
main/admin/ldap_users_list.php 3 patches
Braces   +15 added lines, -20 removed lines patch added patch discarded remove patch
@@ -51,8 +51,7 @@  discard block
 block discarded – undo
51 51
 				if ($user_id != $_user['user_id'] && UserManager :: delete_user($_GET['user_id']))
52 52
 				{
53 53
 					Display :: display_normal_message(get_lang('UserDeleted'));
54
-				}
55
-				else
54
+				} else
56 55
 				{
57 56
 					Display :: display_error_message(get_lang('CannotDeleteUser'));
58 57
 				}
@@ -88,8 +87,7 @@  discard block
 block discarded – undo
88 87
 						{
89 88
 							$message .= '- '.$login.'<br />';
90 89
 						}
91
-					}
92
-					else
90
+					} else
93 91
 					{
94 92
 						$message=get_lang('NoUserAdded');
95 93
 					}
@@ -100,13 +98,11 @@  discard block
 block discarded – undo
100 98
 				Display :: display_header($tool_name);
101 99
 		}
102 100
 		Security::clear_token();
103
-	}
104
-	else
101
+	} else
105 102
 	{
106 103
 		Display::display_header($tool_name);
107 104
 	}
108
-}
109
-else
105
+} else
110 106
 {
111 107
 	Display::display_header($tool_name);
112 108
 }
@@ -133,8 +129,7 @@  discard block
 block discarded – undo
133 129
 				if($number_of_selected_users == $number_of_deleted_users)
134 130
 				{
135 131
 					Display :: display_normal_message(get_lang('SelectedUsersDeleted'));
136
-				}
137
-				else
132
+				} else
138 133
 				{
139 134
 					Display :: display_error_message(get_lang('SomeUsersNotDeleted'));
140 135
 				}
@@ -150,13 +145,13 @@  discard block
 block discarded – undo
150 145
 						$UserList[] = ldap_add_user($user_id);
151 146
 					}
152 147
 				}
153
-				if (isset($_GET['id_session']) && (trim($_GET['id_session'])!=""))
154
-					addUserToSession($UserList, $_GET['id_session']);
148
+				if (isset($_GET['id_session']) && (trim($_GET['id_session'])!="")) {
149
+									addUserToSession($UserList, $_GET['id_session']);
150
+				}
155 151
 				if(count($UserList)>0)
156 152
 				{
157 153
 					Display :: display_normal_message(count($UserList)." ".get_lang('LDAPUsersAdded'));
158
-				}
159
-				else
154
+				} else
160 155
 				{
161 156
 					Display :: display_normal_message(get_lang('NoUserAdded'));
162 157
 				}
@@ -173,14 +168,14 @@  discard block
 block discarded – undo
173 168
 {
174 169
 	$form->addText('keyword_firstname', get_lang('FirstName'), false);
175 170
 	$form->addText('keyword_lastname', get_lang('LastName'), false);
176
-}
177
-else
171
+} else
178 172
 {
179 173
 	$form->addText('keyword_lastname',get_lang('LastName'),false);
180 174
 	$form->addText('keyword_firstname',get_lang('FirstName'),false);
181 175
 }
182
-if (isset($_GET['id_session']))
176
+if (isset($_GET['id_session'])) {
183 177
 	$form->addElement('hidden','id_session',$_GET['id_session']);
178
+}
184 179
 
185 180
 $type = array();
186 181
 $type["all"] = get_lang('All');
@@ -201,8 +196,9 @@  discard block
 block discarded – undo
201 196
 $parameters['keyword_firstname'] = @$_GET['keyword_firstname'] ?: null;
202 197
 $parameters['keyword_lastname'] = @$_GET['keyword_lastname'] ?: null;
203 198
 $parameters['keyword_email'] = @$_GET['keyword_email'] ?: null;
204
-if (isset($_GET['id_session']))
199
+if (isset($_GET['id_session'])) {
205 200
 	$parameters['id_session'] = $_GET['id_session'];
201
+}
206 202
 // Create a sortable table with user-data
207 203
 
208 204
 $parameters['sec_token'] = Security::get_token();
@@ -214,8 +210,7 @@  discard block
 block discarded – undo
214 210
 {
215 211
 	$table->set_header(2, get_lang('FirstName'));
216 212
 	$table->set_header(3, get_lang('LastName'));
217
-}
218
-else
213
+} else
219 214
 {
220 215
 	$table->set_header(2, get_lang('LastName'));
221 216
 	$table->set_header(3, get_lang('FirstName'));
Please login to merge, or discard this patch.
Indentation   +132 added lines, -132 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 // Login as ...
21 21
 if ($action == "login_as" && !empty ($login_as_user_id))
22 22
 {
23
-	login_user($login_as_user_id);
23
+    login_user($login_as_user_id);
24 24
 }
25 25
 
26 26
 //if we already have a session id and a user...
@@ -37,150 +37,150 @@  discard block
 block discarded – undo
37 37
 
38 38
 if (isset ($_GET['action']))
39 39
 {
40
-	$check = Security::check_token('get');
41
-	if($check)
42
-	{
43
-		switch ($_GET['action'])
44
-		{
45
-			case 'show_message' :
46
-				Display :: display_header($tool_name);
47
-				Display :: display_normal_message($_GET['message']);
48
-				break;
49
-			case 'delete_user' :
50
-				Display :: display_header($tool_name);
51
-				if ($user_id != $_user['user_id'] && UserManager :: delete_user($_GET['user_id']))
52
-				{
53
-					Display :: display_normal_message(get_lang('UserDeleted'));
54
-				}
55
-				else
56
-				{
57
-					Display :: display_error_message(get_lang('CannotDeleteUser'));
58
-				}
59
-				break;
60
-			case 'lock' :
61
-				Display :: display_header($tool_name);
62
-				$message=lock_unlock_user('lock',$_GET['user_id']);
63
-				Display :: display_normal_message($message);
64
-				break;
65
-			case 'unlock';
66
-				Display :: display_header($tool_name);
67
-				$message=lock_unlock_user('unlock',$_GET['user_id']);
68
-				Display :: display_normal_message($message);
69
-				break;
70
-			case 'add_user';
71
-				$id=$_GET['id'];
72
-				$UserList=array();
73
-				$userid_match_login = array();
74
-				foreach ($id as $user_id) {
75
-					$tmp = ldap_add_user($user_id);
76
-					$UserList[]= $tmp;
77
-					$userid_match_login[$tmp] = $user_id;
78
-				}
79
-				if (isset($_GET['id_session']) && ($_GET['id_session'] == strval(intval($_GET['id_session']))) && ($_GET['id_session']>0)) {
80
-					ldap_add_user_to_session($UserList, $_GET['id_session']);
81
-					header('Location: resume_session.php?id_session='.intval($_GET['id_session']));
82
-				} else {
83
-					Display :: display_header($tool_name);
84
-					if(count($userid_match_login)>0)
85
-					{
86
-						$message=get_lang('LDAPUsersAddedOrUpdated').':<br />';
87
-						foreach($userid_match_login as $user_id => $login)
88
-						{
89
-							$message .= '- '.$login.'<br />';
90
-						}
91
-					}
92
-					else
93
-					{
94
-						$message=get_lang('NoUserAdded');
95
-					}
96
-					Display :: display_normal_message($message,false);
97
-				}
98
-				break;
99
-			default :
100
-				Display :: display_header($tool_name);
101
-		}
102
-		Security::clear_token();
103
-	}
104
-	else
105
-	{
106
-		Display::display_header($tool_name);
107
-	}
40
+    $check = Security::check_token('get');
41
+    if($check)
42
+    {
43
+        switch ($_GET['action'])
44
+        {
45
+            case 'show_message' :
46
+                Display :: display_header($tool_name);
47
+                Display :: display_normal_message($_GET['message']);
48
+                break;
49
+            case 'delete_user' :
50
+                Display :: display_header($tool_name);
51
+                if ($user_id != $_user['user_id'] && UserManager :: delete_user($_GET['user_id']))
52
+                {
53
+                    Display :: display_normal_message(get_lang('UserDeleted'));
54
+                }
55
+                else
56
+                {
57
+                    Display :: display_error_message(get_lang('CannotDeleteUser'));
58
+                }
59
+                break;
60
+            case 'lock' :
61
+                Display :: display_header($tool_name);
62
+                $message=lock_unlock_user('lock',$_GET['user_id']);
63
+                Display :: display_normal_message($message);
64
+                break;
65
+            case 'unlock';
66
+                Display :: display_header($tool_name);
67
+                $message=lock_unlock_user('unlock',$_GET['user_id']);
68
+                Display :: display_normal_message($message);
69
+                break;
70
+            case 'add_user';
71
+                $id=$_GET['id'];
72
+                $UserList=array();
73
+                $userid_match_login = array();
74
+                foreach ($id as $user_id) {
75
+                    $tmp = ldap_add_user($user_id);
76
+                    $UserList[]= $tmp;
77
+                    $userid_match_login[$tmp] = $user_id;
78
+                }
79
+                if (isset($_GET['id_session']) && ($_GET['id_session'] == strval(intval($_GET['id_session']))) && ($_GET['id_session']>0)) {
80
+                    ldap_add_user_to_session($UserList, $_GET['id_session']);
81
+                    header('Location: resume_session.php?id_session='.intval($_GET['id_session']));
82
+                } else {
83
+                    Display :: display_header($tool_name);
84
+                    if(count($userid_match_login)>0)
85
+                    {
86
+                        $message=get_lang('LDAPUsersAddedOrUpdated').':<br />';
87
+                        foreach($userid_match_login as $user_id => $login)
88
+                        {
89
+                            $message .= '- '.$login.'<br />';
90
+                        }
91
+                    }
92
+                    else
93
+                    {
94
+                        $message=get_lang('NoUserAdded');
95
+                    }
96
+                    Display :: display_normal_message($message,false);
97
+                }
98
+                break;
99
+            default :
100
+                Display :: display_header($tool_name);
101
+        }
102
+        Security::clear_token();
103
+    }
104
+    else
105
+    {
106
+        Display::display_header($tool_name);
107
+    }
108 108
 }
109 109
 else
110 110
 {
111
-	Display::display_header($tool_name);
111
+    Display::display_header($tool_name);
112 112
 }
113 113
 if (isset ($_POST['action']))
114 114
 {
115
-	$check = Security::check_token('get');
116
-	if($check)
117
-	{
118
-		switch ($_POST['action'])
119
-		{
120
-			case 'delete' :
121
-				$number_of_selected_users = count($_POST['id']);
122
-				$number_of_deleted_users = 0;
123
-				foreach ($_POST['id'] as $index => $user_id)
124
-				{
125
-					if($user_id != $_user['user_id'])
126
-					{
127
-						if(UserManager :: delete_user($user_id))
128
-						{
129
-							$number_of_deleted_users++;
130
-						}
131
-					}
132
-				}
133
-				if($number_of_selected_users == $number_of_deleted_users)
134
-				{
135
-					Display :: display_normal_message(get_lang('SelectedUsersDeleted'));
136
-				}
137
-				else
138
-				{
139
-					Display :: display_error_message(get_lang('SomeUsersNotDeleted'));
140
-				}
141
-				break;
142
-			case 'add_user' :
143
-				$number_of_selected_users = count($_POST['id']);
144
-				$number_of_added_users = 0;
145
-				$UserList=array();
146
-				foreach ($_POST['id'] as $index => $user_id)
147
-				{
148
-					if($user_id != $_user['user_id'])
149
-					{
150
-						$UserList[] = ldap_add_user($user_id);
151
-					}
152
-				}
153
-				if (isset($_GET['id_session']) && (trim($_GET['id_session'])!=""))
154
-					addUserToSession($UserList, $_GET['id_session']);
155
-				if(count($UserList)>0)
156
-				{
157
-					Display :: display_normal_message(count($UserList)." ".get_lang('LDAPUsersAdded'));
158
-				}
159
-				else
160
-				{
161
-					Display :: display_normal_message(get_lang('NoUserAdded'));
162
-				}
163
-				break;
115
+    $check = Security::check_token('get');
116
+    if($check)
117
+    {
118
+        switch ($_POST['action'])
119
+        {
120
+            case 'delete' :
121
+                $number_of_selected_users = count($_POST['id']);
122
+                $number_of_deleted_users = 0;
123
+                foreach ($_POST['id'] as $index => $user_id)
124
+                {
125
+                    if($user_id != $_user['user_id'])
126
+                    {
127
+                        if(UserManager :: delete_user($user_id))
128
+                        {
129
+                            $number_of_deleted_users++;
130
+                        }
131
+                    }
132
+                }
133
+                if($number_of_selected_users == $number_of_deleted_users)
134
+                {
135
+                    Display :: display_normal_message(get_lang('SelectedUsersDeleted'));
136
+                }
137
+                else
138
+                {
139
+                    Display :: display_error_message(get_lang('SomeUsersNotDeleted'));
140
+                }
141
+                break;
142
+            case 'add_user' :
143
+                $number_of_selected_users = count($_POST['id']);
144
+                $number_of_added_users = 0;
145
+                $UserList=array();
146
+                foreach ($_POST['id'] as $index => $user_id)
147
+                {
148
+                    if($user_id != $_user['user_id'])
149
+                    {
150
+                        $UserList[] = ldap_add_user($user_id);
151
+                    }
152
+                }
153
+                if (isset($_GET['id_session']) && (trim($_GET['id_session'])!=""))
154
+                    addUserToSession($UserList, $_GET['id_session']);
155
+                if(count($UserList)>0)
156
+                {
157
+                    Display :: display_normal_message(count($UserList)." ".get_lang('LDAPUsersAdded'));
158
+                }
159
+                else
160
+                {
161
+                    Display :: display_normal_message(get_lang('NoUserAdded'));
162
+                }
163
+                break;
164 164
 
165
-		}
166
-		Security::clear_token();
167
-	}
165
+        }
166
+        Security::clear_token();
167
+    }
168 168
 }
169 169
 
170 170
 $form = new FormValidator('advanced_search','get');
171 171
 $form->addText('keyword_username',get_lang('LoginName'),false);
172 172
 if (api_is_western_name_order())
173 173
 {
174
-	$form->addText('keyword_firstname', get_lang('FirstName'), false);
175
-	$form->addText('keyword_lastname', get_lang('LastName'), false);
174
+    $form->addText('keyword_firstname', get_lang('FirstName'), false);
175
+    $form->addText('keyword_lastname', get_lang('LastName'), false);
176 176
 }
177 177
 else
178 178
 {
179
-	$form->addText('keyword_lastname',get_lang('LastName'),false);
180
-	$form->addText('keyword_firstname',get_lang('FirstName'),false);
179
+    $form->addText('keyword_lastname',get_lang('LastName'),false);
180
+    $form->addText('keyword_firstname',get_lang('FirstName'),false);
181 181
 }
182 182
 if (isset($_GET['id_session']))
183
-	$form->addElement('hidden','id_session',$_GET['id_session']);
183
+    $form->addElement('hidden','id_session',$_GET['id_session']);
184 184
 
185 185
 $type = array();
186 186
 $type["all"] = get_lang('All');
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 $parameters['keyword_lastname'] = @$_GET['keyword_lastname'] ?: null;
203 203
 $parameters['keyword_email'] = @$_GET['keyword_email'] ?: null;
204 204
 if (isset($_GET['id_session']))
205
-	$parameters['id_session'] = $_GET['id_session'];
205
+    $parameters['id_session'] = $_GET['id_session'];
206 206
 // Create a sortable table with user-data
207 207
 
208 208
 $parameters['sec_token'] = Security::get_token();
@@ -212,13 +212,13 @@  discard block
 block discarded – undo
212 212
 $table->set_header(1, get_lang('LoginName'));
213 213
 if (api_is_western_name_order())
214 214
 {
215
-	$table->set_header(2, get_lang('FirstName'));
216
-	$table->set_header(3, get_lang('LastName'));
215
+    $table->set_header(2, get_lang('FirstName'));
216
+    $table->set_header(3, get_lang('LastName'));
217 217
 }
218 218
 else
219 219
 {
220
-	$table->set_header(2, get_lang('LastName'));
221
-	$table->set_header(3, get_lang('FirstName'));
220
+    $table->set_header(2, get_lang('LastName'));
221
+    $table->set_header(3, get_lang('FirstName'));
222 222
 }
223 223
 $table->set_header(4, get_lang('Email'));
224 224
 $table->set_header(5, get_lang('Actions'));
Please login to merge, or discard this patch.
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 }
31 31
 */
32 32
 
33
-$interbreadcrumb[] = array ("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
33
+$interbreadcrumb[] = array("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
34 34
 $tool_name = get_lang('SearchLDAPUsers');
35 35
 //Display :: display_header($tool_name); //cannot display now as we need to redirect
36 36
 //api_display_tool_title($tool_name);
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 if (isset ($_GET['action']))
39 39
 {
40 40
 	$check = Security::check_token('get');
41
-	if($check)
41
+	if ($check)
42 42
 	{
43 43
 		switch ($_GET['action'])
44 44
 		{
@@ -59,41 +59,41 @@  discard block
 block discarded – undo
59 59
 				break;
60 60
 			case 'lock' :
61 61
 				Display :: display_header($tool_name);
62
-				$message=lock_unlock_user('lock',$_GET['user_id']);
62
+				$message = lock_unlock_user('lock', $_GET['user_id']);
63 63
 				Display :: display_normal_message($message);
64 64
 				break;
65 65
 			case 'unlock';
66 66
 				Display :: display_header($tool_name);
67
-				$message=lock_unlock_user('unlock',$_GET['user_id']);
67
+				$message = lock_unlock_user('unlock', $_GET['user_id']);
68 68
 				Display :: display_normal_message($message);
69 69
 				break;
70 70
 			case 'add_user';
71
-				$id=$_GET['id'];
72
-				$UserList=array();
71
+				$id = $_GET['id'];
72
+				$UserList = array();
73 73
 				$userid_match_login = array();
74 74
 				foreach ($id as $user_id) {
75 75
 					$tmp = ldap_add_user($user_id);
76
-					$UserList[]= $tmp;
76
+					$UserList[] = $tmp;
77 77
 					$userid_match_login[$tmp] = $user_id;
78 78
 				}
79
-				if (isset($_GET['id_session']) && ($_GET['id_session'] == strval(intval($_GET['id_session']))) && ($_GET['id_session']>0)) {
79
+				if (isset($_GET['id_session']) && ($_GET['id_session'] == strval(intval($_GET['id_session']))) && ($_GET['id_session'] > 0)) {
80 80
 					ldap_add_user_to_session($UserList, $_GET['id_session']);
81 81
 					header('Location: resume_session.php?id_session='.intval($_GET['id_session']));
82 82
 				} else {
83 83
 					Display :: display_header($tool_name);
84
-					if(count($userid_match_login)>0)
84
+					if (count($userid_match_login) > 0)
85 85
 					{
86
-						$message=get_lang('LDAPUsersAddedOrUpdated').':<br />';
87
-						foreach($userid_match_login as $user_id => $login)
86
+						$message = get_lang('LDAPUsersAddedOrUpdated').':<br />';
87
+						foreach ($userid_match_login as $user_id => $login)
88 88
 						{
89 89
 							$message .= '- '.$login.'<br />';
90 90
 						}
91 91
 					}
92 92
 					else
93 93
 					{
94
-						$message=get_lang('NoUserAdded');
94
+						$message = get_lang('NoUserAdded');
95 95
 					}
96
-					Display :: display_normal_message($message,false);
96
+					Display :: display_normal_message($message, false);
97 97
 				}
98 98
 				break;
99 99
 			default :
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 if (isset ($_POST['action']))
114 114
 {
115 115
 	$check = Security::check_token('get');
116
-	if($check)
116
+	if ($check)
117 117
 	{
118 118
 		switch ($_POST['action'])
119 119
 		{
@@ -122,15 +122,15 @@  discard block
 block discarded – undo
122 122
 				$number_of_deleted_users = 0;
123 123
 				foreach ($_POST['id'] as $index => $user_id)
124 124
 				{
125
-					if($user_id != $_user['user_id'])
125
+					if ($user_id != $_user['user_id'])
126 126
 					{
127
-						if(UserManager :: delete_user($user_id))
127
+						if (UserManager :: delete_user($user_id))
128 128
 						{
129 129
 							$number_of_deleted_users++;
130 130
 						}
131 131
 					}
132 132
 				}
133
-				if($number_of_selected_users == $number_of_deleted_users)
133
+				if ($number_of_selected_users == $number_of_deleted_users)
134 134
 				{
135 135
 					Display :: display_normal_message(get_lang('SelectedUsersDeleted'));
136 136
 				}
@@ -142,17 +142,17 @@  discard block
 block discarded – undo
142 142
 			case 'add_user' :
143 143
 				$number_of_selected_users = count($_POST['id']);
144 144
 				$number_of_added_users = 0;
145
-				$UserList=array();
145
+				$UserList = array();
146 146
 				foreach ($_POST['id'] as $index => $user_id)
147 147
 				{
148
-					if($user_id != $_user['user_id'])
148
+					if ($user_id != $_user['user_id'])
149 149
 					{
150 150
 						$UserList[] = ldap_add_user($user_id);
151 151
 					}
152 152
 				}
153
-				if (isset($_GET['id_session']) && (trim($_GET['id_session'])!=""))
153
+				if (isset($_GET['id_session']) && (trim($_GET['id_session']) != ""))
154 154
 					addUserToSession($UserList, $_GET['id_session']);
155
-				if(count($UserList)>0)
155
+				if (count($UserList) > 0)
156 156
 				{
157 157
 					Display :: display_normal_message(count($UserList)." ".get_lang('LDAPUsersAdded'));
158 158
 				}
@@ -167,8 +167,8 @@  discard block
 block discarded – undo
167 167
 	}
168 168
 }
169 169
 
170
-$form = new FormValidator('advanced_search','get');
171
-$form->addText('keyword_username',get_lang('LoginName'),false);
170
+$form = new FormValidator('advanced_search', 'get');
171
+$form->addText('keyword_username', get_lang('LoginName'), false);
172 172
 if (api_is_western_name_order())
173 173
 {
174 174
 	$form->addText('keyword_firstname', get_lang('FirstName'), false);
@@ -176,20 +176,20 @@  discard block
 block discarded – undo
176 176
 }
177 177
 else
178 178
 {
179
-	$form->addText('keyword_lastname',get_lang('LastName'),false);
180
-	$form->addText('keyword_firstname',get_lang('FirstName'),false);
179
+	$form->addText('keyword_lastname', get_lang('LastName'), false);
180
+	$form->addText('keyword_firstname', get_lang('FirstName'), false);
181 181
 }
182 182
 if (isset($_GET['id_session']))
183
-	$form->addElement('hidden','id_session',$_GET['id_session']);
183
+	$form->addElement('hidden', 'id_session', $_GET['id_session']);
184 184
 
185 185
 $type = array();
186 186
 $type["all"] = get_lang('All');
187
-$type["employee"]  = get_lang('Teacher');
187
+$type["employee"] = get_lang('Teacher');
188 188
 $type["student"] = get_lang('Student');
189 189
 
190
-$form->addElement('select','keyword_type',get_lang('Status'),$type);
190
+$form->addElement('select', 'keyword_type', get_lang('Status'), $type);
191 191
 // Structure a rajouer ??
192
-$form->addElement('submit','submit',get_lang('Ok'));
192
+$form->addElement('submit', 'submit', get_lang('Ok'));
193 193
 //$defaults['keyword_active'] = 1;
194 194
 //$defaults['keyword_inactive'] = 1;
195 195
 //$form->setDefaults($defaults);
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 //$table->set_column_filter(5, 'email_filter');
226 226
 //$table->set_column_filter(5, 'active_filter');
227 227
 $table->set_column_filter(5, 'modify_filter');
228
-$table->set_form_actions(array ('add_user' => get_lang('AddLDAPUsers')));
228
+$table->set_form_actions(array('add_user' => get_lang('AddLDAPUsers')));
229 229
 $table->display();
230 230
 
231 231
 /*
Please login to merge, or discard this patch.
main/admin/access_url_edit_course_category_to_url.php 3 patches
Braces   +5 added lines, -4 removed lines patch added patch discarded remove patch
@@ -240,10 +240,11 @@
 block discarded – undo
240 240
 	<td colspan="3" align="center">
241 241
 		<br />
242 242
 		<?php
243
-		if(isset($_GET['add']))
244
-			echo '<button class="save" onclick="valide()" >'.get_lang('Add').'</button>';
245
-		else
246
-			echo '<button class="save" onclick="valide()" >'.get_lang('Edit').'</button>';
243
+		if(isset($_GET['add'])) {
244
+					echo '<button class="save" onclick="valide()" >'.get_lang('Add').'</button>';
245
+		} else {
246
+					echo '<button class="save" onclick="valide()" >'.get_lang('Edit').'</button>';
247
+		}
247 248
 		?>
248 249
 	</td>
249 250
 </tr>
Please login to merge, or discard this patch.
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -120,12 +120,12 @@  discard block
 block discarded – undo
120 120
 }
121 121
 
122 122
 if ($add_type == 'multiple') {
123
-	$link_add_type_unique = '<a href="'.api_get_self().'?add_type=unique&access_url_id='.$access_url_id.'">'.
123
+    $link_add_type_unique = '<a href="'.api_get_self().'?add_type=unique&access_url_id='.$access_url_id.'">'.
124 124
         get_lang('SessionAddTypeUnique').'</a>';
125
-	$link_add_type_multiple = get_lang('SessionAddTypeMultiple');
125
+    $link_add_type_multiple = get_lang('SessionAddTypeMultiple');
126 126
 } else {
127
-	$link_add_type_unique = get_lang('SessionAddTypeUnique');
128
-	$link_add_type_multiple = '<a href="'.api_get_self().'?add_type=multiple&access_url_id='.$access_url_id.'">'.
127
+    $link_add_type_unique = get_lang('SessionAddTypeUnique');
128
+    $link_add_type_multiple = '<a href="'.api_get_self().'?add_type=multiple&access_url_id='.$access_url_id.'">'.
129 129
         get_lang('SessionAddTypeMultiple').'</a>';
130 130
 }
131 131
 
@@ -223,11 +223,11 @@  discard block
 block discarded – undo
223 223
 	<td colspan="3" align="center">
224 224
 		<br />
225 225
 		<?php
226
-		if(isset($_GET['add']))
227
-			echo '<button class="save" onclick="valide()" >'.get_lang('Add').'</button>';
228
-		else
229
-			echo '<button class="save" onclick="valide()" >'.get_lang('Edit').'</button>';
230
-		?>
226
+        if(isset($_GET['add']))
227
+            echo '<button class="save" onclick="valide()" >'.get_lang('Add').'</button>';
228
+        else
229
+            echo '<button class="save" onclick="valide()" >'.get_lang('Edit').'</button>';
230
+        ?>
231 231
 	</td>
232 232
 </tr>
233 233
 </table>
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 
114 114
     foreach ($userGroups as $item) {
115 115
         if ($item['access_url_id'] == $access_url_id) {
116
-            $userGroupList[$item['id']] = $item ;
116
+            $userGroupList[$item['id']] = $item;
117 117
         }
118 118
     }
119 119
     $noUserGroupList = CourseCategory::getCourseCategoryNotInList(array_keys($userGroupList));
@@ -151,11 +151,11 @@  discard block
 block discarded – undo
151 151
         if (!empty($access_url_id)) {
152 152
             if ($url_obj[0] == $access_url_id) {
153 153
                 $checked = 'selected=true';
154
-                $url_selected=$url_obj[1];
154
+                $url_selected = $url_obj[1];
155 155
             }
156 156
         }
157
-        if ($url_obj['active']==1) { ?>
158
-            <option <?php echo $checked;?> value="<?php echo $url_obj[0]; ?>"> <?php echo $url_obj[1]; ?>
157
+        if ($url_obj['active'] == 1) { ?>
158
+            <option <?php echo $checked; ?> value="<?php echo $url_obj[0]; ?>"> <?php echo $url_obj[1]; ?>
159 159
             </option>
160 160
         <?php
161 161
         }
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
   <td align="center"><b><?php echo get_lang('CourseCategoryInPlatform') ?> :</b>
172 172
   </td>
173 173
   <td></td>
174
-  <td align="center"><b><?php printf(get_lang('CourseCategoryListInX'),$url_selected); ?></b></td>
174
+  <td align="center"><b><?php printf(get_lang('CourseCategoryListInX'), $url_selected); ?></b></td>
175 175
 </tr>
176 176
 
177 177
 <tr>
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
   <td align="center">
209 209
   <select id="destination_users" name="course_list[]" multiple="multiple" size="15" style="width:380px;">
210 210
 <?php
211
-foreach($userGroupList as $item) {
211
+foreach ($userGroupList as $item) {
212 212
 ?>
213 213
 	<option value="<?php echo $item['id']; ?>">
214 214
         <?php echo $item['name']; ?>
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
 	<td colspan="3" align="center">
224 224
 		<br />
225 225
 		<?php
226
-		if(isset($_GET['add']))
226
+		if (isset($_GET['add']))
227 227
 			echo '<button class="save" onclick="valide()" >'.get_lang('Add').'</button>';
228 228
 		else
229 229
 			echo '<button class="save" onclick="valide()" >'.get_lang('Edit').'</button>';
Please login to merge, or discard this patch.
main/admin/extra_field_options.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 $htmlHeadXtra[] = api_get_jqgrid_js();
19 19
 
20 20
 // setting breadcrumbs
21
-$interbreadcrumb[]=array('url' => 'index.php','name' => get_lang('PlatformAdmin'));
21
+$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
22 22
 
23 23
 $tool_name = null;
24 24
 
@@ -39,23 +39,23 @@  discard block
 block discarded – undo
39 39
 $token = Security::get_token();
40 40
 
41 41
 if ($action == 'add') {
42
-    $interbreadcrumb[]=array('url' => 'extra_fields.php?type='.$extra_field->type,'name' => $extra_field->pageName);
43
-    $interbreadcrumb[]=array('url' => 'extra_fields.php?type='.$extra_field->type.'&action=edit&id='.$extra_field_info['id'],'name' => $extra_field_info['display_text']);
44
-    $interbreadcrumb[]=array('url' => 'extra_field_options.php?type='.$extra_field->type.'&field_id='.$extra_field_info['id'], 'name' => get_lang('EditExtraFieldOptions'));
45
-    $interbreadcrumb[]=array('url' => '#','name' => get_lang('Add'));
42
+    $interbreadcrumb[] = array('url' => 'extra_fields.php?type='.$extra_field->type, 'name' => $extra_field->pageName);
43
+    $interbreadcrumb[] = array('url' => 'extra_fields.php?type='.$extra_field->type.'&action=edit&id='.$extra_field_info['id'], 'name' => $extra_field_info['display_text']);
44
+    $interbreadcrumb[] = array('url' => 'extra_field_options.php?type='.$extra_field->type.'&field_id='.$extra_field_info['id'], 'name' => get_lang('EditExtraFieldOptions'));
45
+    $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Add'));
46 46
 } elseif ($action == 'edit') {
47
-    $interbreadcrumb[]=array('url' => 'extra_fields.php?type='.$extra_field->type,'name' => $extra_field->pageName);
48
-    $interbreadcrumb[]=array('url' => 'extra_fields.php?type='.$extra_field->type.'&action=edit&id='.$extra_field_info['id'],'name' => $extra_field_info['display_text']);
49
-    $interbreadcrumb[]=array('url' => 'extra_field_options.php?type='.$extra_field->type.'&field_id='.$extra_field_info['id'], 'name' => get_lang('EditExtraFieldOptions'));
47
+    $interbreadcrumb[] = array('url' => 'extra_fields.php?type='.$extra_field->type, 'name' => $extra_field->pageName);
48
+    $interbreadcrumb[] = array('url' => 'extra_fields.php?type='.$extra_field->type.'&action=edit&id='.$extra_field_info['id'], 'name' => $extra_field_info['display_text']);
49
+    $interbreadcrumb[] = array('url' => 'extra_field_options.php?type='.$extra_field->type.'&field_id='.$extra_field_info['id'], 'name' => get_lang('EditExtraFieldOptions'));
50 50
 
51
-    $interbreadcrumb[]=array('url' => '#','name' => get_lang('Edit'));
51
+    $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Edit'));
52 52
 } else {
53
-    $interbreadcrumb[]=array('url' => 'extra_fields.php?type='.$extra_field->type,'name' => $extra_field->pageName);
54
-    $interbreadcrumb[]=array(
53
+    $interbreadcrumb[] = array('url' => 'extra_fields.php?type='.$extra_field->type, 'name' => $extra_field->pageName);
54
+    $interbreadcrumb[] = array(
55 55
         'url' =>  'extra_fields.php?type='.$extra_field->type.'&action=edit&id='.$extra_field_info['id'],
56 56
         'name' => $extra_field_info['display_text']
57 57
     );
58
-    $interbreadcrumb[]=array('url' => '#','name' => get_lang('EditExtraFieldOptions'));
58
+    $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('EditExtraFieldOptions'));
59 59
 }
60 60
 
61 61
 //jqgrid will use this URL to do the selects
@@ -108,12 +108,12 @@  discard block
 block discarded – undo
108 108
 
109 109
 //With this function we can add actions to the jgrid (edit, delete, etc)
110 110
 $action_links = 'function action_formatter(cellvalue, options, rowObject) {
111
-    return \'<a href="?action=edit&'.$params.'&id=\'+options.rowId+\'">'.Display::return_icon('edit.png',get_lang('Edit'),'',ICON_SIZE_SMALL).'</a>'.
112
-    '&nbsp;<a onclick="javascript:if(!confirm('."\'".addslashes(get_lang("ConfirmYourChoice"))."\'".')) return false;"  href="?sec_token='.$token.'&action=delete&'.$params.'&id=\'+options.rowId+\'">'.Display::return_icon('delete.png',get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>'.
111
+    return \'<a href="?action=edit&'.$params.'&id=\'+options.rowId+\'">'.Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL).'</a>'.
112
+    '&nbsp;<a onclick="javascript:if(!confirm('."\'".addslashes(get_lang("ConfirmYourChoice"))."\'".')) return false;"  href="?sec_token='.$token.'&action=delete&'.$params.'&id=\'+options.rowId+\'">'.Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>'.
113 113
     '\';
114 114
  }';
115 115
 
116
-$htmlHeadXtra[]='<script>
116
+$htmlHeadXtra[] = '<script>
117 117
 $(function() {
118 118
     // grid definition see the $obj->display() function
119 119
     '.Display::grid_js(
Please login to merge, or discard this patch.
main/admin/add_users_to_usergroup.php 2 patches
Braces   +8 added lines, -2 removed lines patch added patch discarded remove patch
@@ -345,7 +345,10 @@  discard block
 block discarded – undo
345 345
 $searchForm->display();
346 346
 echo '</div>';
347 347
 ?>
348
-<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?id=<?php echo $id; if(!empty($_GET['add'])) echo '&add=true' ; ?>" style="margin:0px;">
348
+<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?id=<?php echo $id; if(!empty($_GET['add'])) {
349
+    echo '&add=true' ;
350
+}
351
+?>" style="margin:0px;">
349 352
 <?php
350 353
 echo '<legend>'.$tool_name.': '.$data['name'].'</legend>';
351 354
 
@@ -420,7 +423,10 @@  discard block
 block discarded – undo
420 423
     ?>
421 424
     <br />
422 425
       <label class="control-label">
423
-          <input type="checkbox" <?php if ($user_with_any_group) echo 'checked="checked"';?> onchange="checked_in_no_group(this.checked);" name="user_with_any_group" id="user_with_any_group_id">
426
+          <input type="checkbox" <?php if ($user_with_any_group) {
427
+    echo 'checked="checked"';
428
+}
429
+?> onchange="checked_in_no_group(this.checked);" name="user_with_any_group" id="user_with_any_group_id">
424 430
           <?php echo get_lang('UsersRegisteredInAnyGroup'); ?>
425 431
       </label>
426 432
     </div>
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -18,8 +18,8 @@  discard block
 block discarded – undo
18 18
 api_protect_admin_script(true);
19 19
 
20 20
 // setting breadcrumbs
21
-$interbreadcrumb[]= array('url' => 'index.php','name' => get_lang('PlatformAdmin'));
22
-$interbreadcrumb[]= array('url' => 'usergroups.php','name' => get_lang('Classes'));
21
+$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
22
+$interbreadcrumb[] = array('url' => 'usergroups.php', 'name' => get_lang('Classes'));
23 23
 
24 24
 // Database Table Definitions
25 25
 
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 
91 91
 </script>';
92 92
 
93
-$form_sent  = 0;
93
+$form_sent = 0;
94 94
 
95 95
 $extra_field_list = UserManager::get_extra_fields();
96 96
 $new_field_list = array();
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
         foreach ($users as $user) {
145 145
             $data[] = array($user['username'], $groupInfo['name']);
146 146
         }
147
-        $filename = 'export_user_class_' . api_get_local_time();
147
+        $filename = 'export_user_class_'.api_get_local_time();
148 148
         Export::arrayToCsv($data, $filename);
149 149
         exit;
150 150
     }
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
         foreach ($new_field_list as $new_field) {
158 158
             $varname = 'field_'.$new_field['variable'];
159 159
             if (UserManager::is_extra_field_available($new_field['variable'])) {
160
-                if (isset($_POST[$varname]) && $_POST[$varname]!='0') {
160
+                if (isset($_POST[$varname]) && $_POST[$varname] != '0') {
161 161
                     $use_extra_fields = true;
162 162
                     $extra_field_result[] = UserManager::get_extra_user_data_by_value(
163 163
                         $new_field['variable'],
@@ -171,10 +171,10 @@  discard block
 block discarded – undo
171 171
 
172 172
 if ($use_extra_fields) {
173 173
     $final_result = array();
174
-    if (count($extra_field_result)>1) {
175
-        for ($i=0; $i<count($extra_field_result)-1; $i++) {
176
-            if (is_array($extra_field_result[$i+1])) {
177
-                $final_result = array_intersect($extra_field_result[$i], $extra_field_result[$i+1]);
174
+    if (count($extra_field_result) > 1) {
175
+        for ($i = 0; $i < count($extra_field_result) - 1; $i++) {
176
+            if (is_array($extra_field_result[$i + 1])) {
177
+                $final_result = array_intersect($extra_field_result[$i], $extra_field_result[$i + 1]);
178 178
             }
179 179
         }
180 180
     } else {
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 
194 194
 $searchForm = new FormValidator('search', 'get', api_get_self().'?id='.$id);
195 195
 $searchForm->addHeader(get_lang('AdvancedSearch'));
196
-$renderer =& $searchForm->defaultRenderer();
196
+$renderer = & $searchForm->defaultRenderer();
197 197
 
198 198
 $searchForm->addElement('hidden', 'id', $id);
199 199
 foreach ($filters as $param) {
@@ -341,12 +341,12 @@  discard block
 block discarded – undo
341 341
 $searchForm->display();
342 342
 echo '</div>';
343 343
 ?>
344
-<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?id=<?php echo $id; if(!empty($_GET['add'])) echo '&add=true' ; ?>" style="margin:0px;">
344
+<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?id=<?php echo $id; if (!empty($_GET['add'])) echo '&add=true'; ?>" style="margin:0px;">
345 345
 <?php
346 346
 echo '<legend>'.$tool_name.': '.$data['name'].'</legend>';
347 347
 
348 348
 if (is_array($extra_field_list)) {
349
-    if (is_array($new_field_list) && count($new_field_list)>0) {
349
+    if (is_array($new_field_list) && count($new_field_list) > 0) {
350 350
         echo '<h3>'.get_lang('FilterByUser').'</h3>';
351 351
         foreach ($new_field_list as $new_field) {
352 352
             echo $new_field['name'];
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
             echo '&nbsp;<select name="'.$varname.'">';
355 355
             echo '<option value="0">--'.get_lang('Select').'--</option>';
356 356
             foreach ($new_field['data'] as $option) {
357
-                $checked='';
357
+                $checked = '';
358 358
                 if (isset($_POST[$varname])) {
359 359
                     if ($_POST[$varname] == $option[1]) {
360 360
                         $checked = 'selected="true"';
@@ -380,15 +380,15 @@  discard block
 block discarded – undo
380 380
         <?php if ($data['group_type'] == UserGroup::SOCIAL_CLASS) { ?>
381 381
         <select name="relation" id="relation">
382 382
             <option value=""><?php echo get_lang('SelectARelationType')?></option>
383
-            <option value="<?php echo GROUP_USER_PERMISSION_ADMIN ?>" <?php echo ((isset($relation) && $relation == GROUP_USER_PERMISSION_ADMIN)?'selected=selected':'') ?> >
383
+            <option value="<?php echo GROUP_USER_PERMISSION_ADMIN ?>" <?php echo ((isset($relation) && $relation == GROUP_USER_PERMISSION_ADMIN) ? 'selected=selected' : '') ?> >
384 384
                 <?php echo get_lang('Admin') ?></option>
385
-            <option value="<?php echo GROUP_USER_PERMISSION_READER ?>" <?php echo ((isset($relation) && $relation == GROUP_USER_PERMISSION_READER)?'selected=selected':'') ?> >
385
+            <option value="<?php echo GROUP_USER_PERMISSION_READER ?>" <?php echo ((isset($relation) && $relation == GROUP_USER_PERMISSION_READER) ? 'selected=selected' : '') ?> >
386 386
                 <?php echo get_lang('Reader') ?></option>
387
-            <option value="<?php echo GROUP_USER_PERMISSION_PENDING_INVITATION ?>" <?php echo ((isset($relation) && $relation == GROUP_USER_PERMISSION_PENDING_INVITATION)?'selected=selected':'') ?> >
387
+            <option value="<?php echo GROUP_USER_PERMISSION_PENDING_INVITATION ?>" <?php echo ((isset($relation) && $relation == GROUP_USER_PERMISSION_PENDING_INVITATION) ? 'selected=selected' : '') ?> >
388 388
                 <?php echo get_lang('PendingInvitation') ?></option>
389
-            <option value="<?php echo GROUP_USER_PERMISSION_MODERATOR ?>" <?php echo ((isset($relation) && $relation == GROUP_USER_PERMISSION_MODERATOR)?'selected=selected':'') ?> >
389
+            <option value="<?php echo GROUP_USER_PERMISSION_MODERATOR ?>" <?php echo ((isset($relation) && $relation == GROUP_USER_PERMISSION_MODERATOR) ? 'selected=selected' : '') ?> >
390 390
                 <?php echo get_lang('Moderator') ?></option>
391
-            <option value="<?php echo GROUP_USER_PERMISSION_HRM ?>" <?php echo ((isset($relation) && $relation == GROUP_USER_PERMISSION_HRM)?'selected=selected':'') ?> >
391
+            <option value="<?php echo GROUP_USER_PERMISSION_HRM ?>" <?php echo ((isset($relation) && $relation == GROUP_USER_PERMISSION_HRM) ? 'selected=selected' : '') ?> >
392 392
                 <?php echo get_lang('Drh') ?></option>
393 393
         </select>
394 394
         <?php } ?>
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
     ?>
420 420
     <br />
421 421
       <label class="control-label">
422
-          <input type="checkbox" <?php if ($user_with_any_group) echo 'checked="checked"';?> onchange="checked_in_no_group(this.checked);" name="user_with_any_group" id="user_with_any_group_id">
422
+          <input type="checkbox" <?php if ($user_with_any_group) echo 'checked="checked"'; ?> onchange="checked_in_no_group(this.checked);" name="user_with_any_group" id="user_with_any_group_id">
423 423
           <?php echo get_lang('UsersRegisteredInAnyGroup'); ?>
424 424
       </label>
425 425
     </div>
Please login to merge, or discard this patch.
main/admin/system_status.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
 $this_section = SECTION_PLATFORM_ADMIN;
12 12
 // User permissions
13 13
 api_protect_admin_script();
14
-$interbreadcrumb[] = array ('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
14
+$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
15 15
 Display :: display_header(get_lang('SystemStatus'));
16 16
 $diag = new Diagnoser();
17 17
 $diag->show_html();
Please login to merge, or discard this patch.
main/announcements/download.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -43,7 +43,9 @@
 block discarded – undo
43 43
     //remove last slash if present
44 44
     //$doc_url = ($doc_url{strlen($doc_url)-1}=='/')?substr($doc_url,0,strlen($doc_url)-1):$doc_url;
45 45
     //mod_rewrite can change /some/path/ to /some/path// in some cases, so clean them all off (René)
46
-    while ($doc_url{$dul = strlen($doc_url)-1}=='/') $doc_url = substr($doc_url,0,$dul);
46
+    while ($doc_url{$dul = strlen($doc_url)-1}=='/') {
47
+        $doc_url = substr($doc_url,0,$dul);
48
+    }
47 49
     //create the path
48 50
     $document_explorer = api_get_path(WEB_COURSE_PATH).api_get_course_path(); // home course path
49 51
     //redirect
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 $doc_url = str_replace(' ', '+', $doc_url);
29 29
 $doc_url = str_replace('/..', '', $doc_url); //echo $doc_url;
30 30
 
31
-if (strpos($doc_url,'../') OR strpos($doc_url,'/..')) {
31
+if (strpos($doc_url, '../') OR strpos($doc_url, '/..')) {
32 32
     $doc_url = '';
33 33
 }
34 34
 
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
     //remove last slash if present
44 44
     //$doc_url = ($doc_url{strlen($doc_url)-1}=='/')?substr($doc_url,0,strlen($doc_url)-1):$doc_url;
45 45
     //mod_rewrite can change /some/path/ to /some/path// in some cases, so clean them all off (René)
46
-    while ($doc_url{$dul = strlen($doc_url)-1}=='/') $doc_url = substr($doc_url,0,$dul);
46
+    while ($doc_url{$dul = strlen($doc_url) - 1} == '/') $doc_url = substr($doc_url, 0, $dul);
47 47
     //create the path
48 48
     $document_explorer = api_get_path(WEB_COURSE_PATH).api_get_course_path(); // home course path
49 49
     //redirect
@@ -64,10 +64,10 @@  discard block
 block discarded – undo
64 64
 
65 65
 $result = Database::query($sql);
66 66
 if (Database::num_rows($result) > 0) {
67
-    $row= Database::fetch_array($result);
68
-    $title = str_replace(' ','_', $row['filename']);
67
+    $row = Database::fetch_array($result);
68
+    $title = str_replace(' ', '_', $row['filename']);
69 69
     if (Security::check_abs_path($full_file_name,
70
-        api_get_path(SYS_COURSE_PATH) . api_get_course_path() . '/upload/announcements/')
70
+        api_get_path(SYS_COURSE_PATH).api_get_course_path().'/upload/announcements/')
71 71
     ) {
72 72
         $result = DocumentManager::file_send_for_download($full_file_name, true, $title);
73 73
         if ($result === false) {
Please login to merge, or discard this patch.
main/survey/survey_invite.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 $tool_name = get_lang('SurveyPublication');
65 65
 
66 66
 // Displaying the header
67
-Display::display_header($tool_name,'Survey');
67
+Display::display_header($tool_name, 'Survey');
68 68
 
69 69
 echo '<script>
70 70
 $(function() {
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 );
133 133
 
134 134
 $form->addElement('html', '<div id="check_mail">');
135
-$form->addElement('checkbox', 'send_mail','', get_lang('SendMail'));
135
+$form->addElement('checkbox', 'send_mail', '', get_lang('SendMail'));
136 136
 $form->addElement('html', '</div>');
137 137
 
138 138
 $form->addElement('html', '<div id="mail_text_wrapper">');
@@ -219,8 +219,8 @@  discard block
 block discarded – undo
219 219
 	);
220 220
 
221 221
 	// Saving the invitations for the additional users
222
-	$values['additional_users'] = $values['additional_users'].';'; 	// This is for the case when you enter only one email
223
-	$temp = str_replace(',', ';', $values['additional_users']);		// This is to allow , and ; as email separators
222
+	$values['additional_users'] = $values['additional_users'].';'; // This is for the case when you enter only one email
223
+	$temp = str_replace(',', ';', $values['additional_users']); // This is to allow , and ; as email separators
224 224
 	$additional_users = explode(';', $temp);
225 225
 	for ($i = 0; $i < count($additional_users); $i++) {
226 226
 		$additional_users[$i] = trim($additional_users[$i]);
Please login to merge, or discard this patch.
Indentation   +93 added lines, -93 removed lines patch added patch discarded remove patch
@@ -18,10 +18,10 @@  discard block
 block discarded – undo
18 18
 $this_section = SECTION_COURSES;
19 19
 
20 20
 if (!api_is_allowed_to_edit(false, true)) {
21
-	Display :: display_header(get_lang('ToolSurvey'));
22
-	Display :: display_error_message(get_lang('NotAllowed'), false);
23
-	Display :: display_footer();
24
-	exit;
21
+    Display :: display_header(get_lang('ToolSurvey'));
22
+    Display :: display_error_message(get_lang('NotAllowed'), false);
23
+    Display :: display_footer();
24
+    exit;
25 25
 }
26 26
 
27 27
 // Database table definitions
@@ -37,15 +37,15 @@  discard block
 block discarded – undo
37 37
 $survey_id = Security::remove_XSS($_GET['survey_id']);
38 38
 $survey_data = SurveyManager::get_survey($survey_id);
39 39
 if (empty($survey_data)) {
40
-	Display :: display_header(get_lang('ToolSurvey'));
41
-	Display :: display_error_message(get_lang('InvallidSurvey'), false);
42
-	Display :: display_footer();
43
-	exit;
40
+    Display :: display_header(get_lang('ToolSurvey'));
41
+    Display :: display_error_message(get_lang('InvallidSurvey'), false);
42
+    Display :: display_footer();
43
+    exit;
44 44
 }
45 45
 
46 46
 $urlname = strip_tags(api_substr(api_html_entity_decode($survey_data['title'], ENT_QUOTES), 0, 40));
47 47
 if (api_strlen(strip_tags($survey_data['title'])) > 40) {
48
-	$urlname .= '...';
48
+    $urlname .= '...';
49 49
 }
50 50
 
51 51
 // Breadcrumbs
@@ -80,23 +80,23 @@  discard block
 block discarded – undo
80 80
 		WHERE c_id = $course_id AND code='".Database::escape_string($survey_data['code'])."'";
81 81
 $result = Database::query($sql);
82 82
 if (Database::num_rows($result) > 1) {
83
-	Display::display_warning_message(get_lang('IdenticalSurveycodeWarning'));
83
+    Display::display_warning_message(get_lang('IdenticalSurveycodeWarning'));
84 84
 }
85 85
 
86 86
 // Invited / answered message
87 87
 if ($survey_data['invited'] > 0 && !isset($_POST['submit'])) {
88
-	$message  = '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey_invitation.php?view=answered&survey_id='.$survey_data['survey_id'].'">'.$survey_data['answered'].'</a> ';
89
-	$message .= get_lang('HaveAnswered').' ';
90
-	$message .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey_invitation.php?view=invited&survey_id='.$survey_data['survey_id'].'">'.$survey_data['invited'].'</a> ';
91
-	$message .= get_lang('WereInvited');
92
-	Display::display_normal_message($message, false);
88
+    $message  = '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey_invitation.php?view=answered&survey_id='.$survey_data['survey_id'].'">'.$survey_data['answered'].'</a> ';
89
+    $message .= get_lang('HaveAnswered').' ';
90
+    $message .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey_invitation.php?view=invited&survey_id='.$survey_data['survey_id'].'">'.$survey_data['invited'].'</a> ';
91
+    $message .= get_lang('WereInvited');
92
+    Display::display_normal_message($message, false);
93 93
 }
94 94
 
95 95
 // Building the form for publishing the survey
96 96
 $form = new FormValidator(
97
-	'publish_form',
98
-	'post',
99
-	api_get_self().'?survey_id='.$survey_id.'&'.api_get_cidreq()
97
+    'publish_form',
98
+    'post',
99
+    api_get_self().'?survey_id='.$survey_id.'&'.api_get_cidreq()
100 100
 );
101 101
 $form->addElement('header', '', $tool_name);
102 102
 
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 );
110 110
 $possible_users = array();
111 111
 foreach ($complete_user_list as & $user) {
112
-	$possible_users[$user['user_id']] = api_get_person_name($user['firstname'], $user['lastname']);
112
+    $possible_users[$user['user_id']] = api_get_person_name($user['firstname'], $user['lastname']);
113 113
 }
114 114
 
115 115
 
@@ -125,10 +125,10 @@  discard block
 block discarded – undo
125 125
 
126 126
 // Additional users
127 127
 $form->addElement(
128
-	'textarea',
129
-	'additional_users',
130
-	array(get_lang('AdditonalUsers'), get_lang('AdditonalUsersComment')),
131
-	array('rows' => 5)
128
+    'textarea',
129
+    'additional_users',
130
+    array(get_lang('AdditonalUsers'), get_lang('AdditonalUsersComment')),
131
+    array('rows' => 5)
132 132
 );
133 133
 
134 134
 $form->addElement('html', '<div id="check_mail">');
@@ -141,15 +141,15 @@  discard block
 block discarded – undo
141 141
 $form->addText('mail_title', get_lang('MailTitle'), false);
142 142
 // The text of the mail
143 143
 $form->addHtmlEditor(
144
-	'mail_text',
145
-	array(get_lang('MailText'), get_lang('UseLinkSyntax')),
146
-	false,
147
-	array('ToolbarSet' => 'Survey', 'Height' => '150')
144
+    'mail_text',
145
+    array(get_lang('MailText'), get_lang('UseLinkSyntax')),
146
+    false,
147
+    array('ToolbarSet' => 'Survey', 'Height' => '150')
148 148
 );
149 149
 $form->addElement('html', '</div>');
150 150
 // You cab send a reminder to unanswered people if the survey is not anonymous
151 151
 if ($survey_data['anonymous'] != 1) {
152
-	$form->addElement('checkbox', 'remindUnAnswered', '', get_lang('RemindUnanswered'));
152
+    $form->addElement('checkbox', 'remindUnAnswered', '', get_lang('RemindUnanswered'));
153 153
 }
154 154
 // Allow resending to all selected users
155 155
 $form->addElement('checkbox', 'resend_to_all', '', get_lang('ReminderResendToAllUsers'));
@@ -163,11 +163,11 @@  discard block
 block discarded – undo
163 163
 }*/
164 164
 $portal_url = api_get_path(WEB_PATH);
165 165
 if (api_is_multiple_url_enabled()) {
166
-	$access_url_id = api_get_current_access_url_id();
167
-	if ($access_url_id != -1) {
168
-		$url = api_get_access_url($access_url_id);
169
-		$portal_url = $url['url'];
170
-	}
166
+    $access_url_id = api_get_current_access_url_id();
167
+    if ($access_url_id != -1) {
168
+        $url = api_get_access_url($access_url_id);
169
+        $portal_url = $url['url'];
170
+    }
171 171
 }
172 172
 
173 173
 // Show the URL that can be used by users to fill a survey without invitation
@@ -177,56 +177,56 @@  discard block
 block discarded – undo
177 177
 $form->addElement('label', null, $auto_survey_link);
178 178
 
179 179
 if ($form->validate()) {
180
-   	$values = $form->exportValues();
180
+        $values = $form->exportValues();
181 181
     if (isset($values['send_mail']) && $values['send_mail'] == 1) {
182 182
         if (empty($values['mail_title']) || empty($values['mail_text'])) {
183 183
             Display :: display_error_message(get_lang('FormHasErrorsPleaseComplete'));
184 184
             // Getting the invited users
185
-        	$defaults = SurveyUtil::get_invited_users($survey_data['code']);
186
-
187
-        	// Getting the survey mail text
188
-        	if (!empty($survey_data['reminder_mail'])) {
189
-        		$defaults['mail_text'] = $survey_data['reminder_mail'];
190
-        	} else {
191
-        		$defaults['mail_text'] = $survey_data['invite_mail'];
192
-        	}
193
-        	$defaults['mail_title'] = $survey_data['mail_subject'];
194
-        	$defaults['send_mail'] = 1;
195
-        	$form->setDefaults($defaults);
185
+            $defaults = SurveyUtil::get_invited_users($survey_data['code']);
186
+
187
+            // Getting the survey mail text
188
+            if (!empty($survey_data['reminder_mail'])) {
189
+                $defaults['mail_text'] = $survey_data['reminder_mail'];
190
+            } else {
191
+                $defaults['mail_text'] = $survey_data['invite_mail'];
192
+            }
193
+            $defaults['mail_title'] = $survey_data['mail_subject'];
194
+            $defaults['send_mail'] = 1;
195
+            $form->setDefaults($defaults);
196 196
             $form->display();
197 197
             return;
198 198
         }
199 199
     }
200 200
     // Save the invitation mail
201
-	SurveyUtil::save_invite_mail(
202
-		$values['mail_text'],
203
-		$values['mail_title'],
204
-		!empty($survey_data['invite_mail'])
205
-	);
201
+    SurveyUtil::save_invite_mail(
202
+        $values['mail_text'],
203
+        $values['mail_title'],
204
+        !empty($survey_data['invite_mail'])
205
+    );
206 206
 
207 207
     $resendAll = isset($values['resend_to_all']) ? $values['resend_to_all'] : '';
208 208
     $sendMail = isset($values['send_mail']) ? $values['send_mail'] : '';
209 209
     $remindUnAnswered = isset($values['remindUnAnswered']) ? $values['remindUnAnswered'] : '';
210 210
 
211
-	// Saving the invitations for the course users
212
-	$count_course_users = SurveyUtil::saveInvitations(
213
-		$values['users'],
214
-		$values['mail_title'],
215
-		$values['mail_text'],
211
+    // Saving the invitations for the course users
212
+    $count_course_users = SurveyUtil::saveInvitations(
213
+        $values['users'],
214
+        $values['mail_title'],
215
+        $values['mail_text'],
216 216
         $resendAll,
217 217
         $sendMail,
218 218
         $remindUnAnswered
219
-	);
219
+    );
220 220
 
221
-	// Saving the invitations for the additional users
222
-	$values['additional_users'] = $values['additional_users'].';'; 	// This is for the case when you enter only one email
223
-	$temp = str_replace(',', ';', $values['additional_users']);		// This is to allow , and ; as email separators
224
-	$additional_users = explode(';', $temp);
225
-	for ($i = 0; $i < count($additional_users); $i++) {
226
-		$additional_users[$i] = trim($additional_users[$i]);
227
-	}
221
+    // Saving the invitations for the additional users
222
+    $values['additional_users'] = $values['additional_users'].';'; 	// This is for the case when you enter only one email
223
+    $temp = str_replace(',', ';', $values['additional_users']);		// This is to allow , and ; as email separators
224
+    $additional_users = explode(';', $temp);
225
+    for ($i = 0; $i < count($additional_users); $i++) {
226
+        $additional_users[$i] = trim($additional_users[$i]);
227
+    }
228 228
 
229
-	$counter_additional_users = SurveyUtil::saveInvitations(
229
+    $counter_additional_users = SurveyUtil::saveInvitations(
230 230
         $additional_users,
231 231
         $values['mail_title'],
232 232
         $values['mail_text'],
@@ -235,43 +235,43 @@  discard block
 block discarded – undo
235 235
         $remindUnAnswered
236 236
     );
237 237
 
238
-	// Updating the invited field in the survey table
239
-	SurveyUtil::update_count_invited($survey_data['code']);
240
-	$total_count = $count_course_users + $counter_additional_users;
238
+    // Updating the invited field in the survey table
239
+    SurveyUtil::update_count_invited($survey_data['code']);
240
+    $total_count = $count_course_users + $counter_additional_users;
241 241
     $table_survey = Database :: get_course_table(TABLE_SURVEY);
242
-	// Counting the number of people that are invited
243
-	$sql = "SELECT * FROM $table_survey
242
+    // Counting the number of people that are invited
243
+    $sql = "SELECT * FROM $table_survey
244 244
 	        WHERE
245 245
 	        	c_id = $course_id AND
246 246
 	        	code = '".Database::escape_string($survey_data['code'])."'
247 247
 			";
248
-	$result = Database::query($sql);
249
-	$row = Database::fetch_array($result);
250
-	$total_invited = $row['invited'];
248
+    $result = Database::query($sql);
249
+    $row = Database::fetch_array($result);
250
+    $total_invited = $row['invited'];
251 251
     if ($total_invited > 0) {
252
-    	$message  = '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey_invitation.php?view=answered&survey_id='.$survey_data['survey_id'].'">'.
253
-			$survey_data['answered'].'</a> ';
254
-    	$message .= get_lang('HaveAnswered').' ';
255
-    	$message .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey_invitation.php?view=invited&survey_id='.$survey_data['survey_id'].'">'.
256
-			$total_invited.'</a> ';
257
-    	$message .= get_lang('WereInvited');
258
-    	Display::display_normal_message($message, false);
259
-    	Display::display_confirmation_message($total_count.' '.get_lang('InvitationsSend'));
252
+        $message  = '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey_invitation.php?view=answered&survey_id='.$survey_data['survey_id'].'">'.
253
+            $survey_data['answered'].'</a> ';
254
+        $message .= get_lang('HaveAnswered').' ';
255
+        $message .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey_invitation.php?view=invited&survey_id='.$survey_data['survey_id'].'">'.
256
+            $total_invited.'</a> ';
257
+        $message .= get_lang('WereInvited');
258
+        Display::display_normal_message($message, false);
259
+        Display::display_confirmation_message($total_count.' '.get_lang('InvitationsSend'));
260 260
     }
261 261
 } else {
262
-	// Getting the invited users
263
-	$defaults = SurveyUtil::get_invited_users($survey_data['code']);
264
-
265
-	// Getting the survey mail text
266
-	if (!empty($survey_data['reminder_mail'])) {
267
-		$defaults['mail_text'] = $survey_data['reminder_mail'];
268
-	} else {
269
-		$defaults['mail_text'] = $survey_data['invite_mail'];
270
-	}
271
-	$defaults['mail_title'] = $survey_data['mail_subject'];
272
-	$defaults['send_mail'] = 1;
273
-
274
-	$form->setDefaults($defaults);
262
+    // Getting the invited users
263
+    $defaults = SurveyUtil::get_invited_users($survey_data['code']);
264
+
265
+    // Getting the survey mail text
266
+    if (!empty($survey_data['reminder_mail'])) {
267
+        $defaults['mail_text'] = $survey_data['reminder_mail'];
268
+    } else {
269
+        $defaults['mail_text'] = $survey_data['invite_mail'];
270
+    }
271
+    $defaults['mail_title'] = $survey_data['mail_subject'];
272
+    $defaults['send_mail'] = 1;
273
+
274
+    $form->setDefaults($defaults);
275 275
     $form->display();
276 276
 }
277 277
 Display :: display_footer();
Please login to merge, or discard this patch.
main/survey/fillsurvey.php 3 patches
Indentation   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,8 +6,7 @@
 block discarded – undo
6 6
 * @author unknown, the initial survey that did not make it in 1.8 because of bad code
7 7
 * @author Patrick Cool <[email protected]>, Ghent University: cleanup, refactoring and rewriting large parts of the code
8 8
 * @author Julio Montoya Armas <[email protected]>, Chamilo: Personality Test modification and rewriting large parts of the code as well
9
-
10
-* @todo check if the user already filled the survey and if this is the case then the answers have to be updated and not stored again.
9
+ * @todo check if the user already filled the survey and if this is the case then the answers have to be updated and not stored again.
11 10
 * @todo performance could be improved if not the survey_id was stored with the invitation but the survey_code
12 11
  */
13 12
 // Unsetting the course id (because it is in the URL)
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
         $now = api_get_utc_datetime();
113 113
         if (Database :: num_rows($result) == 0) {
114 114
             $params = [
115
-                'c_id' => $course_id ,
115
+                'c_id' => $course_id,
116 116
                 'survey_code' => $surveyCode,
117 117
                 'user' => $userid,
118 118
                 'invitation_code' => $autoInvitationcode,
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
     $jquery_ready_content = $returnParams['jquery_ready_content'];
472 472
 
473 473
 // the $jquery_ready_content variable collects all functions that will be load in the $(document).ready javascript function
474
-    $htmlHeadXtra[] ='<script>
474
+    $htmlHeadXtra[] = '<script>
475 475
     $(document).ready(function(){
476 476
         '.$jquery_ready_content.'
477 477
     });
@@ -904,16 +904,16 @@  discard block
 block discarded – undo
904 904
                             $group2 = $groups[0];
905 905
                             $secondary .= " OR ( survey_group_sec1 = '$group1' AND  survey_group_sec2 = '$group2') ";
906 906
                             $secondary .= " OR ( survey_group_sec1 = '$group2' AND survey_group_sec2 = '$group1' ) ";
907
-                            $combi.= $group1.' - '.$group2." or ".$group2.' - '.$group1.'<br />';
907
+                            $combi .= $group1.' - '.$group2." or ".$group2.' - '.$group1.'<br />';
908 908
                         } else {
909 909
                             if ($i != 0) {
910 910
                                 $secondary .= " OR ( survey_group_sec1 = '$group1' AND  survey_group_sec2 = '$group2') ";
911 911
                                 $secondary .= " OR ( survey_group_sec1 = '$group2' AND survey_group_sec2 = '$group1' ) ";
912
-                                $combi.= $group1.' - '.$group2." or ".$group2.' - '.$group1.'<br />';
912
+                                $combi .= $group1.' - '.$group2." or ".$group2.' - '.$group1.'<br />';
913 913
                             } else {
914 914
                                 $secondary .= " ( survey_group_sec1 = '$group1' AND  survey_group_sec2 = '$group2') ";
915 915
                                 $secondary .= " OR ( survey_group_sec1 = '$group2' AND survey_group_sec2 = '$group1' ) ";
916
-                                $combi.= $group1.' - '.$group2." or ".$group2.' - '.$group1.'<br />';
916
+                                $combi .= $group1.' - '.$group2." or ".$group2.' - '.$group1.'<br />';
917 917
                             }
918 918
                         }
919 919
                     }
@@ -1132,7 +1132,7 @@  discard block
 block discarded – undo
1132 1132
                         $questions[$row['sort']]['survey_group_sec1'] = $row['survey_group_sec1'];
1133 1133
                         $questions[$row['sort']]['survey_group_sec2'] = $row['survey_group_sec2'];
1134 1134
                         $questions[$row['sort']]['survey_group_pri'] = $row['survey_group_pri'];
1135
-                    }  else {
1135
+                    } else {
1136 1136
                         // If the type is a page break we are finished loading the questions for this page
1137 1137
                         break;
1138 1138
                     }
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1132,7 +1132,7 @@
 block discarded – undo
1132 1132
                         $questions[$row['sort']]['survey_group_sec1'] = $row['survey_group_sec1'];
1133 1133
                         $questions[$row['sort']]['survey_group_sec2'] = $row['survey_group_sec2'];
1134 1134
                         $questions[$row['sort']]['survey_group_pri'] = $row['survey_group_pri'];
1135
-                    }  else {
1135
+                    } else {
1136 1136
                         // If the type is a page break we are finished loading the questions for this page
1137 1137
                         break;
1138 1138
                     }
Please login to merge, or discard this patch.
main/survey/ch_yesno.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@
 block discarded – undo
43 43
                 $class = 'radio-inline';
44 44
             }
45 45
 
46
-            $name = 'question' . $questionData['question_id'];
46
+            $name = 'question'.$questionData['question_id'];
47 47
 
48 48
             $form->addRadio(
49 49
                 $name,
Please login to merge, or discard this patch.