Completed
Push — 1.11.x ( 52cc6f...bf3cbb )
by José
80:28 queued 41:29
created
main/admin/user_move_stats.php 1 patch
Braces   +99 added lines, -43 removed lines patch added patch discarded remove patch
@@ -107,7 +107,9 @@  discard block
 block discarded – undo
107 107
                 //Check if the user is registered in the session otherwise we will add it
108 108
                 $result = SessionManager::get_users_by_session($new_session_id);
109 109
                 if (empty($result) || !in_array($user_id, array_keys($result))) {
110
-                    if ($debug) echo 'User added to the session';
110
+                    if ($debug) {
111
+                        echo 'User added to the session';
112
+                    }
111 113
                     //Registering user to the new session
112 114
                     SessionManager::suscribe_users_to_session($new_session_id,array($user_id),false);
113 115
                 }
@@ -142,10 +144,11 @@  discard block
 block discarded – undo
142 144
                     $list[$row['exe_id']]= $row;
143 145
                 }
144 146
 
145
-                if (!empty($list))
146
-                    foreach ($list as $exe_id =>$data) {
147
+                if (!empty($list)) {
148
+                                    foreach ($list as $exe_id =>$data) {
147 149
                         if ($update_database) {
148 150
                             $sql = "UPDATE $TABLETRACK_EXERCICES SET session_id = '$new_session_id' WHERE exe_id = $exe_id";
151
+                }
149 152
                             $res = Database::query($sql);
150 153
                             $result_message[$TABLETRACK_EXERCICES]++;
151 154
                         } else {
@@ -169,10 +172,11 @@  discard block
 block discarded – undo
169 172
                         $list[$row['exe_id']]= $row;
170 173
                     }
171 174
 
172
-                    if (!empty($list))
173
-                        foreach ($list as $exe_id =>$data) {
175
+                    if (!empty($list)) {
176
+                                            foreach ($list as $exe_id =>$data) {
174 177
                             if ($update_database) {
175 178
                                 $sql = "UPDATE $TABLETRACK_EXERCICES SET session_id = '$new_session_id' WHERE exe_id = $exe_id";
179
+                    }
176 180
                                 $res = Database::query($sql);
177 181
                                 $result_message[$TABLETRACK_EXERCICES]++;
178 182
                             } else {
@@ -197,10 +201,11 @@  discard block
 block discarded – undo
197 201
                     $list[$row['course_access_id']] = $row;
198 202
                 }
199 203
 
200
-                if (!empty($list))
201
-                    foreach ($list as $id => $data) {
204
+                if (!empty($list)) {
205
+                                    foreach ($list as $id => $data) {
202 206
                         if ($update_database) {
203 207
                             $sql = "UPDATE $TBL_TRACK_E_COURSE_ACCESS SET session_id = $new_session_id WHERE course_access_id = $id";
208
+                }
204 209
                             if ($debug) {
205 210
                                 echo $sql;
206 211
                             }
@@ -219,13 +224,18 @@  discard block
 block discarded – undo
219 224
                 while($row = Database::fetch_array($res,'ASSOC')) {
220 225
                     $list[] = $row['access_id'];
221 226
                 }
222
-                if (!empty($list))
223
-                    foreach ($list as $id) {
227
+                if (!empty($list)) {
228
+                                    foreach ($list as $id) {
224 229
                         if ($update_database) {
225 230
                             $sql = "UPDATE $TBL_TRACK_E_LAST_ACCESS SET access_session_id = $new_session_id WHERE access_id = $id";
226
-                            if ($debug) echo $sql;
231
+                }
232
+                            if ($debug) {
233
+                                echo $sql;
234
+                            }
227 235
                             $res = Database::query($sql);
228
-                            if ($debug) error_log(__FILE__ . ' +' . __LINE__ . ': ' . print_r($res, 1));
236
+                            if ($debug) {
237
+                                error_log(__FILE__ . ' +' . __LINE__ . ': ' . print_r($res, 1));
238
+                            }
229 239
                             $result_message[$TBL_TRACK_E_LAST_ACCESS]++;
230 240
                         }
231 241
                     }
@@ -249,13 +259,18 @@  discard block
 block discarded – undo
249 259
                     }
250 260
                 }
251 261
 
252
-                if (!empty($list))
253
-                    foreach ($list as $id=>$data) {
262
+                if (!empty($list)) {
263
+                                    foreach ($list as $id=>$data) {
254 264
                         if ($update_database) {
255 265
                             $sql = "UPDATE $TBL_LP_VIEW SET session_id = $new_session_id WHERE c_id = $course_id AND id = $id ";
256
-                            if ($debug) var_dump($sql);
266
+                }
267
+                            if ($debug) {
268
+                                var_dump($sql);
269
+                            }
257 270
                             $res = Database::query($sql);
258
-                            if ($debug) var_dump($res);
271
+                            if ($debug) {
272
+                                var_dump($res);
273
+                            }
259 274
                             $result_message[$TBL_LP_VIEW]++;
260 275
                         } else {
261 276
                             //Getting all information of that lp_item_id
@@ -282,10 +297,11 @@  discard block
 block discarded – undo
282 297
                             $list[$row['id']] = $row;
283 298
                         }
284 299
                     }
285
-                    if (!empty($list))
286
-                        foreach ($list as $id=>$data) {
300
+                    if (!empty($list)) {
301
+                                            foreach ($list as $id=>$data) {
287 302
                             //Getting all information of that lp_item_id
288 303
                             $score    = Tracking::get_avg_student_score($user_id, $origin_course_code,        array($data['lp_id']), $new_session_id);
304
+                    }
289 305
                             $progress = Tracking::get_avg_student_progress($user_id, $origin_course_code,     array($data['lp_id']), $new_session_id);
290 306
                             $result_message_compare['LP_VIEW'][$data['lp_id']] = array('score' => $score, 'progress' =>$progress);
291 307
                         }
@@ -301,9 +317,13 @@  discard block
 block discarded – undo
301 317
                     $id = $row['ref'];
302 318
                     if ($update_database) {
303 319
                         $sql = "UPDATE $TBL_AGENDA SET session_id = $new_session_id WHERE c_id = $course_id AND id = $id ";
304
-                        if ($debug) var_dump($sql);
320
+                        if ($debug) {
321
+                            var_dump($sql);
322
+                        }
305 323
                         $res_update = Database::query($sql);
306
-                        if ($debug) var_dump($res_update);
324
+                        if ($debug) {
325
+                            var_dump($res_update);
326
+                        }
307 327
                         $result_message['agenda']++;
308 328
                     }
309 329
                 }
@@ -315,22 +335,30 @@  discard block
 block discarded – undo
315 335
                 //echo '<h1>Student publication</h1>';
316 336
 
317 337
                 $sql = "SELECT ref FROM $TBL_ITEM_PROPERTY WHERE tool = 'work' AND insert_user_id = $user_id AND c_id = $course_id";
318
-                if ($debug) echo $sql;
338
+                if ($debug) {
339
+                    echo $sql;
340
+                }
319 341
                 $res = Database::query($sql);
320 342
                 while($row = Database::fetch_array($res,'ASSOC')) {
321 343
                     $id = $row['ref'];
322 344
                     $sql = "SELECT * FROM $TBL_STUDENT_PUBLICATION WHERE id = $id AND session_id = $origin_session_id AND c_id = $course_id";
323
-                    if ($debug) var_dump($sql);
345
+                    if ($debug) {
346
+                        var_dump($sql);
347
+                    }
324 348
                     $sub_res = Database::query($sql);
325 349
                     if (Database::num_rows($sub_res) > 0 ) {
326 350
                         $data = Database::fetch_array($sub_res,'ASSOC');
327
-                        if ($debug) var_dump($data);
351
+                        if ($debug) {
352
+                            var_dump($data);
353
+                        }
328 354
                         $parent_id = $data['parent_id'];
329 355
                         if (isset($data['parent_id']) && !empty($data['parent_id'])) {
330 356
                             $sql = "SELECT * FROM $TBL_STUDENT_PUBLICATION WHERE id = $parent_id AND c_id = $course_id";
331 357
                             $select_res     = Database::query($sql);
332 358
                             $parent_data    = Database::fetch_array($select_res,'ASSOC');
333
-                            if ($debug)     var_dump($parent_data);
359
+                            if ($debug) {
360
+                                var_dump($parent_data);
361
+                            }
334 362
 
335 363
                             $sys_course_path = api_get_path(SYS_COURSE_PATH);
336 364
                             $course_dir = $sys_course_path . $course_info['path'];
@@ -345,7 +373,9 @@  discard block
 block discarded – undo
345 373
                             $sql = "SELECT * FROM $TBL_STUDENT_PUBLICATION
346 374
                             		WHERE description like '%$search_this%' AND url LIKE '%$search_this2%' AND session_id = $new_session_id AND c_id = $course_id
347 375
                             		ORDER BY id desc  LIMIT 1";
348
-                            if ($debug) echo $sql;
376
+                            if ($debug) {
377
+                                echo $sql;
378
+                            }
349 379
                             $sub_res = Database::query($sql);
350 380
                             $num_rows = Database::num_rows($sub_res);
351 381
 
@@ -389,7 +419,9 @@  discard block
 block discarded – undo
389 419
 
390 420
                             //Creating student_publication_assignment if exists
391 421
                             $sql = "SELECT * FROM $TBL_STUDENT_PUBLICATION_ASSIGNMENT WHERE publication_id = $parent_id AND c_id = $course_id";
392
-                            if ($debug) var_dump($sql);
422
+                            if ($debug) {
423
+                                var_dump($sql);
424
+                            }
393 425
                             $rest_select     = Database::query($sql);
394 426
                             if (Database::num_rows($rest_select) > 0 ) {
395 427
                                 if ($update_database) {
@@ -401,7 +433,9 @@  discard block
 block discarded – undo
401 433
                                        add_to_calendar      = '".$assignment_data['add_to_calendar']."',
402 434
                                        enable_qualification = '".$assignment_data['enable_qualification']."',
403 435
                                        publication_id       = '".$new_parent_id."'";
404
-                                    if ($debug) echo $sql_add_publication;
436
+                                    if ($debug) {
437
+                                        echo $sql_add_publication;
438
+                                    }
405 439
                                     $rest_select     = Database::query($sql_add_publication);
406 440
                                     $id = Database::insert_id();
407 441
 
@@ -409,11 +443,15 @@  discard block
 block discarded – undo
409 443
                                         "has_properties         = '".$id."',
410 444
                                        view_properties    = '1'
411 445
                                        WHERE id   = ".$new_parent_id;
412
-                                    if ($debug) echo $sql_update;
446
+                                    if ($debug) {
447
+                                        echo $sql_update;
448
+                                    }
413 449
                                     $rest_update     = Database::query($sql_update);
414 450
 
415 451
 
416
-                                    if ($debug) var_dump($sql_update);
452
+                                    if ($debug) {
453
+                                        var_dump($sql_update);
454
+                                    }
417 455
                                     $result_message[$TBL_STUDENT_PUBLICATION_ASSIGNMENT]++;
418 456
                                 }
419 457
                             }
@@ -454,7 +492,9 @@  discard block
 block discarded – undo
454 492
                                     if ($result) {
455 493
                                         unlink($full_file_name);
456 494
                                         $sql = "DELETE FROM $TBL_STUDENT_PUBLICATION WHERE id= ".$data['id'];
457
-                                        if ($debug) var_dump($sql);
495
+                                        if ($debug) {
496
+                                            var_dump($sql);
497
+                                        }
458 498
                                         $result_delete     = Database::query($sql);
459 499
                                         api_item_property_update($course_info, 'work', $data['id'], 'DocumentDeleted', api_get_user_id());
460 500
                                     }
@@ -470,22 +510,30 @@  discard block
 block discarded – undo
470 510
                 //10. Dropbox - not neccesary to move categories (no presence of session_id)
471 511
 
472 512
                 $sql = "SELECT id FROM $TBL_DROPBOX_FILE WHERE uploader_id = $user_id AND session_id = $origin_session_id AND c_id = $course_id";
473
-                if ($debug) var_dump($sql);
513
+                if ($debug) {
514
+                    var_dump($sql);
515
+                }
474 516
                 $res = Database::query($sql);
475 517
                 while($row = Database::fetch_array($res,'ASSOC')) {
476 518
                     $id = $row['id'];
477 519
                     if ($update_database) {
478 520
                         $sql = "UPDATE $TBL_DROPBOX_FILE SET session_id = $new_session_id WHERE c_id = $course_id AND id = $id";
479
-                        if ($debug) var_dump($sql);
521
+                        if ($debug) {
522
+                            var_dump($sql);
523
+                        }
480 524
                         $res = Database::query($sql);
481
-                        if ($debug) var_dump($res);
525
+                        if ($debug) {
526
+                            var_dump($res);
527
+                        }
482 528
 
483 529
                         $sql = "UPDATE $TBL_DROPBOX_POST SET session_id = $new_session_id WHERE file_id = $id";
484
-                        if ($debug)
485
-                            var_dump($sql);
530
+                        if ($debug) {
531
+                                                    var_dump($sql);
532
+                        }
486 533
                         $res = Database::query($sql);
487
-                        if ($debug)
488
-                            var_dump($res);
534
+                        if ($debug) {
535
+                                                    var_dump($res);
536
+                        }
489 537
                         $result_message[$TBL_DROPBOX_FILE]++;
490 538
                     }
491 539
                 }
@@ -494,23 +542,30 @@  discard block
 block discarded – undo
494 542
 
495 543
                 $sql = "SELECT notebook_id FROM $TBL_NOTEBOOK
496 544
                         WHERE user_id = $user_id AND session_id = $origin_session_id AND course = '$origin_course_code' AND c_id = $course_id";
497
-                if ($debug) var_dump($sql);
545
+                if ($debug) {
546
+                    var_dump($sql);
547
+                }
498 548
                 $res = Database::query($sql);
499 549
                 while($row = Database::fetch_array($res,'ASSOC')) {
500 550
                     $id = $row['notebook_id'];
501 551
                     if ($update_database) {
502 552
                         $sql = "UPDATE $TBL_NOTEBOOK SET session_id = $new_session_id WHERE c_id = $course_id AND notebook_id = $id";
503
-                        if ($debug) var_dump($sql);
553
+                        if ($debug) {
554
+                            var_dump($sql);
555
+                        }
504 556
                         $res = Database::query($sql);
505
-                        if ($debug) var_dump($res);
557
+                        if ($debug) {
558
+                            var_dump($res);
559
+                        }
506 560
                     }
507 561
                 }
508 562
 
509 563
                 if ($update_database) {
510 564
                     echo '<h2>'.get_lang('StatsMoved').'</h2>';
511
-                    if (is_array($result_message))
512
-                        foreach ($result_message as $table=>$times) {
565
+                    if (is_array($result_message)) {
566
+                                            foreach ($result_message as $table=>$times) {
513 567
                             echo 'Table '.$table.' - '.$times.' records updated <br />';
568
+                    }
514 569
                         }
515 570
                 } else {
516 571
                     echo '<h2>'.get_lang('UserInformationOfThisCourse').'</h2>';
@@ -626,10 +681,11 @@  discard block
 block discarded – undo
626 681
 }
627 682
 $navigation .= '&nbsp;';
628 683
 $page ++;
629
-if ($page < $nro_pages)
684
+if ($page < $nro_pages) {
630 685
     $navigation .= '<a href="'.api_get_self().'?page='.$page.'">'.get_lang('Next').'</a>';
631
-else
686
+} else {
632 687
     $navigation .= get_lang('Next');
688
+}
633 689
 
634 690
 echo $navigation;
635 691
 $user_list      = UserManager::get_user_list(array(), array(), $begin, $default);
Please login to merge, or discard this patch.
main/webservices/registration.soap.php 1 patch
Braces   +183 added lines, -63 removed lines patch added patch discarded remove patch
@@ -63,14 +63,16 @@  discard block
 block discarded – undo
63 63
         list($ip1) = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
64 64
         $ip = trim($ip1);
65 65
     }
66
-    if ($debug)
67
-        error_log("ip: $ip");
66
+    if ($debug) {
67
+            error_log("ip: $ip");
68
+    }
68 69
     // Check if a file that limits access from webservices exists and contains
69 70
     // the restraining check
70 71
     if (is_file('webservice-auth-ip.conf.php')) {
71 72
         include 'webservice-auth-ip.conf.php';
72
-        if ($debug)
73
-            error_log("webservice-auth-ip.conf.php file included");
73
+        if ($debug) {
74
+                    error_log("webservice-auth-ip.conf.php file included");
75
+        }
74 76
         if (!empty($ws_auth_ip)) {
75 77
             $check_ip = true;
76 78
             $ip_matches = api_check_ip_in_range($ip, $ws_auth_ip);
@@ -556,7 +558,9 @@  discard block
 block discarded – undo
556 558
 
557 559
     // First check wether the login already exists
558 560
     if (!UserManager::is_username_available($loginName)) {
559
-        if ($debug) error_log("Username $loginName is not available");
561
+        if ($debug) {
562
+            error_log("Username $loginName is not available");
563
+        }
560 564
         return 0;
561 565
     }
562 566
 
@@ -1049,9 +1053,15 @@  discard block
 block discarded – undo
1049 1053
         );
1050 1054
     }
1051 1055
 
1052
-    if ($debug) error_log('$userId found: '. $userId);
1053
-    if ($debug) error_log('$courseId found: '. $courseId);
1054
-    if ($debug) error_log('$sessionId found: '. $sessionId);
1056
+    if ($debug) {
1057
+        error_log('$userId found: '. $userId);
1058
+    }
1059
+    if ($debug) {
1060
+        error_log('$courseId found: '. $courseId);
1061
+    }
1062
+    if ($debug) {
1063
+        error_log('$sessionId found: '. $sessionId);
1064
+    }
1055 1065
 
1056 1066
     return [
1057 1067
         'user_id' => $userId,
@@ -1081,13 +1091,17 @@  discard block
 block discarded – undo
1081 1091
 {
1082 1092
     global $debug;
1083 1093
 
1084
-    if ($debug) error_log('WSSubscribeTeacherToSessionCourse');
1094
+    if ($debug) {
1095
+        error_log('WSSubscribeTeacherToSessionCourse');
1096
+    }
1085 1097
 
1086 1098
     if (!WSHelperVerifyKey($params)) {
1087 1099
         return returnError(WS_ERROR_SECRET_KEY);
1088 1100
     }
1089 1101
 
1090
-    if ($debug) error_log('Params '. print_r($params, 1));
1102
+    if ($debug) {
1103
+        error_log('Params '. print_r($params, 1));
1104
+    }
1091 1105
 
1092 1106
     $params = parseCourseSessionUserParams($params);
1093 1107
 
@@ -1100,13 +1114,17 @@  discard block
 block discarded – undo
1100 1114
     $result = 0;
1101 1115
 
1102 1116
     if (!empty($coaches)) {
1103
-        if ($debug) error_log('Coaches:  '. print_r($coaches, 1));
1117
+        if ($debug) {
1118
+            error_log('Coaches:  '. print_r($coaches, 1));
1119
+        }
1104 1120
         if (in_array($userId, $coaches)) {
1105 1121
             $result = 1;
1106 1122
         }
1107 1123
     }
1108 1124
 
1109
-    if ($debug) error_log('Result:  '. $result);
1125
+    if ($debug) {
1126
+        error_log('Result:  '. $result);
1127
+    }
1110 1128
 
1111 1129
     return $result;
1112 1130
 }
@@ -1132,13 +1150,17 @@  discard block
 block discarded – undo
1132 1150
 {
1133 1151
     global $debug;
1134 1152
 
1135
-    if ($debug) error_log('WSSubscribeTeacherToSessionCourse');
1153
+    if ($debug) {
1154
+        error_log('WSSubscribeTeacherToSessionCourse');
1155
+    }
1136 1156
 
1137 1157
     if (!WSHelperVerifyKey($params)) {
1138 1158
         return returnError(WS_ERROR_SECRET_KEY);
1139 1159
     }
1140 1160
 
1141
-    if ($debug) error_log('Params '. print_r($params, 1));
1161
+    if ($debug) {
1162
+        error_log('Params '. print_r($params, 1));
1163
+    }
1142 1164
 
1143 1165
     $params = parseCourseSessionUserParams($params);
1144 1166
 
@@ -1152,7 +1174,9 @@  discard block
 block discarded – undo
1152 1174
     $result = 0;
1153 1175
 
1154 1176
     if (!empty($coaches)) {
1155
-        if ($debug) error_log('Coaches:  ' . print_r($coaches, 1));
1177
+        if ($debug) {
1178
+            error_log('Coaches:  ' . print_r($coaches, 1));
1179
+        }
1156 1180
         if (!in_array($userId, $coaches)) {
1157 1181
             $result = 1;
1158 1182
         }
@@ -1160,7 +1184,9 @@  discard block
 block discarded – undo
1160 1184
         $result = 1;
1161 1185
     }
1162 1186
 
1163
-    if ($debug) error_log('Final Result: '. $result);
1187
+    if ($debug) {
1188
+        error_log('Final Result: '. $result);
1189
+    }
1164 1190
 
1165 1191
     return $result;
1166 1192
 }
@@ -1212,8 +1238,12 @@  discard block
 block discarded – undo
1212 1238
 {
1213 1239
     global $_user, $_configuration, $debug;
1214 1240
     $debug = 1;
1215
-    if ($debug) error_log('WSCreateUserPasswordCrypted');
1216
-    if ($debug) error_log(print_r($params,1));
1241
+    if ($debug) {
1242
+        error_log('WSCreateUserPasswordCrypted');
1243
+    }
1244
+    if ($debug) {
1245
+        error_log(print_r($params,1));
1246
+    }
1217 1247
 
1218 1248
     if (!WSHelperVerifyKey($params)) {
1219 1249
         return returnError(WS_ERROR_SECRET_KEY);
@@ -1245,22 +1275,30 @@  discard block
 block discarded – undo
1245 1275
         if ($_configuration['password_encryption'] === $encrypt_method ) {
1246 1276
             if ($encrypt_method == 'md5' && !preg_match('/^[A-Fa-f0-9]{32}$/', $password)) {
1247 1277
                 $msg = "Encryption $encrypt_method is invalid";
1248
-                if ($debug) error_log($msg);
1278
+                if ($debug) {
1279
+                    error_log($msg);
1280
+                }
1249 1281
                 return $msg;
1250 1282
 
1251 1283
             } else if ($encrypt_method == 'sha1' && !preg_match('/^[A-Fa-f0-9]{40}$/', $password)) {
1252 1284
                 $msg = "Encryption $encrypt_method is invalid";
1253
-                if ($debug) error_log($msg);
1285
+                if ($debug) {
1286
+                    error_log($msg);
1287
+                }
1254 1288
                 return $msg;
1255 1289
             }
1256 1290
         } else {
1257 1291
             $msg = "This encryption $encrypt_method is not configured";
1258
-            if ($debug) error_log($msg);
1292
+            if ($debug) {
1293
+                error_log($msg);
1294
+            }
1259 1295
             return $msg;
1260 1296
         }
1261 1297
     } else {
1262 1298
         $msg = 'The chamilo setting $_configuration["password_encryption"] is not configured';
1263
-        if ($debug) error_log($msg);
1299
+        if ($debug) {
1300
+            error_log($msg);
1301
+        }
1264 1302
         return $msg;
1265 1303
     }
1266 1304
 
@@ -1280,10 +1318,14 @@  discard block
 block discarded – undo
1280 1318
         $original_user_id_name
1281 1319
     );
1282 1320
 
1283
-    if ($debug) error_log('Ready to create user');
1321
+    if ($debug) {
1322
+        error_log('Ready to create user');
1323
+    }
1284 1324
 
1285 1325
     if ($user_id > 0) {
1286
-        if ($debug) error_log('User found with id: '.$user_id);
1326
+        if ($debug) {
1327
+            error_log('User found with id: '.$user_id);
1328
+        }
1287 1329
 
1288 1330
         // Check whether user is not active
1289 1331
         //@todo why this condition exists??
@@ -1294,7 +1336,9 @@  discard block
 block discarded – undo
1294 1336
         $count_check_user = Database::num_rows($resu);
1295 1337
         if ($count_check_user > 0) {
1296 1338
 
1297
-            if ($debug) error_log('User id: '.$user_id.' exists and is NOT active. Updating user and setting setting active = 1');
1339
+            if ($debug) {
1340
+                error_log('User id: '.$user_id.' exists and is NOT active. Updating user and setting setting active = 1');
1341
+            }
1298 1342
 
1299 1343
             $sql = "UPDATE $table_user SET
1300 1344
                     lastname='".Database::escape_string($lastName)."',
@@ -1315,7 +1359,9 @@  discard block
 block discarded – undo
1315 1359
                     hr_dept_id=".intval($hr_dept_id)." 
1316 1360
                 WHERE user_id='".$r_check_user[0]."'";
1317 1361
 
1318
-            if ($debug) error_log($sql);
1362
+            if ($debug) {
1363
+                error_log($sql);
1364
+            }
1319 1365
             Database::query($sql);
1320 1366
 
1321 1367
             if (is_array($extra_list) && count($extra_list) > 0) {
@@ -1332,11 +1378,15 @@  discard block
 block discarded – undo
1332 1378
             }
1333 1379
             return $r_check_user[0];
1334 1380
         } else {
1335
-            if ($debug) error_log('User exists but is active. Cant be updated');
1381
+            if ($debug) {
1382
+                error_log('User exists but is active. Cant be updated');
1383
+            }
1336 1384
             return 0;
1337 1385
         }
1338 1386
     } else {
1339
-        if ($debug) error_log("User not found with original_id = $original_user_id_value and original_name = $original_user_id_name");
1387
+        if ($debug) {
1388
+            error_log("User not found with original_id = $original_user_id_value and original_name = $original_user_id_name");
1389
+        }
1340 1390
     }
1341 1391
 
1342 1392
     // Default language.
@@ -1352,7 +1402,9 @@  discard block
 block discarded – undo
1352 1402
 
1353 1403
     // First check wether the login already exists
1354 1404
     if (!UserManager::is_username_available($loginName)) {
1355
-        if ($debug) error_log("Username $loginName is not available");
1405
+        if ($debug) {
1406
+            error_log("Username $loginName is not available");
1407
+        }
1356 1408
         return 0;
1357 1409
     }
1358 1410
 
@@ -1374,7 +1426,9 @@  discard block
 block discarded – undo
1374 1426
             expiration_date     = '".Database::escape_string($expiration_date)."',
1375 1427
             hr_dept_id          = '".Database::escape_string($hr_dept_id)."',
1376 1428
             active              = '".Database::escape_string($active)."'";
1377
-    if ($debug) error_log($sql);
1429
+    if ($debug) {
1430
+        error_log($sql);
1431
+    }
1378 1432
 
1379 1433
     Database::query($sql);
1380 1434
     $return = Database::insert_id();
@@ -1386,7 +1440,9 @@  discard block
 block discarded – undo
1386 1440
 
1387 1441
         $url_id = api_get_current_access_url_id();
1388 1442
         UrlManager::add_user_to_url($return, $url_id);
1389
-        if ($debug) error_log("Adding user_id = $return to URL id $url_id ");
1443
+        if ($debug) {
1444
+            error_log("Adding user_id = $return to URL id $url_id ");
1445
+        }
1390 1446
 
1391 1447
         // Create extra field for the original_user_id_name
1392 1448
         UserManager::create_extra_field(
@@ -1423,7 +1479,9 @@  discard block
 block discarded – undo
1423 1479
             }
1424 1480
         }
1425 1481
     } else {
1426
-        if ($debug) error_log('Error while inserting a user');
1482
+        if ($debug) {
1483
+            error_log('Error while inserting a user');
1484
+        }
1427 1485
 
1428 1486
         return 0;
1429 1487
     }
@@ -4505,7 +4563,9 @@  discard block
 block discarded – undo
4505 4563
     if (!WSHelperVerifyKey($params)) {
4506 4564
         return returnError(WS_ERROR_SECRET_KEY);
4507 4565
     }
4508
-    if ($debug) error_log('WSSubscribeUserToCourse params: '.print_r($params,1));
4566
+    if ($debug) {
4567
+        error_log('WSSubscribeUserToCourse params: '.print_r($params,1));
4568
+    }
4509 4569
 
4510 4570
     $results = array();
4511 4571
     $userscourses = $params['userscourses'];
@@ -4524,7 +4584,9 @@  discard block
 block discarded – undo
4524 4584
             $original_user_id['original_user_id_value'],
4525 4585
             $original_user_id['original_user_id_name']
4526 4586
         );
4527
-        if ($debug) error_log('WSSubscribeUserToCourse user_id: '.$user_id);
4587
+        if ($debug) {
4588
+            error_log('WSSubscribeUserToCourse user_id: '.$user_id);
4589
+        }
4528 4590
 
4529 4591
         if ($user_id == 0) {
4530 4592
             // If user was not found, there was a problem
@@ -4542,13 +4604,19 @@  discard block
 block discarded – undo
4542 4604
                 // Course was not found
4543 4605
                 $resultValue = 0;
4544 4606
             } else {
4545
-                if ($debug) error_log('WSSubscribeUserToCourse courseCode: '.$courseCode);
4607
+                if ($debug) {
4608
+                    error_log('WSSubscribeUserToCourse courseCode: '.$courseCode);
4609
+                }
4546 4610
                 $result = CourseManager::add_user_to_course($user_id, $courseCode, $status, false);
4547 4611
                 if ($result) {
4548 4612
                     $resultValue = 1;
4549
-                    if ($debug) error_log('WSSubscribeUserToCourse subscribed');
4613
+                    if ($debug) {
4614
+                        error_log('WSSubscribeUserToCourse subscribed');
4615
+                    }
4550 4616
                 } else {
4551
-                    if ($debug) error_log('WSSubscribeUserToCourse NOT subscribed: ');
4617
+                    if ($debug) {
4618
+                        error_log('WSSubscribeUserToCourse NOT subscribed: ');
4619
+                    }
4552 4620
                 }
4553 4621
             }
4554 4622
         }
@@ -4607,8 +4675,12 @@  discard block
 block discarded – undo
4607 4675
 function WSSubscribeUserToCourseSimple($params) {
4608 4676
     global $debug;
4609 4677
 
4610
-    if ($debug) error_log('WSSubscribeUserToCourseSimple');
4611
-    if ($debug) error_log('Params '. print_r($params, 1));
4678
+    if ($debug) {
4679
+        error_log('WSSubscribeUserToCourseSimple');
4680
+    }
4681
+    if ($debug) {
4682
+        error_log('Params '. print_r($params, 1));
4683
+    }
4612 4684
     if (!WSHelperVerifyKey($params)) {
4613 4685
         return returnError(WS_ERROR_SECRET_KEY);
4614 4686
     }
@@ -4626,7 +4698,9 @@  discard block
 block discarded – undo
4626 4698
     if (empty($user_data)) {
4627 4699
         // If user was not found, there was a problem
4628 4700
         $result = "User $user_id does not exist";
4629
-        if ($debug) error_log($result);
4701
+        if ($debug) {
4702
+            error_log($result);
4703
+        }
4630 4704
         return $result;
4631 4705
     }
4632 4706
     if (!empty($course_code)) {
@@ -4634,14 +4708,22 @@  discard block
 block discarded – undo
4634 4708
         if (empty($course_data)) {
4635 4709
             // Course was not found
4636 4710
             $result = "Course $course_code does not exist in the platform ";
4637
-            if ($debug) error_log($result);
4711
+            if ($debug) {
4712
+                error_log($result);
4713
+            }
4638 4714
         } else {
4639
-            if ($debug) error_log('Try to register: user_id= '.$user_id.' to course: '.$course_data['code']);
4715
+            if ($debug) {
4716
+                error_log('Try to register: user_id= '.$user_id.' to course: '.$course_data['code']);
4717
+            }
4640 4718
             if (!CourseManager::add_user_to_course($user_id, $course_data['code'], $status)) {
4641 4719
                 $result = 'User was not registered possible reasons: User already registered to the course, Course visibility doesnt allow user subscriptions ';
4642
-                if ($debug) error_log($result);
4720
+                if ($debug) {
4721
+                    error_log($result);
4722
+                }
4643 4723
             } else {
4644
-                if ($debug) error_log('User registered to the course: '.$course_data['code']);
4724
+                if ($debug) {
4725
+                    error_log('User registered to the course: '.$course_data['code']);
4726
+                }
4645 4727
                 $result = 1;
4646 4728
             }
4647 4729
         }
@@ -4694,8 +4776,12 @@  discard block
 block discarded – undo
4694 4776
 function WSGetUser($params)
4695 4777
 {
4696 4778
     global $debug;
4697
-    if ($debug) error_log('WSGetUser');
4698
-    if ($debug) error_log('$params: '.print_r($params, 1));
4779
+    if ($debug) {
4780
+        error_log('WSGetUser');
4781
+    }
4782
+    if ($debug) {
4783
+        error_log('$params: '.print_r($params, 1));
4784
+    }
4699 4785
 
4700 4786
     if (!WSHelperVerifyKey($params)) {
4701 4787
         return returnError(WS_ERROR_SECRET_KEY);
@@ -4749,8 +4835,12 @@  discard block
 block discarded – undo
4749 4835
 function WSGetUserFromUsername($params)
4750 4836
 {
4751 4837
     global $debug;
4752
-    if ($debug) error_log('WSGetUserFromUsername');
4753
-    if ($debug) error_log('$params: '.print_r($params, 1));
4838
+    if ($debug) {
4839
+        error_log('WSGetUserFromUsername');
4840
+    }
4841
+    if ($debug) {
4842
+        error_log('$params: '.print_r($params, 1));
4843
+    }
4754 4844
 
4755 4845
     if (!WSHelperVerifyKey($params)) {
4756 4846
         return returnError(WS_ERROR_SECRET_KEY);
@@ -5217,7 +5307,9 @@  discard block
 block discarded – undo
5217 5307
                 SessionManager::suscribe_users_to_session($sessionId, array($user_id), SESSION_VISIBLE_READ_ONLY, false);
5218 5308
                 $results[] = 1;
5219 5309
 
5220
-                if ($debug) error_log("subscribe user:$user_id to session $sessionId");
5310
+                if ($debug) {
5311
+                    error_log("subscribe user:$user_id to session $sessionId");
5312
+                }
5221 5313
             }
5222 5314
         }
5223 5315
     } // end principal foreach
@@ -5301,7 +5393,9 @@  discard block
 block discarded – undo
5301 5393
                 SESSION_VISIBLE_READ_ONLY,
5302 5394
                 false
5303 5395
             );
5304
-            if ($debug) error_log('User registered to the course: '.$session_id);
5396
+            if ($debug) {
5397
+                error_log('User registered to the course: '.$session_id);
5398
+            }
5305 5399
             $result = 1;
5306 5400
         }
5307 5401
     }
@@ -5449,7 +5543,9 @@  discard block
 block discarded – undo
5449 5543
 
5450 5544
                 $results[] = 1;
5451 5545
 
5452
-                if ($debug) error_log("Unsubscribe user:$user_id to session:$id_session");
5546
+                if ($debug) {
5547
+                    error_log("Unsubscribe user:$user_id to session:$id_session");
5548
+                }
5453 5549
             }
5454 5550
         }
5455 5551
     } // end principal foreach
@@ -5596,7 +5692,9 @@  discard block
 block discarded – undo
5596 5692
         return returnError(WS_ERROR_SECRET_KEY);
5597 5693
     }
5598 5694
 
5599
-    if ($debug) error_log('WSSuscribeCoursesToSession: '.print_r($params, 1));
5695
+    if ($debug) {
5696
+        error_log('WSSuscribeCoursesToSession: '.print_r($params, 1));
5697
+    }
5600 5698
 
5601 5699
     $coursessessions_params = $params['coursessessions'];
5602 5700
     $results = array();
@@ -5642,7 +5740,9 @@  discard block
 block discarded – undo
5642 5740
                     array($courseInfo['real_id']),
5643 5741
                     false
5644 5742
                 );
5645
-                if ($debug) error_log("add_courses_to_session: course:$courseCode to session:$sessionId");
5743
+                if ($debug) {
5744
+                    error_log("add_courses_to_session: course:$courseCode to session:$sessionId");
5745
+                }
5646 5746
 
5647 5747
                 $results[] = 1;
5648 5748
             }
@@ -6915,7 +7015,9 @@  discard block
 block discarded – undo
6915 7015
     if (!WSHelperVerifyKey($params)) {
6916 7016
         return returnError(WS_ERROR_SECRET_KEY);
6917 7017
     }
6918
-    if ($debug) error_log('WSAddUserVisibilityToCourseCatalogue params: '.print_r($params, 1));
7018
+    if ($debug) {
7019
+        error_log('WSAddUserVisibilityToCourseCatalogue params: '.print_r($params, 1));
7020
+    }
6919 7021
 
6920 7022
     $results = array();
6921 7023
     $userscourses = $params['userscourses'];
@@ -6931,7 +7033,9 @@  discard block
 block discarded – undo
6931 7033
             $original_user_id['original_user_id_value'],
6932 7034
             $original_user_id['original_user_id_name']
6933 7035
         );
