Completed
Pull Request — 1.11.x (#1285)
by José
43:07
created
main/inc/lib/social.lib.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1644,11 +1644,11 @@  discard block
 block discarded – undo
1644 1644
 
1645 1645
             if ($size == IMAGE_WALL_SMALL) {
1646 1646
                 $name = IMAGE_WALL_SMALL. '_' . $array[2];
1647
-            }else if($size == IMAGE_WALL_MEDIUM){
1647
+            } else if($size == IMAGE_WALL_MEDIUM){
1648 1648
                 $name = IMAGE_WALL_MEDIUM. '_' . $array[2];
1649
-            }else if($size == IMAGE_WALL_BIG){
1649
+            } else if($size == IMAGE_WALL_BIG){
1650 1650
                 $name = IMAGE_WALL_BIG. '_' . $array[2];
1651
-            }else {
1651
+            } else {
1652 1652
                 $name = IMAGE_WALL_SMALL. '_' . $array[2];
1653 1653
             }
1654 1654
             $lessImage = str_replace($array[2], '', $path);
@@ -1772,7 +1772,9 @@  discard block
 block discarded – undo
1772 1772
             $friendHtml.= '<ul class="nav nav-list">';
1773 1773
             $j = 1;
1774 1774
             for ($k=0; $k < $number_friends; $k++) {
1775
-                if ($j > $number_of_images) break;
1775
+                if ($j > $number_of_images) {
1776
+                    break;
1777
+                }
1776 1778
 
1777 1779
                 if (isset($friends[$k])) {
1778 1780
                     $friend = $friends[$k];
Please login to merge, or discard this patch.
main/webservices/registration.soap.php 1 patch
Braces   +156 added lines, -54 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
     }
@@ -4194,7 +4252,9 @@  discard block
 block discarded – undo
4194 4252
             continue;
4195 4253
         }
4196 4254
 
4197
-        if (empty($nolimit) && $duration) $nolimit = 1;
4255
+        if (empty($nolimit) && $duration) {
4256
+            $nolimit = 1;
4257
+        }
4198 4258
 
4199 4259
         if (empty($nolimit)) {
4200 4260
             $date_start = "$year_start-".(($month_start < 10) ? "0$month_start" : $month_start)."-".(($day_start < 10) ? "0$day_start" : $day_start).' 00:00:00';
@@ -4507,7 +4567,9 @@  discard block
 block discarded – undo
4507 4567
     if (!WSHelperVerifyKey($params)) {
4508 4568
         return returnError(WS_ERROR_SECRET_KEY);
4509 4569
     }
4510
-    if ($debug) error_log('WSSubscribeUserToCourse params: '.print_r($params,1));
4570
+    if ($debug) {
4571
+        error_log('WSSubscribeUserToCourse params: '.print_r($params,1));
4572
+    }
4511 4573
 
4512 4574
     $results = array();
4513 4575
     $userscourses = $params['userscourses'];
@@ -4526,7 +4588,9 @@  discard block
 block discarded – undo
4526 4588
             $original_user_id['original_user_id_value'],
4527 4589
             $original_user_id['original_user_id_name']
4528 4590
         );
4529
-        if ($debug) error_log('WSSubscribeUserToCourse user_id: '.$user_id);
4591
+        if ($debug) {
4592
+            error_log('WSSubscribeUserToCourse user_id: '.$user_id);
4593
+        }
4530 4594
 
4531 4595
         if ($user_id == 0) {
4532 4596
             // If user was not found, there was a problem
@@ -4544,13 +4608,19 @@  discard block
 block discarded – undo
4544 4608
                 // Course was not found
4545 4609
                 $resultValue = 0;
4546 4610
             } else {
4547
-                if ($debug) error_log('WSSubscribeUserToCourse courseCode: '.$courseCode);
4611
+                if ($debug) {
4612
+                    error_log('WSSubscribeUserToCourse courseCode: '.$courseCode);
4613
+                }
4548 4614
                 $result = CourseManager::add_user_to_course($user_id, $courseCode, $status, false);
4549 4615
                 if ($result) {
4550 4616
                     $resultValue = 1;
4551
-                    if ($debug) error_log('WSSubscribeUserToCourse subscribed');
4617
+                    if ($debug) {
4618
+                        error_log('WSSubscribeUserToCourse subscribed');
4619
+                    }
4552 4620
                 } else {
4553
-                    if ($debug) error_log('WSSubscribeUserToCourse NOT subscribed: ');
4621
+                    if ($debug) {
4622
+                        error_log('WSSubscribeUserToCourse NOT subscribed: ');
4623
+                    }
4554 4624
                 }
4555 4625
             }
4556 4626
         }
