Completed
Push — 1.11.x ( ca7787...41c0f2 )
by José
31:51
created
main/admin/access_url_edit.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -36,22 +36,22 @@  discard block
 block discarded – undo
36 36
             if (substr($url, strlen($url) - 1, strlen($url)) == '/') {
37 37
                 UrlManager::update($url_id, $url, $description, $active);
38 38
             } else {
39
-                UrlManager::update($url_id, $url . '/', $description, $active);
39
+                UrlManager::update($url_id, $url.'/', $description, $active);
40 40
             }
41 41
             // URL Images
42
-            $url_images_dir = api_get_path(SYS_PATH) . 'custompages/url-images/';
42
+            $url_images_dir = api_get_path(SYS_PATH).'custompages/url-images/';
43 43
             $image_fields = array("url_image_1", "url_image_2", "url_image_3");
44 44
             foreach ($image_fields as $image_field) {
45 45
                 if ($_FILES[$image_field]['error'] == 0) {
46 46
                     // Hardcoded: only PNG files allowed
47 47
                     $fileFields = explode('.', $_FILES[$image_field]['name']);
48 48
                     if (end($fileFields) == 'png') {
49
-                        if (file_exists($url_images_dir . $url_id . '_' . $image_field . '.png')) {
49
+                        if (file_exists($url_images_dir.$url_id.'_'.$image_field.'.png')) {
50 50
                             // if the file exists, we have to remove it before move_uploaded_file
51
-                            unlink($url_images_dir . $url_id . '_' . $image_field . '.png');
51
+                            unlink($url_images_dir.$url_id.'_'.$image_field.'.png');
52 52
                         }
53 53
                         move_uploaded_file(
54
-                            $_FILES[$image_field]['tmp_name'], $url_images_dir . $url_id . '_' . $image_field . '.png'
54
+                            $_FILES[$image_field]['tmp_name'], $url_images_dir.$url_id.'_'.$image_field.'.png'
55 55
                         );
56 56
                     }
57 57
                     // else fail silently
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
                     UrlManager::add($url, $description, $active);
69 69
                 } else {
70 70
                     //create
71
-                    UrlManager::add($url . '/', $description, $active);
71
+                    UrlManager::add($url.'/', $description, $active);
72 72
                 }
73 73
                 $message = get_lang('URLAdded');
74 74
                 $url_to_go = 'access_urls.php';
@@ -79,14 +79,14 @@  discard block
 block discarded – undo
79 79
             // URL Images
80 80
             $url .= (substr($url, strlen($url) - 1, strlen($url)) == '/') ? '' : '/';
81 81
             $url_id = UrlManager::get_url_id($url);
82
-            $url_images_dir = api_get_path(SYS_PATH) . 'custompages/url-images/';
82
+            $url_images_dir = api_get_path(SYS_PATH).'custompages/url-images/';
83 83
             $image_fields = array("url_image_1", "url_image_2", "url_image_3");
84 84
             foreach ($image_fields as $image_field) {
85 85
                 if ($_FILES[$image_field]['error'] == 0) {
86 86
                     // Hardcoded: only PNG files allowed
87 87
                     $fileFields = explode('.', $_FILES[$image_field]['name']);
88 88
                     if (end($fileFields) == 'png') {
89
-                        move_uploaded_file($_FILES[$image_field]['tmp_name'], $url_images_dir . $url_id . '_' . $image_field . '.png');
89
+                        move_uploaded_file($_FILES[$image_field]['tmp_name'], $url_images_dir.$url_id.'_'.$image_field.'.png');
90 90
                     }
91 91
                     // else fail silently
92 92
                 }
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
         Security::clear_token();
97 97
         $tok = Security::get_token();
98 98
         Display::addFlash(Display::return_message($message));
99
-        header('Location: ' . $url_to_go . '?sec_token=' . $tok);
99
+        header('Location: '.$url_to_go.'?sec_token='.$tok);
100 100
         exit();
101 101
     }
102 102
 } else {
Please login to merge, or discard this patch.
main/admin/access_url_edit_users_to_url.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 function send() {
60 60
 	if (document.formulaire.access_url_id.value!=0) {
61 61
 		document.formulaire.form_sent.value=0;
62
-		document.formulaire.add_type.value=\'' . $add_type . '\';
62
+		document.formulaire.add_type.value=\'' . $add_type.'\';
63 63
 		document.formulaire.submit();
64 64
 	}
65 65
 }
@@ -95,17 +95,17 @@  discard block
 block discarded – undo
95 95
             $result = UrlManager::update_urls_rel_user($UserList, $access_url_id);
96 96
             $url_info = UrlManager::get_url_data_from_id($access_url_id);
97 97
             if (!empty($result)) {
98
-                $message .= 'URL: ' . $url_info['url'] . '<br />';
98
+                $message .= 'URL: '.$url_info['url'].'<br />';
99 99
             }
100 100
 
101 101
             if (!empty($result['users_added'])) {
102
-                $message .= '<h4>' . get_lang('UsersAdded') . ':</h4>';
102
+                $message .= '<h4>'.get_lang('UsersAdded').':</h4>';
103 103
                 $i = 1;
104 104
                 $user_added_list = array();
105 105
                 foreach ($result['users_added'] as $user) {
106 106
                     $user_info = api_get_user_info($user);
107 107
                     if (!empty($user_info)) {
108
-                        $user_added_list[] = $i . '. ' . api_get_person_name($user_info['firstname'], $user_info['lastname'], null, null, null, null, $user_info['username']);
108
+                        $user_added_list[] = $i.'. '.api_get_person_name($user_info['firstname'], $user_info['lastname'], null, null, null, null, $user_info['username']);
109 109
                         $i++;
110 110
                     }
111 111
                 }
@@ -115,13 +115,13 @@  discard block
 block discarded – undo
115 115
             }
116 116
 
117 117
             if (!empty($result['users_deleted'])) {
118
-                $message .= '<br /><h4>' . get_lang('UsersDeleted') . ': </h4>';
118
+                $message .= '<br /><h4>'.get_lang('UsersDeleted').': </h4>';
119 119
                 $user_deleted_list = array();
120 120
                 $i = 1;
121 121
                 foreach ($result['users_deleted'] as $user) {
122 122
                     $user_info = api_get_user_info($user);
123 123
                     if (!empty($user_info)) {
124
-                        $user_deleted_list [] = $i . '. ' . api_get_person_name($user_info['firstname'], $user_info['lastname']);
124
+                        $user_deleted_list [] = $i.'. '.api_get_person_name($user_info['firstname'], $user_info['lastname']);
125 125
                         $i++;
126 126
                     }
127 127
                 }
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 echo '<div class="actions">';
143 143
 echo Display::url(
144 144
     Display::return_icon('view_more_stats.gif', get_lang('AddUserToURL'), ''),
145
-    api_get_path(WEB_CODE_PATH) . 'admin/access_url_add_users_to_url.php'
145
+    api_get_path(WEB_CODE_PATH).'admin/access_url_add_users_to_url.php'
146 146
 );
147 147
 echo '</div>';
148 148
 
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
     }
168 168
 
169 169
     $sql = "SELECT u.user_id, lastname, firstname, username
170
-	  	  	FROM $tbl_user u WHERE status <> " . ANONYMOUS . " " .
170
+	  	  	FROM $tbl_user u WHERE status <> ".ANONYMOUS." ".
171 171
             $order_clause;
172 172
     $result = Database::query($sql);
173 173
     $Users = Database::store_result($result);
@@ -180,11 +180,11 @@  discard block
 block discarded – undo
180 180
 }
181 181
 
182 182
 if ($add_type == 'multiple') {
183
-    $link_add_type_unique = '<a href="' . api_get_self() . '?add_type=unique&access_url_id=' . $access_url_id . '">' . get_lang('SessionAddTypeUnique') . '</a>';
183
+    $link_add_type_unique = '<a href="'.api_get_self().'?add_type=unique&access_url_id='.$access_url_id.'">'.get_lang('SessionAddTypeUnique').'</a>';
184 184
     $link_add_type_multiple = get_lang('SessionAddTypeMultiple');
185 185
 } else {
186 186
     $link_add_type_unique = get_lang('SessionAddTypeUnique');
187
-    $link_add_type_multiple = '<a href="' . api_get_self() . '?add_type=multiple&access_url_id=' . $access_url_id . '">' . get_lang('SessionAddTypeMultiple') . '</a>';
187
+    $link_add_type_multiple = '<a href="'.api_get_self().'?add_type=multiple&access_url_id='.$access_url_id.'">'.get_lang('SessionAddTypeMultiple').'</a>';
188 188
 }
189 189
 $url_list = UrlManager::get_url_data();
190 190
 ?>
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 <form name="formulaire" method="post" action="<?php echo api_get_self(); ?>" style="margin:0px;" <?php if ($ajax_search) {
197 197
     echo ' onsubmit="valide();"';
198 198
 } ?> >
199
-    <?php echo get_lang('SelectUrl') . ' : '; ?>
199
+    <?php echo get_lang('SelectUrl').' : '; ?>
200 200
 <select name="access_url_id" onchange="javascript:send();">
201 201
 <option value="0"> <?php echo get_lang('SelectUrl') ?></option>
202 202
         <?php
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
     <td>
233 233
     <h3>
234 234
     <?php
235
-        $total_users = count($nosessionUsersList) +  count($sessionUsersList);
235
+        $total_users = count($nosessionUsersList) + count($sessionUsersList);
236 236
         echo get_lang('TotalAvailableUsers').' '.$total_users;
237 237
     ?>
238 238
     </h3>
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
   <td align="center"><b><?php echo get_lang('UserListInPlatform') ?> : <?php echo count($nosessionUsersList); ?></b>
243 243
   </td>
244 244
   <td></td>
245
-  <td align="center"><b><?php echo get_lang('UserListIn') . ' ' . $url_selected; ?> : <?php echo count($sessionUsersList); ?></b></td>
245
+  <td align="center"><b><?php echo get_lang('UserListIn').' '.$url_selected; ?> : <?php echo count($sessionUsersList); ?></b></td>
246 246
 </tr>
247 247
 <tr>
248 248
   <td align="center">
@@ -302,9 +302,9 @@  discard block
 block discarded – undo
302 302
 		<br />
303 303
         <?php
304 304
         if (isset($_GET['add'])) {
305
-            echo '<button class="save" type="button" onclick="valide()" >' . get_lang('AddUsersToURL') . '</button>';
305
+            echo '<button class="save" type="button" onclick="valide()" >'.get_lang('AddUsersToURL').'</button>';
306 306
         } else {
307
-            echo '<button class="save" type="button" onclick="valide()" >' . get_lang('EditUsersToURL') . '</button>';
307
+            echo '<button class="save" type="button" onclick="valide()" >'.get_lang('EditUsersToURL').'</button>';
308 308
         }
309 309
         ?>
310 310
 	</td>
Please login to merge, or discard this patch.
main/admin/course_add.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
         WHERE status=1".$order_clause;
24 24
 // Filtering teachers when creating a course.
25 25
 if (api_is_multiple_url_enabled()) {
26
-    $access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
26
+    $access_url_rel_user_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
27 27
     $sql = "SELECT u.user_id,lastname,firstname
28 28
             FROM $table_user as u
29 29
             INNER JOIN $access_url_rel_user_table url_rel_user
@@ -92,12 +92,12 @@  discard block
 block discarded – undo
92 92
 );
93 93
 
94 94
 // Course department
95
-$form->addText('department_name', get_lang('CourseDepartment'), false, array ('size' => '60'));
95
+$form->addText('department_name', get_lang('CourseDepartment'), false, array('size' => '60'));
96 96
 $form->applyFilter('department_name', 'html_filter');
97 97
 $form->applyFilter('department_name', 'trim');
98 98
 
99 99
 // Department URL
100
-$form->addText('department_url', get_lang('CourseDepartmentURL'), false, array ('size' => '60'));
100
+$form->addText('department_url', get_lang('CourseDepartmentURL'), false, array('size' => '60'));
101 101
 $form->applyFilter('department_url', 'html_filter');
102 102
 
103 103
 // Course language.
@@ -125,32 +125,32 @@  discard block
 block discarded – undo
125 125
             get_lang('PickACourseAsATemplateForThisNewCourse'),
126 126
         ],