6934
-        if ($debug) error_log('WSAddUserVisibilityToCourseCatalogue userId: '.$userId);
7036
+        if ($debug) {
7037
+            error_log('WSAddUserVisibilityToCourseCatalogue userId: '.$userId);
7038
+        }
6935 7039
 
6936 7040
         if ($userId == 0) {
6937 7041
             // If user was not found, there was a problem
@@ -6948,13 +7052,19 @@  discard block
 block discarded – undo
6948 7052
                 // Course was not found
6949 7053
                 $resultValue = 0;
6950 7054
             } else {
6951
-                if ($debug) error_log('WSAddUserVisibilityToCourseCatalogue courseCode: '.$courseCode);
7055
+                if ($debug) {
7056
+                    error_log('WSAddUserVisibilityToCourseCatalogue courseCode: '.$courseCode);
7057
+                }
6952 7058
                 $result = CourseManager::addUserVisibilityToCourseInCatalogue($userId, $courseCode, $visible);
6953 7059
                 if ($result) {
6954 7060
                     $resultValue = 1;
6955
-                    if ($debug) error_log('WSAddUserVisibilityToCourseCatalogue registered');
7061
+                    if ($debug) {
7062
+                        error_log('WSAddUserVisibilityToCourseCatalogue registered');
7063
+                    }
6956 7064
                 } else {
6957
-                    if ($debug) error_log('WSAddUserVisibilityToCourseCatalogue NOT registered: ');
7065
+                    if ($debug) {
7066
+                        error_log('WSAddUserVisibilityToCourseCatalogue NOT registered: ');
7067
+                    }
6958 7068
                 }
6959 7069
             }
