Completed
Push — master ( 565c08...93d030 )
by José
125:33 queued 71:22
created
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.
main/gradebook/lib/be/evaluation.class.php 1 patch
Braces   +22 added lines, -10 removed lines patch added patch discarded remove patch
@@ -232,8 +232,11 @@  discard block
 block discarded – undo
232 232
 		}
233 233
 
234 234
 		if (isset($user_id)) {
235
-			if ($paramcount != 0) $sql .= ' AND';
236
-			else $sql .= ' WHERE';
235
+			if ($paramcount != 0) {
236
+			    $sql .= ' AND';
237
+			} else {
238
+			    $sql .= ' WHERE';
239
+			}
237 240
 			$sql .= ' user_id = '.intval($user_id);
238 241
 			$paramcount ++;
239 242
 		}
@@ -252,22 +255,31 @@  discard block
 block discarded – undo
252 255
 		}
253 256
 
254 257
 		if (isset($category_id)) {
255
-			if ($paramcount != 0) $sql .= ' AND';
256
-			else $sql .= ' WHERE';
258
+			if ($paramcount != 0) {
259
+			    $sql .= ' AND';
260
+			} else {
261
+			    $sql .= ' WHERE';
262
+			}
257 263
 			$sql .= ' category_id = '.intval($category_id);
258 264
 			$paramcount ++;
259 265
 		}
260 266
 
261 267
 		if (isset($visible)) {
262
-			if ($paramcount != 0) $sql .= ' AND';
263
-			else $sql .= ' WHERE';
268
+			if ($paramcount != 0) {
269
+			    $sql .= ' AND';
270
+			} else {
271
+			    $sql .= ' WHERE';
272
+			}
264 273
 			$sql .= ' visible = '.intval($visible);
265 274
 			$paramcount ++;
266 275
 		}
267 276
 
268 277
 		if (isset($locked)) {
269
-			if ($paramcount != 0) $sql .= ' AND';
270
-			else $sql .= ' WHERE';
278
+			if ($paramcount != 0) {
279
+			    $sql .= ' AND';
280
+			} else {
281
+			    $sql .= ' WHERE';
282
+			}
271 283
 			$sql .= ' locked = '.intval($locked);
272 284
 		}
273 285
 
@@ -407,7 +419,7 @@  discard block
 block discarded – undo
407 419
 			.', description = ';
408 420
 		if (isset($this->description)) {
409 421
 			$sql .= "'".Database::escape_string($this->get_description())."'";
410
-		}else {
422
+		} else {
411 423
 			$sql .= 'null';
412 424
 		}
413 425
 		$sql .= ', user_id = '.intval($this->get_user_id())
@@ -475,7 +487,7 @@  discard block
 block discarded – undo
475 487
 				$sql .= ' AND user_id = '.api_get_user_id();
476 488
 			}
477 489
 
478
-		}else {
490
+		} else {
479 491
 			$sql .= ' AND user_id = '.api_get_user_id();
480 492
 		}
481 493
 
Please login to merge, or discard this patch.
main/reports/reports.php 1 patch
Braces   +43 added lines, -31 removed lines patch added patch discarded remove patch
@@ -37,16 +37,18 @@  discard block
 block discarded – undo
37 37
 	// converting post vars to get uri
38 38
 	$params = '';
39 39
 	$kv = array();
40
-	foreach ($_POST as $key => $value)
41
-		if ($key != 'format')
40
+	foreach ($_POST as $key => $value) {
41
+			if ($key != 'format')
42 42
 			$kv[] = $key.'='.urlencode($value);
43
+	}
43 44
 	$query_string = join("&", $kv);
44 45
 	die('<a href="reports.php?format=directlink&'.$query_string.'">'.get_lang('ReportTypeLink').'</a>');
45 46
 }
46 47
 
47 48
 if ($_REQUEST['format'] == 'directlink') {
48
-	foreach (array('jquery.dataTables.min.js') as $js)
49
-		$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_JS_PATH).$js.'" type="text/javascript" language="javascript"></script>'."\n";
49
+	foreach (array('jquery.dataTables.min.js') as $js) {
50
+			$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_JS_PATH).$js.'" type="text/javascript" language="javascript"></script>'."\n";
51
+	}
50 52
 
51 53
 	$htmlCSSXtra[] = 'dataTable.css';
52 54
 
@@ -72,9 +74,10 @@  discard block
 block discarded – undo
72 74
 	// converting post vars to get uri
73 75
 	$params = '';
74 76
 	$kv = array();
75
-	foreach ($_POST as $key => $value)
76
-		if ($key != 'format')
77
+	foreach ($_POST as $key => $value) {
78
+			if ($key != 'format')
77 79
 			$kv[] = $key.'='.urlencode($value);
80
+	}
78 81
 	$query_string = join("&", $kv);
79 82
 	die('<a href="reports.php?format=downloadcsv&'.$query_string.'">'.get_lang('DownloadFile').'</a>');
