@@ -33,10 +33,10 @@ discard block |
||
33 | 33 | exit(); |
34 | 34 | } |
35 | 35 | |
36 | -list($year_start,$month_start,$day_start)=explode('-',$infos['date_start']); |
|
37 | -list($year_end,$month_end,$day_end)=explode('-',$infos['date_end']); |
|
36 | +list($year_start, $month_start, $day_start) = explode('-', $infos['date_start']); |
|
37 | +list($year_end, $month_end, $day_end) = explode('-', $infos['date_end']); |
|
38 | 38 | |
39 | -if (!api_is_platform_admin() && $infos['session_admin_id']!=$_user['user_id'] && !api_is_session_admin()) { |
|
39 | +if (!api_is_platform_admin() && $infos['session_admin_id'] != $_user['user_id'] && !api_is_session_admin()) { |
|
40 | 40 | api_not_allowed(true); |
41 | 41 | } |
42 | 42 | |
@@ -73,24 +73,24 @@ discard block |
||
73 | 73 | // display the header |
74 | 74 | Display::display_header($tool_name); |
75 | 75 | if (!empty($return)) { |
76 | - Display::display_error_message($return,false); |
|
76 | + Display::display_error_message($return, false); |
|
77 | 77 | } |
78 | 78 | ?> |
79 | 79 | <div class="row"> |
80 | 80 | <div class="col-md-12"> |
81 | 81 | <form method="post" name="form" action="<?php echo api_get_self(); ?>?id=<?php echo $id; ?>" class="form-horizontal"> |
82 | 82 | <input type="hidden" name="formSent" value="1"> |
83 | - <legend><?php echo $tool_name;?> </legend> |
|
83 | + <legend><?php echo $tool_name; ?> </legend> |
|
84 | 84 | <div class="form-group"> |
85 | 85 | <label class="col-sm-3 control-label"><?php echo get_lang('SessionName') ?></label> |
86 | 86 | <div class="col-sm-6"> |
87 | - <input class="form-control" type="text" name="name" size="50" maxlength="50" value="<?php if($formSent) echo api_htmlentities($name,ENT_QUOTES,$charset); else echo api_htmlentities($infos['name'],ENT_QUOTES,$charset); ?>"> |
|
87 | + <input class="form-control" type="text" name="name" size="50" maxlength="50" value="<?php if ($formSent) echo api_htmlentities($name, ENT_QUOTES, $charset); else echo api_htmlentities($infos['name'], ENT_QUOTES, $charset); ?>"> |
|
88 | 88 | </div> |
89 | 89 | <div class="col-sm-3"></div> |
90 | 90 | </div> |
91 | 91 | <div class="form-group"> |
92 | 92 | <div class="col-sm-offset-3 col-sm-6"> |
93 | - <?php echo get_lang('TheTimeLimitsAreReferential');?> |
|
93 | + <?php echo get_lang('TheTimeLimitsAreReferential'); ?> |
|
94 | 94 | <a href="javascript://" onclick="if(document.getElementById('options').style.display == 'none'){document.getElementById('options').style.display = 'block';}else{document.getElementById('options').style.display = 'none';}"><?php echo get_lang('EditTimeLimit') ?></a> |
95 | 95 | </div> |
96 | 96 | </div> |
@@ -100,58 +100,58 @@ discard block |
||
100 | 100 | <div class="col-sm-6"> |
101 | 101 | <select name="day_start"> |
102 | 102 | <option value="1">01</option> |
103 | - <option value="2" <?php if($day_start == 2) echo 'selected="selected"'; ?> >02</option> |
|
104 | - <option value="3" <?php if($day_start == 3) echo 'selected="selected"'; ?> >03</option> |
|
105 | - <option value="4" <?php if($day_start == 4) echo 'selected="selected"'; ?> >04</option> |
|
106 | - <option value="5" <?php if($day_start == 5) echo 'selected="selected"'; ?> >05</option> |
|
107 | - <option value="6" <?php if($day_start == 6) echo 'selected="selected"'; ?> >06</option> |
|
108 | - <option value="7" <?php if($day_start == 7) echo 'selected="selected"'; ?> >07</option> |
|
109 | - <option value="8" <?php if($day_start == 8) echo 'selected="selected"'; ?> >08</option> |
|
110 | - <option value="9" <?php if($day_start == 9) echo 'selected="selected"'; ?> >09</option> |
|
111 | - <option value="10" <?php if($day_start == 10) echo 'selected="selected"'; ?> >10</option> |
|
112 | - <option value="11" <?php if($day_start == 11) echo 'selected="selected"'; ?> >11</option> |
|
113 | - <option value="12" <?php if($day_start == 12) echo 'selected="selected"'; ?> >12</option> |
|
114 | - <option value="13" <?php if($day_start == 13) echo 'selected="selected"'; ?> >13</option> |
|
115 | - <option value="14" <?php if($day_start == 14) echo 'selected="selected"'; ?> >14</option> |
|
116 | - <option value="15" <?php if($day_start == 15) echo 'selected="selected"'; ?> >15</option> |
|
117 | - <option value="16" <?php if($day_start == 16) echo 'selected="selected"'; ?> >16</option> |
|
118 | - <option value="17" <?php if($day_start == 17) echo 'selected="selected"'; ?> >17</option> |
|
119 | - <option value="18" <?php if($day_start == 18) echo 'selected="selected"'; ?> >18</option> |
|
120 | - <option value="19" <?php if($day_start == 19) echo 'selected="selected"'; ?> >19</option> |
|
121 | - <option value="20" <?php if($day_start == 20) echo 'selected="selected"'; ?> >20</option> |
|
122 | - <option value="21" <?php if($day_start == 21) echo 'selected="selected"'; ?> >21</option> |
|
123 | - <option value="22" <?php if($day_start == 22) echo 'selected="selected"'; ?> >22</option> |
|
124 | - <option value="23" <?php if($day_start == 23) echo 'selected="selected"'; ?> >23</option> |
|
125 | - <option value="24" <?php if($day_start == 24) echo 'selected="selected"'; ?> >24</option> |
|
126 | - <option value="25" <?php if($day_start == 25) echo 'selected="selected"'; ?> >25</option> |
|
127 | - <option value="26" <?php if($day_start == 26) echo 'selected="selected"'; ?> >26</option> |
|
128 | - <option value="27" <?php if($day_start == 27) echo 'selected="selected"'; ?> >27</option> |
|
129 | - <option value="28" <?php if($day_start == 28) echo 'selected="selected"'; ?> >28</option> |
|
130 | - <option value="29" <?php if($day_start == 29) echo 'selected="selected"'; ?> >29</option> |
|
131 | - <option value="30" <?php if($day_start == 30) echo 'selected="selected"'; ?> >30</option> |
|
132 | - <option value="31" <?php if($day_start == 31) echo 'selected="selected"'; ?> >31</option> |
|
103 | + <option value="2" <?php if ($day_start == 2) echo 'selected="selected"'; ?> >02</option> |
|
104 | + <option value="3" <?php if ($day_start == 3) echo 'selected="selected"'; ?> >03</option> |
|
105 | + <option value="4" <?php if ($day_start == 4) echo 'selected="selected"'; ?> >04</option> |
|
106 | + <option value="5" <?php if ($day_start == 5) echo 'selected="selected"'; ?> >05</option> |
|
107 | + <option value="6" <?php if ($day_start == 6) echo 'selected="selected"'; ?> >06</option> |
|
108 | + <option value="7" <?php if ($day_start == 7) echo 'selected="selected"'; ?> >07</option> |
|
109 | + <option value="8" <?php if ($day_start == 8) echo 'selected="selected"'; ?> >08</option> |
|
110 | + <option value="9" <?php if ($day_start == 9) echo 'selected="selected"'; ?> >09</option> |
|
111 | + <option value="10" <?php if ($day_start == 10) echo 'selected="selected"'; ?> >10</option> |
|
112 | + <option value="11" <?php if ($day_start == 11) echo 'selected="selected"'; ?> >11</option> |
|
113 | + <option value="12" <?php if ($day_start == 12) echo 'selected="selected"'; ?> >12</option> |
|
114 | + <option value="13" <?php if ($day_start == 13) echo 'selected="selected"'; ?> >13</option> |
|
115 | + <option value="14" <?php if ($day_start == 14) echo 'selected="selected"'; ?> >14</option> |
|
116 | + <option value="15" <?php if ($day_start == 15) echo 'selected="selected"'; ?> >15</option> |
|
117 | + <option value="16" <?php if ($day_start == 16) echo 'selected="selected"'; ?> >16</option> |
|
118 | + <option value="17" <?php if ($day_start == 17) echo 'selected="selected"'; ?> >17</option> |
|
119 | + <option value="18" <?php if ($day_start == 18) echo 'selected="selected"'; ?> >18</option> |
|
120 | + <option value="19" <?php if ($day_start == 19) echo 'selected="selected"'; ?> >19</option> |
|
121 | + <option value="20" <?php if ($day_start == 20) echo 'selected="selected"'; ?> >20</option> |
|
122 | + <option value="21" <?php if ($day_start == 21) echo 'selected="selected"'; ?> >21</option> |
|
123 | + <option value="22" <?php if ($day_start == 22) echo 'selected="selected"'; ?> >22</option> |
|
124 | + <option value="23" <?php if ($day_start == 23) echo 'selected="selected"'; ?> >23</option> |
|
125 | + <option value="24" <?php if ($day_start == 24) echo 'selected="selected"'; ?> >24</option> |
|
126 | + <option value="25" <?php if ($day_start == 25) echo 'selected="selected"'; ?> >25</option> |
|
127 | + <option value="26" <?php if ($day_start == 26) echo 'selected="selected"'; ?> >26</option> |
|
128 | + <option value="27" <?php if ($day_start == 27) echo 'selected="selected"'; ?> >27</option> |
|
129 | + <option value="28" <?php if ($day_start == 28) echo 'selected="selected"'; ?> >28</option> |
|
130 | + <option value="29" <?php if ($day_start == 29) echo 'selected="selected"'; ?> >29</option> |
|
131 | + <option value="30" <?php if ($day_start == 30) echo 'selected="selected"'; ?> >30</option> |
|
132 | + <option value="31" <?php if ($day_start == 31) echo 'selected="selected"'; ?> >31</option> |
|
133 | 133 | </select> |
134 | 134 | / |
135 | 135 | <select name="month_start"> |
136 | 136 | <option value="1">01</option> |
137 | - <option value="2" <?php if($month_start == 2) echo 'selected="selected"'; ?> >02</option> |
|
138 | - <option value="3" <?php if($month_start == 3) echo 'selected="selected"'; ?> >03</option> |
|
139 | - <option value="4" <?php if($month_start == 4) echo 'selected="selected"'; ?> >04</option> |
|
140 | - <option value="5" <?php if($month_start == 5) echo 'selected="selected"'; ?> >05</option> |
|
141 | - <option value="6" <?php if($month_start == 6) echo 'selected="selected"'; ?> >06</option> |
|
142 | - <option value="7" <?php if($month_start == 7) echo 'selected="selected"'; ?> >07</option> |
|
143 | - <option value="8" <?php if($month_start == 8) echo 'selected="selected"'; ?> >08</option> |
|
144 | - <option value="9" <?php if($month_start == 9) echo 'selected="selected"'; ?> >09</option> |
|
145 | - <option value="10" <?php if($month_start == 10) echo 'selected="selected"'; ?> >10</option> |
|
146 | - <option value="11" <?php if($month_start == 11) echo 'selected="selected"'; ?> >11</option> |
|
147 | - <option value="12" <?php if($month_start == 12) echo 'selected="selected"'; ?> >12</option> |
|
137 | + <option value="2" <?php if ($month_start == 2) echo 'selected="selected"'; ?> >02</option> |
|
138 | + <option value="3" <?php if ($month_start == 3) echo 'selected="selected"'; ?> >03</option> |
|
139 | + <option value="4" <?php if ($month_start == 4) echo 'selected="selected"'; ?> >04</option> |
|
140 | + <option value="5" <?php if ($month_start == 5) echo 'selected="selected"'; ?> >05</option> |
|
141 | + <option value="6" <?php if ($month_start == 6) echo 'selected="selected"'; ?> >06</option> |
|
142 | + <option value="7" <?php if ($month_start == 7) echo 'selected="selected"'; ?> >07</option> |
|
143 | + <option value="8" <?php if ($month_start == 8) echo 'selected="selected"'; ?> >08</option> |
|
144 | + <option value="9" <?php if ($month_start == 9) echo 'selected="selected"'; ?> >09</option> |
|
145 | + <option value="10" <?php if ($month_start == 10) echo 'selected="selected"'; ?> >10</option> |
|
146 | + <option value="11" <?php if ($month_start == 11) echo 'selected="selected"'; ?> >11</option> |
|
147 | + <option value="12" <?php if ($month_start == 12) echo 'selected="selected"'; ?> >12</option> |
|
148 | 148 | </select> |
149 | 149 | / |
150 | 150 | <select name="year_start"> |
151 | 151 | <?php |
152 | - for($i=$thisYear-5;$i <= ($thisYear+5);$i++) |
|
152 | + for ($i = $thisYear - 5; $i <= ($thisYear + 5); $i++) |
|
153 | 153 | { ?> |
154 | - <option value="<?php echo $i; ?>" <?php if($year_start == $i) echo 'selected="selected"'; ?> ><?php echo $i; ?></option> |
|
154 | + <option value="<?php echo $i; ?>" <?php if ($year_start == $i) echo 'selected="selected"'; ?> ><?php echo $i; ?></option> |
|
155 | 155 | <?php |
156 | 156 | } ?> |
157 | 157 | </select> |
@@ -163,61 +163,61 @@ discard block |
||
163 | 163 | <div class="col-sm-6"> |
164 | 164 | <select name="day_end"> |
165 | 165 | <option value="0">--</option> |
166 | - <option value="1" <?php if($day_end == 1) echo 'selected="selected"'; ?> >01</option> |
|
167 | - <option value="2" <?php if($day_end == 2) echo 'selected="selected"'; ?> >02</option> |
|
168 | - <option value="3" <?php if($day_end == 3) echo 'selected="selected"'; ?> >03</option> |
|
169 | - <option value="4" <?php if($day_end == 4) echo 'selected="selected"'; ?> >04</option> |
|
170 | - <option value="5" <?php if($day_end == 5) echo 'selected="selected"'; ?> >05</option> |
|
171 | - <option value="6" <?php if($day_end == 6) echo 'selected="selected"'; ?> >06</option> |
|
172 | - <option value="7" <?php if($day_end == 7) echo 'selected="selected"'; ?> >07</option> |
|
173 | - <option value="8" <?php if($day_end == 8) echo 'selected="selected"'; ?> >08</option> |
|
174 | - <option value="9" <?php if($day_end == 9) echo 'selected="selected"'; ?> >09</option> |
|
175 | - <option value="10" <?php if($day_end == 10) echo 'selected="selected"'; ?> >10</option> |
|
176 | - <option value="11" <?php if($day_end == 11) echo 'selected="selected"'; ?> >11</option> |
|
177 | - <option value="12" <?php if($day_end == 12) echo 'selected="selected"'; ?> >12</option> |
|
178 | - <option value="13" <?php if($day_end == 13) echo 'selected="selected"'; ?> >13</option> |
|
179 | - <option value="14" <?php if($day_end == 14) echo 'selected="selected"'; ?> >14</option> |
|
180 | - <option value="15" <?php if($day_end == 15) echo 'selected="selected"'; ?> >15</option> |
|
181 | - <option value="16" <?php if($day_end == 16) echo 'selected="selected"'; ?> >16</option> |
|
182 | - <option value="17" <?php if($day_end == 17) echo 'selected="selected"'; ?> >17</option> |
|
183 | - <option value="18" <?php if($day_end == 18) echo 'selected="selected"'; ?> >18</option> |
|
184 | - <option value="19" <?php if($day_end == 19) echo 'selected="selected"'; ?> >19</option> |
|
185 | - <option value="20" <?php if($day_end == 20) echo 'selected="selected"'; ?> >20</option> |
|
186 | - <option value="21" <?php if($day_end == 21) echo 'selected="selected"'; ?> >21</option> |
|
187 | - <option value="22" <?php if($day_end == 22) echo 'selected="selected"'; ?> >22</option> |
|
188 | - <option value="23" <?php if($day_end == 23) echo 'selected="selected"'; ?> >23</option> |
|
189 | - <option value="24" <?php if($day_end == 24) echo 'selected="selected"'; ?> >24</option> |
|
190 | - <option value="25" <?php if($day_end == 25) echo 'selected="selected"'; ?> >25</option> |
|
191 | - <option value="26" <?php if($day_end == 26) echo 'selected="selected"'; ?> >26</option> |
|
192 | - <option value="27" <?php if($day_end == 27) echo 'selected="selected"'; ?> >27</option> |
|
193 | - <option value="28" <?php if($day_end == 28) echo 'selected="selected"'; ?> >28</option> |
|
194 | - <option value="29" <?php if($day_end == 29) echo 'selected="selected"'; ?> >29</option> |
|
195 | - <option value="30" <?php if($day_end == 30) echo 'selected="selected"'; ?> >30</option> |
|
196 | - <option value="31" <?php if($day_end == 31) echo 'selected="selected"'; ?> >31</option> |
|
166 | + <option value="1" <?php if ($day_end == 1) echo 'selected="selected"'; ?> >01</option> |
|
167 | + <option value="2" <?php if ($day_end == 2) echo 'selected="selected"'; ?> >02</option> |
|
168 | + <option value="3" <?php if ($day_end == 3) echo 'selected="selected"'; ?> >03</option> |
|
169 | + <option value="4" <?php if ($day_end == 4) echo 'selected="selected"'; ?> >04</option> |
|
170 | + <option value="5" <?php if ($day_end == 5) echo 'selected="selected"'; ?> >05</option> |
|
171 | + <option value="6" <?php if ($day_end == 6) echo 'selected="selected"'; ?> >06</option> |
|
172 | + <option value="7" <?php if ($day_end == 7) echo 'selected="selected"'; ?> >07</option> |
|
173 | + <option value="8" <?php if ($day_end == 8) echo 'selected="selected"'; ?> >08</option> |
|
174 | + <option value="9" <?php if ($day_end == 9) echo 'selected="selected"'; ?> >09</option> |
|
175 | + <option value="10" <?php if ($day_end == 10) echo 'selected="selected"'; ?> >10</option> |
|
176 | + <option value="11" <?php if ($day_end == 11) echo 'selected="selected"'; ?> >11</option> |
|
177 | + <option value="12" <?php if ($day_end == 12) echo 'selected="selected"'; ?> >12</option> |
|
178 | + <option value="13" <?php if ($day_end == 13) echo 'selected="selected"'; ?> >13</option> |
|
179 | + <option value="14" <?php if ($day_end == 14) echo 'selected="selected"'; ?> >14</option> |
|
180 | + <option value="15" <?php if ($day_end == 15) echo 'selected="selected"'; ?> >15</option> |
|
181 | + <option value="16" <?php if ($day_end == 16) echo 'selected="selected"'; ?> >16</option> |
|
182 | + <option value="17" <?php if ($day_end == 17) echo 'selected="selected"'; ?> >17</option> |
|
183 | + <option value="18" <?php if ($day_end == 18) echo 'selected="selected"'; ?> >18</option> |
|
184 | + <option value="19" <?php if ($day_end == 19) echo 'selected="selected"'; ?> >19</option> |
|
185 | + <option value="20" <?php if ($day_end == 20) echo 'selected="selected"'; ?> >20</option> |
|
186 | + <option value="21" <?php if ($day_end == 21) echo 'selected="selected"'; ?> >21</option> |
|
187 | + <option value="22" <?php if ($day_end == 22) echo 'selected="selected"'; ?> >22</option> |
|
188 | + <option value="23" <?php if ($day_end == 23) echo 'selected="selected"'; ?> >23</option> |
|
189 | + <option value="24" <?php if ($day_end == 24) echo 'selected="selected"'; ?> >24</option> |
|
190 | + <option value="25" <?php if ($day_end == 25) echo 'selected="selected"'; ?> >25</option> |
|
191 | + <option value="26" <?php if ($day_end == 26) echo 'selected="selected"'; ?> >26</option> |
|
192 | + <option value="27" <?php if ($day_end == 27) echo 'selected="selected"'; ?> >27</option> |
|
193 | + <option value="28" <?php if ($day_end == 28) echo 'selected="selected"'; ?> >28</option> |
|
194 | + <option value="29" <?php if ($day_end == 29) echo 'selected="selected"'; ?> >29</option> |
|
195 | + <option value="30" <?php if ($day_end == 30) echo 'selected="selected"'; ?> >30</option> |
|
196 | + <option value="31" <?php if ($day_end == 31) echo 'selected="selected"'; ?> >31</option> |
|
197 | 197 | </select> |
198 | 198 | / |
199 | 199 | <select name="month_end"> |
200 | 200 | <option value="0">--</option> |
201 | - <option value="1" <?php if($month_end == 1) echo 'selected="selected"'; ?> >01</option> |
|
202 | - <option value="2" <?php if($month_end == 2) echo 'selected="selected"'; ?> >02</option> |
|
203 | - <option value="3" <?php if($month_end == 3) echo 'selected="selected"'; ?> >03</option> |
|
204 | - <option value="4" <?php if($month_end == 4) echo 'selected="selected"'; ?> >04</option> |
|
205 | - <option value="5" <?php if($month_end == 5) echo 'selected="selected"'; ?> >05</option> |
|
206 | - <option value="6" <?php if($month_end == 6) echo 'selected="selected"'; ?> >06</option> |
|
207 | - <option value="7" <?php if($month_end == 7) echo 'selected="selected"'; ?> >07</option> |
|
208 | - <option value="8" <?php if($month_end == 8) echo 'selected="selected"'; ?> >08</option> |
|
209 | - <option value="9" <?php if($month_end == 9) echo 'selected="selected"'; ?> >09</option> |
|
210 | - <option value="10" <?php if($month_end == 10) echo 'selected="selected"'; ?> >10</option> |
|
211 | - <option value="11" <?php if($month_end == 11) echo 'selected="selected"'; ?> >11</option> |
|
212 | - <option value="12" <?php if($month_end == 12) echo 'selected="selected"'; ?> >12</option> |
|
201 | + <option value="1" <?php if ($month_end == 1) echo 'selected="selected"'; ?> >01</option> |
|
202 | + <option value="2" <?php if ($month_end == 2) echo 'selected="selected"'; ?> >02</option> |
|
203 | + <option value="3" <?php if ($month_end == 3) echo 'selected="selected"'; ?> >03</option> |
|
204 | + <option value="4" <?php if ($month_end == 4) echo 'selected="selected"'; ?> >04</option> |
|
205 | + <option value="5" <?php if ($month_end == 5) echo 'selected="selected"'; ?> >05</option> |
|
206 | + <option value="6" <?php if ($month_end == 6) echo 'selected="selected"'; ?> >06</option> |
|
207 | + <option value="7" <?php if ($month_end == 7) echo 'selected="selected"'; ?> >07</option> |
|
208 | + <option value="8" <?php if ($month_end == 8) echo 'selected="selected"'; ?> >08</option> |
|
209 | + <option value="9" <?php if ($month_end == 9) echo 'selected="selected"'; ?> >09</option> |
|
210 | + <option value="10" <?php if ($month_end == 10) echo 'selected="selected"'; ?> >10</option> |
|
211 | + <option value="11" <?php if ($month_end == 11) echo 'selected="selected"'; ?> >11</option> |
|
212 | + <option value="12" <?php if ($month_end == 12) echo 'selected="selected"'; ?> >12</option> |
|
213 | 213 | </select> |
214 | 214 | / |
215 | 215 | <select name="year_end"> |
216 | 216 | <option value="0">----</option> |
217 | 217 | <?php |
218 | - for($i=$thisYear-5;$i <= ($thisYear+5);$i++) |
|
218 | + for ($i = $thisYear - 5; $i <= ($thisYear + 5); $i++) |
|
219 | 219 | { ?> |
220 | - <option value="<?php echo $i; ?>" <?php if($year_end == $i) echo 'selected="selected"'; ?> ><?php echo $i; ?></option> |
|
220 | + <option value="<?php echo $i; ?>" <?php if ($year_end == $i) echo 'selected="selected"'; ?> ><?php echo $i; ?></option> |
|
221 | 221 | <?php |
222 | 222 | } ?> |
223 | 223 | </select> |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | |
239 | 239 | |
240 | 240 | <script> |
241 | -<?php if($year_start=="0000") echo "setDisable(document.form.nolimit);\r\n"; ?> |
|
241 | +<?php if ($year_start == "0000") echo "setDisable(document.form.nolimit);\r\n"; ?> |
|
242 | 242 | function setDisable(select){ |
243 | 243 | document.form.day_start.disabled = (select.checked) ? true : false; |
244 | 244 | document.form.month_start.disabled = (select.checked) ? true : false; |
@@ -22,9 +22,9 @@ discard block |
||
22 | 22 | |
23 | 23 | // setting breadcrumbs |
24 | 24 | if (api_is_platform_admin()) { |
25 | - $interbreadcrumb[] = array('url' => 'index.php','name' => get_lang('PlatformAdmin')); |
|
26 | - $interbreadcrumb[] = array('url' => 'session_list.php','name' => get_lang('SessionList')); |
|
27 | - $interbreadcrumb[] = array('url' => "resume_session.php?id_session=".$id_session,"name" => get_lang('SessionOverview')); |
|
25 | + $interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin')); |
|
26 | + $interbreadcrumb[] = array('url' => 'session_list.php', 'name' => get_lang('SessionList')); |
|
27 | + $interbreadcrumb[] = array('url' => "resume_session.php?id_session=".$id_session, "name" => get_lang('SessionOverview')); |
|
28 | 28 | } |
29 | 29 | $allowTutors = api_get_setting('allow_tutors_to_assign_students_to_session'); |
30 | 30 | $extra_field_list = []; |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | $tool_name = get_lang('SubscribeUsersToSession'); |
40 | 40 | $add_type = 'unique'; |
41 | 41 | |
42 | - if (isset($_REQUEST['add_type']) && $_REQUEST['add_type']!='') { |
|
42 | + if (isset($_REQUEST['add_type']) && $_REQUEST['add_type'] != '') { |
|
43 | 43 | $add_type = Security::remove_XSS($_REQUEST['add_type']); |
44 | 44 | } |
45 | 45 | |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | if (is_array($extra_field_list)) { |
52 | 52 | foreach ($extra_field_list as $extra_field) { |
53 | 53 | //if is enabled to filter and is a "<select>" field type |
54 | - if ($extra_field[8]==1 && $extra_field[2]==4 ) { |
|
54 | + if ($extra_field[8] == 1 && $extra_field[2] == 4) { |
|
55 | 55 | $new_field_list[] = array( |
56 | 56 | 'name' => $extra_field[3], |
57 | 57 | 'variable' => $extra_field[1], |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | if (!empty($needle) && !empty($type)) { |
75 | 75 | |
76 | 76 | //normal behaviour |
77 | - if ($type == 'any_session' && $needle == 'false') { |
|
77 | + if ($type == 'any_session' && $needle == 'false') { |
|
78 | 78 | $type = 'multiple'; |
79 | 79 | $needle = ''; |
80 | 80 | } |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | $cond_user_id = ''; |
89 | 89 | |
90 | 90 | //Only for single & multiple |
91 | - if (in_array($type, array('single','multiple'))) { |
|
91 | + if (in_array($type, array('single', 'multiple'))) { |
|
92 | 92 | if (!empty($id_session)) { |
93 | 93 | $id_session = intval($id_session); |
94 | 94 | // check id_user from session_rel_user table |
@@ -98,11 +98,11 @@ discard block |
||
98 | 98 | $user_ids = array(); |
99 | 99 | if (Database::num_rows($res) > 0) { |
100 | 100 | while ($row = Database::fetch_row($res)) { |
101 | - $user_ids[] = (int)$row[0]; |
|
101 | + $user_ids[] = (int) $row[0]; |
|
102 | 102 | } |
103 | 103 | } |
104 | 104 | if (count($user_ids) > 0) { |
105 | - $cond_user_id = ' AND user.user_id NOT IN('.implode(",",$user_ids).')'; |
|
105 | + $cond_user_id = ' AND user.user_id NOT IN('.implode(",", $user_ids).')'; |
|
106 | 106 | } |
107 | 107 | } |
108 | 108 | } |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | break; |
139 | 139 | } |
140 | 140 | if (api_is_multiple_url_enabled()) { |
141 | - $tbl_user_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
141 | + $tbl_user_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
142 | 142 | $access_url_id = api_get_current_access_url_id(); |
143 | 143 | if ($access_url_id != -1) { |
144 | 144 | switch ($type) { |
@@ -183,11 +183,11 @@ discard block |
||
183 | 183 | } |
184 | 184 | |
185 | 185 | $rs = Database::query($sql); |
186 | - $i=0; |
|
186 | + $i = 0; |
|
187 | 187 | if ($type == 'single') { |
188 | 188 | while ($user = Database::fetch_array($rs)) { |
189 | 189 | $i++; |
190 | - if ($i<=10) { |
|
190 | + if ($i <= 10) { |
|
191 | 191 | $person_name = api_get_person_name($user['firstname'], $user['lastname']); |
192 | 192 | $return .= '<a href="javascript: void(0);" onclick="javascript: add_user_to_session(\''.$user['user_id'].'\',\''.$person_name.' ('.$user['username'].')'.'\')">'.$person_name.' ('.$user['username'].')</a><br />'; |
193 | 193 | } else { |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | } |
196 | 196 | } |
197 | 197 | |
198 | - $xajax_response -> addAssign('ajax_list_users_single','innerHTML',api_utf8_encode($return)); |
|
198 | + $xajax_response -> addAssign('ajax_list_users_single', 'innerHTML', api_utf8_encode($return)); |
|
199 | 199 | } else { |
200 | 200 | $return .= '<select id="origin_users" name="nosessionUsersList[]" multiple="multiple" size="15" style="width:360px;">'; |
201 | 201 | while ($user = Database :: fetch_array($rs)) { |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | $return .= '<option value="'.$user['user_id'].'">'.$person_name.' ('.$user['username'].')</option>'; |
204 | 204 | } |
205 | 205 | $return .= '</select>'; |
206 | - $xajax_response -> addAssign('ajax_list_users_multiple','innerHTML',api_utf8_encode($return)); |
|
206 | + $xajax_response -> addAssign('ajax_list_users_multiple', 'innerHTML', api_utf8_encode($return)); |
|
207 | 207 | } |
208 | 208 | } |
209 | 209 | |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | </script>'; |
261 | 261 | |
262 | 262 | $form_sent = 0; |
263 | - $firstLetterUser = $firstLetterSession=''; |
|
263 | + $firstLetterUser = $firstLetterSession = ''; |
|
264 | 264 | $UserList = $SessionList = array(); |
265 | 265 | $sessions = array(); |
266 | 266 | $noPHP_SELF = true; |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | $UserList = $_POST['sessionUsersList']; |
273 | 273 | |
274 | 274 | if (!is_array($UserList)) { |
275 | - $UserList=array(); |
|
275 | + $UserList = array(); |
|
276 | 276 | } |
277 | 277 | |
278 | 278 | if ($form_sent == 1) { |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | WHERE u.status <> ".DRH." AND u.status<>6 $order_clause"; |
303 | 303 | |
304 | 304 | if (api_is_multiple_url_enabled()) { |
305 | - $tbl_user_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
305 | + $tbl_user_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
306 | 306 | $access_url_id = api_get_current_access_url_id(); |
307 | 307 | if ($access_url_id != -1) { |
308 | 308 | $sql = "SELECT u.user_id, lastname, firstname, username, session_id |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | $result = Database::query($sql); |
322 | 322 | $users = Database::store_result($result); |
323 | 323 | foreach ($users as $user) { |
324 | - $sessionUsersList[$user['user_id']] = $user ; |
|
324 | + $sessionUsersList[$user['user_id']] = $user; |
|
325 | 325 | } |
326 | 326 | unset($users); //clean to free memory |
327 | 327 | } else { |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | foreach ($new_field_list as $new_field) { |
334 | 334 | $varname = 'field_'.$new_field['variable']; |
335 | 335 | if (UserManager::is_extra_field_available($new_field['variable'])) { |
336 | - if (isset($_POST[$varname]) && $_POST[$varname]!='0') { |
|
336 | + if (isset($_POST[$varname]) && $_POST[$varname] != '0') { |
|
337 | 337 | $use_extra_fields = true; |
338 | 338 | $extra_field_result[] = UserManager::get_extra_user_data_by_value( |
339 | 339 | $new_field['variable'], |
@@ -347,9 +347,9 @@ discard block |
||
347 | 347 | |
348 | 348 | if ($use_extra_fields) { |
349 | 349 | $final_result = array(); |
350 | - if (count($extra_field_result)>1) { |
|
351 | - for($i=0;$i<count($extra_field_result)-1;$i++) { |
|
352 | - if (is_array($extra_field_result[$i+1])) { |
|
350 | + if (count($extra_field_result) > 1) { |
|
351 | + for ($i = 0; $i < count($extra_field_result) - 1; $i++) { |
|
352 | + if (is_array($extra_field_result[$i + 1])) { |
|
353 | 353 | $final_result = array_intersect( |
354 | 354 | $extra_field_result[$i], |
355 | 355 | $extra_field_result[$i + 1] |
@@ -360,17 +360,17 @@ discard block |
||
360 | 360 | $final_result = $extra_field_result[0]; |
361 | 361 | } |
362 | 362 | |
363 | - $where_filter =''; |
|
363 | + $where_filter = ''; |
|
364 | 364 | if (api_is_multiple_url_enabled()) { |
365 | - if (is_array($final_result) && count($final_result)>0) { |
|
366 | - $where_filter = " AND u.user_id IN ('".implode("','",$final_result)."') "; |
|
365 | + if (is_array($final_result) && count($final_result) > 0) { |
|
366 | + $where_filter = " AND u.user_id IN ('".implode("','", $final_result)."') "; |
|
367 | 367 | } else { |
368 | 368 | //no results |
369 | 369 | $where_filter = " AND u.user_id = -1"; |
370 | 370 | } |
371 | 371 | } else { |
372 | - if (is_array($final_result) && count($final_result)>0) { |
|
373 | - $where_filter = " WHERE u.user_id IN ('".implode("','",$final_result)."') "; |
|
372 | + if (is_array($final_result) && count($final_result) > 0) { |
|
373 | + $where_filter = " WHERE u.user_id IN ('".implode("','", $final_result)."') "; |
|
374 | 374 | } else { |
375 | 375 | //no results |
376 | 376 | $where_filter = " WHERE u.user_id = -1"; |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | $order_clause"; |
400 | 400 | } |
401 | 401 | if (api_is_multiple_url_enabled()) { |
402 | - $tbl_user_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
402 | + $tbl_user_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
403 | 403 | $access_url_id = api_get_current_access_url_id(); |
404 | 404 | if ($access_url_id != -1) { |
405 | 405 | $sql = "SELECT u.user_id, lastname, firstname, username, session_id |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | } |
417 | 417 | |
418 | 418 | $result = Database::query($sql); |
419 | - $users = Database::store_result($result,'ASSOC'); |
|
419 | + $users = Database::store_result($result, 'ASSOC'); |
|
420 | 420 | |
421 | 421 | foreach ($users as $uid => $user) { |
422 | 422 | if ($user['session_id'] != $id_session) { |
@@ -441,7 +441,7 @@ discard block |
||
441 | 441 | WHERE u.status <> ".DRH." AND u.status<>6 $order_clause"; |
442 | 442 | |
443 | 443 | if (api_is_multiple_url_enabled()) { |
444 | - $tbl_user_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
444 | + $tbl_user_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
445 | 445 | $access_url_id = api_get_current_access_url_id(); |
446 | 446 | if ($access_url_id != -1) { |
447 | 447 | $sql = "SELECT u.user_id, lastname, firstname, username, session_id |
@@ -457,11 +457,11 @@ discard block |
||
457 | 457 | } |
458 | 458 | } |
459 | 459 | $result = Database::query($sql); |
460 | - $users = Database::store_result($result,'ASSOC'); |
|
460 | + $users = Database::store_result($result, 'ASSOC'); |
|
461 | 461 | foreach ($users as $uid => $user) { |
462 | 462 | if ($user['session_id'] == $id_session) { |
463 | 463 | $sessionUsersList[$user['user_id']] = $user; |
464 | - if (array_key_exists($user['user_id'],$nosessionUsersList)) { |
|
464 | + if (array_key_exists($user['user_id'], $nosessionUsersList)) { |
|
465 | 465 | unset($nosessionUsersList[$user['user_id']]); |
466 | 466 | } |
467 | 467 | } |
@@ -483,20 +483,20 @@ discard block |
||
483 | 483 | <div class="actions"> |
484 | 484 | <?php echo $link_add_type_unique ?> | <?php echo $link_add_type_multiple ?> | <?php echo $link_add_group; ?> |
485 | 485 | </div> |
486 | - <form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?page=<?php echo $page; ?>&id_session=<?php echo $id_session; ?><?php if(!empty($_GET['add'])) echo '&add=true' ; ?>" style="margin:0px;" <?php if($ajax_search){echo ' onsubmit="valide();"';}?>> |
|
487 | - <?php echo '<legend>'.$tool_name.' (' . $session->getName() . ') </legend>'; ?> |
|
486 | + <form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?page=<?php echo $page; ?>&id_session=<?php echo $id_session; ?><?php if (!empty($_GET['add'])) echo '&add=true'; ?>" style="margin:0px;" <?php if ($ajax_search) {echo ' onsubmit="valide();"'; }?>> |
|
487 | + <?php echo '<legend>'.$tool_name.' ('.$session->getName().') </legend>'; ?> |
|
488 | 488 | <?php |
489 | 489 | if ($add_type === 'multiple') { |
490 | 490 | if (is_array($extra_field_list)) { |
491 | - if (is_array($new_field_list) && count($new_field_list)>0 ) { |
|
491 | + if (is_array($new_field_list) && count($new_field_list) > 0) { |
|
492 | 492 | echo '<h3>'.get_lang('FilterUsers').'</h3>'; |
493 | 493 | foreach ($new_field_list as $new_field) { |
494 | 494 | echo $new_field['name']; |
495 | 495 | $varname = 'field_'.$new_field['variable']; |
496 | 496 | echo ' <select name="'.$varname.'">'; |
497 | 497 | echo '<option value="0">--'.get_lang('Select').'--</option>'; |
498 | - foreach ($new_field['data'] as $option) { |
|
499 | - $checked=''; |
|
498 | + foreach ($new_field['data'] as $option) { |
|
499 | + $checked = ''; |
|
500 | 500 | if (isset($_POST[$varname])) { |
501 | 501 | if ($_POST[$varname] == $option[1]) { |
502 | 502 | $checked = 'selected="true"'; |
@@ -544,7 +544,7 @@ discard block |
||
544 | 544 | <?php |
545 | 545 | foreach ($nosessionUsersList as $uid => $enreg) { |
546 | 546 | ?> |
547 | - <option value="<?php echo $uid; ?>" <?php if(in_array($uid,$UserList)) echo 'selected="selected"'; ?>><?php echo api_get_person_name($enreg['fn'], $enreg['ln']).' ('.$enreg['un'].')'; ?></option> |
|
547 | + <option value="<?php echo $uid; ?>" <?php if (in_array($uid, $UserList)) echo 'selected="selected"'; ?>><?php echo api_get_person_name($enreg['fn'], $enreg['ln']).' ('.$enreg['un'].')'; ?></option> |
|
548 | 548 | <?php |
549 | 549 | } |
550 | 550 | ?> |
@@ -596,7 +596,7 @@ discard block |
||
596 | 596 | </div> |
597 | 597 | <select id="destination_users" name="sessionUsersList[]" multiple="multiple" size="15" class="span5"> |
598 | 598 | <?php |
599 | - foreach($sessionUsersList as $enreg) { |
|
599 | + foreach ($sessionUsersList as $enreg) { |
|
600 | 600 | ?> |
601 | 601 | <option value="<?php echo $enreg['user_id']; ?>"><?php echo api_get_person_name($enreg['firstname'], $enreg['lastname']).' ('.$enreg['username'].')'; ?></option> |
602 | 602 | <?php |
@@ -45,13 +45,13 @@ discard block |
||
45 | 45 | var $proxypassword = ''; |
46 | 46 | var $timeout = 0; |
47 | 47 | var $response_timeout = 30; |
48 | - var $curl_options = array(); // User-specified cURL options |
|
49 | - var $use_curl = false; // whether to always try to use cURL |
|
48 | + var $curl_options = array(); // User-specified cURL options |
|
49 | + var $use_curl = false; // whether to always try to use cURL |
|
50 | 50 | // for HTTP authentication |
51 | - var $username = ''; // Username for HTTP authentication |
|
52 | - var $password = ''; // Password for HTTP authentication |
|
53 | - var $authtype = ''; // Type of HTTP authentication |
|
54 | - var $certRequest = array(); // Certificate for HTTP SSL authentication |
|
51 | + var $username = ''; // Username for HTTP authentication |
|
52 | + var $password = ''; // Password for HTTP authentication |
|
53 | + var $authtype = ''; // Type of HTTP authentication |
|
54 | + var $certRequest = array(); // Certificate for HTTP SSL authentication |
|
55 | 55 | |
56 | 56 | /** |
57 | 57 | * constructor |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | * @param boolean $use_curl try to use cURL |
68 | 68 | * @access public |
69 | 69 | */ |
70 | - function __construct($wsdl = '',$proxyhost=false,$proxyport=false,$proxyusername=false,$proxypassword=false,$timeout=0,$response_timeout=30,$curl_options=null,$use_curl=false){ |
|
70 | + function __construct($wsdl = '', $proxyhost = false, $proxyport = false, $proxyusername = false, $proxypassword = false, $timeout = 0, $response_timeout = 30, $curl_options = null, $use_curl = false) { |
|
71 | 71 | parent::__construct(); |
72 | 72 | $this->debug("ctor wsdl=$wsdl timeout=$timeout response_timeout=$response_timeout"); |
73 | 73 | $this->proxyhost = $proxyhost; |
@@ -103,19 +103,19 @@ discard block |
||
103 | 103 | // Schema imports |
104 | 104 | foreach ($this->schemas as $ns => $list) { |
105 | 105 | foreach ($list as $xs) { |
106 | - $wsdlparts = parse_url($this->wsdl); // this is bogusly simple! |
|
106 | + $wsdlparts = parse_url($this->wsdl); // this is bogusly simple! |
|
107 | 107 | foreach ($xs->imports as $ns2 => $list2) { |
108 | 108 | for ($ii = 0; $ii < count($list2); $ii++) { |
109 | - if (! $list2[$ii]['loaded']) { |
|
109 | + if (!$list2[$ii]['loaded']) { |
|
110 | 110 | $this->schemas[$ns]->imports[$ns2][$ii]['loaded'] = true; |
111 | 111 | $url = $list2[$ii]['location']; |
112 | 112 | if ($url != '') { |
113 | 113 | $urlparts = parse_url($url); |
114 | 114 | if (!isset($urlparts['host'])) { |
115 | - $url = $wsdlparts['scheme'] . '://' . $wsdlparts['host'] . (isset($wsdlparts['port']) ? ':' .$wsdlparts['port'] : '') . |
|
116 | - substr($wsdlparts['path'],0,strrpos($wsdlparts['path'],'/') + 1) .$urlparts['path']; |
|
115 | + $url = $wsdlparts['scheme'].'://'.$wsdlparts['host'].(isset($wsdlparts['port']) ? ':'.$wsdlparts['port'] : ''). |
|
116 | + substr($wsdlparts['path'], 0, strrpos($wsdlparts['path'], '/') + 1).$urlparts['path']; |
|
117 | 117 | } |
118 | - if (! in_array($url, $imported_urls)) { |
|
118 | + if (!in_array($url, $imported_urls)) { |
|
119 | 119 | $this->parseWSDL($url); |
120 | 120 | $imported++; |
121 | 121 | $imported_urls[] = $url; |
@@ -129,19 +129,19 @@ discard block |
||
129 | 129 | } |
130 | 130 | } |
131 | 131 | // WSDL imports |
132 | - $wsdlparts = parse_url($this->wsdl); // this is bogusly simple! |
|
132 | + $wsdlparts = parse_url($this->wsdl); // this is bogusly simple! |
|
133 | 133 | foreach ($this->import as $ns => $list) { |
134 | 134 | for ($ii = 0; $ii < count($list); $ii++) { |
135 | - if (! $list[$ii]['loaded']) { |
|
135 | + if (!$list[$ii]['loaded']) { |
|
136 | 136 | $this->import[$ns][$ii]['loaded'] = true; |
137 | 137 | $url = $list[$ii]['location']; |
138 | 138 | if ($url != '') { |
139 | 139 | $urlparts = parse_url($url); |
140 | 140 | if (!isset($urlparts['host'])) { |
141 | - $url = $wsdlparts['scheme'] . '://' . $wsdlparts['host'] . (isset($wsdlparts['port']) ? ':' . $wsdlparts['port'] : '') . |
|
142 | - substr($wsdlparts['path'],0,strrpos($wsdlparts['path'],'/') + 1) .$urlparts['path']; |
|
141 | + $url = $wsdlparts['scheme'].'://'.$wsdlparts['host'].(isset($wsdlparts['port']) ? ':'.$wsdlparts['port'] : ''). |
|
142 | + substr($wsdlparts['path'], 0, strrpos($wsdlparts['path'], '/') + 1).$urlparts['path']; |
|
143 | 143 | } |
144 | - if (! in_array($url, $imported_urls)) { |
|
144 | + if (!in_array($url, $imported_urls)) { |
|
145 | 145 | $this->parseWSDL($url); |
146 | 146 | $imported++; |
147 | 147 | $imported_urls[] = $url; |
@@ -154,30 +154,28 @@ discard block |
||
154 | 154 | } |
155 | 155 | } |
156 | 156 | // add new data to operation data |
157 | - foreach($this->bindings as $binding => $bindingData) { |
|
157 | + foreach ($this->bindings as $binding => $bindingData) { |
|
158 | 158 | if (isset($bindingData['operations']) && is_array($bindingData['operations'])) { |
159 | - foreach($bindingData['operations'] as $operation => $data) { |
|
160 | - $this->debug('post-parse data gathering for ' . $operation); |
|
159 | + foreach ($bindingData['operations'] as $operation => $data) { |
|
160 | + $this->debug('post-parse data gathering for '.$operation); |
|
161 | 161 | $this->bindings[$binding]['operations'][$operation]['input'] = |
162 | 162 | isset($this->bindings[$binding]['operations'][$operation]['input']) ? |
163 | - array_merge($this->bindings[$binding]['operations'][$operation]['input'], $this->portTypes[ $bindingData['portType'] ][$operation]['input']) : |
|
164 | - $this->portTypes[ $bindingData['portType'] ][$operation]['input']; |
|
163 | + array_merge($this->bindings[$binding]['operations'][$operation]['input'], $this->portTypes[$bindingData['portType']][$operation]['input']) : $this->portTypes[$bindingData['portType']][$operation]['input']; |
|
165 | 164 | $this->bindings[$binding]['operations'][$operation]['output'] = |
166 | 165 | isset($this->bindings[$binding]['operations'][$operation]['output']) ? |
167 | - array_merge($this->bindings[$binding]['operations'][$operation]['output'], $this->portTypes[ $bindingData['portType'] ][$operation]['output']) : |
|
168 | - $this->portTypes[ $bindingData['portType'] ][$operation]['output']; |
|
169 | - if(isset($this->messages[ $this->bindings[$binding]['operations'][$operation]['input']['message'] ])){ |
|
170 | - $this->bindings[$binding]['operations'][$operation]['input']['parts'] = $this->messages[ $this->bindings[$binding]['operations'][$operation]['input']['message'] ]; |
|
166 | + array_merge($this->bindings[$binding]['operations'][$operation]['output'], $this->portTypes[$bindingData['portType']][$operation]['output']) : $this->portTypes[$bindingData['portType']][$operation]['output']; |
|
167 | + if (isset($this->messages[$this->bindings[$binding]['operations'][$operation]['input']['message']])) { |
|
168 | + $this->bindings[$binding]['operations'][$operation]['input']['parts'] = $this->messages[$this->bindings[$binding]['operations'][$operation]['input']['message']]; |
|
171 | 169 | } |
172 | - if(isset($this->messages[ $this->bindings[$binding]['operations'][$operation]['output']['message'] ])){ |
|
173 | - $this->bindings[$binding]['operations'][$operation]['output']['parts'] = $this->messages[ $this->bindings[$binding]['operations'][$operation]['output']['message'] ]; |
|
170 | + if (isset($this->messages[$this->bindings[$binding]['operations'][$operation]['output']['message']])) { |
|
171 | + $this->bindings[$binding]['operations'][$operation]['output']['parts'] = $this->messages[$this->bindings[$binding]['operations'][$operation]['output']['message']]; |
|
174 | 172 | } |
175 | 173 | // Set operation style if necessary, but do not override one already provided |
176 | 174 | if (isset($bindingData['style']) && !isset($this->bindings[$binding]['operations'][$operation]['style'])) { |
177 | 175 | $this->bindings[$binding]['operations'][$operation]['style'] = $bindingData['style']; |
178 | 176 | } |
179 | 177 | $this->bindings[$binding]['operations'][$operation]['transport'] = isset($bindingData['transport']) ? $bindingData['transport'] : ''; |
180 | - $this->bindings[$binding]['operations'][$operation]['documentation'] = isset($this->portTypes[ $bindingData['portType'] ][$operation]['documentation']) ? $this->portTypes[ $bindingData['portType'] ][$operation]['documentation'] : ''; |
|
178 | + $this->bindings[$binding]['operations'][$operation]['documentation'] = isset($this->portTypes[$bindingData['portType']][$operation]['documentation']) ? $this->portTypes[$bindingData['portType']][$operation]['documentation'] : ''; |
|
181 | 179 | $this->bindings[$binding]['operations'][$operation]['endpoint'] = isset($bindingData['endpoint']) ? $bindingData['endpoint'] : ''; |
182 | 180 | } |
183 | 181 | } |
@@ -203,13 +201,13 @@ discard block |
||
203 | 201 | $wsdl_props = parse_url($wsdl); |
204 | 202 | |
205 | 203 | if (isset($wsdl_props['scheme']) && ($wsdl_props['scheme'] == 'http' || $wsdl_props['scheme'] == 'https')) { |
206 | - $this->debug('getting WSDL http(s) URL ' . $wsdl); |
|
204 | + $this->debug('getting WSDL http(s) URL '.$wsdl); |
|
207 | 205 | // get wsdl |
208 | 206 | $tr = new soap_transport_http($wsdl, $this->curl_options, $this->use_curl); |
209 | 207 | $tr->request_method = 'GET'; |
210 | 208 | $tr->useSOAPAction = false; |
211 | - if($this->proxyhost && $this->proxyport){ |
|
212 | - $tr->setProxy($this->proxyhost,$this->proxyport,$this->proxyusername,$this->proxypassword); |
|
209 | + if ($this->proxyhost && $this->proxyport) { |
|
210 | + $tr->setProxy($this->proxyhost, $this->proxyport, $this->proxyusername, $this->proxypassword); |
|
213 | 211 | } |
214 | 212 | if ($this->authtype != '') { |
215 | 213 | $tr->setCredentials($this->username, $this->password, $this->authtype, array(), $this->certRequest); |
@@ -220,8 +218,8 @@ discard block |
||
220 | 218 | //$this->debug("WSDL response\n" . $tr->incoming_payload); |
221 | 219 | $this->appendDebug($tr->getDebug()); |
222 | 220 | // catch errors |
223 | - if($err = $tr->getError() ){ |
|
224 | - $errstr = 'Getting ' . $wsdl . ' - HTTP ERROR: '.$err; |
|
221 | + if ($err = $tr->getError()) { |
|
222 | + $errstr = 'Getting '.$wsdl.' - HTTP ERROR: '.$err; |
|
225 | 223 | $this->debug($errstr); |
226 | 224 | $this->setError($errstr); |
227 | 225 | unset($tr); |
@@ -232,11 +230,11 @@ discard block |
||
232 | 230 | } else { |
233 | 231 | // $wsdl is not http(s), so treat it as a file URL or plain file path |
234 | 232 | if (isset($wsdl_props['scheme']) && ($wsdl_props['scheme'] == 'file') && isset($wsdl_props['path'])) { |
235 | - $path = isset($wsdl_props['host']) ? ($wsdl_props['host'] . ':' . $wsdl_props['path']) : $wsdl_props['path']; |
|
233 | + $path = isset($wsdl_props['host']) ? ($wsdl_props['host'].':'.$wsdl_props['path']) : $wsdl_props['path']; |
|
236 | 234 | } else { |
237 | 235 | $path = $wsdl; |
238 | 236 | } |
239 | - $this->debug('getting WSDL file ' . $path); |
|
237 | + $this->debug('getting WSDL file '.$path); |
|
240 | 238 | if ($fp = @fopen($path, 'r')) { |
241 | 239 | $wsdl_string = ''; |
242 | 240 | while ($data = fread($fp, 32768)) { |
@@ -272,7 +270,7 @@ discard block |
||
272 | 270 | xml_error_string(xml_get_error_code($this->parser)) |
273 | 271 | ); |
274 | 272 | $this->debug($errstr); |
275 | - $this->debug("XML payload:\n" . $wsdl_string); |
|
273 | + $this->debug("XML payload:\n".$wsdl_string); |
|
276 | 274 | $this->setError($errstr); |
277 | 275 | return false; |
278 | 276 | } |
@@ -280,7 +278,7 @@ discard block |
||
280 | 278 | xml_parser_free($this->parser); |
281 | 279 | $this->debug('Parsing WSDL done'); |
282 | 280 | // catch wsdl parse errors |
283 | - if($this->getError()){ |
|
281 | + if ($this->getError()) { |
|
284 | 282 | return false; |
285 | 283 | } |
286 | 284 | return true; |
@@ -318,21 +316,21 @@ discard block |
||
318 | 316 | // process attributes |
319 | 317 | if (count($attrs) > 0) { |
320 | 318 | // register namespace declarations |
321 | - foreach($attrs as $k => $v) { |
|
322 | - if (preg_match('/^xmlns/',$k)) { |
|
319 | + foreach ($attrs as $k => $v) { |
|
320 | + if (preg_match('/^xmlns/', $k)) { |
|
323 | 321 | if ($ns_prefix = substr(strrchr($k, ':'), 1)) { |
324 | 322 | $this->namespaces[$ns_prefix] = $v; |
325 | 323 | } else { |
326 | - $this->namespaces['ns' . (count($this->namespaces) + 1)] = $v; |
|
324 | + $this->namespaces['ns'.(count($this->namespaces) + 1)] = $v; |
|
327 | 325 | } |
328 | 326 | if ($v == 'http://www.w3.org/2001/XMLSchema' || $v == 'http://www.w3.org/1999/XMLSchema' || $v == 'http://www.w3.org/2000/10/XMLSchema') { |
329 | 327 | $this->XMLSchemaVersion = $v; |
330 | - $this->namespaces['xsi'] = $v . '-instance'; |
|
328 | + $this->namespaces['xsi'] = $v.'-instance'; |
|
331 | 329 | } |
332 | 330 | } |
333 | 331 | } |
334 | 332 | // expand each attribute prefix to its namespace |
335 | - foreach($attrs as $k => $v) { |
|
333 | + foreach ($attrs as $k => $v) { |
|
336 | 334 | $k = strpos($k, ':') ? $this->expandQname($k) : $k; |
337 | 335 | if ($k != 'location' && $k != 'soapAction' && $k != 'namespace') { |
338 | 336 | $v = strpos($v, ':') ? $this->expandQname($v) : $v; |
@@ -358,12 +356,12 @@ discard block |
||
358 | 356 | case 'message': |
359 | 357 | if ($name == 'part') { |
360 | 358 | if (isset($attrs['type'])) { |
361 | - $this->debug("msg " . $this->currentMessage . ": found part (with type) $attrs[name]: " . implode(',', $attrs)); |
|
359 | + $this->debug("msg ".$this->currentMessage.": found part (with type) $attrs[name]: ".implode(',', $attrs)); |
|
362 | 360 | $this->messages[$this->currentMessage][$attrs['name']] = $attrs['type']; |
363 | 361 | } |
364 | 362 | if (isset($attrs['element'])) { |
365 | - $this->debug("msg " . $this->currentMessage . ": found part (with element) $attrs[name]: " . implode(',', $attrs)); |
|
366 | - $this->messages[$this->currentMessage][$attrs['name']] = $attrs['element'] . '^'; |
|
363 | + $this->debug("msg ".$this->currentMessage.": found part (with element) $attrs[name]: ".implode(',', $attrs)); |
|
364 | + $this->messages[$this->currentMessage][$attrs['name']] = $attrs['element'].'^'; |
|
367 | 365 | } |
368 | 366 | } |
369 | 367 | break; |
@@ -432,15 +430,15 @@ discard block |
||
432 | 430 | switch ($name) { |
433 | 431 | case 'port': |
434 | 432 | $this->currentPort = $attrs['name']; |
435 | - $this->debug('current port: ' . $this->currentPort); |
|
433 | + $this->debug('current port: '.$this->currentPort); |
|
436 | 434 | $this->ports[$this->currentPort]['binding'] = $this->getLocalPart($attrs['binding']); |
437 | 435 | |
438 | 436 | break; |
439 | 437 | case 'address': |
440 | 438 | $this->ports[$this->currentPort]['location'] = $attrs['location']; |
441 | 439 | $this->ports[$this->currentPort]['bindingType'] = $namespace; |
442 | - $this->bindings[ $this->ports[$this->currentPort]['binding'] ]['bindingType'] = $namespace; |
|
443 | - $this->bindings[ $this->ports[$this->currentPort]['binding'] ]['endpoint'] = $attrs['location']; |
|
440 | + $this->bindings[$this->ports[$this->currentPort]['binding']]['bindingType'] = $namespace; |
|
441 | + $this->bindings[$this->ports[$this->currentPort]['binding']]['endpoint'] = $attrs['location']; |
|
444 | 442 | break; |
445 | 443 | } |
446 | 444 | break; |
@@ -450,13 +448,13 @@ discard block |
||
450 | 448 | case 'import': |
451 | 449 | if (isset($attrs['location'])) { |
452 | 450 | $this->import[$attrs['namespace']][] = array('location' => $attrs['location'], 'loaded' => false); |
453 | - $this->debug('parsing import ' . $attrs['namespace']. ' - ' . $attrs['location'] . ' (' . count($this->import[$attrs['namespace']]).')'); |
|
451 | + $this->debug('parsing import '.$attrs['namespace'].' - '.$attrs['location'].' ('.count($this->import[$attrs['namespace']]).')'); |
|
454 | 452 | } else { |
455 | 453 | $this->import[$attrs['namespace']][] = array('location' => '', 'loaded' => true); |
456 | - if (! $this->getPrefixFromNamespace($attrs['namespace'])) { |
|
457 | - $this->namespaces['ns'.(count($this->namespaces)+1)] = $attrs['namespace']; |
|
454 | + if (!$this->getPrefixFromNamespace($attrs['namespace'])) { |
|
455 | + $this->namespaces['ns'.(count($this->namespaces) + 1)] = $attrs['namespace']; |
|
458 | 456 | } |
459 | - $this->debug('parsing import ' . $attrs['namespace']. ' - [no location] (' . count($this->import[$attrs['namespace']]).')'); |
|
457 | + $this->debug('parsing import '.$attrs['namespace'].' - [no location] ('.count($this->import[$attrs['namespace']]).')'); |
|
460 | 458 | } |
461 | 459 | break; |
462 | 460 | //wait for schema |
@@ -483,13 +481,13 @@ discard block |
||
483 | 481 | } |
484 | 482 | $this->status = 'binding'; |
485 | 483 | $this->bindings[$this->currentBinding]['portType'] = $this->getLocalPart($attrs['type']); |
486 | - $this->debug("current binding: $this->currentBinding of portType: " . $attrs['type']); |
|
484 | + $this->debug("current binding: $this->currentBinding of portType: ".$attrs['type']); |
|
487 | 485 | } |
488 | 486 | break; |
489 | 487 | case 'service': |
490 | 488 | $this->serviceName = $attrs['name']; |
491 | 489 | $this->status = 'service'; |
492 | - $this->debug('current service: ' . $this->serviceName); |
|
490 | + $this->debug('current service: '.$this->serviceName); |
|
493 | 491 | break; |
494 | 492 | case 'definitions': |
495 | 493 | foreach ($attrs as $name => $value) { |
@@ -507,7 +505,7 @@ discard block |
||
507 | 505 | * @param string $name element name |
508 | 506 | * @access private |
509 | 507 | */ |
510 | - function end_element($parser, $name){ |
|
508 | + function end_element($parser, $name) { |
|
511 | 509 | // unset schema status |
512 | 510 | if (/*preg_match('/types$/', $name) ||*/ preg_match('/schema$/', $name)) { |
513 | 511 | $this->status = ""; |
@@ -592,8 +590,8 @@ discard block |
||
592 | 590 | } |
593 | 591 | $this->debug("getOperations for port '$portName' bindingType $bindingType"); |
594 | 592 | // loop thru ports |
595 | - foreach($this->ports as $port => $portData) { |
|
596 | - $this->debug("getOperations checking port $port bindingType " . $portData['bindingType']); |
|
593 | + foreach ($this->ports as $port => $portData) { |
|
594 | + $this->debug("getOperations checking port $port bindingType ".$portData['bindingType']); |
|
597 | 595 | if ($portName == '' || $port == $portName) { |
598 | 596 | // binding type of port matches parameter |
599 | 597 | if ($portData['bindingType'] == $bindingType) { |
@@ -601,8 +599,8 @@ discard block |
||
601 | 599 | //$this->debug("port data: " . $this->varDump($portData)); |
602 | 600 | //$this->debug("bindings: " . $this->varDump($this->bindings[ $portData['binding'] ])); |
603 | 601 | // merge bindings |
604 | - if (isset($this->bindings[ $portData['binding'] ]['operations'])) { |
|
605 | - $ops = array_merge ($ops, $this->bindings[ $portData['binding'] ]['operations']); |
|
602 | + if (isset($this->bindings[$portData['binding']]['operations'])) { |
|
603 | + $ops = array_merge($ops, $this->bindings[$portData['binding']]['operations']); |
|
606 | 604 | } |
607 | 605 | } |
608 | 606 | } |
@@ -629,15 +627,15 @@ discard block |
||
629 | 627 | $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap12/'; |
630 | 628 | } |
631 | 629 | // loop thru ports |
632 | - foreach($this->ports as $port => $portData) { |
|
630 | + foreach ($this->ports as $port => $portData) { |
|
633 | 631 | // binding type of port matches parameter |
634 | 632 | if ($portData['bindingType'] == $bindingType) { |
635 | 633 | // get binding |
636 | 634 | //foreach($this->bindings[ $portData['binding'] ]['operations'] as $bOperation => $opData) { |
637 | - foreach(array_keys($this->bindings[ $portData['binding'] ]['operations']) as $bOperation) { |
|
635 | + foreach (array_keys($this->bindings[$portData['binding']]['operations']) as $bOperation) { |
|
638 | 636 | // note that we could/should also check the namespace here |
639 | 637 | if ($operation == $bOperation) { |
640 | - $opData = $this->bindings[ $portData['binding'] ]['operations'][$operation]; |
|
638 | + $opData = $this->bindings[$portData['binding']]['operations'][$operation]; |
|
641 | 639 | return $opData; |
642 | 640 | } |
643 | 641 | } |
@@ -660,11 +658,11 @@ discard block |
||
660 | 658 | $bindingType = 'http://schemas.xmlsoap.org/wsdl/soap12/'; |
661 | 659 | } |
662 | 660 | // loop thru ports |
663 | - foreach($this->ports as $port => $portData) { |
|
661 | + foreach ($this->ports as $port => $portData) { |
|
664 | 662 | // binding type of port matches parameter |
665 | 663 | if ($portData['bindingType'] == $bindingType) { |
666 | 664 | // loop through operations for the binding |
667 | - foreach ($this->bindings[ $portData['binding'] ]['operations'] as $bOperation => $opData) { |
|
665 | + foreach ($this->bindings[$portData['binding']]['operations'] as $bOperation => $opData) { |
|
668 | 666 | if ($opData['soapAction'] == $soapAction) { |
669 | 667 | return $opData; |
670 | 668 | } |
@@ -693,7 +691,7 @@ discard block |
||
693 | 691 | */ |
694 | 692 | function getTypeDef($type, $ns) { |
695 | 693 | $this->debug("in getTypeDef: type=$type, ns=$ns"); |
696 | - if ((! $ns) && isset($this->namespaces['tns'])) { |
|
694 | + if ((!$ns) && isset($this->namespaces['tns'])) { |
|
697 | 695 | $ns = $this->namespaces['tns']; |
698 | 696 | $this->debug("in getTypeDef: type namespace forced to $ns"); |
699 | 697 | } |
@@ -751,7 +749,7 @@ discard block |
||
751 | 749 | * |
752 | 750 | * @access private |
753 | 751 | */ |
754 | - function webDescription(){ |
|
752 | + function webDescription() { |
|
755 | 753 | global $HTTP_SERVER_VARS; |
756 | 754 | |
757 | 755 | if (isset($_SERVER)) { |
@@ -845,19 +843,19 @@ discard block |
||
845 | 843 | <p>View the <a href="'.$PHP_SELF.'?wsdl">WSDL</a> for the service. |
846 | 844 | Click on an operation name to view it's details.</p> |
847 | 845 | <ul>'; |
848 | - foreach($this->getOperations() as $op => $data){ |
|
846 | + foreach ($this->getOperations() as $op => $data) { |
|
849 | 847 | $b .= "<li><a href='#' onclick=\"popout();popup('$op')\">$op</a></li>"; |
850 | 848 | // create hidden div |
851 | 849 | $b .= "<div id='$op' class='hidden'> |
852 | 850 | <a href='#' onclick='popout()'><font color='#ffffff'>Close</font></a><br><br>"; |
853 | - foreach($data as $donnie => $marie){ // loop through opdata |
|
854 | - if($donnie == 'input' || $donnie == 'output'){ // show input/output data |
|
851 | + foreach ($data as $donnie => $marie) { // loop through opdata |
|
852 | + if ($donnie == 'input' || $donnie == 'output') { // show input/output data |
|
855 | 853 | $b .= "<font color='white'>".ucfirst($donnie).':</font><br>'; |
856 | - foreach($marie as $captain => $tenille){ // loop through data |
|
857 | - if($captain == 'parts'){ // loop thru parts |
|
854 | + foreach ($marie as $captain => $tenille) { // loop through data |
|
855 | + if ($captain == 'parts') { // loop thru parts |
|
858 | 856 | $b .= " $captain:<br>"; |
859 | 857 | //if(is_array($tenille)){ |
860 | - foreach($tenille as $joanie => $chachi){ |
|
858 | + foreach ($tenille as $joanie => $chachi) { |
|
861 | 859 | $b .= " $joanie: $chachi<br>"; |
862 | 860 | } |
863 | 861 | //} |
@@ -889,31 +887,31 @@ discard block |
||
889 | 887 | { |
890 | 888 | $xml = '<?xml version="1.0" encoding="ISO-8859-1"?>'; |
891 | 889 | $xml .= "\n<definitions"; |
892 | - foreach($this->namespaces as $k => $v) { |
|
890 | + foreach ($this->namespaces as $k => $v) { |
|
893 | 891 | $xml .= " xmlns:$k=\"$v\""; |
894 | 892 | } |
895 | 893 | // 10.9.02 - add poulter fix for wsdl and tns declarations |
896 | 894 | if (isset($this->namespaces['wsdl'])) { |
897 | - $xml .= " xmlns=\"" . $this->namespaces['wsdl'] . "\""; |
|
895 | + $xml .= " xmlns=\"".$this->namespaces['wsdl']."\""; |
|
898 | 896 | } |
899 | 897 | if (isset($this->namespaces['tns'])) { |
900 | - $xml .= " targetNamespace=\"" . $this->namespaces['tns'] . "\""; |
|
898 | + $xml .= " targetNamespace=\"".$this->namespaces['tns']."\""; |
|
901 | 899 | } |
902 | 900 | $xml .= '>'; |
903 | 901 | // imports |
904 | 902 | if (sizeof($this->import) > 0) { |
905 | - foreach($this->import as $ns => $list) { |
|
903 | + foreach ($this->import as $ns => $list) { |
|
906 | 904 | foreach ($list as $ii) { |
907 | 905 | if ($ii['location'] != '') { |
908 | - $xml .= '<import location="' . $ii['location'] . '" namespace="' . $ns . '" />'; |
|
906 | + $xml .= '<import location="'.$ii['location'].'" namespace="'.$ns.'" />'; |
|
909 | 907 | } else { |
910 | - $xml .= '<import namespace="' . $ns . '" />'; |
|
908 | + $xml .= '<import namespace="'.$ns.'" />'; |
|
911 | 909 | } |
912 | 910 | } |
913 | 911 | } |
914 | 912 | } |
915 | 913 | // types |
916 | - if (count($this->schemas)>=1) { |
|
914 | + if (count($this->schemas) >= 1) { |
|
917 | 915 | $xml .= "\n<types>\n"; |
918 | 916 | foreach ($this->schemas as $ns => $list) { |
919 | 917 | foreach ($list as $xs) { |
@@ -924,10 +922,10 @@ discard block |
||
924 | 922 | } |
925 | 923 | // messages |
926 | 924 | if (count($this->messages) >= 1) { |
927 | - foreach($this->messages as $msgName => $msgParts) { |
|
928 | - $xml .= "\n<message name=\"" . $msgName . '">'; |
|
929 | - if(is_array($msgParts)){ |
|
930 | - foreach($msgParts as $partName => $partType) { |
|
925 | + foreach ($this->messages as $msgName => $msgParts) { |
|
926 | + $xml .= "\n<message name=\"".$msgName.'">'; |
|
927 | + if (is_array($msgParts)) { |
|
928 | + foreach ($msgParts as $partName => $partType) { |
|
931 | 929 | // print 'serializing '.$partType.', sv: '.$this->XMLSchemaVersion.'<br>'; |
932 | 930 | if (strpos($partType, ':')) { |
933 | 931 | $typePrefix = $this->getPrefixFromNamespace($this->getPrefix($partType)); |
@@ -935,7 +933,7 @@ discard block |
||
935 | 933 | // print 'checking typemap: '.$this->XMLSchemaVersion.'<br>'; |
936 | 934 | $typePrefix = 'xsd'; |
937 | 935 | } else { |
938 | - foreach($this->typemap as $ns => $types) { |
|
936 | + foreach ($this->typemap as $ns => $types) { |
|
939 | 937 | if (isset($types[$partType])) { |
940 | 938 | $typePrefix = $this->getPrefixFromNamespace($ns); |
941 | 939 | } |
@@ -955,7 +953,7 @@ discard block |
||
955 | 953 | } else { |
956 | 954 | $elementortype = 'type'; |
957 | 955 | } |
958 | - $xml .= "\n" . ' <part name="' . $partName . '" ' . $elementortype . '="' . $typePrefix . ':' . $localPart . '" />'; |
|
956 | + $xml .= "\n".' <part name="'.$partName.'" '.$elementortype.'="'.$typePrefix.':'.$localPart.'" />'; |
|
959 | 957 | } |
960 | 958 | } |
961 | 959 | $xml .= '</message>'; |
@@ -965,54 +963,54 @@ discard block |
||
965 | 963 | if (count($this->bindings) >= 1) { |
966 | 964 | $binding_xml = ''; |
967 | 965 | $portType_xml = ''; |
968 | - foreach($this->bindings as $bindingName => $attrs) { |
|
969 | - $binding_xml .= "\n<binding name=\"" . $bindingName . '" type="tns:' . $attrs['portType'] . '">'; |
|
970 | - $binding_xml .= "\n" . ' <soap:binding style="' . $attrs['style'] . '" transport="' . $attrs['transport'] . '"/>'; |
|
971 | - $portType_xml .= "\n<portType name=\"" . $attrs['portType'] . '">'; |
|
972 | - foreach($attrs['operations'] as $opName => $opParts) { |
|
973 | - $binding_xml .= "\n" . ' <operation name="' . $opName . '">'; |
|
974 | - $binding_xml .= "\n" . ' <soap:operation soapAction="' . $opParts['soapAction'] . '" style="'. $opParts['style'] . '"/>'; |
|
966 | + foreach ($this->bindings as $bindingName => $attrs) { |
|
967 | + $binding_xml .= "\n<binding name=\"".$bindingName.'" type="tns:'.$attrs['portType'].'">'; |
|
968 | + $binding_xml .= "\n".' <soap:binding style="'.$attrs['style'].'" transport="'.$attrs['transport'].'"/>'; |
|
969 | + $portType_xml .= "\n<portType name=\"".$attrs['portType'].'">'; |
|
970 | + foreach ($attrs['operations'] as $opName => $opParts) { |
|
971 | + $binding_xml .= "\n".' <operation name="'.$opName.'">'; |
|
972 | + $binding_xml .= "\n".' <soap:operation soapAction="'.$opParts['soapAction'].'" style="'.$opParts['style'].'"/>'; |
|
975 | 973 | if (isset($opParts['input']['encodingStyle']) && $opParts['input']['encodingStyle'] != '') { |
976 | - $enc_style = ' encodingStyle="' . $opParts['input']['encodingStyle'] . '"'; |
|
974 | + $enc_style = ' encodingStyle="'.$opParts['input']['encodingStyle'].'"'; |
|
977 | 975 | } else { |
978 | 976 | $enc_style = ''; |
979 | 977 | } |
980 | - $binding_xml .= "\n" . ' <input><soap:body use="' . $opParts['input']['use'] . '" namespace="' . $opParts['input']['namespace'] . '"' . $enc_style . '/></input>'; |
|
978 | + $binding_xml .= "\n".' <input><soap:body use="'.$opParts['input']['use'].'" namespace="'.$opParts['input']['namespace'].'"'.$enc_style.'/></input>'; |
|
981 | 979 | if (isset($opParts['output']['encodingStyle']) && $opParts['output']['encodingStyle'] != '') { |
982 | - $enc_style = ' encodingStyle="' . $opParts['output']['encodingStyle'] . '"'; |
|
980 | + $enc_style = ' encodingStyle="'.$opParts['output']['encodingStyle'].'"'; |
|
983 | 981 | } else { |
984 | 982 | $enc_style = ''; |
985 | 983 | } |
986 | - $binding_xml .= "\n" . ' <output><soap:body use="' . $opParts['output']['use'] . '" namespace="' . $opParts['output']['namespace'] . '"' . $enc_style . '/></output>'; |
|
987 | - $binding_xml .= "\n" . ' </operation>'; |
|
988 | - $portType_xml .= "\n" . ' <operation name="' . $opParts['name'] . '"'; |
|
984 | + $binding_xml .= "\n".' <output><soap:body use="'.$opParts['output']['use'].'" namespace="'.$opParts['output']['namespace'].'"'.$enc_style.'/></output>'; |
|
985 | + $binding_xml .= "\n".' </operation>'; |
|
986 | + $portType_xml .= "\n".' <operation name="'.$opParts['name'].'"'; |
|
989 | 987 | if (isset($opParts['parameterOrder'])) { |
990 | - $portType_xml .= ' parameterOrder="' . $opParts['parameterOrder'] . '"'; |
|
988 | + $portType_xml .= ' parameterOrder="'.$opParts['parameterOrder'].'"'; |
|
991 | 989 | } |
992 | 990 | $portType_xml .= '>'; |
993 | - if(isset($opParts['documentation']) && $opParts['documentation'] != '') { |
|
994 | - $portType_xml .= "\n" . ' <documentation>' . htmlspecialchars($opParts['documentation']) . '</documentation>'; |
|
991 | + if (isset($opParts['documentation']) && $opParts['documentation'] != '') { |
|
992 | + $portType_xml .= "\n".' <documentation>'.htmlspecialchars($opParts['documentation']).'</documentation>'; |
|
995 | 993 | } |
996 | - $portType_xml .= "\n" . ' <input message="tns:' . $opParts['input']['message'] . '"/>'; |
|
997 | - $portType_xml .= "\n" . ' <output message="tns:' . $opParts['output']['message'] . '"/>'; |
|
998 | - $portType_xml .= "\n" . ' </operation>'; |
|
994 | + $portType_xml .= "\n".' <input message="tns:'.$opParts['input']['message'].'"/>'; |
|
995 | + $portType_xml .= "\n".' <output message="tns:'.$opParts['output']['message'].'"/>'; |
|
996 | + $portType_xml .= "\n".' </operation>'; |
|
999 | 997 | } |
1000 | - $portType_xml .= "\n" . '</portType>'; |
|
1001 | - $binding_xml .= "\n" . '</binding>'; |
|
998 | + $portType_xml .= "\n".'</portType>'; |
|
999 | + $binding_xml .= "\n".'</binding>'; |
|
1002 | 1000 | } |
1003 | - $xml .= $portType_xml . $binding_xml; |
|
1001 | + $xml .= $portType_xml.$binding_xml; |
|
1004 | 1002 | } |
1005 | 1003 | // services |
1006 | - $xml .= "\n<service name=\"" . $this->serviceName . '">'; |
|
1004 | + $xml .= "\n<service name=\"".$this->serviceName.'">'; |
|
1007 | 1005 | if (count($this->ports) >= 1) { |
1008 | - foreach($this->ports as $pName => $attrs) { |
|
1009 | - $xml .= "\n" . ' <port name="' . $pName . '" binding="tns:' . $attrs['binding'] . '">'; |
|
1010 | - $xml .= "\n" . ' <soap:address location="' . $attrs['location'] . ($debug ? '?debug=1' : '') . '"/>'; |
|
1011 | - $xml .= "\n" . ' </port>'; |
|
1006 | + foreach ($this->ports as $pName => $attrs) { |
|
1007 | + $xml .= "\n".' <port name="'.$pName.'" binding="tns:'.$attrs['binding'].'">'; |
|
1008 | + $xml .= "\n".' <soap:address location="'.$attrs['location'].($debug ? '?debug=1' : '').'"/>'; |
|
1009 | + $xml .= "\n".' </port>'; |
|
1012 | 1010 | } |
1013 | 1011 | } |
1014 | - $xml .= "\n" . '</service>'; |
|
1015 | - return $xml . "\n</definitions>"; |
|
1012 | + $xml .= "\n".'</service>'; |
|
1013 | + return $xml."\n</definitions>"; |
|
1016 | 1014 | } |
1017 | 1015 | |
1018 | 1016 | /** |
@@ -1109,7 +1107,7 @@ discard block |
||
1109 | 1107 | */ |
1110 | 1108 | function serializeRPCParameters($operation, $direction, $parameters, $bindingType = 'soap') { |
1111 | 1109 | $this->debug("in serializeRPCParameters: operation=$operation, direction=$direction, XMLSchemaVersion=$this->XMLSchemaVersion, bindingType=$bindingType"); |
1112 | - $this->appendDebug('parameters=' . $this->varDump($parameters)); |
|
1110 | + $this->appendDebug('parameters='.$this->varDump($parameters)); |
|
1113 | 1111 | |
1114 | 1112 | if ($direction != 'input' && $direction != 'output') { |
1115 | 1113 | $this->debug('The value of the \$direction argument needs to be either "input" or "output"'); |
@@ -1117,8 +1115,8 @@ discard block |
||
1117 | 1115 | return false; |
1118 | 1116 | } |
1119 | 1117 | if (!$opData = $this->getOperationData($operation, $bindingType)) { |
1120 | - $this->debug('Unable to retrieve WSDL data for operation: ' . $operation . ' bindingType: ' . $bindingType); |
|
1121 | - $this->setError('Unable to retrieve WSDL data for operation: ' . $operation . ' bindingType: ' . $bindingType); |
|
1118 | + $this->debug('Unable to retrieve WSDL data for operation: '.$operation.' bindingType: '.$bindingType); |
|
1119 | + $this->setError('Unable to retrieve WSDL data for operation: '.$operation.' bindingType: '.$bindingType); |
|
1122 | 1120 | return false; |
1123 | 1121 | } |
1124 | 1122 | $this->debug('in serializeRPCParameters: opData:'); |
@@ -1126,7 +1124,7 @@ discard block |
||
1126 | 1124 | |
1127 | 1125 | // Get encoding style for output and set to current |
1128 | 1126 | $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/'; |
1129 | - if(($direction == 'input') && isset($opData['output']['encodingStyle']) && ($opData['output']['encodingStyle'] != $encodingStyle)) { |
|
1127 | + if (($direction == 'input') && isset($opData['output']['encodingStyle']) && ($opData['output']['encodingStyle'] != $encodingStyle)) { |
|
1130 | 1128 | $encodingStyle = $opData['output']['encodingStyle']; |
1131 | 1129 | $enc_style = $encodingStyle; |
1132 | 1130 | } |
@@ -1211,7 +1209,7 @@ discard block |
||
1211 | 1209 | function serializeParameters($operation, $direction, $parameters) |
1212 | 1210 | { |
1213 | 1211 | $this->debug("in serializeParameters: operation=$operation, direction=$direction, XMLSchemaVersion=$this->XMLSchemaVersion"); |
1214 | - $this->appendDebug('parameters=' . $this->varDump($parameters)); |
|
1212 | + $this->appendDebug('parameters='.$this->varDump($parameters)); |
|
1215 | 1213 | |
1216 | 1214 | if ($direction != 'input' && $direction != 'output') { |
1217 | 1215 | $this->debug('The value of the \$direction argument needs to be either "input" or "output"'); |
@@ -1219,8 +1217,8 @@ discard block |
||
1219 | 1217 | return false; |
1220 | 1218 | } |
1221 | 1219 | if (!$opData = $this->getOperationData($operation)) { |
1222 | - $this->debug('Unable to retrieve WSDL data for operation: ' . $operation); |
|
1223 | - $this->setError('Unable to retrieve WSDL data for operation: ' . $operation); |
|
1220 | + $this->debug('Unable to retrieve WSDL data for operation: '.$operation); |
|
1221 | + $this->setError('Unable to retrieve WSDL data for operation: '.$operation); |
|
1224 | 1222 | return false; |
1225 | 1223 | } |
1226 | 1224 | $this->debug('opData:'); |
@@ -1228,7 +1226,7 @@ discard block |
||
1228 | 1226 | |
1229 | 1227 | // Get encoding style for output and set to current |
1230 | 1228 | $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/'; |
1231 | - if(($direction == 'input') && isset($opData['output']['encodingStyle']) && ($opData['output']['encodingStyle'] != $encodingStyle)) { |
|
1229 | + if (($direction == 'input') && isset($opData['output']['encodingStyle']) && ($opData['output']['encodingStyle'] != $encodingStyle)) { |
|
1232 | 1230 | $encodingStyle = $opData['output']['encodingStyle']; |
1233 | 1231 | $enc_style = $encodingStyle; |
1234 | 1232 | } |
@@ -1239,14 +1237,14 @@ discard block |
||
1239 | 1237 | |
1240 | 1238 | $use = $opData[$direction]['use']; |
1241 | 1239 | $this->debug("use=$use"); |
1242 | - $this->debug('got ' . count($opData[$direction]['parts']) . ' part(s)'); |
|
1240 | + $this->debug('got '.count($opData[$direction]['parts']).' part(s)'); |
|
1243 | 1241 | if (is_array($parameters)) { |
1244 | 1242 | $parametersArrayType = $this->isArraySimpleOrStruct($parameters); |
1245 | - $this->debug('have ' . $parametersArrayType . ' parameters'); |
|
1246 | - foreach($opData[$direction]['parts'] as $name => $type) { |
|
1243 | + $this->debug('have '.$parametersArrayType.' parameters'); |
|
1244 | + foreach ($opData[$direction]['parts'] as $name => $type) { |
|
1247 | 1245 | $this->debug('serializing part "'.$name.'" of type "'.$type.'"'); |
1248 | 1246 | // Track encoding style |
1249 | - if(isset($opData[$direction]['encodingStyle']) && $encodingStyle != $opData[$direction]['encodingStyle']) { |
|
1247 | + if (isset($opData[$direction]['encodingStyle']) && $encodingStyle != $opData[$direction]['encodingStyle']) { |
|
1250 | 1248 | $encodingStyle = $opData[$direction]['encodingStyle']; |
1251 | 1249 | $enc_style = $encodingStyle; |
1252 | 1250 | } else { |
@@ -1287,18 +1285,18 @@ discard block |
||
1287 | 1285 | * @return string value serialized as an XML string |
1288 | 1286 | * @access private |
1289 | 1287 | */ |
1290 | - function serializeType($name, $type, $value, $use='encoded', $encodingStyle=false, $unqualified=false) |
|
1288 | + function serializeType($name, $type, $value, $use = 'encoded', $encodingStyle = false, $unqualified = false) |
|
1291 | 1289 | { |
1292 | - $this->debug("in serializeType: name=$name, type=$type, use=$use, encodingStyle=$encodingStyle, unqualified=" . ($unqualified ? "unqualified" : "qualified")); |
|
1293 | - $this->appendDebug("value=" . $this->varDump($value)); |
|
1294 | - if($use == 'encoded' && $encodingStyle) { |
|
1295 | - $encodingStyle = ' SOAP-ENV:encodingStyle="' . $encodingStyle . '"'; |
|
1290 | + $this->debug("in serializeType: name=$name, type=$type, use=$use, encodingStyle=$encodingStyle, unqualified=".($unqualified ? "unqualified" : "qualified")); |
|
1291 | + $this->appendDebug("value=".$this->varDump($value)); |
|
1292 | + if ($use == 'encoded' && $encodingStyle) { |
|
1293 | + $encodingStyle = ' SOAP-ENV:encodingStyle="'.$encodingStyle.'"'; |
|
1296 | 1294 | } |
1297 | 1295 | |
1298 | 1296 | // if a soapval has been supplied, let its type override the WSDL |
1299 | 1297 | if (is_object($value) && get_class($value) == 'soapval') { |
1300 | 1298 | if ($value->type_ns) { |
1301 | - $type = $value->type_ns . ':' . $value->type; |
|
1299 | + $type = $value->type_ns.':'.$value->type; |
|
1302 | 1300 | $forceType = true; |
1303 | 1301 | $this->debug("in serializeType: soapval overrides type to $type"); |
1304 | 1302 | } elseif ($value->type) { |
@@ -1317,7 +1315,7 @@ discard block |
||
1317 | 1315 | $value['!'] = $value; |
1318 | 1316 | } |
1319 | 1317 | foreach ($attrs as $n => $v) { |
1320 | - $value['!' . $n] = $v; |
|
1318 | + $value['!'.$n] = $v; |
|
1321 | 1319 | } |
1322 | 1320 | $this->debug("in serializeType: soapval provides attributes"); |
1323 | 1321 | } |
@@ -1335,7 +1333,7 @@ discard block |
||
1335 | 1333 | $this->debug("in serializeType: expanded prefixed type: $uqType, $ns"); |
1336 | 1334 | } |
1337 | 1335 | |
1338 | - if($ns == $this->XMLSchemaVersion || $ns == 'http://schemas.xmlsoap.org/soap/encoding/'){ |
|
1336 | + if ($ns == $this->XMLSchemaVersion || $ns == 'http://schemas.xmlsoap.org/soap/encoding/') { |
|
1339 | 1337 | $this->debug('in serializeType: type namespace indicates XML Schema or SOAP Encoding type'); |
1340 | 1338 | if ($unqualified && $use == 'literal') { |
1341 | 1339 | $elementNS = " xmlns=\"\""; |
@@ -1348,7 +1346,7 @@ discard block |
||
1348 | 1346 | $xml = "<$name$elementNS/>"; |
1349 | 1347 | } else { |
1350 | 1348 | // TODO: depends on nillable, which should be checked before calling this method |
1351 | - $xml = "<$name$elementNS xsi:nil=\"true\" xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"/>"; |
|
1349 | + $xml = "<$name$elementNS xsi:nil=\"true\" xsi:type=\"".$this->getPrefixFromNamespace($ns).":$uqType\"/>"; |
|
1352 | 1350 | } |
1353 | 1351 | $this->debug("in serializeType: returning: $xml"); |
1354 | 1352 | return $xml; |
@@ -1358,7 +1356,7 @@ discard block |
||
1358 | 1356 | return $this->serialize_val($value, $name, false, false, false, false, $use); |
1359 | 1357 | } |
1360 | 1358 | if ($uqType == 'boolean') { |
1361 | - if ((is_string($value) && $value == 'false') || (! $value)) { |
|
1359 | + if ((is_string($value) && $value == 'false') || (!$value)) { |
|
1362 | 1360 | $value = 'false'; |
1363 | 1361 | } else { |
1364 | 1362 | $value = 'true'; |
@@ -1376,12 +1374,12 @@ discard block |
||
1376 | 1374 | if (!$this->getTypeDef($uqType, $ns)) { |
1377 | 1375 | if ($use == 'literal') { |
1378 | 1376 | if ($forceType) { |
1379 | - $xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\">$value</$name>"; |
|
1377 | + $xml = "<$name$elementNS xsi:type=\"".$this->getPrefixFromNamespace($ns).":$uqType\">$value</$name>"; |
|
1380 | 1378 | } else { |
1381 | 1379 | $xml = "<$name$elementNS>$value</$name>"; |
1382 | 1380 | } |
1383 | 1381 | } else { |
1384 | - $xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"$encodingStyle>$value</$name>"; |
|
1382 | + $xml = "<$name$elementNS xsi:type=\"".$this->getPrefixFromNamespace($ns).":$uqType\"$encodingStyle>$value</$name>"; |
|
1385 | 1383 | } |
1386 | 1384 | $this->debug("in serializeType: returning: $xml"); |
1387 | 1385 | return $xml; |
@@ -1391,29 +1389,29 @@ discard block |
||
1391 | 1389 | $this->debug('in serializeType: appears to be Apache SOAP type'); |
1392 | 1390 | if ($uqType == 'Map') { |
1393 | 1391 | $tt_prefix = $this->getPrefixFromNamespace('http://xml.apache.org/xml-soap'); |
1394 | - if (! $tt_prefix) { |
|
1392 | + if (!$tt_prefix) { |
|
1395 | 1393 | $this->debug('in serializeType: Add namespace for Apache SOAP type'); |
1396 | - $tt_prefix = 'ns' . rand(1000, 9999); |
|
1394 | + $tt_prefix = 'ns'.rand(1000, 9999); |
|
1397 | 1395 | $this->namespaces[$tt_prefix] = 'http://xml.apache.org/xml-soap'; |
1398 | 1396 | // force this to be added to usedNamespaces |
1399 | 1397 | $tt_prefix = $this->getPrefixFromNamespace('http://xml.apache.org/xml-soap'); |
1400 | 1398 | } |
1401 | 1399 | $contents = ''; |
1402 | - foreach($value as $k => $v) { |
|
1400 | + foreach ($value as $k => $v) { |
|
1403 | 1401 | $this->debug("serializing map element: key $k, value $v"); |
1404 | 1402 | $contents .= '<item>'; |
1405 | - $contents .= $this->serialize_val($k,'key',false,false,false,false,$use); |
|
1406 | - $contents .= $this->serialize_val($v,'value',false,false,false,false,$use); |
|
1403 | + $contents .= $this->serialize_val($k, 'key', false, false, false, false, $use); |
|
1404 | + $contents .= $this->serialize_val($v, 'value', false, false, false, false, $use); |
|
1407 | 1405 | $contents .= '</item>'; |
1408 | 1406 | } |
1409 | 1407 | if ($use == 'literal') { |
1410 | 1408 | if ($forceType) { |
1411 | - $xml = "<$name xsi:type=\"" . $tt_prefix . ":$uqType\">$contents</$name>"; |
|
1409 | + $xml = "<$name xsi:type=\"".$tt_prefix.":$uqType\">$contents</$name>"; |
|
1412 | 1410 | } else { |
1413 | 1411 | $xml = "<$name>$contents</$name>"; |
1414 | 1412 | } |
1415 | 1413 | } else { |
1416 | - $xml = "<$name xsi:type=\"" . $tt_prefix . ":$uqType\"$encodingStyle>$contents</$name>"; |
|
1414 | + $xml = "<$name xsi:type=\"".$tt_prefix.":$uqType\"$encodingStyle>$contents</$name>"; |
|
1417 | 1415 | } |
1418 | 1416 | $this->debug("in serializeType: returning: $xml"); |
1419 | 1417 | return $xml; |
@@ -1427,13 +1425,13 @@ discard block |
||
1427 | 1425 | $ns = ''; |
1428 | 1426 | $uqType = $type; |
1429 | 1427 | } |
1430 | - if(!$typeDef = $this->getTypeDef($uqType, $ns)){ |
|
1428 | + if (!$typeDef = $this->getTypeDef($uqType, $ns)) { |
|
1431 | 1429 | $this->setError("$type ($uqType) is not a supported type."); |
1432 | 1430 | $this->debug("in serializeType: $type ($uqType) is not a supported type."); |
1433 | 1431 | return false; |
1434 | 1432 | } else { |
1435 | 1433 | $this->debug("in serializeType: found typeDef"); |
1436 | - $this->appendDebug('typeDef=' . $this->varDump($typeDef)); |
|
1434 | + $this->appendDebug('typeDef='.$this->varDump($typeDef)); |
|
1437 | 1435 | if (substr($uqType, -1) == '^') { |
1438 | 1436 | $uqType = substr($uqType, 0, -1); |
1439 | 1437 | } |
@@ -1444,7 +1442,7 @@ discard block |
||
1444 | 1442 | return false; |
1445 | 1443 | } |
1446 | 1444 | $phpType = $typeDef['phpType']; |
1447 | - $this->debug("in serializeType: uqType: $uqType, ns: $ns, phptype: $phpType, arrayType: " . (isset($typeDef['arrayType']) ? $typeDef['arrayType'] : '') ); |
|
1445 | + $this->debug("in serializeType: uqType: $uqType, ns: $ns, phptype: $phpType, arrayType: ".(isset($typeDef['arrayType']) ? $typeDef['arrayType'] : '')); |
|
1448 | 1446 | // if php type == struct, map value to the <all> element names |
1449 | 1447 | if ($phpType == 'struct') { |
1450 | 1448 | if (isset($typeDef['typeClass']) && $typeDef['typeClass'] == 'element') { |
@@ -1467,7 +1465,7 @@ discard block |
||
1467 | 1465 | // TODO: depends on minOccurs and nillable |
1468 | 1466 | $xml = "<$elementName$elementNS/>"; |
1469 | 1467 | } else { |
1470 | - $xml = "<$elementName$elementNS xsi:nil=\"true\" xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"/>"; |
|
1468 | + $xml = "<$elementName$elementNS xsi:nil=\"true\" xsi:type=\"".$this->getPrefixFromNamespace($ns).":$uqType\"/>"; |
|
1471 | 1469 | } |
1472 | 1470 | $this->debug("in serializeType: returning: $xml"); |
1473 | 1471 | return $xml; |
@@ -1479,12 +1477,12 @@ discard block |
||
1479 | 1477 | $elementAttrs = $this->serializeComplexTypeAttributes($typeDef, $value, $ns, $uqType); |
1480 | 1478 | if ($use == 'literal') { |
1481 | 1479 | if ($forceType) { |
1482 | - $xml = "<$elementName$elementNS$elementAttrs xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\">"; |
|
1480 | + $xml = "<$elementName$elementNS$elementAttrs xsi:type=\"".$this->getPrefixFromNamespace($ns).":$uqType\">"; |
|
1483 | 1481 | } else { |
1484 | 1482 | $xml = "<$elementName$elementNS$elementAttrs>"; |
1485 | 1483 | } |
1486 | 1484 | } else { |
1487 | - $xml = "<$elementName$elementNS$elementAttrs xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"$encodingStyle>"; |
|
1485 | + $xml = "<$elementName$elementNS$elementAttrs xsi:type=\"".$this->getPrefixFromNamespace($ns).":$uqType\"$encodingStyle>"; |
|
1488 | 1486 | } |
1489 | 1487 | |
1490 | 1488 | if (isset($typeDef['simpleContent']) && $typeDef['simpleContent'] == 'true') { |
@@ -1519,13 +1517,13 @@ discard block |
||
1519 | 1517 | // TODO: depends on minOccurs |
1520 | 1518 | $xml = "<$name$elementNS/>"; |
1521 | 1519 | } else { |
1522 | - $xml = "<$name$elementNS xsi:nil=\"true\" xsi:type=\"" . |
|
1523 | - $this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/') . |
|
1524 | - ":Array\" " . |
|
1525 | - $this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/') . |
|
1526 | - ':arrayType="' . |
|
1527 | - $this->getPrefixFromNamespace($this->getPrefix($typeDef['arrayType'])) . |
|
1528 | - ':' . |
|
1520 | + $xml = "<$name$elementNS xsi:nil=\"true\" xsi:type=\"". |
|
1521 | + $this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/'). |
|
1522 | + ":Array\" ". |
|
1523 | + $this->getPrefixFromNamespace('http://schemas.xmlsoap.org/soap/encoding/'). |
|
1524 | + ':arrayType="'. |
|
1525 | + $this->getPrefixFromNamespace($this->getPrefix($typeDef['arrayType'])). |
|
1526 | + ':'. |
|
1529 | 1527 | $this->getLocalPart($typeDef['arrayType'])."[0]\"/>"; |
1530 | 1528 | } |
1531 | 1529 | $this->debug("in serializeType: returning: $xml"); |
@@ -1533,8 +1531,8 @@ discard block |
||
1533 | 1531 | } |
1534 | 1532 | if (isset($typeDef['multidimensional'])) { |
1535 | 1533 | $nv = array(); |
1536 | - foreach($value as $v) { |
|
1537 | - $cols = ',' . sizeof($v); |
|
1534 | + foreach ($value as $v) { |
|
1535 | + $cols = ','.sizeof($v); |
|
1538 | 1536 | $nv = array_merge($nv, $v); |
1539 | 1537 | } |
1540 | 1538 | $value = $nv; |
@@ -1544,10 +1542,10 @@ discard block |
||
1544 | 1542 | if (is_array($value) && sizeof($value) >= 1) { |
1545 | 1543 | $rows = sizeof($value); |
1546 | 1544 | $contents = ''; |
1547 | - foreach($value as $k => $v) { |
|
1545 | + foreach ($value as $k => $v) { |
|
1548 | 1546 | //$this->debug("serializing array element: $k, $v of type: $typeDef[arrayType]"); |
1549 | 1547 | //if (strpos($typeDef['arrayType'], ':') ) { |
1550 | - if (!in_array($typeDef['arrayType'],$this->typemap['http://www.w3.org/2001/XMLSchema'])) { |
|
1548 | + if (!in_array($typeDef['arrayType'], $this->typemap['http://www.w3.org/2001/XMLSchema'])) { |
|
1551 | 1549 | $contents .= $this->serializeType('item', $typeDef['arrayType'], $v, $use); |
1552 | 1550 | } else { |
1553 | 1551 | $contents .= $this->serialize_val($v, 'item', $typeDef['arrayType'], null, $this->XMLSchemaVersion, false, $use); |
@@ -1584,12 +1582,12 @@ discard block |
||
1584 | 1582 | } |
1585 | 1583 | if ($use == 'literal') { |
1586 | 1584 | if ($forceType) { |
1587 | - $xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\">$value</$name>"; |
|
1585 | + $xml = "<$name$elementNS xsi:type=\"".$this->getPrefixFromNamespace($ns).":$uqType\">$value</$name>"; |
|
1588 | 1586 | } else { |
1589 | 1587 | $xml = "<$name$elementNS>$value</$name>"; |
1590 | 1588 | } |
1591 | 1589 | } else { |
1592 | - $xml = "<$name$elementNS xsi:type=\"" . $this->getPrefixFromNamespace($ns) . ":$uqType\"$encodingStyle>$value</$name>"; |
|
1590 | + $xml = "<$name$elementNS xsi:type=\"".$this->getPrefixFromNamespace($ns).":$uqType\"$encodingStyle>$value</$name>"; |
|
1593 | 1591 | } |
1594 | 1592 | } |
1595 | 1593 | $this->debug("in serializeType: returning: $xml"); |
@@ -1633,22 +1631,22 @@ discard block |
||
1633 | 1631 | $xvalue = array(); |
1634 | 1632 | } |
1635 | 1633 | foreach ($typeDef['attrs'] as $aName => $attrs) { |
1636 | - if (isset($xvalue['!' . $aName])) { |
|
1637 | - $xname = '!' . $aName; |
|
1634 | + if (isset($xvalue['!'.$aName])) { |
|
1635 | + $xname = '!'.$aName; |
|
1638 | 1636 | $this->debug("value provided for attribute $aName with key $xname"); |
1639 | 1637 | } elseif (isset($xvalue[$aName])) { |
1640 | 1638 | $xname = $aName; |
1641 | 1639 | $this->debug("value provided for attribute $aName with key $xname"); |
1642 | 1640 | } elseif (isset($attrs['default'])) { |
1643 | - $xname = '!' . $aName; |
|
1641 | + $xname = '!'.$aName; |
|
1644 | 1642 | $xvalue[$xname] = $attrs['default']; |
1645 | - $this->debug('use default value of ' . $xvalue[$aName] . ' for attribute ' . $aName); |
|
1643 | + $this->debug('use default value of '.$xvalue[$aName].' for attribute '.$aName); |
|
1646 | 1644 | } else { |
1647 | 1645 | $xname = ''; |
1648 | 1646 | $this->debug("no value provided for attribute $aName"); |
1649 | 1647 | } |
1650 | 1648 | if ($xname) { |
1651 | - $xml .= " $aName=\"" . $this->expandEntities($xvalue[$xname]) . "\""; |
|
1649 | + $xml .= " $aName=\"".$this->expandEntities($xvalue[$xname])."\""; |
|
1652 | 1650 | } |
1653 | 1651 | } |
1654 | 1652 | } else { |
@@ -1669,7 +1667,7 @@ discard block |
||
1669 | 1667 | * @return string value serialized as an XML string |
1670 | 1668 | * @access private |
1671 | 1669 | */ |
1672 | - function serializeComplexTypeElements($typeDef, $value, $ns, $uqType, $use='encoded', $encodingStyle=false) { |
|
1670 | + function serializeComplexTypeElements($typeDef, $value, $ns, $uqType, $use = 'encoded', $encodingStyle = false) { |
|
1673 | 1671 | $this->debug("in serializeComplexTypeElements for XML Schema type $ns:$uqType"); |
1674 | 1672 | $xml = ''; |
1675 | 1673 | if (isset($typeDef['extensionBase'])) { |
@@ -1696,23 +1694,23 @@ discard block |
||
1696 | 1694 | $xvalue = array(); |
1697 | 1695 | } |
1698 | 1696 | // toggle whether all elements are present - ideally should validate against schema |
1699 | - if (count($typeDef['elements']) != count($xvalue)){ |
|
1697 | + if (count($typeDef['elements']) != count($xvalue)) { |
|
1700 | 1698 | $optionals = true; |
1701 | 1699 | } |
1702 | 1700 | foreach ($typeDef['elements'] as $eName => $attrs) { |
1703 | 1701 | if (!isset($xvalue[$eName])) { |
1704 | 1702 | if (isset($attrs['default'])) { |
1705 | 1703 | $xvalue[$eName] = $attrs['default']; |
1706 | - $this->debug('use default value of ' . $xvalue[$eName] . ' for element ' . $eName); |
|
1704 | + $this->debug('use default value of '.$xvalue[$eName].' for element '.$eName); |
|
1707 | 1705 | } |
1708 | 1706 | } |
1709 | 1707 | // if user took advantage of a minOccurs=0, then only serialize named parameters |
1710 | 1708 | if (isset($optionals) |
1711 | 1709 | && (!isset($xvalue[$eName])) |
1712 | - && ( (!isset($attrs['nillable'])) || $attrs['nillable'] != 'true') |
|
1713 | - ){ |
|
1710 | + && ((!isset($attrs['nillable'])) || $attrs['nillable'] != 'true') |
|
1711 | + ) { |
|
1714 | 1712 | if (isset($attrs['minOccurs']) && $attrs['minOccurs'] <> '0') { |
1715 | - $this->debug("apparent error: no value provided for element $eName with minOccurs=" . $attrs['minOccurs']); |
|
1713 | + $this->debug("apparent error: no value provided for element $eName with minOccurs=".$attrs['minOccurs']); |
|
1716 | 1714 | } |
1717 | 1715 | // do nothing |
1718 | 1716 | $this->debug("no value provided for complexType element $eName and element is not nillable, so serialize nothing"); |
@@ -1777,15 +1775,15 @@ discard block |
||
1777 | 1775 | * @see nusoap_xmlschema |
1778 | 1776 | * @access public |
1779 | 1777 | */ |
1780 | - function addComplexType($name,$typeClass='complexType',$phpType='array',$compositor='',$restrictionBase='',$elements=array(),$attrs=array(),$arrayType='') { |
|
1778 | + function addComplexType($name, $typeClass = 'complexType', $phpType = 'array', $compositor = '', $restrictionBase = '', $elements = array(), $attrs = array(), $arrayType = '') { |
|
1781 | 1779 | if (count($elements) > 0) { |
1782 | 1780 | $eElements = array(); |
1783 | - foreach($elements as $n => $e){ |
|
1781 | + foreach ($elements as $n => $e) { |
|
1784 | 1782 | // expand each element |
1785 | 1783 | $ee = array(); |
1786 | 1784 | foreach ($e as $k => $v) { |
1787 | - $k = strpos($k,':') ? $this->expandQname($k) : $k; |
|
1788 | - $v = strpos($v,':') ? $this->expandQname($v) : $v; |
|
1785 | + $k = strpos($k, ':') ? $this->expandQname($k) : $k; |
|
1786 | + $v = strpos($v, ':') ? $this->expandQname($v) : $v; |
|
1789 | 1787 | $ee[$k] = $v; |
1790 | 1788 | } |
1791 | 1789 | $eElements[$n] = $ee; |
@@ -1794,11 +1792,11 @@ discard block |
||
1794 | 1792 | } |
1795 | 1793 | |
1796 | 1794 | if (count($attrs) > 0) { |
1797 | - foreach($attrs as $n => $a){ |
|
1795 | + foreach ($attrs as $n => $a) { |
|
1798 | 1796 | // expand each attribute |
1799 | 1797 | foreach ($a as $k => $v) { |
1800 | - $k = strpos($k,':') ? $this->expandQname($k) : $k; |
|
1801 | - $v = strpos($v,':') ? $this->expandQname($v) : $v; |
|
1798 | + $k = strpos($k, ':') ? $this->expandQname($k) : $k; |
|
1799 | + $v = strpos($v, ':') ? $this->expandQname($v) : $v; |
|
1802 | 1800 | $aa[$k] = $v; |
1803 | 1801 | } |
1804 | 1802 | $eAttrs[$n] = $aa; |
@@ -1806,11 +1804,11 @@ discard block |
||
1806 | 1804 | $attrs = $eAttrs; |
1807 | 1805 | } |
1808 | 1806 | |
1809 | - $restrictionBase = strpos($restrictionBase,':') ? $this->expandQname($restrictionBase) : $restrictionBase; |
|
1810 | - $arrayType = strpos($arrayType,':') ? $this->expandQname($arrayType) : $arrayType; |
|
1807 | + $restrictionBase = strpos($restrictionBase, ':') ? $this->expandQname($restrictionBase) : $restrictionBase; |
|
1808 | + $arrayType = strpos($arrayType, ':') ? $this->expandQname($arrayType) : $arrayType; |
|
1811 | 1809 | |
1812 | 1810 | $typens = isset($this->namespaces['types']) ? $this->namespaces['types'] : $this->namespaces['tns']; |
1813 | - $this->schemas[$typens][0]->addComplexType($name,$typeClass,$phpType,$compositor,$restrictionBase,$elements,$attrs,$arrayType); |
|
1811 | + $this->schemas[$typens][0]->addComplexType($name, $typeClass, $phpType, $compositor, $restrictionBase, $elements, $attrs, $arrayType); |
|
1814 | 1812 | } |
1815 | 1813 | |
1816 | 1814 | /** |
@@ -1824,8 +1822,8 @@ discard block |
||
1824 | 1822 | * @see nusoap_xmlschema |
1825 | 1823 | * @access public |
1826 | 1824 | */ |
1827 | - function addSimpleType($name, $restrictionBase='', $typeClass='simpleType', $phpType='scalar', $enumeration=array()) { |
|
1828 | - $restrictionBase = strpos($restrictionBase,':') ? $this->expandQname($restrictionBase) : $restrictionBase; |
|
1825 | + function addSimpleType($name, $restrictionBase = '', $typeClass = 'simpleType', $phpType = 'scalar', $enumeration = array()) { |
|
1826 | + $restrictionBase = strpos($restrictionBase, ':') ? $this->expandQname($restrictionBase) : $restrictionBase; |
|
1829 | 1827 | |
1830 | 1828 | $typens = isset($this->namespaces['types']) ? $this->namespaces['types'] : $this->namespaces['tns']; |
1831 | 1829 | $this->schemas[$typens][0]->addSimpleType($name, $restrictionBase, $typeClass, $phpType, $enumeration); |
@@ -1857,7 +1855,7 @@ discard block |
||
1857 | 1855 | * @param string $encodingStyle optional (usually 'http://schemas.xmlsoap.org/soap/encoding/' for encoded) |
1858 | 1856 | * @access public |
1859 | 1857 | */ |
1860 | - function addOperation($name, $in = false, $out = false, $namespace = false, $soapaction = false, $style = 'rpc', $use = 'encoded', $documentation = '', $encodingStyle = ''){ |
|
1858 | + function addOperation($name, $in = false, $out = false, $namespace = false, $soapaction = false, $style = 'rpc', $use = 'encoded', $documentation = '', $encodingStyle = '') { |
|
1861 | 1859 | if ($use == 'encoded' && $encodingStyle == '') { |
1862 | 1860 | $encodingStyle = 'http://schemas.xmlsoap.org/soap/encoding/'; |
1863 | 1861 | } |
@@ -1867,24 +1865,24 @@ discard block |
||
1867 | 1865 | foreach ($in as $n => $t) { |
1868 | 1866 | $elements[$n] = array('name' => $n, 'type' => $t, 'form' => 'unqualified'); |
1869 | 1867 | } |
1870 | - $this->addComplexType($name . 'RequestType', 'complexType', 'struct', 'all', '', $elements); |
|
1871 | - $this->addElement(array('name' => $name, 'type' => $name . 'RequestType')); |
|
1872 | - $in = array('parameters' => 'tns:' . $name . '^'); |
|
1868 | + $this->addComplexType($name.'RequestType', 'complexType', 'struct', 'all', '', $elements); |
|
1869 | + $this->addElement(array('name' => $name, 'type' => $name.'RequestType')); |
|
1870 | + $in = array('parameters' => 'tns:'.$name.'^'); |
|
1873 | 1871 | |
1874 | 1872 | $elements = array(); |
1875 | 1873 | foreach ($out as $n => $t) { |
1876 | 1874 | $elements[$n] = array('name' => $n, 'type' => $t, 'form' => 'unqualified'); |
1877 | 1875 | } |
1878 | - $this->addComplexType($name . 'ResponseType', 'complexType', 'struct', 'all', '', $elements); |
|
1879 | - $this->addElement(array('name' => $name . 'Response', 'type' => $name . 'ResponseType', 'form' => 'qualified')); |
|
1880 | - $out = array('parameters' => 'tns:' . $name . 'Response' . '^'); |
|
1876 | + $this->addComplexType($name.'ResponseType', 'complexType', 'struct', 'all', '', $elements); |
|
1877 | + $this->addElement(array('name' => $name.'Response', 'type' => $name.'ResponseType', 'form' => 'qualified')); |
|
1878 | + $out = array('parameters' => 'tns:'.$name.'Response'.'^'); |
|
1881 | 1879 | } |
1882 | 1880 | |
1883 | 1881 | // get binding |
1884 | - $this->bindings[ $this->serviceName . 'Binding' ]['operations'][$name] = |
|
1882 | + $this->bindings[$this->serviceName.'Binding']['operations'][$name] = |
|
1885 | 1883 | array( |
1886 | 1884 | 'name' => $name, |
1887 | - 'binding' => $this->serviceName . 'Binding', |
|
1885 | + 'binding' => $this->serviceName.'Binding', |
|
1888 | 1886 | 'endpoint' => $this->endpoint, |
1889 | 1887 | 'soapAction' => $soapaction, |
1890 | 1888 | 'style' => $style, |
@@ -1892,42 +1890,42 @@ discard block |
||
1892 | 1890 | 'use' => $use, |
1893 | 1891 | 'namespace' => $namespace, |
1894 | 1892 | 'encodingStyle' => $encodingStyle, |
1895 | - 'message' => $name . 'Request', |
|
1893 | + 'message' => $name.'Request', |
|
1896 | 1894 | 'parts' => $in), |
1897 | 1895 | 'output' => array( |
1898 | 1896 | 'use' => $use, |
1899 | 1897 | 'namespace' => $namespace, |
1900 | 1898 | 'encodingStyle' => $encodingStyle, |
1901 | - 'message' => $name . 'Response', |
|
1899 | + 'message' => $name.'Response', |
|
1902 | 1900 | 'parts' => $out), |
1903 | 1901 | 'namespace' => $namespace, |
1904 | 1902 | 'transport' => 'http://schemas.xmlsoap.org/soap/http', |
1905 | 1903 | 'documentation' => $documentation); |
1906 | 1904 | // add portTypes |
1907 | 1905 | // add messages |
1908 | - if($in) |
|
1906 | + if ($in) |
|
1909 | 1907 | { |
1910 | - foreach($in as $pName => $pType) |
|
1908 | + foreach ($in as $pName => $pType) |
|
1911 | 1909 | { |
1912 | - if(strpos($pType,':')) { |
|
1910 | + if (strpos($pType, ':')) { |
|
1913 | 1911 | $pType = $this->getNamespaceFromPrefix($this->getPrefix($pType)).":".$this->getLocalPart($pType); |
1914 | 1912 | } |
1915 | 1913 | $this->messages[$name.'Request'][$pName] = $pType; |
1916 | 1914 | } |
1917 | 1915 | } else { |
1918 | - $this->messages[$name.'Request']= '0'; |
|
1916 | + $this->messages[$name.'Request'] = '0'; |
|
1919 | 1917 | } |
1920 | - if($out) |
|
1918 | + if ($out) |
|
1921 | 1919 | { |
1922 | - foreach($out as $pName => $pType) |
|
1920 | + foreach ($out as $pName => $pType) |
|
1923 | 1921 | { |
1924 | - if(strpos($pType,':')) { |
|
1922 | + if (strpos($pType, ':')) { |
|
1925 | 1923 | $pType = $this->getNamespaceFromPrefix($this->getPrefix($pType)).":".$this->getLocalPart($pType); |
1926 | 1924 | } |
1927 | 1925 | $this->messages[$name.'Response'][$pName] = $pType; |
1928 | 1926 | } |
1929 | 1927 | } else { |
1930 | - $this->messages[$name.'Response']= '0'; |
|
1928 | + $this->messages[$name.'Response'] = '0'; |
|
1931 | 1929 | } |
1932 | 1930 | return true; |
1933 | 1931 | } |
@@ -22,37 +22,37 @@ discard block |
||
22 | 22 | */ |
23 | 23 | class nusoap_client extends nusoap_base |
24 | 24 | { |
25 | - var $username = ''; // Username for HTTP authentication |
|
26 | - var $password = ''; // Password for HTTP authentication |
|
27 | - var $authtype = ''; // Type of HTTP authentication |
|
28 | - var $certRequest = array(); // Certificate for HTTP SSL authentication |
|
29 | - var $requestHeaders = false; // SOAP headers in request (text) |
|
30 | - var $responseHeaders = ''; // SOAP headers from response (incomplete namespace resolution) (text) |
|
31 | - var $responseHeader = NULL; // SOAP Header from response (parsed) |
|
32 | - var $document = ''; // SOAP body response portion (incomplete namespace resolution) (text) |
|
25 | + var $username = ''; // Username for HTTP authentication |
|
26 | + var $password = ''; // Password for HTTP authentication |
|
27 | + var $authtype = ''; // Type of HTTP authentication |
|
28 | + var $certRequest = array(); // Certificate for HTTP SSL authentication |
|
29 | + var $requestHeaders = false; // SOAP headers in request (text) |
|
30 | + var $responseHeaders = ''; // SOAP headers from response (incomplete namespace resolution) (text) |
|
31 | + var $responseHeader = NULL; // SOAP Header from response (parsed) |
|
32 | + var $document = ''; // SOAP body response portion (incomplete namespace resolution) (text) |
|
33 | 33 | var $endpoint; |
34 | - var $forceEndpoint = ''; // overrides WSDL endpoint |
|
34 | + var $forceEndpoint = ''; // overrides WSDL endpoint |
|
35 | 35 | var $proxyhost = ''; |
36 | 36 | var $proxyport = ''; |
37 | 37 | var $proxyusername = ''; |
38 | 38 | var $proxypassword = ''; |
39 | - var $portName = ''; // port name to use in WSDL |
|
40 | - var $xml_encoding = ''; // character set encoding of incoming (response) messages |
|
39 | + var $portName = ''; // port name to use in WSDL |
|
40 | + var $xml_encoding = ''; // character set encoding of incoming (response) messages |
|
41 | 41 | var $http_encoding = false; |
42 | - var $timeout = 0; // HTTP connection timeout |
|
43 | - var $response_timeout = 30; // HTTP response timeout |
|
44 | - var $endpointType = ''; // soap|wsdl, empty for WSDL initialization error |
|
42 | + var $timeout = 0; // HTTP connection timeout |
|
43 | + var $response_timeout = 30; // HTTP response timeout |
|
44 | + var $endpointType = ''; // soap|wsdl, empty for WSDL initialization error |
|
45 | 45 | var $persistentConnection = false; |
46 | - var $defaultRpcParams = false; // This is no longer used |
|
47 | - var $request = ''; // HTTP request |
|
48 | - var $response = ''; // HTTP response |
|
49 | - var $responseData = ''; // SOAP payload of response |
|
50 | - var $cookies = array(); // Cookies from response or for request |
|
51 | - var $decode_utf8 = true; // toggles whether the parser decodes element content w/ utf8_decode() |
|
52 | - var $operations = array(); // WSDL operations, empty for WSDL initialization error |
|
53 | - var $curl_options = array(); // User-specified cURL options |
|
54 | - var $bindingType = ''; // WSDL operation binding type |
|
55 | - var $use_curl = false; // whether to always try to use cURL |
|
46 | + var $defaultRpcParams = false; // This is no longer used |
|
47 | + var $request = ''; // HTTP request |
|
48 | + var $response = ''; // HTTP response |
|
49 | + var $responseData = ''; // SOAP payload of response |
|
50 | + var $cookies = array(); // Cookies from response or for request |
|
51 | + var $decode_utf8 = true; // toggles whether the parser decodes element content w/ utf8_decode() |
|
52 | + var $operations = array(); // WSDL operations, empty for WSDL initialization error |
|
53 | + var $curl_options = array(); // User-specified cURL options |
|
54 | + var $bindingType = ''; // WSDL operation binding type |
|
55 | + var $use_curl = false; // whether to always try to use cURL |
|
56 | 56 | |
57 | 57 | /* |
58 | 58 | * fault related variables |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | * @param string $portName optional portName in WSDL document |
93 | 93 | * @access public |
94 | 94 | */ |
95 | - function __construct($endpoint,$wsdl = false,$proxyhost = false,$proxyport = false,$proxyusername = false, $proxypassword = false, $timeout = 0, $response_timeout = 30, $portName = ''){ |
|
95 | + function __construct($endpoint, $wsdl = false, $proxyhost = false, $proxyport = false, $proxyusername = false, $proxypassword = false, $timeout = 0, $response_timeout = 30, $portName = '') { |
|
96 | 96 | parent::__construct(); |
97 | 97 | $this->endpoint = $endpoint; |
98 | 98 | $this->proxyhost = $proxyhost; |
@@ -104,20 +104,20 @@ discard block |
||
104 | 104 | $this->portName = $portName; |
105 | 105 | |
106 | 106 | $this->debug("ctor wsdl=$wsdl timeout=$timeout response_timeout=$response_timeout"); |
107 | - $this->appendDebug('endpoint=' . $this->varDump($endpoint)); |
|
107 | + $this->appendDebug('endpoint='.$this->varDump($endpoint)); |
|
108 | 108 | |
109 | 109 | // make values |
110 | - if($wsdl){ |
|
110 | + if ($wsdl) { |
|
111 | 111 | if (is_object($endpoint) && (get_class($endpoint) == 'wsdl')) { |
112 | 112 | $this->wsdl = $endpoint; |
113 | 113 | $this->endpoint = $this->wsdl->wsdl; |
114 | 114 | $this->wsdlFile = $this->endpoint; |
115 | - $this->debug('existing wsdl instance created from ' . $this->endpoint); |
|
115 | + $this->debug('existing wsdl instance created from '.$this->endpoint); |
|
116 | 116 | $this->checkWSDL(); |
117 | 117 | } else { |
118 | 118 | $this->wsdlFile = $this->endpoint; |
119 | 119 | $this->wsdl = null; |
120 | - $this->debug('will use lazy evaluation of wsdl from ' . $this->endpoint); |
|
120 | + $this->debug('will use lazy evaluation of wsdl from '.$this->endpoint); |
|
121 | 121 | } |
122 | 122 | $this->endpointType = 'wsdl'; |
123 | 123 | } else { |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | * @return mixed response from SOAP call, normally an associative array mirroring the structure of the XML response, false for certain fatal errors |
152 | 152 | * @access public |
153 | 153 | */ |
154 | - function call($operation,$params=array(),$namespace='http://tempuri.org',$soapAction='',$headers=false,$rpcParams=null,$style='rpc',$use='encoded'){ |
|
154 | + function call($operation, $params = array(), $namespace = 'http://tempuri.org', $soapAction = '', $headers = false, $rpcParams = null, $style = 'rpc', $use = 'encoded') { |
|
155 | 155 | $this->operation = $operation; |
156 | 156 | $this->fault = false; |
157 | 157 | $this->setError(''); |
@@ -163,8 +163,8 @@ discard block |
||
163 | 163 | $this->opData = array(); |
164 | 164 | |
165 | 165 | $this->debug("call: operation=$operation, namespace=$namespace, soapAction=$soapAction, rpcParams=$rpcParams, style=$style, use=$use, endpointType=$this->endpointType"); |
166 | - $this->appendDebug('params=' . $this->varDump($params)); |
|
167 | - $this->appendDebug('headers=' . $this->varDump($headers)); |
|
166 | + $this->appendDebug('params='.$this->varDump($params)); |
|
167 | + $this->appendDebug('headers='.$this->varDump($headers)); |
|
168 | 168 | if ($headers) { |
169 | 169 | $this->requestHeaders = $headers; |
170 | 170 | } |
@@ -174,25 +174,25 @@ discard block |
||
174 | 174 | return false; |
175 | 175 | } |
176 | 176 | // serialize parameters |
177 | - if($this->endpointType == 'wsdl' && $opData = $this->getOperationData($operation)){ |
|
177 | + if ($this->endpointType == 'wsdl' && $opData = $this->getOperationData($operation)) { |
|
178 | 178 | // use WSDL for operation |
179 | 179 | $this->opData = $opData; |
180 | 180 | $this->debug("found operation"); |
181 | - $this->appendDebug('opData=' . $this->varDump($opData)); |
|
181 | + $this->appendDebug('opData='.$this->varDump($opData)); |
|
182 | 182 | if (isset($opData['soapAction'])) { |
183 | 183 | $soapAction = $opData['soapAction']; |
184 | 184 | } |
185 | - if (! $this->forceEndpoint) { |
|
185 | + if (!$this->forceEndpoint) { |
|
186 | 186 | $this->endpoint = $opData['endpoint']; |
187 | 187 | } else { |
188 | 188 | $this->endpoint = $this->forceEndpoint; |
189 | 189 | } |
190 | - $namespace = isset($opData['input']['namespace']) ? $opData['input']['namespace'] : $namespace; |
|
190 | + $namespace = isset($opData['input']['namespace']) ? $opData['input']['namespace'] : $namespace; |
|
191 | 191 | $style = $opData['style']; |
192 | 192 | $use = $opData['input']['use']; |
193 | 193 | // add ns to ns array |
194 | - if($namespace != '' && !isset($this->wsdl->namespaces[$namespace])){ |
|
195 | - $nsPrefix = 'ns' . rand(1000, 9999); |
|
194 | + if ($namespace != '' && !isset($this->wsdl->namespaces[$namespace])) { |
|
195 | + $nsPrefix = 'ns'.rand(1000, 9999); |
|
196 | 196 | $this->wsdl->namespaces[$nsPrefix] = $namespace; |
197 | 197 | } |
198 | 198 | $nsPrefix = $this->wsdl->getPrefixFromNamespace($namespace); |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | $payload = $params; |
203 | 203 | } elseif (is_array($params)) { |
204 | 204 | $this->debug("serializing param array for WSDL operation $operation"); |
205 | - $payload = $this->wsdl->serializeRPCParameters($operation,'input',$params,$this->bindingType); |
|
205 | + $payload = $this->wsdl->serializeRPCParameters($operation, 'input', $params, $this->bindingType); |
|
206 | 206 | } else { |
207 | 207 | $this->debug('params must be array or string'); |
208 | 208 | $this->setError('params must be array or string'); |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | $this->setError('wsdl error: '.$errstr); |
222 | 222 | return false; |
223 | 223 | } |
224 | - } elseif($this->endpointType == 'wsdl') { |
|
224 | + } elseif ($this->endpointType == 'wsdl') { |
|
225 | 225 | // operation not in WSDL |
226 | 226 | $this->appendDebug($this->wsdl->getDebug()); |
227 | 227 | $this->wsdl->clearDebug(); |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | } else { |
232 | 232 | // no WSDL |
233 | 233 | //$this->namespaces['ns1'] = $namespace; |
234 | - $nsPrefix = 'ns' . rand(1000, 9999); |
|
234 | + $nsPrefix = 'ns'.rand(1000, 9999); |
|
235 | 235 | // serialize |
236 | 236 | $payload = ''; |
237 | 237 | if (is_string($params)) { |
@@ -239,8 +239,8 @@ discard block |
||
239 | 239 | $payload = $params; |
240 | 240 | } elseif (is_array($params)) { |
241 | 241 | $this->debug("serializing param array for operation $operation"); |
242 | - foreach($params as $k => $v){ |
|
243 | - $payload .= $this->serialize_val($v,$k,false,false,false,false,$use); |
|
242 | + foreach ($params as $k => $v) { |
|
243 | + $payload .= $this->serialize_val($v, $k, false, false, false, false, $use); |
|
244 | 244 | } |
245 | 245 | } else { |
246 | 246 | $this->debug('params must be array or string'); |
@@ -260,45 +260,45 @@ discard block |
||
260 | 260 | $this->debug("wrapping RPC request with literal method element"); |
261 | 261 | if ($namespace) { |
262 | 262 | // 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 |
263 | - $payload = "<$nsPrefix:$operation xmlns:$nsPrefix=\"$namespace\">" . |
|
264 | - $payload . |
|
263 | + $payload = "<$nsPrefix:$operation xmlns:$nsPrefix=\"$namespace\">". |
|
264 | + $payload. |
|
265 | 265 | "</$nsPrefix:$operation>"; |
266 | 266 | } else { |
267 | - $payload = "<$operation>" . $payload . "</$operation>"; |
|
267 | + $payload = "<$operation>".$payload."</$operation>"; |
|
268 | 268 | } |
269 | 269 | } else { |
270 | 270 | $this->debug("wrapping RPC request with encoded method element"); |
271 | 271 | if ($namespace) { |
272 | - $payload = "<$nsPrefix:$operation xmlns:$nsPrefix=\"$namespace\">" . |
|
273 | - $payload . |
|
272 | + $payload = "<$nsPrefix:$operation xmlns:$nsPrefix=\"$namespace\">". |
|
273 | + $payload. |
|
274 | 274 | "</$nsPrefix:$operation>"; |
275 | 275 | } else { |
276 | - $payload = "<$operation>" . |
|
277 | - $payload . |
|
276 | + $payload = "<$operation>". |
|
277 | + $payload. |
|
278 | 278 | "</$operation>"; |
279 | 279 | } |
280 | 280 | } |
281 | 281 | } |
282 | 282 | // serialize envelope |
283 | - $soapmsg = $this->serializeEnvelope($payload,$this->requestHeaders,$usedNamespaces,$style,$use,$encodingStyle); |
|
283 | + $soapmsg = $this->serializeEnvelope($payload, $this->requestHeaders, $usedNamespaces, $style, $use, $encodingStyle); |
|
284 | 284 | $this->debug("endpoint=$this->endpoint, soapAction=$soapAction, namespace=$namespace, style=$style, use=$use, encodingStyle=$encodingStyle"); |
285 | - $this->debug('SOAP message length=' . strlen($soapmsg) . ' contents (max 1000 bytes)=' . substr($soapmsg, 0, 1000)); |
|
285 | + $this->debug('SOAP message length='.strlen($soapmsg).' contents (max 1000 bytes)='.substr($soapmsg, 0, 1000)); |
|
286 | 286 | // send |
287 | - $return = $this->send($this->getHTTPBody($soapmsg),$soapAction,$this->timeout,$this->response_timeout); |
|
288 | - if($errstr = $this->getError()){ |
|
287 | + $return = $this->send($this->getHTTPBody($soapmsg), $soapAction, $this->timeout, $this->response_timeout); |
|
288 | + if ($errstr = $this->getError()) { |
|
289 | 289 | $this->debug('Error: '.$errstr); |
290 | 290 | return false; |
291 | 291 | } else { |
292 | 292 | $this->return = $return; |
293 | 293 | $this->debug('sent message successfully and got a(n) '.gettype($return)); |
294 | - $this->appendDebug('return=' . $this->varDump($return)); |
|
294 | + $this->appendDebug('return='.$this->varDump($return)); |
|
295 | 295 | |
296 | 296 | // fault? |
297 | - if(is_array($return) && isset($return['faultcode'])){ |
|
297 | + if (is_array($return) && isset($return['faultcode'])) { |
|
298 | 298 | $this->debug('got fault'); |
299 | 299 | $this->setError($return['faultcode'].': '.$return['faultstring']); |
300 | 300 | $this->fault = true; |
301 | - foreach($return as $k => $v){ |
|
301 | + foreach ($return as $k => $v) { |
|
302 | 302 | $this->$k = $v; |
303 | 303 | $this->debug("$k = $v<br>"); |
304 | 304 | } |
@@ -309,10 +309,10 @@ discard block |
||
309 | 309 | return $return; |
310 | 310 | } else { |
311 | 311 | // array of return values |
312 | - if(is_array($return)){ |
|
312 | + if (is_array($return)) { |
|
313 | 313 | // multiple 'out' parameters, which we return wrapped up |
314 | 314 | // in the array |
315 | - if(sizeof($return) > 1){ |
|
315 | + if (sizeof($return) > 1) { |
|
316 | 316 | return $return; |
317 | 317 | } |
318 | 318 | // single 'out' parameter (normally the return value) |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | */ |
370 | 370 | function loadWSDL() { |
371 | 371 | $this->debug('instantiating wsdl class with doc: '.$this->wsdlFile); |
372 | - $this->wsdl = new wsdl('',$this->proxyhost,$this->proxyport,$this->proxyusername,$this->proxypassword,$this->timeout,$this->response_timeout,$this->curl_options,$this->use_curl); |
|
372 | + $this->wsdl = new wsdl('', $this->proxyhost, $this->proxyport, $this->proxyusername, $this->proxypassword, $this->timeout, $this->response_timeout, $this->curl_options, $this->use_curl); |
|
373 | 373 | $this->wsdl->setCredentials($this->username, $this->password, $this->authtype, $this->certRequest); |
374 | 374 | $this->wsdl->fetchWSDL($this->wsdlFile); |
375 | 375 | $this->checkWSDL(); |
@@ -382,13 +382,13 @@ discard block |
||
382 | 382 | * @return array array of data pertaining to the operation |
383 | 383 | * @access public |
384 | 384 | */ |
385 | - function getOperationData($operation){ |
|
385 | + function getOperationData($operation) { |
|
386 | 386 | if ($this->endpointType == 'wsdl' && is_null($this->wsdl)) { |
387 | 387 | $this->loadWSDL(); |
388 | 388 | if ($this->getError()) |
389 | 389 | return false; |
390 | 390 | } |
391 | - if(isset($this->operations[$operation])){ |
|
391 | + if (isset($this->operations[$operation])) { |
|
392 | 392 | return $this->operations[$operation]; |
393 | 393 | } |
394 | 394 | $this->debug("No data for operation: $operation"); |
@@ -408,15 +408,15 @@ discard block |
||
408 | 408 | * @return mixed native PHP types. |
409 | 409 | * @access private |
410 | 410 | */ |
411 | - function send($msg, $soapaction = '', $timeout=0, $response_timeout=30) { |
|
411 | + function send($msg, $soapaction = '', $timeout = 0, $response_timeout = 30) { |
|
412 | 412 | $this->checkCookies(); |
413 | 413 | // detect transport |
414 | - switch(true){ |
|
414 | + switch (true) { |
|
415 | 415 | // http(s) |
416 | - case preg_match('/^http/',$this->endpoint): |
|
416 | + case preg_match('/^http/', $this->endpoint): |
|
417 | 417 | $this->debug('transporting via HTTP'); |
418 | - if($this->persistentConnection == true && is_object($this->persistentConnection)){ |
|
419 | - $http =& $this->persistentConnection; |
|
418 | + if ($this->persistentConnection == true && is_object($this->persistentConnection)) { |
|
419 | + $http = & $this->persistentConnection; |
|
420 | 420 | } else { |
421 | 421 | $http = new soap_transport_http($this->endpoint, $this->curl_options, $this->use_curl); |
422 | 422 | if ($this->persistentConnection) { |
@@ -425,27 +425,27 @@ discard block |
||
425 | 425 | } |
426 | 426 | $http->setContentType($this->getHTTPContentType(), $this->getHTTPContentTypeCharset()); |
427 | 427 | $http->setSOAPAction($soapaction); |
428 | - if($this->proxyhost && $this->proxyport){ |
|
429 | - $http->setProxy($this->proxyhost,$this->proxyport,$this->proxyusername,$this->proxypassword); |
|
428 | + if ($this->proxyhost && $this->proxyport) { |
|
429 | + $http->setProxy($this->proxyhost, $this->proxyport, $this->proxyusername, $this->proxypassword); |
|
430 | 430 | } |
431 | - if($this->authtype != '') { |
|
431 | + if ($this->authtype != '') { |
|
432 | 432 | $http->setCredentials($this->username, $this->password, $this->authtype, array(), $this->certRequest); |
433 | 433 | } |
434 | - if($this->http_encoding != ''){ |
|
434 | + if ($this->http_encoding != '') { |
|
435 | 435 | $http->setEncoding($this->http_encoding); |
436 | 436 | } |
437 | 437 | $this->debug('sending message, length='.strlen($msg)); |
438 | - if(preg_match('/^http:/',$this->endpoint)){ |
|
438 | + if (preg_match('/^http:/', $this->endpoint)) { |
|
439 | 439 | //if(strpos($this->endpoint,'http:')){ |
440 | - $this->responseData = $http->send($msg,$timeout,$response_timeout,$this->cookies); |
|
441 | - } elseif(preg_match('/^https/',$this->endpoint)){ |
|
440 | + $this->responseData = $http->send($msg, $timeout, $response_timeout, $this->cookies); |
|
441 | + } elseif (preg_match('/^https/', $this->endpoint)) { |
|
442 | 442 | //} elseif(strpos($this->endpoint,'https:')){ |
443 | 443 | //if(phpversion() == '4.3.0-dev'){ |
444 | 444 | //$response = $http->send($msg,$timeout,$response_timeout); |
445 | 445 | //$this->request = $http->outgoing_payload; |
446 | 446 | //$this->response = $http->incoming_payload; |
447 | 447 | //} else |
448 | - $this->responseData = $http->sendHTTPS($msg,$timeout,$response_timeout,$this->cookies); |
|
448 | + $this->responseData = $http->sendHTTPS($msg, $timeout, $response_timeout, $this->cookies); |
|
449 | 449 | } else { |
450 | 450 | $this->setError('no http/s in endpoint url'); |
451 | 451 | } |
@@ -462,13 +462,13 @@ discard block |
||
462 | 462 | } |
463 | 463 | } |
464 | 464 | |
465 | - if($err = $http->getError()){ |
|
465 | + if ($err = $http->getError()) { |
|
466 | 466 | $this->setError('HTTP Error: '.$err); |
467 | 467 | return false; |
468 | - } elseif($this->getError()){ |
|
468 | + } elseif ($this->getError()) { |
|
469 | 469 | return false; |
470 | 470 | } else { |
471 | - $this->debug('got response, length='. strlen($this->responseData).' type='.$http->incoming_headers['content-type']); |
|
471 | + $this->debug('got response, length='.strlen($this->responseData).' type='.$http->incoming_headers['content-type']); |
|
472 | 472 | return $this->parseResponse($http->incoming_headers, $this->responseData); |
473 | 473 | } |
474 | 474 | break; |
@@ -488,20 +488,20 @@ discard block |
||
488 | 488 | * @access private |
489 | 489 | */ |
490 | 490 | function parseResponse($headers, $data) { |
491 | - $this->debug('Entering parseResponse() for data of length ' . strlen($data) . ' headers:'); |
|
491 | + $this->debug('Entering parseResponse() for data of length '.strlen($data).' headers:'); |
|
492 | 492 | $this->appendDebug($this->varDump($headers)); |
493 | 493 | if (!isset($headers['content-type'])) { |
494 | 494 | $this->setError('Response not of type text/xml (no content-type header)'); |
495 | 495 | return false; |
496 | 496 | } |
497 | 497 | if (!strstr($headers['content-type'], 'text/xml')) { |
498 | - $this->setError('Response not of type text/xml: ' . $headers['content-type']); |
|
498 | + $this->setError('Response not of type text/xml: '.$headers['content-type']); |
|
499 | 499 | return false; |
500 | 500 | } |
501 | 501 | if (strpos($headers['content-type'], '=')) { |
502 | 502 | $enc = str_replace('"', '', substr(strstr($headers["content-type"], '='), 1)); |
503 | - $this->debug('Got response encoding: ' . $enc); |
|
504 | - if(preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i',$enc)){ |
|
503 | + $this->debug('Got response encoding: '.$enc); |
|
504 | + if (preg_match('/^(ISO-8859-1|US-ASCII|UTF-8)$/i', $enc)) { |
|
505 | 505 | $this->xml_encoding = strtoupper($enc); |
506 | 506 | } else { |
507 | 507 | $this->xml_encoding = 'US-ASCII'; |
@@ -510,13 +510,13 @@ discard block |
||
510 | 510 | // should be US-ASCII for HTTP 1.0 or ISO-8859-1 for HTTP 1.1 |
511 | 511 | $this->xml_encoding = 'ISO-8859-1'; |
512 | 512 | } |
513 | - $this->debug('Use encoding: ' . $this->xml_encoding . ' when creating nusoap_parser'); |
|
514 | - $parser = new nusoap_parser($data,$this->xml_encoding,$this->operation,$this->decode_utf8); |
|
513 | + $this->debug('Use encoding: '.$this->xml_encoding.' when creating nusoap_parser'); |
|
514 | + $parser = new nusoap_parser($data, $this->xml_encoding, $this->operation, $this->decode_utf8); |
|
515 | 515 | // add parser debug data to our debug |
516 | 516 | $this->appendDebug($parser->getDebug()); |
517 | 517 | // if parse errors |
518 | - if($errstr = $parser->getError()){ |
|
519 | - $this->setError( $errstr); |
|
518 | + if ($errstr = $parser->getError()) { |
|
519 | + $this->setError($errstr); |
|
520 | 520 | // destroy the parser object |
521 | 521 | unset($parser); |
522 | 522 | return false; |
@@ -566,7 +566,7 @@ discard block |
||
566 | 566 | * @param mixed $headers String of XML with SOAP header content, or array of soapval objects for SOAP headers |
567 | 567 | * @access public |
568 | 568 | */ |
569 | - function setHeaders($headers){ |
|
569 | + function setHeaders($headers) { |
|
570 | 570 | $this->debug("setHeaders headers="); |
571 | 571 | $this->appendDebug($this->varDump($headers)); |
572 | 572 | $this->requestHeaders = $headers; |
@@ -578,7 +578,7 @@ discard block |
||
578 | 578 | * @return string |
579 | 579 | * @access public |
580 | 580 | */ |
581 | - function getHeaders(){ |
|
581 | + function getHeaders() { |
|
582 | 582 | return $this->responseHeaders; |
583 | 583 | } |
584 | 584 | |
@@ -588,7 +588,7 @@ discard block |
||
588 | 588 | * @return mixed |
589 | 589 | * @access public |
590 | 590 | */ |
591 | - function getHeader(){ |
|
591 | + function getHeader() { |
|
592 | 592 | return $this->responseHeader; |
593 | 593 | } |
594 | 594 | |
@@ -632,7 +632,7 @@ discard block |
||
632 | 632 | * @param string $enc HTTP encoding |
633 | 633 | * @access public |
634 | 634 | */ |
635 | - function setHTTPEncoding($enc='gzip, deflate'){ |
|
635 | + function setHTTPEncoding($enc = 'gzip, deflate') { |
|
636 | 636 | $this->debug("setHTTPEncoding(\"$enc\")"); |
637 | 637 | $this->http_encoding = $enc; |
638 | 638 | } |
@@ -653,7 +653,7 @@ discard block |
||
653 | 653 | * |
654 | 654 | * @access public |
655 | 655 | */ |
656 | - function useHTTPPersistentConnection(){ |
|
656 | + function useHTTPPersistentConnection() { |
|
657 | 657 | $this->debug("useHTTPPersistentConnection"); |
658 | 658 | $this->persistentConnection = true; |
659 | 659 | } |
@@ -745,7 +745,7 @@ discard block |
||
745 | 745 | */ |
746 | 746 | function _getProxyClassCode($r) { |
747 | 747 | $this->debug("in getProxy endpointType=$this->endpointType"); |
748 | - $this->appendDebug("wsdl=" . $this->varDump($this->wsdl)); |
|
748 | + $this->appendDebug("wsdl=".$this->varDump($this->wsdl)); |
|
749 | 749 | if ($this->endpointType != 'wsdl') { |
750 | 750 | $evalStr = 'A proxy can only be created for a WSDL client'; |
751 | 751 | $this->setError($evalStr); |
@@ -755,7 +755,7 @@ discard block |
||
755 | 755 | if ($this->endpointType == 'wsdl' && is_null($this->wsdl)) { |
756 | 756 | $this->loadWSDL(); |
757 | 757 | if ($this->getError()) { |
758 | - return "echo \"" . $this->getError() . "\";"; |
|
758 | + return "echo \"".$this->getError()."\";"; |
|
759 | 759 | } |
760 | 760 | } |
761 | 761 | $evalStr = ''; |
@@ -771,9 +771,9 @@ discard block |
||
771 | 771 | $paramArrayStr .= "'$name' => \$$name, "; |
772 | 772 | $paramCommentStr .= "$type \$$name, "; |
773 | 773 | } |
774 | - $paramStr = substr($paramStr, 0, strlen($paramStr)-2); |
|
775 | - $paramArrayStr = substr($paramArrayStr, 0, strlen($paramArrayStr)-2); |
|
776 | - $paramCommentStr = substr($paramCommentStr, 0, strlen($paramCommentStr)-2); |
|
774 | + $paramStr = substr($paramStr, 0, strlen($paramStr) - 2); |
|
775 | + $paramArrayStr = substr($paramArrayStr, 0, strlen($paramArrayStr) - 2); |
|
776 | + $paramCommentStr = substr($paramCommentStr, 0, strlen($paramCommentStr) - 2); |
|
777 | 777 | } else { |
778 | 778 | $paramStr = ''; |
779 | 779 | $paramArrayStr = ''; |
@@ -781,7 +781,7 @@ discard block |
||
781 | 781 | } |
782 | 782 | $opData['namespace'] = !isset($opData['namespace']) ? 'http://testuri.com' : $opData['namespace']; |
783 | 783 | $evalStr .= "// $paramCommentStr |
784 | - function " . str_replace('.', '__', $operation) . "($paramStr) { |
|
784 | + function ".str_replace('.', '__', $operation)."($paramStr) { |
|
785 | 785 | \$params = array($paramArrayStr); |
786 | 786 | return \$this->call('$operation', \$params, '".$opData['namespace']."', '".(isset($opData['soapAction']) ? $opData['soapAction'] : '')."'); |
787 | 787 | } |
@@ -849,7 +849,7 @@ discard block |
||
849 | 849 | * @return always returns true |
850 | 850 | * @access public |
851 | 851 | */ |
852 | - function decodeUTF8($bool){ |
|
852 | + function decodeUTF8($bool) { |
|
853 | 853 | $this->decode_utf8 = $bool; |
854 | 854 | return true; |
855 | 855 | } |
@@ -890,19 +890,19 @@ discard block |
||
890 | 890 | if (sizeof($this->cookies) == 0) { |
891 | 891 | return true; |
892 | 892 | } |
893 | - $this->debug('checkCookie: check ' . sizeof($this->cookies) . ' cookies'); |
|
893 | + $this->debug('checkCookie: check '.sizeof($this->cookies).' cookies'); |
|
894 | 894 | $curr_cookies = $this->cookies; |
895 | 895 | $this->cookies = array(); |
896 | 896 | foreach ($curr_cookies as $cookie) { |
897 | - if (! is_array($cookie)) { |
|
897 | + if (!is_array($cookie)) { |
|
898 | 898 | $this->debug('Remove cookie that is not an array'); |
899 | 899 | continue; |
900 | 900 | } |
901 | - if ((isset($cookie['expires'])) && (! empty($cookie['expires']))) { |
|
901 | + if ((isset($cookie['expires'])) && (!empty($cookie['expires']))) { |
|
902 | 902 | if (strtotime($cookie['expires']) > time()) { |
903 | 903 | $this->cookies[] = $cookie; |
904 | 904 | } else { |
905 | - $this->debug('Remove expired cookie ' . $cookie['name']); |
|
905 | + $this->debug('Remove expired cookie '.$cookie['name']); |
|
906 | 906 | } |
907 | 907 | } else { |
908 | 908 | $this->cookies[] = $cookie; |
@@ -966,11 +966,11 @@ discard block |
||
966 | 966 | } |
967 | 967 | $this->cookies[$i] = $newCookie; |
968 | 968 | $found = true; |
969 | - $this->debug('Update cookie ' . $newName . '=' . $newCookie['value']); |
|
969 | + $this->debug('Update cookie '.$newName.'='.$newCookie['value']); |
|
970 | 970 | break; |
971 | 971 | } |
972 | - if (! $found) { |
|
973 | - $this->debug('Add cookie ' . $newName . '=' . $newCookie['value']); |
|
972 | + if (!$found) { |
|
973 | + $this->debug('Add cookie '.$newName.'='.$newCookie['value']); |
|
974 | 974 | $this->cookies[] = $newCookie; |
975 | 975 | } |
976 | 976 | } |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | * @param mixed $attributes associative array of attributes to add to element serialization |
68 | 68 | * @access public |
69 | 69 | */ |
70 | - function __construct($name='soapval',$type=false,$value=-1,$element_ns=false,$type_ns=false,$attributes=false) { |
|
70 | + function __construct($name = 'soapval', $type = false, $value = -1, $element_ns = false, $type_ns = false, $attributes = false) { |
|
71 | 71 | parent::__construct(); |
72 | 72 | $this->name = $name; |
73 | 73 | $this->type = $type; |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | * @return string XML data |
85 | 85 | * @access public |
86 | 86 | */ |
87 | - function serialize($use='encoded') { |
|
87 | + function serialize($use = 'encoded') { |
|
88 | 88 | return $this->serialize_val($this->value, $this->name, $this->type, $this->element_ns, $this->type_ns, $this->attributes, $use, true); |
89 | 89 | } |
90 | 90 | |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | * @return mixed |
95 | 95 | * @access public |
96 | 96 | */ |
97 | - function decode(){ |
|
97 | + function decode() { |
|
98 | 98 | return $this->value; |
99 | 99 | } |
100 | 100 | } |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | var $root_struct_name = ''; |
19 | 19 | var $root_struct_namespace = ''; |
20 | 20 | var $root_header = ''; |
21 | - var $document = ''; // incoming SOAP body (text) |
|
21 | + var $document = ''; // incoming SOAP body (text) |
|
22 | 22 | // determines where in the message we are (envelope,header,body,method) |
23 | 23 | var $status = ''; |
24 | 24 | var $position = 0; |
@@ -33,9 +33,9 @@ discard block |
||
33 | 33 | var $fault_detail = ''; |
34 | 34 | var $depth_array = array(); |
35 | 35 | var $debug_flag = true; |
36 | - var $soapresponse = NULL; // parsed SOAP Body |
|
37 | - var $soapheader = NULL; // parsed SOAP Header |
|
38 | - var $responseHeaders = ''; // incoming SOAP headers (text) |
|
36 | + var $soapresponse = NULL; // parsed SOAP Body |
|
37 | + var $soapheader = NULL; // parsed SOAP Header |
|
38 | + var $responseHeaders = ''; // incoming SOAP headers (text) |
|
39 | 39 | var $body_position = 0; |
40 | 40 | // for multiref parsing: |
41 | 41 | // array of id => pos |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | * @return void|bool |
56 | 56 | * @access public |
57 | 57 | */ |
58 | - function __construct($xml,$encoding='UTF-8',$method='',$decode_utf8=true) |
|
58 | + function __construct($xml, $encoding = 'UTF-8', $method = '', $decode_utf8 = true) |
|
59 | 59 | { |
60 | 60 | parent::__construct(); |
61 | 61 | $this->xml = $xml; |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | $this->decode_utf8 = $decode_utf8; |
65 | 65 | |
66 | 66 | // Check whether content has been read. |
67 | - if(!empty($this->xml)){ |
|
67 | + if (!empty($this->xml)) { |
|
68 | 68 | // Check XML encoding |
69 | 69 | $pos_xml = strpos($xml, '<?xml'); |
70 | 70 | if ($pos_xml !== FALSE) { |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | if (preg_match("/encoding=[\"']([^\"']*)[\"']/", $xml_decl, $res)) { |
73 | 73 | $xml_encoding = $res[1]; |
74 | 74 | if (strtoupper($xml_encoding) != $encoding) { |
75 | - $err = "Charset from HTTP Content-Type '" . $encoding . "' does not match encoding from XML declaration '" . $xml_encoding . "'"; |
|
75 | + $err = "Charset from HTTP Content-Type '".$encoding."' does not match encoding from XML declaration '".$xml_encoding."'"; |
|
76 | 76 | $this->debug($err); |
77 | 77 | if ($encoding != 'ISO-8859-1' || strtoupper($xml_encoding) != 'UTF-8') { |
78 | 78 | $this->setError($err); |
@@ -98,8 +98,8 @@ discard block |
||
98 | 98 | // Set the object for the parser. |
99 | 99 | xml_set_object($this->parser, $this); |
100 | 100 | // Set the element handlers for the parser. |
101 | - xml_set_element_handler($this->parser, 'start_element','end_element'); |
|
102 | - xml_set_character_data_handler($this->parser,'character_data'); |
|
101 | + xml_set_element_handler($this->parser, 'start_element', 'end_element'); |
|
102 | + xml_set_character_data_handler($this->parser, 'character_data'); |
|
103 | 103 | |
104 | 104 | xml_parse($this->parser, $this->xml); |
105 | 105 | |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | xml_get_current_line_number($this->parser), |
112 | 112 | xml_error_string(xml_get_error_code($this->parser))); |
113 | 113 | $this->debug($err); |
114 | - $this->debug("XML payload:\n" . $xml); |
|
114 | + $this->debug("XML payload:\n".$xml); |
|
115 | 115 | $this->setError($err); |
116 | 116 | } else { |
117 | 117 | $this->debug('in nusoap_parser ctor, message:'); |
@@ -120,18 +120,18 @@ discard block |
||
120 | 120 | // get final value |
121 | 121 | $this->soapresponse = $this->message[$this->root_struct]['result']; |
122 | 122 | // get header value |
123 | - if($this->root_header != '' && isset($this->message[$this->root_header]['result'])){ |
|
123 | + if ($this->root_header != '' && isset($this->message[$this->root_header]['result'])) { |
|
124 | 124 | $this->soapheader = $this->message[$this->root_header]['result']; |
125 | 125 | } |
126 | 126 | // resolve hrefs/ids |
127 | - if(sizeof($this->multirefs) > 0){ |
|
128 | - foreach($this->multirefs as $id => $hrefs){ |
|
127 | + if (sizeof($this->multirefs) > 0) { |
|
128 | + foreach ($this->multirefs as $id => $hrefs) { |
|
129 | 129 | $this->debug('resolving multirefs for id: '.$id); |
130 | 130 | $idVal = $this->buildVal($this->ids[$id]); |
131 | 131 | if (is_array($idVal) && isset($idVal['!id'])) { |
132 | 132 | unset($idVal['!id']); |
133 | 133 | } |
134 | - foreach($hrefs as $refPos => $ref){ |
|
134 | + foreach ($hrefs as $refPos => $ref) { |
|
135 | 135 | $this->debug('resolving href at pos '.$refPos); |
136 | 136 | $this->multirefs[$id][$refPos] = $idVal; |
137 | 137 | } |
@@ -159,13 +159,13 @@ discard block |
||
159 | 159 | // update class level pos |
160 | 160 | $pos = $this->position++; |
161 | 161 | // and set mine |
162 | - $this->message[$pos] = array('pos' => $pos,'children'=>'','cdata'=>''); |
|
162 | + $this->message[$pos] = array('pos' => $pos, 'children'=>'', 'cdata'=>''); |
|
163 | 163 | // depth = how many levels removed from root? |
164 | 164 | // set mine as current global depth and increment global depth value |
165 | 165 | $this->message[$pos]['depth'] = $this->depth++; |
166 | 166 | |
167 | 167 | // else add self as child to whoever the current parent is |
168 | - if($pos != 0){ |
|
168 | + if ($pos != 0) { |
|
169 | 169 | $this->message[$this->parent]['children'] .= '|'.$pos; |
170 | 170 | } |
171 | 171 | // set my parent |
@@ -175,11 +175,11 @@ discard block |
||
175 | 175 | // set self as current value for this depth |
176 | 176 | $this->depth_array[$this->depth] = $pos; |
177 | 177 | // get element prefix |
178 | - if(strpos($name,':')){ |
|
178 | + if (strpos($name, ':')) { |
|
179 | 179 | // get ns prefix |
180 | - $prefix = substr($name,0,strpos($name,':')); |
|
180 | + $prefix = substr($name, 0, strpos($name, ':')); |
|
181 | 181 | // get unqualified name |
182 | - $name = substr(strstr($name,':'),1); |
|
182 | + $name = substr(strstr($name, ':'), 1); |
|
183 | 183 | } |
184 | 184 | // set status |
185 | 185 | if ($name == 'Envelope' && $this->status == '') { |
@@ -187,11 +187,11 @@ discard block |
||
187 | 187 | } elseif ($name == 'Header' && $this->status == 'envelope') { |
188 | 188 | $this->root_header = $pos; |
189 | 189 | $this->status = 'header'; |
190 | - } elseif ($name == 'Body' && $this->status == 'envelope'){ |
|
190 | + } elseif ($name == 'Body' && $this->status == 'envelope') { |
|
191 | 191 | $this->status = 'body'; |
192 | 192 | $this->body_position = $pos; |
193 | 193 | // set method |
194 | - } elseif($this->status == 'body' && $pos == ($this->body_position+1)) { |
|
194 | + } elseif ($this->status == 'body' && $pos == ($this->body_position + 1)) { |
|
195 | 195 | $this->status = 'method'; |
196 | 196 | $this->root_struct_name = $name; |
197 | 197 | $this->root_struct = $pos; |
@@ -207,23 +207,23 @@ discard block |
||
207 | 207 | |
208 | 208 | // loop through atts, logging ns and type declarations |
209 | 209 | $attstr = ''; |
210 | - foreach($attrs as $key => $value){ |
|
210 | + foreach ($attrs as $key => $value) { |
|
211 | 211 | $key_prefix = $this->getPrefix($key); |
212 | 212 | $key_localpart = $this->getLocalPart($key); |
213 | 213 | // if ns declarations, add to class level array of valid namespaces |
214 | - if($key_prefix == 'xmlns'){ |
|
215 | - if(preg_match('/^http:\/\/www.w3.org\/[0-9]{4}\/XMLSchema$/',$value)){ |
|
214 | + if ($key_prefix == 'xmlns') { |
|
215 | + if (preg_match('/^http:\/\/www.w3.org\/[0-9]{4}\/XMLSchema$/', $value)) { |
|
216 | 216 | $this->XMLSchemaVersion = $value; |
217 | 217 | $this->namespaces['xsd'] = $this->XMLSchemaVersion; |
218 | 218 | $this->namespaces['xsi'] = $this->XMLSchemaVersion.'-instance'; |
219 | 219 | } |
220 | 220 | $this->namespaces[$key_localpart] = $value; |
221 | 221 | // set method namespace |
222 | - if($name == $this->root_struct_name){ |
|
222 | + if ($name == $this->root_struct_name) { |
|
223 | 223 | $this->methodNamespace = $value; |
224 | 224 | } |
225 | 225 | // if it's a type declaration, set type |
226 | - } elseif($key_localpart == 'type'){ |
|
226 | + } elseif ($key_localpart == 'type') { |
|
227 | 227 | if (isset($this->message[$pos]['type']) && $this->message[$pos]['type'] == 'array') { |
228 | 228 | // do nothing: already processed arrayType |
229 | 229 | } else { |
@@ -231,14 +231,14 @@ discard block |
||
231 | 231 | $value_localpart = $this->getLocalPart($value); |
232 | 232 | $this->message[$pos]['type'] = $value_localpart; |
233 | 233 | $this->message[$pos]['typePrefix'] = $value_prefix; |
234 | - if(isset($this->namespaces[$value_prefix])){ |
|
234 | + if (isset($this->namespaces[$value_prefix])) { |
|
235 | 235 | $this->message[$pos]['type_namespace'] = $this->namespaces[$value_prefix]; |
236 | - } else if(isset($attrs['xmlns:'.$value_prefix])) { |
|
236 | + } else if (isset($attrs['xmlns:'.$value_prefix])) { |
|
237 | 237 | $this->message[$pos]['type_namespace'] = $attrs['xmlns:'.$value_prefix]; |
238 | 238 | } |
239 | 239 | // should do something here with the namespace of specified type? |
240 | 240 | } |
241 | - } elseif($key_localpart == 'arrayType'){ |
|
241 | + } elseif ($key_localpart == 'arrayType') { |
|
242 | 242 | $this->message[$pos]['type'] = 'array'; |
243 | 243 | /* do arrayType ereg here |
244 | 244 | [1] arrayTypeValue ::= atype asize |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | [6] nextDimension ::= Digit+ ',' |
250 | 250 | */ |
251 | 251 | $expr = '/([A-Za-z0-9_]+):([A-Za-z]+[A-Za-z0-9_]+)\[([0-9]+),?([0-9]*)\]/'; |
252 | - if(preg_match($expr,$value,$regs)){ |
|
252 | + if (preg_match($expr, $value, $regs)) { |
|
253 | 253 | $this->message[$pos]['typePrefix'] = $regs[1]; |
254 | 254 | $this->message[$pos]['arrayTypePrefix'] = $regs[1]; |
255 | 255 | if (isset($this->namespaces[$regs[1]])) { |
@@ -262,22 +262,22 @@ discard block |
||
262 | 262 | $this->message[$pos]['arrayCols'] = $regs[4]; |
263 | 263 | } |
264 | 264 | // specifies nil value (or not) |
265 | - } elseif ($key_localpart == 'nil'){ |
|
265 | + } elseif ($key_localpart == 'nil') { |
|
266 | 266 | $this->message[$pos]['nil'] = ($value == 'true' || $value == '1'); |
267 | 267 | // some other attribute |
268 | 268 | } elseif ($key != 'href' && $key != 'xmlns' && $key_localpart != 'encodingStyle' && $key_localpart != 'root') { |
269 | - $this->message[$pos]['xattrs']['!' . $key] = $value; |
|
269 | + $this->message[$pos]['xattrs']['!'.$key] = $value; |
|
270 | 270 | } |
271 | 271 | |
272 | 272 | if ($key == 'xmlns') { |
273 | 273 | $this->default_namespace = $value; |
274 | 274 | } |
275 | 275 | // log id |
276 | - if($key == 'id'){ |
|
276 | + if ($key == 'id') { |
|
277 | 277 | $this->ids[$value] = $pos; |
278 | 278 | } |
279 | 279 | // root |
280 | - if($key_localpart == 'root' && $value == 1){ |
|
280 | + if ($key_localpart == 'root' && $value == 1) { |
|
281 | 281 | $this->status = 'method'; |
282 | 282 | $this->root_struct_name = $name; |
283 | 283 | $this->root_struct = $pos; |
@@ -287,18 +287,18 @@ discard block |
||
287 | 287 | $attstr .= " $key=\"$value\""; |
288 | 288 | } |
289 | 289 | // get namespace - must be done after namespace atts are processed |
290 | - if(isset($prefix)){ |
|
290 | + if (isset($prefix)) { |
|
291 | 291 | $this->message[$pos]['namespace'] = $this->namespaces[$prefix]; |
292 | 292 | $this->default_namespace = $this->namespaces[$prefix]; |
293 | 293 | } else { |
294 | 294 | $this->message[$pos]['namespace'] = $this->default_namespace; |
295 | 295 | } |
296 | - if($this->status == 'header'){ |
|
296 | + if ($this->status == 'header') { |
|
297 | 297 | if ($this->root_header != $pos) { |
298 | - $this->responseHeaders .= "<" . (isset($prefix) ? $prefix . ':' : '') . "$name$attstr>"; |
|
298 | + $this->responseHeaders .= "<".(isset($prefix) ? $prefix.':' : '')."$name$attstr>"; |
|
299 | 299 | } |
300 | - } elseif($this->root_struct_name != ''){ |
|
301 | - $this->document .= "<" . (isset($prefix) ? $prefix . ':' : '') . "$name$attstr>"; |
|
300 | + } elseif ($this->root_struct_name != '') { |
|
301 | + $this->document .= "<".(isset($prefix) ? $prefix.':' : '')."$name$attstr>"; |
|
302 | 302 | } |
303 | 303 | } |
304 | 304 | |
@@ -314,27 +314,27 @@ discard block |
||
314 | 314 | $pos = $this->depth_array[$this->depth--]; |
315 | 315 | |
316 | 316 | // get element prefix |
317 | - if(strpos($name,':')){ |
|
317 | + if (strpos($name, ':')) { |
|
318 | 318 | // get ns prefix |
319 | - $prefix = substr($name,0,strpos($name,':')); |
|
319 | + $prefix = substr($name, 0, strpos($name, ':')); |
|
320 | 320 | // get unqualified name |
321 | - $name = substr(strstr($name,':'),1); |
|
321 | + $name = substr(strstr($name, ':'), 1); |
|
322 | 322 | } |
323 | 323 | |
324 | 324 | // build to native type |
325 | - if(isset($this->body_position) && $pos > $this->body_position){ |
|
325 | + if (isset($this->body_position) && $pos > $this->body_position) { |
|
326 | 326 | // deal w/ multirefs |
327 | - if(isset($this->message[$pos]['attrs']['href'])){ |
|
327 | + if (isset($this->message[$pos]['attrs']['href'])) { |
|
328 | 328 | // get id |
329 | - $id = substr($this->message[$pos]['attrs']['href'],1); |
|
329 | + $id = substr($this->message[$pos]['attrs']['href'], 1); |
|
330 | 330 | // add placeholder to href array |
331 | 331 | $this->multirefs[$id][$pos] = 'placeholder'; |
332 | 332 | // add set a reference to it as the result value |
333 | - $this->message[$pos]['result'] =& $this->multirefs[$id][$pos]; |
|
333 | + $this->message[$pos]['result'] = & $this->multirefs[$id][$pos]; |
|
334 | 334 | // build complexType values |
335 | - } elseif($this->message[$pos]['children'] != ''){ |
|
335 | + } elseif ($this->message[$pos]['children'] != '') { |
|
336 | 336 | // if result has already been generated (struct/array) |
337 | - if(!isset($this->message[$pos]['result'])){ |
|
337 | + if (!isset($this->message[$pos]['result'])) { |
|
338 | 338 | $this->message[$pos]['result'] = $this->buildVal($pos); |
339 | 339 | } |
340 | 340 | // build complexType values of attributes and possibly simpleContent |
@@ -384,15 +384,15 @@ discard block |
||
384 | 384 | } |
385 | 385 | |
386 | 386 | // for doclit |
387 | - if($this->status == 'header'){ |
|
387 | + if ($this->status == 'header') { |
|
388 | 388 | if ($this->root_header != $pos) { |
389 | - $this->responseHeaders .= "</" . (isset($prefix) ? $prefix . ':' : '') . "$name>"; |
|
389 | + $this->responseHeaders .= "</".(isset($prefix) ? $prefix.':' : '')."$name>"; |
|
390 | 390 | } |
391 | - } elseif($pos >= $this->root_struct){ |
|
392 | - $this->document .= "</" . (isset($prefix) ? $prefix . ':' : '') . "$name>"; |
|
391 | + } elseif ($pos >= $this->root_struct) { |
|
392 | + $this->document .= "</".(isset($prefix) ? $prefix.':' : '')."$name>"; |
|
393 | 393 | } |
394 | 394 | // switch status |
395 | - if ($pos == $this->root_struct){ |
|
395 | + if ($pos == $this->root_struct) { |
|
396 | 396 | $this->status = 'body'; |
397 | 397 | $this->root_struct_namespace = $this->message[$pos]['namespace']; |
398 | 398 | } elseif ($pos == $this->root_header) { |
@@ -418,17 +418,17 @@ discard block |
||
418 | 418 | function character_data($parser, $data) |
419 | 419 | { |
420 | 420 | $pos = $this->depth_array[$this->depth]; |
421 | - if ($this->xml_encoding == 'UTF-8'){ |
|
421 | + if ($this->xml_encoding == 'UTF-8') { |
|
422 | 422 | // TODO: add an option to disable this for folks who want |
423 | 423 | // raw UTF-8 that, e.g., might not map to iso-8859-1 |
424 | 424 | // TODO: this can also be handled with xml_parser_set_option($this->parser, XML_OPTION_TARGET_ENCODING, "ISO-8859-1"); |
425 | - if($this->decode_utf8){ |
|
425 | + if ($this->decode_utf8) { |
|
426 | 426 | $data = utf8_decode($data); |
427 | 427 | } |
428 | 428 | } |
429 | 429 | $this->message[$pos]['cdata'] .= $data; |
430 | 430 | // for doclit |
431 | - if($this->status == 'header'){ |
|
431 | + if ($this->status == 'header') { |
|
432 | 432 | $this->responseHeaders .= $data; |
433 | 433 | } else { |
434 | 434 | $this->document .= $data; |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | * @access public |
443 | 443 | * @deprecated use get_soapbody instead |
444 | 444 | */ |
445 | - function get_response(){ |
|
445 | + function get_response() { |
|
446 | 446 | return $this->soapresponse; |
447 | 447 | } |
448 | 448 | |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | * @return mixed |
453 | 453 | * @access public |
454 | 454 | */ |
455 | - function get_soapbody(){ |
|
455 | + function get_soapbody() { |
|
456 | 456 | return $this->soapresponse; |
457 | 457 | } |
458 | 458 | |
@@ -462,7 +462,7 @@ discard block |
||
462 | 462 | * @return mixed |
463 | 463 | * @access public |
464 | 464 | */ |
465 | - function get_soapheader(){ |
|
465 | + function get_soapheader() { |
|
466 | 466 | return $this->soapheader; |
467 | 467 | } |
468 | 468 | |
@@ -472,7 +472,7 @@ discard block |
||
472 | 472 | * @return string XML or empty if no Header |
473 | 473 | * @access public |
474 | 474 | */ |
475 | - function getHeaders(){ |
|
475 | + function getHeaders() { |
|
476 | 476 | return $this->responseHeaders; |
477 | 477 | } |
478 | 478 | |
@@ -529,40 +529,40 @@ discard block |
||
529 | 529 | * @return mixed PHP value |
530 | 530 | * @access private |
531 | 531 | */ |
532 | - function buildVal($pos){ |
|
533 | - if(!isset($this->message[$pos]['type'])){ |
|
532 | + function buildVal($pos) { |
|
533 | + if (!isset($this->message[$pos]['type'])) { |
|
534 | 534 | $this->message[$pos]['type'] = ''; |
535 | 535 | } |
536 | 536 | $this->debug('in buildVal() for '.$this->message[$pos]['name']."(pos $pos) of type ".$this->message[$pos]['type']); |
537 | 537 | // if there are children... |
538 | - if($this->message[$pos]['children'] != ''){ |
|
538 | + if ($this->message[$pos]['children'] != '') { |
|
539 | 539 | $this->debug('in buildVal, there are children'); |
540 | - $children = explode('|',$this->message[$pos]['children']); |
|
540 | + $children = explode('|', $this->message[$pos]['children']); |
|
541 | 541 | array_shift($children); // knock off empty |
542 | 542 | // md array |
543 | - if(isset($this->message[$pos]['arrayCols']) && $this->message[$pos]['arrayCols'] != ''){ |
|
544 | - $r=0; // rowcount |
|
545 | - $c=0; // colcount |
|
546 | - foreach($children as $child_pos){ |
|
543 | + if (isset($this->message[$pos]['arrayCols']) && $this->message[$pos]['arrayCols'] != '') { |
|
544 | + $r = 0; // rowcount |
|
545 | + $c = 0; // colcount |
|
546 | + foreach ($children as $child_pos) { |
|
547 | 547 | $this->debug("in buildVal, got an MD array element: $r, $c"); |
548 | 548 | $params[$r][] = $this->message[$child_pos]['result']; |
549 | 549 | $c++; |
550 | - if($c == $this->message[$pos]['arrayCols']){ |
|
550 | + if ($c == $this->message[$pos]['arrayCols']) { |
|
551 | 551 | $c = 0; |
552 | 552 | $r++; |
553 | 553 | } |
554 | 554 | } |
555 | 555 | // array |
556 | - } elseif($this->message[$pos]['type'] == 'array' || $this->message[$pos]['type'] == 'Array'){ |
|
556 | + } elseif ($this->message[$pos]['type'] == 'array' || $this->message[$pos]['type'] == 'Array') { |
|
557 | 557 | $this->debug('in buildVal, adding array '.$this->message[$pos]['name']); |
558 | - foreach($children as $child_pos){ |
|
558 | + foreach ($children as $child_pos) { |
|
559 | 559 | $params[] = &$this->message[$child_pos]['result']; |
560 | 560 | } |
561 | 561 | // apache Map type: java hashtable |
562 | - } elseif($this->message[$pos]['type'] == 'Map' && $this->message[$pos]['type_namespace'] == 'http://xml.apache.org/xml-soap'){ |
|
562 | + } elseif ($this->message[$pos]['type'] == 'Map' && $this->message[$pos]['type_namespace'] == 'http://xml.apache.org/xml-soap') { |
|
563 | 563 | $this->debug('in buildVal, Java Map '.$this->message[$pos]['name']); |
564 | - foreach($children as $child_pos){ |
|
565 | - $kv = explode("|",$this->message[$child_pos]['children']); |
|
564 | + foreach ($children as $child_pos) { |
|
565 | + $kv = explode("|", $this->message[$child_pos]['children']); |
|
566 | 566 | $params[$this->message[$kv[1]]['result']] = &$this->message[$kv[2]]['result']; |
567 | 567 | } |
568 | 568 | // generic compound type |
@@ -576,8 +576,8 @@ discard block |
||
576 | 576 | $notstruct = 0; |
577 | 577 | } |
578 | 578 | // |
579 | - foreach($children as $child_pos){ |
|
580 | - if($notstruct){ |
|
579 | + foreach ($children as $child_pos) { |
|
580 | + if ($notstruct) { |
|
581 | 581 | $params[] = &$this->message[$child_pos]['result']; |
582 | 582 | } else { |
583 | 583 | if (isset($params[$this->message[$child_pos]['name']])) { |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * @param integer $cache_lifetime lifetime for caching-files in seconds or 0 for unlimited |
46 | 46 | * @access public |
47 | 47 | */ |
48 | - function __construct($cache_dir='.', $cache_lifetime=0) { |
|
48 | + function __construct($cache_dir = '.', $cache_lifetime = 0) { |
|
49 | 49 | $this->fplock = array(); |
50 | 50 | $this->cache_dir = $cache_dir != '' ? $cache_dir : '.'; |
51 | 51 | $this->cache_lifetime = $cache_lifetime; |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | * @access private |
60 | 60 | */ |
61 | 61 | function createFilename($wsdl) { |
62 | - return $this->cache_dir.'/wsdlcache-' . md5($wsdl); |
|
62 | + return $this->cache_dir.'/wsdlcache-'.md5($wsdl); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | /** |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | * @param string $string debug data |
69 | 69 | * @access private |
70 | 70 | */ |
71 | - function debug($string){ |
|
71 | + function debug($string) { |
|
72 | 72 | $this->debug_str .= get_class($this).": $string\n"; |
73 | 73 | } |
74 | 74 | |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | $s = serialize($wsdl_instance); |
148 | 148 | if ($this->obtainMutex($filename, "w")) { |
149 | 149 | $fp = fopen($filename, "w"); |
150 | - if (! $fp) { |
|
150 | + if (!$fp) { |
|
151 | 151 | $this->debug("Cannot write $wsdl_instance->wsdl ($filename) in cache"); |
152 | 152 | $this->releaseMutex($filename); |
153 | 153 | return false; |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | $ret = flock($this->fplock[md5($filename)], LOCK_UN); |
175 | 175 | fclose($this->fplock[md5($filename)]); |
176 | 176 | unset($this->fplock[md5($filename)]); |
177 | - if (! $ret) { |
|
177 | + if (!$ret) { |
|
178 | 178 | $this->debug("Not able to release lock for $filename"); |
179 | 179 | } |
180 | 180 | return $ret; |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * @param string $faultstring human readable error message |
44 | 44 | * @param mixed $faultdetail detail, typically a string or array of string |
45 | 45 | */ |
46 | - public function __construct($faultcode,$faultactor='',$faultstring='',$faultdetail=''){ |
|
46 | + public function __construct($faultcode, $faultactor = '', $faultstring = '', $faultdetail = '') { |
|
47 | 47 | parent::__construct(); |
48 | 48 | $this->faultcode = $faultcode; |
49 | 49 | $this->faultactor = $faultactor; |
@@ -57,9 +57,9 @@ discard block |
||
57 | 57 | * @return string The serialization of the fault instance. |
58 | 58 | * @access public |
59 | 59 | */ |
60 | - function serialize(){ |
|
60 | + function serialize() { |
|
61 | 61 | $ns_string = ''; |
62 | - foreach($this->namespaces as $k => $v){ |
|
62 | + foreach ($this->namespaces as $k => $v) { |
|
63 | 63 | $ns_string .= "\n xmlns:$k=\"$v\""; |
64 | 64 | } |
65 | 65 | $return_msg = |
@@ -26,18 +26,18 @@ discard block |
||
26 | 26 | var $incoming_cookies = array(); |
27 | 27 | var $outgoing_payload = ''; |
28 | 28 | var $incoming_payload = ''; |
29 | - var $response_status_line; // HTTP response status line |
|
29 | + var $response_status_line; // HTTP response status line |
|
30 | 30 | var $useSOAPAction = true; |
31 | 31 | var $persistentConnection = false; |
32 | - var $ch = false; // cURL handle |
|
33 | - var $ch_options = array(); // cURL custom options |
|
34 | - var $use_curl = false; // force cURL use |
|
35 | - var $proxy = null; // proxy information (associative array) |
|
32 | + var $ch = false; // cURL handle |
|
33 | + var $ch_options = array(); // cURL custom options |
|
34 | + var $use_curl = false; // force cURL use |
|
35 | + var $proxy = null; // proxy information (associative array) |
|
36 | 36 | var $username = ''; |
37 | 37 | var $password = ''; |
38 | 38 | var $authtype = ''; |
39 | 39 | var $digestRequest = array(); |
40 | - var $certRequest = array(); // keys must be cainfofile (optional), sslcertfile, sslkeyfile, passphrase, certpassword (optional), verifypeer (optional), verifyhost (optional) |
|
40 | + var $certRequest = array(); // keys must be cainfofile (optional), sslcertfile, sslkeyfile, passphrase, certpassword (optional), verifypeer (optional), verifyhost (optional) |
|
41 | 41 | // cainfofile: certificate authority file, e.g. '$pathToPemFiles/rootca.pem' |
42 | 42 | // sslcertfile: SSL certificate file, e.g. '$pathToPemFiles/mycert.pem' |
43 | 43 | // sslkeyfile: SSL key file, e.g. '$pathToPemFiles/mykey.pem' |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | * @param boolean $use_curl Whether to try to force cURL use |
55 | 55 | * @access public |
56 | 56 | */ |
57 | - function __construct($url, $curl_options = NULL, $use_curl = false){ |
|
57 | + function __construct($url, $curl_options = NULL, $use_curl = false) { |
|
58 | 58 | parent::__construct(); |
59 | 59 | $this->debug("ctor url=$url use_curl=$use_curl curl_options:"); |
60 | 60 | $this->appendDebug($this->varDump($curl_options)); |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | $this->ch_options = $curl_options; |
64 | 64 | } |
65 | 65 | $this->use_curl = $use_curl; |
66 | - preg_match('/\$Revisio' . 'n: ([^ ]+)/', $this->revision, $rev); |
|
66 | + preg_match('/\$Revisio'.'n: ([^ ]+)/', $this->revision, $rev); |
|
67 | 67 | $this->setHeader('User-Agent', $this->title.'/'.$this->version.' ('.$rev[1].')'); |
68 | 68 | } |
69 | 69 | |
@@ -115,19 +115,19 @@ discard block |
||
115 | 115 | $this->url = $url; |
116 | 116 | |
117 | 117 | $u = parse_url($url); |
118 | - foreach($u as $k => $v){ |
|
118 | + foreach ($u as $k => $v) { |
|
119 | 119 | $this->debug("parsed URL $k = $v"); |
120 | 120 | $this->$k = $v; |
121 | 121 | } |
122 | 122 | |
123 | 123 | // add any GET params to path |
124 | - if(isset($u['query']) && $u['query'] != ''){ |
|
125 | - $this->path .= '?' . $u['query']; |
|
124 | + if (isset($u['query']) && $u['query'] != '') { |
|
125 | + $this->path .= '?'.$u['query']; |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | // set default port |
129 | - if(!isset($u['port'])){ |
|
130 | - if($u['scheme'] == 'https'){ |
|
129 | + if (!isset($u['port'])) { |
|
130 | + if ($u['scheme'] == 'https') { |
|
131 | 131 | $this->port = 443; |
132 | 132 | } else { |
133 | 133 | $this->port = 80; |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | * @return boolean true if connected, false if not |
172 | 172 | * @access private |
173 | 173 | */ |
174 | - function connect($connection_timeout=0,$response_timeout=30){ |
|
174 | + function connect($connection_timeout = 0, $response_timeout = 30) { |
|
175 | 175 | // For PHP 4.3 with OpenSSL, change https scheme to ssl, then treat like |
176 | 176 | // "regular" socket. |
177 | 177 | // TODO: disabled for now because OpenSSL must be *compiled* in (not just |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | } |
196 | 196 | |
197 | 197 | // use persistent connection |
198 | - if($this->persistentConnection && isset($this->fp) && is_resource($this->fp)){ |
|
198 | + if ($this->persistentConnection && isset($this->fp) && is_resource($this->fp)) { |
|
199 | 199 | if (!feof($this->fp)) { |
200 | 200 | $this->debug('Re-use persistent connection'); |
201 | 201 | return true; |
@@ -206,20 +206,20 @@ discard block |
||
206 | 206 | |
207 | 207 | // munge host if using OpenSSL |
208 | 208 | if ($this->scheme == 'ssl') { |
209 | - $host = 'ssl://' . $host; |
|
209 | + $host = 'ssl://'.$host; |
|
210 | 210 | } |
211 | - $this->debug('calling fsockopen with host ' . $host . ' connection_timeout ' . $connection_timeout); |
|
211 | + $this->debug('calling fsockopen with host '.$host.' connection_timeout '.$connection_timeout); |
|
212 | 212 | |
213 | 213 | // open socket |
214 | - if($connection_timeout > 0){ |
|
215 | - $this->fp = @fsockopen( $host, $this->port, $this->errno, $this->error_str, $connection_timeout); |
|
214 | + if ($connection_timeout > 0) { |
|
215 | + $this->fp = @fsockopen($host, $this->port, $this->errno, $this->error_str, $connection_timeout); |
|
216 | 216 | } else { |
217 | - $this->fp = @fsockopen( $host, $this->port, $this->errno, $this->error_str); |
|
217 | + $this->fp = @fsockopen($host, $this->port, $this->errno, $this->error_str); |
|
218 | 218 | } |
219 | 219 | |
220 | 220 | // test pointer |
221 | - if(!$this->fp) { |
|
222 | - $msg = 'Couldn\'t open socket connection to server ' . $this->url; |
|
221 | + if (!$this->fp) { |
|
222 | + $msg = 'Couldn\'t open socket connection to server '.$this->url; |
|
223 | 223 | if ($this->errno) { |
224 | 224 | $msg .= ', Error ('.$this->errno.'): '.$this->error_str; |
225 | 225 | } else { |
@@ -231,8 +231,8 @@ discard block |
||
231 | 231 | } |
232 | 232 | |
233 | 233 | // set response timeout |
234 | - $this->debug('set response timeout to ' . $response_timeout); |
|
235 | - socket_set_timeout( $this->fp, $response_timeout); |
|
234 | + $this->debug('set response timeout to '.$response_timeout); |
|
235 | + socket_set_timeout($this->fp, $response_timeout); |
|
236 | 236 | |
237 | 237 | $this->debug('socket connected'); |
238 | 238 | return true; |
@@ -391,8 +391,8 @@ discard block |
||
391 | 391 | $this->debug('cURL connection set up'); |
392 | 392 | return true; |
393 | 393 | } else { |
394 | - $this->setError('Unknown scheme ' . $this->scheme); |
|
395 | - $this->debug('Unknown scheme ' . $this->scheme); |
|
394 | + $this->setError('Unknown scheme '.$this->scheme); |
|
395 | + $this->debug('Unknown scheme '.$this->scheme); |
|
396 | 396 | return false; |
397 | 397 | } |
398 | 398 | } |
@@ -407,7 +407,7 @@ discard block |
||
407 | 407 | * @return string data |
408 | 408 | * @access public |
409 | 409 | */ |
410 | - function send($data, $timeout=0, $response_timeout=30, $cookies=NULL) { |
|
410 | + function send($data, $timeout = 0, $response_timeout = 30, $cookies = NULL) { |
|
411 | 411 | |
412 | 412 | $this->debug('entered send() with data of length: '.strlen($data)); |
413 | 413 | |
@@ -417,12 +417,12 @@ discard block |
||
417 | 417 | $this->tryagain = false; |
418 | 418 | if ($tries++ < 2) { |
419 | 419 | // make connnection |
420 | - if (!$this->connect($timeout, $response_timeout)){ |
|
420 | + if (!$this->connect($timeout, $response_timeout)) { |
|
421 | 421 | return false; |
422 | 422 | } |
423 | 423 | |
424 | 424 | // send request |
425 | - if (!$this->sendRequest($data, $cookies)){ |
|
425 | + if (!$this->sendRequest($data, $cookies)) { |
|
426 | 426 | return false; |
427 | 427 | } |
428 | 428 | |
@@ -448,7 +448,7 @@ discard block |
||
448 | 448 | * @access public |
449 | 449 | * @deprecated |
450 | 450 | */ |
451 | - function sendHTTPS($data, $timeout=0, $response_timeout=30, $cookies) { |
|
451 | + function sendHTTPS($data, $timeout = 0, $response_timeout = 30, $cookies) { |
|
452 | 452 | return $this->send($data, $timeout, $response_timeout, $cookies); |
453 | 453 | } |
454 | 454 | |
@@ -469,7 +469,7 @@ discard block |
||
469 | 469 | $this->appendDebug($this->varDump($certRequest)); |
470 | 470 | // cf. RFC 2617 |
471 | 471 | if ($authtype == 'basic') { |
472 | - $this->setHeader('Authorization', 'Basic '.base64_encode(str_replace(':','',$username).':'.$password)); |
|
472 | + $this->setHeader('Authorization', 'Basic '.base64_encode(str_replace(':', '', $username).':'.$password)); |
|
473 | 473 | } elseif ($authtype == 'digest') { |
474 | 474 | if (isset($digestRequest['nonce'])) { |
475 | 475 | $digestRequest['nc'] = isset($digestRequest['nc']) ? $digestRequest['nc']++ : 1; |
@@ -477,16 +477,16 @@ discard block |
||
477 | 477 | // calculate the Digest hashes (calculate code based on digest implementation found at: http://www.rassoc.com/gregr/weblog/stories/2002/07/09/webServicesSecurityHttpDigestAuthenticationWithoutActiveDirectory.html) |
478 | 478 | |
479 | 479 | // A1 = unq(username-value) ":" unq(realm-value) ":" passwd |
480 | - $A1 = $username. ':' . (isset($digestRequest['realm']) ? $digestRequest['realm'] : '') . ':' . $password; |
|
480 | + $A1 = $username.':'.(isset($digestRequest['realm']) ? $digestRequest['realm'] : '').':'.$password; |
|
481 | 481 | |
482 | 482 | // H(A1) = MD5(A1) |
483 | 483 | $HA1 = md5($A1); |
484 | 484 | |
485 | 485 | // A2 = Method ":" digest-uri-value |
486 | - $A2 = $this->request_method . ':' . $this->digest_uri; |
|
486 | + $A2 = $this->request_method.':'.$this->digest_uri; |
|
487 | 487 | |
488 | 488 | // H(A2) |
489 | - $HA2 = md5($A2); |
|
489 | + $HA2 = md5($A2); |
|
490 | 490 | |
491 | 491 | // KD(secret, data) = H(concat(secret, ":", data)) |
492 | 492 | // if qop == auth: |
@@ -503,19 +503,19 @@ discard block |
||
503 | 503 | $nonce = isset($digestRequest['nonce']) ? $digestRequest['nonce'] : ''; |
504 | 504 | $cnonce = $nonce; |
505 | 505 | if ($digestRequest['qop'] != '') { |
506 | - $unhashedDigest = $HA1 . ':' . $nonce . ':' . sprintf("%08d", $digestRequest['nc']) . ':' . $cnonce . ':' . $digestRequest['qop'] . ':' . $HA2; |
|
506 | + $unhashedDigest = $HA1.':'.$nonce.':'.sprintf("%08d", $digestRequest['nc']).':'.$cnonce.':'.$digestRequest['qop'].':'.$HA2; |
|
507 | 507 | } else { |
508 | - $unhashedDigest = $HA1 . ':' . $nonce . ':' . $HA2; |
|
508 | + $unhashedDigest = $HA1.':'.$nonce.':'.$HA2; |
|
509 | 509 | } |
510 | 510 | |
511 | 511 | $hashedDigest = md5($unhashedDigest); |
512 | 512 | |
513 | 513 | $opaque = ''; |
514 | 514 | if (isset($digestRequest['opaque'])) { |
515 | - $opaque = ', opaque="' . $digestRequest['opaque'] . '"'; |
|
515 | + $opaque = ', opaque="'.$digestRequest['opaque'].'"'; |
|
516 | 516 | } |
517 | 517 | |
518 | - $this->setHeader('Authorization', 'Digest username="' . $username . '", realm="' . $digestRequest['realm'] . '", nonce="' . $nonce . '", uri="' . $this->digest_uri . $opaque . '", cnonce="' . $cnonce . '", nc=' . sprintf("%08x", $digestRequest['nc']) . ', qop="' . $digestRequest['qop'] . '", response="' . $hashedDigest . '"'); |
|
518 | + $this->setHeader('Authorization', 'Digest username="'.$username.'", realm="'.$digestRequest['realm'].'", nonce="'.$nonce.'", uri="'.$this->digest_uri.$opaque.'", cnonce="'.$cnonce.'", nc='.sprintf("%08x", $digestRequest['nc']).', qop="'.$digestRequest['qop'].'", response="'.$hashedDigest.'"'); |
|
519 | 519 | } |
520 | 520 | } elseif ($authtype == 'certificate') { |
521 | 521 | $this->certRequest = $certRequest; |
@@ -537,7 +537,7 @@ discard block |
||
537 | 537 | * @access public |
538 | 538 | */ |
539 | 539 | function setSOAPAction($soapaction) { |
540 | - $this->setHeader('SOAPAction', '"' . $soapaction . '"'); |
|
540 | + $this->setHeader('SOAPAction', '"'.$soapaction.'"'); |
|
541 | 541 | } |
542 | 542 | |
543 | 543 | /** |
@@ -546,7 +546,7 @@ discard block |
||
546 | 546 | * @param string $enc encoding style. supported values: gzip, deflate, or both |
547 | 547 | * @access public |
548 | 548 | */ |
549 | - function setEncoding($enc='gzip, deflate') { |
|
549 | + function setEncoding($enc = 'gzip, deflate') { |
|
550 | 550 | if (function_exists('gzdeflate')) { |
551 | 551 | $this->protocol_version = '1.1'; |
552 | 552 | $this->setHeader('Accept-Encoding', $enc); |
@@ -599,7 +599,7 @@ discard block |
||
599 | 599 | * @access private |
600 | 600 | */ |
601 | 601 | function isSkippableCurlHeader(&$data) { |
602 | - $skipHeaders = array( 'HTTP/1.1 100', |
|
602 | + $skipHeaders = array('HTTP/1.1 100', |
|
603 | 603 | 'HTTP/1.0 301', |
604 | 604 | 'HTTP/1.1 301', |
605 | 605 | 'HTTP/1.0 302', |
@@ -625,7 +625,7 @@ discard block |
||
625 | 625 | * @access public |
626 | 626 | * @deprecated |
627 | 627 | */ |
628 | - function decodeChunked($buffer, $lb){ |
|
628 | + function decodeChunked($buffer, $lb) { |
|
629 | 629 | // length := 0 |
630 | 630 | $length = 0; |
631 | 631 | $new = ''; |
@@ -637,17 +637,17 @@ discard block |
||
637 | 637 | $this->debug('no linebreak found in decodeChunked'); |
638 | 638 | return $new; |
639 | 639 | } |
640 | - $temp = substr($buffer,0,$chunkend); |
|
641 | - $chunk_size = hexdec( trim($temp) ); |
|
640 | + $temp = substr($buffer, 0, $chunkend); |
|
641 | + $chunk_size = hexdec(trim($temp)); |
|
642 | 642 | $chunkstart = $chunkend + strlen($lb); |
643 | 643 | // while (chunk-size > 0) { |
644 | 644 | while ($chunk_size > 0) { |
645 | 645 | $this->debug("chunkstart: $chunkstart chunk_size: $chunk_size"); |
646 | - $chunkend = strpos( $buffer, $lb, $chunkstart + $chunk_size); |
|
646 | + $chunkend = strpos($buffer, $lb, $chunkstart + $chunk_size); |
|
647 | 647 | |
648 | 648 | // Just in case we got a broken connection |
649 | 649 | if ($chunkend == FALSE) { |
650 | - $chunk = substr($buffer,$chunkstart); |
|
650 | + $chunk = substr($buffer, $chunkstart); |
|
651 | 651 | // append chunk-data to entity-body |
652 | 652 | $new .= $chunk; |
653 | 653 | $length += strlen($chunk); |
@@ -655,7 +655,7 @@ discard block |
||
655 | 655 | } |
656 | 656 | |
657 | 657 | // read chunk-data and CRLF |
658 | - $chunk = substr($buffer,$chunkstart,$chunkend-$chunkstart); |
|
658 | + $chunk = substr($buffer, $chunkstart, $chunkend - $chunkstart); |
|
659 | 659 | // append chunk-data to entity-body |
660 | 660 | $new .= $chunk; |
661 | 661 | // length := length + chunk-size |
@@ -667,8 +667,8 @@ discard block |
||
667 | 667 | if ($chunkend == FALSE) { |
668 | 668 | break; //Just in case we got a broken connection |
669 | 669 | } |
670 | - $temp = substr($buffer,$chunkstart,$chunkend-$chunkstart); |
|
671 | - $chunk_size = hexdec( trim($temp) ); |
|
670 | + $temp = substr($buffer, $chunkstart, $chunkend - $chunkstart); |
|
671 | + $chunk_size = hexdec(trim($temp)); |
|
672 | 672 | $chunkstart = $chunkend; |
673 | 673 | } |
674 | 674 | return $new; |
@@ -703,7 +703,7 @@ discard block |
||
703 | 703 | $this->outgoing_payload = "$req\r\n"; |
704 | 704 | |
705 | 705 | // loop thru headers, serializing |
706 | - foreach($this->outgoing_headers as $k => $v){ |
|
706 | + foreach ($this->outgoing_headers as $k => $v) { |
|
707 | 707 | $hdr = $k.': '.$v; |
708 | 708 | $this->debug("HTTP header: $hdr"); |
709 | 709 | $this->outgoing_payload .= "$hdr\r\n"; |
@@ -740,12 +740,12 @@ discard block |
||
740 | 740 | |
741 | 741 | if ($this->io_method() == 'socket') { |
742 | 742 | // send payload |
743 | - if(!fputs($this->fp, $this->outgoing_payload, strlen($this->outgoing_payload))) { |
|
743 | + if (!fputs($this->fp, $this->outgoing_payload, strlen($this->outgoing_payload))) { |
|
744 | 744 | $this->setError('couldn\'t write message data to socket'); |
745 | 745 | $this->debug('couldn\'t write message data to socket'); |
746 | 746 | return false; |
747 | 747 | } |
748 | - $this->debug('wrote data to socket, length = ' . strlen($this->outgoing_payload)); |
|
748 | + $this->debug('wrote data to socket, length = '.strlen($this->outgoing_payload)); |
|
749 | 749 | return true; |
750 | 750 | } else if ($this->io_method() == 'curl') { |
751 | 751 | // set payload |
@@ -754,7 +754,7 @@ discard block |
||
754 | 754 | // some servers refuse to work with (so we no longer use this method!) |
755 | 755 | //$this->setCurlOption(CURLOPT_CUSTOMREQUEST, $this->outgoing_payload); |
756 | 756 | $curl_headers = array(); |
757 | - foreach($this->outgoing_headers as $k => $v){ |
|
757 | + foreach ($this->outgoing_headers as $k => $v) { |
|
758 | 758 | if ($k == 'Connection' || $k == 'Content-Length' || $k == 'Host' || $k == 'Authorization' || $k == 'Proxy-Authorization') { |
759 | 759 | $this->debug("Skip cURL header $k: $v"); |
760 | 760 | } else { |
@@ -762,7 +762,7 @@ discard block |
||
762 | 762 | } |
763 | 763 | } |
764 | 764 | if ($cookie_str != '') { |
765 | - $curl_headers[] = 'Cookie: ' . $cookie_str; |
|
765 | + $curl_headers[] = 'Cookie: '.$cookie_str; |
|
766 | 766 | } |
767 | 767 | $this->setCurlOption(CURLOPT_HTTPHEADER, $curl_headers); |
768 | 768 | $this->debug('set cURL HTTP headers'); |
@@ -788,62 +788,62 @@ discard block |
||
788 | 788 | * @return string the response (also sets member variables like incoming_payload) |
789 | 789 | * @access private |
790 | 790 | */ |
791 | - function getResponse(){ |
|
791 | + function getResponse() { |
|
792 | 792 | $this->incoming_payload = ''; |
793 | 793 | |
794 | 794 | if ($this->io_method() == 'socket') { |
795 | 795 | // loop until headers have been retrieved |
796 | 796 | $data = ''; |
797 | - while (!isset($lb)){ |
|
797 | + while (!isset($lb)) { |
|
798 | 798 | |
799 | 799 | // We might EOF during header read. |
800 | - if(feof($this->fp)) { |
|
800 | + if (feof($this->fp)) { |
|
801 | 801 | $this->incoming_payload = $data; |
802 | - $this->debug('found no headers before EOF after length ' . strlen($data)); |
|
803 | - $this->debug("received before EOF:\n" . $data); |
|
802 | + $this->debug('found no headers before EOF after length '.strlen($data)); |
|
803 | + $this->debug("received before EOF:\n".$data); |
|
804 | 804 | $this->setError('server failed to send headers'); |
805 | 805 | return false; |
806 | 806 | } |
807 | 807 | |
808 | 808 | $tmp = fgets($this->fp, 256); |
809 | 809 | $tmplen = strlen($tmp); |
810 | - $this->debug("read line of $tmplen bytes: " . trim($tmp)); |
|
810 | + $this->debug("read line of $tmplen bytes: ".trim($tmp)); |
|
811 | 811 | |
812 | 812 | if ($tmplen == 0) { |
813 | 813 | $this->incoming_payload = $data; |
814 | - $this->debug('socket read of headers timed out after length ' . strlen($data)); |
|
815 | - $this->debug("read before timeout: " . $data); |
|
814 | + $this->debug('socket read of headers timed out after length '.strlen($data)); |
|
815 | + $this->debug("read before timeout: ".$data); |
|
816 | 816 | $this->setError('socket read of headers timed out'); |
817 | 817 | return false; |
818 | 818 | } |
819 | 819 | |
820 | 820 | $data .= $tmp; |
821 | - $pos = strpos($data,"\r\n\r\n"); |
|
822 | - if($pos > 1){ |
|
821 | + $pos = strpos($data, "\r\n\r\n"); |
|
822 | + if ($pos > 1) { |
|
823 | 823 | $lb = "\r\n"; |
824 | 824 | } else { |
825 | - $pos = strpos($data,"\n\n"); |
|
826 | - if($pos > 1){ |
|
825 | + $pos = strpos($data, "\n\n"); |
|
826 | + if ($pos > 1) { |
|
827 | 827 | $lb = "\n"; |
828 | 828 | } |
829 | 829 | } |
830 | 830 | // remove 100 headers |
831 | - if (isset($lb) && preg_match('/^HTTP\/1.1 100/',$data)) { |
|
831 | + if (isset($lb) && preg_match('/^HTTP\/1.1 100/', $data)) { |
|
832 | 832 | unset($lb); |
833 | 833 | $data = ''; |
834 | 834 | }// |
835 | 835 | } |
836 | 836 | // store header data |
837 | 837 | $this->incoming_payload .= $data; |
838 | - $this->debug('found end of headers after length ' . strlen($data)); |
|
838 | + $this->debug('found end of headers after length '.strlen($data)); |
|
839 | 839 | // process headers |
840 | - $header_data = trim(substr($data,0,$pos)); |
|
841 | - $header_array = explode($lb,$header_data); |
|
840 | + $header_data = trim(substr($data, 0, $pos)); |
|
841 | + $header_array = explode($lb, $header_data); |
|
842 | 842 | $this->incoming_headers = array(); |
843 | 843 | $this->incoming_cookies = array(); |
844 | - foreach($header_array as $header_line){ |
|
845 | - $arr = explode(':',$header_line, 2); |
|
846 | - if(count($arr) > 1){ |
|
844 | + foreach ($header_array as $header_line) { |
|
845 | + $arr = explode(':', $header_line, 2); |
|
846 | + if (count($arr) > 1) { |
|
847 | 847 | $header_name = strtolower(trim($arr[0])); |
848 | 848 | $this->incoming_headers[$header_name] = trim($arr[1]); |
849 | 849 | if ($header_name == 'set-cookie') { |
@@ -851,20 +851,20 @@ discard block |
||
851 | 851 | $cookie = $this->parseCookie(trim($arr[1])); |
852 | 852 | if ($cookie) { |
853 | 853 | $this->incoming_cookies[] = $cookie; |
854 | - $this->debug('found cookie: ' . $cookie['name'] . ' = ' . $cookie['value']); |
|
854 | + $this->debug('found cookie: '.$cookie['name'].' = '.$cookie['value']); |
|
855 | 855 | } else { |
856 | - $this->debug('did not find cookie in ' . trim($arr[1])); |
|
856 | + $this->debug('did not find cookie in '.trim($arr[1])); |
|
857 | 857 | } |
858 | 858 | } |
859 | 859 | } else if (isset($header_name)) { |
860 | 860 | // append continuation line to previous header |
861 | - $this->incoming_headers[$header_name] .= $lb . ' ' . $header_line; |
|
861 | + $this->incoming_headers[$header_name] .= $lb.' '.$header_line; |
|
862 | 862 | } |
863 | 863 | } |
864 | 864 | |
865 | 865 | // loop until msg has been received |
866 | 866 | if (isset($this->incoming_headers['transfer-encoding']) && strtolower($this->incoming_headers['transfer-encoding']) == 'chunked') { |
867 | - $content_length = 2147483647; // ignore any content-length header |
|
867 | + $content_length = 2147483647; // ignore any content-length header |
|
868 | 868 | $chunked = true; |
869 | 869 | $this->debug("want to read chunked content"); |
870 | 870 | } elseif (isset($this->incoming_headers['content-length'])) { |
@@ -872,7 +872,7 @@ discard block |
||
872 | 872 | $chunked = false; |
873 | 873 | $this->debug("want to read content of length $content_length"); |
874 | 874 | } else { |
875 | - $content_length = 2147483647; |
|
875 | + $content_length = 2147483647; |
|
876 | 876 | $chunked = false; |
877 | 877 | $this->debug("want to read content to EOF"); |
878 | 878 | } |
@@ -884,8 +884,8 @@ discard block |
||
884 | 884 | $this->debug("read chunk line of $tmplen bytes"); |
885 | 885 | if ($tmplen == 0) { |
886 | 886 | $this->incoming_payload = $data; |
887 | - $this->debug('socket read of chunk length timed out after length ' . strlen($data)); |
|
888 | - $this->debug("read before timeout:\n" . $data); |
|
887 | + $this->debug('socket read of chunk length timed out after length '.strlen($data)); |
|
888 | + $this->debug("read before timeout:\n".$data); |
|
889 | 889 | $this->setError('socket read of chunk length timed out'); |
890 | 890 | return false; |
891 | 891 | } |
@@ -900,8 +900,8 @@ discard block |
||
900 | 900 | $this->debug("read buffer of $tmplen bytes"); |
901 | 901 | if (($tmplen == 0) && (!feof($this->fp))) { |
902 | 902 | $this->incoming_payload = $data; |
903 | - $this->debug('socket read of body timed out after length ' . strlen($data)); |
|
904 | - $this->debug("read before timeout:\n" . $data); |
|
903 | + $this->debug('socket read of body timed out after length '.strlen($data)); |
|
904 | + $this->debug("read before timeout:\n".$data); |
|
905 | 905 | $this->setError('socket read of body timed out'); |
906 | 906 | return false; |
907 | 907 | } |
@@ -914,8 +914,8 @@ discard block |
||
914 | 914 | $this->debug("read chunk terminator of $tmplen bytes"); |
915 | 915 | if ($tmplen == 0) { |
916 | 916 | $this->incoming_payload = $data; |
917 | - $this->debug('socket read of chunk terminator timed out after length ' . strlen($data)); |
|
918 | - $this->debug("read before timeout:\n" . $data); |
|
917 | + $this->debug('socket read of chunk terminator timed out after length '.strlen($data)); |
|
918 | + $this->debug("read before timeout:\n".$data); |
|
919 | 919 | $this->setError('socket read of chunk terminator timed out'); |
920 | 920 | return false; |
921 | 921 | } |
@@ -924,21 +924,21 @@ discard block |
||
924 | 924 | if (feof($this->fp)) { |
925 | 925 | $this->debug('read to EOF'); |
926 | 926 | } |
927 | - $this->debug('read body of length ' . strlen($data)); |
|
927 | + $this->debug('read body of length '.strlen($data)); |
|
928 | 928 | $this->incoming_payload .= $data; |
929 | 929 | $this->debug('received a total of '.strlen($this->incoming_payload).' bytes of data from server'); |
930 | 930 | |
931 | 931 | // close filepointer |
932 | - if( |
|
932 | + if ( |
|
933 | 933 | (isset($this->incoming_headers['connection']) && strtolower($this->incoming_headers['connection']) == 'close') || |
934 | - (! $this->persistentConnection) || feof($this->fp)){ |
|
934 | + (!$this->persistentConnection) || feof($this->fp)) { |
|
935 | 935 | fclose($this->fp); |
936 | 936 | $this->fp = false; |
937 | 937 | $this->debug('closed socket'); |
938 | 938 | } |
939 | 939 | |
940 | 940 | // connection was closed unexpectedly |
941 | - if($this->incoming_payload == ''){ |
|
941 | + if ($this->incoming_payload == '') { |
|
942 | 942 | $this->setError('no response from server'); |
943 | 943 | return false; |
944 | 944 | } |
@@ -964,7 +964,7 @@ discard block |
||
964 | 964 | if ($cErr != '') { |
965 | 965 | $err = 'cURL ERROR: '.curl_errno($this->ch).': '.$cErr.'<br>'; |
966 | 966 | // TODO: there is a PHP bug that can cause this to SEGV for CURLINFO_CONTENT_TYPE |
967 | - foreach(curl_getinfo($this->ch) as $k => $v){ |
|
967 | + foreach (curl_getinfo($this->ch) as $k => $v) { |
|
968 | 968 | $err .= "$k: $v<br>"; |
969 | 969 | } |
970 | 970 | $this->debug($err); |
@@ -984,44 +984,44 @@ discard block |
||
984 | 984 | $savedata = $data; |
985 | 985 | while ($this->isSkippableCurlHeader($data)) { |
986 | 986 | $this->debug("Found HTTP header to skip"); |
987 | - if ($pos = strpos($data,"\r\n\r\n")) { |
|
988 | - $data = ltrim(substr($data,$pos)); |
|
989 | - } elseif($pos = strpos($data,"\n\n") ) { |
|
990 | - $data = ltrim(substr($data,$pos)); |
|
987 | + if ($pos = strpos($data, "\r\n\r\n")) { |
|
988 | + $data = ltrim(substr($data, $pos)); |
|
989 | + } elseif ($pos = strpos($data, "\n\n")) { |
|
990 | + $data = ltrim(substr($data, $pos)); |
|
991 | 991 | } |
992 | 992 | } |
993 | 993 | |
994 | 994 | if ($data == '') { |
995 | 995 | // have nothing left; just remove 100 header(s) |
996 | 996 | $data = $savedata; |
997 | - while (preg_match('/^HTTP\/1.1 100/',$data)) { |
|
998 | - if ($pos = strpos($data,"\r\n\r\n")) { |
|
999 | - $data = ltrim(substr($data,$pos)); |
|
1000 | - } elseif($pos = strpos($data,"\n\n") ) { |
|
1001 | - $data = ltrim(substr($data,$pos)); |
|
997 | + while (preg_match('/^HTTP\/1.1 100/', $data)) { |
|
998 | + if ($pos = strpos($data, "\r\n\r\n")) { |
|
999 | + $data = ltrim(substr($data, $pos)); |
|
1000 | + } elseif ($pos = strpos($data, "\n\n")) { |
|
1001 | + $data = ltrim(substr($data, $pos)); |
|
1002 | 1002 | } |
1003 | 1003 | } |
1004 | 1004 | } |
1005 | 1005 | |
1006 | 1006 | // separate content from HTTP headers |
1007 | - if ($pos = strpos($data,"\r\n\r\n")) { |
|
1007 | + if ($pos = strpos($data, "\r\n\r\n")) { |
|
1008 | 1008 | $lb = "\r\n"; |
1009 | - } elseif( $pos = strpos($data,"\n\n")) { |
|
1009 | + } elseif ($pos = strpos($data, "\n\n")) { |
|
1010 | 1010 | $lb = "\n"; |
1011 | 1011 | } else { |
1012 | 1012 | $this->debug('no proper separation of headers and document'); |
1013 | 1013 | $this->setError('no proper separation of headers and document'); |
1014 | 1014 | return false; |
1015 | 1015 | } |
1016 | - $header_data = trim(substr($data,0,$pos)); |
|
1017 | - $header_array = explode($lb,$header_data); |
|
1018 | - $data = ltrim(substr($data,$pos)); |
|
1016 | + $header_data = trim(substr($data, 0, $pos)); |
|
1017 | + $header_array = explode($lb, $header_data); |
|
1018 | + $data = ltrim(substr($data, $pos)); |
|
1019 | 1019 | $this->debug('found proper separation of headers and document'); |
1020 | 1020 | $this->debug('cleaned data, stringlen: '.strlen($data)); |
1021 | 1021 | // clean headers |
1022 | 1022 | foreach ($header_array as $header_line) { |
1023 | - $arr = explode(':',$header_line,2); |
|
1024 | - if(count($arr) > 1){ |
|
1023 | + $arr = explode(':', $header_line, 2); |
|
1024 | + if (count($arr) > 1) { |
|
1025 | 1025 | $header_name = strtolower(trim($arr[0])); |
1026 | 1026 | $this->incoming_headers[$header_name] = trim($arr[1]); |
1027 | 1027 | if ($header_name == 'set-cookie') { |
@@ -1029,14 +1029,14 @@ discard block |
||
1029 | 1029 | $cookie = $this->parseCookie(trim($arr[1])); |
1030 | 1030 | if ($cookie) { |
1031 | 1031 | $this->incoming_cookies[] = $cookie; |
1032 | - $this->debug('found cookie: ' . $cookie['name'] . ' = ' . $cookie['value']); |
|
1032 | + $this->debug('found cookie: '.$cookie['name'].' = '.$cookie['value']); |
|
1033 | 1033 | } else { |
1034 | - $this->debug('did not find cookie in ' . trim($arr[1])); |
|
1034 | + $this->debug('did not find cookie in '.trim($arr[1])); |
|
1035 | 1035 | } |
1036 | 1036 | } |
1037 | 1037 | } else if (isset($header_name)) { |
1038 | 1038 | // append continuation line to previous header |
1039 | - $this->incoming_headers[$header_name] .= $lb . ' ' . $header_line; |
|
1039 | + $this->incoming_headers[$header_name] .= $lb.' '.$header_line; |
|
1040 | 1040 | } |
1041 | 1041 | } |
1042 | 1042 | } |
@@ -1049,7 +1049,7 @@ discard block |
||
1049 | 1049 | |
1050 | 1050 | // see if we need to resend the request with http digest authentication |
1051 | 1051 | if (isset($this->incoming_headers['location']) && ($http_status == 301 || $http_status == 302)) { |
1052 | - $this->debug("Got $http_status $http_reason with Location: " . $this->incoming_headers['location']); |
|
1052 | + $this->debug("Got $http_status $http_reason with Location: ".$this->incoming_headers['location']); |
|
1053 | 1053 | $this->setURL($this->incoming_headers['location']); |
1054 | 1054 | $this->tryagain = true; |
1055 | 1055 | return false; |
@@ -1057,7 +1057,7 @@ discard block |
||
1057 | 1057 | |
1058 | 1058 | // see if we need to resend the request with http digest authentication |
1059 | 1059 | if (isset($this->incoming_headers['www-authenticate']) && $http_status == 401) { |
1060 | - $this->debug("Got 401 $http_reason with WWW-Authenticate: " . $this->incoming_headers['www-authenticate']); |
|
1060 | + $this->debug("Got 401 $http_reason with WWW-Authenticate: ".$this->incoming_headers['www-authenticate']); |
|
1061 | 1061 | if (strstr($this->incoming_headers['www-authenticate'], "Digest ")) { |
1062 | 1062 | $this->debug('Server wants digest authentication'); |
1063 | 1063 | // remove "Digest " from our elements |
@@ -1092,10 +1092,10 @@ discard block |
||
1092 | 1092 | } |
1093 | 1093 | |
1094 | 1094 | // decode content-encoding |
1095 | - if(isset($this->incoming_headers['content-encoding']) && $this->incoming_headers['content-encoding'] != ''){ |
|
1096 | - if(strtolower($this->incoming_headers['content-encoding']) == 'deflate' || strtolower($this->incoming_headers['content-encoding']) == 'gzip'){ |
|
1095 | + if (isset($this->incoming_headers['content-encoding']) && $this->incoming_headers['content-encoding'] != '') { |
|
1096 | + if (strtolower($this->incoming_headers['content-encoding']) == 'deflate' || strtolower($this->incoming_headers['content-encoding']) == 'gzip') { |
|
1097 | 1097 | // if decoding works, use it. else assume data wasn't gzencoded |
1098 | - if(function_exists('gzinflate')){ |
|
1098 | + if (function_exists('gzinflate')) { |
|
1099 | 1099 | //$timer->setMarker('starting decoding of gzip/deflated content'); |
1100 | 1100 | // IIS 5 requires gzinflate instead of gzuncompress (similar to IE 5 and gzdeflate v. gzcompress) |
1101 | 1101 | // this means there are no Zlib headers, although there should be |
@@ -1104,13 +1104,13 @@ discard block |
||
1104 | 1104 | if ($this->incoming_headers['content-encoding'] == 'deflate') { |
1105 | 1105 | if ($degzdata = @gzinflate($data)) { |
1106 | 1106 | $data = $degzdata; |
1107 | - $this->debug('The payload has been inflated to ' . strlen($data) . ' bytes'); |
|
1107 | + $this->debug('The payload has been inflated to '.strlen($data).' bytes'); |
|
1108 | 1108 | if (strlen($data) < $datalen) { |
1109 | 1109 | // test for the case that the payload has been compressed twice |
1110 | 1110 | $this->debug('The inflated payload is smaller than the gzipped one; try again'); |
1111 | 1111 | if ($degzdata = @gzinflate($data)) { |
1112 | 1112 | $data = $degzdata; |
1113 | - $this->debug('The payload has been inflated again to ' . strlen($data) . ' bytes'); |
|
1113 | + $this->debug('The payload has been inflated again to '.strlen($data).' bytes'); |
|
1114 | 1114 | } |
1115 | 1115 | } |
1116 | 1116 | } else { |
@@ -1120,13 +1120,13 @@ discard block |
||
1120 | 1120 | } elseif ($this->incoming_headers['content-encoding'] == 'gzip') { |
1121 | 1121 | if ($degzdata = @gzinflate(substr($data, 10))) { // do our best |
1122 | 1122 | $data = $degzdata; |
1123 | - $this->debug('The payload has been un-gzipped to ' . strlen($data) . ' bytes'); |
|
1123 | + $this->debug('The payload has been un-gzipped to '.strlen($data).' bytes'); |
|
1124 | 1124 | if (strlen($data) < $datalen) { |
1125 | 1125 | // test for the case that the payload has been compressed twice |
1126 | 1126 | $this->debug('The un-gzipped payload is smaller than the gzipped one; try again'); |
1127 | 1127 | if ($degzdata = @gzinflate(substr($data, 10))) { |
1128 | 1128 | $data = $degzdata; |
1129 | - $this->debug('The payload has been un-gzipped again to ' . strlen($data) . ' bytes'); |
|
1129 | + $this->debug('The payload has been un-gzipped again to '.strlen($data).' bytes'); |
|
1130 | 1130 | } |
1131 | 1131 | } |
1132 | 1132 | } else { |
@@ -1143,14 +1143,14 @@ discard block |
||
1143 | 1143 | $this->setError('The server sent compressed data. Your php install must have the Zlib extension compiled in to support this.'); |
1144 | 1144 | } |
1145 | 1145 | } else { |
1146 | - $this->debug('Unsupported Content-Encoding ' . $this->incoming_headers['content-encoding']); |
|
1147 | - $this->setError('Unsupported Content-Encoding ' . $this->incoming_headers['content-encoding']); |
|
1146 | + $this->debug('Unsupported Content-Encoding '.$this->incoming_headers['content-encoding']); |
|
1147 | + $this->setError('Unsupported Content-Encoding '.$this->incoming_headers['content-encoding']); |
|
1148 | 1148 | } |
1149 | 1149 | } else { |
1150 | 1150 | $this->debug('No Content-Encoding header'); |
1151 | 1151 | } |
1152 | 1152 | |
1153 | - if(strlen($data) == 0){ |
|
1153 | + if (strlen($data) == 0) { |
|
1154 | 1154 | $this->debug('no data after headers!'); |
1155 | 1155 | $this->setError('no data present after HTTP headers'); |
1156 | 1156 | return false; |
@@ -1167,7 +1167,7 @@ discard block |
||
1167 | 1167 | * @access public |
1168 | 1168 | */ |
1169 | 1169 | function setContentType($type, $charset = false) { |
1170 | - $this->setHeader('Content-Type', $type . ($charset ? '; charset=' . $charset : '')); |
|
1170 | + $this->setHeader('Content-Type', $type.($charset ? '; charset='.$charset : '')); |
|
1171 | 1171 | } |
1172 | 1172 | |
1173 | 1173 | /** |
@@ -1176,7 +1176,7 @@ discard block |
||
1176 | 1176 | * @return boolean whether the request was honored by this method. |
1177 | 1177 | * @access public |
1178 | 1178 | */ |
1179 | - function usePersistentConnection(){ |
|
1179 | + function usePersistentConnection() { |
|
1180 | 1180 | if (isset($this->outgoing_headers['Accept-Encoding'])) { |
1181 | 1181 | return false; |
1182 | 1182 | } |
@@ -1197,7 +1197,7 @@ discard block |
||
1197 | 1197 | * TODO: allow a Set-Cookie string to be parsed into multiple cookies |
1198 | 1198 | */ |
1199 | 1199 | function parseCookie($cookie_str) { |
1200 | - $cookie_str = str_replace('; ', ';', $cookie_str) . ';'; |
|
1200 | + $cookie_str = str_replace('; ', ';', $cookie_str).';'; |
|
1201 | 1201 | $data = preg_split('/;/', $cookie_str); |
1202 | 1202 | $value_str = $data[0]; |
1203 | 1203 | |
@@ -1221,7 +1221,7 @@ discard block |
||
1221 | 1221 | |
1222 | 1222 | $cookie_param = 'path='; |
1223 | 1223 | $start = strpos($cookie_str, $cookie_param); |
1224 | - if ( $start > 0 ) { |
|
1224 | + if ($start > 0) { |
|
1225 | 1225 | $path = substr($cookie_str, $start + strlen($cookie_param)); |
1226 | 1226 | $path = substr($path, 0, strpos($path, ';')); |
1227 | 1227 | } else { |
@@ -1240,7 +1240,7 @@ discard block |
||
1240 | 1240 | if ($sep_pos) { |
1241 | 1241 | $name = substr($value_str, 0, $sep_pos); |
1242 | 1242 | $value = substr($value_str, $sep_pos + 1); |
1243 | - $cookie= array( 'name' => $name, |
|
1243 | + $cookie = array('name' => $name, |
|
1244 | 1244 | 'value' => $value, |
1245 | 1245 | 'domain' => $domain, |
1246 | 1246 | 'path' => $path, |
@@ -1260,40 +1260,40 @@ discard block |
||
1260 | 1260 | * @return string for Cookie-HTTP-Header |
1261 | 1261 | * @access private |
1262 | 1262 | */ |
1263 | - function getCookiesForRequest($cookies, $secure=false) { |
|
1263 | + function getCookiesForRequest($cookies, $secure = false) { |
|
1264 | 1264 | $cookie_str = ''; |
1265 | - if ((! is_null($cookies)) && (is_array($cookies))) { |
|
1265 | + if ((!is_null($cookies)) && (is_array($cookies))) { |
|
1266 | 1266 | foreach ($cookies as $cookie) { |
1267 | - if (! is_array($cookie)) { |
|
1267 | + if (!is_array($cookie)) { |
|
1268 | 1268 | continue; |
1269 | 1269 | } |
1270 | 1270 | $this->debug("check cookie for validity: ".$cookie['name'].'='.$cookie['value']); |
1271 | - if ((isset($cookie['expires'])) && (! empty($cookie['expires']))) { |
|
1271 | + if ((isset($cookie['expires'])) && (!empty($cookie['expires']))) { |
|
1272 | 1272 | if (strtotime($cookie['expires']) <= time()) { |
1273 | 1273 | $this->debug('cookie has expired'); |
1274 | 1274 | continue; |
1275 | 1275 | } |
1276 | 1276 | } |
1277 | - if ((isset($cookie['domain'])) && (! empty($cookie['domain']))) { |
|
1277 | + if ((isset($cookie['domain'])) && (!empty($cookie['domain']))) { |
|
1278 | 1278 | $domain = preg_quote($cookie['domain']); |
1279 | - if (! preg_match("'.*$domain$'i", $this->host)) { |
|
1279 | + if (!preg_match("'.*$domain$'i", $this->host)) { |
|
1280 | 1280 | $this->debug('cookie has different domain'); |
1281 | 1281 | continue; |
1282 | 1282 | } |
1283 | 1283 | } |
1284 | - if ((isset($cookie['path'])) && (! empty($cookie['path']))) { |
|
1284 | + if ((isset($cookie['path'])) && (!empty($cookie['path']))) { |
|
1285 | 1285 | $path = preg_quote($cookie['path']); |
1286 | - if (! preg_match("'^$path.*'i", $this->path)) { |
|
1286 | + if (!preg_match("'^$path.*'i", $this->path)) { |
|
1287 | 1287 | $this->debug('cookie is for a different path'); |
1288 | 1288 | continue; |
1289 | 1289 | } |
1290 | 1290 | } |
1291 | - if ((! $secure) && (isset($cookie['secure'])) && ($cookie['secure'])) { |
|
1291 | + if ((!$secure) && (isset($cookie['secure'])) && ($cookie['secure'])) { |
|
1292 | 1292 | $this->debug('cookie is secure, transport is not'); |
1293 | 1293 | continue; |
1294 | 1294 | } |
1295 | - $cookie_str .= $cookie['name'] . '=' . $cookie['value'] . '; '; |
|
1296 | - $this->debug('add cookie to Cookie-String: ' . $cookie['name'] . '=' . $cookie['value']); |
|
1295 | + $cookie_str .= $cookie['name'].'='.$cookie['value'].'; '; |
|
1296 | + $this->debug('add cookie to Cookie-String: '.$cookie['name'].'='.$cookie['value']); |
|
1297 | 1297 | } |
1298 | 1298 | } |
1299 | 1299 | return $cookie_str; |