6960 7070
         }
@@ -6987,7 +7097,9 @@  discard block
 block discarded – undo
6987 7097
     if (!WSHelperVerifyKey($params)) {
6988 7098
         return returnError(WS_ERROR_SECRET_KEY);
6989 7099
     }
6990
-    if ($debug) error_log('WSRemoveUserVisibilityToCourseInCatalogue params: '.print_r($params, 1));
7100
+    if ($debug) {
7101
+        error_log('WSRemoveUserVisibilityToCourseInCatalogue params: '.print_r($params, 1));
7102
+    }
6991 7103
 
6992 7104
     $results = array();
6993 7105
     $userscourses = $params['userscourses'];
@@ -7003,7 +7115,9 @@  discard block
 block discarded – undo
7003 7115
             $original_user_id['original_user_id_value'],
7004 7116
             $original_user_id['original_user_id_name']
7005 7117
         );
7006
-        if ($debug) error_log('WSRemoveUserVisibilityToCourseInCatalogue user_id: '.$userId);
7118
+        if ($debug) {
7119
+            error_log('WSRemoveUserVisibilityToCourseInCatalogue user_id: '.$userId);
7120
+        }
7007 7121
 
7008 7122
         if ($userId == 0) {
7009 7123
             // If user was not found, there was a problem
@@ -7021,13 +7135,19 @@  discard block
 block discarded – undo
7021 7135
                 // Course was not found
7022 7136
                 $resultValue = 0;
7023 7137
             } else {
7024
-                if ($debug) error_log('WSRemoveUserVisibilityToCourseInCatalogue courseCode: '.$courseCode);
7138
+                if ($debug) {
7139
+                    error_log('WSRemoveUserVisibilityToCourseInCatalogue courseCode: '.$courseCode);
7140
+                }
7025 7141
                 $result = CourseManager::removeUserVisibilityToCourseInCatalogue($userId, $courseCode, $visible);
7026 7142
                 if ($result) {
7027 7143
                     $resultValue = 1;
7028
-                    if ($debug) error_log('WSRemoveUserVisibilityToCourseInCatalogue removed');
7144
+                    if ($debug) {
7145
+                        error_log('WSRemoveUserVisibilityToCourseInCatalogue removed');
7146
+                    }
7029 7147
                 } else {
7030
-                    if ($debug) error_log('WSRemoveUserVisibilityToCourseInCatalogue NOT removed: ');
7148
+                    if ($debug) {
7149
+                        error_log('WSRemoveUserVisibilityToCourseInCatalogue NOT removed: ');
7150
+                    }
7031 7151
                 }
7032 7152
             }
