Completed
Pull Request — 1.11.x (#1589)
by José
46:32
created
plugin/ims_lti/OAuthSimple.php 1 patch
Braces   +7 added lines, -12 removed lines patch added patch discarded remove patch
@@ -74,8 +74,7 @@  discard block
 block discarded – undo
74 74
         if (empty($this->_parameters))
75 75
 		{
76 76
 			$this->_parameters = $parameters;
77
-		}
78
-        else if (!empty($parameters))
77
+		} else if (!empty($parameters))
79 78
 		{
80 79
 			$this->_parameters = array_merge($this->_parameters,$parameters);
81 80
 		}
@@ -324,8 +323,7 @@  discard block
 block discarded – undo
324 323
                 {
325 324
                     $result .= $pName .'="' . self::_oauthEscape($val) . '", ';
326 325
                 }
327
-            }
328
-            else
326
+            } else
329 327
             {
330 328
                 $result .= $pName . '="' . self::_oauthEscape($pValue) . '", ';
331 329
             }
@@ -350,14 +348,13 @@  discard block
 block discarded – undo
350 348
                 if (!is_array($result[$key]))
351 349
 				{
352 350
                     $result[$key] = array($result[$key],$token);
353
-				}
354
-                else
351
+				} else
355 352
 				{
356 353
                     array_push($result[$key],$token);
357 354
 				}
355
+            } else {
356
+                            $result[$key]=$token;
358 357
             }
359
-            else
360
-                $result[$key]=$token;
361 358
         }
362 359
         return $result;
363 360
     }
@@ -447,8 +444,7 @@  discard block
 block discarded – undo
447 444
 					{
448 445
 						array_push($normalized_keys[self::_oauthEscape($paramName)],  self::_oauthEscape($item));
449 446
 					}
450
-				}
451
-				else
447
+				} else
452 448
 				{
453 449
 					$normalized_keys[self::_oauthEscape($paramName)] = self::_oauthEscape($paramValue);
454 450
 				}
@@ -466,8 +462,7 @@  discard block
 block discarded – undo
466 462
 				{
467 463
 					array_push($return_array, $key . "=" . $element);
468 464
 				}
469
-			}
470
-			else
465
+			} else
471 466
 			{
472 467
 				array_push($return_array, $key .'='. $val);
473 468
 			}
Please login to merge, or discard this patch.
main/gradebook/lib/be/abstractlink.class.php 1 patch
Braces   +10 added lines, -4 removed lines patch added patch discarded remove patch
@@ -244,14 +244,20 @@
 block discarded – undo
244 244
             $paramcount ++;
245 245
         }
246 246
         if (isset($type)) {
247
-            if ($paramcount != 0) $sql .= ' AND';
248
-            else $sql .= ' WHERE';
247
+            if ($paramcount != 0) {
248
+                $sql .= ' AND';
249
+            } else {
250
+                $sql .= ' WHERE';
251
+            }
249 252
             $sql .= ' type = '.intval($type);
250 253
             $paramcount ++;
251 254
         }
252 255
         if (isset($ref_id)) {
253
-            if ($paramcount != 0) $sql .= ' AND';
254
-            else $sql .= ' WHERE';
256
+            if ($paramcount != 0) {
257
+                $sql .= ' AND';
258
+            } else {
259
+                $sql .= ' WHERE';
260
+            }
255 261
             $sql .= ' ref_id = '.intval($ref_id);
256 262
             $paramcount ++;
257 263
         }
Please login to merge, or discard this patch.
main/inc/lib/sessionmanager.lib.php 1 patch
Braces   +5 added lines, -4 removed lines patch added patch discarded remove patch
@@ -2896,10 +2896,11 @@
 block discarded – undo
2896 2896
                                 c_id = $courseId AND
2897 2897
                                 user_id = $user_id ";
2898 2898
                     $result = Database::query($sql);
