Completed
Push — 1.10.x ( 8f997c...918380 )
by Yannick
259:37 queued 220:06
created
main/inc/lib/event_email_template.class.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -7,14 +7,14 @@  discard block
 block discarded – undo
7 7
 class EventEmailTemplate extends Model
8 8
 {
9 9
     public $table;
10
-    public $columns = array('id', 'message','subject','event_type_name','activated');
10
+    public $columns = array('id', 'message', 'subject', 'event_type_name', 'activated');
11 11
 
12 12
     /**
13 13
      * Constructor
14 14
      */
15 15
 	public function __construct()
16 16
     {
17
-        $this->table =  Database::get_main_table(TABLE_EVENT_EMAIL_TEMPLATE);
17
+        $this->table = Database::get_main_table(TABLE_EVENT_EMAIL_TEMPLATE);
18 18
 	}
19 19
 
20 20
     public function get_all($where_conditions = array())
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 		// action links
35 35
 		$content = Display::actions(array(
36 36
                 array(
37
-                    'url' => 'event_type.php' ,
37
+                    'url' => 'event_type.php',
38 38
                     'content' => Display::return_icon('new_document.png', get_lang('Add'), array(), ICON_SIZE_MEDIUM)
39 39
                  )
40 40
             )
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
 
115 115
     public function get_count()
116 116
     {
117
-        $row = Database::select('count(*) as count', $this->table, array(),'first');
117
+        $row = Database::select('count(*) as count', $this->table, array(), 'first');
118 118
 
119 119
         return $row['count'];
120 120
     }
Please login to merge, or discard this patch.
main/inc/lib/myspace.lib.php 1 patch
Spacing   +170 added lines, -170 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
             array('url' => api_get_path(WEB_CODE_PATH).'mySpace/admin_view.php?display=course', 'content' => get_lang('DisplayCourseOverview')),
26 26
             array('url' => api_get_path(WEB_CODE_PATH).'tracking/question_course_report.php?view=admin', 'content' => get_lang('LPQuestionListResults')),
27 27
             array('url' => api_get_path(WEB_CODE_PATH).'tracking/course_session_report.php?view=admin', 'content' => get_lang('LPExerciseResultsBySession')),
28
-            ['url' => api_get_path(WEB_CODE_PATH) . 'mySpace/admin_view.php?display=accessoverview', 'content' => get_lang('DisplayAccessOverview') . ' (' . get_lang('Beta') . ')']
28
+            ['url' => api_get_path(WEB_CODE_PATH).'mySpace/admin_view.php?display=accessoverview', 'content' => get_lang('DisplayAccessOverview').' ('.get_lang('Beta').')']
29 29
         );
30 30
 
31 31
         return Display :: actions($actions, null);
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
     public static function getTopMenu()
35 35
     {
36 36
         $menu_items = array();
37
-        $menu_items[] = Display::url(Display::return_icon('stats.png', get_lang('MyStats'),'',ICON_SIZE_MEDIUM),api_get_path(WEB_CODE_PATH)."auth/my_progress.php" );
37
+        $menu_items[] = Display::url(Display::return_icon('stats.png', get_lang('MyStats'), '', ICON_SIZE_MEDIUM), api_get_path(WEB_CODE_PATH)."auth/my_progress.php");
38 38
         $menu_items[] = Display::url(Display::return_icon('teacher.png', get_lang('TeacherInterface'), array(), 32), api_get_path(WEB_CODE_PATH).'mySpace/?view=teacher');
39 39
         $menu_items[] = Display::url(Display::return_icon('star_na.png', get_lang('AdminInterface'), array(), 32), '#');
40 40
         $menu_items[] = Display::url(Display::return_icon('quiz.png', get_lang('ExamTracking'), array(), 32), api_get_path(WEB_CODE_PATH).'tracking/exams.php');
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
         $session_id  = intval($session_id);
105 105
 
106 106
         $sql = 'SELECT login_course_date, logout_course_date
107
-                FROM ' . $tbl_track_course . '
107
+                FROM ' . $tbl_track_course.'
108 108
                 WHERE
109 109
                     user_id = '.$user_id.' AND
110 110
                     c_id = '.$courseId.' AND
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
         foreach ($course_list as $course_item) {
144 144
             $courseInfo = api_get_course_info($course_item['code']);
145 145
             $courseId = $courseInfo['real_id'];
146
-            $new_course_list[] =  '"'.$courseId.'"';
146
+            $new_course_list[] = '"'.$courseId.'"';
147 147
         }
148 148
         $course_list = implode(', ', $new_course_list);
149 149
 
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
             return false;
152 152
         }
153 153
         $sql = 'SELECT login_course_date, logout_course_date, c_id
154
-                FROM ' . $tbl_track_course . '
154
+                FROM ' . $tbl_track_course.'
155 155
                 WHERE
156 156
                     user_id = '.$user_id.' AND
157 157
                     c_id IN ('.$course_list.') AND
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
             // student score
230 230
             $avg_score = Tracking :: get_avg_student_score($user_id, $courseCode);
231 231
             if (is_numeric($avg_score)) {
232
-                $avg_score = round($avg_score,2);
232
+                $avg_score = round($avg_score, 2);
233 233
             } else {
234 234
                 $$avg_score = '-';
235 235
             }
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 
266 266
         $t_head = '    <table style="width: 100%;border:0;padding:0;border-collapse:collapse;table-layout: fixed">';
267 267
         //$t_head .= '  <caption>'.get_lang('CourseInformation').'</caption>';
268
-        $t_head .=      '<tr>';
268
+        $t_head .= '<tr>';
269 269
         $t_head .= '        <th width="155px" style="border-left:0;border-bottom:0"><span>'.get_lang('Course').'</span></th>';
270 270
         $t_head .= '        <th style="padding:0;border-bottom:0"><span>'.cut(get_lang('AvgTimeSpentInTheCourse'), 6, true).'</span></th>';
271 271
         $t_head .= '        <th style="padding:0;border-bottom:0"><span>'.cut(get_lang('AvgStudentsProgress'), 6, true).'</span></th>';
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 
284 284
         $addparams = array('view' => 'admin', 'display' => 'user');
285 285
 
286
-        $table = new SortableTable('tracking_user_overview', array('MySpace','get_number_of_users_tracking_overview'), array('MySpace','get_user_data_tracking_overview'), 0);
286
+        $table = new SortableTable('tracking_user_overview', array('MySpace', 'get_number_of_users_tracking_overview'), array('MySpace', 'get_user_data_tracking_overview'), 0);
287 287
         $table->additional_parameters = $addparams;
288 288
 
289 289
         $table->set_header(0, get_lang('OfficialCode'), true, array('style' => 'font-size:8pt'), array('style' => 'font-size:8pt'));
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
         }
297 297
         $table->set_header(3, get_lang('LoginName'), true, array('style' => 'font-size:8pt'), array('style' => 'font-size:8pt'));
298 298
         $table->set_header(4, $t_head, false, array('style' => 'width:90%;border:0;padding:0;font-size:7.5pt;'), array('style' => 'width:90%;padding:0;font-size:7.5pt;'));
299
-        $table->set_column_filter(4, array('MySpace','course_info_tracking_filter'));
299
+        $table->set_column_filter(4, array('MySpace', 'course_info_tracking_filter'));
300 300
         $table->display();
301 301
     }
302 302
 
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
         $table -> set_header(7, get_lang('Sessions'), false);
342 342
 
