Completed
Push — 1.10.x ( f89535...7ba96a )
by Angel Fernando Quiroz
126:15 queued 89:30
created
main/inc/lib/thematic.lib.php 1 patch
Spacing   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
         $from = intval($from);
75 75
         $number_of_items = intval($number_of_items);
76 76
 
77
-        if (!in_array($direction, array('ASC','DESC'))) {
77
+        if (!in_array($direction, array('ASC', 'DESC'))) {
78 78
             $direction = 'ASC';
79 79
         }
80 80
 
@@ -97,24 +97,24 @@  discard block
 block discarded – undo
97 97
             $thematic[1] = '<a href="index.php?'.api_get_cidreq().'&action=thematic_details&thematic_id='.$thematic[0].'">'.
98 98
                 Security::remove_XSS($thematic[1], STUDENT).$session_star.'</a>';
99 99
             if (api_is_allowed_to_edit(null, true)) {
100
-                $actions  = '';
100
+                $actions = '';
101 101
 
102 102
                 if (api_get_session_id()) {
103 103
                     if (api_get_session_id() == $thematic[3]) {
104 104
                         $actions .= '<a href="index.php?'.api_get_cidreq().'&action=thematic_plan_list&thematic_id='.$thematic[0].'">'.
105
-                            Display::return_icon('lesson_plan.png',get_lang('ThematicPlan'),'',ICON_SIZE_SMALL).'</a>&nbsp;';
105
+                            Display::return_icon('lesson_plan.png', get_lang('ThematicPlan'), '', ICON_SIZE_SMALL).'</a>&nbsp;';
106 106
                         $actions .= '<a href="index.php?'.api_get_cidreq().'&action=thematic_advance_list&thematic_id='.$thematic[0].'">'.
107
-                            Display::return_icon('lesson_plan_calendar.png',get_lang('ThematicAdvance'),'',ICON_SIZE_SMALL).'</a>&nbsp;';
107
+                            Display::return_icon('lesson_plan_calendar.png', get_lang('ThematicAdvance'), '', ICON_SIZE_SMALL).'</a>&nbsp;';
108 108
 
109 109
                         $actions .= '<a href="index.php?'.api_get_cidreq().'&action=thematic_edit&thematic_id='.$thematic[0].'">'.
110
-                            Display::return_icon('edit.png',get_lang('Edit'),'',ICON_SIZE_SMALL).'</a>';
110
+                            Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL).'</a>';
111 111
                         $actions .= '<a onclick="javascript:if(!confirm(\''.get_lang('AreYouSureToDelete').'\')) return false;" href="index.php?'.api_get_cidreq().'&action=thematic_delete&thematic_id='.$thematic[0].'">'.
112
-                            Display::return_icon('delete.png',get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>';
112
+                            Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>';
113 113
                     } else {
114
-                        $actions .= Display::return_icon('lesson_plan_na.png',get_lang('ThematicPlan'),'',ICON_SIZE_SMALL).'&nbsp;';
115
-                        $actions .= Display::return_icon('lesson_plan_calendar_na.png',get_lang('ThematicAdvance'),'',ICON_SIZE_SMALL).'&nbsp;';
116
-                        $actions .= Display::return_icon('edit_na.png',get_lang('Edit'),'',ICON_SIZE_SMALL);
117
-                        $actions .= Display::return_icon('delete_na.png',get_lang('Delete'),'',ICON_SIZE_SMALL).'&nbsp;';
114
+                        $actions .= Display::return_icon('lesson_plan_na.png', get_lang('ThematicPlan'), '', ICON_SIZE_SMALL).'&nbsp;';
115
+                        $actions .= Display::return_icon('lesson_plan_calendar_na.png', get_lang('ThematicAdvance'), '', ICON_SIZE_SMALL).'&nbsp;';
116
+                        $actions .= Display::return_icon('edit_na.png', get_lang('Edit'), '', ICON_SIZE_SMALL);
117
+                        $actions .= Display::return_icon('delete_na.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'&nbsp;';
118 118
                         $actions .= Display::url(
119 119
                             Display::return_icon('cd.gif', get_lang('Copy')),
120 120
                             'index.php?'.api_get_cidreq().'&action=thematic_copy&thematic_id='.$thematic[0]
@@ -122,26 +122,26 @@  discard block
 block discarded – undo
122 122
                     }
123 123
                 } else {
124 124
                     $actions .= '<a href="index.php?'.api_get_cidreq().'&action=thematic_plan_list&thematic_id='.$thematic[0].'">'.
125
-                        Display::return_icon('lesson_plan.png',get_lang('ThematicPlan'),'',ICON_SIZE_SMALL).'</a>&nbsp;';
125
+                        Display::return_icon('lesson_plan.png', get_lang('ThematicPlan'), '', ICON_SIZE_SMALL).'</a>&nbsp;';
126 126
                     $actions .= '<a href="index.php?'.api_get_cidreq().'&action=thematic_advance_list&thematic_id='.$thematic[0].'">'.
127
-                        Display::return_icon('lesson_plan_calendar.png',get_lang('ThematicAdvance'),'',ICON_SIZE_SMALL).'</a>&nbsp;';
127
+                        Display::return_icon('lesson_plan_calendar.png', get_lang('ThematicAdvance'), '', ICON_SIZE_SMALL).'</a>&nbsp;';
128 128
 
129 129
                     if ($thematic[2] > 1) {
130 130
                         $actions .= '<a href="'.api_get_self().'?action=moveup&'.api_get_cidreq().'&thematic_id='.$thematic[0].'">'.
131
-                            Display::return_icon('up.png', get_lang('Up'),'',ICON_SIZE_SMALL).'</a>';
131
+                            Display::return_icon('up.png', get_lang('Up'), '', ICON_SIZE_SMALL).'</a>';
132 132
                     } else {
133
-                        $actions .= Display::return_icon('up_na.png','&nbsp;','',ICON_SIZE_SMALL);
133
+                        $actions .= Display::return_icon('up_na.png', '&nbsp;', '', ICON_SIZE_SMALL);
134 134
                     }
135 135
                     if ($thematic[2] < self::get_max_thematic_item()) {
136 136
                         $actions .= '<a href="'.api_get_self().'?action=movedown&a'.api_get_cidreq().'&thematic_id='.$thematic[0].'">'.
137
-                            Display::return_icon('down.png',get_lang('Down'),'',ICON_SIZE_SMALL).'</a>';
137
+                            Display::return_icon('down.png', get_lang('Down'), '', ICON_SIZE_SMALL).'</a>';
138 138
                     } else {
139
-                        $actions .= Display::return_icon('down_na.png','&nbsp;','',ICON_SIZE_SMALL);
139
+                        $actions .= Display::return_icon('down_na.png', '&nbsp;', '', ICON_SIZE_SMALL);
140 140
                     }
141 141
                     $actions .= '<a href="index.php?'.api_get_cidreq().'&action=thematic_edit&thematic_id='.$thematic[0].'">'.
142
-                        Display::return_icon('edit.png',get_lang('Edit'),'',ICON_SIZE_SMALL).'</a>';
142
+                        Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL).'</a>';
143 143
                     $actions .= '<a onclick="javascript:if(!confirm(\''.get_lang('AreYouSureToDelete').'\')) return false;" href="index.php?'.api_get_cidreq().'&action=thematic_delete&thematic_id='.$thematic[0].'">'.
144
-                        Display::return_icon('delete.png',get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>';
144
+                        Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>';
145 145
                 }
146 146
                 $thematics[] = array($thematic[0], $thematic[1], $actions);
147 147
             }
@@ -278,9 +278,9 @@  discard block
 block discarded – undo
278 278
         $res = Database::query($sql);
279 279
         if (Database::num_rows($res) > 0) {
280 280
             if (!empty($thematic_id)) {
281
-                $data = Database::fetch_array($res,'ASSOC');
281
+                $data = Database::fetch_array($res, 'ASSOC');
282 282
             } else {
283
-                while ($row = Database::fetch_array($res,'ASSOC')) {
283
+                while ($row = Database::fetch_array($res, 'ASSOC')) {
284 284
                     $data[$row['id']] = $row;
285 285
                 }
286 286
             }
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
 
376 376
         if (is_array($thematic_id)) {
377 377
             foreach ($thematic_id as $id) {
378
-                $id	= intval($id);
378
+                $id = intval($id);
379 379
                 $sql = "UPDATE $tbl_thematic SET active = 0
380 380
                         WHERE c_id = $course_id AND id = $id";
381 381
                 $result = Database::query($sql);
@@ -391,8 +391,8 @@  discard block
 block discarded – undo
391 391
                     );
392 392
                 }
393 393
             }
394
-        } else  {
395
-            $thematic_id	= intval($thematic_id);
394
+        } else {
395
+            $thematic_id = intval($thematic_id);
396 396
             $sql = "UPDATE $tbl_thematic SET active = 0
397 397
                     WHERE c_id = $course_id AND id = $thematic_id";
398 398
             $result = Database::query($sql);
@@ -428,8 +428,8 @@  discard block
 block discarded – undo
428 428
         $new_thematic_id = $thematic_copy->thematic_save();
429 429
         if (!empty($new_thematic_id)) {
430 430
             $thematic_advanced = self::get_thematic_advance_by_thematic_id($thematic_id);
431
-            if(!empty($thematic_advanced)) {
432
-                foreach($thematic_advanced as $item) {
431
+            if (!empty($thematic_advanced)) {
432
+                foreach ($thematic_advanced as $item) {
433 433
                     $thematic = new Thematic();
434 434
                     $thematic->set_thematic_advance_attributes(
435 435
                         0,
@@ -492,7 +492,7 @@  discard block
 block discarded – undo
492 492
         $column = intval($column);
493 493
         $from   = intval($from);
494 494
         $number_of_items = intval($number_of_items);
495
-        if (!in_array($direction, array('ASC','DESC'))) {
495
+        if (!in_array($direction, array('ASC', 'DESC'))) {
496 496
             $direction = 'ASC';
497 497
         }
498 498
         $data = array();
@@ -525,8 +525,8 @@  discard block
 block discarded – undo
525 525
                     $thematic_advance[1] = api_get_local_time($thematic_advance[1]);
526 526
                     $thematic_advance[1] = api_format_date($thematic_advance[1], DATE_TIME_FORMAT_LONG);
527 527
                     $actions  = '';
528
-                    $actions .= '<a href="index.php?'.api_get_cidreq().'&action=thematic_advance_edit&thematic_id='.$thematic_id.'&thematic_advance_id='.$thematic_advance[0].'">'.Display::return_icon('edit.png',get_lang('Edit'),'',22).'</a>';
529
-                    $actions .= '<a onclick="javascript:if(!confirm(\''.get_lang('AreYouSureToDelete').'\')) return false;" href="index.php?'.api_get_cidreq().'&action=thematic_advance_delete&thematic_id='.$thematic_id.'&thematic_advance_id='.$thematic_advance[0].'">'.Display::return_icon('delete.png',get_lang('Delete'),'',22).'</a></center>';
528
+                    $actions .= '<a href="index.php?'.api_get_cidreq().'&action=thematic_advance_edit&thematic_id='.$thematic_id.'&thematic_advance_id='.$thematic_advance[0].'">'.Display::return_icon('edit.png', get_lang('Edit'), '', 22).'</a>';
529
+                    $actions .= '<a onclick="javascript:if(!confirm(\''.get_lang('AreYouSureToDelete').'\')) return false;" href="index.php?'.api_get_cidreq().'&action=thematic_advance_delete&thematic_id='.$thematic_id.'&thematic_advance_id='.$thematic_advance[0].'">'.Display::return_icon('delete.png', get_lang('Delete'), '', 22).'</a></center>';
530 530
                     $data[] = array($i, $thematic_advance[1], $thematic_advance[2], $thematic_advance[3], $actions);
531 531
                     $i++;
532 532
                 }
@@ -590,7 +590,7 @@  discard block
 block discarded – undo
590 590
 
591 591
                 $session_star = '';
592 592
                 if (api_is_allowed_to_edit(null, true)) {
593
-                    if ($thematic_advance['session_id'] !=0) {
593
+                    if ($thematic_advance['session_id'] != 0) {
594 594
                         $session_star = api_get_session_image(api_get_session_id(), $uinfo['status']);
595 595
                     }
596 596
                 }
@@ -616,13 +616,13 @@  discard block
 block discarded – undo
616 616
 
617 617
         foreach ($data as $thematic_id => $thematic_plan_data) {
618 618
             $new_thematic_plan_data = array();
619
-            foreach($thematic_plan_data as $thematic_item) {
619
+            foreach ($thematic_plan_data as $thematic_item) {
620 620
                 $thematic_simple_list[] = $thematic_item['description_type'];
621 621
                 $new_thematic_plan_data[$thematic_item['description_type']] = $thematic_item;
622 622
             }
623 623
 
624 624
             if (!empty($thematic_simple_list)) {
625
-                foreach($thematic_simple_list as $item) {
625
+                foreach ($thematic_simple_list as $item) {
626 626
                     $default_thematic_plan_title[$item] = $new_thematic_plan_data[$item]['title'];
627 627
                 }
628 628
             }
@@ -638,7 +638,7 @@  discard block
 block discarded – undo
638 638
                     }
639 639
                     if (!empty($data[$thematic_id][$id]['title']) && !empty($data[$thematic_id][$id]['description'])) {
640 640
                         if (api_is_allowed_to_edit(null, true)) {
641
-                            if ($data[$thematic_id][$id]['session_id'] !=0) {
641
+                            if ($data[$thematic_id][$id]['session_id'] != 0) {
642 642
                                 $session_star = api_get_session_image(api_get_session_id(), $uinfo['status']);
643 643
                             }
644 644
                         }
@@ -651,7 +651,7 @@  discard block
 block discarded – undo
651 651
             if ($no_data) {
652 652
                 $return .= '<div><em>'.get_lang('StillDoNotHaveAThematicPlan').'</em></div>';
653 653
             }
654
-            $return  .= '</div>';
654
+            $return .= '</div>';
655 655
             $final_return[$thematic_id] = $return;
656 656
         }
657 657
         return $final_return;
@@ -691,7 +691,7 @@  discard block
 block discarded – undo
691 691
                 api_get_session_id()
692 692
             );
693 693
             foreach ($list as $value) {
694
-                $elements[$value['ref']]= $value;
694
+                $elements[$value['ref']] = $value;
695 695
             }
696 696
         }
697 697
 
@@ -865,18 +865,18 @@  discard block
 block discarded – undo
865 865
             api_get_session_id()
866 866
         );
867 867
 
868
-        $thematic_plan_complete_list  = array();
868
+        $thematic_plan_complete_list = array();
869 869
         $thematic_plan_id_list = array();
870 870
 
871 871
         if (!empty($items_from_course)) {
872
-            foreach($items_from_course as $item) {
872
+            foreach ($items_from_course as $item) {
873 873
                 $thematic_plan_id_list[] = $item['ref'];
874 874
                 $thematic_plan_complete_list[$item['ref']] = $item;
875 875
             }
876 876
         }
877 877
 
878 878
         if (!empty($items_from_session)) {
879
-            foreach($items_from_session as $item) {
879
+            foreach ($items_from_session as $item) {
880 880
                 $thematic_plan_id_list[] = $item['ref'];
881 881
                 $thematic_plan_complete_list[$item['ref']] = $item;
882 882
             }
@@ -898,7 +898,7 @@  discard block
 block discarded – undo
898 898
                 if (!isset($thematic_id) && !isset($description_type)) {
899 899
                     // group all data group by thematic id
900 900
                     $tmp = array();
901
-                    while ($row = Database::fetch_array($rs,'ASSOC')) {
901
+                    while ($row = Database::fetch_array($rs, 'ASSOC')) {
902 902
                         $tmp[] = $row['thematic_id'];
903 903
                         if (in_array($row['thematic_id'], $tmp)) {
904 904
                             $row['session_id'] = $thematic_plan_complete_list[$row['id']];
@@ -906,7 +906,7 @@  discard block
 block discarded – undo
906 906
                         }
907 907
                     }
908 908
                 } else {
909
-                    while ($row = Database::fetch_array($rs,'ASSOC')) {
909
+                    while ($row = Database::fetch_array($rs, 'ASSOC')) {
910 910
                         $row['session_id'] = $thematic_plan_complete_list[$row['id']];
911 911
                         $data[] = $row;
912 912
                     }
@@ -941,8 +941,8 @@  discard block
 block discarded – undo
941 941
         );
942 942
 
943 943
         $elements_to_show = array();
944
-        foreach($list as $value) {
945
-            $elements_to_show[]= $value['ref'];
944
+        foreach ($list as $value) {
945
+            $elements_to_show[] = $value['ref'];
946 946
         }
947 947
         $condition = '';
948 948
         if (!empty($elements_to_show)) {
@@ -954,7 +954,7 @@  discard block
 block discarded – undo
954 954
                     c_id = $course_id AND
955 955
                     thematic_id = $thematic_id AND
956 956
                     description_type = '$description_type'";
957
-        $rs	 = Database::query($sql);
957
+        $rs = Database::query($sql);
958 958
 
959 959
         $affected_rows = 0;
960 960
         if (Database::num_rows($rs) > 0) {
@@ -1190,7 +1190,7 @@  discard block
 block discarded – undo
1190 1190
             $diff = array_diff($all, $a_thematic_advance_ids);
1191 1191
             if (!empty($diff)) {
1192 1192
                 $upd = "UPDATE $tbl_thematic_advance SET done_advance = 0
1193
-    			        WHERE c_id = $course_id AND id IN(".implode(',',$diff).") ";
1193
+    			        WHERE c_id = $course_id AND id IN(".implode(',', $diff).") ";
1194 1194
                 Database::query($upd);
1195 1195
             }
1196 1196
 
@@ -1304,7 +1304,7 @@  discard block
 block discarded – undo
1304 1304
             $course_code = api_get_course_id();
1305 1305
         }
1306 1306
         if (api_get_session_id()) {
1307
-            $thematic_data = $this->get_thematic_list(null, $course_code );
1307
+            $thematic_data = $this->get_thematic_list(null, $course_code);
1308 1308
         } else {
1309 1309
             $thematic_data = $this->get_thematic_list(null, $course_code, 0);
1310 1310
         }
@@ -1356,7 +1356,7 @@  discard block
 block discarded – undo
1356 1356
             }
1357 1357
             // calculate average by thematic
1358 1358
             $count_total_advances = count($advances);
1359
-            $average = round(($count_done_advances*100)/$count_total_advances);
1359
+            $average = round(($count_done_advances * 100) / $count_total_advances);
1360 1360
         }
1361 1361
 
1362 1362
         return $average;
@@ -1447,12 +1447,12 @@  discard block
 block discarded – undo
1447 1447
     public function get_default_thematic_plan_title()
1448 1448
     {
1449 1449
         $default_thematic_plan_titles = array();
1450
-        $default_thematic_plan_titles[1]= get_lang('Objectives');
1451
-        $default_thematic_plan_titles[2]= get_lang('SkillToAcquire');
1452
-        $default_thematic_plan_titles[3]= get_lang('Methodology');
1453
-        $default_thematic_plan_titles[4]= get_lang('Infrastructure');
1454
-        $default_thematic_plan_titles[5]= get_lang('Assessment');
1455
-        $default_thematic_plan_titles[6]= get_lang('Others');
1450
+        $default_thematic_plan_titles[1] = get_lang('Objectives');
1451
+        $default_thematic_plan_titles[2] = get_lang('SkillToAcquire');
1452
+        $default_thematic_plan_titles[3] = get_lang('Methodology');
1453
+        $default_thematic_plan_titles[4] = get_lang('Infrastructure');
1454
+        $default_thematic_plan_titles[5] = get_lang('Assessment');
1455
+        $default_thematic_plan_titles[6] = get_lang('Others');
1456 1456
 
1457 1457
         return $default_thematic_plan_titles;
1458 1458
     }
@@ -1464,12 +1464,12 @@  discard block
 block discarded – undo
1464 1464
     public function get_default_thematic_plan_icon()
1465 1465
     {
1466 1466
         $default_thematic_plan_icon = array();
1467
-        $default_thematic_plan_icon[1]= 'icons/32/objective.png';
1468
-        $default_thematic_plan_icon[2]= 'icons/32/skills.png';
1469
-        $default_thematic_plan_icon[3]= 'icons/32/strategy.png';
1470
-        $default_thematic_plan_icon[4]= 'icons/32/laptop.png';
1471
-        $default_thematic_plan_icon[5]= 'icons/32/assessment.png';
1472
-        $default_thematic_plan_icon[6]= 'icons/32/wizard.png';
1467
+        $default_thematic_plan_icon[1] = 'icons/32/objective.png';
1468
+        $default_thematic_plan_icon[2] = 'icons/32/skills.png';
1469
+        $default_thematic_plan_icon[3] = 'icons/32/strategy.png';
1470
+        $default_thematic_plan_icon[4] = 'icons/32/laptop.png';
1471
+        $default_thematic_plan_icon[5] = 'icons/32/assessment.png';
1472
+        $default_thematic_plan_icon[6] = 'icons/32/wizard.png';
1473 1473
 
1474 1474
         return $default_thematic_plan_icon;
1475 1475
     }
@@ -1481,11 +1481,11 @@  discard block
 block discarded – undo
1481 1481
     public function get_default_question()
1482 1482
     {
1483 1483
         $question = array();
1484
-        $question[1]= get_lang('ObjectivesQuestions');
1485
-        $question[2]= get_lang('SkillToAcquireQuestions');
1486
-        $question[3]= get_lang('MethodologyQuestions');
1487
-        $question[4]= get_lang('InfrastructureQuestions');
1488
-        $question[5]= get_lang('AssessmentQuestions');
1484
+        $question[1] = get_lang('ObjectivesQuestions');
1485
+        $question[2] = get_lang('SkillToAcquireQuestions');
1486
+        $question[3] = get_lang('MethodologyQuestions');
1487
+        $question[4] = get_lang('InfrastructureQuestions');
1488
+        $question[5] = get_lang('AssessmentQuestions');
1489 1489
 
1490 1490
         return $question;
1491 1491
     }
Please login to merge, or discard this patch.
main/inc/lib/glossary.lib.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -39,13 +39,13 @@  discard block
 block discarded – undo
39 39
      * @param int $glossary_id
40 40
      * @return string The glossary description
41 41
      */
42
-    public static function get_glossary_term_by_glossary_id ($glossary_id)
42
+    public static function get_glossary_term_by_glossary_id($glossary_id)
43 43
     {
44
-        $glossary_table  = Database::get_course_table(TABLE_GLOSSARY);
44
+        $glossary_table = Database::get_course_table(TABLE_GLOSSARY);
45 45
         $course_id = api_get_course_int_id();
46 46
         $sql = "SELECT description FROM $glossary_table
47 47
                 WHERE c_id = $course_id  AND glossary_id =".intval($glossary_id);
48
-        $rs=Database::query($sql);
48
+        $rs = Database::query($sql);
49 49
         if (Database::num_rows($rs) > 0) {
50 50
             $row = Database::fetch_array($rs);
51 51
 
@@ -61,9 +61,9 @@  discard block
 block discarded – undo
61 61
      * @param string The glossary term name
62 62
      * @return string The glossary description
63 63
      */
64
-    public static function get_glossary_term_by_glossary_name ($glossary_name)
64
+    public static function get_glossary_term_by_glossary_name($glossary_name)
65 65
     {
66
-        $glossary_table  = Database::get_course_table(TABLE_GLOSSARY);
66
+        $glossary_table = Database::get_course_table(TABLE_GLOSSARY);
67 67
         $session_id = api_get_session_id();
68 68
         $course_id = api_get_course_int_id();
69 69
         $sql_filter = api_get_session_condition($session_id);
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
         $course_id = api_get_course_int_id();
164 164
 
165 165
         // check if the glossary term already exists
166
-        if (GlossaryManager::glossary_exists($values['glossary_title'],$values['glossary_id'])) {
166
+        if (GlossaryManager::glossary_exists($values['glossary_title'], $values['glossary_id'])) {
167 167
             // display the feedback message
168 168
             if ($message)
169 169
                 Display::display_error_message(get_lang('GlossaryTermAlreadyExistsYouShouldEditIt'));
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
         $get_max = "SELECT MAX(display_order) FROM $t_glossary
211 211
                     WHERE c_id = $course_id ";
212 212
         $res_max = Database::query($get_max);
213
-        if (Database::num_rows($res_max)==0) {
213
+        if (Database::num_rows($res_max) == 0) {
214 214
             return 0;
215 215
         }
216 216
         $row = Database::fetch_array($res_max);
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
      * @author Patrick Cool <[email protected]>, Ghent University, Belgium
232 232
      * @version januari 2009, dokeos 1.8.6
233 233
      */
234
-    public static function glossary_exists($term, $not_id='')
234
+    public static function glossary_exists($term, $not_id = '')
235 235
     {
236 236
         // Database table definition
237 237
         $t_glossary = Database :: get_course_table(TABLE_GLOSSARY);
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
                 WHERE
242 242
                     c_id = $course_id AND
243 243
                     name = '".Database::escape_string($term)."'";
244
-        if ($not_id<>'') {
244
+        if ($not_id <> '') {
245 245
             $sql .= " AND glossary_id <> '".intval($not_id)."'";
246 246
         }
247 247
         $result = Database::query($sql);
@@ -347,27 +347,27 @@  discard block
 block discarded – undo
347 347
         // action links
348 348
         echo '<div class="actions">';
349 349
 
350
-        if (api_is_allowed_to_edit(null,true)) {
350
+        if (api_is_allowed_to_edit(null, true)) {
351 351
             echo '<a href="index.php?'.api_get_cidreq().'&action=addglossary&msg=add?'.api_get_cidreq().'">'.
352
-                Display::return_icon('new_glossary_term.png',get_lang('TermAddNew'),'', ICON_SIZE_MEDIUM).'</a>';
352
+                Display::return_icon('new_glossary_term.png', get_lang('TermAddNew'), '', ICON_SIZE_MEDIUM).'</a>';
353 353
         }
354 354
 
355 355
         echo '<a href="index.php?'.api_get_cidreq().'&action=export">'.
356
-            Display::return_icon('export_csv.png',get_lang('ExportGlossaryAsCSV'),'',ICON_SIZE_MEDIUM).'</a>';
357
-        if (api_is_allowed_to_edit(null,true)) {
356
+            Display::return_icon('export_csv.png', get_lang('ExportGlossaryAsCSV'), '', ICON_SIZE_MEDIUM).'</a>';
357
+        if (api_is_allowed_to_edit(null, true)) {
358 358
             echo '<a href="index.php?'.api_get_cidreq().'&action=import">'.
359
-                Display::return_icon('import_csv.png',get_lang('ImportGlossary'),'',ICON_SIZE_MEDIUM).'</a>';
359
+                Display::return_icon('import_csv.png', get_lang('ImportGlossary'), '', ICON_SIZE_MEDIUM).'</a>';
360 360
         }
361 361
 
362 362
         echo '<a href="index.php?'.api_get_cidreq().'&action=export_to_pdf">'.
363
-            Display::return_icon('pdf.png',get_lang('ExportToPDF'),'', ICON_SIZE_MEDIUM).'</a>';
363
+            Display::return_icon('pdf.png', get_lang('ExportToPDF'), '', ICON_SIZE_MEDIUM).'</a>';
364 364
 
365
-        if ((isset($_SESSION['glossary_view']) && $_SESSION['glossary_view'] == 'table') or (!isset($_SESSION['glossary_view']))){
365
+        if ((isset($_SESSION['glossary_view']) && $_SESSION['glossary_view'] == 'table') or (!isset($_SESSION['glossary_view']))) {
366 366
             echo '<a href="index.php?'.api_get_cidreq().'&action=changeview&view=list">'.
367
-                Display::return_icon('view_detailed.png',get_lang('ListView'),'',ICON_SIZE_MEDIUM).'</a>';
367
+                Display::return_icon('view_detailed.png', get_lang('ListView'), '', ICON_SIZE_MEDIUM).'</a>';
368 368
         } else {
369 369
             echo '<a href="index.php?'.api_get_cidreq().'&action=changeview&view=table">'.
370
-                Display::return_icon('view_text.png',get_lang('TableView'),'',ICON_SIZE_MEDIUM).'</a>';
370
+                Display::return_icon('view_text.png', get_lang('TableView'), '', ICON_SIZE_MEDIUM).'</a>';
371 371
         }
372 372
         echo '</div>';
373 373
         if (!$_SESSION['glossary_view'] || $_SESSION['glossary_view'] == 'table') {
@@ -380,9 +380,9 @@  discard block
 block discarded – undo
380 380
             //$table->set_header(0, '', false);
381 381
             $table->set_header(0, get_lang('TermName'), true);
382 382
             $table->set_header(1, get_lang('TermDefinition'), true);
383
-            if (api_is_allowed_to_edit(null,true)) {
383
+            if (api_is_allowed_to_edit(null, true)) {
384 384
                 $table->set_header(2, get_lang('Actions'), false, 'width=90px', array('class' => 'td_actions'));
385
-                $table->set_column_filter(2, array('GlossaryManager','actions_filter'));
385
+                $table->set_column_filter(2, array('GlossaryManager', 'actions_filter'));
386 386
             }
387 387
             $table->display();
388 388
         }
@@ -399,11 +399,11 @@  discard block
 block discarded – undo
399 399
      */
400 400
     public static function display_glossary_list()
401 401
     {
402
-        $glossary_data = self::get_glossary_data(0,1000,0,'ASC');
402
+        $glossary_data = self::get_glossary_data(0, 1000, 0, 'ASC');
403 403
         foreach ($glossary_data as $key => $glossary_item) {
404 404
             $actions = '';
405
-            if (api_is_allowed_to_edit(null,true)) {
406
-                $actions = '<div class="pull-right">'.self::actions_filter($glossary_item[2], '',$glossary_item).'</div>';
405
+            if (api_is_allowed_to_edit(null, true)) {
406
+                $actions = '<div class="pull-right">'.self::actions_filter($glossary_item[2], '', $glossary_item).'</div>';
407 407
             }
408 408
             echo Display::panel($glossary_item[1], $glossary_item[0].' '.$actions);
409 409
         }
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
      * @author Patrick Cool <[email protected]>, Ghent University, Belgium
419 419
      * @version januari 2009, dokeos 1.8.6
420 420
      */
421
-    public static  function get_number_glossary_terms($session_id=0)
421
+    public static  function get_number_glossary_terms($session_id = 0)
422 422
     {
423 423
         // Database table definition
424 424
         $t_glossary = Database :: get_course_table(TABLE_GLOSSARY);
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
         $t_glossary = Database :: get_course_table(TABLE_GLOSSARY);
457 457
         $t_item_propery = Database :: get_course_table(TABLE_ITEM_PROPERTY);
458 458
 
459
-        if (api_is_allowed_to_edit(null,true)) {
459
+        if (api_is_allowed_to_edit(null, true)) {
460 460
             $col2 = " glossary.glossary_id	as col2, ";
461 461
         } else {
462 462
             $col2 = " ";
@@ -471,8 +471,8 @@  discard block
 block discarded – undo
471 471
             'glossary.session_id'
472 472
         );
473 473
         $column = intval($column);
474
-        if (!in_array($direction,array('DESC', 'ASC'))) {
475
-            $direction          = 'ASC';
474
+        if (!in_array($direction, array('DESC', 'ASC'))) {
475
+            $direction = 'ASC';
476 476
         }
477 477
         $from = intval($from);
478 478
         $number_of_items = intval($number_of_items);
@@ -497,15 +497,15 @@  discard block
 block discarded – undo
497 497
         while ($data = Database::fetch_array($res)) {
498 498
             // Validation when belongs to a session
499 499
             $session_img = api_get_session_image($data['session_id'], $_user['status']);
500
-            $array[0] = $data[0] . $session_img;
500
+            $array[0] = $data[0].$session_img;
501 501
 
502 502
             if (!$_SESSION['glossary_view'] || $_SESSION['glossary_view'] == 'table') {
503
-                $array[1] = str_replace(array('<p>','</p>'),array('','<br />'),$data[1]);
503
+                $array[1] = str_replace(array('<p>', '</p>'), array('', '<br />'), $data[1]);
504 504
             } else {
505 505
                 $array[1] = $data[1];
506 506
             }
507 507
 
508
-            if (api_is_allowed_to_edit(null,true)) {
508
+            if (api_is_allowed_to_edit(null, true)) {
509 509
                 $array[2] = $data[2];
510 510
             }
511 511
             $return[] = $array;
@@ -528,14 +528,14 @@  discard block
 block discarded – undo
528 528
     public static function actions_filter($glossary_id, $url_params, $row)
529 529
     {
530 530
         $glossary_id = $row[2];
531
-        $return = '<a href="'.api_get_self().'?action=edit_glossary&amp;glossary_id='.$glossary_id.'&'.api_get_cidreq().'&msg=edit">'.Display::return_icon('edit.png',get_lang('Edit'),'',22).'</a>';
531
+        $return = '<a href="'.api_get_self().'?action=edit_glossary&amp;glossary_id='.$glossary_id.'&'.api_get_cidreq().'&msg=edit">'.Display::return_icon('edit.png', get_lang('Edit'), '', 22).'</a>';
532 532
         $glossary_data = GlossaryManager::get_glossary_information($glossary_id);
533 533
 
534 534
         $glossary_term = $glossary_data['glossary_title'];
535 535
 
536 536
         if (api_is_allowed_to_edit(null, true)) {
537 537
             if ($glossary_data['session_id'] == api_get_session_id()) {
538
-                $return .= '<a href="'.api_get_self().'?action=delete_glossary&amp;glossary_id='.$glossary_id.'&'.api_get_cidreq().'" onclick="return confirmation(\''.$glossary_term.'\');">'.Display::return_icon('delete.png', get_lang('Delete'),'',22).'</a>';
538
+                $return .= '<a href="'.api_get_self().'?action=delete_glossary&amp;glossary_id='.$glossary_id.'&'.api_get_cidreq().'" onclick="return confirmation(\''.$glossary_term.'\');">'.Display::return_icon('delete.png', get_lang('Delete'), '', 22).'</a>';
539 539
             } else {
540 540
                 $return  = get_lang('EditionNotAvailableFromSession');
541 541
             }
@@ -556,7 +556,7 @@  discard block
 block discarded – undo
556 556
     {
557 557
         return "<script type=\"text/javascript\">
558 558
 				function confirmation (name) {
559
-					if (confirm(\" ". get_lang("TermConfirmDelete") ." \"+ name + \" ?\"))
559
+					if (confirm(\" ". get_lang("TermConfirmDelete")." \"+ name + \" ?\"))
560 560
 						{return true;}
561 561
 					else
562 562
 						{return false;}
@@ -616,7 +616,7 @@  discard block
 block discarded – undo
616 616
         $res = Database::query($sql);
617 617
         $found = false;
618 618
         while ($row = Database::fetch_array($res)) {
619
-            if ($found && empty($next_id))	{
619
+            if ($found && empty($next_id)) {
620 620
                 $next_id = $row['glossary_id'];
621 621
                 $next_display_order = $row['display_order'];
622 622
             }
Please login to merge, or discard this patch.
main/inc/lib/nanogong.lib.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 		if (api_is_allowed_to_edit()) {
125 125
 			$this->can_edit = true;
126 126
 		} else {
127
-			if ($this->user_id ==  api_get_user_id()) {
127
+			if ($this->user_id == api_get_user_id()) {
128 128
 				$this->can_edit = true;
129 129
 			}
130 130
 		}
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
     {
197 197
 		$filename = null;
198 198
 		//@ugly fix
199
-		foreach($this->available_extensions as $extension) {
199
+		foreach ($this->available_extensions as $extension) {
200 200
 			$items = explode('-', $this->filename);
201 201
 			$items[5] = 'temp_exe';
202 202
 			$filename = implode('-', $items);
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
     {
221 221
 		$filename = null;
222 222
 		//@ugly fix
223
-		foreach($this->available_extensions as $extension) {
223
+		foreach ($this->available_extensions as $extension) {
224 224
 			if (is_file($this->store_path.$this->filename.'.'.$extension)) {
225 225
 				$filename = $this->filename.'.'.$extension;
226 226
 				break;
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
                             course_code = '".$this->course_info['code']."'
245 245
                         LIMIT 1";
246 246
 				$result = Database::query($sql);
247
-				$result = Database::fetch_row($result,'ASSOC');
247
+				$result = Database::fetch_row($result, 'ASSOC');
248 248
 
249 249
 				if (isset($result) && isset($result[0]) && !empty($result[0])) {
250 250
 					$filename = $result[0];
@@ -369,18 +369,18 @@  discard block
 block discarded – undo
369 369
                         $html .= '<param name="ShowSpeedButton" value="false" />';
370 370
 						//echo '<param name="StartTime" value="10.5" />';
371 371
 						//echo '<param name="EndTime" value="65" />';
372
-						$html .= '<param name="AudioFormat" value="ImaADPCM" />';// ImaADPCM (more speed), Speex (more compression)|(default Speex)
372
+						$html .= '<param name="AudioFormat" value="ImaADPCM" />'; // ImaADPCM (more speed), Speex (more compression)|(default Speex)
373 373
 						//$html .= '<param name="AudioFormat" value="Speex" />';// ImaADPCM (more speed), Speex (more compression)|(default Speex)
374 374
 						//Quality for ImaADPCM (low 8000, medium 11025, normal 22050, hight 44100) OR Quality for Speex (low 8000, medium 16000, normal 32000, hight 44100) | (default 44100)
375 375
 						//echo '<param name="SamplingRate" value="32000" />';
376 376
 						//echo '<param name="MaxDuration" value="60" />';
377
-						$html .=  '<param name="SoundFileURL" value="'.$url.'" />';//load a file |(default "")
377
+						$html .= '<param name="SoundFileURL" value="'.$url.'" />'; //load a file |(default "")
378 378
 						$html .= '</applet>';
379 379
 					$html .= '</div>';
380 380
 				$html .= '</div>';
381 381
                 $html .= '<div id="nanogong_warning">'.Display::return_message(get_lang('BrowserDoesNotSupportNanogongPlayer'), 'warning').$download_button.'</div>';
382 382
 
383
-			} elseif(in_array($path_info['extension'],array('mp3', 'ogg','wav'))) {
383
+			} elseif (in_array($path_info['extension'], array('mp3', 'ogg', 'wav'))) {
384 384
 				$js_path = api_get_path(WEB_LIBRARY_PATH).'javascript/';
385 385
 				$html .= '<link rel="stylesheet" href="'.$js_path.'jquery-jplayer/skin/blue.monday/css/jplayer.blue.monday.css" type="text/css">';
386 386
 				$html .= '<script type="text/javascript" src="'.$js_path.'jquery-jplayer/jplayer/jquery.jplayer.min.js"></script>';
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
 
429 429
 		$url_delete = api_get_path(WEB_AJAX_PATH).'nanogong.ajax.php?a=delete&'.$params;
430 430
 
431
-		$js =  '<script language="javascript">
431
+		$js = '<script language="javascript">
432 432
 
433 433
 			//lang vars
434 434
 
@@ -570,8 +570,8 @@  discard block
 block discarded – undo
570 570
 		$html = '<center>';
571 571
 
572 572
 		//Use normal upload file
573
-		$html .= Display::return_icon('microphone.png', get_lang('PressRecordButton'),'', ICON_SIZE_BIG);
574
-		$html .='<br />';
573
+		$html .= Display::return_icon('microphone.png', get_lang('PressRecordButton'), '', ICON_SIZE_BIG);
574
+		$html .= '<br />';
575 575
 
576 576
 		$html .= '<div id="nanogong_div">';
577 577
 
@@ -584,7 +584,7 @@  discard block
 block discarded – undo
584 584
 		$html .= '<param name="Color" value="#FFFFFF" />'; // default #FFFFFF
585 585
 		//echo '<param name="StartTime" value="10.5" />';
586 586
 		//echo '<param name="EndTime" value="65" />';
587
-		$html .= '<param name="AudioFormat" value="ImaADPCM" />';// ImaADPCM (more speed), Speex (more compression)|(default Speex)
587
+		$html .= '<param name="AudioFormat" value="ImaADPCM" />'; // ImaADPCM (more speed), Speex (more compression)|(default Speex)
588 588
 		//$html .= '<param name="AudioFormat" value="Speex" />';// ImaADPCM (more speed), Speex (more compression)|(default Speex)
589 589
 
590 590
 		//echo '<param name="SamplingRate" value="32000" />';//Quality for ImaADPCM (low 8000, medium 11025, normal 22050, hight 44100) OR Quality for Speex (low 8000, medium 16000, normal 32000, hight 44100) | (default 44100)
Please login to merge, or discard this patch.
main/inc/lib/rights.lib.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,9 +6,9 @@
 block discarded – undo
6 6
  */
7 7
 class Rights {
8 8
 	private static $rights_cache = array();
9
-	private static $rights = array (
9
+	private static $rights = array(
10 10
 		'show_tabs:reports' =>
11
-			array (
11
+			array(
12 12
 				'type' => 'const',
13 13
 				'const' => 'true' )
14 14
 		);
Please login to merge, or discard this patch.
main/inc/lib/table_sort.class.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 
158 158
                 $new_data_order = array();
159 159
                 if (!empty($docs_to_sort)) {
160
-                    foreach($docs_to_sort as $id => $document) {
160
+                    foreach ($docs_to_sort as $id => $document) {
161 161
                         if (isset($new_data[$id])) {
162 162
                             $new_data_order[] = $new_data[$id];
163 163
                         }
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
                 }
166 166
 
167 167
                 if (!empty($folder_to_sort)) {
168
-                    foreach($folder_to_sort as $id => $document) {
168
+                    foreach ($folder_to_sort as $id => $document) {
169 169
                         if (isset($new_data[$id])) {
170 170
                             $new_data_order[] = $new_data[$id];
171 171
                         }
Please login to merge, or discard this patch.
main/inc/lib/plugin.lib.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -425,7 +425,7 @@  discard block
 block discarded – undo
425 425
             //extra options
426 426
             $plugin_settings = api_get_settings_params(
427 427
                 array(
428
-                    "subkey = ? AND category = ? AND type = ? " => array($plugin_name, 'Plugins','setting')
428
+                    "subkey = ? AND category = ? AND type = ? " => array($plugin_name, 'Plugins', 'setting')
429 429
                 )
430 430
             );
431 431
             $settings_filtered = array();
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
             if (!empty($obj->course_settings)) {
531 531
                 if (is_file(api_get_path(SYS_CODE_PATH).'img/icons/'.ICON_SIZE_SMALL.'/'.$plugin_name.'.png')) {
532 532
                     $icon = Display::return_icon(
533
-                        $plugin_name . '.png',
533
+                        $plugin_name.'.png',
534 534
                         Security::remove_XSS($pluginTitle),
535 535
                         '',
536 536
                         ICON_SIZE_SMALL
Please login to merge, or discard this patch.
main/inc/lib/phpseclib/Crypt/Random.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -145,12 +145,12 @@  discard block
 block discarded – undo
145 145
         session_start();
146 146
 
147 147
         $v = $seed = $_SESSION['seed'] = pack('H*', sha1(
148
-            serialize($_SERVER) .
149
-            serialize($_POST) .
150
-            serialize($_GET) .
151
-            serialize($_COOKIE) .
152
-            serialize($GLOBALS) .
153
-            serialize($_SESSION) .
148
+            serialize($_SERVER).
149
+            serialize($_POST).
150
+            serialize($_GET).
151
+            serialize($_COOKIE).
152
+            serialize($GLOBALS).
153
+            serialize($_SESSION).
154 154
             serialize($_OLD_SESSION)
155 155
         ));
156 156
         if (!isset($_SESSION['count'])) {
@@ -183,8 +183,8 @@  discard block
 block discarded – undo
183 183
         // http://tools.ietf.org/html/rfc4253#section-7.2
184 184
         //
185 185
         // see the is_string($crypto) part for an example of how to expand the keys
186
-        $key = pack('H*', sha1($seed . 'A'));
187
-        $iv = pack('H*', sha1($seed . 'C'));
186
+        $key = pack('H*', sha1($seed.'A'));
187
+        $iv = pack('H*', sha1($seed.'C'));
188 188
 
189 189
         // ciphers are used as per the nist.gov link below. also, see this link:
190 190
         //
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
             $i = pack('H*', sha1(microtime()));
232 232
             $r = pack('H*', sha1($i ^ $v));
233 233
             $v = pack('H*', sha1($r ^ $i));
234
-            $result.= $r;
234
+            $result .= $r;
235 235
         }
236 236
         return substr($result, 0, $length);
237 237
     }
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
         $i = $crypto->encrypt(microtime());
244 244
         $r = $crypto->encrypt($i ^ $v);
245 245
         $v = $crypto->encrypt($r ^ $i);
246
-        $result.= $r;
246
+        $result .= $r;
247 247
     }
248 248
     return substr($result, 0, $length);
249 249
 }
Please login to merge, or discard this patch.
main/inc/lib/phpseclib/Crypt/Hash.php 1 patch
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -66,11 +66,11 @@  discard block
 block discarded – undo
66 66
 /**
67 67
  * Toggles the mhash() implementation, which has been deprecated on PHP 5.3.0+.
68 68
  */
69
-define('CRYPT_HASH_MODE_MHASH',    2);
69
+define('CRYPT_HASH_MODE_MHASH', 2);
70 70
 /**
71 71
  * Toggles the hash() implementation, which works on PHP 5.1.2+.
72 72
  */
73
-define('CRYPT_HASH_MODE_HASH',     3);
73
+define('CRYPT_HASH_MODE_HASH', 3);
74 74
 /**#@-*/
75 75
 
76 76
 /**
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
      */
146 146
     function Crypt_Hash($hash = 'sha1')
147 147
     {
148
-        if ( !defined('CRYPT_HASH_MODE') ) {
148
+        if (!defined('CRYPT_HASH_MODE')) {
149 149
             switch (true) {
150 150
                 case extension_loaded('hash'):
151 151
                     define('CRYPT_HASH_MODE', CRYPT_HASH_MODE_HASH);
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
                 $mode = CRYPT_HASH_MODE;
219 219
         }
220 220
 
221
-        switch ( $mode ) {
221
+        switch ($mode) {
222 222
             case CRYPT_HASH_MODE_MHASH:
223 223
                 switch ($hash) {
224 224
                     case 'md5':
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
         $mode = is_array($this->hash) ? CRYPT_HASH_MODE_INTERNAL : CRYPT_HASH_MODE;
297 297
 
298 298
         if (!empty($this->key) || is_string($this->key)) {
299
-            switch ( $mode ) {
299
+            switch ($mode) {
300 300
                 case CRYPT_HASH_MODE_MHASH:
301 301
                     $output = mhash($this->hash, $text, $this->key);
302 302
                     break;
@@ -310,16 +310,16 @@  discard block
 block discarded – undo
310 310
                         -- http://tools.ietf.org/html/rfc2104#section-2 */
311 311
                     $key = strlen($this->key) > $this->b ? call_user_func($this->hash, $this->key) : $this->key;
312 312
 
313
-                    $key    = str_pad($key, $this->b, chr(0));      // step 1
314
-                    $temp   = $this->ipad ^ $key;                   // step 2
315
-                    $temp  .= $text;                                // step 3
316
-                    $temp   = call_user_func($this->hash, $temp);   // step 4
317
-                    $output = $this->opad ^ $key;                   // step 5
318
-                    $output.= $temp;                                // step 6
313
+                    $key    = str_pad($key, $this->b, chr(0)); // step 1
314
+                    $temp   = $this->ipad ^ $key; // step 2
315
+                    $temp  .= $text; // step 3
316
+                    $temp   = call_user_func($this->hash, $temp); // step 4
317
+                    $output = $this->opad ^ $key; // step 5
318
+                    $output .= $temp; // step 6
319 319
                     $output = call_user_func($this->hash, $output); // step 7
320 320
             }
321 321
         } else {
322
-            switch ( $mode ) {
322
+            switch ($mode) {
323 323
                 case CRYPT_HASH_MODE_MHASH:
324 324
                     $output = mhash($this->hash, $text);
325 325
                     break;
@@ -378,36 +378,36 @@  discard block
 block discarded – undo
378 378
     function _md2($m)
379 379
     {
380 380
         static $s = array(
381
-             41,  46,  67, 201, 162, 216, 124,   1,  61,  54,  84, 161, 236, 240, 6,
382
-             19,  98, 167,   5, 243, 192, 199, 115, 140, 152, 147,  43, 217, 188,
383
-             76, 130, 202,  30, 155,  87,  60, 253, 212, 224,  22, 103,  66, 111, 24,
384
-            138,  23, 229,  18, 190,  78, 196, 214, 218, 158, 222,  73, 160, 251,
385
-            245, 142, 187,  47, 238, 122, 169, 104, 121, 145,  21, 178,   7,  63,
386
-            148, 194,  16, 137,  11,  34,  95,  33, 128, 127,  93, 154,  90, 144, 50,
387
-             39,  53,  62, 204, 231, 191, 247, 151,   3, 255,  25,  48, 179,  72, 165,
388
-            181, 209, 215,  94, 146,  42, 172,  86, 170, 198,  79, 184,  56, 210,
389
-            150, 164, 125, 182, 118, 252, 107, 226, 156, 116,   4, 241,  69, 157,
390
-            112,  89, 100, 113, 135,  32, 134,  91, 207, 101, 230,  45, 168,   2, 27,
391
-             96,  37, 173, 174, 176, 185, 246,  28,  70,  97, 105,  52,  64, 126, 15,
392
-             85,  71, 163,  35, 221,  81, 175,  58, 195,  92, 249, 206, 186, 197,
393
-            234,  38,  44,  83,  13, 110, 133,  40, 132,   9, 211, 223, 205, 244, 65,
394
-            129,  77,  82, 106, 220,  55, 200, 108, 193, 171, 250,  36, 225, 123,
395
-              8,  12, 189, 177,  74, 120, 136, 149, 139, 227,  99, 232, 109, 233,
396
-            203, 213, 254,  59,   0,  29,  57, 242, 239, 183,  14, 102,  88, 208, 228,
397
-            166, 119, 114, 248, 235, 117,  75,  10,  49,  68,  80, 180, 143, 237,
398
-             31,  26, 219, 153, 141,  51, 159,  17, 131, 20
381
+             41, 46, 67, 201, 162, 216, 124, 1, 61, 54, 84, 161, 236, 240, 6,
382
+             19, 98, 167, 5, 243, 192, 199, 115, 140, 152, 147, 43, 217, 188,
383
+             76, 130, 202, 30, 155, 87, 60, 253, 212, 224, 22, 103, 66, 111, 24,
384
+            138, 23, 229, 18, 190, 78, 196, 214, 218, 158, 222, 73, 160, 251,
385
+            245, 142, 187, 47, 238, 122, 169, 104, 121, 145, 21, 178, 7, 63,
386
+            148, 194, 16, 137, 11, 34, 95, 33, 128, 127, 93, 154, 90, 144, 50,
387
+             39, 53, 62, 204, 231, 191, 247, 151, 3, 255, 25, 48, 179, 72, 165,
388
+            181, 209, 215, 94, 146, 42, 172, 86, 170, 198, 79, 184, 56, 210,
389
+            150, 164, 125, 182, 118, 252, 107, 226, 156, 116, 4, 241, 69, 157,
390
+            112, 89, 100, 113, 135, 32, 134, 91, 207, 101, 230, 45, 168, 2, 27,
391
+             96, 37, 173, 174, 176, 185, 246, 28, 70, 97, 105, 52, 64, 126, 15,
392
+             85, 71, 163, 35, 221, 81, 175, 58, 195, 92, 249, 206, 186, 197,
393
+            234, 38, 44, 83, 13, 110, 133, 40, 132, 9, 211, 223, 205, 244, 65,
394
+            129, 77, 82, 106, 220, 55, 200, 108, 193, 171, 250, 36, 225, 123,
395
+              8, 12, 189, 177, 74, 120, 136, 149, 139, 227, 99, 232, 109, 233,
396
+            203, 213, 254, 59, 0, 29, 57, 242, 239, 183, 14, 102, 88, 208, 228,
397
+            166, 119, 114, 248, 235, 117, 75, 10, 49, 68, 80, 180, 143, 237,
398
+             31, 26, 219, 153, 141, 51, 159, 17, 131, 20
399 399
         );
400 400
 
401 401
         // Step 1. Append Padding Bytes
402 402
         $pad = 16 - (strlen($m) & 0xF);
403
-        $m.= str_repeat(chr($pad), $pad);
403
+        $m .= str_repeat(chr($pad), $pad);
404 404
 
405 405
         $length = strlen($m);
406 406
 
407 407
         // Step 2. Append Checksum
408 408
         $c = str_repeat(chr(0), 16);
409 409
         $l = chr(0);
410
-        for ($i = 0; $i < $length; $i+= 16) {
410
+        for ($i = 0; $i < $length; $i += 16) {
411 411
             for ($j = 0; $j < 16; $j++) {
412 412
                 // RFC1319 incorrectly states that C[j] should be set to S[c xor L]
413 413
                 //$c[$j] = chr($s[ord($m[$i + $j] ^ $l)]);
@@ -416,15 +416,15 @@  discard block
 block discarded – undo
416 416
                 $l = $c[$j];
417 417
             }
418 418
         }
419
-        $m.= $c;
419
+        $m .= $c;
420 420
 
421
-        $length+= 16;
421
+        $length += 16;
422 422
 
423 423
         // Step 3. Initialize MD Buffer
424 424
         $x = str_repeat(chr(0), 48);
425 425
 
426 426
         // Step 4. Process Message in 16-Byte Blocks
427
-        for ($i = 0; $i < $length; $i+= 16) {
427
+        for ($i = 0; $i < $length; $i += 16) {
428 428
             for ($j = 0; $j < 16; $j++) {
429 429
                 $x[$j + 16] = $m[$i + $j];
430 430
                 $x[$j + 32] = $x[$j + 16] ^ $x[$j];
@@ -477,10 +477,10 @@  discard block
 block discarded – undo
477 477
         // Pre-processing
478 478
         $length = strlen($m);
479 479
         // to round to nearest 56 mod 64, we'll add 64 - (length + (64 - 56)) % 64
480
-        $m.= str_repeat(chr(0), 64 - (($length + 8) & 0x3F));
480
+        $m .= str_repeat(chr(0), 64 - (($length + 8) & 0x3F));
481 481
         $m[$length] = chr(0x80);
482 482
         // we don't support hashing strings 512MB long
483
-        $m.= pack('N2', 0, $length << 3);
483
+        $m .= pack('N2', 0, $length << 3);
484 484
 
485 485
         // Process the message in successive 512-bit chunks
486 486
         $chunks = str_split($m, 64);
@@ -493,12 +493,12 @@  discard block
 block discarded – undo
493 493
 
494 494
             // Extend the sixteen 32-bit words into sixty-four 32-bit words
495 495
             for ($i = 16; $i < 64; $i++) {
496
-                $s0 = $this->_rightRotate($w[$i - 15],  7) ^
496
+                $s0 = $this->_rightRotate($w[$i - 15], 7) ^
497 497
                       $this->_rightRotate($w[$i - 15], 18) ^
498
-                      $this->_rightShift( $w[$i - 15],  3);
498
+                      $this->_rightShift($w[$i - 15], 3);
499 499
                 $s1 = $this->_rightRotate($w[$i - 2], 17) ^
500 500
                       $this->_rightRotate($w[$i - 2], 19) ^
501
-                      $this->_rightShift( $w[$i - 2], 10);
501
+                      $this->_rightShift($w[$i - 2], 10);
502 502
                 $w[$i] = $this->_add($w[$i - 16], $s0, $w[$i - 7], $s1);
503 503
 
504 504
             }
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
 
509 509
             // Main loop
510 510
             for ($i = 0; $i < 64; $i++) {
511
-                $s0 = $this->_rightRotate($a,  2) ^
511
+                $s0 = $this->_rightRotate($a, 2) ^
512 512
                       $this->_rightRotate($a, 13) ^
513 513
                       $this->_rightRotate($a, 22);
514 514
                 $maj = ($a & $b) ^
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
                        ($b & $c);
517 517
                 $t2 = $this->_add($s0, $maj);
518 518
 
519
-                $s1 = $this->_rightRotate($e,  6) ^
519
+                $s1 = $this->_rightRotate($e, 6) ^
520 520
                       $this->_rightRotate($e, 11) ^
521 521
                       $this->_rightRotate($e, 25);
522 522
                 $ch = ($e & $f) ^
@@ -617,10 +617,10 @@  discard block
 block discarded – undo
617 617
         // Pre-processing
618 618
         $length = strlen($m);
619 619
         // to round to nearest 112 mod 128, we'll add 128 - (length + (128 - 112)) % 128
620
-        $m.= str_repeat(chr(0), 128 - (($length + 16) & 0x7F));
620
+        $m .= str_repeat(chr(0), 128 - (($length + 16) & 0x7F));
621 621
         $m[$length] = chr(0x80);
622 622
         // we don't support hashing strings 512MB long
623
-        $m.= pack('N4', 0, 0, 0, $length << 3);
623
+        $m .= pack('N4', 0, 0, 0, $length << 3);
624 624
 
625 625
         // Process the message in successive 1024-bit chunks
626 626
         $chunks = str_split($m, 128);
@@ -724,10 +724,10 @@  discard block
 block discarded – undo
724 724
 
725 725
         // Produce the final hash value (big-endian)
726 726
         // (Crypt_Hash::hash() trims the output for hashes but not for HMACs.  as such, we trim the output here)
727
-        $temp = $hash[0]->toBytes() . $hash[1]->toBytes() . $hash[2]->toBytes() . $hash[3]->toBytes() .
728
-                $hash[4]->toBytes() . $hash[5]->toBytes();
727
+        $temp = $hash[0]->toBytes().$hash[1]->toBytes().$hash[2]->toBytes().$hash[3]->toBytes().
728
+                $hash[4]->toBytes().$hash[5]->toBytes();
729 729
         if ($this->l != 48) {
730
-            $temp.= $hash[6]->toBytes() . $hash[7]->toBytes();
730
+            $temp .= $hash[6]->toBytes().$hash[7]->toBytes();
731 731
         }
732 732
 
733 733
         return $temp;
@@ -798,7 +798,7 @@  discard block
 block discarded – undo
798 798
         $result = 0;
799 799
         $arguments = func_get_args();
800 800
         foreach ($arguments as $argument) {
801
-            $result+= $argument < 0 ? ($argument & 0x7FFFFFFF) + 0x80000000 : $argument;
801
+            $result += $argument < 0 ? ($argument & 0x7FFFFFFF) + 0x80000000 : $argument;
802 802
         }
803 803
 
804 804
         return fmod($result, $mod);
Please login to merge, or discard this patch.
main/inc/lib/phpseclib/Crypt/AES.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
      */
178 178
     function Crypt_AES($mode = CRYPT_AES_MODE_CBC)
179 179
     {
180
-        if ( !defined('CRYPT_AES_MODE') ) {
180
+        if (!defined('CRYPT_AES_MODE')) {
181 181
             switch (true) {
182 182
                 case extension_loaded('mcrypt') && in_array('rijndael-128', mcrypt_list_algorithms()):
183 183
                     define('CRYPT_AES_MODE', CRYPT_AES_MODE_MCRYPT);
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
             }
188 188
         }
189 189
 
190
-        switch ( CRYPT_AES_MODE ) {
190
+        switch (CRYPT_AES_MODE) {
191 191
             case CRYPT_AES_MODE_MCRYPT:
192 192
                 switch ($mode) {
193 193
                     case CRYPT_AES_MODE_ECB:
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
     function setIV($iv)
268 268
     {
269 269
         parent::setIV($iv);
270
-        if ( CRYPT_AES_MODE == CRYPT_AES_MODE_MCRYPT ) {
270
+        if (CRYPT_AES_MODE == CRYPT_AES_MODE_MCRYPT) {
271 271
             $this->changed = true;
272 272
         }
273 273
     }
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
      */
292 292
     function encrypt($plaintext)
293 293
     {
294
-        if ( CRYPT_AES_MODE == CRYPT_AES_MODE_MCRYPT ) {
294
+        if (CRYPT_AES_MODE == CRYPT_AES_MODE_MCRYPT) {
295 295
             $this->_mcryptSetup();
296 296
 
297 297
             // re: http://phpseclib.sourceforge.net/cfb-demo.phps
@@ -308,11 +308,11 @@  discard block
 block discarded – undo
308 308
                     $max = 16 - $pos;
309 309
                     if ($len >= $max) {
310 310
                         $i = $max;
311
-                        $len-= $max;
311
+                        $len -= $max;
312 312
                         $pos = 0;
313 313
                     } else {
314 314
                         $i = $len;
315
-                        $pos+= $len;
315
+                        $pos += $len;
316 316
                         $len = 0;
317 317
                     }
318 318
                     $ciphertext = substr($iv, $orig_pos) ^ $plaintext;
@@ -325,15 +325,15 @@  discard block
 block discarded – undo
325 325
                             mcrypt_generic_init($this->enmcrypt, $this->key, $iv);
326 326
                             $this->enbuffer['enmcrypt_init'] = false;
327 327
                         }
328
-                        $ciphertext.= mcrypt_generic($this->enmcrypt, substr($plaintext, $i, $len - $len % 16));
328
+                        $ciphertext .= mcrypt_generic($this->enmcrypt, substr($plaintext, $i, $len - $len % 16));
329 329
                         $iv = substr($ciphertext, -16);
330
-                        $len%= 16;
330
+                        $len %= 16;
331 331
                     } else {
332 332
                         while ($len >= 16) {
333 333
                             $iv = mcrypt_generic($this->ecb, $iv) ^ substr($plaintext, $i, 16);
334
-                            $ciphertext.= $iv;
335
-                            $len-= 16;
336
-                            $i+= 16;
334
+                            $ciphertext .= $iv;
335
+                            $len -= 16;
336
+                            $i += 16;
337 337
                         }
338 338
                     }
339 339
                 }
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
                     $iv = mcrypt_generic($this->ecb, $iv);
343 343
                     $block = $iv ^ substr($plaintext, -$len);
344 344
                     $iv = substr_replace($iv, $block, 0, $len);
345
-                    $ciphertext.= $block;
345
+                    $ciphertext .= $block;
346 346
                     $pos = $len;
347 347
                 }
348 348
 
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
      */
377 377
     function decrypt($ciphertext)
378 378
     {
379
-        if ( CRYPT_AES_MODE == CRYPT_AES_MODE_MCRYPT ) {
379
+        if (CRYPT_AES_MODE == CRYPT_AES_MODE_MCRYPT) {
380 380
             $this->_mcryptSetup();
381 381
 
382 382
             if ($this->mode == 'ncfb' && $this->continuousBuffer) {
@@ -390,11 +390,11 @@  discard block
 block discarded – undo
390 390
                     $max = 16 - $pos;
391 391
                     if ($len >= $max) {
392 392
                         $i = $max;
393
-                        $len-= $max;
393
+                        $len -= $max;
394 394
                         $pos = 0;
395 395
                     } else {
396 396
                         $i = $len;
397
-                        $pos+= $len;
397
+                        $pos += $len;
398 398
                         $len = 0;
399 399
                     }
400 400
                     // ie. $i = min($max, $len), $len-= $i, $pos+= $i, $pos%= $blocksize
@@ -403,13 +403,13 @@  discard block
 block discarded – undo
403 403
                 }
404 404
                 if ($len >= 16) {
405 405
                     $cb = substr($ciphertext, $i, $len - $len % 16);
406
-                    $plaintext.= mcrypt_generic($this->ecb, $iv . $cb) ^ $cb;
406
+                    $plaintext .= mcrypt_generic($this->ecb, $iv.$cb) ^ $cb;
407 407
                     $iv = substr($cb, -16);
408
-                    $len%= 16;
408
+                    $len %= 16;
409 409
                 }
410 410
                 if ($len) {
411 411
                     $iv = mcrypt_generic($this->ecb, $iv);
412
-                    $plaintext.= $iv ^ substr($ciphertext, -$len);
412
+                    $plaintext .= $iv ^ substr($ciphertext, -$len);
413 413
                     $iv = substr_replace($iv, substr($ciphertext, -$len), 0, $len);
414 414
                     $pos = $len;
415 415
                 }
Please login to merge, or discard this patch.