2899
-                    if (Database::affected_rows($result) > 0)
2900
-                        return true;
2901
-                    else
2902
-                        return false;
2899
+                    if (Database::affected_rows($result) > 0) {
2900
+                                            return true;
2901
+                    } else {
2902
+                                            return false;
2903
+                    }
2903 2904
                 } else {
2904 2905
                     // The user is not subscribed to the session, so make sure
2905 2906
                     // he isn't subscribed to a course in this session either
Please login to merge, or discard this patch.
main/lp/lp_controller.php 1 patch
Braces   +83 added lines, -34 removed lines patch added patch discarded remove patch
@@ -14,7 +14,9 @@  discard block
 block discarded – undo
14 14
 $use_anonymous = true;
15 15
 
16 16
 $debug = 0;
17
-if ($debug > 0) error_log('New LP -+- Entered lp_controller.php -+- (action: '.$_REQUEST['action'].')', 0);
17
+if ($debug > 0) {
18
+    error_log('New LP -+- Entered lp_controller.php -+- (action: '.$_REQUEST['action'].')', 0);
19
+}
18 20
 
19 21
 // Language files that needs to be included.
20 22
 if (isset($_GET['action'])) {
@@ -210,10 +212,14 @@  discard block
 block discarded – undo
210 212
     // If refresh is set, we regenerate the oLP object from the database (kind of flush).
211 213
     Session::erase('refresh');
212 214
     $myrefresh = 1;
213
-    if ($debug > 0) error_log('New LP - Refresh asked', 0);
214
-}
215
+    if ($debug > 0) {
216
+        error_log('New LP - Refresh asked', 0);
217
+    }
218
+    }
215 219
 
216
-if ($debug > 0) error_log('New LP - Passed refresh check', 0);
220
+if ($debug > 0) {
221
+    error_log('New LP - Passed refresh check', 0);
222
+}
217 223
 