127 127
         null,
128
-        ['url' => api_get_path(WEB_AJAX_PATH) . 'course.ajax.php?a=search_course']
128
+        ['url' => api_get_path(WEB_AJAX_PATH).'course.ajax.php?a=search_course']
129 129
     );
130 130
 }
131 131
 
132 132
 $form->addElement('checkbox', 'exemplary_content', '', get_lang('FillWithExemplaryContent'));
133 133
 
134 134
 $group = array();
135
-$group[]= $form->createElement('radio', 'visibility', get_lang('CourseAccess'), get_lang('OpenToTheWorld'), COURSE_VISIBILITY_OPEN_WORLD);
136
-$group[]= $form->createElement('radio', 'visibility', null, get_lang('OpenToThePlatform'), COURSE_VISIBILITY_OPEN_PLATFORM);
137
-$group[]= $form->createElement('radio', 'visibility', null, get_lang('Private'), COURSE_VISIBILITY_REGISTERED);
138
-$group[]= $form->createElement('radio', 'visibility', null, get_lang('CourseVisibilityClosed'), COURSE_VISIBILITY_CLOSED);
139
-$group[]= $form->createElement('radio', 'visibility', null, get_lang('CourseVisibilityHidden'), COURSE_VISIBILITY_HIDDEN);
135
+$group[] = $form->createElement('radio', 'visibility', get_lang('CourseAccess'), get_lang('OpenToTheWorld'), COURSE_VISIBILITY_OPEN_WORLD);
136
+$group[] = $form->createElement('radio', 'visibility', null, get_lang('OpenToThePlatform'), COURSE_VISIBILITY_OPEN_PLATFORM);
137
+$group[] = $form->createElement('radio', 'visibility', null, get_lang('Private'), COURSE_VISIBILITY_REGISTERED);
138
+$group[] = $form->createElement('radio', 'visibility', null, get_lang('CourseVisibilityClosed'), COURSE_VISIBILITY_CLOSED);
139
+$group[] = $form->createElement('radio', 'visibility', null, get_lang('CourseVisibilityHidden'), COURSE_VISIBILITY_HIDDEN);
140 140
 
