Completed
Pull Request — master (#586)
by Richard
14:46
created
htdocs/class/xml/rpc/metaweblogapi.php 2 patches
Switch Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -207,23 +207,23 @@
 block discarded – undo
207 207
                         foreach ($ret[$i] as $key => $value) {
208 208
                             $maptag = $this->_getXoopsTagMap($key);
209 209
                             switch($maptag) {
210
-                            case 'userid':
211
-                                $struct->add('userid', new XoopsXmlRpcString($value));
212
-                                break;
213
-                            case 'dateCreated':
214
-                                $struct->add('dateCreated', new XoopsXmlRpcDatetime($value));
215
-                                break;
216
-                            case 'postid':
217
-                                $struct->add('postid', new XoopsXmlRpcString($value));
218
-                                $struct->add('link', new XoopsXmlRpcString($xoops_url.'/modules/news/article.php?item_id='.$value));
219
-                                $struct->add('permaLink', new XoopsXmlRpcString($xoops_url.'/modules/news/article.php?item_id='.$value));
220
-                                break;
221
-                            case 'title':
222
-                                $struct->add('title', new XoopsXmlRpcString($value));
223
-                                break;
224
-                            default :
225
-                                $content .= '<'.$key.'>'.trim($value).'</'.$key.'>';
226
-                                break;
210
+                                case 'userid':
211
+                                    $struct->add('userid', new XoopsXmlRpcString($value));
212
+                                    break;
213
+                                case 'dateCreated':
214
+                                    $struct->add('dateCreated', new XoopsXmlRpcDatetime($value));
215
+                                    break;
216
+                                case 'postid':
217
+                                    $struct->add('postid', new XoopsXmlRpcString($value));
218
+                                    $struct->add('link', new XoopsXmlRpcString($xoops_url.'/modules/news/article.php?item_id='.$value));
219
+                                    $struct->add('permaLink', new XoopsXmlRpcString($xoops_url.'/modules/news/article.php?item_id='.$value));
220
+                                    break;
221
+                                case 'title':
222
+                                    $struct->add('title', new XoopsXmlRpcString($value));
223
+                                    break;
224
+                                default :
225
+                                    $content .= '<'.$key.'>'.trim($value).'</'.$key.'>';
226
+                                    break;
227 227
                             }
228 228
                         }
229 229
                         $struct->add('description', new XoopsXmlRpcString($content));
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
                 if (count($missing) > 0) {
63 63
                     $msg = '';
64 64
                     foreach ($missing as $m) {
65
-                        $msg .= '<' . $m . '> ';
65
+                        $msg .= '<'.$m.'> ';
66 66
                         echo $m;
67 67
                     }
68 68
                     $this->response->add(new XoopsXmlRpcFault(109, $msg));
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
                     $maptag = $this->_getXoopsTagMap($tag);
104 104
                     if (!isset($this->params[3][$maptag])) {
105 105
                         $data = $this->_getTagCdata($this->params[3]['description'], $maptag, true);
106
-                        if (trim($data) == ''){
106
+                        if (trim($data) == '') {
107 107
                             if ($detail['required']) {
108 108
                                 $missing[] = $tag;
109 109
                             }
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
                 if (count($missing) > 0) {
118 118
                     $msg = '';
119 119
                     foreach ($missing as $m) {
120
-                        $msg .= '<' . $m . '> ';
120
+                        $msg .= '<'.$m.'> ';
121 121
                     }
122 122
                     $this->response->add(new XoopsXmlRpcFault(109, $msg));
123 123
                 } else {
@@ -167,14 +167,14 @@  discard block
 block discarded – undo
167 167
                             break;
168 168
                         case 'postid':
169 169
                             $struct->add('postid', new XoopsXmlRpcString($value));
170
-                            $struct->add('link', new XoopsXmlRpcString($xoops_url . '/modules/xoopssections/item.php?item=' . $value));
171
-                            $struct->add('permaLink', new XoopsXmlRpcString($xoops_url . '/modules/xoopssections/item.php?item=' . $value));
170
+                            $struct->add('link', new XoopsXmlRpcString($xoops_url.'/modules/xoopssections/item.php?item='.$value));
171
+                            $struct->add('permaLink', new XoopsXmlRpcString($xoops_url.'/modules/xoopssections/item.php?item='.$value));
172 172
                             break;
173 173
                         case 'title':
174 174
                             $struct->add('title', new XoopsXmlRpcString($value));
175 175
                             break;
176 176
                         default :
177
-                            $content .= '<' . $key . '>' . trim($value) . '</' . $key . '>';
177
+                            $content .= '<'.$key.'>'.trim($value).'</'.$key.'>';
178 178
                             break;
179 179
                     }
180 180
                 }
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
                         $content = '';
207 207
                         foreach ($ret[$i] as $key => $value) {
208 208
                             $maptag = $this->_getXoopsTagMap($key);
209
-                            switch($maptag) {
209
+                            switch ($maptag) {
210 210
                             case 'userid':
211 211
                                 $struct->add('userid', new XoopsXmlRpcString($value));
212 212
                                 break;
Please login to merge, or discard this patch.
htdocs/class/xml/rpc/bloggerapi.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -231,7 +231,7 @@
 block discarded – undo
231 231
         } else {
232 232
             $arr = new XoopsXmlRpcArray();
233 233
             $struct = new XoopsXmlRpcStruct();
234
-			$xoops_url = \XoopsBaseConfig::get('url');
234
+            $xoops_url = \XoopsBaseConfig::get('url');
235 235
             $struct->add('url', new XoopsXmlRpcString($xoops_url.'/modules/'.$this->module->getVar('dirname').'/'));
236 236
             $struct->add('blogid', new XoopsXmlRpcString($this->module->getVar('mid')));
237 237
             $struct->add('blogName', new XoopsXmlRpcString('XOOPS Blog'));
Please login to merge, or discard this patch.
Switch Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -154,18 +154,18 @@  discard block
 block discarded – undo
154 154
                 foreach ($ret as $key => $value) {
155 155
                     $maptag = $this->_getXoopsTagMap($key);
156 156
                     switch($maptag) {
157
-                    case 'userid':
158
-                        $struct->add('userid', new XoopsXmlRpcString($value));
159
-                        break;
160
-                    case 'dateCreated':
161
-                        $struct->add('dateCreated', new XoopsXmlRpcDatetime($value));
162
-                        break;
163
-                    case 'postid':
164
-                        $struct->add('postid', new XoopsXmlRpcString($value));
165
-                        break;
166
-                    default :
167
-                        $content .= '<'.$key.'>'.trim($value).'</'.$key.'>';
168
-                        break;
157
+                        case 'userid':
158
+                            $struct->add('userid', new XoopsXmlRpcString($value));
159
+                            break;
160
+                        case 'dateCreated':
161
+                            $struct->add('dateCreated', new XoopsXmlRpcDatetime($value));
162
+                            break;
163
+                        case 'postid':
164
+                            $struct->add('postid', new XoopsXmlRpcString($value));
165
+                            break;
166
+                        default :
167
+                            $content .= '<'.$key.'>'.trim($value).'</'.$key.'>';
168
+                            break;
169 169
                     }
170 170
                 }
171 171
                 $struct->add('content', new XoopsXmlRpcString($content));
@@ -198,18 +198,18 @@  discard block
 block discarded – undo
198 198
                         foreach($ret[$i] as $key => $value) {
199 199
                             $maptag = $this->_getXoopsTagMap($key);
200 200
                             switch($maptag) {
201
-                            case 'userid':
202
-                                $struct->add('userid', new XoopsXmlRpcString($value));
203
-                                break;
204
-                            case 'dateCreated':
205
-                                $struct->add('dateCreated', new XoopsXmlRpcDatetime($value));
206
-                                break;
207
-                            case 'postid':
208
-                                $struct->add('postid', new XoopsXmlRpcString($value));
209
-                                break;
210
-                            default :
211
-                                $content .= '<'.$key.'>'.trim($value).'</'.$key.'>';
212
-                                break;
201
+                                case 'userid':
202
+                                    $struct->add('userid', new XoopsXmlRpcString($value));
203
+                                    break;
204
+                                case 'dateCreated':
205
+                                    $struct->add('dateCreated', new XoopsXmlRpcDatetime($value));
206
+                                    break;
207
+                                case 'postid':
208
+                                    $struct->add('postid', new XoopsXmlRpcString($value));
209
+                                    break;
210
+                                default :
211
+                                    $content .= '<'.$key.'>'.trim($value).'</'.$key.'>';
212
+                                    break;
213 213
                             }
214 214
                         }
215 215
                         $struct->add('content', new XoopsXmlRpcString($content));
@@ -262,15 +262,15 @@  discard block
 block discarded – undo
262 262
             $this->response->add(new XoopsXmlRpcFault(104));
263 263
         } else {
264 264
             switch ($this->params[5]) {
265
-            case 'main':
266
-                $this->response->add(new XoopsXmlRpcFault(107));
267
-                break;
268
-            case 'archiveIndex':
269
-                $this->response->add(new XoopsXmlRpcFault(107));
270
-                break;
271
-            default:
272
-                $this->response->add(new XoopsXmlRpcFault(107));
273
-                break;
265
+                case 'main':
266
+                    $this->response->add(new XoopsXmlRpcFault(107));
267
+                    break;
268
+                case 'archiveIndex':
269
+                    $this->response->add(new XoopsXmlRpcFault(107));
270
+                    break;
271
+                default:
272
+                    $this->response->add(new XoopsXmlRpcFault(107));
273
+                    break;
274 274
             }
275 275
         }
276 276
     }
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
         if (!$this->_checkUser($this->params[2], $this->params[3])) {
39 39
             $this->response->add(new XoopsXmlRpcFault(104));
40 40
         } else {
41
-            if (!$fields =& $this->_getPostFields(null, $this->params[1])) {
41
+            if (!$fields = & $this->_getPostFields(null, $this->params[1])) {
42 42
                 $this->response->add(new XoopsXmlRpcFault(106));
43 43
             } else {
44 44
                 $missing = array();
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
                 foreach ($fields as $tag => $detail) {
47 47
                     $maptag = $this->_getXoopsTagMap($tag);
48 48
                     $data = $this->_getTagCdata($this->params[4], $maptag, true);
49
-                    if (trim($data) == ''){
49
+                    if (trim($data) == '') {
50 50
                         if ($detail['required']) {
51 51
                             $missing[] = $maptag;
52 52
                         }
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
                 if (count($missing) > 0) {
58 58
                     $msg = '';
59 59
                     foreach ($missing as $m) {
60
-                        $msg .= '<' . $m . '> ';
60
+                        $msg .= '<'.$m.'> ';
61 61
                     }
62 62
                     $this->response->add(new XoopsXmlRpcFault(109, $msg));
63 63
                 } else {
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
                 $post = array();
92 92
                 foreach ($fields as $tag => $detail) {
93 93
                     $data = $this->_getTagCdata($this->params[4], $tag, true);
94
-                    if (trim($data) == ''){
94
+                    if (trim($data) == '') {
95 95
                         if ($detail['required']) {
96 96
                             $missing[] = $tag;
97 97
                         }
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
                 if (count($missing) > 0) {
103 103
                     $msg = '';
104 104
                     foreach ($missing as $m) {
105
-                        $msg .= '<' . $m . '> ';
105
+                        $msg .= '<'.$m.'> ';
106 106
                     }
107 107
                     $this->response->add(new XoopsXmlRpcFault(109, $msg));
108 108
                 } else {
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
                 $content = '';
154 154
                 foreach ($ret as $key => $value) {
155 155
                     $maptag = $this->_getXoopsTagMap($key);
156
-                    switch($maptag) {
156
+                    switch ($maptag) {
157 157
                     case 'userid':
158 158
                         $struct->add('userid', new XoopsXmlRpcString($value));
159 159
                         break;
@@ -195,9 +195,9 @@  discard block
 block discarded – undo
195 195
                     for ($i = 0; $i < $count; ++$i) {
196 196
                         $struct = new XoopsXmlRpcStruct();
197 197
                         $content = '';
198
-                        foreach($ret[$i] as $key => $value) {
198
+                        foreach ($ret[$i] as $key => $value) {
199 199
                             $maptag = $this->_getXoopsTagMap($key);
200
-                            switch($maptag) {
200
+                            switch ($maptag) {
201 201
                             case 'userid':
202 202
                                 $struct->add('userid', new XoopsXmlRpcString($value));
203 203
                                 break;
Please login to merge, or discard this patch.
htdocs/class/xml/rpc/xmlrpctag.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -54,10 +54,10 @@  discard block
 block discarded – undo
54 54
             if (!$tag->isFault()) {
55 55
                 $payload .= $tag->render();
56 56
             } else {
57
-                return '<?xml version="1.0"?><methodResponse>' . $tag->render() . '</methodResponse>';
57
+                return '<?xml version="1.0"?><methodResponse>'.$tag->render().'</methodResponse>';
58 58
             }
59 59
         }
60
-        return '<?xml version="1.0"?><methodResponse><params><param>' . $payload . '</param></params></methodResponse>';
60
+        return '<?xml version="1.0"?><methodResponse><params><param>'.$payload.'</param></params></methodResponse>';
61 61
     }
62 62
 }
63 63
 
@@ -88,9 +88,9 @@  discard block
 block discarded – undo
88 88
         $payload = '';
89 89
         foreach ($this->_tags as $tag) {
90 90
             /* @var $tag XoopsXmlRpcTag */
91
-            $payload .= '<param>' . $tag->render() . '</param>';
91
+            $payload .= '<param>'.$tag->render().'</param>';
92 92
         }
93
-        return '<?xml version="1.0"?><methodCall><methodName>' . $this->methodName . '</methodName><params>' . $payload . '</params></methodCall>';
93
+        return '<?xml version="1.0"?><methodCall><methodName>'.$this->methodName.'</methodName><params>'.$payload.'</params></methodCall>';
94 94
     }
95 95
 }
96 96
 
@@ -209,9 +209,9 @@  discard block
 block discarded – undo
209 209
                 $string = 'Method response error';
210 210
                 break;
211 211
         }
212
-        $string .= "\n" . $this->_extra;
212
+        $string .= "\n".$this->_extra;
213 213
 
214
-        return '<fault><value><struct><member><name>faultCode</name><value>' . $this->_code . '</value></member><member><name>faultString</name><value>' . $this->encode($string) . '</value></member></struct></value></fault>';
214
+        return '<fault><value><struct><member><name>faultCode</name><value>'.$this->_code.'</value></member><member><name>faultString</name><value>'.$this->encode($string).'</value></member></struct></value></fault>';
215 215
     }
216 216
 }
217 217
 
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
      */
239 239
     public function render()
240 240
     {
241
-        return '<value><int>' . $this->_value . '</int></value>';
241
+        return '<value><int>'.$this->_value.'</int></value>';
242 242
     }
243 243
 }
244 244
 
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
      */
266 266
     public function render()
267 267
     {
268
-        return '<value><double>' . $this->_value . '</double></value>';
268
+        return '<value><double>'.$this->_value.'</double></value>';
269 269
     }
270 270
 }
271 271
 
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
      */
293 293
     public function render()
294 294
     {
295
-        return '<value><boolean>' . $this->_value . '</boolean></value>';
295
+        return '<value><boolean>'.$this->_value.'</boolean></value>';
296 296
     }
297 297
 }
298 298
 
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
      */
320 320
     public function render()
321 321
     {
322
-        return '<value><string>' . $this->encode($this->_value) . '</string></value>';
322
+        return '<value><string>'.$this->encode($this->_value).'</string></value>';
323 323
     }
324 324
 }
325 325
 
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
      */
351 351
     public function render()
352 352
     {
353
-        return '<value><dateTime.iso8601>' . gmstrftime("%Y%m%dT%H:%M:%S", $this->_value) . '</dateTime.iso8601></value>';
353
+        return '<value><dateTime.iso8601>'.gmstrftime("%Y%m%dT%H:%M:%S", $this->_value).'</dateTime.iso8601></value>';
354 354
     }
355 355
 }
356 356
 
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
      */
378 378
     public function render()
379 379
     {
380
-        return '<value><base64>' . $this->_value . '</base64></value>';
380
+        return '<value><base64>'.$this->_value.'</base64></value>';
381 381
     }
382 382
 }
383 383
 
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
         $ret = '<value><struct>';
444 444
         foreach ($this->_tags as $tag) {
445 445
             /* @var $tag['value'] XoopsXmlRplTag */
446
-            $ret .= '<member><name>' . $this->encode($tag['name']) . '</name>' . $tag['value']->render() . '</member>';
446
+            $ret .= '<member><name>'.$this->encode($tag['name']).'</name>'.$tag['value']->render().'</member>';
447 447
         }
448 448
         $ret .= '</struct></value>';
449 449
         return $ret;
Please login to merge, or discard this patch.
htdocs/class/xml/rpc/xmlrpcapi.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
     {
181 181
         $ret = '';
182 182
         $match = array();
183
-        if (preg_match("/\<" . $tag . "\>(.*)\<\/" . $tag . "\>/is", $text, $match)) {
183
+        if (preg_match("/\<".$tag."\>(.*)\<\/".$tag."\>/is", $text, $match)) {
184 184
             if ($remove) {
185 185
                 $text = str_replace($match[0], '', $text);
186 186
             }
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
     {
202 202
         if (strtolower(get_class($this)) !== 'xoopsapi') {
203 203
             $xoops_root_path = \XoopsBaseConfig::get('root-path');
204
-            require_once($xoops_root_path . '/class/xml/rpc/xoopsapi.php');
204
+            require_once($xoops_root_path.'/class/xml/rpc/xoopsapi.php');
205 205
             return new XoopsApi($params, $this->response, $this->module);
206 206
         } else {
207 207
             return $this;
Please login to merge, or discard this patch.
htdocs/class/xml/rpc/xmlrpcparser.php 3 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -336,8 +336,8 @@  discard block
 block discarded – undo
336 336
 {
337 337
 
338 338
     /**
339
-    * @return string[]
340
-    */
339
+     * @return string[]
340
+     */
341 341
     public function getName()
342 342
     {
343 343
         return array('int', 'i4');
@@ -647,10 +647,10 @@  discard block
 block discarded – undo
647 647
     }
648 648
 
649 649
     /**
650
-    * @param SaxParser $parser
651
-    * @param array $attributes
652
-    * @return void
653
-    */
650
+     * @param SaxParser $parser
651
+     * @param array $attributes
652
+     * @return void
653
+     */
654 654
     public function handleBeginElement(SaxParser $parser, &$attributes)
655 655
     {
656 656
         if (!is_a($parser,'XoopsXmlRpcParser')) return;
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
      */
325 325
     public function handleCharacterData(SaxParser $parser, &$data)
326 326
     {
327
-        if (!is_a($parser,'XoopsXmlRpcParser')) return;
327
+        if (!is_a($parser, 'XoopsXmlRpcParser')) return;
328 328
         $parser->setMethodName($data);
329 329
     }
330 330
 }
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
      */
351 351
     public function handleCharacterData(SaxParser $parser, &$data)
352 352
     {
353
-        if (!is_a($parser,'XoopsXmlRpcParser')) return;
353
+        if (!is_a($parser, 'XoopsXmlRpcParser')) return;
354 354
         $parser->setTempValue((int)($data));
355 355
     }
356 356
 }
@@ -376,7 +376,7 @@  discard block
 block discarded – undo
376 376
      */
377 377
     public function handleCharacterData(SaxParser $parser, &$data)
378 378
     {
379
-        if (!is_a($parser,'XoopsXmlRpcParser')) return;
379
+        if (!is_a($parser, 'XoopsXmlRpcParser')) return;
380 380
         $data = (float)$data;
381 381
         $parser->setTempValue($data);
382 382
     }
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
      */
404 404
     public function handleCharacterData(SaxParser $parser, &$data)
405 405
     {
406
-        if (!is_a($parser,'XoopsXmlRpcParser')) return;
406
+        if (!is_a($parser, 'XoopsXmlRpcParser')) return;
407 407
         $data = (boolean)$data;
408 408
         $parser->setTempValue($data);
409 409
     }
@@ -430,7 +430,7 @@  discard block
 block discarded – undo
430 430
      */
431 431
     public function handleCharacterData(SaxParser $parser, &$data)
432 432
     {
433
-        if (!is_a($parser,'XoopsXmlRpcParser')) return;
433
+        if (!is_a($parser, 'XoopsXmlRpcParser')) return;
434 434
         $parser->setTempValue((string)($data));
435 435
     }
436 436
 }
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
      */
457 457
     public function handleCharacterData(SaxParser $parser, &$data)
458 458
     {
459
-        if (!is_a($parser,'XoopsXmlRpcParser')) return;
459
+        if (!is_a($parser, 'XoopsXmlRpcParser')) return;
460 460
         $matches = array();
461 461
         if (!preg_match("/^([0-9]{4})([0-9]{2})([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})$/", $data, $matches)) {
462 462
             $parser->setTempValue(time());
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
      */
488 488
     public function handleCharacterData(SaxParser $parser, &$data)
489 489
     {
490
-        if (!is_a($parser,'XoopsXmlRpcParser')) return;
490
+        if (!is_a($parser, 'XoopsXmlRpcParser')) return;
491 491
         $parser->setTempValue(base64_decode($data));
492 492
     }
493 493
 }
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
      */
514 514
     public function handleCharacterData(SaxParser $parser, &$data)
515 515
     {
516
-        if (!is_a($parser,'XoopsXmlRpcParser')) return;
516
+        if (!is_a($parser, 'XoopsXmlRpcParser')) return;
517 517
         switch ($parser->getParentTag()) {
518 518
             case 'member':
519 519
                 $parser->setTempName($data);
@@ -545,7 +545,7 @@  discard block
 block discarded – undo
545 545
      */
546 546
     public function handleCharacterData(SaxParser $parser, &$data)
547 547
     {
548
-        if (!is_a($parser,'XoopsXmlRpcParser')) return;
548
+        if (!is_a($parser, 'XoopsXmlRpcParser')) return;
549 549
         switch ($parser->getParentTag()) {
550 550
             case 'member':
551 551
                 $parser->setTempValue($data);
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
      */
567 567
     public function handleBeginElement(SaxParser $parser, &$attributes)
568 568
     {
569
-        if (!is_a($parser,'XoopsXmlRpcParser')) return;
569
+        if (!is_a($parser, 'XoopsXmlRpcParser')) return;
570 570
         //$parser->resetTempValue();
571 571
     }
572 572
 
@@ -576,7 +576,7 @@  discard block
 block discarded – undo
576 576
      */
577 577
     public function handleEndElement(SaxParser $parser)
578 578
     {
579
-        if (!is_a($parser,'XoopsXmlRpcParser')) return;
579
+        if (!is_a($parser, 'XoopsXmlRpcParser')) return;
580 580
         switch ($parser->getCurrentTag()) {
581 581
             case 'member':
582 582
                 $parser->setTempMember($parser->getTempName(), $parser->getTempValue());
@@ -614,7 +614,7 @@  discard block
 block discarded – undo
614 614
      */
615 615
     public function handleBeginElement(SaxParser $parser, &$attributes)
616 616
     {
617
-        if (!is_a($parser,'XoopsXmlRpcParser')) return;
617
+        if (!is_a($parser, 'XoopsXmlRpcParser')) return;
618 618
         $parser->setWorkingLevel();
619 619
         $parser->resetTempMember();
620 620
     }
@@ -625,7 +625,7 @@  discard block
 block discarded – undo
625 625
      */
626 626
     public function handleEndElement(SaxParser $parser)
627 627
     {
628
-        if (!is_a($parser,'XoopsXmlRpcParser')) return;
628
+        if (!is_a($parser, 'XoopsXmlRpcParser')) return;
629 629
         $member = $parser->getTempMember();
630 630
         $parser->releaseWorkingLevel();
631 631
         $parser->setTempStruct($member);
@@ -653,7 +653,7 @@  discard block
 block discarded – undo
653 653
     */
654 654
     public function handleBeginElement(SaxParser $parser, &$attributes)
655 655
     {
656
-        if (!is_a($parser,'XoopsXmlRpcParser')) return;
656
+        if (!is_a($parser, 'XoopsXmlRpcParser')) return;
657 657
         $parser->setWorkingLevel();
658 658
         $parser->resetTempArray();
659 659
     }
@@ -664,7 +664,7 @@  discard block
 block discarded – undo
664 664
      */
665 665
     public function handleEndElement(SaxParser $parser)
666 666
     {
667
-        if (!is_a($parser,'XoopsXmlRpcParser')) return;
667
+        if (!is_a($parser, 'XoopsXmlRpcParser')) return;
668 668
         $parser->setTempValue($parser->getTempArray());
669 669
         $parser->releaseWorkingLevel();
670 670
     }
@@ -691,7 +691,7 @@  discard block
 block discarded – undo
691 691
      */
692 692
     public function handleBeginElement(SaxParser $parser, &$attributes)
693 693
     {
694
-        if (!is_a($parser,'XoopsXmlRpcParser')) return;
694
+        if (!is_a($parser, 'XoopsXmlRpcParser')) return;
695 695
         $parser->setWorkingLevel();
696 696
         $parser->resetTempStruct();
697 697
     }
@@ -702,7 +702,7 @@  discard block
 block discarded – undo
702 702
      */
703 703
     public function handleEndElement(SaxParser $parser)
704 704
     {
705
-        if (!is_a($parser,'XoopsXmlRpcParser')) return;
705
+        if (!is_a($parser, 'XoopsXmlRpcParser')) return;
706 706
         $parser->setTempValue($parser->getTempStruct());
707 707
         $parser->releaseWorkingLevel();
708 708
     }
Please login to merge, or discard this patch.
Braces   +51 added lines, -17 removed lines patch added patch discarded remove patch
@@ -324,7 +324,9 @@  discard block
 block discarded – undo
324 324
      */
325 325
     public function handleCharacterData(SaxParser $parser, &$data)
326 326
     {
327
-        if (!is_a($parser,'XoopsXmlRpcParser')) return;
327
+        if (!is_a($parser,'XoopsXmlRpcParser')) {
328
+            return;
329
+        }
328 330
         $parser->setMethodName($data);
329 331
     }
330 332
 }
@@ -350,7 +352,9 @@  discard block
 block discarded – undo
350 352
      */
351 353
     public function handleCharacterData(SaxParser $parser, &$data)
352 354
     {
353
-        if (!is_a($parser,'XoopsXmlRpcParser')) return;
355
+        if (!is_a($parser,'XoopsXmlRpcParser')) {
356
+            return;
357
+        }
354 358
         $parser->setTempValue((int)($data));
355 359
     }
356 360
 }
@@ -376,7 +380,9 @@  discard block
 block discarded – undo
376 380
      */
377 381
     public function handleCharacterData(SaxParser $parser, &$data)
378 382
     {
379
-        if (!is_a($parser,'XoopsXmlRpcParser')) return;
383
+        if (!is_a($parser,'XoopsXmlRpcParser')) {
384
+            return;
385
+        }
380 386
         $data = (float)$data;
381 387
         $parser->setTempValue($data);
382 388
     }
@@ -403,7 +409,9 @@  discard block
 block discarded – undo
403 409
      */
404 410
     public function handleCharacterData(SaxParser $parser, &$data)
405 411
     {
406
-        if (!is_a($parser,'XoopsXmlRpcParser')) return;
412
+        if (!is_a($parser,'XoopsXmlRpcParser')) {
413
+            return;
414
+        }
407 415
         $data = (boolean)$data;
408 416
         $parser->setTempValue($data);
409 417
     }
@@ -430,7 +438,9 @@  discard block
 block discarded – undo
430 438
      */
431 439
     public function handleCharacterData(SaxParser $parser, &$data)
432 440
     {
433
-        if (!is_a($parser,'XoopsXmlRpcParser')) return;
441
+        if (!is_a($parser,'XoopsXmlRpcParser')) {
442
+            return;
443
+        }
434 444
         $parser->setTempValue((string)($data));
435 445
     }
436 446
 }
@@ -456,7 +466,9 @@  discard block
 block discarded – undo
456 466
      */
457 467
     public function handleCharacterData(SaxParser $parser, &$data)
458 468
     {
459
-        if (!is_a($parser,'XoopsXmlRpcParser')) return;
469
+        if (!is_a($parser,'XoopsXmlRpcParser')) {
470
+            return;
471
+        }
460 472
         $matches = array();
461 473
         if (!preg_match("/^([0-9]{4})([0-9]{2})([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})$/", $data, $matches)) {
462 474
             $parser->setTempValue(time());
@@ -487,7 +499,9 @@  discard block
 block discarded – undo
487 499
      */
488 500
     public function handleCharacterData(SaxParser $parser, &$data)
489 501
     {
490
-        if (!is_a($parser,'XoopsXmlRpcParser')) return;
502
+        if (!is_a($parser,'XoopsXmlRpcParser')) {
503
+            return;
504
+        }
491 505
         $parser->setTempValue(base64_decode($data));
492 506
     }
493 507
 }
@@ -513,7 +527,9 @@  discard block
 block discarded – undo
513 527
      */
514 528
     public function handleCharacterData(SaxParser $parser, &$data)
515 529
     {
516
-        if (!is_a($parser,'XoopsXmlRpcParser')) return;
530
+        if (!is_a($parser,'XoopsXmlRpcParser')) {
531
+            return;
532
+        }
517 533
         switch ($parser->getParentTag()) {
518 534
             case 'member':
519 535
                 $parser->setTempName($data);
@@ -545,7 +561,9 @@  discard block
 block discarded – undo
545 561
      */
546 562
     public function handleCharacterData(SaxParser $parser, &$data)
547 563
     {
548
-        if (!is_a($parser,'XoopsXmlRpcParser')) return;
564
+        if (!is_a($parser,'XoopsXmlRpcParser')) {
565
+            return;
566
+        }
549 567
         switch ($parser->getParentTag()) {
550 568
             case 'member':
551 569
                 $parser->setTempValue($data);
@@ -566,7 +584,9 @@  discard block
 block discarded – undo
566 584
      */
567 585
     public function handleBeginElement(SaxParser $parser, &$attributes)
568 586
     {
569
-        if (!is_a($parser,'XoopsXmlRpcParser')) return;
587
+        if (!is_a($parser,'XoopsXmlRpcParser')) {
588
+            return;
589
+        }
570 590
         //$parser->resetTempValue();
571 591
     }
572 592
 
@@ -576,7 +596,9 @@  discard block
 block discarded – undo
576 596
      */
577 597
     public function handleEndElement(SaxParser $parser)
578 598
     {
579
-        if (!is_a($parser,'XoopsXmlRpcParser')) return;
599
+        if (!is_a($parser,'XoopsXmlRpcParser')) {
600
+            return;
601
+        }
580 602
         switch ($parser->getCurrentTag()) {
581 603
             case 'member':
582 604
                 $parser->setTempMember($parser->getTempName(), $parser->getTempValue());
@@ -614,7 +636,9 @@  discard block
 block discarded – undo
614 636
      */
615 637
     public function handleBeginElement(SaxParser $parser, &$attributes)
616 638
     {
617
-        if (!is_a($parser,'XoopsXmlRpcParser')) return;
639
+        if (!is_a($parser,'XoopsXmlRpcParser')) {
640
+            return;
641
+        }
618 642
         $parser->setWorkingLevel();
619 643
         $parser->resetTempMember();
620 644
     }
@@ -625,7 +649,9 @@  discard block
 block discarded – undo
625 649
      */
626 650
     public function handleEndElement(SaxParser $parser)
627 651
     {
628
-        if (!is_a($parser,'XoopsXmlRpcParser')) return;
652
+        if (!is_a($parser,'XoopsXmlRpcParser')) {
653
+            return;
654
+        }
629 655
         $member = $parser->getTempMember();
630 656
         $parser->releaseWorkingLevel();
631 657
         $parser->setTempStruct($member);
@@ -653,7 +679,9 @@  discard block
 block discarded – undo
653 679
     */
654 680
     public function handleBeginElement(SaxParser $parser, &$attributes)
655 681
     {
656
-        if (!is_a($parser,'XoopsXmlRpcParser')) return;
682
+        if (!is_a($parser,'XoopsXmlRpcParser')) {
683
+            return;
684
+        }
657 685
         $parser->setWorkingLevel();
658 686
         $parser->resetTempArray();
659 687
     }
@@ -664,7 +692,9 @@  discard block
 block discarded – undo
664 692
      */
665 693
     public function handleEndElement(SaxParser $parser)
666 694
     {
667
-        if (!is_a($parser,'XoopsXmlRpcParser')) return;
695
+        if (!is_a($parser,'XoopsXmlRpcParser')) {
696
+            return;
697
+        }
668 698
         $parser->setTempValue($parser->getTempArray());
669 699
         $parser->releaseWorkingLevel();
670 700
     }
@@ -691,7 +721,9 @@  discard block
 block discarded – undo
691 721
      */
692 722
     public function handleBeginElement(SaxParser $parser, &$attributes)
693 723
     {
694
-        if (!is_a($parser,'XoopsXmlRpcParser')) return;
724
+        if (!is_a($parser,'XoopsXmlRpcParser')) {
725
+            return;
726
+        }
695 727
         $parser->setWorkingLevel();
696 728
         $parser->resetTempStruct();
697 729
     }
@@ -702,7 +734,9 @@  discard block
 block discarded – undo
702 734
      */
703 735
     public function handleEndElement(SaxParser $parser)
704 736
     {
705
-        if (!is_a($parser,'XoopsXmlRpcParser')) return;
737
+        if (!is_a($parser,'XoopsXmlRpcParser')) {
738
+            return;
739
+        }
706 740
         $parser->setTempValue($parser->getTempStruct());
707 741
         $parser->releaseWorkingLevel();
708 742
     }
Please login to merge, or discard this patch.
htdocs/class/xml/rpc/xoopsapi.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
                 if (count($missing) > 0) {
62 62
                     $msg = '';
63 63
                     foreach ($missing as $m) {
64
-                        $msg .= '<' . $m . '> ';
64
+                        $msg .= '<'.$m.'> ';
65 65
                     }
66 66
                     $this->response->add(new XoopsXmlRpcFault(109, $msg));
67 67
                 } else {
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
                 if (count($missing) > 0) {
152 152
                     $msg = '';
153 153
                     foreach ($missing as $m) {
154
-                        $msg .= '<' . $m . '> ';
154
+                        $msg .= '<'.$m.'> ';
155 155
                     }
156 156
                     $this->response->add(new XoopsXmlRpcFault(109, $msg));
157 157
                 } else {
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
                     $struct = new XoopsXmlRpcStruct();
250 250
                     $content = '';
251 251
                     foreach ($ret as $key => $value) {
252
-                        switch($key) {
252
+                        switch ($key) {
253 253
                             case 'uid':
254 254
                                 $struct->add('userid', new XoopsXmlRpcString($value));
255 255
                                 break;
@@ -258,14 +258,14 @@  discard block
 block discarded – undo
258 258
                                 break;
259 259
                             case 'storyid':
260 260
                                 $struct->add('postid', new XoopsXmlRpcString($value));
261
-                                $struct->add('link', new XoopsXmlRpcString(\XoopsBaseConfig::get('url') . '/modules/news/article.php?item_id=' . $value));
262
-                                $struct->add('permaLink', new XoopsXmlRpcString(\XoopsBaseConfig::get('url') . '/modules/news/article.php?item_id=' . $value));
261
+                                $struct->add('link', new XoopsXmlRpcString(\XoopsBaseConfig::get('url').'/modules/news/article.php?item_id='.$value));
262
+                                $struct->add('permaLink', new XoopsXmlRpcString(\XoopsBaseConfig::get('url').'/modules/news/article.php?item_id='.$value));
263 263
                                 break;
264 264
                             case 'title':
265 265
                                 $struct->add('title', new XoopsXmlRpcString($value));
266 266
                                 break;
267 267
                             default :
268
-                                $content .= '<' . $key . '>' . trim($value) . '</' . $key . '>';
268
+                                $content .= '<'.$key.'>'.trim($value).'</'.$key.'>';
269 269
                                 break;
270 270
                         }
271 271
                     }
@@ -319,8 +319,8 @@  discard block
 block discarded – undo
319 319
                     for ($i = 0; $i < $count; ++$i) {
320 320
                         $struct = new XoopsXmlRpcStruct();
321 321
                         $content = '';
322
-                        foreach($ret[$i] as $key => $value) {
323
-                            switch($key) {
322
+                        foreach ($ret[$i] as $key => $value) {
323
+                            switch ($key) {
324 324
                                 case 'uid':
325 325
                                     $struct->add('userid', new XoopsXmlRpcString($value));
326 326
                                     break;
@@ -329,14 +329,14 @@  discard block
 block discarded – undo
329 329
                                     break;
330 330
                                 case 'storyid':
331 331
                                     $struct->add('postid', new XoopsXmlRpcString($value));
332
-                                    $struct->add('link', new XoopsXmlRpcString(\XoopsBaseConfig::get('url') . '/modules/news/article.php?item_id=' . $value));
333
-                                    $struct->add('permaLink', new XoopsXmlRpcString(\XoopsBaseConfig::get('url') . '/modules/news/article.php?item_id=' . $value));
332
+                                    $struct->add('link', new XoopsXmlRpcString(\XoopsBaseConfig::get('url').'/modules/news/article.php?item_id='.$value));
333
+                                    $struct->add('permaLink', new XoopsXmlRpcString(\XoopsBaseConfig::get('url').'/modules/news/article.php?item_id='.$value));
334 334
                                     break;
335 335
                                 case 'title':
336 336
                                     $struct->add('title', new XoopsXmlRpcString($value));
337 337
                                     break;
338 338
                                 default :
339
-                                    $content .= '<' . $key . '>' . trim($value) . '</' . $key . '>';
339
+                                    $content .= '<'.$key.'>'.trim($value).'</'.$key.'>';
340 340
                                     break;
341 341
                             }
342 342
                         }
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
         return null;
352 352
     }
353 353
 
354
-    function getCategories($respond=true)
354
+    function getCategories($respond = true)
355 355
     {
356 356
         global $xoopsDB;
357 357
         if (!$this->_checkUser($this->params[1], $this->params[2])) {
Please login to merge, or discard this patch.
htdocs/class/xml/saxparser.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -380,7 +380,7 @@
 block discarded – undo
380 380
             $ret = '';
381 381
             if (count($this->errors) > 0) {
382 382
                 foreach ($this->errors as $error) {
383
-                    $ret .= $error . '<br />';
383
+                    $ret .= $error.'<br />';
384 384
                 }
385 385
             }
386 386
             return $ret;
Please login to merge, or discard this patch.
htdocs/class/tree.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -189,11 +189,11 @@  discard block
 block discarded – undo
189 189
     {
190 190
         if ($key > 0) {
191 191
             $value = $this->tree[$key]['obj']->getVar($this->myId);
192
-            $ret .= '<option value="' . $value . '"';
192
+            $ret .= '<option value="'.$value.'"';
193 193
             if ($value == $selected) {
194 194
                 $ret .= ' selected';
195 195
             }
196
-            $ret .= '>' . $prefix_curr . $this->tree[$key]['obj']->getVar($fieldName) . '</option>';
196
+            $ret .= '>'.$prefix_curr.$this->tree[$key]['obj']->getVar($fieldName).'</option>';
197 197
             $prefix_curr .= $prefix_orig;
198 198
         }
199 199
         if (isset($this->tree[$key]['child']) && !empty($this->tree[$key]['child'])) {
@@ -229,13 +229,13 @@  discard block
 block discarded – undo
229 229
     ) {
230 230
         $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1);
231 231
         trigger_error("makeSelBox() is deprecated since 2.5.9, please use makeSelectElement(), accessed from {$trace[0]['file']} line {$trace[0]['line']},");
232
-        $ret = '<select name="' . $name . '" id="' . $name . '" ' . $extra . '>';
232
+        $ret = '<select name="'.$name.'" id="'.$name.'" '.$extra.'>';
233 233
         if (false !== (bool)$addEmptyOption) {
234 234
             $ret .= '<option value="0"></option>';
235 235
         }
236 236
         $this->makeSelBoxOptions($fieldName, $selected, $key, $ret, $prefix);
237 237
 
238
-        return $ret . '</select>';
238
+        return $ret.'</select>';
239 239
     }
240 240
 
241 241
     /**
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
     {
291 291
         if ($key > 0) {
292 292
             $value = $this->tree[$key]['obj']->getVar($this->myId);
293
-            $name = $prefix_curr . $this->tree[$key]['obj']->getVar($fieldName);
293
+            $name = $prefix_curr.$this->tree[$key]['obj']->getVar($fieldName);
294 294
             $element->addOption($value, $name);
295 295
             $prefix_curr .= $prefix_orig;
296 296
         }
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
             return $this->tree;
321 321
         }
322 322
         trigger_error(
323
-            'Undefined property: XoopsObjectTree::$' . $name .
323
+            'Undefined property: XoopsObjectTree::$'.$name.
324 324
             " in {$trace[0]['file']} line {$trace[0]['line']}, ",
325 325
             E_USER_NOTICE);
326 326
         return null;
Please login to merge, or discard this patch.
htdocs/class/vendor/snoopy.php 2 patches
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
                         // using proxy, send entire URI
150 150
                         $this->_httprequest($URI, $fp, $URI, $this->_httpmethod);
151 151
                     } else {
152
-                        $path = $URI_PARTS["path"] . ($URI_PARTS["query"] ? "?" . $URI_PARTS["query"] : "");
152
+                        $path = $URI_PARTS["path"].($URI_PARTS["query"] ? "?".$URI_PARTS["query"] : "");
153 153
                         // no proxy, send only the path
154 154
                         $this->_httprequest($path, $fp, $URI, $this->_httpmethod);
155 155
                     }
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
                         /* url was redirected, check if we've hit the max depth */
161 161
                         if ($this->maxredirs > $this->_redirectdepth) {
162 162
                             // only follow redirect if it's on this site, or offsiteok is true
163
-                            if (preg_match("|^https?://" . preg_quote($this->host) . "|i", $this->_redirectaddr) || $this->offsiteok) {
163
+                            if (preg_match("|^https?://".preg_quote($this->host)."|i", $this->_redirectaddr) || $this->offsiteok) {
164 164
                                 /* follow the redirect */
165 165
                                 $this->_redirectdepth++;
166 166
                                 $this->lastredirectaddr = $this->_redirectaddr;
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
                 break;
189 189
             default:
190 190
                 // not a valid protocol
191
-                $this->error = 'Invalid protocol "' . $URI_PARTS["scheme"] . '"\n';
191
+                $this->error = 'Invalid protocol "'.$URI_PARTS["scheme"].'"\n';
192 192
                 return false;
193 193
                 break;
194 194
         }
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
                         // using proxy, send entire URI
240 240
                         $this->_httprequest($URI, $fp, $URI, $this->_submit_method, $this->_submit_type, $postdata);
241 241
                     } else {
242
-                        $path = $URI_PARTS["path"] . ($URI_PARTS["query"] ? "?" . $URI_PARTS["query"] : "");
242
+                        $path = $URI_PARTS["path"].($URI_PARTS["query"] ? "?".$URI_PARTS["query"] : "");
243 243
                         // no proxy, send only the path
244 244
                         $this->_httprequest($path, $fp, $URI, $this->_submit_method, $this->_submit_type, $postdata);
245 245
                     }
@@ -249,11 +249,11 @@  discard block
 block discarded – undo
249 249
                     if ($this->_redirectaddr) {
250 250
                         /* url was redirected, check if we've hit the max depth */
251 251
                         if ($this->maxredirs > $this->_redirectdepth) {
252
-                            if (!preg_match("|^" . $URI_PARTS["scheme"] . "://|", $this->_redirectaddr))
253
-                                $this->_redirectaddr = $this->_expandlinks($this->_redirectaddr, $URI_PARTS["scheme"] . "://" . $URI_PARTS["host"]);
252
+                            if (!preg_match("|^".$URI_PARTS["scheme"]."://|", $this->_redirectaddr))
253
+                                $this->_redirectaddr = $this->_expandlinks($this->_redirectaddr, $URI_PARTS["scheme"]."://".$URI_PARTS["host"]);
254 254
 
255 255
                             // only follow redirect if it's on this site, or offsiteok is true
256
-                            if (preg_match("|^https?://" . preg_quote($this->host) . "|i", $this->_redirectaddr) || $this->offsiteok) {
256
+                            if (preg_match("|^https?://".preg_quote($this->host)."|i", $this->_redirectaddr) || $this->offsiteok) {
257 257
                                 /* follow the redirect */
258 258
                                 $this->_redirectdepth++;
259 259
                                 $this->lastredirectaddr = $this->_redirectaddr;
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
                 break;
286 286
             default:
287 287
                 // not a valid protocol
288
-                $this->error = 'Invalid protocol "' . $URI_PARTS["scheme"] . '"\n';
288
+                $this->error = 'Invalid protocol "'.$URI_PARTS["scheme"].'"\n';
289 289
                 return false;
290 290
                 break;
291 291
         }
@@ -585,9 +585,9 @@  discard block
 block discarded – undo
585 585
         $match = preg_replace("|/$|", "", $match);
586 586
         $match_part = parse_url($match);
587 587
         $match_root =
588
-            $match_part["scheme"] . "://" . $match_part["host"];
588
+            $match_part["scheme"]."://".$match_part["host"];
589 589
 
590
-        $search = array("|^http://" . preg_quote($this->host) . "|i",
590
+        $search = array("|^http://".preg_quote($this->host)."|i",
591 591
             "|^(\/)|i",
592 592
             "|^(?!http://)(?!mailto:)|i",
593 593
             "|/\./|",
@@ -595,8 +595,8 @@  discard block
 block discarded – undo
595 595
         );
596 596
 
597 597
         $replace = array("",
598
-            $match_root . "/",
599
-            $match . "/",
598
+            $match_root."/",
599
+            $match."/",
600 600
             "/",
601 601
             "/"
602 602
         );
@@ -625,17 +625,17 @@  discard block
 block discarded – undo
625 625
         $URI_PARTS = parse_url($URI);
626 626
         if (empty($url))
627 627
             $url = "/";
628
-        $headers = $http_method . " " . $url . " " . $this->_httpversion . "\r\n";
628
+        $headers = $http_method." ".$url." ".$this->_httpversion."\r\n";
629 629
         if (!empty($this->host) && !isset($this->rawheaders['Host'])) {
630
-            $headers .= "Host: " . $this->host;
630
+            $headers .= "Host: ".$this->host;
631 631
             if (!empty($this->port) && $this->port != '80')
632
-                $headers .= ":" . $this->port;
632
+                $headers .= ":".$this->port;
633 633
             $headers .= "\r\n";
634 634
         }
635 635
         if (!empty($this->agent))
636
-            $headers .= "User-Agent: " . $this->agent . "\r\n";
636
+            $headers .= "User-Agent: ".$this->agent."\r\n";
637 637
         if (!empty($this->accept))
638
-            $headers .= "Accept: " . $this->accept . "\r\n";
638
+            $headers .= "Accept: ".$this->accept."\r\n";
639 639
         if ($this->use_gzip) {
640 640
             // make sure PHP was built with --with-zlib
641 641
             // and we can handle gzipp'ed data
@@ -643,13 +643,13 @@  discard block
 block discarded – undo
643 643
                 $headers .= "Accept-encoding: gzip\r\n";
644 644
             } else {
645 645
                 trigger_error(
646
-                    "use_gzip is on, but PHP was built without zlib support." .
646
+                    "use_gzip is on, but PHP was built without zlib support.".
647 647
                     "  Requesting file(s) without gzip encoding.",
648 648
                     E_USER_NOTICE);
649 649
             }
650 650
         }
651 651
         if (!empty($this->referer))
652
-            $headers .= "Referer: " . $this->referer . "\r\n";
652
+            $headers .= "Referer: ".$this->referer."\r\n";
653 653
         if (!empty($this->cookies)) {
654 654
             if (!is_array($this->cookies))
655 655
                 $this->cookies = (array)$this->cookies;
@@ -658,31 +658,31 @@  discard block
 block discarded – undo
658 658
             if (count($this->cookies) > 0) {
659 659
                 $cookie_headers .= 'Cookie: ';
660 660
                 foreach ($this->cookies as $cookieKey => $cookieVal) {
661
-                    $cookie_headers .= $cookieKey . "=" . urlencode($cookieVal) . "; ";
661
+                    $cookie_headers .= $cookieKey."=".urlencode($cookieVal)."; ";
662 662
                 }
663
-                $headers .= substr($cookie_headers, 0, -2) . "\r\n";
663
+                $headers .= substr($cookie_headers, 0, -2)."\r\n";
664 664
             }
665 665
         }
666 666
         if (!empty($this->rawheaders)) {
667 667
             if (!is_array($this->rawheaders))
668 668
                 $this->rawheaders = (array)$this->rawheaders;
669 669
             while (list($headerKey, $headerVal) = each($this->rawheaders))
670
-                $headers .= $headerKey . ": " . $headerVal . "\r\n";
670
+                $headers .= $headerKey.": ".$headerVal."\r\n";
671 671
         }
672 672
         if (!empty($content_type)) {
673 673
             $headers .= "Content-type: $content_type";
674 674
             if ($content_type == "multipart/form-data")
675
-                $headers .= "; boundary=" . $this->_mime_boundary;
675
+                $headers .= "; boundary=".$this->_mime_boundary;
676 676
             $headers .= "\r\n";
677 677
         }
678 678
         if (!empty($body))
679
-            $headers .= "Content-length: " . strlen($body) . "\r\n";
679
+            $headers .= "Content-length: ".strlen($body)."\r\n";
680 680
         if (!empty($this->user) || !empty($this->pass))
681
-            $headers .= "Authorization: Basic " . base64_encode($this->user . ":" . $this->pass) . "\r\n";
681
+            $headers .= "Authorization: Basic ".base64_encode($this->user.":".$this->pass)."\r\n";
682 682
 
683 683
         //add proxy auth headers
684 684
         if (!empty($this->proxy_user))
685
-            $headers .= 'Proxy-Authorization: ' . 'Basic ' . base64_encode($this->proxy_user . ':' . $this->proxy_pass) . "\r\n";
685
+            $headers .= 'Proxy-Authorization: '.'Basic '.base64_encode($this->proxy_user.':'.$this->proxy_pass)."\r\n";
686 686
 
687 687
 
688 688
         $headers .= "\r\n";
@@ -692,7 +692,7 @@  discard block
 block discarded – undo
692 692
             socket_set_timeout($fp, $this->read_timeout);
693 693
         $this->timed_out = false;
694 694
 
695
-        fwrite($fp, $headers . $body, strlen($headers . $body));
695
+        fwrite($fp, $headers.$body, strlen($headers.$body));
696 696
 
697 697
         $this->_redirectaddr = false;
698 698
         unset($this->headers);
@@ -716,10 +716,10 @@  discard block
 block discarded – undo
716 716
                 // look for :// in the Location header to see if hostname is included
717 717
                 if (!preg_match("|\:\/\/|", $matches[2])) {
718 718
                     // no host in the path, so prepend
719
-                    $this->_redirectaddr = $URI_PARTS["scheme"] . "://" . $this->host . ":" . $this->port;
719
+                    $this->_redirectaddr = $URI_PARTS["scheme"]."://".$this->host.":".$this->port;
720 720
                     // eliminate double slash
721 721
                     if (!preg_match("|^/|", $matches[2]))
722
-                        $this->_redirectaddr .= "/" . $matches[2];
722
+                        $this->_redirectaddr .= "/".$matches[2];
723 723
                     else
724 724
                         $this->_redirectaddr .= $matches[2];
725 725
                 } else
@@ -771,7 +771,7 @@  discard block
 block discarded – undo
771 771
         if (($this->_framedepth < $this->maxframes) && preg_match_all("'<frame\s+.*src[\s]*=[\'\"]?([^\'\"\>]+)'i", $results, $match)) {
772 772
             $this->results[] = $results;
773 773
             for ($x = 0; $x < count($match[1]); $x++)
774
-                $this->_frameurls[] = $this->_expandlinks($match[1][$x], $URI_PARTS["scheme"] . "://" . $this->host);
774
+                $this->_frameurls[] = $this->_expandlinks($match[1][$x], $URI_PARTS["scheme"]."://".$this->host);
775 775
         } // have we already fetched framed content?
776 776
         elseif (is_array($this->results))
777 777
             $this->results[] = $results;
@@ -858,14 +858,14 @@  discard block
 block discarded – undo
858 858
                     $context_opts['ssl']['capath'] = $this->capath;
859 859
             }
860 860
                     
861
-            $host = 'ssl://' . $host;
861
+            $host = 'ssl://'.$host;
862 862
         }
863 863
 
864 864
         $context = stream_context_create($context_opts);
865 865
 
866 866
         if (version_compare(PHP_VERSION, '5.0.0', '>')) {
867
-            if($this->scheme == 'http')
868
-                $host = "tcp://" . $host;
867
+            if ($this->scheme == 'http')
868
+                $host = "tcp://".$host;
869 869
             $fp = stream_socket_client(
870 870
                 "$host:$port",
871 871
                 $errno,
@@ -897,7 +897,7 @@  discard block
 block discarded – undo
897 897
                 case -5:
898 898
                     $this->error = "connection refused or timed out (-5)";
899 899
                 default:
900
-                    $this->error = "connection failed (" . $errno . ")";
900
+                    $this->error = "connection failed (".$errno.")";
901 901
             }
902 902
             return false;
903 903
         }
@@ -938,26 +938,26 @@  discard block
 block discarded – undo
938 938
                 while (list($key, $val) = each($formvars)) {
939 939
                     if (is_array($val) || is_object($val)) {
940 940
                         while (list($cur_key, $cur_val) = each($val)) {
941
-                            $postdata .= urlencode($key) . "[]=" . urlencode($cur_val) . "&";
941
+                            $postdata .= urlencode($key)."[]=".urlencode($cur_val)."&";
942 942
                         }
943 943
                     } else
944
-                        $postdata .= urlencode($key) . "=" . urlencode($val) . "&";
944
+                        $postdata .= urlencode($key)."=".urlencode($val)."&";
945 945
                 }
946 946
                 break;
947 947
 
948 948
             case "multipart/form-data":
949
-                $this->_mime_boundary = "Snoopy" . md5(uniqid(microtime()));
949
+                $this->_mime_boundary = "Snoopy".md5(uniqid(microtime()));
950 950
 
951 951
                 reset($formvars);
952 952
                 while (list($key, $val) = each($formvars)) {
953 953
                     if (is_array($val) || is_object($val)) {
954 954
                         while (list($cur_key, $cur_val) = each($val)) {
955
-                            $postdata .= "--" . $this->_mime_boundary . "\r\n";
955
+                            $postdata .= "--".$this->_mime_boundary."\r\n";
956 956
                             $postdata .= "Content-Disposition: form-data; name=\"$key\[\]\"\r\n\r\n";
957 957
                             $postdata .= "$cur_val\r\n";
958 958
                         }
959 959
                     } else {
960
-                        $postdata .= "--" . $this->_mime_boundary . "\r\n";
960
+                        $postdata .= "--".$this->_mime_boundary."\r\n";
961 961
                         $postdata .= "Content-Disposition: form-data; name=\"$key\"\r\n\r\n";
962 962
                         $postdata .= "$val\r\n";
963 963
                     }
@@ -974,12 +974,12 @@  discard block
 block discarded – undo
974 974
                         fclose($fp);
975 975
                         $base_name = basename($file_name);
976 976
 
977
-                        $postdata .= "--" . $this->_mime_boundary . "\r\n";
977
+                        $postdata .= "--".$this->_mime_boundary."\r\n";
978 978
                         $postdata .= "Content-Disposition: form-data; name=\"$field_name\"; filename=\"$base_name\"\r\n\r\n";
979 979
                         $postdata .= "$file_content\r\n";
980 980
                     }
981 981
                 }
982
-                $postdata .= "--" . $this->_mime_boundary . "--\r\n";
982
+                $postdata .= "--".$this->_mime_boundary."--\r\n";
983 983
                 break;
984 984
         }
985 985
 
Please login to merge, or discard this patch.
Braces   +192 added lines, -127 removed lines patch added patch discarded remove patch
@@ -121,14 +121,18 @@  discard block
 block discarded – undo
121 121
     {
122 122
 
123 123
         $URI_PARTS = parse_url($URI);
124
-        if (!empty($URI_PARTS["user"]))
125
-            $this->user = $URI_PARTS["user"];
126
-        if (!empty($URI_PARTS["pass"]))
127
-            $this->pass = $URI_PARTS["pass"];
128
-        if (empty($URI_PARTS["query"]))
129
-            $URI_PARTS["query"] = '';
130
-        if (empty($URI_PARTS["path"]))
131
-            $URI_PARTS["path"] = '';
124
+        if (!empty($URI_PARTS["user"])) {
125
+                    $this->user = $URI_PARTS["user"];
126
+        }
127
+        if (!empty($URI_PARTS["pass"])) {
128
+                    $this->pass = $URI_PARTS["pass"];
129
+        }
130
+        if (empty($URI_PARTS["query"])) {
131
+                    $URI_PARTS["query"] = '';
132
+        }
133
+        if (empty($URI_PARTS["path"])) {
134
+                    $URI_PARTS["path"] = '';
135
+        }
132 136
 
133 137
         $fp = null;
134 138
 
@@ -142,8 +146,9 @@  discard block
 block discarded – undo
142 146
             case "http":
143 147
                 $this->scheme = strtolower($URI_PARTS["scheme"]);
144 148
                 $this->host = $URI_PARTS["host"];
145
-                if (!empty($URI_PARTS["port"]))
146
-                    $this->port = $URI_PARTS["port"];
149
+                if (!empty($URI_PARTS["port"])) {
150
+                                    $this->port = $URI_PARTS["port"];
151
+                }
147 152
                 if ($this->_connect($fp)) {
148 153
                     if ($this->_isproxy) {
149 154
                         // using proxy, send entire URI
@@ -177,8 +182,9 @@  discard block
 block discarded – undo
177 182
                             if ($this->_framedepth < $this->maxframes) {
178 183
                                 $this->fetch($frameurl);
179 184
                                 $this->_framedepth++;
180
-                            } else
181
-                                break;
185
+                            } else {
186
+                                                            break;
187
+                            }
182 188
                         }
183 189
                     }
184 190
                 } else {
@@ -213,14 +219,18 @@  discard block
 block discarded – undo
213 219
         $postdata = $this->_prepare_post_body($formvars, $formfiles);
214 220
 
215 221
         $URI_PARTS = parse_url($URI);
216
-        if (!empty($URI_PARTS["user"]))
217
-            $this->user = $URI_PARTS["user"];
218
-        if (!empty($URI_PARTS["pass"]))
219
-            $this->pass = $URI_PARTS["pass"];
220
-        if (empty($URI_PARTS["query"]))
221
-            $URI_PARTS["query"] = '';
222
-        if (empty($URI_PARTS["path"]))
223
-            $URI_PARTS["path"] = '';
222
+        if (!empty($URI_PARTS["user"])) {
223
+                    $this->user = $URI_PARTS["user"];
224
+        }
225
+        if (!empty($URI_PARTS["pass"])) {
226
+                    $this->pass = $URI_PARTS["pass"];
227
+        }
228
+        if (empty($URI_PARTS["query"])) {
229
+                    $URI_PARTS["query"] = '';
230
+        }
231
+        if (empty($URI_PARTS["path"])) {
232
+                    $URI_PARTS["path"] = '';
233
+        }
224 234
 
225 235
         switch (strtolower($URI_PARTS["scheme"])) {
226 236
             case "https":
@@ -232,8 +242,9 @@  discard block
 block discarded – undo
232 242
             case "http":
233 243
                 $this->scheme = strtolower($URI_PARTS["scheme"]);
234 244
                 $this->host = $URI_PARTS["host"];
235
-                if (!empty($URI_PARTS["port"]))
236
-                    $this->port = $URI_PARTS["port"];
245
+                if (!empty($URI_PARTS["port"])) {
246
+                                    $this->port = $URI_PARTS["port"];
247
+                }
237 248
                 if ($this->_connect($fp)) {
238 249
                     if ($this->_isproxy) {
239 250
                         // using proxy, send entire URI
@@ -249,18 +260,22 @@  discard block
 block discarded – undo
249 260
                     if ($this->_redirectaddr) {
250 261
                         /* url was redirected, check if we've hit the max depth */
251 262
                         if ($this->maxredirs > $this->_redirectdepth) {
252
-                            if (!preg_match("|^" . $URI_PARTS["scheme"] . "://|", $this->_redirectaddr))
253
-                                $this->_redirectaddr = $this->_expandlinks($this->_redirectaddr, $URI_PARTS["scheme"] . "://" . $URI_PARTS["host"]);
263
+                            if (!preg_match("|^" . $URI_PARTS["scheme"] . "://|", $this->_redirectaddr)) {
264
+                                                            $this->_redirectaddr = $this->_expandlinks($this->_redirectaddr, $URI_PARTS["scheme"] . "://" . $URI_PARTS["host"]);
265
+                            }
254 266
 
255 267
                             // only follow redirect if it's on this site, or offsiteok is true
256 268
                             if (preg_match("|^https?://" . preg_quote($this->host) . "|i", $this->_redirectaddr) || $this->offsiteok) {
257 269
                                 /* follow the redirect */
258 270
                                 $this->_redirectdepth++;
259 271
                                 $this->lastredirectaddr = $this->_redirectaddr;
260
-                                if (strpos($this->_redirectaddr, "?") > 0)
261
-                                    $this->fetch($this->_redirectaddr); // the redirect has changed the request method from post to get
262
-                                else
263
-                                    $this->submit($this->_redirectaddr, $formvars, $formfiles);
272
+                                if (strpos($this->_redirectaddr, "?") > 0) {
273
+                                                                    $this->fetch($this->_redirectaddr);
274
+                                }
275
+                                // the redirect has changed the request method from post to get
276
+                                else {
277
+                                                                    $this->submit($this->_redirectaddr, $formvars, $formfiles);
278
+                                }
264 279
                             }
265 280
                         }
266 281
                     }
@@ -273,8 +288,9 @@  discard block
 block discarded – undo
273 288
                             if ($this->_framedepth < $this->maxframes) {
274 289
                                 $this->fetch($frameurl);
275 290
                                 $this->_framedepth++;
276
-                            } else
277
-                                break;
291
+                            } else {
292
+                                                            break;
293
+                            }
278 294
                         }
279 295
                     }
280 296
 
@@ -302,19 +318,24 @@  discard block
 block discarded – undo
302 318
     function fetchlinks($URI)
303 319
     {
304 320
         if ($this->fetch($URI) !== false) {
305
-            if ($this->lastredirectaddr)
306
-                $URI = $this->lastredirectaddr;
321
+            if ($this->lastredirectaddr) {
322
+                            $URI = $this->lastredirectaddr;
323
+            }
307 324
             if (is_array($this->results)) {
308
-                for ($x = 0; $x < count($this->results); $x++)
309
-                    $this->results[$x] = $this->_striplinks($this->results[$x]);
310
-            } else
311
-                $this->results = $this->_striplinks($this->results);
325
+                for ($x = 0; $x < count($this->results); $x++) {
326
+                                    $this->results[$x] = $this->_striplinks($this->results[$x]);
327
+                }
328
+            } else {
329
+                            $this->results = $this->_striplinks($this->results);
330
+            }
312 331
 
313
-            if ($this->expandlinks)
314
-                $this->results = $this->_expandlinks($this->results, $URI);
332
+            if ($this->expandlinks) {
333
+                            $this->results = $this->_expandlinks($this->results, $URI);
334
+            }
315 335
             return $this;
316
-        } else
317
-            return false;
336
+        } else {
337
+                    return false;
338
+        }
318 339
     }
319 340
 
320 341
     /*======================================================================*\
@@ -330,14 +351,17 @@  discard block
 block discarded – undo
330 351
         if ($this->fetch($URI) !== false) {
331 352
 
332 353
             if (is_array($this->results)) {
333
-                for ($x = 0; $x < count($this->results); $x++)
334
-                    $this->results[$x] = $this->_stripform($this->results[$x]);
335
-            } else
336
-                $this->results = $this->_stripform($this->results);
354
+                for ($x = 0; $x < count($this->results); $x++) {
355
+                                    $this->results[$x] = $this->_stripform($this->results[$x]);
356
+                }
357
+            } else {
358
+                            $this->results = $this->_stripform($this->results);
359
+            }
337 360
 
338 361
             return $this;
339
-        } else
340
-            return false;
362
+        } else {
363
+                    return false;
364
+        }
341 365
     }
342 366
 
343 367
 
@@ -352,13 +376,16 @@  discard block
 block discarded – undo
352 376
     {
353 377
         if ($this->fetch($URI) !== false) {
354 378
             if (is_array($this->results)) {
355
-                for ($x = 0; $x < count($this->results); $x++)
356
-                    $this->results[$x] = $this->_striptext($this->results[$x]);
357
-            } else
358
-                $this->results = $this->_striptext($this->results);
379
+                for ($x = 0; $x < count($this->results); $x++) {
380
+                                    $this->results[$x] = $this->_striptext($this->results[$x]);
381
+                }
382
+            } else {
383
+                            $this->results = $this->_striptext($this->results);
384
+            }
359 385
             return $this;
360
-        } else
361
-            return false;
386
+        } else {
387
+                    return false;
388
+        }
362 389
     }
363 390
 
364 391
     /*======================================================================*\
@@ -371,22 +398,26 @@  discard block
 block discarded – undo
371 398
     function submitlinks($URI, $formvars = "", $formfiles = "")
372 399
     {
373 400
         if ($this->submit($URI, $formvars, $formfiles) !== false) {
374
-            if ($this->lastredirectaddr)
375
-                $URI = $this->lastredirectaddr;
401
+            if ($this->lastredirectaddr) {
402
+                            $URI = $this->lastredirectaddr;
403
+            }
376 404
             if (is_array($this->results)) {
377 405
                 for ($x = 0; $x < count($this->results); $x++) {
378 406
                     $this->results[$x] = $this->_striplinks($this->results[$x]);
379
-                    if ($this->expandlinks)
380
-                        $this->results[$x] = $this->_expandlinks($this->results[$x], $URI);
407
+                    if ($this->expandlinks) {
408
+                                            $this->results[$x] = $this->_expandlinks($this->results[$x], $URI);
409
+                    }
381 410
                 }
382 411
             } else {
383 412
                 $this->results = $this->_striplinks($this->results);
384
-                if ($this->expandlinks)
385
-                    $this->results = $this->_expandlinks($this->results, $URI);
413
+                if ($this->expandlinks) {
414
+                                    $this->results = $this->_expandlinks($this->results, $URI);
415
+                }
386 416
             }
387 417
             return $this;
388
-        } else
389
-            return false;
418
+        } else {
419
+                    return false;
420
+        }
390 421
     }
391 422
 
392 423
     /*======================================================================*\
@@ -399,22 +430,26 @@  discard block
 block discarded – undo
399 430
     function submittext($URI, $formvars = "", $formfiles = "")
400 431
     {
401 432
         if ($this->submit($URI, $formvars, $formfiles) !== false) {
402
-            if ($this->lastredirectaddr)
403
-                $URI = $this->lastredirectaddr;
433
+            if ($this->lastredirectaddr) {
434
+                            $URI = $this->lastredirectaddr;
435
+            }
404 436
             if (is_array($this->results)) {
405 437
                 for ($x = 0; $x < count($this->results); $x++) {
406 438
                     $this->results[$x] = $this->_striptext($this->results[$x]);
407
-                    if ($this->expandlinks)
408
-                        $this->results[$x] = $this->_expandlinks($this->results[$x], $URI);
439
+                    if ($this->expandlinks) {
440
+                                            $this->results[$x] = $this->_expandlinks($this->results[$x], $URI);
441
+                    }
409 442
                 }
410 443
             } else {
411 444
                 $this->results = $this->_striptext($this->results);
412
-                if ($this->expandlinks)
413
-                    $this->results = $this->_expandlinks($this->results, $URI);
445
+                if ($this->expandlinks) {
446
+                                    $this->results = $this->_expandlinks($this->results, $URI);
447
+                }
414 448
             }
415 449
             return $this;
416
-        } else
417
-            return false;
450
+        } else {
451
+                    return false;
452
+        }
418 453
     }
419 454
 
420 455
 
@@ -468,13 +503,15 @@  discard block
 block discarded – undo
468 503
         // catenate the non-empty matches from the conditional subpattern
469 504
 
470 505
         while (list($key, $val) = each($links[2])) {
471
-            if (!empty($val))
472
-                $match[] = $val;
506
+            if (!empty($val)) {
507
+                            $match[] = $val;
508
+            }
473 509
         }
474 510
 
475 511
         while (list($key, $val) = each($links[3])) {
476
-            if (!empty($val))
477
-                $match[] = $val;
512
+            if (!empty($val)) {
513
+                            $match[] = $val;
514
+            }
478 515
         }
479 516
 
480 517
         // return the links
@@ -619,23 +656,28 @@  discard block
 block discarded – undo
619 656
     function _httprequest($url, $fp, $URI, $http_method, $content_type = "", $body = "")
620 657
     {
621 658
         $cookie_headers = '';
622
-        if ($this->passcookies && $this->_redirectaddr)
623
-            $this->setcookies();
659
+        if ($this->passcookies && $this->_redirectaddr) {
660
+                    $this->setcookies();
661
+        }
624 662
 
625 663
         $URI_PARTS = parse_url($URI);
626
-        if (empty($url))
627
-            $url = "/";
664
+        if (empty($url)) {
665
+                    $url = "/";
666
+        }
628 667
         $headers = $http_method . " " . $url . " " . $this->_httpversion . "\r\n";
629 668
         if (!empty($this->host) && !isset($this->rawheaders['Host'])) {
630 669
             $headers .= "Host: " . $this->host;
631
-            if (!empty($this->port) && $this->port != '80')
632
-                $headers .= ":" . $this->port;
670
+            if (!empty($this->port) && $this->port != '80') {
671
+                            $headers .= ":" . $this->port;
672
+            }
633 673
             $headers .= "\r\n";
634 674
         }
635
-        if (!empty($this->agent))
636
-            $headers .= "User-Agent: " . $this->agent . "\r\n";
637
-        if (!empty($this->accept))
638
-            $headers .= "Accept: " . $this->accept . "\r\n";
675
+        if (!empty($this->agent)) {
676
+                    $headers .= "User-Agent: " . $this->agent . "\r\n";
677
+        }
678
+        if (!empty($this->accept)) {
679
+                    $headers .= "Accept: " . $this->accept . "\r\n";
680
+        }
639 681
         if ($this->use_gzip) {
640 682
             // make sure PHP was built with --with-zlib
641 683
             // and we can handle gzipp'ed data
@@ -648,11 +690,13 @@  discard block
 block discarded – undo
648 690
                     E_USER_NOTICE);
649 691
             }
650 692
         }
651
-        if (!empty($this->referer))
652
-            $headers .= "Referer: " . $this->referer . "\r\n";
693
+        if (!empty($this->referer)) {
694
+                    $headers .= "Referer: " . $this->referer . "\r\n";
695
+        }
653 696
         if (!empty($this->cookies)) {
654
-            if (!is_array($this->cookies))
655
-                $this->cookies = (array)$this->cookies;
697
+            if (!is_array($this->cookies)) {
698
+                            $this->cookies = (array)$this->cookies;
699
+            }
656 700
 
657 701
             reset($this->cookies);
658 702
             if (count($this->cookies) > 0) {
@@ -664,32 +708,39 @@  discard block
 block discarded – undo
664 708
             }
665 709
         }
666 710
         if (!empty($this->rawheaders)) {
667
-            if (!is_array($this->rawheaders))
668
-                $this->rawheaders = (array)$this->rawheaders;
669
-            while (list($headerKey, $headerVal) = each($this->rawheaders))
670
-                $headers .= $headerKey . ": " . $headerVal . "\r\n";
711
+            if (!is_array($this->rawheaders)) {
712
+                            $this->rawheaders = (array)$this->rawheaders;
713
+            }
714
+            while (list($headerKey, $headerVal) = each($this->rawheaders)) {
715
+                            $headers .= $headerKey . ": " . $headerVal . "\r\n";
716
+            }
671 717
         }
672 718
         if (!empty($content_type)) {
673 719
             $headers .= "Content-type: $content_type";
674
-            if ($content_type == "multipart/form-data")
675
-                $headers .= "; boundary=" . $this->_mime_boundary;
720
+            if ($content_type == "multipart/form-data") {
721
+                            $headers .= "; boundary=" . $this->_mime_boundary;
722
+            }
676 723
             $headers .= "\r\n";
677 724
         }
678
-        if (!empty($body))
679
-            $headers .= "Content-length: " . strlen($body) . "\r\n";
680
-        if (!empty($this->user) || !empty($this->pass))
681
-            $headers .= "Authorization: Basic " . base64_encode($this->user . ":" . $this->pass) . "\r\n";
725
+        if (!empty($body)) {
726
+                    $headers .= "Content-length: " . strlen($body) . "\r\n";
727
+        }
728
+        if (!empty($this->user) || !empty($this->pass)) {
729
+                    $headers .= "Authorization: Basic " . base64_encode($this->user . ":" . $this->pass) . "\r\n";
730
+        }
682 731
 
683 732
         //add proxy auth headers
684
-        if (!empty($this->proxy_user))
685
-            $headers .= 'Proxy-Authorization: ' . 'Basic ' . base64_encode($this->proxy_user . ':' . $this->proxy_pass) . "\r\n";
733
+        if (!empty($this->proxy_user)) {
734
+                    $headers .= 'Proxy-Authorization: ' . 'Basic ' . base64_encode($this->proxy_user . ':' . $this->proxy_pass) . "\r\n";
735
+        }
686 736
 
687 737
 
688 738
         $headers .= "\r\n";
689 739
 
690 740
         // set the read timeout if needed
691
-        if ($this->read_timeout > 0)
692
-            socket_set_timeout($fp, $this->read_timeout);
741
+        if ($this->read_timeout > 0) {
742
+                    socket_set_timeout($fp, $this->read_timeout);
743
+        }
693 744
         $this->timed_out = false;
694 745
 
695 746
         fwrite($fp, $headers . $body, strlen($headers . $body));
@@ -706,8 +757,9 @@  discard block
 block discarded – undo
706 757
                 return false;
707 758
             }
708 759
 
709
-            if ($currentHeader == "\r\n")
710
-                break;
760
+            if ($currentHeader == "\r\n") {
761
+                            break;
762
+            }
711 763
 
712 764
             // if a header begins with Location: or URI:, set the redirect
713 765
             if (preg_match("/^(Location:|URI:)/i", $currentHeader)) {
@@ -718,12 +770,14 @@  discard block
 block discarded – undo
718 770
                     // no host in the path, so prepend
719 771
                     $this->_redirectaddr = $URI_PARTS["scheme"] . "://" . $this->host . ":" . $this->port;
720 772
                     // eliminate double slash
721
-                    if (!preg_match("|^/|", $matches[2]))
722
-                        $this->_redirectaddr .= "/" . $matches[2];
723
-                    else
724
-                        $this->_redirectaddr .= $matches[2];
725
-                } else
726
-                    $this->_redirectaddr = $matches[2];
773
+                    if (!preg_match("|^/|", $matches[2])) {
774
+                                            $this->_redirectaddr .= "/" . $matches[2];
775
+                    } else {
776
+                                            $this->_redirectaddr .= $matches[2];
777
+                    }
778
+                } else {
779
+                                    $this->_redirectaddr = $matches[2];
780
+                }
727 781
             }
728 782
 
729 783
             if (preg_match("|^HTTP/|", $currentHeader)) {
@@ -770,14 +824,17 @@  discard block
 block discarded – undo
770 824
         // have we hit our frame depth and is there frame src to fetch?
771 825
         if (($this->_framedepth < $this->maxframes) && preg_match_all("'<frame\s+.*src[\s]*=[\'\"]?([^\'\"\>]+)'i", $results, $match)) {
772 826
             $this->results[] = $results;
773
-            for ($x = 0; $x < count($match[1]); $x++)
774
-                $this->_frameurls[] = $this->_expandlinks($match[1][$x], $URI_PARTS["scheme"] . "://" . $this->host);
827
+            for ($x = 0; $x < count($match[1]); $x++) {
828
+                            $this->_frameurls[] = $this->_expandlinks($match[1][$x], $URI_PARTS["scheme"] . "://" . $this->host);
829
+            }
775 830
         } // have we already fetched framed content?
776
-        elseif (is_array($this->results))
777
-            $this->results[] = $results;
831
+        elseif (is_array($this->results)) {
832
+                    $this->results[] = $results;
833
+        }
778 834
         // no framed content
779
-        else
780
-            $this->results = $results;
835
+        else {
836
+                    $this->results = $results;
837
+        }
781 838
 
782 839
         return $this;
783 840
     }
@@ -790,8 +847,9 @@  discard block
 block discarded – undo
790 847
     function setcookies()
791 848
     {
792 849
         for ($x = 0; $x < count($this->headers); $x++) {
793
-            if (preg_match('/^set-cookie:[\s]+([^=]+)=([^;]+)/i', $this->headers[$x], $match))
794
-                $this->cookies[$match[1]] = urldecode($match[2]);
850
+            if (preg_match('/^set-cookie:[\s]+([^=]+)=([^;]+)/i', $this->headers[$x], $match)) {
851
+                            $this->cookies[$match[1]] = urldecode($match[2]);
852
+            }
795 853
         }
796 854
         return $this;
797 855
     }
@@ -852,10 +910,12 @@  discard block
 block discarded – undo
852 910
                     'disable_compression' => true,
853 911
                 );
854 912
 
855
-                if (isset($this->cafile))
856
-                    $context_opts['ssl']['cafile'] = $this->cafile;
857
-                if (isset($this->capath))
858
-                    $context_opts['ssl']['capath'] = $this->capath;
913
+                if (isset($this->cafile)) {
914
+                                    $context_opts['ssl']['cafile'] = $this->cafile;
915
+                }
916
+                if (isset($this->capath)) {
917
+                                    $context_opts['ssl']['capath'] = $this->capath;
918
+                }
859 919
             }
860 920
                     
861 921
             $host = 'ssl://' . $host;
@@ -864,8 +924,9 @@  discard block
 block discarded – undo
864 924
         $context = stream_context_create($context_opts);
865 925
 
866 926
         if (version_compare(PHP_VERSION, '5.0.0', '>')) {
867
-            if($this->scheme == 'http')
868
-                $host = "tcp://" . $host;
927
+            if($this->scheme == 'http') {
928
+                            $host = "tcp://" . $host;
929
+            }
869 930
             $fp = stream_socket_client(
870 931
                 "$host:$port",
871 932
                 $errno,
@@ -929,8 +990,9 @@  discard block
 block discarded – undo
929 990
         settype($formfiles, "array");
930 991
         $postdata = '';
931 992
 
932
-        if (count($formvars) == 0 && count($formfiles) == 0)
933
-            return;
993
+        if (count($formvars) == 0 && count($formfiles) == 0) {
994
+                    return;
995
+        }
934 996
 
935 997
         switch ($this->_submit_type) {
936 998
             case "application/x-www-form-urlencoded":
@@ -940,8 +1002,9 @@  discard block
 block discarded – undo
940 1002
                         while (list($cur_key, $cur_val) = each($val)) {
941 1003
                             $postdata .= urlencode($key) . "[]=" . urlencode($cur_val) . "&";
942 1004
                         }
943
-                    } else
944
-                        $postdata .= urlencode($key) . "=" . urlencode($val) . "&";
1005
+                    } else {
1006
+                                            $postdata .= urlencode($key) . "=" . urlencode($val) . "&";
1007
+                    }
945 1008
                 }
946 1009
                 break;
947 1010
 
@@ -967,7 +1030,9 @@  discard block
 block discarded – undo
967 1030
                 while (list($field_name, $file_names) = each($formfiles)) {
968 1031
                     settype($file_names, "array");
969 1032
                     while (list(, $file_name) = each($file_names)) {
970
-                        if (!is_readable($file_name)) continue;
1033
+                        if (!is_readable($file_name)) {
1034
+                            continue;
1035
+                        }
971 1036
 
972 1037
                         $fp = fopen($file_name, "r");
973 1038
                         $file_content = fread($fp, filesize($file_name));
Please login to merge, or discard this patch.