218 224
 if (!empty($_REQUEST['dialog_box'])) {
219 225
     $dialog_box = stripslashes(urldecode($_REQUEST['dialog_box']));
@@ -223,17 +229,23 @@  discard block
 block discarded – undo
223 229
 $lp_found = false;
224 230
 
225 231
 if (isset($_SESSION['lpobject'])) {
226
-    if ($debug > 0) error_log('New LP - SESSION[lpobject] is defined', 0);
232
+    if ($debug > 0) {
233
+        error_log('New LP - SESSION[lpobject] is defined', 0);
234
+    }
227 235
     $oLP = unserialize($_SESSION['lpobject']);
228 236
     if (isset($oLP) && is_object($oLP)) {
229
-        if ($debug > 0) error_log('New LP - oLP is object', 0);
237
+        if ($debug > 0) {
238
+            error_log('New LP - oLP is object', 0);
239
+        }
230 240
         if ($myrefresh == 1 ||
231 241
             empty($oLP->cc) ||
232 242
             $oLP->cc != api_get_course_id() ||
233 243
             $oLP->lp_view_session_id != $session_id ||
234 244
             $oLP->scorm_debug == '1'
235 245
         ) {
236
-            if ($debug > 0) error_log('New LP - Course has changed, discard lp object', 0);
246
+            if ($debug > 0) {
247
+                error_log('New LP - Course has changed, discard lp object', 0);
248
+            }
237 249
             if ($myrefresh == 1) { $myrefresh_id = $oLP->get_id(); }
238 250
             $oLP = null;
239 251
             Session::erase('oLP');
@@ -247,13 +259,19 @@  discard block
 block discarded – undo
247 259
 
248 260
 $course_id = api_get_course_int_id();
249 261
 
250
-if ($debug>0) error_log('New LP - Passed data remains check', 0);
262
+if ($debug>0) {
263
+    error_log('New LP - Passed data remains check', 0);
264
+}
251 265
 
252 266
 if (!$lp_found || (!empty($_REQUEST['lp_id']) && $_SESSION['oLP']->get_id() != $_REQUEST['lp_id'])) {
253
-    if ($debug > 0) error_log('New LP - oLP is not object, has changed or refresh been asked, getting new', 0);
267
+    if ($debug > 0) {
268
+        error_log('New LP - oLP is not object, has changed or refresh been asked, getting new', 0);
269
+    }
254 270
     // Regenerate a new lp object? Not always as some pages don't need the object (like upload?)
255 271
     if (!empty($_REQUEST['lp_id']) || !empty($myrefresh_id)) {
256
-        if ($debug > 0) error_log('New LP - lp_id is defined', 0);
272
+        if ($debug > 0) {
273
+            error_log('New LP - lp_id is defined', 0);
274
+        }
257 275
         // Select the lp in the database and check which type it is (scorm/dokeos/aicc) to generate the
258 276
         // right object.
259 277
         if (!empty($_REQUEST['lp_id'])) {
@@ -265,16 +283,22 @@  discard block
 block discarded – undo
265 283
         $lp_table = Database::get_course_table(TABLE_LP_MAIN);
266 284
         if (is_numeric($lp_id)) {
267 285
             $sel = "SELECT lp_type FROM $lp_table WHERE c_id = $course_id AND id = $lp_id";
268
-            if ($debug > 0) error_log('New LP - querying '.$sel, 0);
286
+            if ($debug > 0) {
287
+                error_log('New LP - querying '.$sel, 0);
288
+            }
269 289
             $res = Database::query($sel);
270 290
 
271 291
             if (Database::num_rows($res)) {
272 292
                 $row = Database::fetch_array($res);
273 293
                 $type = $row['lp_type'];
274
-                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);
294
+                if ($debug > 0) {
295
+                    error_log('New LP - found row - type '.$type. ' - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
296
+                }
275 297
                 switch ($type) {
276 298
                     case 1:
277
-                        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);
299
+                        if ($debug > 0) {
300
+                            error_log('New LP - found row - type dokeos - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
301
+                        }
278 302
 
279 303
                         $oLP = new learnpath(api_get_course_id(), $lp_id, api_get_user_id());
280 304
                         if ($oLP !== false) {
@@ -284,7 +308,9 @@  discard block
 block discarded – undo
284 308
                         }
285 309
                         break;
286 310
                     case 2:
287
-                        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);
311
+                        if ($debug > 0) {
312
+                            error_log('New LP - found row - type scorm - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
313
+                        }
288 314
                         $oLP = new scorm(api_get_course_id(), $lp_id, api_get_user_id());
289 315
                         if ($oLP !== false) {
290 316
                             $lp_found = true;
@@ -293,7 +319,9 @@  discard block
 block discarded – undo
293 319
                         }
294 320
                         break;
295 321
                     case 3:
296
-                        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);
322
+                        if ($debug > 0) {
323
+                            error_log('New LP - found row - type aicc - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
324
+                        }
297 325
                         $oLP = new aicc(api_get_course_id(), $lp_id, api_get_user_id());
298 326
                         if ($oLP !== false) {
299 327
                             $lp_found = true;
@@ -302,7 +330,9 @@  discard block
 block discarded – undo
302 330
                         }
303 331
                         break;
304 332
                     default:
305
-                        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);
333
+                        if ($debug > 0) {
334
+                            error_log('New LP - found row - type other - Calling constructor with '.api_get_course_id().' - '.$lp_id.' - '.api_get_user_id(), 0);
335
+                        }
306 336
                         $oLP = new learnpath(api_get_course_id(), $lp_id, api_get_user_id());
307 337
                         if ($oLP !== false) {
308 338
                             $lp_found = true;
@@ -313,17 +343,23 @@  discard block
 block discarded – undo
313 343
                 }
314 344
             }
315 345
         } else {
316
-            if ($debug > 0) error_log('New LP - Request[lp_id] is not numeric', 0);
346
+            if ($debug > 0) {
347
+                error_log('New LP - Request[lp_id] is not numeric', 0);
348
+            }
317 349
         }
318 350
     } else {
319
-        if ($debug > 0) error_log('New LP - Request[lp_id] and refresh_id were empty', 0);
351
+        if ($debug > 0) {
352
+            error_log('New LP - Request[lp_id] and refresh_id were empty', 0);
353
+        }
320 354
     }
321 355
     if ($lp_found) {
322 356
         $_SESSION['oLP'] = $oLP;
323 357
     }
324 358
 }
325 359
 
326
-if ($debug > 0) error_log('New LP - Passed oLP creation check', 0);
360
+if ($debug > 0) {
361
+    error_log('New LP - Passed oLP creation check', 0);
362
+}
327 363
 
328 364
 $is_allowed_to_edit = api_is_allowed_to_edit(false, true, false, false);
329 365
 
@@ -360,7 +396,9 @@  discard block
 block discarded – undo
360 396
 }
361 397
 
362 398
 $redirectTo = '';
363
-if ($debug > 0) error_log('New LP - action "'.$action.'" triggered');
399
+if ($debug > 0) {
400
+    error_log('New LP - action "'.$action.'" triggered');
401
+}
364 402
 
365 403
 switch ($action) {
366 404
     case 'add_item':
@@ -369,7 +407,9 @@  discard block
 block discarded – undo
369 407
         }
370 408
         if (!$lp_found) {
371 409
             //check if the learnpath ID was defined, otherwise send back to list
372
-            if ($debug > 0) error_log('New LP - No learnpath given for add item', 0);
410
+            if ($debug > 0) {
411
+                error_log('New LP - No learnpath given for add item', 0);
412
+            }
373 413
             require 'lp_list.php';
374 414
         } else {
375 415
             $_SESSION['refresh'] = 1;
@@ -459,7 +499,9 @@  discard block
 block discarded – undo
459 499
         }
460 500
         if (!$lp_found) {
461 501
             //check if the learnpath ID was defined, otherwise send back to list
462
-            if ($debug > 0) error_log('New LP - No learnpath given for add audio', 0);
502
+            if ($debug > 0) {
503
+                error_log('New LP - No learnpath given for add audio', 0);
504
+            }
463 505
             require 'lp_list.php';
464 506
         } else {
465 507
             $_SESSION['refresh'] = 1;
@@ -607,8 +649,7 @@  discard block
 block discarded – undo
607 649
             if (!$is_allowed_to_edit) {
608 650
                 api_not_allowed(true);
609 651
             }
610
-            if (!$lp_found) { error_log('New LP - No learnpath given for set_autolaunch', 0); require 'lp_list.php'; }
611
-            else {
652
+            if (!$lp_found) { error_log('New LP - No learnpath given for set_autolaunch', 0); require 'lp_list.php'; } else {
612 653
                 $_SESSION['oLP']->set_autolaunch($_GET['lp_id'], $_GET['status']);
613 654
                 require 'lp_list.php';
614 655
                 exit;
@@ -689,8 +730,7 @@  discard block
 block discarded – undo
689 730
         if (!$is_allowed_to_edit) {
690 731
             api_not_allowed(true);
691 732
         }
692
-        if (!$lp_found) { error_log('New LP - No learnpath given for edit item prereq', 0); require 'lp_list.php'; }
693
-        else {
733
+        if (!$lp_found) { error_log('New LP - No learnpath given for edit item prereq', 0); require 'lp_list.php'; } else {
694 734
             if (isset($_POST['submit_button'])) {
695 735
                 //Updating the lp.modified_on
696 736
                 $_SESSION['oLP']->set_modified_on();
@@ -1119,16 +1159,24 @@  discard block
 block discarded – undo
1119 1159
         }
1120 1160
         break;
1121 1161
     case 'content':
1122
-        if ($debug > 0) error_log('New LP - Item id is '.intval($_GET['item_id']), 0);
1162
+        if ($debug > 0) {
1163
+            error_log('New LP - Item id is '.intval($_GET['item_id']), 0);
1164
+        }
1123 1165
         if (!$lp_found) {
1124 1166
             error_log('New LP - No learnpath given for content', 0);
1125 1167
             require 'lp_list.php';
1126 1168
         } else {
1127
-            if ($debug > 0) error_log('New LP - save_last()', 0);
1169
+            if ($debug > 0) {
1170
+                error_log('New LP - save_last()', 0);
1171
+            }
1128 1172
             $_SESSION['oLP']->save_last();
1129
-            if ($debug > 0) error_log('New LP - set_current_item()', 0);
1173
+            if ($debug > 0) {
1174
+                error_log('New LP - set_current_item()', 0);
1175
+            }
1130 1176
             $_SESSION['oLP']->set_current_item($_GET['item_id']);
1131
-            if ($debug > 0) error_log('New LP - start_current_item()', 0);
1177
+            if ($debug > 0) {
1178
+                error_log('New LP - start_current_item()', 0);
1179
+            }
1132 1180
             $_SESSION['oLP']->start_current_item();
1133 1181
             require 'lp_content.php';
1134 1182
         }
@@ -1244,8 +1292,7 @@  discard block
 block discarded – undo
1244 1292
         require 'lp_message.php';
1245 1293
         break;
1246 1294
     case 'return_to_course_homepage':
1247
-        if (!$lp_found) { error_log('New LP - No learnpath given for stats', 0); require 'lp_list.php'; }
1248
-        else {
1295
+        if (!$lp_found) { error_log('New LP - No learnpath given for stats', 0); require 'lp_list.php'; } else {
1249 1296
             $_SESSION['oLP']->save_current();
1250 1297
             $_SESSION['oLP']->save_last();
1251 1298
             $url = api_get_path(WEB_COURSE_PATH).api_get_course_path().'/index.php?id_session='.api_get_session_id();
@@ -1438,8 +1485,10 @@  discard block
 block discarded – undo
1438 1485
 
1439 1486
 if (!empty($_SESSION['oLP'])) {
1440 1487
     $_SESSION['lpobject'] = serialize($_SESSION['oLP']);
1441
-    if ($debug > 0) error_log('New LP - lpobject is serialized in session', 0);
1442
-}
1488
+    if ($debug > 0) {
1489
+        error_log('New LP - lpobject is serialized in session', 0);
1490
+    }
1491
+    }
1443 1492
 
1444 1493
 if (!empty($redirectTo)) {
1445 1494
     header("Location: $redirectTo");
Please login to merge, or discard this patch.
main/admin/user_move_stats.php 1 patch
Braces   +99 added lines, -43 removed lines patch added patch discarded remove patch
@@ -108,7 +108,9 @@  discard block
 block discarded – undo
108 108
                 //Check if the user is registered in the session otherwise we will add it
109 109
                 $result = SessionManager::get_users_by_session($new_session_id);
110 110
                 if (empty($result) || !in_array($user_id, array_keys($result))) {
111
-                    if ($debug) echo 'User added to the session';
111
+                    if ($debug) {
112
+                        echo 'User added to the session';
113
+                    }
112 114
                     //Registering user to the new session
113 115
                     SessionManager::subscribe_users_to_session($new_session_id,array($user_id),false);
114 116
                 }
@@ -143,10 +145,11 @@  discard block
 block discarded – undo
143 145
                     $list[$row['exe_id']]= $row;
144 146
                 }
145 147
 
146
-                if (!empty($list))
147
-                    foreach ($list as $exe_id =>$data) {
148
+                if (!empty($list)) {
149
+                                    foreach ($list as $exe_id =>$data) {
148 150
                         if ($update_database) {
149 151
                             $sql = "UPDATE $TABLETRACK_EXERCICES SET session_id = '$new_session_id' WHERE exe_id = $exe_id";
152
+                }
150 153
                             $res = Database::query($sql);
151 154
                             $result_message[$TABLETRACK_EXERCICES]++;
152 155
                         } else {
@@ -170,10 +173,11 @@  discard block
 block discarded – undo
170 173
                         $list[$row['exe_id']]= $row;
171 174
                     }
172 175
 
173
-                    if (!empty($list))
174
-                        foreach ($list as $exe_id =>$data) {
176
+                    if (!empty($list)) {
177
+                                            foreach ($list as $exe_id =>$data) {
175 178
                             if ($update_database) {
176 179
                                 $sql = "UPDATE $TABLETRACK_EXERCICES SET session_id = '$new_session_id' WHERE exe_id = $exe_id";
180
+                    }
177 181
                                 $res = Database::query($sql);
178 182
                                 $result_message[$TABLETRACK_EXERCICES]++;
179 183
                             } else {
@@ -198,10 +202,11 @@  discard block
 block discarded – undo
198 202
                     $list[$row['course_access_id']] = $row;
199 203
                 }
200 204
 
201
-                if (!empty($list))
202
-                    foreach ($list as $id => $data) {
205
+                if (!empty($list)) {
206
+                                    foreach ($list as $id => $data) {
203 207
                         if ($update_database) {
204 208
                             $sql = "UPDATE $TBL_TRACK_E_COURSE_ACCESS SET session_id = $new_session_id WHERE course_access_id = $id";
209
+                }
205 210
                             if ($debug) {
206 211
                                 echo $sql;
207 212
                             }
@@ -220,13 +225,18 @@  discard block
 block discarded – undo
220 225
                 while($row = Database::fetch_array($res,'ASSOC')) {
221 226
                     $list[] = $row['access_id'];
222 227
                 }
223
-                if (!empty($list))
224
-                    foreach ($list as $id) {
228
+                if (!empty($list)) {
229
+                                    foreach ($list as $id) {
225 230
                         if ($update_database) {
226 231
                             $sql = "UPDATE $TBL_TRACK_E_LAST_ACCESS SET access_session_id = $new_session_id WHERE access_id = $id";
227
-                            if ($debug) echo $sql;
232
+                }
233
+                            if ($debug) {
234
+                                echo $sql;
235
+                            }
228 236
                             $res = Database::query($sql);
229
-                            if ($debug) var_dump($res);
237
+                            if ($debug) {
238
+                                var_dump($res);
239
+                            }
230 240
                             $result_message[$TBL_TRACK_E_LAST_ACCESS]++;
231 241
                         }
232 242
                     }
@@ -250,13 +260,18 @@  discard block
 block discarded – undo
250 260
                     }
251 261
                 }
252 262
 
253
-                if (!empty($list))
254
-                    foreach ($list as $id=>$data) {
263
+                if (!empty($list)) {
264
+                                    foreach ($list as $id=>$data) {
255 265
                         if ($update_database) {
256 266
                             $sql = "UPDATE $TBL_LP_VIEW SET session_id = $new_session_id WHERE c_id = $course_id AND id = $id ";
257
-                            if ($debug) var_dump($sql);
267
+                }
268
+                            if ($debug) {
269
+                                var_dump($sql);
270
+                            }
258 271
                             $res = Database::query($sql);
259
-                            if ($debug) var_dump($res);
272
+                            if ($debug) {
273
+                                var_dump($res);
274
+                            }
260 275
                             $result_message[$TBL_LP_VIEW]++;
261 276
                         } else {
262 277
                             //Getting all information of that lp_item_id
@@ -283,10 +298,11 @@  discard block
 block discarded – undo
283 298
                             $list[$row['id']] = $row;
284 299
                         }
285 300
                     }
286
-                    if (!empty($list))
287
-                        foreach ($list as $id=>$data) {
301
+                    if (!empty($list)) {
302
+                                            foreach ($list as $id=>$data) {
288 303
                             //Getting all information of that lp_item_id
289 304
                             $score    = Tracking::get_avg_student_score($user_id, $origin_course_code,        array($data['lp_id']), $new_session_id);
305
+                    }
290 306
                             $progress = Tracking::get_avg_student_progress($user_id, $origin_course_code,     array($data['lp_id']), $new_session_id);
291 307
                             $result_message_compare['LP_VIEW'][$data['lp_id']] = array('score' => $score, 'progress' =>$progress);
292 308
                         }
@@ -302,9 +318,13 @@  discard block
 block discarded – undo
302 318
                     $id = $row['ref'];
303 319
                     if ($update_database) {
304 320
                         $sql = "UPDATE $TBL_AGENDA SET session_id = $new_session_id WHERE c_id = $course_id AND id = $id ";
305
-                        if ($debug) var_dump($sql);
321
+                        if ($debug) {
322
+                            var_dump($sql);
323
+                        }
306 324
                         $res_update = Database::query($sql);
307
-                        if ($debug) var_dump($res_update);
325
+                        if ($debug) {
326
+                            var_dump($res_update);
327
+                        }
308 328
                         $result_message['agenda']++;
309 329
                     }
310 330
                 }
@@ -316,22 +336,30 @@  discard block
 block discarded – undo
316 336
                 //echo '<h1>Student publication</h1>';
317 337
 
318 338
                 $sql = "SELECT ref FROM $TBL_ITEM_PROPERTY WHERE tool = 'work' AND insert_user_id = $user_id AND c_id = $course_id";
319
-                if ($debug) echo $sql;
339
+                if ($debug) {
340
+                    echo $sql;
341
+                }
320 342
                 $res = Database::query($sql);
321 343
                 while($row = Database::fetch_array($res,'ASSOC')) {
322 344
                     $id = $row['ref'];
323 345
                     $sql = "SELECT * FROM $TBL_STUDENT_PUBLICATION WHERE id = $id AND session_id = $origin_session_id AND c_id = $course_id";
324
-                    if ($debug) var_dump($sql);
346
+                    if ($debug) {
347
+                        var_dump($sql);
348
+                    }
325 349
                     $sub_res = Database::query($sql);
326 350
                     if (Database::num_rows($sub_res) > 0 ) {
327 351
                         $data = Database::fetch_array($sub_res,'ASSOC');
328
-                        if ($debug) var_dump($data);
352
+                        if ($debug) {
353
+                            var_dump($data);
354
+                        }
329 355
                         $parent_id = $data['parent_id'];
330 356
                         if (isset($data['parent_id']) && !empty($data['parent_id'])) {
331 357
                             $sql = "SELECT * FROM $TBL_STUDENT_PUBLICATION WHERE id = $parent_id AND c_id = $course_id";
332 358
                             $select_res     = Database::query($sql);
333 359
                             $parent_data    = Database::fetch_array($select_res,'ASSOC');
334
-                            if ($debug)     var_dump($parent_data);
360
+                            if ($debug) {
361
+                                var_dump($parent_data);
362
+                            }
335 363
 
336 364
                             $sys_course_path = api_get_path(SYS_COURSE_PATH);
337 365
                             $course_dir = $sys_course_path . $course_info['path'];
@@ -346,7 +374,9 @@  discard block
 block discarded – undo
346 374
                             $sql = "SELECT * FROM $TBL_STUDENT_PUBLICATION
347 375
                             		WHERE description like '%$search_this%' AND url LIKE '%$search_this2%' AND session_id = $new_session_id AND c_id = $course_id
348 376
                             		ORDER BY id desc  LIMIT 1";
349
-                            if ($debug) echo $sql;
377
+                            if ($debug) {
378
+                                echo $sql;
379
+                            }
350 380
                             $sub_res = Database::query($sql);
351 381
                             $num_rows = Database::num_rows($sub_res);
352 382
 
@@ -390,7 +420,9 @@  discard block
 block discarded – undo
390 420
 
391 421
                             //Creating student_publication_assignment if exists
392 422
                             $sql = "SELECT * FROM $TBL_STUDENT_PUBLICATION_ASSIGNMENT WHERE publication_id = $parent_id AND c_id = $course_id";
393
-                            if ($debug) var_dump($sql);
423
+                            if ($debug) {
424
+                                var_dump($sql);
425
+                            }
394 426
                             $rest_select     = Database::query($sql);
395 427
                             if (Database::num_rows($rest_select) > 0 ) {
396 428
                                 if ($update_database) {
@@ -402,7 +434,9 @@  discard block
 block discarded – undo
402 434
                                        add_to_calendar      = '".$assignment_data['add_to_calendar']."',
403 435
                                        enable_qualification = '".$assignment_data['enable_qualification']."',
404 436
                                        publication_id       = '".$new_parent_id."'";
405
-                                    if ($debug) echo $sql_add_publication;
437
+                                    if ($debug) {
438
+                                        echo $sql_add_publication;
439
+                                    }
406 440
                                     $rest_select     = Database::query($sql_add_publication);
407 441
                                     $id = Database::insert_id();
408 442
 
@@ -410,11 +444,15 @@  discard block
 block discarded – undo
410 444
                                         "has_properties         = '".$id."',
411 445
                                        view_properties    = '1'
412 446
                                        WHERE id   = ".$new_parent_id;
413
-                                    if ($debug) echo $sql_update;
447
+                                    if ($debug) {
448
+                                        echo $sql_update;
449
+                                    }
414 450
                                     $rest_update     = Database::query($sql_update);
415 451
 
416 452
 
417
-                                    if ($debug) var_dump($sql_update);
453
+                                    if ($debug) {
454
+                                        var_dump($sql_update);
455
+                                    }
418 456
                                     $result_message[$TBL_STUDENT_PUBLICATION_ASSIGNMENT]++;
419 457
                                 }
420 458
                             }
@@ -455,7 +493,9 @@  discard block
 block discarded – undo
455 493
                                     if ($result) {
456 494
                                         unlink($full_file_name);
457 495
                                         $sql = "DELETE FROM $TBL_STUDENT_PUBLICATION WHERE id= ".$data['id'];
458
-                                        if ($debug) var_dump($sql);
496
+                                        if ($debug) {
497
+                                            var_dump($sql);
498
+                                        }
459 499
                                         $result_delete     = Database::query($sql);
460 500
                                         api_item_property_update($course_info, 'work', $data['id'], 'DocumentDeleted', api_get_user_id());
461 501
                                     }
@@ -471,22 +511,30 @@  discard block
 block discarded – undo
471 511
                 //10. Dropbox - not neccesary to move categories (no presence of session_id)
472 512
 
473 513
                 $sql = "SELECT id FROM $TBL_DROPBOX_FILE WHERE uploader_id = $user_id AND session_id = $origin_session_id AND c_id = $course_id";
474
-                if ($debug) var_dump($sql);
514
+                if ($debug) {
515
+                    var_dump($sql);
516
+                }
475 517
                 $res = Database::query($sql);
476 518
                 while($row = Database::fetch_array($res,'ASSOC')) {
477 519
                     $id = $row['id'];
478 520
                     if ($update_database) {
479 521
                         $sql = "UPDATE $TBL_DROPBOX_FILE SET session_id = $new_session_id WHERE c_id = $course_id AND id = $id";
480
-                        if ($debug) var_dump($sql);
522
+                        if ($debug) {
523
+                            var_dump($sql);
524
+                        }
481 525
                         $res = Database::query($sql);
482
-                        if ($debug) var_dump($res);
526
+                        if ($debug) {
527
+                            var_dump($res);
528
+                        }
483 529
 
484 530
                         $sql = "UPDATE $TBL_DROPBOX_POST SET session_id = $new_session_id WHERE file_id = $id";
485
-                        if ($debug)
486
-                            var_dump($sql);
531
+                        if ($debug) {
532
+                                                    var_dump($sql);
533
+                        }
487 534
                         $res = Database::query($sql);
488
-                        if ($debug)
489
-                            var_dump($res);
535
+                        if ($debug) {
536
+                                                    var_dump($res);
537
+                        }
490 538
                         $result_message[$TBL_DROPBOX_FILE]++;
491 539
                     }
492 540
                 }
@@ -495,23 +543,30 @@  discard block
 block discarded – undo
495 543
 
496 544
                 $sql = "SELECT notebook_id FROM $TBL_NOTEBOOK
497 545
                         WHERE user_id = $user_id AND session_id = $origin_session_id AND course = '$origin_course_code' AND c_id = $course_id";
498
-                if ($debug) var_dump($sql);
546
+                if ($debug) {
547
+                    var_dump($sql);
548
+                }
499 549
                 $res = Database::query($sql);
500 550
                 while($row = Database::fetch_array($res,'ASSOC')) {
501 551
                     $id = $row['notebook_id'];
502 552
                     if ($update_database) {
503 553
                         $sql = "UPDATE $TBL_NOTEBOOK SET session_id = $new_session_id WHERE c_id = $course_id AND notebook_id = $id";
504
-                        if ($debug) var_dump($sql);
554
+                        if ($debug) {
555
+                            var_dump($sql);
556
+                        }
505 557
                         $res = Database::query($sql);
506
-                        if ($debug) var_dump($res);
558
+                        if ($debug) {
559
+                            var_dump($res);
560
+                        }
507 561
                     }
508 562
                 }
509 563
 
510 564
                 if ($update_database) {
511 565
                     echo '<h2>'.get_lang('StatsMoved').'</h2>';
512
-                    if (is_array($result_message))
513
-                        foreach ($result_message as $table=>$times) {
566
+                    if (is_array($result_message)) {
567
+                                            foreach ($result_message as $table=>$times) {
514 568
                             echo 'Table '.$table.' - '.$times.' records updated <br />';
569
+                    }
515 570
                         }
516 571
                 } else {
517 572
                     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/inc/lib/course.lib.php 1 patch
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -3416,7 +3416,7 @@  discard block
 block discarded – undo
3416 3416
             $html .= '<a class="thumbnail" href="'.$params['link'].'">';
3417 3417
             $html .= $params['icon'];
3418 3418
             $html .= '</a>';
3419
-        }else{
3419
+        } else{
3420 3420
             $html .= $params['icon'];
3421 3421
         }
3422 3422
         $html .= '</div>';
@@ -3675,7 +3675,7 @@  discard block
 block discarded – undo
3675 3675
             if ($showCustomIcon === 'true' && $iconName != 'course.png') {
3676 3676
                 $thumbnails = $course_info['course_image'];
3677 3677
                 $image = $course_info['course_image_large'];
3678
-            }else{
3678
+            } else{
3679 3679
                 $image = Display::return_icon('session_default.png', null, null, null,null, true);
3680 3680
             }
3681 3681
 
@@ -3803,7 +3803,7 @@  discard block
 block discarded – undo
3803 3803
             if ($showCustomIcon === 'true' && $iconName != 'course.png') {
3804 3804
                 $thumbnails = $course_info['course_image'];
3805 3805
                 $image = $course_info['course_image_large'];
3806
-            }else{
3806
+            } else{
3807 3807
                 $image = Display::return_icon('session_default.png', null, null, null,null, true);
3808 3808
             }
3809 3809
 
Please login to merge, or discard this patch.
main/inc/lib/message.lib.php 1 patch
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -662,8 +662,9 @@  discard block
 block discarded – undo
662 662
      */
663 663
     public static function update_message($user_id, $message_id)
664 664
     {
665
-        if ($message_id != strval(intval($message_id)) || $user_id != strval(intval($user_id)))
666
-            return false;
665
+        if ($message_id != strval(intval($message_id)) || $user_id != strval(intval($user_id))) {
666
+                    return false;
667
+        }
667 668
 
668 669
         $table_message = Database::get_main_table(TABLE_MESSAGE);
669 670
         $sql = "UPDATE $table_message SET msg_status = '0'
@@ -703,8 +704,9 @@  discard block
 block discarded – undo
703 704
      */
704 705
     public static function get_message_by_user($user_id, $message_id)
705 706
     {
706
-        if ($message_id != strval(intval($message_id)) || $user_id != strval(intval($user_id)))
707
-            return false;
707
+        if ($message_id != strval(intval($message_id)) || $user_id != strval(intval($user_id))) {
708
+                    return false;
709
+        }
708 710
         $table_message = Database::get_main_table(TABLE_MESSAGE);
709 711
         $query = "SELECT * FROM $table_message
710 712
                   WHERE user_receiver_id=" . intval($user_id) . " AND id='" . intval($message_id) . "'";
@@ -829,8 +831,9 @@  discard block
 block discarded – undo
829 831
      */
830 832
     public static function exist_message($user_id, $id)
831 833
     {
832
-        if ($id != strval(intval($id)) || $user_id != strval(intval($user_id)))
833
-            return false;
834
+        if ($id != strval(intval($id)) || $user_id != strval(intval($user_id))) {
835
+                    return false;
836
+        }
834 837
         $table_message = Database::get_main_table(TABLE_MESSAGE);
835 838
         $query = "SELECT id FROM $table_message
836 839
                   WHERE
@@ -861,8 +864,9 @@  discard block
 block discarded – undo
861 864
             $direction = 'DESC';
862 865
         } else {
863 866
             $column = intval($column);
864
-            if (!in_array($direction, array('ASC', 'DESC')))
865
-                $direction = 'ASC';
867
+            if (!in_array($direction, array('ASC', 'DESC'))) {
868
+                            $direction = 'ASC';
869
+            }
866 870
         }
867 871
         $table_message = Database::get_main_table(TABLE_MESSAGE);
868 872
         $request = api_is_xml_http_request();
Please login to merge, or discard this patch.