141
-$form->addGroup($group,'', get_lang('CourseAccess'));
141
+$form->addGroup($group, '', get_lang('CourseAccess'));
142 142
 
143 143
 $group = array();
144
-$group[]= $form->createElement('radio', 'subscribe', get_lang('Subscription'), get_lang('Allowed'), 1);
145
-$group[]= $form->createElement('radio', 'subscribe', null, get_lang('Denied'), 0);
146
-$form->addGroup($group,'', get_lang('Subscription'));
144
+$group[] = $form->createElement('radio', 'subscribe', get_lang('Subscription'), get_lang('Allowed'), 1);
145
+$group[] = $form->createElement('radio', 'subscribe', null, get_lang('Denied'), 0);
146
+$form->addGroup($group, '', get_lang('Subscription'));
147 147
 
148 148
 $group = array();
149
-$group[]= $form->createElement('radio', 'unsubscribe', get_lang('Unsubscription'), get_lang('AllowedToUnsubscribe'), 1);
150
-$group[]= $form->createElement('radio', 'unsubscribe', null, get_lang('NotAllowedToUnsubscribe'), 0);
149
+$group[] = $form->createElement('radio', 'unsubscribe', get_lang('Unsubscription'), get_lang('AllowedToUnsubscribe'), 1);
150
+$group[] = $form->createElement('radio', 'unsubscribe', null, get_lang('NotAllowedToUnsubscribe'), 0);
151 151
 $form->addGroup($group, '', get_lang('Unsubscription'));
152 152
 
153
-$form->addElement('text','disk_quota',array(get_lang('CourseQuota'), null, get_lang('MB')));
153
+$form->addElement('text', 'disk_quota', array(get_lang('CourseQuota'), null, get_lang('MB')));
154 154
 $form->addRule('disk_quota', get_lang('ThisFieldShouldBeNumeric'), 'numeric');
155 155
 
156 156
 $obj = new GradeModel();
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 $extra_field = new ExtraField('course');
161 161
 $extra = $extra_field->addElements($form);
162 162
 
163
-$htmlHeadXtra[] ='
163
+$htmlHeadXtra[] = '
164 164
 <script>