343 343
         if ($is_western_name_order) {
344
-            $csv_header[] = array (
344
+            $csv_header[] = array(
345 345
                 get_lang('FirstName', ''),
346 346
                 get_lang('LastName', ''),
347 347
                 get_lang('TimeSpentOnThePlatform', ''),
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
                 get_lang('NumberOfSessions', '')
352 352
             );
353 353
         } else {
354
-            $csv_header[] = array (
354
+            $csv_header[] = array(
355 355
                 get_lang('LastName', ''),
356 356
                 get_lang('FirstName', ''),
357 357
                 get_lang('TimeSpentOnThePlatform', ''),
@@ -491,9 +491,9 @@  discard block
 block discarded – undo
491 491
 
492 492
         if ($tracking_column != 3) {
493 493
             if ($tracking_direction == 'DESC') {
494
-                usort($all_datas, array('MySpace','rsort_users'));
494
+                usort($all_datas, array('MySpace', 'rsort_users'));
495 495
             } else {
496
-                usort($all_datas, array('MySpace','sort_users'));
496
+                usort($all_datas, array('MySpace', 'sort_users'));
497 497
             }
498 498
         }
499 499
 
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
         /**
553 553
          * Column config
554 554
          */
555
-        $column_model   = array(
555
+        $column_model = array(
556 556
             array(
557 557
                 'name' => 'username',
558 558
                 'index' => 'username',
@@ -593,7 +593,7 @@  discard block
 block discarded – undo
593 593
 
594 594
         $action_links = '';
595 595
         // jqgrid will use this URL to do the selects
596
-        $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_session_lp_progress&session_id=' . $sessionId . '&course_id=' . $courseId . '&date_to=' . $date_to . '&date_from=' . $date_from;
596
+        $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_session_lp_progress&session_id='.$sessionId.'&course_id='.$courseId.'&date_to='.$date_to.'&date_from='.$date_from;
597 597
 
598 598
         //Table Id
599 599
         $tableId = 'lpProgress';
@@ -615,11 +615,11 @@  discard block
 block discarded – undo
615 615
             true
616 616
         );
617 617
 
618
-        $return = '<script>$(function() {'. $table .
618
+        $return = '<script>$(function() {'.$table.
619 619
             'jQuery("#'.$tableId.'").jqGrid("navGrid","#'.$tableId.'_pager",{view:false, edit:false, add:false, del:false, search:false, excel:true});
620 620
                 jQuery("#'.$tableId.'").jqGrid("navButtonAdd","#'.$tableId.'_pager",{
621 621
                        caption:"",
622
-                       title:"' . get_lang('ExportExcel') . '",
622
+                       title:"' . get_lang('ExportExcel').'",
623 623
                        onClickButton : function () {
624 624
                            jQuery("#'.$tableId.'").jqGrid("excelExport",{"url":"'.$url.'&export_format=xls"});
625 625
                        }
@@ -669,7 +669,7 @@  discard block
 block discarded – undo
669 669
         /**
670 670
          * Column config
671 671
          */
672
-        $column_model   = array(
672
+        $column_model = array(
673 673
             array('name'=>'session', 'index'=>'session', 'align'=>'left', 'search' => 'true', 'wrap_cell' => "true"),
674 674
             array('name'=>'exercise_id', 'index'=>'exercise_id', 'align'=>'left', 'search' => 'true'),
675 675
             array('name'=>'quiz_title', 'index'=>'quiz_title', 'align'=>'left', 'search' => 'true'),
@@ -686,7 +686,7 @@  discard block
 block discarded – undo
686 686
         //get dynamic column names
687 687
 
688 688
         // jqgrid will use this URL to do the selects
689
-        $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_exercise_progress&session_id=' . $sessionId . '&course_id=' . $courseId  . '&exercise_id=' . $exerciseId . '&date_to=' . $date_to . '&date_from=' . $date_from;
689
+        $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_exercise_progress&session_id='.$sessionId.'&course_id='.$courseId.'&exercise_id='.$exerciseId.'&date_to='.$date_to.'&date_from='.$date_from;
690 690
 
691 691
         // Autowidth
692 692
         $extra_params['autowidth'] = 'true';
@@ -697,11 +697,11 @@  discard block
 block discarded – undo
697 697
         $tableId = 'exerciseProgressOverview';
698 698
         $table = Display::grid_js($tableId, $url, $columns, $column_model, $extra_params, array(), '', true);
699 699
 
700
-        $return = '<script>$(function() {'. $table .
700
+        $return = '<script>$(function() {'.$table.
701 701
             'jQuery("#'.$tableId.'").jqGrid("navGrid","#'.$tableId.'_pager",{view:false, edit:false, add:false, del:false, search:false, excel:true});
702 702
                 jQuery("#'.$tableId.'").jqGrid("navButtonAdd","#'.$tableId.'_pager",{
703 703
                        caption:"",
704
-                       title:"' . get_lang('ExportExcel') . '",
704
+                       title:"' . get_lang('ExportExcel').'",
705 705
                        onClickButton : function () {
706 706
                            jQuery("#'.$tableId.'").jqGrid("excelExport",{"url":"'.$url.'&export_format=xls"});
707 707
                        }
@@ -787,8 +787,8 @@  discard block
 block discarded – undo
787 787
 
788 788
                     $column[] = $title;
789 789
                     $column_model[] = array(
790
-                        'name' => 'exer' . $i,
791
-                        'index' => 'exer' . $i,
790
+                        'name' => 'exer'.$i,
791
+                        'index' => 'exer'.$i,
792 792
                         'align' => 'center',
793 793
                         'search' => 'true',
794 794
                         'wrap_cell' => "true"
@@ -800,7 +800,7 @@  discard block
 block discarded – undo
800 800
 
801 801
         //end get dynamic column names
802 802
         // jqgrid will use this URL to do the selects
803
-        $url = api_get_path(WEB_AJAX_PATH) . 'model.ajax.php?a=get_exercise_grade&session_id=' . $sessionId . '&course_id=' . $courseId;
803
+        $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_exercise_grade&session_id='.$sessionId.'&course_id='.$courseId;
804 804
 
805 805
         // Autowidth
806 806
         $extra_params['autowidth'] = 'true';
@@ -811,13 +811,13 @@  discard block
 block discarded – undo
811 811
         $tableId = 'exerciseGradeOverview';
812 812
         $table = Display::grid_js($tableId, $url, $column, $column_model, $extra_params, array(), '', true);
813 813
 
814
-        $return = '<script>$(function() {' . $table .
815
-            'jQuery("#' . $tableId . '").jqGrid("navGrid","#' . $tableId . '_pager",{view:false, edit:false, add:false, del:false, search:false, excel:true});
816
-                jQuery("#' . $tableId . '").jqGrid("navButtonAdd","#' . $tableId . '_pager",{
814
+        $return = '<script>$(function() {'.$table.
815
+            'jQuery("#'.$tableId.'").jqGrid("navGrid","#'.$tableId.'_pager",{view:false, edit:false, add:false, del:false, search:false, excel:true});
816
+                jQuery("#' . $tableId.'").jqGrid("navButtonAdd","#'.$tableId.'_pager",{
817 817
                        caption:"",
818
-                       title:"' . get_lang('ExportExcel') . '",
818
+                       title:"' . get_lang('ExportExcel').'",
819 819
                        onClickButton : function () {
820
-                           jQuery("#' . $tableId . '").jqGrid("excelExport",{"url":"' . $url . '&export_format=xls"});
820
+                           jQuery("#' . $tableId.'").jqGrid("excelExport",{"url":"'.$url.'&export_format=xls"});
821 821
                        }
822 822
                 });
823 823
             });</script>';
@@ -850,10 +850,10 @@  discard block
 block discarded – undo
850 850
         /**
851 851
          * Column config
852 852
          */
853
-        $column_model   = array(
854
-            array('name'=>'username',   'index'=>'username',    'align'=>'left', 'search' => 'true', 'wrap_cell' => "true"),
855
-            array('name'=>'firstname',  'index'=>'firstname',   'align'=>'left', 'search' => 'true'),
856
-            array('name'=>'lastname',   'index'=>'lastname',    'align'=>'left', 'search' => 'true'),
853
+        $column_model = array(
854
+            array('name'=>'username', 'index'=>'username', 'align'=>'left', 'search' => 'true', 'wrap_cell' => "true"),
855
+            array('name'=>'firstname', 'index'=>'firstname', 'align'=>'left', 'search' => 'true'),
856
+            array('name'=>'lastname', 'index'=>'lastname', 'align'=>'left', 'search' => 'true'),
857 857
         );
858 858
         //get dinamic column names
859 859
         foreach ($questions as $question_id => $question) {
@@ -869,7 +869,7 @@  discard block
 block discarded – undo
869 869
         $action_links = '';
870 870
 
871 871
         // jqgrid will use this URL to do the selects
872
-        $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_survey_overview&session_id=' . $sessionId . '&course_id=' . $courseId . '&survey_id=' . $surveyId . '&date_to=' . $date_to . '&date_from=' . $date_from;
872
+        $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_survey_overview&session_id='.$sessionId.'&course_id='.$courseId.'&survey_id='.$surveyId.'&date_to='.$date_to.'&date_from='.$date_from;
873 873
 
874 874
         // Table Id
875 875
         $tableId = 'lpProgress';
@@ -891,11 +891,11 @@  discard block
 block discarded – undo
891 891
             true
892 892
         );
893 893
 
894
-        $return = '<script>$(function() {'. $table .
894
+        $return = '<script>$(function() {'.$table.
895 895
             'jQuery("#'.$tableId.'").jqGrid("navGrid","#'.$tableId.'_pager",{view:false, edit:false, add:false, del:false, search:false, excel:true});
896 896
                 jQuery("#'.$tableId.'").jqGrid("navButtonAdd","#'.$tableId.'_pager",{
897 897
                        caption:"",
898
-                       title:"' . get_lang('ExportExcel') . '",
898
+                       title:"' . get_lang('ExportExcel').'",
899 899
                        onClickButton : function () {
900 900
                            jQuery("#'.$tableId.'").jqGrid("excelExport",{"url":"'.$url.'&export_format=xls"});
901 901
                        }
@@ -910,7 +910,7 @@  discard block
 block discarded – undo
910 910
      * Display a sortable table that contains an overview off all the progress of the user in a session
911 911
      * @author César Perales <[email protected]>, Beeznest Team
912 912
      */
913
-    static function display_tracking_progress_overview($sessionId = 0, $courseId = 0,  $date_from, $date_to)
913
+    static function display_tracking_progress_overview($sessionId = 0, $courseId = 0, $date_from, $date_to)
914 914
     {
915 915
         //The order is important you need to check the the $column variable in the model.ajax.php file
916 916
         $columns = array(
@@ -960,55 +960,55 @@  discard block
 block discarded – undo
960 960
         );
961 961
 
962 962
         //Column config
963
-        $column_model   = array(
964
-            array('name'=>'lastname',   'index'=>'lastname',     'align'=>'left'),
965
-            array('name'=>'firstname',  'index'=>'firstname',    'align'=>'left'),
966
-            array('name'=>'username',   'index'=>'username',     'align'=>'left'),
963
+        $column_model = array(
964
+            array('name'=>'lastname', 'index'=>'lastname', 'align'=>'left'),
965
+            array('name'=>'firstname', 'index'=>'firstname', 'align'=>'left'),
966
+            array('name'=>'username', 'index'=>'username', 'align'=>'left'),
967 967
             #array('name'=>'profile',   'index'=>'username',     'align'=>'left'),
968
-            array('name'=>'total',      'index'=>'total',        'align'=>'left'),
969
-            array('name'=>'courses',    'index'=>'courses',      'align'=>'left', 'sortable' => 'false'),
970
-            array('name'=>'lessons',    'index'=>'lessons',      'align'=>'left', 'sortable' => 'false'),
971
-            array('name'=>'exercises',  'index'=>'exercises',    'align'=>'left', 'sortable' => 'false'),
972
-            array('name'=>'forums',     'index'=>'forums',       'align'=>'left', 'sortable' => 'false'),
973
-            array('name'=>'homeworks',  'index'=>'homeworks',    'align'=>'left', 'sortable' => 'false'),
974
-            array('name'=>'wikis',      'index'=>'wikis',        'align'=>'left', 'sortable' => 'false'),
975
-            array('name'=>'surveys',    'index'=>'surveys',      'align'=>'left', 'sortable' => 'false'),
968
+            array('name'=>'total', 'index'=>'total', 'align'=>'left'),
969
+            array('name'=>'courses', 'index'=>'courses', 'align'=>'left', 'sortable' => 'false'),
970
+            array('name'=>'lessons', 'index'=>'lessons', 'align'=>'left', 'sortable' => 'false'),
971
+            array('name'=>'exercises', 'index'=>'exercises', 'align'=>'left', 'sortable' => 'false'),
972
+            array('name'=>'forums', 'index'=>'forums', 'align'=>'left', 'sortable' => 'false'),
973
+            array('name'=>'homeworks', 'index'=>'homeworks', 'align'=>'left', 'sortable' => 'false'),
974
+            array('name'=>'wikis', 'index'=>'wikis', 'align'=>'left', 'sortable' => 'false'),
975
+            array('name'=>'surveys', 'index'=>'surveys', 'align'=>'left', 'sortable' => 'false'),
976 976
             //Lessons
977
-            array('name'=>'lessons_total',    'index'=>'lessons_total',      'align'=>'center', 'sortable' => 'false'),
978
-            array('name'=>'lessons_done',     'index'=>'lessons_done',       'align'=>'center', 'sortable' => 'false'),
979
-            array('name'=>'lessons_left',     'index'=>'lessons_left',       'align'=>'center', 'sortable' => 'false'),
980
-            array('name'=>'lessons_progress', 'index'=>'lessons_progress',   'align'=>'center', 'sortable' => 'false'),
977
+            array('name'=>'lessons_total', 'index'=>'lessons_total', 'align'=>'center', 'sortable' => 'false'),
978
+            array('name'=>'lessons_done', 'index'=>'lessons_done', 'align'=>'center', 'sortable' => 'false'),
979
+            array('name'=>'lessons_left', 'index'=>'lessons_left', 'align'=>'center', 'sortable' => 'false'),
980
+            array('name'=>'lessons_progress', 'index'=>'lessons_progress', 'align'=>'center', 'sortable' => 'false'),
981 981
             //Exercises
982
-            array('name'=>'exercises_total',    'index'=>'exercises_total',      'align'=>'center', 'sortable' => 'false'),
983
-            array('name'=>'exercises_done',     'index'=>'exercises_done',       'align'=>'center', 'sortable' => 'false'),
984
-            array('name'=>'exercises_left',     'index'=>'exercises_left',       'align'=>'center', 'sortable' => 'false'),
985
-            array('name'=>'exercises_progress', 'index'=>'exercises_progress',   'align'=>'center', 'sortable' => 'false'),
982
+            array('name'=>'exercises_total', 'index'=>'exercises_total', 'align'=>'center', 'sortable' => 'false'),
983
+            array('name'=>'exercises_done', 'index'=>'exercises_done', 'align'=>'center', 'sortable' => 'false'),
984
+            array('name'=>'exercises_left', 'index'=>'exercises_left', 'align'=>'center', 'sortable' => 'false'),
985
+            array('name'=>'exercises_progress', 'index'=>'exercises_progress', 'align'=>'center', 'sortable' => 'false'),
986 986
             //Assignments
987
-            array('name'=>'forums_total',    'index'=>'forums_total',        'align'=>'center', 'sortable' => 'false'),
988
-            array('name'=>'forums_done',     'index'=>'forums_done',         'align'=>'center', 'sortable' => 'false'),
989
-            array('name'=>'forums_left',     'index'=>'forums_left',         'align'=>'center', 'sortable' => 'false'),
990
-            array('name'=>'forums_progress', 'index'=>'forums_progress',     'align'=>'center', 'sortable' => 'false'),
987
+            array('name'=>'forums_total', 'index'=>'forums_total', 'align'=>'center', 'sortable' => 'false'),
988
+            array('name'=>'forums_done', 'index'=>'forums_done', 'align'=>'center', 'sortable' => 'false'),
989
+            array('name'=>'forums_left', 'index'=>'forums_left', 'align'=>'center', 'sortable' => 'false'),
990
+            array('name'=>'forums_progress', 'index'=>'forums_progress', 'align'=>'center', 'sortable' => 'false'),
991 991
             //Assignments
992
-            array('name'=>'assigments_total',    'index'=>'assigments_total',        'align'=>'center', 'sortable' => 'false'),
993
-            array('name'=>'assigments_done',     'index'=>'assigments_done',         'align'=>'center', 'sortable' => 'false'),
994
-            array('name'=>'assigments_left',     'index'=>'assigments_left',         'align'=>'center', 'sortable' => 'false'),
995
-            array('name'=>'assigments_progress', 'index'=>'assigments_progress',     'align'=>'center', 'sortable' => 'false'),
992
+            array('name'=>'assigments_total', 'index'=>'assigments_total', 'align'=>'center', 'sortable' => 'false'),
993
+            array('name'=>'assigments_done', 'index'=>'assigments_done', 'align'=>'center', 'sortable' => 'false'),
994
+            array('name'=>'assigments_left', 'index'=>'assigments_left', 'align'=>'center', 'sortable' => 'false'),
995
+            array('name'=>'assigments_progress', 'index'=>'assigments_progress', 'align'=>'center', 'sortable' => 'false'),
996 996
             //Assignments
997
-            array('name'=>'wiki_total',         'index'=>'wiki_total',       'align'=>'center', 'sortable' => 'false'),
998
-            array('name'=>'wiki_revisions',     'index'=>'wiki_revisions',   'align'=>'center', 'sortable' => 'false'),
999
-            array('name'=>'wiki_read',          'index'=>'wiki_read',        'align'=>'center', 'sortable' => 'false'),
1000
-            array('name'=>'wiki_unread',        'index'=>'wiki_unread',      'align'=>'center', 'sortable' => 'false'),
1001
-            array('name'=>'wiki_progress',      'index'=>'wiki_progress',    'align'=>'center', 'sortable' => 'false'),
997
+            array('name'=>'wiki_total', 'index'=>'wiki_total', 'align'=>'center', 'sortable' => 'false'),
998
+            array('name'=>'wiki_revisions', 'index'=>'wiki_revisions', 'align'=>'center', 'sortable' => 'false'),
999
+            array('name'=>'wiki_read', 'index'=>'wiki_read', 'align'=>'center', 'sortable' => 'false'),
1000
+            array('name'=>'wiki_unread', 'index'=>'wiki_unread', 'align'=>'center', 'sortable' => 'false'),
1001
+            array('name'=>'wiki_progress', 'index'=>'wiki_progress', 'align'=>'center', 'sortable' => 'false'),
1002 1002
             //Surveys
1003
-            array('name'=>'surveys_total',    'index'=>'surveys_total',      'align'=>'center', 'sortable' => 'false'),
1004
-            array('name'=>'surveys_done',     'index'=>'surveys_done',       'align'=>'center', 'sortable' => 'false'),
1005
-            array('name'=>'surveys_left',     'index'=>'surveys_left',       'align'=>'center', 'sortable' => 'false'),
1006
-            array('name'=>'surveys_progress', 'index'=>'surveys_progress',   'align'=>'center', 'sortable' => 'false'),
1003
+            array('name'=>'surveys_total', 'index'=>'surveys_total', 'align'=>'center', 'sortable' => 'false'),
1004
+            array('name'=>'surveys_done', 'index'=>'surveys_done', 'align'=>'center', 'sortable' => 'false'),
1005
+            array('name'=>'surveys_left', 'index'=>'surveys_left', 'align'=>'center', 'sortable' => 'false'),
1006
+            array('name'=>'surveys_progress', 'index'=>'surveys_progress', 'align'=>'center', 'sortable' => 'false'),
1007 1007
         );
1008 1008
 
1009 1009
         $action_links = '';
1010 1010
         // jqgrid will use this URL to do the selects
1011
-        $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_session_progress&session_id=' . $sessionId . '&course_id=' . $courseId . '&date_to=' . $date_to . '&date_from=' . $date_from;
1011
+        $url = api_get_path(WEB_AJAX_PATH).'model.ajax.php?a=get_session_progress&session_id='.$sessionId.'&course_id='.$courseId.'&date_to='.$date_to.'&date_from='.$date_from;
1012 1012
 
1013 1013
         //Table Id
1014 1014
         $tableId = 'progressOverview';
@@ -1068,11 +1068,11 @@  discard block
 block discarded – undo
1068 1068
             true
1069 1069
         );
1070 1070
 
1071
-        $return = '<script>$(function() {'. $table .
1071
+        $return = '<script>$(function() {'.$table.
1072 1072
             'jQuery("#'.$tableId.'").jqGrid("navGrid","#'.$tableId.'_pager",{view:false, edit:false, add:false, del:false, search:false, excel:true});
1073 1073
                 jQuery("#'.$tableId.'").jqGrid("navButtonAdd","#'.$tableId.'_pager",{
1074 1074
                        caption:"",
1075
-                       title:"' . get_lang('ExportExcel') . '",
1075
+                       title:"' . get_lang('ExportExcel').'",
1076 1076
                        onClickButton : function () {
1077 1077
                            jQuery("#'.$tableId.'").jqGrid("excelExport",{"url":"'.$url.'&export_format=xls"});
1078 1078
                        }
@@ -1132,7 +1132,7 @@  discard block
 block discarded – undo
1132 1132
                 // adding the fields that are checked to the session
1133 1133
                 $message = '';
1134 1134
                 foreach ($values as $field_ids => $value) {
1135
-                    if ($value == 1 && strstr($field_ids,'extra_export_field')) {
1135
+                    if ($value == 1 && strstr($field_ids, 'extra_export_field')) {
1136 1136
                         $_SESSION['additional_export_fields'][] = str_replace('extra_export_field', '', $field_ids);
1137 1137
                     }
1138 1138
                 }
@@ -1147,7 +1147,7 @@  discard block
 block discarded – undo
1147 1147
                 // Displaying a feedback message
1148 1148
                 if (!empty($_SESSION['additional_export_fields'])) {
1149 1149
                     Display::display_confirmation_message(get_lang('FollowingFieldsWillAlsoBeExported').': <br /><ul>'.$message.'</ul>', false);
1150
-                } else  {
1150
+                } else {
1151 1151
                     Display::display_confirmation_message(get_lang('NoAdditionalFieldsWillBeExported'), false);
1152 1152
                 }
1153 1153
             } else {
@@ -1175,7 +1175,7 @@  discard block
 block discarded – undo
1175 1175
     {
1176 1176
         $t_head = '    <table style="width: 100%;border:0;padding:0;border-collapse:collapse;table-layout: fixed">';
1177 1177
         //$t_head .= '  <caption>'.get_lang('CourseInformation').'</caption>';
1178
-        $t_head .=      '<tr>';
1178
+        $t_head .= '<tr>';
1179 1179
         $t_head .= '        <th style="padding:0;border-bottom:0"><span>'.cut(get_lang('AvgTimeSpentInTheCourse'), 6, true).'</span></th>';
1180 1180
         $t_head .= '        <th style="padding:0;border-bottom:0"><span>'.cut(get_lang('AvgStudentsProgress'), 6, true).'</span></th>';
1181 1181
         $t_head .= '        <th style="padding:0;border-bottom:0"><span>'.cut(get_lang('AvgCourseScore'), 6, true).'</span></th>';
@@ -1192,13 +1192,13 @@  discard block
 block discarded – undo
1192 1192
 
1193 1193
         $addparams = array('view' => 'admin', 'display' => 'courseoverview');
1194 1194
 
1195
-        $table = new SortableTable('tracking_session_overview', array('MySpace', 'get_total_number_courses'), array('MySpace','get_course_data_tracking_overview'), 1);
1195
+        $table = new SortableTable('tracking_session_overview', array('MySpace', 'get_total_number_courses'), array('MySpace', 'get_course_data_tracking_overview'), 1);
1196 1196
         $table->additional_parameters = $addparams;
1197 1197
 
1198 1198
         $table->set_header(0, '', false, null, array('style' => 'display: none'));
1199 1199
         $table->set_header(1, get_lang('Course'), true, array('style' => 'font-size:8pt'), array('style' => 'font-size:8pt'));
1200 1200
         $table->set_header(2, $t_head, false, array('style' => 'width:90%;border:0;padding:0;font-size:7.5pt;'), array('style' => 'width:90%;padding:0;font-size:7.5pt;'));
1201
-        $table->set_column_filter(2, array('MySpace','course_tracking_filter'));
1201
+        $table->set_column_filter(2, array('MySpace', 'course_tracking_filter'));
1202 1202
         $table->display();
1203 1203
     }
1204 1204
 
@@ -1234,7 +1234,7 @@  discard block
 block discarded – undo
1234 1234
         $sql .= " ORDER BY col$column $direction ";
1235 1235
         $sql .= " LIMIT $from,$number_of_items";
1236 1236
         $result = Database::query($sql);
1237
-        $return = array ();
1237
+        $return = array();
1238 1238
         while ($course = Database::fetch_row($result)) {
1239 1239
             $return[] = $course;
1240 1240
         }
@@ -1287,18 +1287,18 @@  discard block
 block discarded – undo
1287 1287
             $progress += $progress_tmp[0];
1288 1288
             $nb_progress_lp += $progress_tmp[1];
1289 1289
             $score_tmp = Tracking :: get_avg_student_score($row->user_id, $course_code, array(), null, true);
1290
-            if(is_array($score_tmp)) {
1290
+            if (is_array($score_tmp)) {
1291 1291
                 $score += $score_tmp[0];
1292 1292
                 $nb_score_lp += $score_tmp[1];
1293 1293
             }
1294 1294
             $nb_messages += Tracking::count_student_messages($row->user_id, $course_code);
1295 1295
             $nb_assignments += Tracking::count_student_assignments($row->user_id, $course_code);
1296 1296
             $last_login_date_tmp = Tracking :: get_last_connection_date_on_the_course($row->user_id, $courseInfo, null, false);
1297
-            if($last_login_date_tmp != false && $last_login_date == false) { // TODO: To be cleaned
1297
+            if ($last_login_date_tmp != false && $last_login_date == false) { // TODO: To be cleaned
1298 1298
                 $last_login_date = $last_login_date_tmp;
1299
-            } else if($last_login_date_tmp != false && $last_login_date != false) { // TODO: Repeated previous condition. To be cleaned.
1299
+            } else if ($last_login_date_tmp != false && $last_login_date != false) { // TODO: Repeated previous condition. To be cleaned.
1300 1300
                 // Find the max and assign it to first_login_date
1301
-                if(strtotime($last_login_date_tmp) > strtotime($last_login_date)) {
1301
+                if (strtotime($last_login_date_tmp) > strtotime($last_login_date)) {
1302 1302
                     $last_login_date = $last_login_date_tmp;
1303 1303
                 }
1304 1304
             }
@@ -1308,27 +1308,27 @@  discard block
 block discarded – undo
1308 1308
             $total_score_possible += $exercise_results_tmp['score_possible'];
1309 1309
             $total_questions_answered += $exercise_results_tmp['questions_answered'];
1310 1310
         }
1311
-        if($nb_progress_lp > 0) {
1311
+        if ($nb_progress_lp > 0) {
1312 1312
             $avg_progress = round($progress / $nb_progress_lp, 2);
1313 1313
         } else {
1314 1314
             $avg_progress = 0;
1315 1315
         }
1316
-        if($nb_score_lp > 0) {
1316
+        if ($nb_score_lp > 0) {
1317 1317
             $avg_score = round($score / $nb_score_lp, 2);
1318 1318
         } else {
1319 1319
             $avg_score = '-';
1320 1320
         }
1321
-        if($last_login_date) {
1321
+        if ($last_login_date) {
1322 1322
             $last_login_date = api_convert_and_format_date($last_login_date, DATE_FORMAT_SHORT, date_default_timezone_get());
1323 1323
         } else {
1324 1324
             $last_login_date = '-';
1325 1325
         }
1326
-        if($total_score_possible > 0) {
1326
+        if ($total_score_possible > 0) {
1327 1327
             $total_score_percentage = round($total_score_obtained / $total_score_possible * 100, 2);
1328 1328
         } else {
1329 1329
             $total_score_percentage = 0;
1330 1330
         }
1331
-        if($total_score_percentage > 0) {
1331
+        if ($total_score_percentage > 0) {
1332 1332
             $total_score = $total_score_obtained.'/'.$total_score_possible.' ('.$total_score_percentage.' %)';
1333 1333
         } else {
1334 1334
             $total_score = '-';
@@ -1436,7 +1436,7 @@  discard block
 block discarded – undo
1436 1436
                 $progress += $progress_tmp[0];
1437 1437
                 $nb_progress_lp += $progress_tmp[1];
1438 1438
                 $score_tmp = Tracking :: get_avg_student_score($row->user_id, $course_code, array(), null, true);
1439
-                if(is_array($score_tmp)) {
1439
+                if (is_array($score_tmp)) {
1440 1440
                     $score += $score_tmp[0];
1441 1441
                     $nb_score_lp += $score_tmp[1];
1442 1442
                 }
@@ -1444,11 +1444,11 @@  discard block
 block discarded – undo
1444 1444
                 $nb_assignments += Tracking::count_student_assignments($row->user_id, $course_code);
1445 1445
 
1446 1446
                 $last_login_date_tmp = Tracking::get_last_connection_date_on_the_course($row->user_id, $courseInfo, null, false);
1447
-                if($last_login_date_tmp != false && $last_login_date == false) { // TODO: To be cleaned.
1447
+                if ($last_login_date_tmp != false && $last_login_date == false) { // TODO: To be cleaned.
1448 1448
                     $last_login_date = $last_login_date_tmp;
1449
-                } else if($last_login_date_tmp != false && $last_login_date == false) { // TODO: Repeated previous condition. To be cleaned.
1449
+                } else if ($last_login_date_tmp != false && $last_login_date == false) { // TODO: Repeated previous condition. To be cleaned.
1450 1450
                     // Find the max and assign it to first_login_date
1451
-                    if(strtotime($last_login_date_tmp) > strtotime($last_login_date)) {
1451
+                    if (strtotime($last_login_date_tmp) > strtotime($last_login_date)) {
1452 1452
                         $last_login_date = $last_login_date_tmp;
1453 1453
                     }
1454 1454
                 }
@@ -1458,22 +1458,22 @@  discard block
 block discarded – undo
1458 1458
                 $total_score_possible += $exercise_results_tmp['score_possible'];
1459 1459
                 $total_questions_answered += $exercise_results_tmp['questions_answered'];
1460 1460
             }
1461
-            if($nb_progress_lp > 0) {
1461
+            if ($nb_progress_lp > 0) {
1462 1462
                 $avg_progress = round($progress / $nb_progress_lp, 2);
1463 1463
             } else {
1464 1464
                 $avg_progress = 0;
1465 1465
             }
1466
-            if($nb_score_lp > 0) {
1466
+            if ($nb_score_lp > 0) {
1467 1467
                 $avg_score = round($score / $nb_score_lp, 2);
1468 1468
             } else {
1469 1469
                 $avg_score = '-';
1470 1470
             }
1471
-            if($last_login_date) {
1471
+            if ($last_login_date) {
1472 1472
                 $last_login_date = api_convert_and_format_date($last_login_date, DATE_FORMAT_SHORT, date_default_timezone_get());
1473 1473
             } else {
1474 1474
                 $last_login_date = '-';
1475 1475
             }
1476
-            if($total_score_possible > 0) {
1476
+            if ($total_score_possible > 0) {
1477 1477
                 $total_score_percentage = round($total_score_obtained / $total_score_possible * 100, 2);
1478 1478
             } else {
1479 1479
                 $total_score_percentage = 0;
@@ -1509,7 +1509,7 @@  discard block
 block discarded – undo
1509 1509
     {
1510 1510
         $t_head = '    <table style="width: 100%;border:0;padding:0;border-collapse:collapse;table-layout: fixed">';
1511 1511
         //$t_head .= '  <caption>'.get_lang('CourseInformation').'</caption>';
1512
-        $t_head .=      '<tr>';
1512
+        $t_head .= '<tr>';
1513 1513
         $t_head .= '        <th width="155px" style="border-left:0;border-bottom:0"><span>'.get_lang('Course').'</span></th>';
1514 1514
         $t_head .= '        <th style="padding:0;border-bottom:0"><span>'.cut(get_lang('AvgTimeSpentInTheCourse'), 6, true).'</span></th>';
1515 1515
         $t_head .= '        <th style="padding:0;border-bottom:0"><span>'.cut(get_lang('AvgStudentsProgress'), 6, true).'</span></th>';
@@ -1527,7 +1527,7 @@  discard block
 block discarded – undo
1527 1527
 
1528 1528
         $addparams = array('view' => 'admin', 'display' => 'sessionoverview');
1529 1529
 
1530
-        $table = new SortableTable('tracking_session_overview', array('MySpace','get_total_number_sessions'), array('MySpace','get_session_data_tracking_overview'), 1);
1530
+        $table = new SortableTable('tracking_session_overview', array('MySpace', 'get_total_number_sessions'), array('MySpace', 'get_session_data_tracking_overview'), 1);
1531 1531
         $table->additional_parameters = $addparams;
1532 1532
 
1533 1533
         $table->set_header(0, '', false, null, array('style' => 'display: none'));
@@ -1566,7 +1566,7 @@  discard block
 block discarded – undo
1566 1566
         $sql .= " ORDER BY col$column $direction ";
1567 1567
         $sql .= " LIMIT $from,$number_of_items";
1568 1568
         $result = Database::query($sql);
1569
-        $return = array ();
1569
+        $return = array();
1570 1570
         while ($session = Database::fetch_row($result)) {
1571 1571
             $return[] = $session;
1572 1572
         }
@@ -1655,10 +1655,10 @@  discard block
 block discarded – undo
1655 1655
                 if ($last_login_date_tmp != false && $last_login_date == false) {
1656 1656
                     // TODO: To be cleaned.
1657 1657
                     $last_login_date = $last_login_date_tmp;
1658
-                } else if($last_login_date_tmp != false && $last_login_date != false) {
1658
+                } else if ($last_login_date_tmp != false && $last_login_date != false) {
1659 1659
                     // TODO: Repeated previous condition! To be cleaned.
1660 1660
                     // Find the max and assign it to first_login_date
1661
-                    if(strtotime($last_login_date_tmp) > strtotime($last_login_date)) {
1661
+                    if (strtotime($last_login_date_tmp) > strtotime($last_login_date)) {
1662 1662
                         $last_login_date = $last_login_date_tmp;
1663 1663
                     }
1664 1664
                 }
@@ -1668,27 +1668,27 @@  discard block
 block discarded – undo
1668 1668
                 $total_score_possible += $exercise_results_tmp['score_possible'];
1669 1669
                 $total_questions_answered += $exercise_results_tmp['questions_answered'];
1670 1670
             }
1671
-            if($nb_progress_lp > 0) {
1671
+            if ($nb_progress_lp > 0) {
1672 1672
                 $avg_progress = round($progress / $nb_progress_lp, 2);
1673 1673
             } else {
1674 1674
                 $avg_progress = 0;
1675 1675
             }
1676
-            if($nb_score_lp > 0) {
1676
+            if ($nb_score_lp > 0) {
1677 1677
                 $avg_score = round($score / $nb_score_lp, 2);
1678 1678
             } else {
1679 1679
                 $avg_score = '-';
1680 1680
             }
1681
-            if($last_login_date) {
1681
+            if ($last_login_date) {
1682 1682
                 $last_login_date = api_convert_and_format_date($last_login_date, DATE_FORMAT_SHORT, date_default_timezone_get());
1683 1683
             } else {
1684 1684
                 $last_login_date = '-';
1685 1685
             }
1686
-            if($total_score_possible > 0) {
1686
+            if ($total_score_possible > 0) {
1687 1687
                 $total_score_percentage = round($total_score_obtained / $total_score_possible * 100, 2);
1688 1688
             } else {
1689 1689
                 $total_score_percentage = 0;
1690 1690
             }
1691
-            if($total_score_percentage > 0) {
1691
+            if ($total_score_percentage > 0) {
1692 1692
                 $total_score = $total_score_obtained.'/'.$total_score_possible.' ('.$total_score_percentage.' %)';
1693 1693
             } else {
1694 1694
                 $total_score = '-';
@@ -1799,7 +1799,7 @@  discard block
 block discarded – undo
1799 1799
                 $total_score_obtained = 0;
1800 1800
                 $total_score_possible = 0;
1801 1801
                 $total_questions_answered = 0;
1802
-                while($row_user = Database::fetch_object($result_users)) {
1802
+                while ($row_user = Database::fetch_object($result_users)) {
1803 1803
                     // get time spent in the course and session
1804 1804
                     $time_spent += Tracking::get_time_spent_on_the_course($row_user->user_id, $courseId, $session_id);
1805 1805
                     $progress_tmp = Tracking::get_avg_student_progress($row_user->user_id, $row->code, array(), $session_id, true);
@@ -1828,11 +1828,11 @@  discard block
 block discarded – undo
1828 1828
                         $session_id,
1829 1829
                         false
1830 1830
                     );
1831
-                    if($last_login_date_tmp != false && $last_login_date == false) { // TODO: To be cleaned.
1831
+                    if ($last_login_date_tmp != false && $last_login_date == false) { // TODO: To be cleaned.
1832 1832
                         $last_login_date = $last_login_date_tmp;
1833
-                    } else if($last_login_date_tmp != false && $last_login_date == false) { // TODO: Repeated previous condition. To be cleaned.
1833
+                    } else if ($last_login_date_tmp != false && $last_login_date == false) { // TODO: Repeated previous condition. To be cleaned.
1834 1834
                         // Find the max and assign it to first_login_date
1835
-                        if(strtotime($last_login_date_tmp) > strtotime($last_login_date)) {
1835
+                        if (strtotime($last_login_date_tmp) > strtotime($last_login_date)) {
1836 1836
                             $last_login_date = $last_login_date_tmp;
1837 1837
                         }
1838 1838
                     }
@@ -1842,27 +1842,27 @@  discard block
 block discarded – undo
1842 1842
                     $total_score_possible += $exercise_results_tmp['score_possible'];
1843 1843
                     $total_questions_answered += $exercise_results_tmp['questions_answered'];
1844 1844
                 }
1845
-                if($nb_progress_lp > 0) {
1845
+                if ($nb_progress_lp > 0) {
1846 1846
                     $avg_progress = round($progress / $nb_progress_lp, 2);
1847 1847
                 } else {
1848 1848
                     $avg_progress = 0;
1849 1849
                 }
1850
-                if($nb_score_lp > 0) {
1850
+                if ($nb_score_lp > 0) {
1851 1851
                     $avg_score = round($score / $nb_score_lp, 2);
1852 1852
                 } else {
1853 1853
                     $avg_score = '-';
1854 1854
                 }
1855
-                if($last_login_date) {
1855
+                if ($last_login_date) {
1856 1856
                     $last_login_date = api_convert_and_format_date($last_login_date, DATE_FORMAT_SHORT, date_default_timezone_get());
1857 1857
                 } else {
1858 1858
                     $last_login_date = '-';
1859 1859
                 }
1860
-                if($total_score_possible > 0) {
1860
+                if ($total_score_possible > 0) {
1861 1861
                     $total_score_percentage = round($total_score_obtained / $total_score_possible * 100, 2);
1862 1862
                 } else {
1863 1863
                     $total_score_percentage = 0;
1864 1864
                 }
1865
-                if($total_score_percentage > 0) {
1865
+                if ($total_score_percentage > 0) {
1866 1866
                     $total_score = $total_score_obtained.'/'.$total_score_possible.' ('.$total_score_percentage.' %)';
1867 1867
                 } else {
1868 1868
                     $total_score = '-';
@@ -1912,7 +1912,7 @@  discard block
 block discarded – undo
1912 1912
             FROM '.Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES)."
1913 1913
             WHERE c_id = ' . $courseId . '
1914 1914
             AND exe_user_id = '".intval($user_id)."'";
1915
-        if($session_id !== false) {
1915
+        if ($session_id !== false) {
1916 1916
             $sql .= " AND session_id = '".$session_id."' ";
1917 1917
         }
1918 1918
         $result = Database::query($sql);
@@ -1922,7 +1922,7 @@  discard block
 block discarded – undo
1922 1922
         while ($row = Database::fetch_array($result)) {
1923 1923
             $score_obtained += $row['exe_result'];
1924 1924
             $score_possible += $row['exe_weighting'];
1925
-            $questions_answered ++;
1925
+            $questions_answered++;
1926 1926
         }
1927 1927
 
1928 1928
         if ($score_possible != 0) {
@@ -2043,9 +2043,9 @@  discard block
 block discarded – undo
2043 2043
                     }
2044 2044
                 }
2045 2045
                 // time spent in the course
2046
-                $csv_row[] = api_time_to_hms(Tracking::get_time_spent_on_the_course ($user[4], $courseId));
2046
+                $csv_row[] = api_time_to_hms(Tracking::get_time_spent_on_the_course($user[4], $courseId));
2047 2047
                 // student progress in course
2048
-                $csv_row[] = round(Tracking::get_avg_student_progress ($user[4], $row[0]), 2);
2048
+                $csv_row[] = round(Tracking::get_avg_student_progress($user[4], $row[0]), 2);
2049 2049
                 // student score
2050 2050
                 $csv_row[] = round(Tracking::get_avg_student_score($user[4], $row[0]), 2);
2051 2051
                 // student tes score
@@ -2053,7 +2053,7 @@  discard block
 block discarded – undo
2053 2053
                 // student messages
2054 2054
                 $csv_row[] = Tracking::count_student_messages($user[4], $row[0]);
2055 2055
                 // student assignments
2056
-                $csv_row[] = Tracking::count_student_assignments ($user[4], $row[0]);
2056
+                $csv_row[] = Tracking::count_student_assignments($user[4], $row[0]);
2057 2057
                 // student exercises results
2058 2058
                 $exercises_results = MySpace::exercises_results($user[4], $row[0]);
2059 2059
                 $csv_row[] = $exercises_results['score_obtained'];
@@ -2061,7 +2061,7 @@  discard block
 block discarded – undo
2061 2061
                 $csv_row[] = $exercises_results['questions_answered'];
2062 2062
                 $csv_row[] = $exercises_results['percentage'];
2063 2063
                 // first connection
2064
-                $csv_row[] = Tracking::get_first_connection_date_on_the_course ($user[4], $courseId);
2064
+                $csv_row[] = Tracking::get_first_connection_date_on_the_course($user[4], $courseId);
2065 2065
                 // last connection
2066 2066
                 $csv_row[] = strip_tags(Tracking::get_last_connection_date_on_the_course($user[4], $courseInfo));
2067 2067
 
@@ -2095,9 +2095,9 @@  discard block
 block discarded – undo
2095 2095
         // get all courses with limit
2096 2096
         $sql = "SELECT course.code as col1, course.title as col2
2097 2097
                 FROM $tbl_course course
2098
-                WHERE course.code IN (".implode(',',$courses_code).")";
2098
+                WHERE course.code IN (".implode(',', $courses_code).")";
2099 2099
 
2100
-        if (!in_array($direction, array('ASC','DESC'))) $direction = 'ASC';
2100
+        if (!in_array($direction, array('ASC', 'DESC'))) $direction = 'ASC';
2101 2101
 
2102 2102
         $column = intval($column);
2103 2103
         $from = intval($from);
@@ -2166,7 +2166,7 @@  discard block
 block discarded – undo
2166 2166
             $table_row[] = $avg_assignments_in_course;
2167 2167
 
2168 2168
             //set the "from" value to know if I access the Reporting by the chamilo tab or the course link
2169
-            $table_row[] = '<center><a href="../../tracking/courseLog.php?cidReq=' .$course_code.'&from=myspace&id_session='.$session_id.'">
2169
+            $table_row[] = '<center><a href="../../tracking/courseLog.php?cidReq='.$course_code.'&from=myspace&id_session='.$session_id.'">
2170 2170
                              <img src="'.api_get_path(WEB_IMG_PATH).'icons/22/2rightarrow.png" border="0" /></a>
2171 2171
                             </center>';
2172 2172
             $csv_content[] = array(
@@ -2174,7 +2174,7 @@  discard block
 block discarded – undo
2174 2174
                 $nb_students_in_course,
2175 2175
                 $avg_time_spent_in_course,
2176 2176
                 is_null($avg_progress_in_course) ? null : $avg_progress_in_course.'%',
2177
-                is_null($avg_score_in_course) ? null : is_numeric($avg_score_in_course) ? $avg_score_in_course.'%' : $avg_score_in_course ,
2177
+                is_null($avg_score_in_course) ? null : is_numeric($avg_score_in_course) ? $avg_score_in_course.'%' : $avg_score_in_course,
2178 2178
                 is_null($avg_score_in_exercise) ? null : $avg_score_in_exercise.'%',
2179 2179
                 $avg_messages_in_course,
2180 2180
                 $avg_assignments_in_course,
@@ -2242,7 +2242,7 @@  discard block
 block discarded – undo
2242 2242
         $sql .= " ORDER BY col$column $direction ";
2243 2243
         $sql .= " LIMIT $from,$number_of_items";
2244 2244
         $result = Database::query($sql);
2245
-        $return = array ();
2245
+        $return = array();
2246 2246
         while ($user = Database::fetch_row($result)) {
2247 2247
             $return[] = $user;
2248 2248
         }
@@ -2297,7 +2297,7 @@  discard block
 block discarded – undo
2297 2297
                     $i++;
2298 2298
                 }
2299 2299
             }
2300
-            $username_array = array('username' => $desired_username , 'sufix' => $sufix);
2300
+            $username_array = array('username' => $desired_username, 'sufix' => $sufix);
2301 2301
             return $username_array;
2302 2302
         } else {
2303 2303
             $username_array = array('username' => $username, 'sufix' => '');
@@ -2571,7 +2571,7 @@  discard block
 block discarded – undo
2571 2571
         foreach ($users as $index => $user) {
2572 2572
             $userid = $user['id'];
2573 2573
             $sql_insert = "INSERT IGNORE INTO $tbl_session_rel_user(session_id, user_id, registered_at)
2574
-                           VALUES ('$id_session','$userid', '" . api_get_utc_datetime() . "')";
2574
+                           VALUES ('$id_session','$userid', '".api_get_utc_datetime()."')";
2575 2575
             Database::query($sql_insert);
2576 2576
             $user['added_at_session'] = 1;
2577 2577
             $new_users[] = $user;
@@ -2605,10 +2605,10 @@  discard block
 block discarded – undo
2605 2605
                 );
2606 2606
                 $userInfo = api_get_user_info($user['id']);
2607 2607
 
2608
-                if (($user['added_at_platform'] == 1  && $user['added_at_session'] == 1) || $user['added_at_session'] == 1) {
2608
+                if (($user['added_at_platform'] == 1 && $user['added_at_session'] == 1) || $user['added_at_session'] == 1) {
2609 2609
                     if ($user['added_at_platform'] == 1) {
2610 2610
                         $addedto = get_lang('UserCreatedPlatform');
2611
-                    } else  {
2611
+                    } else {
2612 2612
                         $addedto = '          ';
2613 2613
                     }
2614 2614
 
@@ -2671,7 +2671,7 @@  discard block
 block discarded – undo
2671 2671
         global $current_tag;
2672 2672
         switch ($data) {
2673 2673
             case 'Contact' :
2674
-                $user = array ();
2674
+                $user = array();
2675 2675
                 break;
2676 2676
             default :
2677 2677
                 $current_tag = $data;
@@ -2718,9 +2718,9 @@  discard block
 block discarded – undo
2718 2718
         global $current_value;
2719 2719
         global $user;
2720 2720
         global $users;
2721
-        $users = array ();
2721
+        $users = array();
2722 2722
         $parser = xml_parser_create('UTF-8');
2723
-        xml_set_element_handler($parser, array('MySpace','element_start'), array('MySpace','element_end'));
2723
+        xml_set_element_handler($parser, array('MySpace', 'element_start'), array('MySpace', 'element_end'));
2724 2724
         xml_set_character_data_handler($parser, "character_data");
2725 2725
         xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, false);
2726 2726
         xml_parse($parser, api_utf8_encode_xml(file_get_contents($file)));
@@ -2766,7 +2766,7 @@  discard block
 block discarded – undo
2766 2766
             get_lang('SearchCourse'),
2767 2767
             $courseList,
2768 2768
             [
2769
-                'url' => api_get_path(WEB_AJAX_PATH) . 'course.ajax.php?' . http_build_query([
2769
+                'url' => api_get_path(WEB_AJAX_PATH).'course.ajax.php?'.http_build_query([
2770 2770
                     'a' => 'search_course_by_session_all',
2771 2771
                     'session_id' => $sessionId
2772 2772
                 ])
@@ -2785,7 +2785,7 @@  discard block
 block discarded – undo
2785 2785
                             course_id: $('#course_id').val() || 0
2786 2786
                         });
2787 2787
 
2788
-                        return '" . api_get_path(WEB_AJAX_PATH) . "session.ajax.php?' + params;
2788
+                        return '" . api_get_path(WEB_AJAX_PATH)."session.ajax.php?' + params;
2789 2789
                     }
2790 2790
                 "
2791 2791
             ]
@@ -2816,7 +2816,7 @@  discard block
 block discarded – undo
2816 2816
                             course_id: $('#course_id').val()
2817 2817
                         });
2818 2818
 
2819
-                        return '" . api_get_path(WEB_AJAX_PATH) . "course.ajax.php?' + params;
2819
+                        return '" . api_get_path(WEB_AJAX_PATH)."course.ajax.php?' + params;
2820 2820
                     }
2821 2821
                 "
2822 2822
             ]
@@ -2842,8 +2842,8 @@  discard block
 block discarded – undo
2842 2842
         if ($form->validate()) {
2843 2843
             $table = new SortableTable(
2844 2844
                 'tracking_access_overview',
2845
-                ['MySpace','getNumberOfRrackingAccessOverview'],
2846
-                ['MySpace','getUserDataAccessTrackingOverview'],
2845
+                ['MySpace', 'getNumberOfRrackingAccessOverview'],
2846
+                ['MySpace', 'getUserDataAccessTrackingOverview'],
2847 2847
                 0
2848 2848
             );
2849 2849
             $table->additional_parameters = $form->exportValues();
@@ -2904,7 +2904,7 @@  discard block
 block discarded – undo
2904 2904
                     " : "
2905 2905
                         u.lastname AS col2,
2906 2906
                         u.firstname AS col3,
2907
-                " ) . "
2907
+                " )."
2908 2908
                 a.logout_course_date,
2909 2909
                 c.title, 
2910 2910
                 c.code, 
@@ -2915,7 +2915,7 @@  discard block
 block discarded – undo
2915 2915
 
2916 2916
         if (isset($_GET['session_id']) && !empty($_GET['session_id'])) {
2917 2917
             $sessionId = intval($_GET['session_id']);
2918
-            $sql .= " WHERE a.session_id = " . $sessionId;
2918
+            $sql .= " WHERE a.session_id = ".$sessionId;
2919 2919
         }
2920 2920
 
2921 2921
         $sql .= " ORDER BY col$column $orderDirection ";
@@ -2976,14 +2976,14 @@  discard block
 block discarded – undo
2976 2976
 function get_stats($user_id, $courseId, $start_date = null, $end_date = null)
2977 2977
 {
2978 2978
     // Database table definitions
2979
-    $tbl_track_course   = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
2979
+    $tbl_track_course = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
2980 2980
 
2981 2981
     $course_info = api_get_course_info_by_id($courseId);
2982 2982
     if (!empty($course_info)) {
2983 2983
         $strg_sd    = "";
2984 2984
         $strg_ed    = "";
2985
-        if ($start_date != null && $end_date != null){
2986
-            $end_date = add_day_to( $end_date );
2985
+        if ($start_date != null && $end_date != null) {
2986
+            $end_date = add_day_to($end_date);
2987 2987
             $strg_sd = "AND login_course_date BETWEEN '$start_date' AND '$end_date'";
2988 2988
             $strg_ed = "AND logout_course_date BETWEEN '$start_date' AND '$end_date'";
2989 2989
         }
@@ -2991,10 +2991,10 @@  discard block
 block discarded – undo
2991 2991
                 SEC_TO_TIME(avg(time_to_sec(timediff(logout_course_date,login_course_date)))) as avrg,
2992 2992
                 SEC_TO_TIME(sum(time_to_sec(timediff(logout_course_date,login_course_date)))) as total,
2993 2993
                 count(user_id) as times
2994
-                FROM ' . $tbl_track_course . '
2994
+                FROM ' . $tbl_track_course.'
2995 2995
                 WHERE
2996
-                    user_id = ' . intval($user_id) . ' AND
2997
-                    c_id = ' . intval($courseId) . ' '.$strg_sd.' '.$strg_ed.' '.'
2996
+                    user_id = ' . intval($user_id).' AND
2997
+                    c_id = ' . intval($courseId).' '.$strg_sd.' '.$strg_ed.' '.'
2998 2998
                 ORDER BY login_course_date ASC';
2999 2999
 
3000 3000
         $rs = Database::query($sql);
@@ -3012,7 +3012,7 @@  discard block
 block discarded – undo
3012 3012
 }
3013 3013
 
3014 3014
 function add_day_to($end_date) {
3015
-    $foo_date = strtotime( $end_date );
3015
+    $foo_date = strtotime($end_date);
3016 3016
     $foo_date = strtotime(" +1 day", $foo_date);
3017 3017
     $foo_date = date("Y-m-d", $foo_date);
3018 3018
     return $foo_date;
@@ -3072,7 +3072,7 @@  discard block
 block discarded – undo
3072 3072
  * @version OCT-22- 2010
3073 3073
  * @return array
3074 3074
  */
3075
-function convert_to_array($sql_result){
3075
+function convert_to_array($sql_result) {
3076 3076
     $result_to_print = '<table>';
3077 3077
     foreach ($sql_result as $key => $data) {
3078 3078
         $result_to_print .= '<tr><td>'.date('d-m-Y (H:i:s)', $data['login']).'</td><td>'.api_time_to_hms($data['logout'] - $data['login']).'</tr></td>'."\n";
@@ -3091,7 +3091,7 @@  discard block
 block discarded – undo
3091 3091
  * @version OCT-22- 2010
3092 3092
  * @return string
3093 3093
  */
3094
-function convert_to_string($sql_result){
3094
+function convert_to_string($sql_result) {
3095 3095
     $result_to_print = '<table>';
3096 3096
     if (!empty($sql_result)) {
3097 3097
         foreach ($sql_result as $key => $data) {
@@ -3116,18 +3116,18 @@  discard block
 block discarded – undo
3116 3116
  */
3117 3117
 function grapher($sql_result, $start_date, $end_date, $type = "")
3118 3118
 {
3119
-    if (empty($start_date)) { $start_date =""; }
3120
-    if (empty($end_date)) { $end_date =""; }
3121
-    if ($type == ""){ $type = 'day'; }
3122
-    $main_year  = $main_month_year = $main_day = array();
3119
+    if (empty($start_date)) { $start_date = ""; }
3120
+    if (empty($end_date)) { $end_date = ""; }
3121
+    if ($type == "") { $type = 'day'; }
3122
+    $main_year = $main_month_year = $main_day = array();
3123 3123
     // get last 8 days/months
3124 3124
     $last_days      = 5;
3125 3125
     $last_months    = 3;
3126 3126
     for ($i = $last_days; $i >= 0; $i--) {
3127
-        $main_day[date ('d-m-Y', mktime () - $i * 3600 * 24)] = 0;
3127
+        $main_day[date('d-m-Y', mktime() - $i * 3600 * 24)] = 0;
3128 3128
     }
3129 3129
     for ($i = $last_months; $i >= 0; $i--) {
3130
-        $main_month_year[date ('m-Y', mktime () - $i * 30 * 3600 * 24)] = 0;
3130
+        $main_month_year[date('m-Y', mktime() - $i * 30 * 3600 * 24)] = 0;
3131 3131
     }
3132 3132
 
3133 3133
     $i = 0;
@@ -3163,7 +3163,7 @@  discard block
 block discarded – undo
3163 3163
         /* Create and populate the pData object */
3164 3164
         $myData = new pData();
3165 3165
         $myData->addPoints($main_date, 'Serie1');
3166
-        if (count($main_date)!= 1) {
3166
+        if (count($main_date) != 1) {
3167 3167
             $myData->addPoints($labels, 'Labels');
3168 3168
             $myData->setSerieDescription('Labels', 'Months');
3169 3169
             $myData->setAbscissa('Labels');
@@ -3171,7 +3171,7 @@  discard block
 block discarded – undo
3171 3171
         $myData->setSerieWeight('Serie1', 1);
3172 3172
         $myData->setSerieDescription('Serie1', get_lang('MyResults'));
3173 3173
         $myData->setAxisName(0, get_lang('Minutes'));
3174
-        $myData->loadPalette(api_get_path(SYS_CODE_PATH) . 'palettes/pchart/default.color', true);
3174
+        $myData->loadPalette(api_get_path(SYS_CODE_PATH).'palettes/pchart/default.color', true);
3175 3175
 
3176 3176
         // Cache definition
3177 3177
         $cachePath = api_get_path(SYS_ARCHIVE_PATH);
@@ -3180,9 +3180,9 @@  discard block
 block discarded – undo
3180 3180
 
3181 3181
         if ($myCache->isInCache($chartHash)) {
3182 3182
             //if we already created the img
3183
-            $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash;
3183
+            $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash;
3184 3184
             $myCache->saveFromCache($chartHash, $imgPath);
3185
-            $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash;
3185
+            $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash;
3186 3186
         } else {
3187 3187
             /* Define width, height and angle */
3188 3188
             $mainWidth = 760;
@@ -3211,7 +3211,7 @@  discard block
 block discarded – undo
3211 3211
             /* Set the default font */
3212 3212
             $myPicture->setFontProperties(
3213 3213
                 array(
3214
-                    "FontName" => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf',
3214
+                    "FontName" => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf',
3215 3215
                     "FontSize" => 10)
3216 3216
             );
3217 3217
             /* Write the chart title */
@@ -3228,7 +3228,7 @@  discard block
 block discarded – undo
3228 3228
             /* Set the default font */
3229 3229
             $myPicture->setFontProperties(
3230 3230
                 array(
3231
-                    "FontName" => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf',
3231
+                    "FontName" => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf',
3232 3232
                     "FontSize" => 8
3233 3233
                 )
3234 3234
             );
@@ -3270,7 +3270,7 @@  discard block
 block discarded – undo
3270 3270
             /* Draw the line chart */
3271 3271
             $myPicture->setFontProperties(
3272 3272
                 array(
3273
-                    "FontName" => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf',
3273
+                    "FontName" => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf',
3274 3274
                     "FontSize" => 10
3275 3275
                 )
3276 3276
             );
@@ -3289,15 +3289,15 @@  discard block
 block discarded – undo
3289 3289
 
3290 3290
             /* Write and save into cache */
3291 3291
             $myCache->writeToCache($chartHash, $myPicture);
3292
-            $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash;
3292
+            $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash;
3293 3293
             $myCache->saveFromCache($chartHash, $imgPath);
3294
-            $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash;
3294
+            $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash;
3295 3295
         }
3296
-        $html = '<img src="' . $imgPath . '">';
3296
+        $html = '<img src="'.$imgPath.'">';
3297 3297
 
3298 3298
         return $html;
3299 3299
     } else {
3300
-        $foo_img = api_convert_encoding('<div id="messages" class="warning-message">'.get_lang('GraphicNotAvailable').'</div>','UTF-8');
3300
+        $foo_img = api_convert_encoding('<div id="messages" class="warning-message">'.get_lang('GraphicNotAvailable').'</div>', 'UTF-8');
3301 3301
 
3302 3302
         return $foo_img;
3303 3303
     }
Please login to merge, or discard this patch.
main/inc/lib/security.lib.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
             $rel_path = '/'.$rel_path;
92 92
         }
93 93
         $abs_path = $current_path.$rel_path;
94
-        $true_path=str_replace("\\", '/', realpath($abs_path));
94
+        $true_path = str_replace("\\", '/', realpath($abs_path));
95 95
         $found = strpos($true_path.'/', $checker_path);
96 96
         if ($found === 0) {
97 97
             return true;
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
         }
322 322
 
323 323
         if ($user_status == COURSEMANAGERLOWSECURITY) {
324
-            return $var;  // No filtering.
324
+            return $var; // No filtering.
325 325
         }
326 326
 
327 327
         static $purifier = array();
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
             }
345 345
 
346 346
             // Shows _target attribute in anchors
347
-            $config->set('Attr.AllowedFrameTargets', array('_blank','_top','_self', '_parent'));
347
+            $config->set('Attr.AllowedFrameTargets', array('_blank', '_top', '_self', '_parent'));
348 348
 
349 349
             if ($user_status == STUDENT) {
350 350
                 global $allowed_html_student;
Please login to merge, or discard this patch.
main/inc/lib/wami-recorder/record_document.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@
 block discarded – undo
48 48
 // Do not use here check Fileinfo method because return: text/plain
49 49
 
50 50
 $dirBaseDocuments = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
51
-$saveDir = $dirBaseDocuments . $wamidir;
51
+$saveDir = $dirBaseDocuments.$wamidir;
52 52
 
53 53
 if (!is_dir($saveDir)) {
54 54
     DocumentManager::createDefaultAudioFolder($_course);
Please login to merge, or discard this patch.
main/inc/lib/access_url_edit_users_to_url_functions.lib.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -43,22 +43,22 @@
 block discarded – undo
43 43
                    ' WHERE (username LIKE "'.$needle.'%" '.
44 44
                    ' OR firstname LIKE "'.$needle.'%" '.
45 45
                    ' OR lastname LIKE "'.$needle.'%") '.
46
-                    $order_clause .
46
+                    $order_clause.
47 47
                    ' LIMIT 11';
48 48
 
49 49
             $rs = Database::query($sql);
50
-            $i=0;
50
+            $i = 0;
51 51
 
52 52
             while ($user = Database :: fetch_array($rs)) {
53 53
                 $i++;
54
-                if ($i<=10) {
54
+                if ($i <= 10) {
55 55
                     $return .= '<a href="javascript: void(0);" onclick="javascript: add_user_to_url(\''.addslashes($user['user_id']).'\',\''.api_get_person_name(addslashes($user['firstname']), addslashes($user['lastname'])).' ('.addslashes($user['username']).')'.'\')">'.api_get_person_name($user['firstname'], $user['lastname']).' ('.$user['username'].')</a><br />';
56 56
                 } else {
57 57
                     $return .= '...<br />';
58 58
                 }
59 59
             }
60 60
         }
61
-        $xajax_response -> addAssign('ajax_list_users','innerHTML',api_utf8_encode($return));
61
+        $xajax_response -> addAssign('ajax_list_users', 'innerHTML', api_utf8_encode($return));
62 62
         return $xajax_response;
63 63
     }
64 64
 }
Please login to merge, or discard this patch.
main/inc/lib/nusoap/class.xmlschema.php 1 patch
Spacing   +139 added lines, -139 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 * @version  $Id: class.xmlschema.php,v 1.53 2010/04/26 20:15:08 snichol Exp $
13 13
 * @access   public
14 14
 */
15
-class nusoap_xmlschema extends nusoap_base  {
15
+class nusoap_xmlschema extends nusoap_base {
16 16
 	
17 17
 	// files
18 18
 	var $schema = '';
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 	* @param	string $namespaces namespaces defined in enclosing XML
52 52
 	* @access   public
53 53
 	*/
54
-	function nusoap_xmlschema($schema='',$xml='',$namespaces=array()){
54
+	function nusoap_xmlschema($schema = '', $xml = '', $namespaces = array()) {
55 55
 		parent::nusoap_base();
56 56
 		$this->debug('nusoap_xmlschema class instantiated, inside constructor');
57 57
 		// files
@@ -63,13 +63,13 @@  discard block
 block discarded – undo
63 63
 		$this->namespaces = array_merge($this->namespaces, $namespaces);
64 64
 
65 65
 		// parse schema file
66
-		if($schema != ''){
66
+		if ($schema != '') {
67 67
 			$this->debug('initial schema file: '.$schema);
68 68
 			$this->parseFile($schema, 'schema');
69 69
 		}
70 70
 
71 71
 		// parse xml file
72
-		if($xml != ''){
72
+		if ($xml != '') {
73 73
 			$this->debug('initial xml file: '.$xml);
74 74
 			$this->parseFile($xml, 'xml');
75 75
 		}
@@ -84,18 +84,18 @@  discard block
 block discarded – undo
84 84
 	* @return boolean
85 85
     * @access public
86 86
     */
87
-	function parseFile($xml,$type){
87
+	function parseFile($xml, $type) {
88 88
 		// parse xml file
89
-		if($xml != ""){
90
-			$xmlStr = @join("",@file($xml));
91
-			if($xmlStr == ""){
89
+		if ($xml != "") {
90
+			$xmlStr = @join("", @file($xml));
91
+			if ($xmlStr == "") {
92 92
 				$msg = 'Error reading XML from '.$xml;
93 93
 				$this->setError($msg);
94 94
 				$this->debug($msg);
95 95
 			return false;
96 96
 			} else {
97 97
 				$this->debug("parsing $xml");
98
-				$this->parseString($xmlStr,$type);
98
+				$this->parseString($xmlStr, $type);
99 99
 				$this->debug("done parsing $xml");
100 100
 			return true;
101 101
 			}
@@ -110,9 +110,9 @@  discard block
 block discarded – undo
110 110
     * @param	string $type (schema|xml)
111 111
 	* @access   private
112 112
 	*/
113
-	function parseString($xml,$type){
113
+	function parseString($xml, $type) {
114 114
 		// parse xml string
115
-		if($xml != ""){
115
+		if ($xml != "") {
116 116
 
117 117
 	    	// Create an XML parser.
118 118
 	    	$this->parser = xml_parser_create();
@@ -123,28 +123,28 @@  discard block
 block discarded – undo
123 123
 	    	xml_set_object($this->parser, $this);
124 124
 
125 125
 	    	// Set the element handlers for the parser.
126
-			if($type == "schema"){
127
-		    	xml_set_element_handler($this->parser, 'schemaStartElement','schemaEndElement');
128
-		    	xml_set_character_data_handler($this->parser,'schemaCharacterData');
129
-			} elseif($type == "xml"){
130
-				xml_set_element_handler($this->parser, 'xmlStartElement','xmlEndElement');
131
-		    	xml_set_character_data_handler($this->parser,'xmlCharacterData');
126
+			if ($type == "schema") {
127
+		    	xml_set_element_handler($this->parser, 'schemaStartElement', 'schemaEndElement');
128
+		    	xml_set_character_data_handler($this->parser, 'schemaCharacterData');
129
+			} elseif ($type == "xml") {
130
+				xml_set_element_handler($this->parser, 'xmlStartElement', 'xmlEndElement');
131
+		    	xml_set_character_data_handler($this->parser, 'xmlCharacterData');
132 132
 			}
133 133
 
134 134
 		    // Parse the XML file.
135
-		    if(!xml_parse($this->parser,$xml,true)){
135
+		    if (!xml_parse($this->parser, $xml, true)) {
136 136
 			// Display an error message.
137 137
 				$errstr = sprintf('XML error parsing XML schema on line %d: %s',
138 138
 				xml_get_current_line_number($this->parser),
139 139
 				xml_error_string(xml_get_error_code($this->parser))
140 140
 				);
141 141
 				$this->debug($errstr);
142
-				$this->debug("XML payload:\n" . $xml);
142
+				$this->debug("XML payload:\n".$xml);
143 143
 				$this->setError($errstr);
144 144
 	    	}
145 145
             
146 146
 			xml_parser_free($this->parser);
147
-		} else{
147
+		} else {
148 148
 			$this->debug('no xml passed to parseString()!!');
149 149
 			$this->setError('no xml passed to parseString()!!');
150 150
 		}
@@ -160,9 +160,9 @@  discard block
 block discarded – undo
160 160
 	function CreateTypeName($ename) {
161 161
 		$scope = '';
162 162
 		for ($i = 0; $i < count($this->complexTypeStack); $i++) {
163
-			$scope .= $this->complexTypeStack[$i] . '_';
163
+			$scope .= $this->complexTypeStack[$i].'_';
164 164
 		}
165
-		return $scope . $ename . '_ContainedType';
165
+		return $scope.$ename.'_ContainedType';
166 166
 	}
167 167
 	
168 168
 	/**
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 		}
189 189
 
190 190
 		// get element prefix
191
-		if($prefix = $this->getPrefix($name)){
191
+		if ($prefix = $this->getPrefix($name)) {
192 192
 			// get unqualified name
193 193
 			$name = $this->getLocalPart($name);
194 194
 		} else {
@@ -196,31 +196,31 @@  discard block
 block discarded – undo
196 196
         }
197 197
 		
198 198
         // loop thru attributes, expanding, and registering namespace declarations
199
-        if(count($attrs) > 0){
200
-        	foreach($attrs as $k => $v){
199
+        if (count($attrs) > 0) {
200
+        	foreach ($attrs as $k => $v) {
201 201
                 // if ns declarations, add to class level array of valid namespaces
202
-				if(preg_match('/^xmlns/',$k)){
202
+				if (preg_match('/^xmlns/', $k)) {
203 203
                 	//$this->xdebug("$k: $v");
204 204
                 	//$this->xdebug('ns_prefix: '.$this->getPrefix($k));
205
-                	if($ns_prefix = substr(strrchr($k,':'),1)){
205
+                	if ($ns_prefix = substr(strrchr($k, ':'), 1)) {
206 206
                 		//$this->xdebug("Add namespace[$ns_prefix] = $v");
207 207
 						$this->namespaces[$ns_prefix] = $v;
208 208
 					} else {
209 209
 						$this->defaultNamespace[$pos] = $v;
210
-						if (! $this->getPrefixFromNamespace($v)) {
211
-							$this->namespaces['ns'.(count($this->namespaces)+1)] = $v;
210
+						if (!$this->getPrefixFromNamespace($v)) {
211
+							$this->namespaces['ns'.(count($this->namespaces) + 1)] = $v;
212 212
 						}
213 213
 					}
214
-					if($v == 'http://www.w3.org/2001/XMLSchema' || $v == 'http://www.w3.org/1999/XMLSchema' || $v == 'http://www.w3.org/2000/10/XMLSchema'){
214
+					if ($v == 'http://www.w3.org/2001/XMLSchema' || $v == 'http://www.w3.org/1999/XMLSchema' || $v == 'http://www.w3.org/2000/10/XMLSchema') {
215 215
 						$this->XMLSchemaVersion = $v;
216 216
 						$this->namespaces['xsi'] = $v.'-instance';
217 217
 					}
218 218
 				}
219 219
         	}
220
-        	foreach($attrs as $k => $v){
220
+        	foreach ($attrs as $k => $v) {
221 221
                 // expand each attribute
222
-                $k = strpos($k,':') ? $this->expandQname($k) : $k;
223
-                $v = strpos($v,':') ? $this->expandQname($v) : $v;
222
+                $k = strpos($k, ':') ? $this->expandQname($k) : $k;
223
+                $v = strpos($v, ':') ? $this->expandQname($v) : $v;
224 224
         		$eAttrs[$k] = $v;
225 225
         	}
226 226
         	$attrs = $eAttrs;
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
         	$attrs = array();
229 229
         }
230 230
 		// find status, register data
231
-		switch($name){
231
+		switch ($name) {
232 232
 			case 'all':			// (optional) compositor content for a complexType
233 233
 			case 'choice':
234 234
 			case 'group':
@@ -253,41 +253,41 @@  discard block
 block discarded – undo
253 253
 						// no namespace in arrayType attribute value...
254 254
 						if ($this->defaultNamespace[$pos]) {
255 255
 							// ...so use the default
256
-							$attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'] = $this->defaultNamespace[$pos] . ':' . $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'];
256
+							$attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'] = $this->defaultNamespace[$pos].':'.$attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'];
257 257
 						}
258 258
 					}
259 259
             	}
260
-                if(isset($attrs['name'])){
260
+                if (isset($attrs['name'])) {
261 261
 					$this->attributes[$attrs['name']] = $attrs;
262 262
 					$aname = $attrs['name'];
263
-				} elseif(isset($attrs['ref']) && $attrs['ref'] == 'http://schemas.xmlsoap.org/soap/encoding/:arrayType'){
263
+				} elseif (isset($attrs['ref']) && $attrs['ref'] == 'http://schemas.xmlsoap.org/soap/encoding/:arrayType') {
264 264
 					if (isset($attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'])) {
265 265
 	                	$aname = $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'];
266 266
 	                } else {
267 267
 	                	$aname = '';
268 268
 	                }
269
-				} elseif(isset($attrs['ref'])){
269
+				} elseif (isset($attrs['ref'])) {
270 270
 					$aname = $attrs['ref'];
271 271
                     $this->attributes[$attrs['ref']] = $attrs;
272 272
 				}
273 273
                 
274
-				if($this->currentComplexType){	// This should *always* be
274
+				if ($this->currentComplexType) {	// This should *always* be
275 275
 					$this->complexTypes[$this->currentComplexType]['attrs'][$aname] = $attrs;
276 276
 				}
277 277
 				// arrayType attribute
278
-				if(isset($attrs['http://schemas.xmlsoap.org/wsdl/:arrayType']) || $this->getLocalPart($aname) == 'arrayType'){
278
+				if (isset($attrs['http://schemas.xmlsoap.org/wsdl/:arrayType']) || $this->getLocalPart($aname) == 'arrayType') {
279 279
 					$this->complexTypes[$this->currentComplexType]['phpType'] = 'array';
280 280
                 	$prefix = $this->getPrefix($aname);
281
-					if(isset($attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'])){
281
+					if (isset($attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'])) {
282 282
 						$v = $attrs['http://schemas.xmlsoap.org/wsdl/:arrayType'];
283 283
 					} else {
284 284
 						$v = '';
285 285
 					}
286
-                    if(strpos($v,'[,]')){
286
+                    if (strpos($v, '[,]')) {
287 287
                         $this->complexTypes[$this->currentComplexType]['multidimensional'] = true;
288 288
                     }
289
-                    $v = substr($v,0,strpos($v,'[')); // clip the []
290
-                    if(!strpos($v,':') && isset($this->typemap[$this->XMLSchemaVersion][$v])){
289
+                    $v = substr($v, 0, strpos($v, '[')); // clip the []
290
+                    if (!strpos($v, ':') && isset($this->typemap[$this->XMLSchemaVersion][$v])) {
291 291
                         $v = $this->XMLSchemaVersion.':'.$v;
292 292
                     }
293 293
                     $this->complexTypes[$this->currentComplexType]['arrayType'] = $v;
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
 			break;
299 299
 			case 'complexType':
300 300
 				array_push($this->complexTypeStack, $this->currentComplexType);
301
-				if(isset($attrs['name'])){
301
+				if (isset($attrs['name'])) {
302 302
 					// TODO: what is the scope of named complexTypes that appear
303 303
 					//       nested within other c complexTypes?
304 304
 					$this->xdebug('processing named complexType '.$attrs['name']);
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 					//                        minOccurs="0" maxOccurs="unbounded" />
314 314
 					//                </sequence>
315 315
 					//            </complexType>
316
-					if(isset($attrs['base']) && preg_match('/:Array$/',$attrs['base'])){
316
+					if (isset($attrs['base']) && preg_match('/:Array$/', $attrs['base'])) {
317 317
 						$this->xdebug('complexType is unusual array');
318 318
 						$this->complexTypes[$this->currentComplexType]['phpType'] = 'array';
319 319
 					} else {
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
 					}
322 322
 				} else {
323 323
 					$name = $this->CreateTypeName($this->currentElement);
324
-					$this->xdebug('processing unnamed complexType for element ' . $this->currentElement . ' named ' . $name);
324
+					$this->xdebug('processing unnamed complexType for element '.$this->currentElement.' named '.$name);
325 325
 					$this->currentComplexType = $name;
326 326
 					//$this->currentElement = false;
327 327
 					$this->complexTypes[$this->currentComplexType] = $attrs;
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
 					//                        minOccurs="0" maxOccurs="unbounded" />
334 334
 					//                </sequence>
335 335
 					//            </complexType>
336
-					if(isset($attrs['base']) && preg_match('/:Array$/',$attrs['base'])){
336
+					if (isset($attrs['base']) && preg_match('/:Array$/', $attrs['base'])) {
337 337
 						$this->xdebug('complexType is unusual array');
338 338
 						$this->complexTypes[$this->currentComplexType]['phpType'] = 'array';
339 339
 					} else {
@@ -352,12 +352,12 @@  discard block
 block discarded – undo
352 352
 						$attrs['form'] = 'qualified';
353 353
 					}
354 354
 				}
355
-				if(isset($attrs['type'])){
355
+				if (isset($attrs['type'])) {
356 356
 					$this->xdebug("processing typed element ".$attrs['name']." of type ".$attrs['type']);
357
-					if (! $this->getPrefix($attrs['type'])) {
357
+					if (!$this->getPrefix($attrs['type'])) {
358 358
 						if ($this->defaultNamespace[$pos]) {
359
-							$attrs['type'] = $this->defaultNamespace[$pos] . ':' . $attrs['type'];
360
-							$this->xdebug('used default namespace to make type ' . $attrs['type']);
359
+							$attrs['type'] = $this->defaultNamespace[$pos].':'.$attrs['type'];
360
+							$this->xdebug('used default namespace to make type '.$attrs['type']);
361 361
 						}
362 362
 					}
363 363
 					// This is for constructs like
@@ -368,20 +368,20 @@  discard block
 block discarded – undo
368 368
 					//                </sequence>
369 369
 					//            </complexType>
370 370
 					if ($this->currentComplexType && $this->complexTypes[$this->currentComplexType]['phpType'] == 'array') {
371
-						$this->xdebug('arrayType for unusual array is ' . $attrs['type']);
371
+						$this->xdebug('arrayType for unusual array is '.$attrs['type']);
372 372
 						$this->complexTypes[$this->currentComplexType]['arrayType'] = $attrs['type'];
373 373
 					}
374 374
 					$this->currentElement = $attrs['name'];
375 375
 					$ename = $attrs['name'];
376
-				} elseif(isset($attrs['ref'])){
376
+				} elseif (isset($attrs['ref'])) {
377 377
 					$this->xdebug("processing element as ref to ".$attrs['ref']);
378 378
 					$this->currentElement = "ref to ".$attrs['ref'];
379 379
 					$ename = $this->getLocalPart($attrs['ref']);
380 380
 				} else {
381
-					$type = $this->CreateTypeName($this->currentComplexType . '_' . $attrs['name']);
382
-					$this->xdebug("processing untyped element " . $attrs['name'] . ' type ' . $type);
381
+					$type = $this->CreateTypeName($this->currentComplexType.'_'.$attrs['name']);
382
+					$this->xdebug("processing untyped element ".$attrs['name'].' type '.$type);
383 383
 					$this->currentElement = $attrs['name'];
384
-					$attrs['type'] = $this->schemaTargetNamespace . ':' . $type;
384
+					$attrs['type'] = $this->schemaTargetNamespace.':'.$type;
385 385
 					$ename = $attrs['name'];
386 386
 				}
387 387
 				if (isset($ename) && $this->currentComplexType) {
@@ -389,12 +389,12 @@  discard block
 block discarded – undo
389 389
 					$this->complexTypes[$this->currentComplexType]['elements'][$ename] = $attrs;
390 390
 				} elseif (!isset($attrs['ref'])) {
391 391
 					$this->xdebug("add element $ename to elements array");
392
-					$this->elements[ $attrs['name'] ] = $attrs;
393
-					$this->elements[ $attrs['name'] ]['typeClass'] = 'element';
392
+					$this->elements[$attrs['name']] = $attrs;
393
+					$this->elements[$attrs['name']]['typeClass'] = 'element';
394 394
 				}
395 395
 			break;
396 396
 			case 'enumeration':	//	restriction value list member
397
-				$this->xdebug('enumeration ' . $attrs['value']);
397
+				$this->xdebug('enumeration '.$attrs['value']);
398 398
 				if ($this->currentSimpleType) {
399 399
 					$this->simpleTypes[$this->currentSimpleType]['enumeration'][] = $attrs['value'];
400 400
 				} elseif ($this->currentComplexType) {
@@ -402,11 +402,11 @@  discard block
 block discarded – undo
402 402
 				}
403 403
 			break;
404 404
 			case 'extension':	// simpleContent or complexContent type extension
405
-				$this->xdebug('extension ' . $attrs['base']);
405
+				$this->xdebug('extension '.$attrs['base']);
406 406
 				if ($this->currentComplexType) {
407 407
 					$ns = $this->getPrefix($attrs['base']);
408 408
 					if ($ns == '') {
409
-						$this->complexTypes[$this->currentComplexType]['extensionBase'] = $this->schemaTargetNamespace . ':' . $attrs['base'];
409
+						$this->complexTypes[$this->currentComplexType]['extensionBase'] = $this->schemaTargetNamespace.':'.$attrs['base'];
410 410
 					} else {
411 411
 						$this->complexTypes[$this->currentComplexType]['extensionBase'] = $attrs['base'];
412 412
 					}
@@ -416,19 +416,19 @@  discard block
 block discarded – undo
416 416
 			break;
417 417
 			case 'import':
418 418
 			    if (isset($attrs['schemaLocation'])) {
419
-					$this->xdebug('import namespace ' . $attrs['namespace'] . ' from ' . $attrs['schemaLocation']);
419
+					$this->xdebug('import namespace '.$attrs['namespace'].' from '.$attrs['schemaLocation']);
420 420
                     $this->imports[$attrs['namespace']][] = array('location' => $attrs['schemaLocation'], 'loaded' => false);
421 421
 				} else {
422
-					$this->xdebug('import namespace ' . $attrs['namespace']);
422
+					$this->xdebug('import namespace '.$attrs['namespace']);
423 423
                     $this->imports[$attrs['namespace']][] = array('location' => '', 'loaded' => true);
424
-					if (! $this->getPrefixFromNamespace($attrs['namespace'])) {
425
-						$this->namespaces['ns'.(count($this->namespaces)+1)] = $attrs['namespace'];
424
+					if (!$this->getPrefixFromNamespace($attrs['namespace'])) {
425
+						$this->namespaces['ns'.(count($this->namespaces) + 1)] = $attrs['namespace'];
426 426
 					}
427 427
 				}
428 428
 			break;
429 429
 			case 'include':
430 430
 			    if (isset($attrs['schemaLocation'])) {
431
-					$this->xdebug('include into namespace ' . $this->schemaTargetNamespace . ' from ' . $attrs['schemaLocation']);
431
+					$this->xdebug('include into namespace '.$this->schemaTargetNamespace.' from '.$attrs['schemaLocation']);
432 432
                     $this->imports[$this->schemaTargetNamespace][] = array('location' => $attrs['schemaLocation'], 'loaded' => false);
433 433
 				} else {
434 434
 					$this->xdebug('ignoring invalid XML Schema construct: include without schemaLocation attribute');
@@ -438,12 +438,12 @@  discard block
 block discarded – undo
438 438
 				$this->xdebug("do nothing for element $name");
439 439
 			break;
440 440
 			case 'restriction':	// simpleType, simpleContent or complexContent value restriction
441
-				$this->xdebug('restriction ' . $attrs['base']);
442
-				if($this->currentSimpleType){
441
+				$this->xdebug('restriction '.$attrs['base']);
442
+				if ($this->currentSimpleType) {
443 443
 					$this->simpleTypes[$this->currentSimpleType]['type'] = $attrs['base'];
444
-				} elseif($this->currentComplexType){
444
+				} elseif ($this->currentComplexType) {
445 445
 					$this->complexTypes[$this->currentComplexType]['restrictionBase'] = $attrs['base'];
446
-					if(strstr($attrs['base'],':') == ':Array'){
446
+					if (strstr($attrs['base'], ':') == ':Array') {
447 447
 						$this->complexTypes[$this->currentComplexType]['phpType'] = 'array';
448 448
 					}
449 449
 				}
@@ -470,15 +470,15 @@  discard block
 block discarded – undo
470 470
 			break;
471 471
 			case 'simpleType':
472 472
 				array_push($this->simpleTypeStack, $this->currentSimpleType);
473
-				if(isset($attrs['name'])){
474
-					$this->xdebug("processing simpleType for name " . $attrs['name']);
473
+				if (isset($attrs['name'])) {
474
+					$this->xdebug("processing simpleType for name ".$attrs['name']);
475 475
 					$this->currentSimpleType = $attrs['name'];
476
-					$this->simpleTypes[ $attrs['name'] ] = $attrs;
477
-					$this->simpleTypes[ $attrs['name'] ]['typeClass'] = 'simpleType';
478
-					$this->simpleTypes[ $attrs['name'] ]['phpType'] = 'scalar';
476
+					$this->simpleTypes[$attrs['name']] = $attrs;
477
+					$this->simpleTypes[$attrs['name']]['typeClass'] = 'simpleType';
478
+					$this->simpleTypes[$attrs['name']]['phpType'] = 'scalar';
479 479
 				} else {
480
-					$name = $this->CreateTypeName($this->currentComplexType . '_' . $this->currentElement);
481
-					$this->xdebug('processing unnamed simpleType for element ' . $this->currentElement . ' named ' . $name);
480
+					$name = $this->CreateTypeName($this->currentComplexType.'_'.$this->currentElement);
481
+					$this->xdebug('processing unnamed simpleType for element '.$this->currentElement.' named '.$name);
482 482
 					$this->currentSimpleType = $name;
483 483
 					//$this->currentElement = false;
484 484
 					$this->simpleTypes[$this->currentSimpleType] = $attrs;
@@ -504,29 +504,29 @@  discard block
 block discarded – undo
504 504
 		// bring depth down a notch
505 505
 		$this->depth--;
506 506
 		// position of current element is equal to the last value left in depth_array for my depth
507
-		if(isset($this->depth_array[$this->depth])){
507
+		if (isset($this->depth_array[$this->depth])) {
508 508
         	$pos = $this->depth_array[$this->depth];
509 509
         }
510 510
 		// get element prefix
511
-		if ($prefix = $this->getPrefix($name)){
511
+		if ($prefix = $this->getPrefix($name)) {
512 512
 			// get unqualified name
513 513
 			$name = $this->getLocalPart($name);
514 514
 		} else {
515 515
         	$prefix = '';
516 516
         }
517 517
 		// move on...
518
-		if($name == 'complexType'){
519
-			$this->xdebug('done processing complexType ' . ($this->currentComplexType ? $this->currentComplexType : '(unknown)'));
518
+		if ($name == 'complexType') {
519
+			$this->xdebug('done processing complexType '.($this->currentComplexType ? $this->currentComplexType : '(unknown)'));
520 520
 			$this->xdebug($this->varDump($this->complexTypes[$this->currentComplexType]));
521 521
 			$this->currentComplexType = array_pop($this->complexTypeStack);
522 522
 			//$this->currentElement = false;
523 523
 		}
524
-		if($name == 'element'){
525
-			$this->xdebug('done processing element ' . ($this->currentElement ? $this->currentElement : '(unknown)'));
524
+		if ($name == 'element') {
525
+			$this->xdebug('done processing element '.($this->currentElement ? $this->currentElement : '(unknown)'));
526 526
 			$this->currentElement = array_pop($this->elementStack);
527 527
 		}
528
-		if($name == 'simpleType'){
529
-			$this->xdebug('done processing simpleType ' . ($this->currentSimpleType ? $this->currentSimpleType : '(unknown)'));
528
+		if ($name == 'simpleType') {
529
+			$this->xdebug('done processing simpleType '.($this->currentSimpleType ? $this->currentSimpleType : '(unknown)'));
530 530
 			$this->xdebug($this->varDump($this->simpleTypes[$this->currentSimpleType]));
531 531
 			$this->currentSimpleType = array_pop($this->simpleTypeStack);
532 532
 		}
@@ -539,7 +539,7 @@  discard block
 block discarded – undo
539 539
 	* @param    string $data element content
540 540
 	* @access   private
541 541
 	*/
542
-	function schemaCharacterData($parser, $data){
542
+	function schemaCharacterData($parser, $data) {
543 543
 		$pos = $this->depth_array[$this->depth - 1];
544 544
 		$this->message[$pos]['cdata'] .= $data;
545 545
 	}
@@ -549,32 +549,32 @@  discard block
 block discarded – undo
549 549
 	*
550 550
 	* @access   public
551 551
 	*/
552
-	function serializeSchema(){
552
+	function serializeSchema() {
553 553
 
554 554
 		$schemaPrefix = $this->getPrefixFromNamespace($this->XMLSchemaVersion);
555 555
 		$xml = '';
556 556
 		// imports
557 557
 		if (sizeof($this->imports) > 0) {
558
-			foreach($this->imports as $ns => $list) {
558
+			foreach ($this->imports as $ns => $list) {
559 559
 				foreach ($list as $ii) {
560 560
 					if ($ii['location'] != '') {
561
-						$xml .= " <$schemaPrefix:import location=\"" . $ii['location'] . '" namespace="' . $ns . "\" />\n";
561
+						$xml .= " <$schemaPrefix:import location=\"".$ii['location'].'" namespace="'.$ns."\" />\n";
562 562
 					} else {
563
-						$xml .= " <$schemaPrefix:import namespace=\"" . $ns . "\" />\n";
563
+						$xml .= " <$schemaPrefix:import namespace=\"".$ns."\" />\n";
564 564
 					}
565 565
 				}
566 566
 			} 
567 567
 		} 
568 568
 		// complex types
569
-		foreach($this->complexTypes as $typeName => $attrs){
569
+		foreach ($this->complexTypes as $typeName => $attrs) {
570 570
 			$contentStr = '';
571 571
 			// serialize child elements
572
-			if(isset($attrs['elements']) && (count($attrs['elements']) > 0)){
573
-				foreach($attrs['elements'] as $element => $eParts){
574
-					if(isset($eParts['ref'])){
572
+			if (isset($attrs['elements']) && (count($attrs['elements']) > 0)) {
573
+				foreach ($attrs['elements'] as $element => $eParts) {
574
+					if (isset($eParts['ref'])) {
575 575
 						$contentStr .= "   <$schemaPrefix:element ref=\"$element\"/>\n";
576 576
 					} else {
577
-						$contentStr .= "   <$schemaPrefix:element name=\"$element\" type=\"" . $this->contractQName($eParts['type']) . "\"";
577
+						$contentStr .= "   <$schemaPrefix:element name=\"$element\" type=\"".$this->contractQName($eParts['type'])."\"";
578 578
 						foreach ($eParts as $aName => $aValue) {
579 579
 							// handle, e.g., abstract, default, form, minOccurs, maxOccurs, nillable
580 580
 							if ($aName != 'name' && $aName != 'type') {
@@ -590,8 +590,8 @@  discard block
 block discarded – undo
590 590
 				}
591 591
 			}
592 592
 			// attributes
593
-			if(isset($attrs['attrs']) && (count($attrs['attrs']) >= 1)){
594
-				foreach($attrs['attrs'] as $attr => $aParts){
593
+			if (isset($attrs['attrs']) && (count($attrs['attrs']) >= 1)) {
594
+				foreach ($attrs['attrs'] as $attr => $aParts) {
595 595
 					$contentStr .= "    <$schemaPrefix:attribute";
596 596
 					foreach ($aParts as $a => $v) {
597 597
 						if ($a == 'ref' || $a == 'type') {
@@ -607,15 +607,15 @@  discard block
 block discarded – undo
607 607
 				}
608 608
 			}
609 609
 			// if restriction
610
-			if (isset($attrs['restrictionBase']) && $attrs['restrictionBase'] != ''){
610
+			if (isset($attrs['restrictionBase']) && $attrs['restrictionBase'] != '') {
611 611
 				$contentStr = "   <$schemaPrefix:restriction base=\"".$this->contractQName($attrs['restrictionBase'])."\">\n".$contentStr."   </$schemaPrefix:restriction>\n";
612 612
 				// complex or simple content
613
-				if ((isset($attrs['elements']) && count($attrs['elements']) > 0) || (isset($attrs['attrs']) && count($attrs['attrs']) > 0)){
613
+				if ((isset($attrs['elements']) && count($attrs['elements']) > 0) || (isset($attrs['attrs']) && count($attrs['attrs']) > 0)) {
614 614
 					$contentStr = "  <$schemaPrefix:complexContent>\n".$contentStr."  </$schemaPrefix:complexContent>\n";
615 615
 				}
616 616
 			}
617 617
 			// finalize complex type
618
-			if($contentStr != ''){
618
+			if ($contentStr != '') {
619 619
 				$contentStr = " <$schemaPrefix:complexType name=\"$typeName\">\n".$contentStr." </$schemaPrefix:complexType>\n";
620 620
 			} else {
621 621
 				$contentStr = " <$schemaPrefix:complexType name=\"$typeName\"/>\n";
@@ -623,8 +623,8 @@  discard block
 block discarded – undo
623 623
 			$xml .= $contentStr;
624 624
 		}
625 625
 		// simple types
626
-		if(isset($this->simpleTypes) && count($this->simpleTypes) > 0){
627
-			foreach($this->simpleTypes as $typeName => $eParts){
626
+		if (isset($this->simpleTypes) && count($this->simpleTypes) > 0) {
627
+			foreach ($this->simpleTypes as $typeName => $eParts) {
628 628
 				$xml .= " <$schemaPrefix:simpleType name=\"$typeName\">\n  <$schemaPrefix:restriction base=\"".$this->contractQName($eParts['type'])."\">\n";
629 629
 				if (isset($eParts['enumeration'])) {
630 630
 					foreach ($eParts['enumeration'] as $e) {
@@ -635,14 +635,14 @@  discard block
 block discarded – undo
635 635
 			}
636 636
 		}
637 637
 		// elements
638
-		if(isset($this->elements) && count($this->elements) > 0){
639
-			foreach($this->elements as $element => $eParts){
638
+		if (isset($this->elements) && count($this->elements) > 0) {
639
+			foreach ($this->elements as $element => $eParts) {
640 640
 				$xml .= " <$schemaPrefix:element name=\"$element\" type=\"".$this->contractQName($eParts['type'])."\"/>\n";
641 641
 			}
642 642
 		}
643 643
 		// attributes
644
-		if(isset($this->attributes) && count($this->attributes) > 0){
645
-			foreach($this->attributes as $attr => $aParts){
644
+		if (isset($this->attributes) && count($this->attributes) > 0) {
645
+			foreach ($this->attributes as $attr => $aParts) {
646 646
 				$xml .= " <$schemaPrefix:attribute name=\"$attr\" type=\"".$this->contractQName($aParts['type'])."\"\n/>";
647 647
 			}
648 648
 		}
@@ -657,7 +657,7 @@  discard block
 block discarded – undo
657 657
 		foreach (array_diff($this->usedNamespaces, $this->enclosingNamespaces) as $nsp => $ns) {
658 658
 			$el .= " xmlns:$nsp=\"$ns\"";
659 659
 		}
660
-		$xml = $el . ">\n".$xml."</$schemaPrefix:schema>\n";
660
+		$xml = $el.">\n".$xml."</$schemaPrefix:schema>\n";
661 661
 		return $xml;
662 662
 	}
663 663
 
@@ -667,8 +667,8 @@  discard block
 block discarded – undo
667 667
 	* @param    string $string debug data
668 668
 	* @access   private
669 669
 	*/
670
-	function xdebug($string){
671
-		$this->debug('<' . $this->schemaTargetNamespace . '> '.$string);
670
+	function xdebug($string) {
671
+		$this->debug('<'.$this->schemaTargetNamespace.'> '.$string);
672 672
 	}
673 673
 
674 674
     /**
@@ -683,11 +683,11 @@  discard block
 block discarded – undo
683 683
     * @access public
684 684
     * @deprecated
685 685
     */
686
-	function getPHPType($type,$ns){
687
-		if(isset($this->typemap[$ns][$type])){
686
+	function getPHPType($type, $ns) {
687
+		if (isset($this->typemap[$ns][$type])) {
688 688
 			//print "found type '$type' and ns $ns in typemap<br>";
689 689
 			return $this->typemap[$ns][$type];
690
-		} elseif(isset($this->complexTypes[$type])){
690
+		} elseif (isset($this->complexTypes[$type])) {
691 691
 			//print "getting type '$type' and ns $ns from complexTypes array<br>";
692 692
 			return $this->complexTypes[$type]['phpType'];
693 693
 		}
@@ -716,7 +716,7 @@  discard block
 block discarded – undo
716 716
     * @see addSimpleType
717 717
     * @see addElement
718 718
     */
719
-	function getTypeDef($type){
719
+	function getTypeDef($type) {
720 720
 		//$this->debug("in getTypeDef for type $type");
721 721
 		if (substr($type, -1) == '^') {
722 722
 			$is_element = 1;
@@ -725,10 +725,10 @@  discard block
 block discarded – undo
725 725
 			$is_element = 0;
726 726
 		}
727 727
 
728
-		if((! $is_element) && isset($this->complexTypes[$type])){
728
+		if ((!$is_element) && isset($this->complexTypes[$type])) {
729 729
 			$this->xdebug("in getTypeDef, found complexType $type");
730 730
 			return $this->complexTypes[$type];
731
-		} elseif((! $is_element) && isset($this->simpleTypes[$type])){
731
+		} elseif ((!$is_element) && isset($this->simpleTypes[$type])) {
732 732
 			$this->xdebug("in getTypeDef, found simpleType $type");
733 733
 			if (!isset($this->simpleTypes[$type]['phpType'])) {
734 734
 				// get info for type to tack onto the simple type
@@ -748,7 +748,7 @@  discard block
 block discarded – undo
748 748
 				}
749 749
 			}
750 750
 			return $this->simpleTypes[$type];
751
-		} elseif(isset($this->elements[$type])){
751
+		} elseif (isset($this->elements[$type])) {
752 752
 			$this->xdebug("in getTypeDef, found element $type");
753 753
 			if (!isset($this->elements[$type]['phpType'])) {
754 754
 				// get info for type to tack onto the element
@@ -773,7 +773,7 @@  discard block
 block discarded – undo
773 773
 				}
774 774
 			}
775 775
 			return $this->elements[$type];
776
-		} elseif(isset($this->attributes[$type])){
776
+		} elseif (isset($this->attributes[$type])) {
777 777
 			$this->xdebug("in getTypeDef, found attribute $type");
778 778
 			return $this->attributes[$type];
779 779
 		} elseif (preg_match('/_ContainedType$/', $type)) {
@@ -795,23 +795,23 @@  discard block
 block discarded – undo
795 795
     * @access public
796 796
     * @deprecated
797 797
     */
798
-    function serializeTypeDef($type){
798
+    function serializeTypeDef($type) {
799 799
     	//print "in sTD() for type $type<br>";
800
-	if($typeDef = $this->getTypeDef($type)){
800
+	if ($typeDef = $this->getTypeDef($type)) {
801 801
 		$str .= '<'.$type;
802
-	    if(is_array($typeDef['attrs'])){
803
-		foreach($typeDef['attrs'] as $attName => $data){
802
+	    if (is_array($typeDef['attrs'])) {
803
+		foreach ($typeDef['attrs'] as $attName => $data) {
804 804
 		    $str .= " $attName=\"{type = ".$data['type']."}\"";
805 805
 		}
806 806
 	    }
807 807
 	    $str .= " xmlns=\"".$this->schema['targetNamespace']."\"";
808
-	    if(count($typeDef['elements']) > 0){
808
+	    if (count($typeDef['elements']) > 0) {
809 809
 		$str .= ">";
810
-		foreach($typeDef['elements'] as $element => $eData){
810
+		foreach ($typeDef['elements'] as $element => $eData) {
811 811
 		    $str .= $this->serializeTypeDef($element);
812 812
 		}
813 813
 		$str .= "</$type>";
814
-	    } elseif($typeDef['typeClass'] == 'element') {
814
+	    } elseif ($typeDef['typeClass'] == 'element') {
815 815
 		$str .= "></$type>";
816 816
 	    } else {
817 817
 		$str .= "/>";
@@ -831,22 +831,22 @@  discard block
 block discarded – undo
831 831
     * @access public
832 832
     * @deprecated
833 833
 	*/
834
-	function typeToForm($name,$type){
834
+	function typeToForm($name, $type) {
835 835
 		// get typedef
836
-		if($typeDef = $this->getTypeDef($type)){
836
+		if ($typeDef = $this->getTypeDef($type)) {
837 837
 			// if struct
838
-			if($typeDef['phpType'] == 'struct'){
838
+			if ($typeDef['phpType'] == 'struct') {
839 839
 				$buffer .= '<table>';
840
-				foreach($typeDef['elements'] as $child => $childDef){
840
+				foreach ($typeDef['elements'] as $child => $childDef) {
841 841
 					$buffer .= "
842 842
 					<tr><td align='right'>$childDef[name] (type: ".$this->getLocalPart($childDef['type'])."):</td>
843 843
 					<td><input type='text' name='parameters[".$name."][$childDef[name]]'></td></tr>";
844 844
 				}
845 845
 				$buffer .= '</table>';
846 846
 			// if array
847
-			} elseif($typeDef['phpType'] == 'array'){
847
+			} elseif ($typeDef['phpType'] == 'array') {
848 848
 				$buffer .= '<table>';
849
-				for($i=0;$i < 3; $i++){
849
+				for ($i = 0; $i < 3; $i++) {
850 850
 					$buffer .= "
851 851
 					<tr><td align='right'>array item (type: $typeDef[arrayType]):</td>
852 852
 					<td><input type='text' name='parameters[".$name."][]'></td></tr>";
@@ -903,7 +903,7 @@  discard block
 block discarded – undo
903 903
 	* @access public
904 904
 	* @see getTypeDef
905 905
 	*/
906
-	function addComplexType($name,$typeClass='complexType',$phpType='array',$compositor='',$restrictionBase='',$elements=array(),$attrs=array(),$arrayType=''){
906
+	function addComplexType($name, $typeClass = 'complexType', $phpType = 'array', $compositor = '', $restrictionBase = '', $elements = array(), $attrs = array(), $arrayType = '') {
907 907
 		$this->complexTypes[$name] = array(
908 908
 	    'name'		=> $name,
909 909
 	    'typeClass'	=> $typeClass,
@@ -931,7 +931,7 @@  discard block
 block discarded – undo
931 931
 	* @see nusoap_xmlschema
932 932
 	* @see getTypeDef
933 933
 	*/
934
-	function addSimpleType($name, $restrictionBase='', $typeClass='simpleType', $phpType='scalar', $enumeration=array()) {
934
+	function addSimpleType($name, $restrictionBase = '', $typeClass = 'simpleType', $phpType = 'scalar', $enumeration = array()) {
935 935
 		$this->simpleTypes[$name] = array(
936 936
 	    'name'			=> $name,
937 937
 	    'typeClass'		=> $typeClass,
@@ -952,14 +952,14 @@  discard block
 block discarded – undo
952 952
 	* @access public
953 953
 	*/
954 954
 	function addElement($attrs) {
955
-		if (! $this->getPrefix($attrs['type'])) {
956
-			$attrs['type'] = $this->schemaTargetNamespace . ':' . $attrs['type'];
955
+		if (!$this->getPrefix($attrs['type'])) {
956
+			$attrs['type'] = $this->schemaTargetNamespace.':'.$attrs['type'];
957 957
 		}
958
-		$this->elements[ $attrs['name'] ] = $attrs;
959
-		$this->elements[ $attrs['name'] ]['typeClass'] = 'element';
958
+		$this->elements[$attrs['name']] = $attrs;
959
+		$this->elements[$attrs['name']]['typeClass'] = 'element';
960 960
 		
961
-		$this->xdebug("addElement " . $attrs['name']);
962
-		$this->appendDebug($this->varDump($this->elements[ $attrs['name'] ]));
961
+		$this->xdebug("addElement ".$attrs['name']);
962
+		$this->appendDebug($this->varDump($this->elements[$attrs['name']]));
963 963
 	}
964 964
 }
965 965
 
Please login to merge, or discard this patch.
main/inc/lib/nusoap/class.soapclient.php 1 patch
Spacing   +107 added lines, -107 removed lines patch added patch discarded remove patch
@@ -23,39 +23,39 @@  discard block
 block discarded – undo
23 23
 * @version  $Id: class.soapclient.php,v 1.69 2010/04/26 20:15:08 snichol Exp $
24 24
 * @access   public
25 25
 */
26
-class nusoap_client extends nusoap_base  {
27
-
28
-	var $username = '';				// Username for HTTP authentication
29
-	var $password = '';				// Password for HTTP authentication
30
-	var $authtype = '';				// Type of HTTP authentication
31
-	var $certRequest = array();		// Certificate for HTTP SSL authentication
32
-	var $requestHeaders = false;	// SOAP headers in request (text)
33
-	var $responseHeaders = '';		// SOAP headers from response (incomplete namespace resolution) (text)
34
-	var $responseHeader = NULL;		// SOAP Header from response (parsed)
35
-	var $document = '';				// SOAP body response portion (incomplete namespace resolution) (text)
26
+class nusoap_client extends nusoap_base {
27
+
28
+	var $username = ''; // Username for HTTP authentication
29
+	var $password = ''; // Password for HTTP authentication
30
+	var $authtype = ''; // Type of HTTP authentication
31
+	var $certRequest = array(); // Certificate for HTTP SSL authentication
32
+	var $requestHeaders = false; // SOAP headers in request (text)
33
+	var $responseHeaders = ''; // SOAP headers from response (incomplete namespace resolution) (text)
34
+	var $responseHeader = NULL; // SOAP Header from response (parsed)
35
+	var $document = ''; // SOAP body response portion (incomplete namespace resolution) (text)
36 36
 	var $endpoint;
37
-	var $forceEndpoint = '';		// overrides WSDL endpoint
37
+	var $forceEndpoint = ''; // overrides WSDL endpoint
38 38
     var $proxyhost = '';
39 39
     var $proxyport = '';
40 40
 	var $proxyusername = '';
41 41
 	var $proxypassword = '';
42
-	var $portName = '';				// port name to use in WSDL
43
-    var $xml_encoding = '';			// character set encoding of incoming (response) messages
42
+	var $portName = ''; // port name to use in WSDL
43
+    var $xml_encoding = ''; // character set encoding of incoming (response) messages
44 44
 	var $http_encoding = false;
45
-	var $timeout = 0;				// HTTP connection timeout
46
-	var $response_timeout = 30;		// HTTP response timeout
47
-	var $endpointType = '';			// soap|wsdl, empty for WSDL initialization error
45
+	var $timeout = 0; // HTTP connection timeout
46
+	var $response_timeout = 30; // HTTP response timeout
47
+	var $endpointType = ''; // soap|wsdl, empty for WSDL initialization error
48 48
 	var $persistentConnection = false;
49
-	var $defaultRpcParams = false;	// This is no longer used
50
-	var $request = '';				// HTTP request
51
-	var $response = '';				// HTTP response
52
-	var $responseData = '';			// SOAP payload of response
53
-	var $cookies = array();			// Cookies from response or for request
54
-    var $decode_utf8 = true;		// toggles whether the parser decodes element content w/ utf8_decode()
55
-	var $operations = array();		// WSDL operations, empty for WSDL initialization error
56
-	var $curl_options = array();	// User-specified cURL options
57
-	var $bindingType = '';			// WSDL operation binding type
58
-	var $use_curl = false;			// whether to always try to use cURL
49
+	var $defaultRpcParams = false; // This is no longer used
50
+	var $request = ''; // HTTP request
51
+	var $response = ''; // HTTP response
52
+	var $responseData = ''; // SOAP payload of response
53
+	var $cookies = array(); // Cookies from response or for request
54
+    var $decode_utf8 = true; // toggles whether the parser decodes element content w/ utf8_decode()
55
+	var $operations = array(); // WSDL operations, empty for WSDL initialization error
56
+	var $curl_options = array(); // User-specified cURL options
57
+	var $bindingType = ''; // WSDL operation binding type
58
+	var $use_curl = false; // whether to always try to use cURL
59 59
 
60 60
 	/*
61 61
 	 * fault related variables
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 	* @param	string $portName optional portName in WSDL document
96 96
 	* @access   public
97 97
 	*/
98
-	function nusoap_client($endpoint,$wsdl = false,$proxyhost = false,$proxyport = false,$proxyusername = false, $proxypassword = false, $timeout = 0, $response_timeout = 30, $portName = ''){
98
+	function nusoap_client($endpoint, $wsdl = false, $proxyhost = false, $proxyport = false, $proxyusername = false, $proxypassword = false, $timeout = 0, $response_timeout = 30, $portName = '') {
99 99
 		parent::nusoap_base();
100 100
 		$this->endpoint = $endpoint;
101 101
 		$this->proxyhost = $proxyhost;
@@ -107,20 +107,20 @@  discard block
 block discarded – undo
107 107
 		$this->portName = $portName;
108 108
 
109 109
 		$this->debug("ctor wsdl=$wsdl timeout=$timeout response_timeout=$response_timeout");
110
-		$this->appendDebug('endpoint=' . $this->varDump($endpoint));
110
+		$this->appendDebug('endpoint='.$this->varDump($endpoint));
111 111
 
112 112
 		// make values
113
-		if($wsdl){
113
+		if ($wsdl) {
114 114
 			if (is_object($endpoint) && (get_class($endpoint) == 'wsdl')) {
115 115
 				$this->wsdl = $endpoint;
116 116
 				$this->endpoint = $this->wsdl->wsdl;
117 117
 				$this->wsdlFile = $this->endpoint;
118
-				$this->debug('existing wsdl instance created from ' . $this->endpoint);
118
+				$this->debug('existing wsdl instance created from '.$this->endpoint);
119 119
 				$this->checkWSDL();
120 120
 			} else {
121 121
 				$this->wsdlFile = $this->endpoint;
122 122
 				$this->wsdl = null;
123
-				$this->debug('will use lazy evaluation of wsdl from ' . $this->endpoint);
123
+				$this->debug('will use lazy evaluation of wsdl from '.$this->endpoint);
124 124
 			}
125 125
 			$this->endpointType = 'wsdl';
126 126
 		} else {
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 	* @return	mixed	response from SOAP call, normally an associative array mirroring the structure of the XML response, false for certain fatal errors
155 155
 	* @access   public
156 156
 	*/
157
-	function call($operation,$params=array(),$namespace='http://tempuri.org',$soapAction='',$headers=false,$rpcParams=null,$style='rpc',$use='encoded'){
157
+	function call($operation, $params = array(), $namespace = 'http://tempuri.org', $soapAction = '', $headers = false, $rpcParams = null, $style = 'rpc', $use = 'encoded') {
158 158
 		$this->operation = $operation;
159 159
 		$this->fault = false;
160 160
 		$this->setError('');
@@ -166,8 +166,8 @@  discard block
 block discarded – undo
166 166
 		$this->opData = array();
167 167
 		
168 168
 		$this->debug("call: operation=$operation, namespace=$namespace, soapAction=$soapAction, rpcParams=$rpcParams, style=$style, use=$use, endpointType=$this->endpointType");
169
-		$this->appendDebug('params=' . $this->varDump($params));
170
-		$this->appendDebug('headers=' . $this->varDump($headers));
169
+		$this->appendDebug('params='.$this->varDump($params));
170
+		$this->appendDebug('headers='.$this->varDump($headers));
171 171
 		if ($headers) {
172 172
 			$this->requestHeaders = $headers;
173 173
 		}
@@ -177,25 +177,25 @@  discard block
 block discarded – undo
177 177
 				return false;
178 178
 		}
179 179
 		// serialize parameters
180
-		if($this->endpointType == 'wsdl' && $opData = $this->getOperationData($operation)){
180
+		if ($this->endpointType == 'wsdl' && $opData = $this->getOperationData($operation)) {
181 181
 			// use WSDL for operation
182 182
 			$this->opData = $opData;
183 183
 			$this->debug("found operation");
184
-			$this->appendDebug('opData=' . $this->varDump($opData));
184
+			$this->appendDebug('opData='.$this->varDump($opData));
185 185
 			if (isset($opData['soapAction'])) {
186 186
 				$soapAction = $opData['soapAction'];
187 187
 			}
188
-			if (! $this->forceEndpoint) {
188
+			if (!$this->forceEndpoint) {
189 189
 				$this->endpoint = $opData['endpoint'];
190 190
 			} else {
191 191
 				$this->endpoint = $this->forceEndpoint;
192 192
 			}
193
-			$namespace = isset($opData['input']['namespace']) ? $opData['input']['namespace'] :	$namespace;
193
+			$namespace = isset($opData['input']['namespace']) ? $opData['input']['namespace'] : $namespace;
194 194
 			$style = $opData['style'];
195 195
 			$use = $opData['input']['use'];
196 196
 			// add ns to ns array
197
-			if($namespace != '' && !isset($this->wsdl->namespaces[$namespace])){
198
-				$nsPrefix = 'ns' . rand(1000, 9999);
197
+			if ($namespace != '' && !isset($this->wsdl->namespaces[$namespace])) {
198
+				$nsPrefix = 'ns'.rand(1000, 9999);
199 199
 				$this->wsdl->namespaces[$nsPrefix] = $namespace;
200 200
 			}
201 201
             $nsPrefix = $this->wsdl->getPrefixFromNamespace($namespace);
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
 				$payload = $params;
206 206
 			} elseif (is_array($params)) {
207 207
 				$this->debug("serializing param array for WSDL operation $operation");
208
-				$payload = $this->wsdl->serializeRPCParameters($operation,'input',$params,$this->bindingType);
208
+				$payload = $this->wsdl->serializeRPCParameters($operation, 'input', $params, $this->bindingType);
209 209
 			} else {
210 210
 				$this->debug('params must be array or string');
211 211
 				$this->setError('params must be array or string');
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 				$this->setError('wsdl error: '.$errstr);
225 225
 				return false;
226 226
 			}
227
-		} elseif($this->endpointType == 'wsdl') {
227
+		} elseif ($this->endpointType == 'wsdl') {
228 228
 			// operation not in WSDL
229 229
 			$this->appendDebug($this->wsdl->getDebug());
230 230
 			$this->wsdl->clearDebug();
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 		} else {
235 235
 			// no WSDL
236 236
 			//$this->namespaces['ns1'] = $namespace;
237
-			$nsPrefix = 'ns' . rand(1000, 9999);
237
+			$nsPrefix = 'ns'.rand(1000, 9999);
238 238
 			// serialize 
239 239
 			$payload = '';
240 240
 			if (is_string($params)) {
@@ -242,8 +242,8 @@  discard block
 block discarded – undo
242 242
 				$payload = $params;
243 243
 			} elseif (is_array($params)) {
244 244
 				$this->debug("serializing param array for operation $operation");
245
-				foreach($params as $k => $v){
246
-					$payload .= $this->serialize_val($v,$k,false,false,false,false,$use);
245
+				foreach ($params as $k => $v) {
246
+					$payload .= $this->serialize_val($v, $k, false, false, false, false, $use);
247 247
 				}
248 248
 			} else {
249 249
 				$this->debug('params must be array or string');
@@ -263,45 +263,45 @@  discard block
 block discarded – undo
263 263
 				$this->debug("wrapping RPC request with literal method element");
264 264
 				if ($namespace) {
265 265
 					// http://www.ws-i.org/Profiles/BasicProfile-1.1-2004-08-24.html R2735 says rpc/literal accessor elements should not be in a namespace
266
-					$payload = "<$nsPrefix:$operation xmlns:$nsPrefix=\"$namespace\">" .
267
-								$payload .
266
+					$payload = "<$nsPrefix:$operation xmlns:$nsPrefix=\"$namespace\">".
267
+								$payload.
268 268
 								"</$nsPrefix:$operation>";
269 269
 				} else {
270
-					$payload = "<$operation>" . $payload . "</$operation>";
270
+					$payload = "<$operation>".$payload."</$operation>";
271 271
 				}
272 272
 			} else {
273 273
 				$this->debug("wrapping RPC request with encoded method element");
274 274
 				if ($namespace) {
275
-					$payload = "<$nsPrefix:$operation xmlns:$nsPrefix=\"$namespace\">" .
276
-								$payload .
275
+					$payload = "<$nsPrefix:$operation xmlns:$nsPrefix=\"$namespace\">".
276
+								$payload.
277 277
 								"</$nsPrefix:$operation>";
278 278
 				} else {
279
-					$payload = "<$operation>" .
280
-								$payload .
279
+					$payload = "<$operation>".
280
+								$payload.
281 281
 								"</$operation>";
282 282
 				}
283 283
 			}
284 284
 		}
285 285
 		// serialize envelope
286
-		$soapmsg = $this->serializeEnvelope($payload,$this->requestHeaders,$usedNamespaces,$style,$use,$encodingStyle);
286
+		$soapmsg = $this->serializeEnvelope($payload, $this->requestHeaders, $usedNamespaces, $style, $use, $encodingStyle);
287 287
 		$this->debug("endpoint=$this->endpoint, soapAction=$soapAction, namespace=$namespace, style=$style, use=$use, encodingStyle=$encodingStyle");
288
-		$this->debug('SOAP message length=' . strlen($soapmsg) . ' contents (max 1000 bytes)=' . substr($soapmsg, 0, 1000));
288
+		$this->debug('SOAP message length='.strlen($soapmsg).' contents (max 1000 bytes)='.substr($soapmsg, 0, 1000));
289 289
 		// send
290
-		$return = $this->send($this->getHTTPBody($soapmsg),$soapAction,$this->timeout,$this->response_timeout);
291
-		if($errstr = $this->getError()){
290
+		$return = $this->send($this->getHTTPBody($soapmsg), $soapAction, $this->timeout, $this->response_timeout);
291
+		if ($errstr = $this->getError()) {
292 292
 			$this->debug('Error: '.$errstr);
293 293
 			return false;
294 294
 		} else {
295 295
 			$this->return = $return;
296 296
 			$this->debug('sent message successfully and got a(n) '.gettype($return));
297
-           	$this->appendDebug('return=' . $this->varDump($return));
297
+           	$this->appendDebug('return='.$this->varDump($return));
298 298
 			
299 299
 			// fault?
300
-			if(is_array($return) && isset($return['faultcode'])){
300
+			if (is_array($return) && isset($return['faultcode'])) {
301 301
 				$this->debug('got fault');
302 302
 				$this->setError($return['faultcode'].': '.$return['faultstring']);
303 303
 				$this->fault = true;
304
-				foreach($return as $k => $v){
304
+				foreach ($return as $k => $v) {
305 305
 					$this->$k = $v;
306 306
 					$this->debug("$k = $v<br>");
307 307
 				}
@@ -312,10 +312,10 @@  discard block
 block discarded – undo
312 312
 				return $return;
313 313
 			} else {
314 314
 				// array of return values
315
-				if(is_array($return)){
315
+				if (is_array($return)) {
316 316
 					// multiple 'out' parameters, which we return wrapped up
317 317
 					// in the array
318
-					if(sizeof($return) > 1){
318
+					if (sizeof($return) > 1) {
319 319
 						return $return;
320 320
 					}
321 321
 					// single 'out' parameter (normally the return value)
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
 	 */
373 373
 	function loadWSDL() {
374 374
 		$this->debug('instantiating wsdl class with doc: '.$this->wsdlFile);
375
-		$this->wsdl = new wsdl('',$this->proxyhost,$this->proxyport,$this->proxyusername,$this->proxypassword,$this->timeout,$this->response_timeout,$this->curl_options,$this->use_curl);
375
+		$this->wsdl = new wsdl('', $this->proxyhost, $this->proxyport, $this->proxyusername, $this->proxypassword, $this->timeout, $this->response_timeout, $this->curl_options, $this->use_curl);
376 376
 		$this->wsdl->setCredentials($this->username, $this->password, $this->authtype, $this->certRequest);
377 377
 		$this->wsdl->fetchWSDL($this->wsdlFile);
378 378
 		$this->checkWSDL();
@@ -385,13 +385,13 @@  discard block
 block discarded – undo
385 385
 	* @return	array array of data pertaining to the operation
386 386
 	* @access   public
387 387
 	*/
388
-	function getOperationData($operation){
388
+	function getOperationData($operation) {
389 389
 		if ($this->endpointType == 'wsdl' && is_null($this->wsdl)) {
390 390
 			$this->loadWSDL();
391 391
 			if ($this->getError())
392 392
 				return false;
393 393
 		}
394
-		if(isset($this->operations[$operation])){
394
+		if (isset($this->operations[$operation])) {
395 395
 			return $this->operations[$operation];
396 396
 		}
397 397
 		$this->debug("No data for operation: $operation");
@@ -411,15 +411,15 @@  discard block
 block discarded – undo
411 411
 	* @return	mixed native PHP types.
412 412
 	* @access   private
413 413
 	*/
414
-	function send($msg, $soapaction = '', $timeout=0, $response_timeout=30) {
414
+	function send($msg, $soapaction = '', $timeout = 0, $response_timeout = 30) {
415 415
 		$this->checkCookies();
416 416
 		// detect transport
417
-		switch(true){
417
+		switch (true) {
418 418
 			// http(s)
419
-			case preg_match('/^http/',$this->endpoint):
419
+			case preg_match('/^http/', $this->endpoint):
420 420
 				$this->debug('transporting via HTTP');
421
-				if($this->persistentConnection == true && is_object($this->persistentConnection)){
422
-					$http =& $this->persistentConnection;
421
+				if ($this->persistentConnection == true && is_object($this->persistentConnection)) {
422
+					$http = & $this->persistentConnection;
423 423
 				} else {
424 424
 					$http = new soap_transport_http($this->endpoint, $this->curl_options, $this->use_curl);
425 425
 					if ($this->persistentConnection) {
@@ -428,27 +428,27 @@  discard block
 block discarded – undo
428 428
 				}
429 429
 				$http->setContentType($this->getHTTPContentType(), $this->getHTTPContentTypeCharset());
430 430
 				$http->setSOAPAction($soapaction);
431
-				if($this->proxyhost && $this->proxyport){
432
-					$http->setProxy($this->proxyhost,$this->proxyport,$this->proxyusername,$this->proxypassword);
431
+				if ($this->proxyhost && $this->proxyport) {
432
+					$http->setProxy($this->proxyhost, $this->proxyport, $this->proxyusername, $this->proxypassword);
433 433
 				}
434
-                if($this->authtype != '') {
434
+                if ($this->authtype != '') {
435 435
 					$http->setCredentials($this->username, $this->password, $this->authtype, array(), $this->certRequest);
436 436
 				}
437
-				if($this->http_encoding != ''){
437
+				if ($this->http_encoding != '') {
438 438
 					$http->setEncoding($this->http_encoding);
439 439
 				}
440 440
 				$this->debug('sending message, length='.strlen($msg));
441
-				if(preg_match('/^http:/',$this->endpoint)){
441
+				if (preg_match('/^http:/', $this->endpoint)) {
442 442
 				//if(strpos($this->endpoint,'http:')){
443
-					$this->responseData = $http->send($msg,$timeout,$response_timeout,$this->cookies);
444
-				} elseif(preg_match('/^https/',$this->endpoint)){
443
+					$this->responseData = $http->send($msg, $timeout, $response_timeout, $this->cookies);
444
+				} elseif (preg_match('/^https/', $this->endpoint)) {
445 445
 				//} elseif(strpos($this->endpoint,'https:')){
446 446
 					//if(phpversion() == '4.3.0-dev'){
447 447
 						//$response = $http->send($msg,$timeout,$response_timeout);
448 448
                    		//$this->request = $http->outgoing_payload;
449 449
 						//$this->response = $http->incoming_payload;
450 450
 					//} else
451
-					$this->responseData = $http->sendHTTPS($msg,$timeout,$response_timeout,$this->cookies);
451
+					$this->responseData = $http->sendHTTPS($msg, $timeout, $response_timeout, $this->cookies);
452 452
 				} else {
453 453
 					$this->setError('no http/s in endpoint url');
454 454
 				}
@@ -465,13 +465,13 @@  discard block
 block discarded – undo
465 465
 					}
466 466
 				}
467 467
 				
468
-				if($err = $http->getError()){
468
+				if ($err = $http->getError()) {
469 469
 					$this->setError('HTTP Error: '.$err);
470 470
 					return false;
471
-				} elseif($this->getError()){
471
+				} elseif ($this->getError()) {
472 472
 					return false;
473 473
 				} else {
474
-					$this->debug('got response, length='. strlen($this->responseData).' type='.$http->incoming_headers['content-type']);
474
+					$this->debug('got response, length='.strlen($this->responseData).' type='.$http->incoming_headers['content-type']);
475 475
 					return $this->parseResponse($http->incoming_headers, $this->responseData);
476 476
 				}
477 477
 			break;
@@ -491,20 +491,20 @@  discard block
 block discarded – undo
491 491
 	* @access   private
492 492
 	*/
493 493
     function parseResponse($headers, $data) {
494
-		$this->debug('Entering parseResponse() for data of length ' . strlen($data) . ' headers:');
494
+		$this->debug('Entering parseResponse() for data of length '.strlen($data).' headers:');
495 495
 		$this->appendDebug($this->varDump($headers));
496 496
     	if (!isset($headers['content-type'])) {
497 497
 			$this->setError('Response not of type text/xml (no content-type header)');
498 498
 			return false;
499 499
     	}
500 500
 		if (!strstr($headers['content-type'], 'text/xml')) {
501
-			$this->setError('Response not of type text/xml: ' . $headers['content-type']);
501
+			$this->setError('Response not of type text/xml: '.$headers['content-type']);
502 502
 			return false;
503 503
 		}
504 504
 		if (strpos($headers['content-type'], '=')) {
505 505
 			$enc = str_replace('"', '', substr(strstr($headers["content-type"], '='), 1));
506
-			$this->debug('Got response encoding: ' . $enc);
507
-			if(preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)){
506
+			$this->debug('Got response encoding: '.$enc);
507
+			if (preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i', $enc)) {
508 508
 				$this->xml_encoding = strtoupper($enc);
509 509
 			} else {
510 510
 				$this->xml_encoding = 'US-ASCII';
@@ -513,13 +513,13 @@  discard block
 block discarded – undo
513 513
 			// should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1
514 514
 			$this->xml_encoding = 'ISO-8859-1';
515 515
 		}
516
-		$this->debug('Use encoding: ' . $this->xml_encoding . ' when creating nusoap_parser');
517
-		$parser = new nusoap_parser($data,$this->xml_encoding,$this->operation,$this->decode_utf8);
516
+		$this->debug('Use encoding: '.$this->xml_encoding.' when creating nusoap_parser');
517
+		$parser = new nusoap_parser($data, $this->xml_encoding, $this->operation, $this->decode_utf8);
518 518
 		// add parser debug data to our debug
519 519
 		$this->appendDebug($parser->getDebug());
520 520
 		// if parse errors
521
-		if($errstr = $parser->getError()){
522
-			$this->setError( $errstr);
521
+		if ($errstr = $parser->getError()) {
522
+			$this->setError($errstr);
523 523
 			// destroy the parser object
524 524
 			unset($parser);
525 525
 			return false;
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
 	* @param	mixed $headers String of XML with SOAP header content, or array of soapval objects for SOAP headers
570 570
 	* @access   public
571 571
 	*/
572
-	function setHeaders($headers){
572
+	function setHeaders($headers) {
573 573
 		$this->debug("setHeaders headers=");
574 574
 		$this->appendDebug($this->varDump($headers));
575 575
 		$this->requestHeaders = $headers;
@@ -581,7 +581,7 @@  discard block
 block discarded – undo
581 581
 	* @return	string
582 582
 	* @access   public
583 583
 	*/
584
-	function getHeaders(){
584
+	function getHeaders() {
585 585
 		return $this->responseHeaders;
586 586
 	}
587 587
 
@@ -591,7 +591,7 @@  discard block
 block discarded – undo
591 591
 	* @return	mixed
592 592
 	* @access   public
593 593
 	*/
594
-	function getHeader(){
594
+	function getHeader() {
595 595
 		return $this->responseHeader;
596 596
 	}
597 597
 
@@ -635,7 +635,7 @@  discard block
 block discarded – undo
635 635
 	* @param    string $enc HTTP encoding
636 636
 	* @access   public
637 637
 	*/
638
-	function setHTTPEncoding($enc='gzip, deflate'){
638
+	function setHTTPEncoding($enc = 'gzip, deflate') {
639 639
 		$this->debug("setHTTPEncoding(\"$enc\")");
640 640
 		$this->http_encoding = $enc;
641 641
 	}
@@ -656,7 +656,7 @@  discard block
 block discarded – undo
656 656
 	*
657 657
 	* @access   public
658 658
 	*/
659
-	function useHTTPPersistentConnection(){
659
+	function useHTTPPersistentConnection() {
660 660
 		$this->debug("useHTTPPersistentConnection");
661 661
 		$this->persistentConnection = true;
662 662
 	}
@@ -748,7 +748,7 @@  discard block
 block discarded – undo
748 748
 	*/
749 749
 	function _getProxyClassCode($r) {
750 750
 		$this->debug("in getProxy endpointType=$this->endpointType");
751
-		$this->appendDebug("wsdl=" . $this->varDump($this->wsdl));
751
+		$this->appendDebug("wsdl=".$this->varDump($this->wsdl));
752 752
 		if ($this->endpointType != 'wsdl') {
753 753
 			$evalStr = 'A proxy can only be created for a WSDL client';
754 754
 			$this->setError($evalStr);
@@ -758,7 +758,7 @@  discard block
 block discarded – undo
758 758
 		if ($this->endpointType == 'wsdl' && is_null($this->wsdl)) {
759 759
 			$this->loadWSDL();
760 760
 			if ($this->getError()) {
761
-				return "echo \"" . $this->getError() . "\";";
761
+				return "echo \"".$this->getError()."\";";
762 762
 			}
763 763
 		}
764 764
 		$evalStr = '';
@@ -774,9 +774,9 @@  discard block
 block discarded – undo
774 774
 						$paramArrayStr .= "'$name' => \$$name, ";
775 775
 						$paramCommentStr .= "$type \$$name, ";
776 776
 					}
777
-					$paramStr = substr($paramStr, 0, strlen($paramStr)-2);
778
-					$paramArrayStr = substr($paramArrayStr, 0, strlen($paramArrayStr)-2);
779
-					$paramCommentStr = substr($paramCommentStr, 0, strlen($paramCommentStr)-2);
777
+					$paramStr = substr($paramStr, 0, strlen($paramStr) - 2);
778
+					$paramArrayStr = substr($paramArrayStr, 0, strlen($paramArrayStr) - 2);
779
+					$paramCommentStr = substr($paramCommentStr, 0, strlen($paramCommentStr) - 2);
780 780
 				} else {
781 781
 					$paramStr = '';
782 782
 					$paramArrayStr = '';
@@ -784,7 +784,7 @@  discard block
 block discarded – undo
784 784
 				}
785 785
 				$opData['namespace'] = !isset($opData['namespace']) ? 'http://testuri.com' : $opData['namespace'];
786 786
 				$evalStr .= "// $paramCommentStr
787
-	function " . str_replace('.', '__', $operation) . "($paramStr) {
787
+	function ".str_replace('.', '__', $operation)."($paramStr) {
788 788
 		\$params = array($paramArrayStr);
789 789
 		return \$this->call('$operation', \$params, '".$opData['namespace']."', '".(isset($opData['soapAction']) ? $opData['soapAction'] : '')."');
790 790
 	}
@@ -852,7 +852,7 @@  discard block
 block discarded – undo
852 852
     * @return   always returns true
853 853
     * @access   public
854 854
     */
855
-    function decodeUTF8($bool){
855
+    function decodeUTF8($bool) {
856 856
 		$this->decode_utf8 = $bool;
857 857
 		return true;
858 858
     }
@@ -893,19 +893,19 @@  discard block
 block discarded – undo
893 893
 		if (sizeof($this->cookies) == 0) {
894 894
 			return true;
895 895
 		}
896
-		$this->debug('checkCookie: check ' . sizeof($this->cookies) . ' cookies');
896
+		$this->debug('checkCookie: check '.sizeof($this->cookies).' cookies');
897 897
 		$curr_cookies = $this->cookies;
898 898
 		$this->cookies = array();
899 899
 		foreach ($curr_cookies as $cookie) {
900
-			if (! is_array($cookie)) {
900
+			if (!is_array($cookie)) {
901 901
 				$this->debug('Remove cookie that is not an array');
902 902
 				continue;
903 903
 			}
904
-			if ((isset($cookie['expires'])) && (! empty($cookie['expires']))) {
904
+			if ((isset($cookie['expires'])) && (!empty($cookie['expires']))) {
905 905
 				if (strtotime($cookie['expires']) > time()) {
906 906
 					$this->cookies[] = $cookie;
907 907
 				} else {
908
-					$this->debug('Remove expired cookie ' . $cookie['name']);
908
+					$this->debug('Remove expired cookie '.$cookie['name']);
909 909
 				}
910 910
 			} else {
911 911
 				$this->cookies[] = $cookie;
@@ -969,11 +969,11 @@  discard block
 block discarded – undo
969 969
 				}
970 970
 				$this->cookies[$i] = $newCookie;
971 971
 				$found = true;
972
-				$this->debug('Update cookie ' . $newName . '=' . $newCookie['value']);
972
+				$this->debug('Update cookie '.$newName.'='.$newCookie['value']);
973 973
 				break;
974 974
 			}
975
-			if (! $found) {
976
-				$this->debug('Add cookie ' . $newName . '=' . $newCookie['value']);
975
+			if (!$found) {
976
+				$this->debug('Add cookie '.$newName.'='.$newCookie['value']);
977 977
 				$this->cookies[] = $newCookie;
978 978
 			}
979 979
 		}
Please login to merge, or discard this patch.
main/inc/lib/nusoap/class.soap_server.php 1 patch
Spacing   +85 added lines, -85 removed lines patch added patch discarded remove patch
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
     * @param mixed $wsdl file path or URL (string), or wsdl instance (object)
171 171
 	* @access   public
172 172
 	*/
173
-	function nusoap_server($wsdl=false){
173
+	function nusoap_server($wsdl = false) {
174 174
 		parent::nusoap_base();
175 175
 		// turn on debugging?
176 176
 		global $debug;
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 			$qs = explode('&', $_SERVER['QUERY_STRING']);
194 194
 			foreach ($qs as $v) {
195 195
 				if (substr($v, 0, 6) == 'debug=') {
196
-					$this->debug("In nusoap_server, set debug_flag=" . substr($v, 6) . " based on query string #1");
196
+					$this->debug("In nusoap_server, set debug_flag=".substr($v, 6)." based on query string #1");
197 197
 					$this->debug_flag = substr($v, 6);
198 198
 				}
199 199
 			}
@@ -201,27 +201,27 @@  discard block
 block discarded – undo
201 201
 			$qs = explode('&', $HTTP_SERVER_VARS['QUERY_STRING']);
202 202
 			foreach ($qs as $v) {
203 203
 				if (substr($v, 0, 6) == 'debug=') {
204
-					$this->debug("In nusoap_server, set debug_flag=" . substr($v, 6) . " based on query string #2");
204
+					$this->debug("In nusoap_server, set debug_flag=".substr($v, 6)." based on query string #2");
205 205
 					$this->debug_flag = substr($v, 6);
206 206
 				}
207 207
 			}
208 208
 		}
209 209
 
210 210
 		// wsdl
211
-		if($wsdl){
211
+		if ($wsdl) {
212 212
 			$this->debug("In nusoap_server, WSDL is specified");
213 213
 			if (is_object($wsdl) && (get_class($wsdl) == 'wsdl')) {
214 214
 				$this->wsdl = $wsdl;
215 215
 				$this->externalWSDLURL = $this->wsdl->wsdl;
216
-				$this->debug('Use existing wsdl instance from ' . $this->externalWSDLURL);
216
+				$this->debug('Use existing wsdl instance from '.$this->externalWSDLURL);
217 217
 			} else {
218
-				$this->debug('Create wsdl from ' . $wsdl);
218
+				$this->debug('Create wsdl from '.$wsdl);
219 219
 				$this->wsdl = new wsdl($wsdl);
220 220
 				$this->externalWSDLURL = $wsdl;
221 221
 			}
222 222
 			$this->appendDebug($this->wsdl->getDebug());
223 223
 			$this->wsdl->clearDebug();
224
-			if($err = $this->wsdl->getError()){
224
+			if ($err = $this->wsdl->getError()) {
225 225
 				die('WSDL ERROR: '.$err);
226 226
 			}
227 227
 		}
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 	* @param    string $data usually is the value of $HTTP_RAW_POST_DATA
234 234
 	* @access   public
235 235
 	*/
236
-	function service($data){
236
+	function service($data) {
237 237
 		global $HTTP_SERVER_VARS;
238 238
 
239 239
 		if (isset($_SERVER['REQUEST_METHOD'])) {
@@ -251,21 +251,21 @@  discard block
 block discarded – undo
251 251
 		} else {
252 252
 			$qs = '';
253 253
 		}
254
-		$this->debug("In service, request method=$rm query string=$qs strlen(\$data)=" . strlen($data));
254
+		$this->debug("In service, request method=$rm query string=$qs strlen(\$data)=".strlen($data));
255 255
 
256 256
 		if ($rm == 'POST') {
257 257
 			$this->debug("In service, invoke the request");
258 258
 			$this->parse_request($data);
259
-			if (! $this->fault) {
259
+			if (!$this->fault) {
260 260
 				$this->invoke_method();
261 261
 			}
262
-			if (! $this->fault) {
262
+			if (!$this->fault) {
263 263
 				$this->serialize_return();
264 264
 			}
265 265
 			$this->send_response();
266
-		} elseif (preg_match('/wsdl/', $qs) ){
266
+		} elseif (preg_match('/wsdl/', $qs)) {
267 267
 			$this->debug("In service, this is a request for WSDL");
268
-			if ($this->externalWSDLURL){
268
+			if ($this->externalWSDLURL) {
269 269
               if (strpos($this->externalWSDLURL, "http://") !== false) { // assume URL
270 270
 				$this->debug("In service, re-direct for WSDL");
271 271
 				header('Location: '.$this->externalWSDLURL);
@@ -322,23 +322,23 @@  discard block
 block discarded – undo
322 322
 
323 323
 		$this->request = '';
324 324
 		$this->SOAPAction = '';
325
-		if(function_exists('getallheaders')){
325
+		if (function_exists('getallheaders')) {
326 326
 			$this->debug("In parse_http_headers, use getallheaders");
327 327
 			$headers = getallheaders();
328
-			foreach($headers as $k=>$v){
328
+			foreach ($headers as $k=>$v) {
329 329
 				$k = strtolower($k);
330 330
 				$this->headers[$k] = $v;
331 331
 				$this->request .= "$k: $v\r\n";
332 332
 				$this->debug("$k: $v");
333 333
 			}
334 334
 			// get SOAPAction header
335
-			if(isset($this->headers['soapaction'])){
336
-				$this->SOAPAction = str_replace('"','',$this->headers['soapaction']);
335
+			if (isset($this->headers['soapaction'])) {
336
+				$this->SOAPAction = str_replace('"', '', $this->headers['soapaction']);
337 337
 			}
338 338
 			// get the character encoding of the incoming request
339
-			if(isset($this->headers['content-type']) && strpos($this->headers['content-type'],'=')){
340
-				$enc = str_replace('"','',substr(strstr($this->headers["content-type"],'='),1));
341
-				if(preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)){
339
+			if (isset($this->headers['content-type']) && strpos($this->headers['content-type'], '=')) {
340
+				$enc = str_replace('"', '', substr(strstr($this->headers["content-type"], '='), 1));
341
+				if (preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i', $enc)) {
342 342
 					$this->xml_encoding = strtoupper($enc);
343 343
 				} else {
344 344
 					$this->xml_encoding = 'US-ASCII';
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
 				// should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1
348 348
 				$this->xml_encoding = 'ISO-8859-1';
349 349
 			}
350
-		} elseif(isset($_SERVER) && is_array($_SERVER)){
350
+		} elseif (isset($_SERVER) && is_array($_SERVER)) {
351 351
 			$this->debug("In parse_http_headers, use _SERVER");
352 352
 			foreach ($_SERVER as $k => $v) {
353 353
 				if (substr($k, 0, 5) == 'HTTP_') {
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
 						$enc = substr(strstr($v, '='), 1);
368 368
 						$enc = str_replace('"', '', $enc);
369 369
 						$enc = str_replace('\\', '', $enc);
370
-						if (preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)) {
370
+						if (preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i', $enc)) {
371 371
 							$this->xml_encoding = strtoupper($enc);
372 372
 						} else {
373 373
 							$this->xml_encoding = 'US-ASCII';
@@ -385,9 +385,9 @@  discard block
 block discarded – undo
385 385
 			$this->debug("In parse_http_headers, use HTTP_SERVER_VARS");
386 386
 			foreach ($HTTP_SERVER_VARS as $k => $v) {
387 387
 				if (substr($k, 0, 5) == 'HTTP_') {
388
-					$k = str_replace(' ', '-', strtolower(str_replace('_', ' ', substr($k, 5)))); 	                                         $k = strtolower(substr($k, 5));
388
+					$k = str_replace(' ', '-', strtolower(str_replace('_', ' ', substr($k, 5)))); $k = strtolower(substr($k, 5));
389 389
 				} else {
390
-					$k = str_replace(' ', '-', strtolower(str_replace('_', ' ', $k))); 	                                         $k = strtolower($k);
390
+					$k = str_replace(' ', '-', strtolower(str_replace('_', ' ', $k))); $k = strtolower($k);
391 391
 				}
392 392
 				if ($k == 'soapaction') {
393 393
 					// get SOAPAction header
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
 						$enc = substr(strstr($v, '='), 1);
402 402
 						$enc = str_replace('"', '', $enc);
403 403
 						$enc = str_replace('\\', '', $enc);
404
-						if (preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)) {
404
+						if (preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i', $enc)) {
405 405
 							$this->xml_encoding = strtoupper($enc);
406 406
 						} else {
407 407
 							$this->xml_encoding = 'US-ASCII';
@@ -443,13 +443,13 @@  discard block
 block discarded – undo
443 443
 	* @param    string $data XML string
444 444
 	* @access   private
445 445
 	*/
446
-	function parse_request($data='') {
446
+	function parse_request($data = '') {
447 447
 		$this->debug('entering parse_request()');
448 448
 		$this->parse_http_headers();
449 449
 		$this->debug('got character encoding: '.$this->xml_encoding);
450 450
 		// uncompress if necessary
451 451
 		if (isset($this->headers['content-encoding']) && $this->headers['content-encoding'] != '') {
452
-			$this->debug('got content encoding: ' . $this->headers['content-encoding']);
452
+			$this->debug('got content encoding: '.$this->headers['content-encoding']);
453 453
 			if ($this->headers['content-encoding'] == 'deflate' || $this->headers['content-encoding'] == 'gzip') {
454 454
 		    	// if decoding works, use it. else assume data wasn't gzencoded
455 455
 				if (function_exists('gzuncompress')) {
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
 	* @access   private
492 492
 	*/
493 493
 	function invoke_method() {
494
-		$this->debug('in invoke_method, methodname=' . $this->methodname . ' methodURI=' . $this->methodURI . ' SOAPAction=' . $this->SOAPAction);
494
+		$this->debug('in invoke_method, methodname='.$this->methodname.' methodURI='.$this->methodURI.' SOAPAction='.$this->SOAPAction);
495 495
 
496 496
 		//
497 497
 		// if you are debugging in this area of the code, your service uses a class to implement methods,
@@ -506,16 +506,16 @@  discard block
 block discarded – undo
506 506
 		$orig_methodname = $this->methodname;
507 507
 		if ($this->wsdl) {
508 508
 			if ($this->opData = $this->wsdl->getOperationData($this->methodname)) {
509
-				$this->debug('in invoke_method, found WSDL operation=' . $this->methodname);
510
-				$this->appendDebug('opData=' . $this->varDump($this->opData));
509
+				$this->debug('in invoke_method, found WSDL operation='.$this->methodname);
510
+				$this->appendDebug('opData='.$this->varDump($this->opData));
511 511
 			} elseif ($this->opData = $this->wsdl->getOperationDataForSoapAction($this->SOAPAction)) {
512 512
 				// Note: hopefully this case will only be used for doc/lit, since rpc services should have wrapper element
513
-				$this->debug('in invoke_method, found WSDL soapAction=' . $this->SOAPAction . ' for operation=' . $this->opData['name']);
514
-				$this->appendDebug('opData=' . $this->varDump($this->opData));
513
+				$this->debug('in invoke_method, found WSDL soapAction='.$this->SOAPAction.' for operation='.$this->opData['name']);
514
+				$this->appendDebug('opData='.$this->varDump($this->opData));
515 515
 				$this->methodname = $this->opData['name'];
516 516
 			} else {
517
-				$this->debug('in invoke_method, no WSDL for operation=' . $this->methodname);
518
-				$this->fault('SOAP-ENV:Client', "Operation '" . $this->methodname . "' is not defined in the WSDL for this service");
517
+				$this->debug('in invoke_method, no WSDL for operation='.$this->methodname);
518
+				$this->fault('SOAP-ENV:Client', "Operation '".$this->methodname."' is not defined in the WSDL for this service");
519 519
 				return;
520 520
 			}
521 521
 		} else {
@@ -556,7 +556,7 @@  discard block
 block discarded – undo
556 556
 			if (!function_exists($this->methodname)) {
557 557
 				$this->debug("in invoke_method, function '$this->methodname' not found!");
558 558
 				$this->result = 'fault: method not found';
559
-				$this->fault('SOAP-ENV:Client',"method '$this->methodname'('$orig_methodname') not defined in service('$try_class' '$delim')");
559
+				$this->fault('SOAP-ENV:Client', "method '$this->methodname'('$orig_methodname') not defined in service('$try_class' '$delim')");
560 560
 				return;
561 561
 			}
562 562
 		} else {
@@ -564,19 +564,19 @@  discard block
 block discarded – undo
564 564
 			if (!in_array($method_to_compare, get_class_methods($class))) {
565 565
 				$this->debug("in invoke_method, method '$this->methodname' not found in class '$class'!");
566 566
 				$this->result = 'fault: method not found';
567
-				$this->fault('SOAP-ENV:Client',"method '$this->methodname'/'$method_to_compare'('$orig_methodname') not defined in service/'$class'('$try_class' '$delim')");
567
+				$this->fault('SOAP-ENV:Client', "method '$this->methodname'/'$method_to_compare'('$orig_methodname') not defined in service/'$class'('$try_class' '$delim')");
568 568
 				return;
569 569
 			}
570 570
 		}
571 571
 
572 572
 		// evaluate message, getting back parameters
573 573
 		// verify that request parameters match the method's signature
574
-		if(! $this->verify_method($this->methodname,$this->methodparams)){
574
+		if (!$this->verify_method($this->methodname, $this->methodparams)) {
575 575
 			// debug
576 576
 			$this->debug('ERROR: request not verified against method signature');
577 577
 			$this->result = 'fault: request failed validation against method signature';
578 578
 			// return fault
579
-			$this->fault('SOAP-ENV:Client',"Operation '$this->methodname' not defined in service.");
579
+			$this->fault('SOAP-ENV:Client', "Operation '$this->methodname' not defined in service.");
580 580
 			return;
581 581
 		}
582 582
 
@@ -616,13 +616,13 @@  discard block
 block discarded – undo
616 616
 		} else {
617 617
 			if ($class == '') {
618 618
 				$this->debug('in invoke_method, calling function using call_user_func_array()');
619
-				$call_arg = "$this->methodname";	// straight assignment changes $this->methodname to lower case after call_user_func_array()
619
+				$call_arg = "$this->methodname"; // straight assignment changes $this->methodname to lower case after call_user_func_array()
620 620
 			} elseif ($delim == '..') {
621 621
 				$this->debug('in invoke_method, calling class method using call_user_func_array()');
622
-				$call_arg = array ($class, $method);
622
+				$call_arg = array($class, $method);
623 623
 			} else {
624 624
 				$this->debug('in invoke_method, calling instance method using call_user_func_array()');
625
-				$instance = new $class ();
625
+				$instance = new $class();
626 626
 				$call_arg = array(&$instance, $method);
627 627
 			}
628 628
 			if (is_array($this->methodparams)) {
@@ -648,7 +648,7 @@  discard block
 block discarded – undo
648 648
 	* @access   private
649 649
 	*/
650 650
 	function serialize_return() {
651
-		$this->debug('Entering serialize_return methodname: ' . $this->methodname . ' methodURI: ' . $this->methodURI);
651
+		$this->debug('Entering serialize_return methodname: '.$this->methodname.' methodURI: '.$this->methodURI);
652 652
 		// if fault
653 653
 		if (isset($this->methodreturn) && is_object($this->methodreturn) && ((get_class($this->methodreturn) == 'soap_fault') || (get_class($this->methodreturn) == 'nusoap_fault'))) {
654 654
 			$this->debug('got a fault object from method');
@@ -660,7 +660,7 @@  discard block
 block discarded – undo
660 660
 		} else {
661 661
 			$this->debug('got a(n) '.gettype($this->methodreturn).' from method');
662 662
 			$this->debug('serializing return value');
663
-			if($this->wsdl){
663
+			if ($this->wsdl) {
664 664
 				$opParams = "";
665 665
 				if (sizeof($this->opData['output']['parts']) > 1) {
666 666
 					$this->debug('more than one output part, so use the method return unchanged');
@@ -673,10 +673,10 @@  discard block
 block discarded – undo
673 673
 			    	//}
674 674
 			    	$opParams = array($this->methodreturn);
675 675
 			    }
676
-			    $return_val = $this->wsdl->serializeRPCParameters($this->methodname,'output',$opParams);
676
+			    $return_val = $this->wsdl->serializeRPCParameters($this->methodname, 'output', $opParams);
677 677
 			    $this->appendDebug($this->wsdl->getDebug());
678 678
 			    $this->wsdl->clearDebug();
679
-				if($errstr = $this->wsdl->getError()){
679
+				if ($errstr = $this->wsdl->getError()) {
680 680
 					$this->debug('got wsdl error: '.$errstr);
681 681
 					$this->fault('SOAP-ENV:Server', 'unable to serialize result');
682 682
 					return;
@@ -695,9 +695,9 @@  discard block
 block discarded – undo
695 695
 
696 696
 		$this->debug('serializing response');
697 697
 		if ($this->wsdl) {
698
-			$this->debug('have WSDL for serialization: style is ' . $this->opData['style']);
698
+			$this->debug('have WSDL for serialization: style is '.$this->opData['style']);
699 699
 			if ($this->opData['style'] == 'rpc') {
700
-				$this->debug('style is rpc for serialization: use is ' . $this->opData['output']['use']);
700
+				$this->debug('style is rpc for serialization: use is '.$this->opData['output']['use']);
701 701
 				if ($this->opData['output']['use'] == 'literal') {
702 702
 					// http://www.ws-i.org/Profiles/BasicProfile-1.1-2004-08-24.html R2735 says rpc/literal accessor elements should not be in a namespace
703 703
 					if ($this->methodURI) {
@@ -721,7 +721,7 @@  discard block
 block discarded – undo
721 721
 			$payload = '<ns1:'.$this->methodname.'Response xmlns:ns1="'.$this->methodURI.'">'.$return_val.'</ns1:'.$this->methodname."Response>";
722 722
 		}
723 723
 		$this->result = 'successful';
724
-		if($this->wsdl){
724
+		if ($this->wsdl) {
725 725
 			//if($this->debug_flag){
726 726
             	$this->appendDebug($this->wsdl->getDebug());
727 727
             //	}
@@ -731,9 +731,9 @@  discard block
 block discarded – undo
731 731
 				$encodingStyle = '';
732 732
 			}
733 733
 			// Added: In case we use a WSDL, return a serialized env. WITH the usedNamespaces.
734
-			$this->responseSOAP = $this->serializeEnvelope($payload,$this->responseHeaders,$this->wsdl->usedNamespaces,$this->opData['style'],$this->opData['output']['use'],$encodingStyle);
734
+			$this->responseSOAP = $this->serializeEnvelope($payload, $this->responseHeaders, $this->wsdl->usedNamespaces, $this->opData['style'], $this->opData['output']['use'], $encodingStyle);
735 735
 		} else {
736
-			$this->responseSOAP = $this->serializeEnvelope($payload,$this->responseHeaders);
736
+			$this->responseSOAP = $this->serializeEnvelope($payload, $this->responseHeaders);
737 737
 		}
738 738
 		$this->debug("Leaving serialize_return");
739 739
 	}
@@ -763,18 +763,18 @@  discard block
 block discarded – undo
763 763
 			// $this->outgoing_headers[] = "Status: 200 OK";
764 764
 		}
765 765
         // add debug data if in debug mode
766
-		if(isset($this->debug_flag) && $this->debug_flag){
766
+		if (isset($this->debug_flag) && $this->debug_flag) {
767 767
         	$payload .= $this->getDebugAsXMLComment();
768 768
         }
769 769
 		$this->outgoing_headers[] = "Server: $this->title Server v$this->version";
770
-		preg_match('/\$Revisio' . 'n: ([^ ]+)/', $this->revision, $rev);
770
+		preg_match('/\$Revisio'.'n: ([^ ]+)/', $this->revision, $rev);
771 771
 		$this->outgoing_headers[] = "X-SOAP-Server: $this->title/$this->version (".$rev[1].")";
772 772
 		// Let the Web server decide about this
773 773
 		//$this->outgoing_headers[] = "Connection: Close\r\n";
774 774
 		$payload = $this->getHTTPBody($payload);
775 775
 		$type = $this->getHTTPContentType();
776 776
 		$charset = $this->getHTTPContentTypeCharset();
777
-		$this->outgoing_headers[] = "Content-Type: $type" . ($charset ? '; charset=' . $charset : '');
777
+		$this->outgoing_headers[] = "Content-Type: $type".($charset ? '; charset='.$charset : '');
778 778
 		//begin code to compress payload - by John
779 779
 		// NOTE: there is no way to know whether the Web server will also compress
780 780
 		// this data.
@@ -811,11 +811,11 @@  discard block
 block discarded – undo
811 811
 		//end code
812 812
 		$this->outgoing_headers[] = "Content-Length: ".strlen($payload);
813 813
 		reset($this->outgoing_headers);
814
-		foreach($this->outgoing_headers as $hdr){
814
+		foreach ($this->outgoing_headers as $hdr) {
815 815
 			header($hdr, false);
816 816
 		}
817 817
 		print $payload;
818
-		$this->response = join("\r\n",$this->outgoing_headers)."\r\n\r\n".$payload;
818
+		$this->response = join("\r\n", $this->outgoing_headers)."\r\n\r\n".$payload;
819 819
 	}
820 820
 
821 821
 	/**
@@ -827,12 +827,12 @@  discard block
 block discarded – undo
827 827
 	* @return	boolean	Whether the operation was found
828 828
 	* @access   private
829 829
 	*/
830
-	function verify_method($operation,$request){
831
-		if(isset($this->wsdl) && is_object($this->wsdl)){
832
-			if($this->wsdl->getOperationData($operation)){
830
+	function verify_method($operation, $request) {
831
+		if (isset($this->wsdl) && is_object($this->wsdl)) {
832
+			if ($this->wsdl->getOperationData($operation)) {
833 833
 				return true;
834 834
 			}
835
-	    } elseif(isset($this->operations[$operation])){
835
+	    } elseif (isset($this->operations[$operation])) {
836 836
 			return true;
837 837
 		}
838 838
 		return false;
@@ -847,7 +847,7 @@  discard block
 block discarded – undo
847 847
 	* @access   private
848 848
 	*/
849 849
     function parseRequest($headers, $data) {
850
-		$this->debug('Entering parseRequest() for data of length ' . strlen($data) . ' headers:');
850
+		$this->debug('Entering parseRequest() for data of length '.strlen($data).' headers:');
851 851
 		$this->appendDebug($this->varDump($headers));
852 852
     	if (!isset($headers['content-type'])) {
853 853
 			$this->setError('Request not of type text/xml (no content-type header)');
@@ -859,8 +859,8 @@  discard block
 block discarded – undo
859 859
 		}
860 860
 		if (strpos($headers['content-type'], '=')) {
861 861
 			$enc = str_replace('"', '', substr(strstr($headers["content-type"], '='), 1));
862
-			$this->debug('Got response encoding: ' . $enc);
863
-			if(preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)){
862
+			$this->debug('Got response encoding: '.$enc);
863
+			if (preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i', $enc)) {
864 864
 				$this->xml_encoding = strtoupper($enc);
865 865
 			} else {
866 866
 				$this->xml_encoding = 'US-ASCII';
@@ -869,16 +869,16 @@  discard block
 block discarded – undo
869 869
 			// should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1
870 870
 			$this->xml_encoding = 'ISO-8859-1';
871 871
 		}
872
-		$this->debug('Use encoding: ' . $this->xml_encoding . ' when creating nusoap_parser');
872
+		$this->debug('Use encoding: '.$this->xml_encoding.' when creating nusoap_parser');
873 873
 		// parse response, get soap parser obj
874
-		$parser = new nusoap_parser($data,$this->xml_encoding,'',$this->decode_utf8);
874
+		$parser = new nusoap_parser($data, $this->xml_encoding, '', $this->decode_utf8);
875 875
 
876 876
 		// parser debug
877 877
 		$this->debug("parser debug: \n".$parser->getDebug());
878 878
 		// if fault occurred during message parsing
879
-		if($err = $parser->getError()){
879
+		if ($err = $parser->getError()) {
880 880
 			$this->result = 'fault: error in msg parsing: '.$err;
881
-			$this->fault('SOAP-ENV:Client',"error in msg parsing:\n".$err);
881
+			$this->fault('SOAP-ENV:Client', "error in msg parsing:\n".$err);
882 882
 		// else successfully parsed request into soapval object
883 883
 		} else {
884 884
 			// get/set methodname
@@ -941,8 +941,8 @@  discard block
 block discarded – undo
941 941
 	* @access   public
942 942
 	* @deprecated
943 943
 	*/
944
-	function add_to_map($methodname,$in,$out){
945
-			$this->operations[$methodname] = array('name' => $methodname,'in' => $in,'out' => $out);
944
+	function add_to_map($methodname, $in, $out) {
945
+			$this->operations[$methodname] = array('name' => $methodname, 'in' => $in, 'out' => $out);
946 946
 	}
947 947
 
948 948
 	/**
@@ -959,13 +959,13 @@  discard block
 block discarded – undo
959 959
 	* @param	string $encodingStyle optional (usually 'http://schemas.xmlsoap.org/soap/encoding/' for encoded)
960 960
 	* @access   public
961 961
 	*/
962
-	function register($name,$in=array(),$out=array(),$namespace=false,$soapaction=false,$style=false,$use=false,$documentation='',$encodingStyle=''){
962
+	function register($name, $in = array(), $out = array(), $namespace = false, $soapaction = false, $style = false, $use = false, $documentation = '', $encodingStyle = '') {
963 963
 		global $HTTP_SERVER_VARS;
964 964
 
965
-		if($this->externalWSDLURL){
965
+		if ($this->externalWSDLURL) {
966 966
 			die('You cannot bind to an external WSDL file, and register methods outside of it! Please choose either WSDL or no WSDL.');
967 967
 		}
968
-		if (! $name) {
968
+		if (!$name) {
969 969
 			die('You must specify a name when you register an operation');
970 970
 		}
971 971
 		if (!is_array($in)) {
@@ -974,9 +974,9 @@  discard block
 block discarded – undo
974 974
 		if (!is_array($out)) {
975 975
 			die('You must provide an array for operation outputs');
976 976
 		}
977
-		if(false == $namespace) {
977
+		if (false == $namespace) {
978 978
 		}
979
-		if(false == $soapaction) {
979
+		if (false == $soapaction) {
980 980
 			if (isset($_SERVER)) {
981 981
 				$SERVER_NAME = $_SERVER['SERVER_NAME'];
982 982
 				$SCRIPT_NAME = isset($_SERVER['PHP_SELF']) ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME'];
@@ -995,10 +995,10 @@  discard block
 block discarded – undo
995 995
         	}
996 996
 			$soapaction = "$SCHEME://$SERVER_NAME$SCRIPT_NAME/$name";
997 997
 		}
998
-		if(false == $style) {
998
+		if (false == $style) {
999 999
 			$style = "rpc";
1000 1000
 		}
1001
-		if(false == $use) {
1001
+		if (false == $use) {
1002 1002
 			$use = "encoded";
1003 1003
 		}
1004 1004
 		if ($use == 'encoded' && $encodingStyle == '') {
@@ -1012,8 +1012,8 @@  discard block
 block discarded – undo
1012 1012
 	    'namespace' => $namespace,
1013 1013
 	    'soapaction' => $soapaction,
1014 1014
 	    'style' => $style);
1015
-        if($this->wsdl){
1016
-        	$this->wsdl->addOperation($name,$in,$out,$namespace,$soapaction,$style,$use,$documentation,$encodingStyle);
1015
+        if ($this->wsdl) {
1016
+        	$this->wsdl->addOperation($name, $in, $out, $namespace, $soapaction, $style, $use, $documentation, $encodingStyle);
1017 1017
 	    }
1018 1018
 		return true;
1019 1019
 	}
@@ -1028,11 +1028,11 @@  discard block
 block discarded – undo
1028 1028
 	* @param	string $faultdetail
1029 1029
 	* @access   public
1030 1030
 	*/
1031
-	function fault($faultcode,$faultstring,$faultactor='',$faultdetail=''){
1031
+	function fault($faultcode, $faultstring, $faultactor = '', $faultdetail = '') {
1032 1032
 		if ($faultdetail == '' && $this->debug_flag) {
1033 1033
 			$faultdetail = $this->getDebug();
1034 1034
 		}
1035
-		$this->fault = new nusoap_fault($faultcode,$faultactor,$faultstring,$faultdetail);
1035
+		$this->fault = new nusoap_fault($faultcode, $faultactor, $faultstring, $faultdetail);
1036 1036
 		$this->fault->soap_defencoding = $this->soap_defencoding;
1037 1037
 	}
1038 1038
 
@@ -1047,7 +1047,7 @@  discard block
 block discarded – undo
1047 1047
     * @param string $transport optional SOAP transport
1048 1048
     * @param mixed $schemaTargetNamespace optional 'types' targetNamespace for service schema or false
1049 1049
     */
1050
-    function configureWSDL($serviceName,$namespace = false,$endpoint = false,$style='rpc', $transport = 'http://schemas.xmlsoap.org/soap/http', $schemaTargetNamespace = false)
1050
+    function configureWSDL($serviceName, $namespace = false, $endpoint = false, $style = 'rpc', $transport = 'http://schemas.xmlsoap.org/soap/http', $schemaTargetNamespace = false)
1051 1051
     {
1052 1052
     	global $HTTP_SERVER_VARS;
1053 1053
 
@@ -1065,20 +1065,20 @@  discard block
 block discarded – undo
1065 1065
 			$this->setError("Neither _SERVER nor HTTP_SERVER_VARS is available");
1066 1066
 		}
1067 1067
 		// If server name has port number attached then strip it (else port number gets duplicated in WSDL output) (occurred using lighttpd and FastCGI)
1068
-		$colon = strpos($SERVER_NAME,":");
1068
+		$colon = strpos($SERVER_NAME, ":");
1069 1069
 		if ($colon) {
1070 1070
 		    $SERVER_NAME = substr($SERVER_NAME, 0, $colon);
1071 1071
 		}
1072 1072
 		if ($SERVER_PORT == 80) {
1073 1073
 			$SERVER_PORT = '';
1074 1074
 		} else {
1075
-			$SERVER_PORT = ':' . $SERVER_PORT;
1075
+			$SERVER_PORT = ':'.$SERVER_PORT;
1076 1076
 		}
1077
-        if(false == $namespace) {
1077
+        if (false == $namespace) {
1078 1078
             $namespace = "http://$SERVER_NAME/soap/$serviceName";
1079 1079
         }
1080 1080
 
1081
-        if(false == $endpoint) {
1081
+        if (false == $endpoint) {
1082 1082
         	if ($HTTPS == '1' || $HTTPS == 'on') {
1083 1083
         		$SCHEME = 'https';
1084 1084
         	} else {
@@ -1087,7 +1087,7 @@  discard block
 block discarded – undo
1087 1087
             $endpoint = "$SCHEME://$SERVER_NAME$SERVER_PORT$SCRIPT_NAME";
1088 1088
         }
1089 1089
 
1090
-        if(false == $schemaTargetNamespace) {
1090
+        if (false == $schemaTargetNamespace) {
1091 1091
             $schemaTargetNamespace = $namespace;
1092 1092
         }
1093 1093
 
Please login to merge, or discard this patch.
main/inc/lib/nusoap/class.soap_fault.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
     * @param string $faultstring human readable error message
46 46
     * @param mixed $faultdetail detail, typically a string or array of string
47 47
 	*/
48
-	function nusoap_fault($faultcode,$faultactor='',$faultstring='',$faultdetail=''){
48
+	function nusoap_fault($faultcode, $faultactor = '', $faultstring = '', $faultdetail = '') {
49 49
 		parent::nusoap_base();
50 50
 		$this->faultcode = $faultcode;
51 51
 		$this->faultactor = $faultactor;
@@ -59,9 +59,9 @@  discard block
 block discarded – undo
59 59
 	* @return	string	The serialization of the fault instance.
60 60
 	* @access   public
61 61
 	*/
62
-	function serialize(){
62
+	function serialize() {
63 63
 		$ns_string = '';
64
-		foreach($this->namespaces as $k => $v){
64
+		foreach ($this->namespaces as $k => $v) {
65 65
 			$ns_string .= "\n  xmlns:$k=\"$v\"";
66 66
 		}
67 67
 		$return_msg =
Please login to merge, or discard this patch.