80 83
 } else if ($_REQUEST['format'] == 'downloadcsv') {
@@ -82,8 +85,7 @@  discard block
 block discarded – undo
82 85
 		header("Pragma: must-revalidate");
83 86
 		header("Cache-Control: must-revalidate");
84 87
 		header("Content-type: application/vnd.ms-excel");
85
-	}
86
-	else {
88
+	} else {
87 89
 		header("Content-type: text/csv");
88 90
 	}
89 91
 	$date = date("Y-m-d");
@@ -96,10 +98,12 @@  discard block
 block discarded – undo
96 98
 
97 99
 if (is_array($reports_template[$_REQUEST['type']])) {
98 100
 	$query = $reports_template[$_REQUEST['type']]['getSQL']();
99
-	if (! is_array($query))
100
-		$query = array($query);
101
-	if ($_REQUEST['format'] == 'sql')
102
-		die(var_export($query, true));
101
+	if (! is_array($query)) {
102
+			$query = array($query);
103
+	}
104
+	if ($_REQUEST['format'] == 'sql') {
105
+			die(var_export($query, true));
106
+	}
103 107
 
104 108
 	$result = multiquery_query($query);
105 109
 
@@ -155,32 +159,35 @@  discard block
 block discarded – undo
155 159
 		if (substr($columns[$i], -5, 5) != '_link') {
156 160
 			$column_islink[$i] = false;
157 161
 			echo '<th>'.$columns[$i].'</th>';
158
-		} else
159
-			$columns_islink[$i] = true;
162
+		} else {
163
+					$columns_islink[$i] = true;
164
+		}
160 165
 	}
161 166
 
162 167
 	// checking resolving link column id
163 168
 	$columns_flip = array_flip($columns);
164 169
 	$columns_link = array();
165
-	for ($i=0; $i < $nfields; $i++)
166
-		if ($column_islink[$i] == false && array_key_exists($columns[$i].'_link', $columns_flip))
170
+	for ($i=0; $i < $nfields; $i++) {
171
+			if ($column_islink[$i] == false && array_key_exists($columns[$i].'_link', $columns_flip))
167 172
 			$columns_link[$i] = $columns_flip[$columns[$i].'_link'];
168
-		else
169
-			$columns_link[$i] = '';
173
+	}
174
+		else {
175
+					$columns_link[$i] = '';
176
+		}
170 177
 	echo '</tr></thead><tbody>';
171 178
 	while ($row = multiquery_fetch_row($result)) {
172 179
 		echo '<tr>';
173
-		for ($i = 0; $i<$nfields; $i++)
174
-			if (!$columns_islink[$i]){ // ignore links
180
+		for ($i = 0; $i<$nfields; $i++) {
181
+					if (!$columns_islink[$i]){ // ignore links
175 182
 				if ($columns_link[$i] != '') // link is defined
176 183
 					if (substr($columns_link[$i],0,10) == 'javascript') {
177 184
 						echo '<td><a href="#" onclick="'.$row[$columns_link[$i]].'">'.$row[$i].'</a></td>';
178
-					}
179
-					else {
185
+		}
186
+					} else {
180 187
 						echo '<td><a href="'.$row[$columns_link[$i]].'">'.$row[$i].'</a></td>';
181
-					}
182
-				else
183
-					echo '<td>'.$row[$i].'</td>';
188
+					} else {
189
+									echo '<td>'.$row[$i].'</td>';
190
+				}
184 191
 			}
185 192
 		echo "</tr>\n";
186 193
 	}
@@ -206,18 +213,23 @@  discard block
 block discarded – undo
206 213
 		if (substr($columns[$i], -5, 5) != '_link') {
207 214
 			$column_islink[$i] = false;
208 215
 			echo csv_escaping($columns[$i]).',';
209
-		} else
210
-			$columns_islink[$i] = true;
216
+		} else {
217
+					$columns_islink[$i] = true;
218
+		}
211 219
 	}
212 220
 
213 221
 	echo "\n";
214 222
 	while ($row = multiquery_fetch_row($result)) {
215
-		for ($i = 0; $i<$nfields; $i++)
216
-			if (!$columns_islink[$i]) // ignore links
217
-				echo csv_escaping($row[$i]).',';  // fixme
223
+		for ($i = 0; $i<$nfields; $i++) {
224
+					if (!$columns_islink[$i]) // ignore links
225
+				echo csv_escaping($row[$i]).',';
226
+		}
227
+		// fixme
218 228
 		echo "\n";
219 229
 	}
220
-} else die(get_lang('UnknownFormat'));
230
+} else {
231
+    die(get_lang('UnknownFormat'));
232
+}
221 233
 
222 234
 function csv_escaping($value, $csv_separator = ',') {
223 235
 	$value = str_replace('"','""',$value);
Please login to merge, or discard this patch.