7033 7153
         }
Please login to merge, or discard this patch.
main/install/install.lib.php 1 patch
Braces   +12 added lines, -7 removed lines patch added patch discarded remove patch
@@ -972,8 +972,7 @@  discard block
 block discarded – undo
972 972
                 <?php echo get_lang('Error'); ?>!<br />
973 973
                 Chamilo <?php echo implode('|', $update_from_version_8).' '.get_lang('HasNotBeenFoundInThatDir'); ?>.
974 974
             </div>
975
-        <?php }
976
-        else {
975
+        <?php } else {
977 976
             echo '<br />';
978 977
         }
979 978
         ?>
@@ -1088,7 +1087,10 @@  discard block
 block discarded – undo
1088 1087
         <button type="submit" name="step1" class="btn btn-default" onclick="javascript: window.location='index.php'; return false;" value="<?php echo get_lang('Previous'); ?>" >
1089 1088
             <em class="fa fa-backward"> </em> <?php echo get_lang('Previous'); ?>
1090 1089
         </button>
1091
-        <button type="submit" name="step2_install" class="btn btn-success" value="<?php echo get_lang("NewInstallation"); ?>" <?php if ($error) echo 'disabled="disabled"'; ?> >
1090
+        <button type="submit" name="step2_install" class="btn btn-success" value="<?php echo get_lang("NewInstallation"); ?>" <?php if ($error) {
1091
+    echo 'disabled="disabled"';
1092
+}
1093
+?> >
1092 1094
             <em class="fa fa-forward"> </em> <?php echo get_lang('NewInstallation'); ?>