@@ -4609,8 +4679,12 @@  discard block
 block discarded – undo
4609 4679
 function WSSubscribeUserToCourseSimple($params) {
4610 4680
     global $debug;
4611 4681
 
4612
-    if ($debug) error_log('WSSubscribeUserToCourseSimple');
4613
-    if ($debug) error_log('Params '. print_r($params, 1));
4682
+    if ($debug) {
4683
+        error_log('WSSubscribeUserToCourseSimple');
4684
+    }
4685
+    if ($debug) {
4686
+        error_log('Params '. print_r($params, 1));
4687
+    }
4614 4688
     if (!WSHelperVerifyKey($params)) {
4615 4689
         return returnError(WS_ERROR_SECRET_KEY);
4616 4690
     }
@@ -4628,7 +4702,9 @@  discard block
 block discarded – undo
4628 4702
     if (empty($user_data)) {
4629 4703
         // If user was not found, there was a problem
4630 4704
         $result = "User $user_id does not exist";
4631
-        if ($debug) error_log($result);
4705
+        if ($debug) {
4706
+            error_log($result);
4707
+        }
4632 4708
         return $result;
4633 4709
     }
4634 4710
     if (!empty($course_code)) {
@@ -4636,14 +4712,22 @@  discard block
 block discarded – undo
4636 4712
         if (empty($course_data)) {
4637 4713
             // Course was not found
4638 4714
             $result = "Course $course_code does not exist in the platform ";
4639
-            if ($debug) error_log($result);
4715
+            if ($debug) {
4716
+                error_log($result);
4717
+            }
4640 4718
         } else {
4641
-            if ($debug) error_log('Try to register: user_id= '.$user_id.' to course: '.$course_data['code']);
4719
+            if ($debug) {
4720
+                error_log('Try to register: user_id= '.$user_id.' to course: '.$course_data['code']);
4721
+            }
4642 4722
             if (!CourseManager::add_user_to_course($user_id, $course_data['code'], $status)) {
4643 4723
                 $result = 'User was not registered possible reasons: User already registered to the course, Course visibility doesnt allow user subscriptions ';
4644
-                if ($debug) error_log($result);
4724
+                if ($debug) {
4725
+                    error_log($result);
4726
+                }
4645 4727
             } else {
4646
-                if ($debug) error_log('User registered to the course: '.$course_data['code']);
4728
+                if ($debug) {
4729
+                    error_log('User registered to the course: '.$course_data['code']);
4730
+                }
4647 4731
                 $result = 1;
4648 4732
             }
4649 4733
         }
@@ -4696,8 +4780,12 @@  discard block
 block discarded – undo
4696 4780
 function WSGetUser($params)
4697 4781
 {
4698 4782
     global $debug;
4699
-    if ($debug) error_log('WSGetUser');
4700
-    if ($debug) error_log('$params: '.print_r($params, 1));
4783
+    if ($debug) {
4784
+        error_log('WSGetUser');
4785
+    }
4786
+    if ($debug) {
4787
+        error_log('$params: '.print_r($params, 1));
4788
+    }
4701 4789
 
4702 4790
     if (!WSHelperVerifyKey($params)) {
4703 4791
         return returnError(WS_ERROR_SECRET_KEY);
@@ -4751,8 +4839,12 @@  discard block
 block discarded – undo
4751 4839
 function WSGetUserFromUsername($params)
4752 4840
 {
4753 4841
     global $debug;
4754
-    if ($debug) error_log('WSGetUserFromUsername');
4755
-    if ($debug) error_log('$params: '.print_r($params, 1));
4842
+    if ($debug) {
4843
+        error_log('WSGetUserFromUsername');
4844
+    }
4845
+    if ($debug) {
4846
+        error_log('$params: '.print_r($params, 1));
4847
+    }
4756 4848
 
4757 4849
     if (!WSHelperVerifyKey($params)) {
4758 4850
         return returnError(WS_ERROR_SECRET_KEY);
@@ -5219,7 +5311,9 @@  discard block
 block discarded – undo
5219 5311
                 SessionManager::suscribe_users_to_session($sessionId, array($user_id), SESSION_VISIBLE_READ_ONLY, false);
5220 5312
                 $results[] = 1;
5221 5313
 
5222
-                if ($debug) error_log("subscribe user:$user_id to session $sessionId");
5314
+                if ($debug) {
5315
+                    error_log("subscribe user:$user_id to session $sessionId");
5316
+                }
5223 5317
             }
5224 5318
         }
5225 5319
     } // end principal foreach
@@ -5303,7 +5397,9 @@  discard block
 block discarded – undo
5303 5397
                 SESSION_VISIBLE_READ_ONLY,
5304 5398
                 false
5305 5399
             );
5306
-            if ($debug) error_log('User registered to the course: '.$session_id);
5400
+            if ($debug) {
5401
+                error_log('User registered to the course: '.$session_id);
5402
+            }
5307 5403
             $result = 1;
5308 5404
         }
5309 5405
     }