165 165
 
166 166
 $(function() {
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 
174 174
 // Set some default values.
175 175
 $values['course_language'] = api_get_setting('platformLanguage');
176
-$values['disk_quota'] = round(api_get_setting('default_document_quotum')/1024/1024, 1);
176
+$values['disk_quota'] = round(api_get_setting('default_document_quotum') / 1024 / 1024, 1);
177 177
 
178 178
 $default_course_visibility = api_get_setting('courses_default_creation_visibility');
179 179
 
@@ -193,16 +193,16 @@  discard block
 block discarded – undo
193 193
     $course = $form->exportValues();
194 194
 
195 195
     $course_teachers = isset($course['course_teachers']) ? $course['course_teachers'] : null;
196
-    $course['disk_quota'] = $course['disk_quota']*1024*1024;
196
+    $course['disk_quota'] = $course['disk_quota'] * 1024 * 1024;
197 197
     $course['exemplary_content'] = empty($course['exemplary_content']) ? false : true;
198 198
     $course['teachers'] = $course_teachers;
199 199
     $course['wanted_code'] = $course['visual_code'];
200
-    $course['gradebook_model_id']   = isset($course['gradebook_model_id']) ? $course['gradebook_model_id'] : null;
200
+    $course['gradebook_model_id'] = isset($course['gradebook_model_id']) ? $course['gradebook_model_id'] : null;
201 201
     // Fixing category code
202
-    $course['course_category'] = isset($course['category_code']) ? $course['category_code'] :  '';
202
+    $course['course_category'] = isset($course['category_code']) ? $course['category_code'] : '';
203 203
 
204
-    include_once api_get_path(SYS_CODE_PATH) . 'lang/english/trad4all.inc.php';
205
-    $file_to_include = api_get_path(SYS_CODE_PATH) . 'lang/' . $course['course_language'] . '/trad4all.inc.php';
204
+    include_once api_get_path(SYS_CODE_PATH).'lang/english/trad4all.inc.php';
205
+    $file_to_include = api_get_path(SYS_CODE_PATH).'lang/'.$course['course_language'].'/trad4all.inc.php';
206 206
 
207 207
     if (file_exists($file_to_include)) {
208 208
         include $file_to_include;
Please login to merge, or discard this patch.
main/webservices/webservice_user.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -20,12 +20,12 @@  discard block
 block discarded – undo
20 20
 	 */
21 21
 	protected function changeUserActiveState($user_id_field_name, $user_id_value, $state) {
22 22
 		$user_id = $this->getUserId($user_id_field_name, $user_id_value);
23
-		if($user_id instanceof WSError) {
23
+		if ($user_id instanceof WSError) {
24 24
 			return $user_id;
25 25
 		} else {
26
-			if($state == 0) {
26
+			if ($state == 0) {
27 27
 				UserManager::disable($user_id);
28
-			} else if($state == 1) {
28
+			} else if ($state == 1) {
29 29
 				UserManager::enable($user_id);
30 30
 			}
31 31
 		}
@@ -40,11 +40,11 @@  discard block
 block discarded – undo
40 40
 	 */
41 41
 	protected function changeUsersActiveState($users, $state) {
42 42
 		$results = array();
43
-		foreach($users as $user) {
43
+		foreach ($users as $user) {
44 44
 			$result_tmp = array();
45 45
 			$result_op = $this->changeUserActiveState($user['user_id_field_name'], $user['user_id_value'], $state);
46 46
 			$result_tmp['user_id_value'] = $user['user_id_value'];
47
-			if($result_op instanceof WSError) {
47
+			if ($result_op instanceof WSError) {
48 48
 				// Return the error in the results
49 49
 				$result_tmp['result'] = $result_op->toArray();
50 50
 			} else {
@@ -64,12 +64,12 @@  discard block
 block discarded – undo
64 64
 	 */
65 65
 	public function DisableUser($secret_key, $user_id_field_name, $user_id_value) {
66 66
 		$verifKey = $this->verifyKey($secret_key);
67
-		if($verifKey instanceof WSError) {
67
+		if ($verifKey instanceof WSError) {
68 68
 			// Let the implementation handle it
69 69
 			$this->handleError($verifKey);
70 70
 		} else {
71 71
 			$result = $this->changeUserActiveState($user_id_field_name, $user_id_value, 0);
72
-			if($result instanceof WSError) {
72
+			if ($result instanceof WSError) {
73 73
 				$this->handleError($result);
74 74
 			}
75 75
 		}
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	 */
86 86
 	public function DisableUsers($secret_key, $users) {
87 87
 		$verifKey = $this->verifyKey($secret_key);
88
-		if($verifKey instanceof WSError) {
88
+		if ($verifKey instanceof WSError) {
89 89
 			// Let the implementation handle it
90 90
 			$this->handleError($verifKey);
91 91
 		} else {
@@ -102,11 +102,11 @@  discard block
 block discarded – undo
102 102
 	 */
103 103
 	public function EnableUser($secret_key, $user_id_field_name, $user_id_value) {
104 104
 		$verifKey = $this->verifyKey($secret_key);
105
-		if($verifKey instanceof WSError) {
105
+		if ($verifKey instanceof WSError) {
106 106
 			$this->handleError($verifKey);
107 107
 		} else {
108 108
 			$result = $this->changeUserActiveState($user_id_field_name, $user_id_value, 1);
109
-			if($result instanceof WSError) {
109
+			if ($result instanceof WSError) {
110 110
 				$this->handleError($result);
111 111
 			}
112 112
 		}
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 	 */
123 123
 	public function EnableUsers($secret_key, $users) {
124 124
 		$verifKey = $this->verifyKey($secret_key);
125
-		if($verifKey instanceof WSError) {
125
+		if ($verifKey instanceof WSError) {
126 126
 			// Let the implementation handle it
127 127
 			$this->handleError($verifKey);
128 128
 		} else {
@@ -139,10 +139,10 @@  discard block
 block discarded – undo
139 139
 	 */
140 140
 	protected function deleteUserHelper($user_id_field_name, $user_id_value) {
141 141
 		$user_id = $this->getUserId($user_id_field_name, $user_id_value);
142
-		if($user_id instanceof WSError) {
142
+		if ($user_id instanceof WSError) {
143 143
 			return $user_id;
144 144
 		} else {
145
-			if(!UserManager::delete_user($user_id)) {
145
+			if (!UserManager::delete_user($user_id)) {
146 146
 				return new WSError(101, "There was a problem while deleting this user");
147 147
 			} else {
148 148
 				return true;
@@ -159,11 +159,11 @@  discard block
 block discarded – undo
159 159
 	 */
160 160
 	public function DeleteUser($secret_key, $user_id_field_name, $user_id_value) {
161 161
 		$verifKey = $this->verifyKey($secret_key);
162
-		if($verifKey instanceof WSError) {
162
+		if ($verifKey instanceof WSError) {
163 163
 			$this->handleError($verifKey);
164 164
 		} else {
165 165
 			$result = $this->deleteUserHelper($user_id_field_name, $user_id_value);
166
-			if($result instanceof WSError) {
166
+			if ($result instanceof WSError) {
167 167
 				$this->handleError($result);
168 168
 			}
169 169
 		}
@@ -179,15 +179,15 @@  discard block
 block discarded – undo
179 179
 	 */
180 180
 	public function DeleteUsers($secret_key, $users) {
181 181
 		$verifKey = $this->verifyKey($secret_key);
182
-		if($verifKey instanceof WSError) {
182
+		if ($verifKey instanceof WSError) {
183 183
 			$this->handleError($verifKey);
184 184
 		} else {
185 185
 			$results = array();
186
-			foreach($users as $user) {
186
+			foreach ($users as $user) {
187 187
 				$result_tmp = array();
188 188
 				$result_op = $this->deleteUserHelper($user['user_id_field_name'], $user['user_id_value']);
189 189
 				$result_tmp['user_id_value'] = $user['user_id_value'];
190
-				if($result_op instanceof WSError) {
190
+				if ($result_op instanceof WSError) {
191 191
 					// Return the error in the results
192 192
 					$result_tmp['result'] = $result_op->toArray();
193 193
 				} else {
@@ -223,11 +223,11 @@  discard block
 block discarded – undo
223 223
 
224 224
 		// Add the original user id field name and value to the extra fields if needed
225 225
 		$extras_associative = array();
226
-		if($user_id_field_name != "chamilo_user_id") {
226
+		if ($user_id_field_name != "chamilo_user_id") {
227 227
 			$extras_associative[$user_id_field_name] = $user_id_value;
228 228
 		}
229 229
                 if (!empty($extras)) {
230
-                    foreach($extras as $extra) {
230
+                    foreach ($extras as $extra) {
231 231
                         $extras_associative[$extra['field_name']] = $extra['field_value'];
232 232
                     }
233 233
                 }
@@ -273,11 +273,11 @@  discard block
 block discarded – undo
273 273
 	public function CreateUser($secret_key, $firstname, $lastname, $status, $login, $password, $encrypt_method, $user_id_field_name, $user_id_value, $visibility = 1, $email = '', $language = 'english', $phone = '', $expiration_date = '0000-00-00 00:00:00', $extras = array()) {
274 274
 		// First, verify the secret key
275 275
 		$verifKey = $this->verifyKey($secret_key);
276
-		if($verifKey instanceof WSError) {
276
+		if ($verifKey instanceof WSError) {
277 277
 			$this->handleError($verifKey);
278 278
 		} else {
279 279
 			$result = $this->createUserHelper($firstname, $lastname, $status, $login, $password, $encrypt_method, $user_id_field_name, $user_id_value, $visibility, $email, $language, $phone, $expiration_date, $extras);
280
-			if($result instanceof WSError) {
280
+			if ($result instanceof WSError) {
281 281
 				$this->handleError($result);
282 282
 			} else {
283 283
 				return $result;
@@ -294,17 +294,17 @@  discard block
 block discarded – undo
294 294
 	 */
295 295
 	public function CreateUsers($secret_key, $users) {
296 296
 		$verifKey = $this->verifyKey($secret_key);
297
-		if($verifKey instanceof WSError) {
297
+		if ($verifKey instanceof WSError) {
298 298
 			$this->handleError($verifKey);
299 299
 		} else {
300 300
 			$results = array();
301
-			foreach($users as $user) {
301
+			foreach ($users as $user) {
302 302
 				$result_tmp = array();
303 303
                 // re-initialize variables just in case
304 304
                 $firstname = $lastname = $status = $login = $password = $encrypt_method = $user_id_field_name = $user_id_value = $visibility = $email = $language = $phone = $expiration_date = $extras = null;
305 305
 				extract($user);
306 306
 				$result = $this->createUserHelper($firstname, $lastname, $status, $login, $password, $encrypt_method, $user_id_field_name, $user_id_value, $visibility, $email, $language, $phone, $expiration_date, $extras);
307
-				if($result instanceof WSError) {
307
+				if ($result instanceof WSError) {
308 308
 					$result_tmp['result'] = $result->toArray();
309 309
 					$result_tmp['user_id_value'] = $user_id_value;
310 310
 					$result_tmp['user_id_generated'] = 0;
@@ -353,10 +353,10 @@  discard block
 block discarded – undo
353 353
 		$extras
354 354
 	) {
355 355
 		$user_id = $this->getUserId($user_id_field_name, $user_id_value);
356
-		if($user_id instanceof WSError) {
356
+		if ($user_id instanceof WSError) {
357 357
 			return $user_id;
358 358
 		} else {
359
-			if($password == '') {
359
+			if ($password == '') {
360 360
 				$password = null;
361 361
 			}
362 362
 			$user_info = api_get_user_info($user_id);
@@ -417,19 +417,19 @@  discard block
 block discarded – undo
417 417
 	public function EditUser($secret_key, $user_id_field_name, $user_id_value, $firstname, $lastname, $status, $loginname, $password, $encrypt_method, $email, $language, $phone, $expiration_date, $extras) {
418 418
 		// First, verify the secret key
419 419
 		$verifKey = $this->verifyKey($secret_key);
420
-		if($verifKey instanceof WSError) {
420
+		if ($verifKey instanceof WSError) {
421 421
 			$this->handleError($verifKey);
422 422
 		} else {
423 423
 
424 424
 			$extras_associative = array();
425 425
 			if (!empty($extras)) {
426
-				foreach($extras as $extra) {
426
+				foreach ($extras as $extra) {
427 427
 					$extras_associative[$extra['field_name']] = $extra['field_value'];
428 428
 				}
429 429
 			}
430 430
 
431 431
 			$result = $this->editUserHelper($user_id_field_name, $user_id_value, $firstname, $lastname, $status, $loginname, $password, $encrypt_method, $email, $language, $phone, $expiration_date, $extras_associative);
432
-			if($result instanceof WSError) {
432
+			if ($result instanceof WSError) {
433 433
 				$this->handleError($result);
434 434
 			}
435 435
 		}
@@ -445,18 +445,18 @@  discard block
 block discarded – undo
445 445
 	 */
446 446
 	public function EditUsers($secret_key, $users) {
447 447
 		$verifKey = $this->verifyKey($secret_key);
448
-		if($verifKey instanceof WSError) {
448
+		if ($verifKey instanceof WSError) {
449 449
 			$this->handleError($verifKey);
450 450
 		} else {
451 451
 			$results = array();
452
-			foreach($users as $user) {
452
+			foreach ($users as $user) {
453 453
 				$result_tmp = array();
454 454
                 // re-initialize variables just in case
455 455
                 $user_id_field_name = $user_id_value = $firstname = $lastname = $status = $loginname = $password = $encrypt_method = $email = $language = $phone = $expiration_date = $extras = null;
456 456
 				extract($user);
457 457
 				$result_op = $this->editUserHelper($user_id_field_name, $user_id_value, $firstname, $lastname, $status, $loginname, $password, $encrypt_method, $email, $language, $phone, $expiration_date, $extras);
458 458
 				$result_tmp['user_id_value'] = $user['user_id_value'];
459
-				if($result_op instanceof WSError) {
459
+				if ($result_op instanceof WSError) {
460 460
 					// Return the error in the results
461 461
 					$result_tmp['result'] = $result_op->toArray();
462 462
 				} else {
Please login to merge, or discard this patch.
main/admin/access_url_edit_course_category_to_url.php 1 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/access_url_edit_courses_to_url.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -35,12 +35,12 @@  discard block
 block discarded – undo
35 35
 $interbreadcrumb[] = array('url' => 'access_urls.php', 'name' => get_lang('MultipleAccessURLs'));
36 36
 
37 37
 $add_type = 'multiple';
38
-if (isset($_REQUEST['add_type']) && $_REQUEST['add_type']!='') {
38
+if (isset($_REQUEST['add_type']) && $_REQUEST['add_type'] != '') {
39 39
 	$add_type = Security::remove_XSS($_REQUEST['add_type']);
40 40
 }
41 41
 
42 42
 $access_url_id = 1;
43
-if (isset($_REQUEST['access_url_id']) && $_REQUEST['access_url_id']!='') {
43
+if (isset($_REQUEST['access_url_id']) && $_REQUEST['access_url_id'] != '') {
44 44
 	$access_url_id = Security::remove_XSS($_REQUEST['access_url_id']);
45 45
 }
46 46
 
@@ -157,23 +157,23 @@  discard block
 block discarded – undo
157 157
 		<?php echo $link_add_type_unique ?>&nbsp;|&nbsp;<?php echo $link_add_type_multiple ?>
158 158
 	</div>
159 159
 	<br /><br />
160
-	<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>" style="margin:0px;" <?php if($ajax_search){echo ' onsubmit="valide();"';}?> >
160
+	<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>" style="margin:0px;" <?php if ($ajax_search) {echo ' onsubmit="valide();"'; }?> >
161 161
 		<?php echo get_lang('SelectUrl').' : '; ?>
162 162
 		<select name="access_url_id" onchange="javascript:send();">
163 163
 			<option value="0">-- <?php echo get_lang('SelectUrl')?> -- </option>
164 164
 			<?php
165
-			$url_selected='';
165
+			$url_selected = '';
166 166
 			foreach ($url_list as $url_obj) {
167 167
 				$checked = '';
168 168
 				if (!empty($access_url_id)) {
169
-					if ($url_obj[0]==$access_url_id) {
169
+					if ($url_obj[0] == $access_url_id) {
170 170
 						$checked = 'selected=true';
171
-						$url_selected=$url_obj[1];
171
+						$url_selected = $url_obj[1];
172 172
 					}
173 173
 				}
174
-				if ($url_obj['active']==1) {
174
+				if ($url_obj['active'] == 1) {
175 175
 					?>
176
-					<option <?php echo $checked;?> value="<?php echo $url_obj[0]; ?>"> <?php echo $url_obj[1]; ?></option>
176
+					<option <?php echo $checked; ?> value="<?php echo $url_obj[0]; ?>"> <?php echo $url_obj[1]; ?></option>
177 177
 				<?php
178 178
 				}
179 179
 			}
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 				<td align="center">
197 197
 					<div id="content_source">
198 198
 						<?php
199
-						if($ajax_search) {
199
+						if ($ajax_search) {
200 200
 							?>
201 201
 							<input type="text" id="course_to_add" onkeyup="xajax_search_courses(this.value,document.formulaire.access_url_id.options[document.formulaire.access_url_id.selectedIndex].value)" />
202 202
 							<div id="ajax_list_courses"></div>
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 							?>
206 206
 							<select id="origin_users" name="no_course_list[]" multiple="multiple" size="15" style="width:380px;">
207 207
 								<?php
208
-								foreach($no_course_list as $no_course) {
208
+								foreach ($no_course_list as $no_course) {
209 209
 									?>
210 210
 									<option value="<?php echo $no_course['id']; ?>"><?php echo $no_course['title'].' ('.$no_course['code'].')'; ?></option>
211 211
 								<?php
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
 				</td>
221 221
 				<td width="10%" valign="middle" align="center">
222 222
 					<?php
223
-					if($ajax_search) {
223
+					if ($ajax_search) {
224 224
 						?>
225 225
 						<button class="btn btn-default" type="button" onclick="remove_item(document.getElementById('destination_users'))" >
226 226
                             <em class="fa fa-arrow-left"></em>
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
 				<td align="center">
244 244
 					<select id="destination_users" name="course_list[]" multiple="multiple" size="15" style="width:380px;">
245 245
 						<?php
246
-						foreach($course_list as $course) {
246
+						foreach ($course_list as $course) {
247 247
 							$courseInfo = api_get_course_info_by_id($course['id']);
248 248
 							?>
249 249
 							<option value="<?php echo $course['id']; ?>"><?php echo $course['title'].' ('.$courseInfo['code'].')'; ?></option>
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
 				<td colspan="3" align="center">
259 259
 					<br />
260 260
 					<?php
261
-					if(isset($_GET['add']))
261
+					if (isset($_GET['add']))
262 262
 						echo '<button class="btn btn-default" onclick="valide()" >'.get_lang('AddCoursesToURL').'</button>';
263 263
 					else
264 264
 						echo '<button class="btn btn-default" onclick="valide()" >'.get_lang('EditCoursesToURL').'</button>';
Please login to merge, or discard this patch.
main/exercise/export/aiken/aiken_import.inc.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
         $dir .= '/';
26 26
 
27 27
     do {
28
-        $path = $dir . $prefix . mt_rand(0, 9999999);
28
+        $path = $dir.$prefix.mt_rand(0, 9999999);
29 29
     } while (!mkdir($path, $mode));
30 30
 
31 31
     return $path;
@@ -39,8 +39,8 @@  discard block
 block discarded – undo
39 39
 {
40 40
     $name_tools = get_lang('ImportAikenQuiz');
41 41
     $form  = '<div class="actions">';
42
-    $form .= '<a href="exercise.php?show=test&'.api_get_cidreq().'">' .
43
-        Display :: return_icon('back.png', get_lang('BackToExercisesList'),'',ICON_SIZE_MEDIUM).'</a>';
42
+    $form .= '<a href="exercise.php?show=test&'.api_get_cidreq().'">'.
43
+        Display :: return_icon('back.png', get_lang('BackToExercisesList'), '', ICON_SIZE_MEDIUM).'</a>';
44 44
     $form .= '</div>';
45 45
     $form_validator = new FormValidator(
46 46
         'aiken_upload',
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 function aiken_import_exercise($file)
94 94
 {
95 95
     global $exercise_info;
96
-    $archive_path = api_get_path(SYS_ARCHIVE_PATH) . 'aiken';
96
+    $archive_path = api_get_path(SYS_ARCHIVE_PATH).'aiken';
97 97
     $baseWorkDir = $archive_path;
98 98
 
99 99
     if (!is_dir($baseWorkDir)) {
@@ -130,9 +130,9 @@  discard block
 block discarded – undo
130 130
 
131 131
     // Parse every subdirectory to search txt question files
132 132
     while (false !== ($file = readdir($exerciseHandle))) {
133
-        if (is_dir($baseWorkDir . '/' . $file) && $file != "." && $file != "..") {
133
+        if (is_dir($baseWorkDir.'/'.$file) && $file != "." && $file != "..") {
134 134
             //find each manifest for each question repository found
135
-            $questionHandle = opendir($baseWorkDir . '/' . $file);
135
+            $questionHandle = opendir($baseWorkDir.'/'.$file);
136 136
             while (false !== ($questionFile = readdir($questionHandle))) {
137 137
                 if (preg_match('/.txt$/i', $questionFile)) {
138 138
                     $result = aiken_parse_file(
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
         }
217 217
 
218 218
         // Delete the temp dir where the exercise was unzipped
219
-        my_delete($baseWorkDir . $uploadPath);
219
+        my_delete($baseWorkDir.$uploadPath);
220 220
         $operation = $last_exercise_id;
221 221
     }
222 222
 
@@ -239,8 +239,8 @@  discard block
 block discarded – undo
239 239
 function aiken_parse_file(&$exercise_info, $exercisePath, $file, $questionFile) {
240 240
     global $questionTempDir;
241 241
 
242
-    $questionTempDir = $exercisePath . '/' . $file . '/';
243
-    $questionFilePath = $questionTempDir . $questionFile;
242
+    $questionTempDir = $exercisePath.'/'.$file.'/';
243
+    $questionFilePath = $questionTempDir.$questionFile;
244 244
 
245 245
     if (!is_file($questionFilePath)) {
246 246
         return 'FileNotFound';
@@ -252,13 +252,13 @@  discard block
 block discarded – undo
252 252
     $answers_array = array();
253 253
     $new_question = true;
254 254
     foreach ($data as $line => $info) {
255
-        if ($question_index > 0 && $new_question == true && preg_match('/^(\r)?\n/',$info)) {
255
+        if ($question_index > 0 && $new_question == true && preg_match('/^(\r)?\n/', $info)) {
256 256
             // double empty line
257 257
             continue;
258 258
         }
259 259
         $new_question = false;
260 260
         //make sure it is transformed from iso-8859-1 to utf-8 if in that form
261
-        if (!mb_check_encoding($info,'utf-8') && mb_check_encoding($info,'iso-8859-1')) {
261
+        if (!mb_check_encoding($info, 'utf-8') && mb_check_encoding($info, 'iso-8859-1')) {
262 262
             $info = utf8_encode($info);
263 263
         }
264 264
         $exercise_info['question'][$question_index]['type'] = 'MCUA';
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
         } elseif (preg_match('/^ETIQUETAS:\s?([A-Z])\s?/', $info, $matches)) {
291 291
             //TAGS for chamilo >= 1.10 (Spanish e-ducativa format)
292 292
             $exercise_info['question'][$question_index]['answer_tags'] = explode(',', $matches[1]);
293
-        } elseif (preg_match('/^(\r)?\n/',$info)) {
293
+        } elseif (preg_match('/^(\r)?\n/', $info)) {
294 294
             //moving to next question (tolerate \r\n or just \n)
295 295
             if (empty($exercise_info['question'][$question_index]['correct_answers'])) {
296 296
                 error_log('Aiken: Error in question index '.$question_index.': no correct answer defined');
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
                     $exercise_info['question'][$question_index]['title'] = $info;
311 311
                 } else {
312 312
                     //Question itself (use a 100-chars long title and a larger description)
313
-                    $exercise_info['question'][$question_index]['title'] = trim(substr($info, 0, 100)) . '...';
313
+                    $exercise_info['question'][$question_index]['title'] = trim(substr($info, 0, 100)).'...';
314 314
                     $exercise_info['question'][$question_index]['description'] = $info;
315 315
                 }
316 316
             } else {
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
     }
321 321
     $total_questions = count($exercise_info['question']);
322 322
     $total_weight = (!empty($_POST['total_weight'])) ? intval($_POST['total_weight']) : 20;
323
-    foreach  ($exercise_info['question'] as $key => $question) {
323
+    foreach ($exercise_info['question'] as $key => $question) {
324 324
         $exercise_info['question'][$key]['weighting'][current(array_keys($exercise_info['question'][$key]['weighting']))] = $total_weight / $total_questions;
325 325
     }
326 326
     return true;
Please login to merge, or discard this patch.
main/exercise/aiken.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
     if (isset($_POST['submit'])) {
33 33
         $id = aiken_import_file($_FILES['userFile']);
34 34
         if (is_numeric($id) && !empty($id)) {
35
-            header('Location: admin.php?' . api_get_cidreq() . '&exerciseId=' . $id);
35
+            header('Location: admin.php?'.api_get_cidreq().'&exerciseId='.$id);
36 36
             exit;
37 37
         }
38 38
     }
Please login to merge, or discard this patch.
main/admin/configure_extensions.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 
27 27
 			$rs = Database::query($sql);
28 28
 
29
-			if (Database::affected_rows($rs)>0){
29
+			if (Database::affected_rows($rs) > 0) {
30 30
 				$message = get_lang('ServiceActivated');
31 31
 			}
32 32
 
@@ -76,18 +76,18 @@  discard block
 block discarded – undo
76 76
 		WHERE variable LIKE "service_%" AND subkey="active" and selected_value="true"';
77 77
 
78 78
 $rs = Database::query($sql);
79
-while($row = Database::fetch_array($rs)){
79
+while ($row = Database::fetch_array($rs)) {
80 80
 	$listActiveServices[] = $row['variable'];
81 81
 }
82 82
 
83 83
 // javascript to handle accordion behaviour
84 84
 $javascript_message = '';
85
-if(!empty($message)){
85
+if (!empty($message)) {
86 86
 	$javascript_message = '
87 87
 	document.getElementById("message").style.display = "block";
88 88
 	var timer = setTimeout(hideMessage, 5000);';
89 89
 }
90
-$htmlHeadXtra[]= '<script>
90
+$htmlHeadXtra[] = '<script>
91 91
 var listeDiv;
92 92
 var extensionsHeader = new Array();
93 93
 var extensionsContent = new Array();
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 ?>
136 136
 <div id="message" style="display: none">
137 137
 	<?php
138
-	if(!empty($message))
138
+	if (!empty($message))
139 139
 		Display::display_normal_message($message)
140 140
 	?>
141 141
 </div>
Please login to merge, or discard this patch.