1093 1095
         </button>
1094 1096
         <input type="hidden" name="is_executable" id="is_executable" value="-" />
@@ -1374,7 +1376,7 @@  discard block
 block discarded – undo
1374 1376
                 <input type="hidden" name="dbHostForm" value="<?php echo htmlentities($dbHostForm); ?>" /><?php echo $dbHostForm; ?>
1375 1377
             </div>
1376 1378
             <div class="col-sm-3"></div>
1377
-            <?php }else{ ?>
1379
+            <?php } else{ ?>
1378 1380
             <div class="col-sm-5">
1379 1381
                 <input type="text" class="form-control" size="25" maxlength="50" name="dbHostForm" value="<?php echo htmlentities($dbHostForm); ?>" />
1380 1382
             </div>
@@ -1388,7 +1390,7 @@  discard block
 block discarded – undo
1388 1390
                 <input type="hidden" name="dbPortForm" value="<?php echo htmlentities($dbPortForm); ?>" /><?php echo $dbPortForm; ?>
1389 1391
             </div>
1390 1392
             <div class="col-sm-3"></div>
1391
-            <?php }else{ ?>
1393
+            <?php } else{ ?>
1392 1394
             <div class="col-sm-5">
1393 1395
                 <input type="text" class="form-control" size="25" maxlength="50" name="dbPortForm" value="<?php echo htmlentities($dbPortForm); ?>" />
1394 1396
             </div>
@@ -1470,9 +1472,12 @@  discard block
 block discarded – undo
1470 1472
             Database port: <strong><?php echo $manager->getConnection()->getPort(); ?></strong><br/>
1471 1473
             Database driver: <strong><?php echo $manager->getConnection()->getDriver()->getName(); ?></strong><br/>
1472 1474
         </div>
1473
-    <?php else: ?>
1475
+    <?php else {
1476
+    : ?>
1474 1477
         <div id="db_status" class="alert alert-danger">
1475
-            <p><?php echo get_lang('FailedConectionDatabase'); ?></strong></p>
1478
+            <p><?php echo get_lang('FailedConectionDatabase');
1479
+}
1480
+?></strong></p>
1476 1481
             <code><?php echo $database_exists_text ?></code>
1477 1482
         </div>
1478 1483
     <?php endif; ?>
Please login to merge, or discard this patch.
main/admin/access_url_edit_courses_to_url.php 1 patch
Braces   +5 added lines, -4 removed lines patch added patch discarded remove patch
@@ -260,10 +260,11 @@
 block discarded – undo
260 260
 				<td colspan="3" align="center">
261 261
 					<br />
262 262
 					<?php
263
-					if(isset($_GET['add']))
264
-						echo '<button class="btn btn-default" onclick="valide()" >'.get_lang('AddCoursesToURL').'</button>';
265
-					else
266
-						echo '<button class="btn btn-default" onclick="valide()" >'.get_lang('EditCoursesToURL').'</button>';
263
+					if(isset($_GET['add'])) {
264
+											echo '<button class="btn btn-default" onclick="valide()" >'.get_lang('AddCoursesToURL').'</button>';
265
+					} else {
266
+											echo '<button class="btn btn-default" onclick="valide()" >'.get_lang('EditCoursesToURL').'</button>';
267
+					}
267 268
 					?>
268 269
 				</td>
269 270
 			</tr>
Please login to merge, or discard this patch.
main/lp/aicc.class.php 1 patch
Braces   +21 added lines, -13 removed lines patch added patch discarded remove patch
@@ -509,7 +509,9 @@  discard block
 block discarded – undo
509 509
                     if ($file != '.' && $file != '..') {
510 510
                         $filetype = 'file';
511 511
 
512
-                        if (is_dir($course_sys_dir.$new_dir.$file)) $filetype = 'folder';
512
+                        if (is_dir($course_sys_dir.$new_dir.$file)) {
513
+                            $filetype = 'folder';
514
+                        }
513 515
 
514 516
                         // TODO: RENAMING FILES CAN BE VERY DANGEROUS AICC-WISE, avoid that as much as possible!
515 517
                         //$safe_file = api_replace_dangerous_char($file, 'strict');
@@ -908,37 +910,43 @@  discard block
 block discarded – undo
908 910
                     if ($enclosed && $data{$i+1} == $enclosure) {
909 911
                         $fldval .= $chr;
910 912
                         ++$i; // Skip the next character.
911
-                    } else
912
-                        $enclosed = !$enclosed;
913
+                    } else {
914
+                                            $enclosed = !$enclosed;
915
+                    }
913 916
                     break;
914 917
                 case $delim:
915 918
                     if (!$enclosed) {
916 919
                         $ret_array[$linecount][$fldcount++] = $fldval;
917 920
                         $fldval = '';
918
-                    } else
919
-                        $fldval .= $chr;
921
+                    } else {
922
+                                            $fldval .= $chr;
923
+                    }
920 924
                     break;
921 925
                 case "\r":
922
-                    if (!$enclosed&&$data{$i+1} == "\n")
923
-                        continue;
926
+                    if (!$enclosed&&$data{$i+1} == "\n") {
927
+                                            continue;
928
+                    }
924 929
                 case "\n":
925 930
                     if (!$enclosed) {
926 931
                         $ret_array[$linecount++][$fldcount] = $fldval;
927 932
                         $fldcount = 0;
928 933
                         $fldval = '';
929
-                    } else
930
-                        $fldval .= $chr;
934
+                    } else {
935
+                                            $fldval .= $chr;
936
+                    }
931 937
                     break;
932 938
                 case "\\r":
933
-                    if (!$enclosed&&$data{$i+1} == "\\n")
934
-                        continue;
939
+                    if (!$enclosed&&$data{$i+1} == "\\n") {
940
+                                            continue;
941
+                    }
935 942
                 case "\\n":
936 943
                     if (!$enclosed) {
937 944
                         $ret_array[$linecount++][$fldcount] = $fldval;
938 945
                         $fldcount = 0;
939 946
                         $fldval = '';
940
-                    } else
941
-                        $fldval .= $chr;
947
+                    } else {
948
+                                            $fldval .= $chr;
949
+                    }
942 950
                     break;
943 951
                 default:
944 952
                     $fldval .= $chr;