@@ -5451,7 +5547,9 @@  discard block
 block discarded – undo
5451 5547
 
5452 5548
                 $results[] = 1;
5453 5549
 
5454
-                if ($debug) error_log("Unsubscribe user:$user_id to session:$id_session");
5550
+                if ($debug) {
5551
+                    error_log("Unsubscribe user:$user_id to session:$id_session");
5552
+                }
5455 5553
             }
5456 5554
         }
5457 5555
     } // end principal foreach
@@ -5598,7 +5696,9 @@  discard block
 block discarded – undo
5598 5696
         return returnError(WS_ERROR_SECRET_KEY);
5599 5697
     }
5600 5698
 
5601
-    if ($debug) error_log('WSSuscribeCoursesToSession: '.print_r($params, 1));
5699
+    if ($debug) {
5700
+        error_log('WSSuscribeCoursesToSession: '.print_r($params, 1));
5701
+    }
5602 5702
 
5603 5703
     $coursessessions_params = $params['coursessessions'];
5604 5704
     $results = array();
@@ -5644,7 +5744,9 @@  discard block
 block discarded – undo
5644 5744
                     array($courseInfo['real_id']),
5645 5745
                     false
5646 5746
                 );
5647
-                if ($debug) error_log("add_courses_to_session: course:$courseCode to session:$sessionId");
5747
+                if ($debug) {
5748
+                    error_log("add_courses_to_session: course:$courseCode to session:$sessionId");
5749
+                }
5648 5750
 
5649 5751
                 $results[] = 1;
5650 5752
             }
Please login to merge, or discard this patch.
main/ticket/report.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -289,8 +289,9 @@
 block discarded – undo
289 289
 