Please login to merge, or discard this patch.
main/lp/lp_controller.php 1 patch
Braces   +86 added lines, -36 removed lines patch added patch discarded remove patch
@@ -13,7 +13,9 @@  discard block
 block discarded – undo
13 13
 $use_anonymous = true;
14 14
 
15 15
 $debug = 0;
16
-if ($debug > 0) error_log('New LP -+- Entered lp_controller.php -+- (action: '.$_REQUEST['action'].')', 0);
16
+if ($debug > 0) {
17
+    error_log('New LP -+- Entered lp_controller.php -+- (action: '.$_REQUEST['action'].')', 0);
18
+}
17 19
 
18 20
 // Language files that needs to be included.
19 21
 if (isset($_GET['action'])) {
@@ -209,10 +211,14 @@  discard block
 block discarded – undo
209 211
     // If refresh is set, we regenerate the oLP object from the database (kind of flush).
210 212
     Session::erase('refresh');
211 213
     $myrefresh = 1;
212
-    if ($debug > 0) error_log('New LP - Refresh asked', 0);
213
-}
214
+    if ($debug > 0) {
215
+        error_log('New LP - Refresh asked', 0);
216
+    }
217
+    }
214 218
 
215
-if ($debug > 0) error_log('New LP - Passed refresh check', 0);
219
+if ($debug > 0) {
220
+    error_log('New LP - Passed refresh check', 0);
221
+}
216 222
 