290 290
     if ($start_date != '' || $end_date != '') {
291 291
         $sql .= " HAVING ";
292
-        if ($start_date != '')
293
-            $sql .= "  access_date >= '$start_date'   ";
292
+        if ($start_date != '') {
293
+                    $sql .= "  access_date >= '$start_date'   ";
294
+        }
294 295
         if ($end_date != '') {
295 296
             $sql = ($start_date == '') ? $sql : ($sql . " AND ");
296 297
             $sql .= "  access_date <= '$end_date'   ";
Please login to merge, or discard this patch.
src/Chamilo/CourseBundle/Component/CourseCopy/CourseSelectForm.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -527,14 +527,15 @@
 block discarded – undo
527 527
 						// Mark folders to import which are not selected by the user to import,
528 528
 						// but in which a document was selected.
529 529
 						$documents = isset($_POST['resource'][RESOURCE_DOCUMENT]) ? $_POST['resource'][RESOURCE_DOCUMENT] : null;
530
-						if (!empty($resources) && is_array($resources))
531
-							foreach ($resources as $id => $obj) {
530
+						if (!empty($resources) && is_array($resources)) {
531
+													foreach ($resources as $id => $obj) {
532 532
 								if (isset($obj->file_type) && $obj->file_type == 'folder' &&
533 533
                                     !isset($_POST['resource'][RESOURCE_DOCUMENT][$id]) &&
534 534
                                     is_array($documents)
535 535
                                 ) {
536 536
 									foreach ($documents as $id_to_check => $post_value) {
537 537
 										$obj_to_check = $resources[$id_to_check];
538
+						}
538 539
 										$shared_path_part = substr($obj_to_check->path,0,strlen($obj->path));
539 540
 										if ($id_to_check != $id && $obj->path == $shared_path_part) {
540 541
 											$_POST['resource'][RESOURCE_DOCUMENT][$id] = 1;
Please login to merge, or discard this patch.
src/Chamilo/CourseBundle/Component/CourseCopy/CourseRestorer.php 1 patch
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -533,7 +533,9 @@  discard block
 block discarded – undo
533 533
 
534 534
                                     if (in_array($file_info['extension'], array('html', 'htm'))) {
535 535
                                         $content = file_get_contents($path.$document->path);
536
-                                        if (UTF8_CONVERT) $content = utf8_encode($content);
536
+                                        if (UTF8_CONVERT) {
537
+                                            $content = utf8_encode($content);
538
+                                        }
537 539
                                         $content = DocumentManager::replace_urls_inside_content_html_from_copy_course(
538 540
                                             $content,
539 541
                                             $this->course->code,
@@ -2808,8 +2810,9 @@  discard block
 block discarded – undo
2808 2810
                             echo '<font color="red">File ('.$path.') '.get_lang('NotHavePermission').'</font>';
2809 2811
                         }*/
2810 2812
                     } elseif(is_dir($path)) {
2811
-                        if (!is_dir($dest . '/' . $file))
2812
-                        mkdir($dest . '/' . $file);
2813
+                        if (!is_dir($dest . '/' . $file)) {
2814
+                                                mkdir($dest . '/' . $file);
2815
+                        }
2813 2816
                         self:: allow_create_all_directory($path, $dest . '/' . $file, $overwrite);
2814 2817
                     }
2815 2818
                 }
Please login to merge, or discard this patch.
main/admin/user_move_stats.php 1 patch
Braces   +111 added lines, -47 removed lines patch added patch discarded remove patch
@@ -106,7 +106,9 @@  discard block
 block discarded – undo
106 106
                 //Check if the user is registered in the session otherwise we will add it
107 107
                 $result = SessionManager::get_users_by_session($new_session_id);
108 108
                 if (empty($result) || !in_array($user_id, array_keys($result))) {
109
-                    if ($debug) echo 'User added to the session';
109
+                    if ($debug) {
110
+                        echo 'User added to the session';
111
+                    }
110 112
                     //Registering user to the new session
111 113
                     SessionManager::suscribe_users_to_session($new_session_id,array($user_id),false);
112 114
                 }
@@ -141,10 +143,11 @@  discard block
 block discarded – undo
141 143
                     $list[$row['exe_id']]= $row;
142 144
                 }
143 145
 
144
-                if (!empty($list))
145
-                    foreach ($list as $exe_id =>$data) {
146
+                if (!empty($list)) {
147
+                                    foreach ($list as $exe_id =>$data) {
146 148
                         if ($update_database) {
147 149
                             $sql = "UPDATE $TABLETRACK_EXERCICES SET session_id = '$new_session_id' WHERE exe_id = $exe_id";
150
+                }
148 151
                             $res = Database::query($sql);
149 152
                             $result_message[$TABLETRACK_EXERCICES]++;
150 153
                         } else {
@@ -168,10 +171,11 @@  discard block
 block discarded – undo
168 171
                         $list[$row['exe_id']]= $row;
169 172
                     }
170 173
 
171
-                    if (!empty($list))
172
-                        foreach ($list as $exe_id =>$data) {
174
+                    if (!empty($list)) {
175
+                                            foreach ($list as $exe_id =>$data) {
173 176
                             if ($update_database) {
174 177
                                 $sql = "UPDATE $TABLETRACK_EXERCICES SET session_id = '$new_session_id' WHERE exe_id = $exe_id";
178
+                    }
175 179
                                 $res = Database::query($sql);
176 180
                                 $result_message[$TABLETRACK_EXERCICES]++;
177 181
                             } else {
@@ -196,10 +200,11 @@  discard block
 block discarded – undo
196 200
                     $list[$row['course_access_id']] = $row;
197 201
                 }
198 202
 
199
-                if (!empty($list))
200
-                    foreach ($list as $id => $data) {
203
+                if (!empty($list)) {
204
+                                    foreach ($list as $id => $data) {
201 205
                         if ($update_database) {
202 206
                             $sql = "UPDATE $TBL_TRACK_E_COURSE_ACCESS SET session_id = $new_session_id WHERE course_access_id = $id";
207
+                }
203 208
                             if ($debug) {
204 209
                                 echo $sql;
205 210
                             }
@@ -218,13 +223,18 @@  discard block
 block discarded – undo
218 223
                 while($row = Database::fetch_array($res,'ASSOC')) {
219 224
                     $list[] = $row['access_id'];
220 225
                 }
221
-                if (!empty($list))
222
-                    foreach ($list as $id) {
226
+                if (!empty($list)) {
227
+                                    foreach ($list as $id) {
223 228
                         if ($update_database) {
224 229
                             $sql = "UPDATE $TBL_TRACK_E_LAST_ACCESS SET access_session_id = $new_session_id WHERE access_id = $id";
225
-                            if ($debug) echo $sql;
230
+                }
231
+                            if ($debug) {
232
+                                echo $sql;
233
+                            }
226 234
                             $res = Database::query($sql);
227
-                            if ($debug) error_log(__FILE__ . ' +' . __LINE__ . ': ' . print_r($res, 1));
235
+                            if ($debug) {
236
+                                error_log(__FILE__ . ' +' . __LINE__ . ': ' . print_r($res, 1));
237
+                            }
228 238
                             $result_message[$TBL_TRACK_E_LAST_ACCESS]++;
229 239
                         }
230 240
                     }
@@ -248,13 +258,18 @@  discard block
 block discarded – undo
248 258
                     }
249 259
                 }
250 260
 
251
-                if (!empty($list))
252
-                    foreach ($list as $id=>$data) {
261
+                if (!empty($list)) {
262
+                                    foreach ($list as $id=>$data) {
253 263
                         if ($update_database) {
254 264
                             $sql = "UPDATE $TBL_LP_VIEW SET session_id = $new_session_id WHERE c_id = $course_id AND id = $id ";
255
-                            if ($debug) var_dump($sql);
265
+                }
266
+                            if ($debug) {
267
+                                var_dump($sql);
268
+                            }
256 269
                             $res = Database::query($sql);
257
-                            if ($debug) var_dump($res);
270
+                            if ($debug) {
271
+                                var_dump($res);
272
+                            }
258 273
                             $result_message[$TBL_LP_VIEW]++;
259 274
                         } else {
260 275
                             //Getting all information of that lp_item_id
@@ -281,10 +296,11 @@  discard block
 block discarded – undo
281 296
                             $list[$row['id']] = $row;
282 297
                         }
283 298
                     }
284
-                    if (!empty($list))
285
-                        foreach ($list as $id=>$data) {
299
+                    if (!empty($list)) {
300
+                                            foreach ($list as $id=>$data) {
286 301
                             //Getting all information of that lp_item_id
287 302
                             $score    = Tracking::get_avg_student_score($user_id, $origin_course_code,        array($data['lp_id']), $new_session_id);
303
+                    }
288 304
                             $progress = Tracking::get_avg_student_progress($user_id, $origin_course_code,     array($data['lp_id']), $new_session_id);
289 305
                             $result_message_compare['LP_VIEW'][$data['lp_id']] = array('score' => $score, 'progress' =>$progress);
290 306
                         }
@@ -300,9 +316,13 @@  discard block
 block discarded – undo
300 316
                     $id = $row['ref'];
301 317
                     if ($update_database) {
302 318
                         $sql = "UPDATE $TBL_AGENDA SET session_id = $new_session_id WHERE c_id = $course_id AND id = $id ";
303
-                        if ($debug) var_dump($sql);
319
+                        if ($debug) {
320
+                            var_dump($sql);
321
+                        }
304 322
                         $res_update = Database::query($sql);
305
-                        if ($debug) var_dump($res_update);
323
+                        if ($debug) {
324
+                            var_dump($res_update);
325
+                        }
306 326
                         $result_message['agenda']++;
307 327
                     }
308 328
                 }
@@ -314,22 +334,30 @@  discard block
 block discarded – undo
314 334
                 //echo '<h1>Student publication</h1>';
315 335
 
316 336
                 $sql = "SELECT ref FROM $TBL_ITEM_PROPERTY WHERE tool = 'work' AND insert_user_id = $user_id AND c_id = $course_id";
317
-                if ($debug) echo $sql;
337
+                if ($debug) {
338
+                    echo $sql;
339
+                }
318 340
                 $res = Database::query($sql);
319 341
                 while($row = Database::fetch_array($res,'ASSOC')) {
320 342
                     $id = $row['ref'];
321 343
                     $sql = "SELECT * FROM $TBL_STUDENT_PUBLICATION WHERE id = $id AND session_id = $origin_session_id AND c_id = $course_id";
322
-                    if ($debug) var_dump($sql);
344
+                    if ($debug) {
345
+                        var_dump($sql);
346
+                    }
323 347
                     $sub_res = Database::query($sql);
324 348
                     if (Database::num_rows($sub_res) > 0 ) {
325 349
                         $data = Database::fetch_array($sub_res,'ASSOC');
326
-                        if ($debug) var_dump($data);
350
+                        if ($debug) {
351
+                            var_dump($data);
352
+                        }
327 353
                         $parent_id = $data['parent_id'];
328 354
                         if (isset($data['parent_id']) && !empty($data['parent_id'])) {
329 355
                             $sql = "SELECT * FROM $TBL_STUDENT_PUBLICATION WHERE id = $parent_id AND c_id = $course_id";
330 356
                             $select_res     = Database::query($sql);
331 357
                             $parent_data    = Database::fetch_array($select_res,'ASSOC');
332
-                            if ($debug)     var_dump($parent_data);
358
+                            if ($debug) {
359
+                                var_dump($parent_data);
360
+                            }
333 361
 
334 362
                             $sys_course_path = api_get_path(SYS_COURSE_PATH);
335 363
                             $course_dir = $sys_course_path . $course_info['path'];
@@ -344,7 +372,9 @@  discard block
 block discarded – undo
344 372
                             $sql = "SELECT * FROM $TBL_STUDENT_PUBLICATION
345 373
                             		WHERE description like '%$search_this%' AND url LIKE '%$search_this2%' AND session_id = $new_session_id AND c_id = $course_id
346 374
                             		ORDER BY id desc  LIMIT 1";
347
-                            if ($debug) echo $sql;
375
+                            if ($debug) {
376
+                                echo $sql;
377
+                            }
348 378
                             $sub_res = Database::query($sql);
349 379
                             $num_rows = Database::num_rows($sub_res);
350 380
 
@@ -377,12 +407,16 @@  discard block
 block discarded – undo
377 407
 	                                       date_of_qualification    = '',
378 408
 	                                       session_id   = ".$new_session_id;
379 409
                                     $rest_insert     = Database::query($sql_add_publication);
380
-                                    if ($debug) echo ($sql_add_publication);
410
+                                    if ($debug) {
411
+                                        echo ($sql_add_publication);
412
+                                    }
381 413
                                     // add the directory
382 414
                                     $id = Database::insert_id();
383 415
                                     //Folder created
384 416
                                     api_item_property_update($course_info, 'work', $id, 'DirectoryCreated', api_get_user_id());
385
-                                    if ($debug) var_dump($rest_insert);
417
+                                    if ($debug) {
418
+                                        var_dump($rest_insert);
419
+                                    }
386 420
                                     $new_parent_id = $id;
387 421
                                     $result_message[$TBL_STUDENT_PUBLICATION.' - new folder created called: '.$created_dir]++;
388 422
                                 }
@@ -390,7 +424,9 @@  discard block
 block discarded – undo
390 424
 
391 425
                             //Creating student_publication_assignment if exists
392 426
                             $sql = "SELECT * FROM $TBL_STUDENT_PUBLICATION_ASSIGNMENT WHERE publication_id = $parent_id AND c_id = $course_id";
393
-                            if ($debug) var_dump($sql);
427
+                            if ($debug) {
428
+                                var_dump($sql);
429
+                            }
394 430
                             $rest_select     = Database::query($sql);
395 431
                             if (Database::num_rows($rest_select) > 0 ) {
396 432
                                 if ($update_database) {
@@ -402,7 +438,9 @@  discard block
 block discarded – undo
402 438
                                        add_to_calendar      = '".$assignment_data['add_to_calendar']."',
403 439
                                        enable_qualification = '".$assignment_data['enable_qualification']."',
404 440
                                        publication_id       = '".$new_parent_id."'";
405
-                                    if ($debug) echo $sql_add_publication;
441
+                                    if ($debug) {
442
+                                        echo $sql_add_publication;
443
+                                    }
406 444
                                     $rest_select     = Database::query($sql_add_publication);
407 445
                                     $id = Database::insert_id();
408 446
 
@@ -410,11 +448,15 @@  discard block
 block discarded – undo
410 448
                                         "has_properties         = '".$id."',
411 449
                                        view_properties    = '1'
412 450
                                        WHERE id   = ".$new_parent_id;
413
-                                    if ($debug) echo $sql_update;
451
+                                    if ($debug) {
452
+                                        echo $sql_update;
453
+                                    }
414 454
                                     $rest_update     = Database::query($sql_update);
415 455
 
416 456
 
417
-                                    if ($debug) var_dump($sql_update);
457
+                                    if ($debug) {
458
+                                        var_dump($sql_update);
459
+                                    }
418 460
                                     $result_message[$TBL_STUDENT_PUBLICATION_ASSIGNMENT]++;
419 461
                                 }
420 462
                             }
@@ -437,9 +479,13 @@  discard block
 block discarded – undo
437 479
                                                parent_id    =  ".$new_parent_id ." ,
438 480
                                                session_id = ".$new_session_id;
439 481
 
440
-                                if ($debug) echo $sql_add_publication;
482
+                                if ($debug) {
483
+                                    echo $sql_add_publication;
484
+                                }
441 485
                                 $rest_insert     = Database::query($sql_add_publication);
442
-                                if ($debug) var_dump($rest_insert);
486
+                                if ($debug) {
487
+                                    var_dump($rest_insert);
488
+                                }
443 489
                                 $id = Database::insert_id();
444 490
                                 api_item_property_update($course_info, 'work', $id, 'DocumentAdded', $user_id);
445 491
                                 $result_message[$TBL_STUDENT_PUBLICATION]++;
@@ -453,7 +499,9 @@  discard block
 block discarded – undo
453 499
                                     if ($result) {
454 500
                                         unlink($full_file_name);
455 501
                                         $sql = "DELETE FROM $TBL_STUDENT_PUBLICATION WHERE id= ".$data['id'];
456
-                                        if ($debug) var_dump($sql);
502
+                                        if ($debug) {
503
+                                            var_dump($sql);
504
+                                        }
457 505
                                         $result_delete     = Database::query($sql);
458 506
                                         api_item_property_update($course_info, 'work', $data['id'], 'DocumentDeleted', api_get_user_id());
459 507
                                     }
@@ -469,22 +517,30 @@  discard block
 block discarded – undo
469 517
                 //10. Dropbox - not neccesary to move categories (no presence of session_id)
470 518
 
471 519
                 $sql = "SELECT id FROM $TBL_DROPBOX_FILE WHERE uploader_id = $user_id AND session_id = $origin_session_id AND c_id = $course_id";
472
-                if ($debug) var_dump($sql);
520
+                if ($debug) {
521
+                    var_dump($sql);
522
+                }
473 523
                 $res = Database::query($sql);
474 524
                 while($row = Database::fetch_array($res,'ASSOC')) {
475 525
                     $id = $row['id'];
476 526
                     if ($update_database) {
477 527
                         $sql = "UPDATE $TBL_DROPBOX_FILE SET session_id = $new_session_id WHERE c_id = $course_id AND id = $id";
478
-                        if ($debug) var_dump($sql);
528
+                        if ($debug) {
529
+                            var_dump($sql);
530
+                        }
479 531
                         $res = Database::query($sql);
480
-                        if ($debug) var_dump($res);
532
+                        if ($debug) {
533
+                            var_dump($res);
534
+                        }
481 535
 
482 536
                         $sql = "UPDATE $TBL_DROPBOX_POST SET session_id = $new_session_id WHERE file_id = $id";
483
-                        if ($debug)
484
-                            var_dump($sql);
537
+                        if ($debug) {
538
+                                                    var_dump($sql);
539
+                        }
485 540
                         $res = Database::query($sql);
486
-                        if ($debug)
487
-                            var_dump($res);
541
+                        if ($debug) {
542
+                                                    var_dump($res);
543
+                        }
488 544
                         $result_message[$TBL_DROPBOX_FILE]++;
489 545
                     }
490 546
                 }
@@ -493,23 +549,30 @@  discard block
 block discarded – undo
493 549
 
494 550
                 $sql = "SELECT notebook_id FROM $TBL_NOTEBOOK
495 551
                         WHERE user_id = $user_id AND session_id = $origin_session_id AND course = '$origin_course_code' AND c_id = $course_id";
496
-                if ($debug) var_dump($sql);
552
+                if ($debug) {
553
+                    var_dump($sql);
554
+                }
497 555
                 $res = Database::query($sql);
498 556
                 while($row = Database::fetch_array($res,'ASSOC')) {
499 557
                     $id = $row['notebook_id'];
500 558
                     if ($update_database) {
501 559
                         $sql = "UPDATE $TBL_NOTEBOOK SET session_id = $new_session_id WHERE c_id = $course_id AND notebook_id = $id";
502
-                        if ($debug) var_dump($sql);
560
+                        if ($debug) {
561
+                            var_dump($sql);
562
+                        }
503 563
                         $res = Database::query($sql);
504
-                        if ($debug) var_dump($res);
564
+                        if ($debug) {
565
+                            var_dump($res);
566
+                        }
505 567
                     }
506 568
                 }
507 569
 
508 570
                 if ($update_database) {
509 571
                     echo '<h2>'.get_lang('StatsMoved').'</h2>';
510
-                    if (is_array($result_message))
511
-                        foreach ($result_message as $table=>$times) {
572
+                    if (is_array($result_message)) {
573
+                                            foreach ($result_message as $table=>$times) {
512 574
                             echo 'Table '.$table.' - '.$times.' records updated <br />';
575
+                    }
513 576
                         }
514 577
                 } else {
515 578
                     echo '<h2>'.get_lang('UserInformationOfThisCourse').'</h2>';
@@ -626,10 +689,11 @@  discard block
 block discarded – undo
626 689
 }
627 690
 $navigation .= '&nbsp;';
628 691
 $page ++;
629
-if ($page < $nro_pages)
692
+if ($page < $nro_pages) {
630 693
     $navigation .= '<a href="'.api_get_self().'?page='.$page.'">'.get_lang('Next').'</a>';
631
-else
694
+} else {
632 695
     $navigation .= get_lang('Next');
696
+}
633 697
 
634 698
 echo $navigation;
635 699
 $user_list      = UserManager::get_user_list(array(), array(), $begin, $default);
Please login to merge, or discard this patch.
main/mySpace/myStudents.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1143,10 +1143,11 @@
 block discarded – undo
1143 1143
                 $result_last_attempt = Database::query($sql);
1144 1144
                 if (Database :: num_rows($result_last_attempt) > 0) {
1145 1145
                     $id_last_attempt = Database :: result($result_last_attempt, 0, 0);
1146
-                    if ($count_attempts > 0)
1147
-                        echo '<a href="../exercise/exercise_show.php?id=' . $id_last_attempt . '&cidReq='.$course_code.'&session_id='.$sessionId.'&student='.$student_id.'&origin='.(empty($origin)?'tracking':$origin).'">
1146
+                    if ($count_attempts > 0) {
1147
+                                            echo '<a href="../exercise/exercise_show.php?id=' . $id_last_attempt . '&cidReq='.$course_code.'&session_id='.$sessionId.'&student='.$student_id.'&origin='.(empty($origin)?'tracking':$origin).'">
1148 1148
                         '.Display::return_icon('quiz.gif').'
1149 1149
                      </a>';
1150
+                    }
1150 1151
                 }
1151 1152
                 echo '</td>';
1152 1153
 
Please login to merge, or discard this patch.
main/exercise/overview.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -250,8 +250,7 @@
 block discarded – undo
250 250
         case RESULT_DISABLE_SHOW_SCORE_ONLY:
251 251
             if ($objExercise->feedback_type != EXERCISE_FEEDBACK_TYPE_END) {
252 252
                $header_names = array(get_lang('Attempt'), get_lang('StartDate'), get_lang('IP'), get_lang('Score'));
253
-            }
254
-            else {
253
+            } else {
255 254
                 $header_names = array(get_lang('Attempt'), get_lang('StartDate'), get_lang('IP'), get_lang('Score'), get_lang('Details'));
256 255
             }
257 256
             break;
Please login to merge, or discard this patch.
main/exercise/admin.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -362,9 +362,10 @@
 block discarded – undo
362 362
 
363 363
 if ($inATest) {
364 364
     echo '<div class="actions">';
365
-    if (isset($_GET['hotspotadmin']) || isset($_GET['newQuestion']) || isset($_GET['myid']))
366
-        echo '<a href="'.api_get_path(WEB_CODE_PATH).'exercise/admin.php?exerciseId='.$exerciseId.'&'.api_get_cidreq().'">'.
365
+    if (isset($_GET['hotspotadmin']) || isset($_GET['newQuestion']) || isset($_GET['myid'])) {
366
+            echo '<a href="'.api_get_path(WEB_CODE_PATH).'exercise/admin.php?exerciseId='.$exerciseId.'&'.api_get_cidreq().'">'.
367 367
             Display::return_icon('back.png', get_lang('GoBackToQuestionList'),'',ICON_SIZE_MEDIUM).'</a>';
368
+    }
368 369
 
369 370
     if (!isset($_GET['hotspotadmin']) && !isset($_GET['newQuestion']) && !isset($_GET['myid']) &&  !isset($_GET['editQuestion'])) {
370 371
         echo '<a href="'.api_get_path(WEB_CODE_PATH).'exercise/exercise.php?'.api_get_cidreq().'">'.
Please login to merge, or discard this patch.