217 223
 if (!empty($_REQUEST['dialog_box'])) {
218 224
     $dialog_box = stripslashes(urldecode($_REQUEST['dialog_box']));
@@ -222,17 +228,23 @@  discard block
 block discarded – undo
222 228
 $lp_found = false;
223 229
 
224 230
 if (isset($_SESSION['lpobject'])) {
225
-    if ($debug > 0) error_log('New LP - SESSION[lpobject] is defined', 0);
231
+    if ($debug > 0) {
232
+        error_log('New LP - SESSION[lpobject] is defined', 0);
233
+    }
226 234
     $oLP = unserialize($_SESSION['lpobject']);
227 235
     if (isset($oLP) && is_object($oLP)) {
228
-        if ($debug > 0) error_log('New LP - oLP is object', 0);
236
+        if ($debug > 0) {
237
+            error_log('New LP - oLP is object', 0);
238
+        }
229 239
         if ($myrefresh == 1 ||
230 240
             empty($oLP->cc) ||
231 241
             $oLP->cc != api_get_course_id() ||
232 242
             $oLP->lp_view_session_id != $session_id ||
233 243
             $oLP->scorm_debug == '1'
234 244
         ) {
235
-            if ($debug > 0) error_log('New LP - Course has changed, discard lp object', 0);
245
+            if ($debug > 0) {
246
+                error_log('New LP - Course has changed, discard lp object', 0);
247
+            }
236 248
             if ($myrefresh == 1) { $myrefresh_id = $oLP->get_id(); }
237 249
             $oLP = null;
238 250
             Session::erase('oLP');
@@ -246,13 +258,19 @@  discard block
 block discarded – undo
246 258
 
247 259
 $course_id = api_get_course_int_id();
248 260
 
249
-if ($debug>0) error_log('New LP - Passed data remains check', 0);
261
+if ($debug>0) {
262
+    error_log('New LP - Passed data remains check', 0);
263
+}
250 264
 
251 265
 if (!$lp_found || (!empty($_REQUEST['lp_id']) && $_SESSION['oLP']->get_id() != $_REQUEST['lp_id'])) {
252
-    if ($debug > 0) error_log('New LP - oLP is not object, has changed or refresh been asked, getting new', 0);
266
+    if ($debug > 0) {
267
+        error_log('New LP - oLP is not object, has changed or refresh been asked, getting new', 0);
268
+    }
253 269
     // Regenerate a new lp object? Not always as some pages don't need the object (like upload?)
254 270
     if (!empty($_REQUEST['lp_id']) || !empty($myrefresh_id)) {
255
-        if ($debug > 0) error_log('New LP - lp_id is defined', 0);
271
+        if ($debug > 0) {
272
+            error_log('New LP - lp_id is defined', 0);
273
+        }
256 274
         // Select the lp in the database and check which type it is (scorm/dokeos/aicc) to generate the
257 275
         // right object.
258 276
         if (!empty($_REQUEST['lp_id'])) {
@@ -264,16 +282,22 @@  discard block
 block discarded – undo
264 282
         $lp_table = Database::get_course_table(TABLE_LP_MAIN);
265 283
         if (is_numeric($lp_id)) {
266 284
             $sel = "SELECT lp_type FROM $lp_table WHERE c_id = $course_id AND id = $lp_id";
267
-            if ($debug > 0) error_log('New LP - querying '.$sel, 0);
285
+            if ($debug > 0) {
286
+                error_log('New LP - querying '.$sel, 0);
287
+            }
268 288
             $res = Database::query($sel);
269 289
 
270 290
             if (Database::num_rows($res)) {
271 291
                 $row = Database::fetch_array($res);
272 292
                 $type = $row['lp_type'];
273
-                if ($debug > 0) error_log('New LP - found row - type '.$type. ' - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
293
+                if ($debug > 0) {
294
+                    error_log('New LP - found row - type '.$type. ' - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
295
+                }
274 296
                 switch ($type) {
275 297
                     case 1:
276
-                        if ($debug > 0) error_log('New LP - found row - type dokeos - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
298
+                        if ($debug > 0) {
299
+                            error_log('New LP - found row - type dokeos - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
300
+                        }
277 301
 
278 302
                         $oLP = new learnpath(api_get_course_id(), $lp_id, api_get_user_id());
279 303
                         if ($oLP !== false) {
@@ -283,7 +307,9 @@  discard block
 block discarded – undo
283 307
                         }
284 308
                         break;
285 309
                     case 2:
286
-                        if ($debug > 0) error_log('New LP - found row - type scorm - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
310
+                        if ($debug > 0) {
311
+                            error_log('New LP - found row - type scorm - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
312
+                        }
287 313
                         $oLP = new scorm(api_get_course_id(), $lp_id, api_get_user_id());
288 314
                         if ($oLP !== false) {
289 315
                             $lp_found = true;
@@ -292,7 +318,9 @@  discard block
 block discarded – undo
292 318
                         }
293 319
                         break;
294 320
                     case 3:
295
-                        if ($debug > 0) error_log('New LP - found row - type aicc - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
321
+                        if ($debug > 0) {
322
+                            error_log('New LP - found row - type aicc - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
323
+                        }
296 324
                         $oLP = new aicc(api_get_course_id(), $lp_id, api_get_user_id());
297 325
                         if ($oLP !== false) {
298 326
                             $lp_found = true;
@@ -301,7 +329,9 @@  discard block
 block discarded – undo
301 329
                         }
302 330
                         break;
303 331
                     default:
304
-                        if ($debug > 0) error_log('New LP - found row - type other - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
332
+                        if ($debug > 0) {
333
+                            error_log('New LP - found row - type other - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
334
+                        }
305 335
                         $oLP = new learnpath(api_get_course_id(), $lp_id, api_get_user_id());
306 336
                         if ($oLP !== false) {
307 337
                             $lp_found = true;
@@ -312,17 +342,23 @@  discard block
 block discarded – undo
312 342
                 }
313 343
             }
314 344
         } else {
315
-            if ($debug > 0) error_log('New LP - Request[lp_id] is not numeric', 0);
345
+            if ($debug > 0) {
346
+                error_log('New LP - Request[lp_id] is not numeric', 0);
347
+            }
316 348
         }
317 349
     } else {
318
-        if ($debug > 0) error_log('New LP - Request[lp_id] and refresh_id were empty', 0);
350
+        if ($debug > 0) {
351
+            error_log('New LP - Request[lp_id] and refresh_id were empty', 0);
352
+        }
319 353
     }
320 354
     if ($lp_found) {
321 355
         $_SESSION['oLP'] = $oLP;
322 356
     }
323 357
 }
324 358
 
325
-if ($debug > 0) error_log('New LP - Passed oLP creation check', 0);
359
+if ($debug > 0) {
360
+    error_log('New LP - Passed oLP creation check', 0);
361
+}
326 362
 
327 363
 $is_allowed_to_edit = api_is_allowed_to_edit(false, true, false, false);
328 364
 
@@ -359,7 +395,9 @@  discard block
 block discarded – undo
359 395
 }
360 396
 
361 397
 $redirectTo = '';
362
-if ($debug > 0) error_log('New LP - action "'.$action.'" triggered');
398
+if ($debug > 0) {
399
+    error_log('New LP - action "'.$action.'" triggered');
400
+}
363 401
 
364 402
 switch ($action) {
365 403
     case 'add_item':
@@ -368,7 +406,9 @@  discard block
 block discarded – undo
368 406
         }
369 407
         if (!$lp_found) {
370 408
             //check if the learnpath ID was defined, otherwise send back to list
371
-            if ($debug > 0) error_log('New LP - No learnpath given for add item', 0);
409
+            if ($debug > 0) {
410
+                error_log('New LP - No learnpath given for add item', 0);
411
+            }
372 412
             require 'lp_list.php';
373 413
         } else {
374 414
             $_SESSION['refresh'] = 1;
@@ -458,7 +498,9 @@  discard block
 block discarded – undo
458 498
         }
459 499
         if (!$lp_found) {
460 500
             //check if the learnpath ID was defined, otherwise send back to list
461
-            if ($debug > 0) error_log('New LP - No learnpath given for add audio', 0);
501
+            if ($debug > 0) {
502
+                error_log('New LP - No learnpath given for add audio', 0);
503
+            }
462 504
             require 'lp_list.php';
463 505
         } else {
464 506
             $_SESSION['refresh'] = 1;
@@ -606,8 +648,7 @@  discard block
 block discarded – undo
606 648
             if (!$is_allowed_to_edit) {
607 649
                 api_not_allowed(true);
608 650
             }
609
-            if (!$lp_found) { error_log('New LP - No learnpath given for set_autolaunch', 0); require 'lp_list.php'; }
610
-            else {
651
+            if (!$lp_found) { error_log('New LP - No learnpath given for set_autolaunch', 0); require 'lp_list.php'; } else {
611 652
                 $_SESSION['oLP']->set_autolaunch($_GET['lp_id'], $_GET['status']);
612 653
                 require 'lp_list.php';
613 654
                 exit;
@@ -688,8 +729,7 @@  discard block
 block discarded – undo
688 729
         if (!$is_allowed_to_edit) {
689 730
             api_not_allowed(true);
690 731
         }
691
-        if (!$lp_found) { error_log('New LP - No learnpath given for edit item prereq', 0); require 'lp_list.php'; }
692
-        else {
732
+        if (!$lp_found) { error_log('New LP - No learnpath given for edit item prereq', 0); require 'lp_list.php'; } else {
693 733
             if (isset($_POST['submit_button'])) {
694 734
                 //Updating the lp.modified_on
695 735
                 $_SESSION['oLP']->set_modified_on();
@@ -983,8 +1023,9 @@  discard block
 block discarded – undo
983 1023
             );
984 1024
             $extraFieldValue->saveFieldValues($_REQUEST);
985 1025
 
986
-            if ($_FILES['lp_preview_image']['size'] > 0)
987
-                $_SESSION['oLP']->upload_image($_FILES['lp_preview_image']);
1026
+            if ($_FILES['lp_preview_image']['size'] > 0) {
1027
+                            $_SESSION['oLP']->upload_image($_FILES['lp_preview_image']);
1028
+            }
988 1029
 
989 1030
             if (api_get_setting('search_enabled') === 'true') {
990 1031
                 require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php';
@@ -1117,16 +1158,24 @@  discard block
 block discarded – undo
1117 1158
         }
1118 1159
         break;
1119 1160
     case 'content':
1120
-        if ($debug > 0) error_log('New LP - Item id is '.intval($_GET['item_id']), 0);
1161
+        if ($debug > 0) {
1162
+            error_log('New LP - Item id is '.intval($_GET['item_id']), 0);
1163
+        }
1121 1164
         if (!$lp_found) {
1122 1165
             error_log('New LP - No learnpath given for content', 0);
1123 1166
             require 'lp_list.php';
1124 1167
         } else {
1125
-            if ($debug > 0) error_log('New LP - save_last()', 0);
1168
+            if ($debug > 0) {
1169
+                error_log('New LP - save_last()', 0);
1170
+            }
1126 1171
             $_SESSION['oLP']->save_last();
1127
-            if ($debug > 0) error_log('New LP - set_current_item()', 0);
1172
+            if ($debug > 0) {
1173
+                error_log('New LP - set_current_item()', 0);
1174
+            }
1128 1175
             $_SESSION['oLP']->set_current_item($_GET['item_id']);
1129
-            if ($debug > 0) error_log('New LP - start_current_item()', 0);
1176
+            if ($debug > 0) {
1177
+                error_log('New LP - start_current_item()', 0);
1178
+            }
1130 1179
             $_SESSION['oLP']->start_current_item();
1131 1180
             require 'lp_content.php';
1132 1181
         }
@@ -1242,8 +1291,7 @@  discard block
 block discarded – undo
1242 1291
         require 'lp_message.php';
1243 1292
         break;
1244 1293
     case 'return_to_course_homepage':
1245
-        if (!$lp_found) { error_log('New LP - No learnpath given for stats', 0); require 'lp_list.php'; }
1246
-        else {
1294
+        if (!$lp_found) { error_log('New LP - No learnpath given for stats', 0); require 'lp_list.php'; } else {
1247 1295
             $_SESSION['oLP']->save_current();
1248 1296
             $_SESSION['oLP']->save_last();
1249 1297
             $url = api_get_path(WEB_COURSE_PATH).api_get_course_path().'/index.php?id_session='.api_get_session_id();
@@ -1436,8 +1484,10 @@  discard block
 block discarded – undo
1436 1484
 
1437 1485
 if (!empty($_SESSION['oLP'])) {
1438 1486
     $_SESSION['lpobject'] = serialize($_SESSION['oLP']);
1439
-    if ($debug > 0) error_log('New LP - lpobject is serialized in session', 0);
1440
-}
1487
+    if ($debug > 0) {
1488
+        error_log('New LP - lpobject is serialized in session', 0);
1489
+    }
1490
+    }
1441 1491
 
1442 1492
 if (!empty($redirectTo)) {
1443 1493
     header("Location: $redirectTo");
Please login to merge, or discard this patch.
main/admin/configure_extensions.php 1 patch
Braces   +5 added lines, -3 removed lines patch added patch discarded remove patch
@@ -135,8 +135,8 @@  discard block
 block discarded – undo
135 135
 ?>
136 136
 <div id="message" style="display: none">
137 137
 	<?php
138
-	if(!empty($message))
139
-		Display::display_normal_message($message)
138
+	if(!empty($message)) {
139
+			Display::display_normal_message($message)
140 140
 	?>
141 141
 </div>
142 142
 
@@ -150,7 +150,9 @@  discard block
 block discarded – undo
150 150
     </div>
151 151
         <div class="row">
152 152
             <div class="col-md-5">
153
-                <?php Display::display_icon('screenshot_ppt2lp.jpg', get_lang('Ppt2lp'), array('class'=>'img-responsive')); ?>
153
+                <?php Display::display_icon('screenshot_ppt2lp.jpg', get_lang('Ppt2lp'), array('class'=>'img-responsive'));
154
+	}
155
+	?>
154 156
             </div>
155 157
             <div class="col-md-7">
156 158
                 <form method="POST" class="form-horizontal" action="<?php echo api_get_self(); ?>">
Please login to merge, or discard this patch.
main/inc/lib/usermanager.lib.php 1 patch
Braces   +88 added lines, -56 removed lines patch added patch discarded remove patch
@@ -2165,8 +2165,9 @@  discard block
 block discarded – undo
2165 2165
         if (empty($user_id)) {
2166 2166
             $user_id = 0;
2167 2167
         } else {
2168
-            if ($user_id != strval(intval($user_id)))
2169
-                return array();
2168
+            if ($user_id != strval(intval($user_id))) {
2169
+                            return array();
2170
+            }
2170 2171
         }
2171 2172
         $extra_data = array();
2172 2173
         $t_uf = Database::get_main_table(TABLE_EXTRA_FIELD);
@@ -2258,8 +2259,9 @@  discard block
 block discarded – undo
2258 2259
         if (empty($user_id)) {
2259 2260
             $user_id = 0;
2260 2261
         } else {
2261
-            if ($user_id != strval(intval($user_id)))
2262
-                return array();
2262
+            if ($user_id != strval(intval($user_id))) {
2263
+                            return array();
2264
+            }
2263 2265
         }
2264 2266
         $extra_data = array();
2265 2267
         $t_uf = Database::get_main_table(TABLE_EXTRA_FIELD);
@@ -3042,13 +3044,15 @@  discard block
 block discarded – undo
3042 3044
      */
3043 3045
     public static function get_api_keys($user_id = null, $api_service = 'dokeos')
3044 3046
     {
3045
-        if ($user_id != strval(intval($user_id)))
3046
-            return false;
3047
+        if ($user_id != strval(intval($user_id))) {
3048
+                    return false;
3049
+        }
3047 3050
         if (empty($user_id)) {
3048 3051
             $user_id = api_get_user_id();
3049 3052
         }
3050
-        if ($user_id === false)
3051
-            return false;
3053
+        if ($user_id === false) {
3054
+                    return false;
3055
+        }
3052 3056
         $service_name = Database::escape_string($api_service);
3053 3057
         if (is_string($service_name) === false) {
3054 3058
             return false;
@@ -3056,11 +3060,14 @@  discard block
 block discarded – undo
3056 3060
         $t_api = Database::get_main_table(TABLE_MAIN_USER_API_KEY);
3057 3061
         $sql = "SELECT * FROM $t_api WHERE user_id = $user_id AND api_service='$api_service';";
3058 3062
         $res = Database::query($sql);
3059
-        if ($res === false)
3060
-            return false; //error during query
3063
+        if ($res === false) {
3064
+                    return false;
3065
+        }
3066
+        //error during query
3061 3067
         $num = Database::num_rows($res);
3062
-        if ($num == 0)
3063
-            return false;
3068
+        if ($num == 0) {
3069
+                    return false;
3070
+        }
3064 3071
         $list = array();
3065 3072
         while ($row = Database::fetch_array($res)) {
3066 3073
             $list[$row['id']] = $row['api_key'];
@@ -3075,13 +3082,15 @@  discard block
 block discarded – undo
3075 3082
      */
3076 3083
     public static function add_api_key($user_id = null, $api_service = 'dokeos')
3077 3084
     {
3078
-        if ($user_id != strval(intval($user_id)))
3079
-            return false;
3085
+        if ($user_id != strval(intval($user_id))) {
3086
+                    return false;
3087
+        }
3080 3088
         if (empty($user_id)) {
3081 3089
             $user_id = api_get_user_id();
3082 3090
         }
3083
-        if ($user_id === false)
3084
-            return false;
3091
+        if ($user_id === false) {
3092
+                    return false;
3093
+        }
3085 3094
         $service_name = Database::escape_string($api_service);
3086 3095
         if (is_string($service_name) === false) {
3087 3096
             return false;
@@ -3090,8 +3099,10 @@  discard block
 block discarded – undo
3090 3099
         $md5 = md5((time() + ($user_id * 5)) - rand(10000, 10000)); //generate some kind of random key
3091 3100
         $sql = "INSERT INTO $t_api (user_id, api_key,api_service) VALUES ($user_id,'$md5','$service_name')";
3092 3101
         $res = Database::query($sql);
3093
-        if ($res === false)
3094
-            return false; //error during query
3102
+        if ($res === false) {
3103
+                    return false;
3104
+        }
3105
+        //error during query
3095 3106
         $num = Database::insert_id();
3096 3107
         return ($num == 0) ? false : $num;
3097 3108
     }
@@ -3103,22 +3114,29 @@  discard block
 block discarded – undo
3103 3114
      */
3104 3115
     public static function delete_api_key($key_id)
3105 3116
     {
3106
-        if ($key_id != strval(intval($key_id)))
3107
-            return false;
3108
-        if ($key_id === false)
3109
-            return false;
3117
+        if ($key_id != strval(intval($key_id))) {
3118
+                    return false;
3119
+        }
3120
+        if ($key_id === false) {
3121
+                    return false;
3122
+        }
3110 3123
         $t_api = Database::get_main_table(TABLE_MAIN_USER_API_KEY);
3111 3124
         $sql = "SELECT * FROM $t_api WHERE id = ".$key_id;
3112 3125
         $res = Database::query($sql);
3113
-        if ($res === false)
3114
-            return false; //error during query
3126
+        if ($res === false) {
3127
+                    return false;
3128
+        }
3129
+        //error during query
3115 3130
         $num = Database::num_rows($res);
3116
-        if ($num !== 1)
3117
-            return false;
3131
+        if ($num !== 1) {
3132
+                    return false;
3133
+        }
3118 3134
         $sql = "DELETE FROM $t_api WHERE id = ".$key_id;
3119 3135
         $res = Database::query($sql);
3120
-        if ($res === false)
3121
-            return false; //error during query
3136
+        if ($res === false) {
3137
+                    return false;
3138
+        }
3139
+        //error during query
3122 3140
         return true;
3123 3141
     }
3124 3142
 
@@ -3130,10 +3148,12 @@  discard block
 block discarded – undo
3130 3148
      */
3131 3149
     public static function update_api_key($user_id, $api_service)
3132 3150
     {
3133
-        if ($user_id != strval(intval($user_id)))
3134
-            return false;
3135
-        if ($user_id === false)
3136
-            return false;
3151
+        if ($user_id != strval(intval($user_id))) {
3152
+                    return false;
3153
+        }
3154
+        if ($user_id === false) {
3155
+                    return false;
3156
+        }
3137 3157
         $service_name = Database::escape_string($api_service);
3138 3158
         if (is_string($service_name) === false) {
3139 3159
             return false;
@@ -3159,12 +3179,15 @@  discard block
 block discarded – undo
3159 3179
      */
3160 3180
     public static function get_api_key_id($user_id, $api_service)
3161 3181
     {
3162
-        if ($user_id != strval(intval($user_id)))
3163
-            return false;
3164
-        if ($user_id === false)
3165
-            return false;
3166
-        if (empty($api_service))
3167
-            return false;
3182
+        if ($user_id != strval(intval($user_id))) {
3183
+                    return false;
3184
+        }
3185
+        if ($user_id === false) {
3186
+                    return false;
3187
+        }
3188
+        if (empty($api_service)) {
3189
+                    return false;
3190
+        }
3168 3191
         $t_api = Database::get_main_table(TABLE_MAIN_USER_API_KEY);
3169 3192
         $api_service = Database::escape_string($api_service);
3170 3193
         $sql = "SELECT id FROM $t_api WHERE user_id=".$user_id." AND api_service='".$api_service."'";
@@ -4666,8 +4689,9 @@  discard block
 block discarded – undo
4666 4689
                     $form->applyFilter('extra_'.$field_details[1], 'stripslashes');
4667 4690
                     $form->applyFilter('extra_'.$field_details[1], 'trim');
4668 4691
                     if (!$admin_permissions) {
4669
-                        if ($field_details[7] == 0)
4670
-                            $form->freeze('extra_'.$field_details[1]);
4692
+                        if ($field_details[7] == 0) {
4693
+                                                    $form->freeze('extra_'.$field_details[1]);
4694
+                        }
4671 4695
                     }
4672 4696
                     break;
4673 4697
                 case ExtraField::FIELD_TYPE_RADIO:
@@ -4724,8 +4748,9 @@  discard block
 block discarded – undo
4724 4748
                     );
4725 4749
 
4726 4750
                     if (!$admin_permissions) {
4727
-                        if ($field_details[7] == 0)
4728
-                            $form->freeze('extra_'.$field_details[1]);
4751
+                        if ($field_details[7] == 0) {
4752
+                                                    $form->freeze('extra_'.$field_details[1]);
4753
+                        }
4729 4754
                     }
4730 4755
                     break;
4731 4756
                 case ExtraField::FIELD_TYPE_SELECT_MULTIPLE:
@@ -4741,8 +4766,9 @@  discard block
 block discarded – undo
4741 4766
                         array('multiple' => 'multiple')
4742 4767
                     );
4743 4768
                     if (!$admin_permissions) {
4744
-                        if ($field_details[7] == 0)
4745
-                            $form->freeze('extra_'.$field_details[1]);
4769
+                        if ($field_details[7] == 0) {
4770
+                                                    $form->freeze('extra_'.$field_details[1]);
4771
+                        }
4746 4772
                     }
4747 4773
                     break;
4748 4774
                 case ExtraField::FIELD_TYPE_DATE:
@@ -4750,8 +4776,9 @@  discard block
 block discarded – undo
4750 4776
                     $defaults['extra_'.$field_details[1]] = date('Y-m-d 12:00:00');
4751 4777
                     $form->setDefaults($defaults);
4752 4778
                     if (!$admin_permissions) {
4753
-                        if ($field_details[7] == 0)
4754
-                            $form->freeze('extra_'.$field_details[1]);
4779
+                        if ($field_details[7] == 0) {
4780
+                                                    $form->freeze('extra_'.$field_details[1]);
4781
+                        }
4755 4782
                     }
4756 4783
                     $form->applyFilter('theme', 'trim');
4757 4784
                     break;
@@ -4760,8 +4787,9 @@  discard block
 block discarded – undo
4760 4787
                     $defaults['extra_'.$field_details[1]] = date('Y-m-d 12:00:00');
4761 4788
                     $form->setDefaults($defaults);
4762 4789
                     if (!$admin_permissions) {
4763
-                        if ($field_details[7] == 0)
4764
-                            $form->freeze('extra_'.$field_details[1]);
4790
+                        if ($field_details[7] == 0) {
4791
+                                                    $form->freeze('extra_'.$field_details[1]);
4792
+                        }
4765 4793
                     }
4766 4794
                     $form->applyFilter('theme', 'trim');
4767 4795
                     break;
@@ -4780,8 +4808,9 @@  discard block
 block discarded – undo
4780 4808
                     $form->addGroup($group, 'extra_'.$field_details[1], $field_details[3]);
4781 4809
 
4782 4810
                     if (!$admin_permissions) {
4783
-                        if ($field_details[7] == 0)
4784
-                            $form->freeze('extra_'.$field_details[1]);
4811
+                        if ($field_details[7] == 0) {
4812
+                                                    $form->freeze('extra_'.$field_details[1]);
4813
+                        }
4785 4814
                     }
4786 4815
 
4787 4816
                     /* Recoding the selected values for double : if the user has
@@ -4841,8 +4870,9 @@  discard block
 block discarded – undo
4841 4870
                     break;
4842 4871
                 case ExtraField::FIELD_TYPE_TIMEZONE:
4843 4872
                     $form->addElement('select', 'extra_'.$field_details[1], $field_details[3], api_get_timezones(), '');
4844
-                    if ($field_details[7] == 0)
4845
-                        $form->freeze('extra_'.$field_details[1]);
4873
+                    if ($field_details[7] == 0) {
4874
+                                            $form->freeze('extra_'.$field_details[1]);
4875
+                    }
4846 4876
                     break;
4847 4877
                 case ExtraField::FIELD_TYPE_SOCIAL_PROFILE:
4848 4878
                     // get the social network's favicon
@@ -4867,8 +4897,9 @@  discard block
 block discarded – undo
4867 4897
                     );
4868 4898
                     $form->applyFilter('extra_'.$field_details[1], 'stripslashes');
4869 4899
                     $form->applyFilter('extra_'.$field_details[1], 'trim');
4870
-                    if ($field_details[7] == 0)
4871
-                        $form->freeze('extra_'.$field_details[1]);
4900
+                    if ($field_details[7] == 0) {
4901
+                                            $form->freeze('extra_'.$field_details[1]);
4902
+                    }
4872 4903
                     break;
4873 4904
                 case ExtraField::FIELD_TYPE_FILE:
4874 4905
                     $extra_field = 'extra_'.$field_details[1];
@@ -5277,8 +5308,9 @@  discard block
 block discarded – undo
5277 5308
         $url .= "?s=$s&d=$d&r=$r";
5278 5309
         if ( $img ) {
5279 5310
             $url = '<img src="' . $url . '"';
5280
-            foreach ( $atts as $key => $val )
5281
-                $url .= ' ' . $key . '="' . $val . '"';
5311
+            foreach ( $atts as $key => $val ) {
5312
+                            $url .= ' ' . $key . '="' . $val . '"';
5313
+            }
5282 5314
             $url .= ' />';
5283 5315
         }
5284 5316
         return $url;
Please login to merge, or discard this patch.
main/ticket/tickets.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -138,8 +138,8 @@  discard block
 block discarded – undo
138 138
 $isAdmin = api_is_platform_admin();
139 139
 
140 140
 Display::display_header(get_lang('MyTickets'));
141
-if (!empty($projectId))
142
-if ($isAdmin) {
141
+if (!empty($projectId)) {
142
+    if ($isAdmin) {
143 143
     $getParameters = [
144 144
         'keyword',
145 145
         'keyword_status',
@@ -151,6 +151,7 @@  discard block
 block discarded – undo
151 151
         'Tickets_per_page',
152 152
         'Tickets_column'
153 153
     ];
154
+}
154 155
     $get_parameter = '';
155 156
     foreach ($getParameters as $getParameter) {
156 157
         if (isset($_GET[$getParameter])) {
Please login to merge, or discard this patch.