@@ -185,6 +185,7 @@ |
||
185 | 185 | * @param string |
186 | 186 | * @param string |
187 | 187 | * @param string |
188 | + * @param string $val |
|
188 | 189 | * @return string |
189 | 190 | */ |
190 | 191 | protected function _parse_single($key, $val, $string) |
@@ -78,7 +78,7 @@ |
||
78 | 78 | */ |
79 | 79 | public function __construct() |
80 | 80 | { |
81 | - $this->CI =& get_instance(); |
|
81 | + $this->CI = & get_instance(); |
|
82 | 82 | log_message('info', 'Parser Class Initialized'); |
83 | 83 | } |
84 | 84 |
@@ -434,8 +434,8 @@ |
||
434 | 434 | /** |
435 | 435 | * Set table data from a database result object |
436 | 436 | * |
437 | - * @param CI_DB_result $db_result Database result object |
|
438 | 437 | * @return void |
438 | + * @param CI_DB_result $object |
|
439 | 439 | */ |
440 | 440 | protected function _set_from_db_result($object) |
441 | 441 | { |
@@ -55,56 +55,56 @@ |
||
55 | 55 | * |
56 | 56 | * @var array |
57 | 57 | */ |
58 | - public $rows = array(); |
|
58 | + public $rows = array(); |
|
59 | 59 | |
60 | 60 | /** |
61 | 61 | * Data for table heading |
62 | 62 | * |
63 | 63 | * @var array |
64 | 64 | */ |
65 | - public $heading = array(); |
|
65 | + public $heading = array(); |
|
66 | 66 | |
67 | 67 | /** |
68 | 68 | * Whether or not to automatically create the table header |
69 | 69 | * |
70 | 70 | * @var bool |
71 | 71 | */ |
72 | - public $auto_heading = TRUE; |
|
72 | + public $auto_heading = TRUE; |
|
73 | 73 | |
74 | 74 | /** |
75 | 75 | * Table caption |
76 | 76 | * |
77 | 77 | * @var string |
78 | 78 | */ |
79 | - public $caption = NULL; |
|
79 | + public $caption = NULL; |
|
80 | 80 | |
81 | 81 | /** |
82 | 82 | * Table layout template |
83 | 83 | * |
84 | 84 | * @var array |
85 | 85 | */ |
86 | - public $template = NULL; |
|
86 | + public $template = NULL; |
|
87 | 87 | |
88 | 88 | /** |
89 | 89 | * Newline setting |
90 | 90 | * |
91 | 91 | * @var string |
92 | 92 | */ |
93 | - public $newline = "\n"; |
|
93 | + public $newline = "\n"; |
|
94 | 94 | |
95 | 95 | /** |
96 | 96 | * Contents of empty cells |
97 | 97 | * |
98 | 98 | * @var string |
99 | 99 | */ |
100 | - public $empty_cells = ''; |
|
100 | + public $empty_cells = ''; |
|
101 | 101 | |
102 | 102 | /** |
103 | 103 | * Callback for custom table layout |
104 | 104 | * |
105 | 105 | * @var function |
106 | 106 | */ |
107 | - public $function = NULL; |
|
107 | + public $function = NULL; |
|
108 | 108 | |
109 | 109 | /** |
110 | 110 | * Set the template from the table config file if it exists |
@@ -296,8 +296,7 @@ discard block |
||
296 | 296 | if ($table_data instanceof CI_DB_result) |
297 | 297 | { |
298 | 298 | $this->_set_from_db_result($table_data); |
299 | - } |
|
300 | - elseif (is_array($table_data)) |
|
299 | + } elseif (is_array($table_data)) |
|
301 | 300 | { |
302 | 301 | $this->_set_from_array($table_data); |
303 | 302 | } |
@@ -387,12 +386,10 @@ discard block |
||
387 | 386 | if ($cell === '' OR $cell === NULL) |
388 | 387 | { |
389 | 388 | $out .= $this->empty_cells; |
390 | - } |
|
391 | - elseif (isset($this->function)) |
|
389 | + } elseif (isset($this->function)) |
|
392 | 390 | { |
393 | 391 | $out .= call_user_func($this->function, $cell); |
394 | - } |
|
395 | - else |
|
392 | + } else |
|
396 | 393 | { |
397 | 394 | $out .= $cell; |
398 | 395 | } |
@@ -280,6 +280,7 @@ discard block |
||
280 | 280 | * |
281 | 281 | * @param string |
282 | 282 | * @param string |
283 | + * @param string $data |
|
283 | 284 | * @return bool |
284 | 285 | */ |
285 | 286 | public function process($url, $data) |
@@ -423,6 +424,7 @@ discard block |
||
423 | 424 | * Convert Reserved XML characters to Entities |
424 | 425 | * |
425 | 426 | * @param string |
427 | + * @param string $str |
|
426 | 428 | * @return string |
427 | 429 | */ |
428 | 430 | public function convert_xml($str) |
@@ -531,6 +533,7 @@ discard block |
||
531 | 533 | * Set error message |
532 | 534 | * |
533 | 535 | * @param string |
536 | + * @param string $msg |
|
534 | 537 | * @return void |
535 | 538 | */ |
536 | 539 | public function set_error($msg) |
@@ -391,26 +391,26 @@ discard block |
||
391 | 391 | if (strpos($url, '?') !== FALSE) |
392 | 392 | { |
393 | 393 | $tb_array = explode('/', $url); |
394 | - $tb_end = $tb_array[count($tb_array)-1]; |
|
394 | + $tb_end = $tb_array[count($tb_array) - 1]; |
|
395 | 395 | |
396 | 396 | if ( ! is_numeric($tb_end)) |
397 | 397 | { |
398 | - $tb_end = $tb_array[count($tb_array)-2]; |
|
398 | + $tb_end = $tb_array[count($tb_array) - 2]; |
|
399 | 399 | } |
400 | 400 | |
401 | 401 | $tb_array = explode('=', $tb_end); |
402 | - $tb_id = $tb_array[count($tb_array)-1]; |
|
402 | + $tb_id = $tb_array[count($tb_array) - 1]; |
|
403 | 403 | } |
404 | 404 | else |
405 | 405 | { |
406 | 406 | $url = rtrim($url, '/'); |
407 | 407 | |
408 | 408 | $tb_array = explode('/', $url); |
409 | - $tb_id = $tb_array[count($tb_array)-1]; |
|
409 | + $tb_id = $tb_array[count($tb_array) - 1]; |
|
410 | 410 | |
411 | 411 | if ( ! is_numeric($tb_id)) |
412 | 412 | { |
413 | - $tb_id = $tb_array[count($tb_array)-2]; |
|
413 | + $tb_id = $tb_array[count($tb_array) - 2]; |
|
414 | 414 | } |
415 | 415 | } |
416 | 416 | |
@@ -488,9 +488,9 @@ discard block |
||
488 | 488 | */ |
489 | 489 | public function convert_ascii($str) |
490 | 490 | { |
491 | - $count = 1; |
|
492 | - $out = ''; |
|
493 | - $temp = array(); |
|
491 | + $count = 1; |
|
492 | + $out = ''; |
|
493 | + $temp = array(); |
|
494 | 494 | |
495 | 495 | for ($i = 0, $s = strlen($str); $i < $s; $i++) |
496 | 496 | { |
@@ -205,8 +205,7 @@ discard block |
||
205 | 205 | if (MB_ENABLED === TRUE) |
206 | 206 | { |
207 | 207 | $_POST[$val] = mb_convert_encoding($_POST[$val], $this->charset, $this->data['charset']); |
208 | - } |
|
209 | - elseif (ICONV_ENABLED === TRUE) |
|
208 | + } elseif (ICONV_ENABLED === TRUE) |
|
210 | 209 | { |
211 | 210 | $_POST[$val] = @iconv($this->data['charset'], $this->charset.'//IGNORE', $_POST[$val]); |
212 | 211 | } |
@@ -400,8 +399,7 @@ discard block |
||
400 | 399 | |
401 | 400 | $tb_array = explode('=', $tb_end); |
402 | 401 | $tb_id = $tb_array[count($tb_array)-1]; |
403 | - } |
|
404 | - else |
|
402 | + } else |
|
405 | 403 | { |
406 | 404 | $url = rtrim($url, '/'); |
407 | 405 | |
@@ -499,8 +497,7 @@ discard block |
||
499 | 497 | if ($ordinal < 128) |
500 | 498 | { |
501 | 499 | $out .= $str[$i]; |
502 | - } |
|
503 | - else |
|
500 | + } else |
|
504 | 501 | { |
505 | 502 | if (count($temp) === 0) |
506 | 503 | { |
@@ -286,7 +286,6 @@ |
||
286 | 286 | /** |
287 | 287 | * Constructor |
288 | 288 | * |
289 | - * @param array $props |
|
290 | 289 | * @return void |
291 | 290 | */ |
292 | 291 | public function __construct($config = array()) |
@@ -1,40 +1,40 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * CodeIgniter |
|
4 | - * |
|
5 | - * An open source application development framework for PHP |
|
6 | - * |
|
7 | - * This content is released under the MIT License (MIT) |
|
8 | - * |
|
9 | - * Copyright (c) 2014 - 2015, British Columbia Institute of Technology |
|
10 | - * |
|
11 | - * Permission is hereby granted, free of charge, to any person obtaining a copy |
|
12 | - * of this software and associated documentation files (the "Software"), to deal |
|
13 | - * in the Software without restriction, including without limitation the rights |
|
14 | - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
15 | - * copies of the Software, and to permit persons to whom the Software is |
|
16 | - * furnished to do so, subject to the following conditions: |
|
17 | - * |
|
18 | - * The above copyright notice and this permission notice shall be included in |
|
19 | - * all copies or substantial portions of the Software. |
|
20 | - * |
|
21 | - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
22 | - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
23 | - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
|
24 | - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
25 | - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|
26 | - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
|
27 | - * THE SOFTWARE. |
|
28 | - * |
|
29 | - * @package CodeIgniter |
|
30 | - * @author EllisLab Dev Team |
|
31 | - * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) |
|
32 | - * @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/) |
|
33 | - * @license http://opensource.org/licenses/MIT MIT License |
|
34 | - * @link http://codeigniter.com |
|
35 | - * @since Version 1.0.0 |
|
36 | - * @filesource |
|
37 | - */ |
|
3 | + * CodeIgniter |
|
4 | + * |
|
5 | + * An open source application development framework for PHP |
|
6 | + * |
|
7 | + * This content is released under the MIT License (MIT) |
|
8 | + * |
|
9 | + * Copyright (c) 2014 - 2015, British Columbia Institute of Technology |
|
10 | + * |
|
11 | + * Permission is hereby granted, free of charge, to any person obtaining a copy |
|
12 | + * of this software and associated documentation files (the "Software"), to deal |
|
13 | + * in the Software without restriction, including without limitation the rights |
|
14 | + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
15 | + * copies of the Software, and to permit persons to whom the Software is |
|
16 | + * furnished to do so, subject to the following conditions: |
|
17 | + * |
|
18 | + * The above copyright notice and this permission notice shall be included in |
|
19 | + * all copies or substantial portions of the Software. |
|
20 | + * |
|
21 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
22 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
23 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
|
24 | + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
25 | + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|
26 | + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
|
27 | + * THE SOFTWARE. |
|
28 | + * |
|
29 | + * @package CodeIgniter |
|
30 | + * @author EllisLab Dev Team |
|
31 | + * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) |
|
32 | + * @copyright Copyright (c) 2014 - 2015, British Columbia Institute of Technology (http://bcit.ca/) |
|
33 | + * @license http://opensource.org/licenses/MIT MIT License |
|
34 | + * @link http://codeigniter.com |
|
35 | + * @since Version 1.0.0 |
|
36 | + * @filesource |
|
37 | + */ |
|
38 | 38 | defined('BASEPATH') OR exit('No direct script access allowed'); |
39 | 39 | |
40 | 40 | /** |
@@ -293,8 +293,8 @@ discard block |
||
293 | 293 | { |
294 | 294 | empty($config) OR $this->initialize($config, FALSE); |
295 | 295 | |
296 | - $this->_mimes =& get_mimes(); |
|
297 | - $this->_CI =& get_instance(); |
|
296 | + $this->_mimes = & get_mimes(); |
|
297 | + $this->_CI = & get_instance(); |
|
298 | 298 | |
299 | 299 | log_message('info', 'Upload Class Initialized'); |
300 | 300 | } |
@@ -480,7 +480,7 @@ discard block |
||
480 | 480 | else |
481 | 481 | { |
482 | 482 | // An extension was provided, let's have it! |
483 | - $this->file_ext = $this->get_extension($this->_file_name_override); |
|
483 | + $this->file_ext = $this->get_extension($this->_file_name_override); |
|
484 | 484 | } |
485 | 485 | |
486 | 486 | if ( ! $this->is_allowed_filetype(TRUE)) |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | // Convert the file size to kilobytes |
494 | 494 | if ($this->file_size > 0) |
495 | 495 | { |
496 | - $this->file_size = round($this->file_size/1024, 2); |
|
496 | + $this->file_size = round($this->file_size / 1024, 2); |
|
497 | 497 | } |
498 | 498 | |
499 | 499 | // Is the file size within the allowed maximum? |
@@ -812,10 +812,10 @@ discard block |
||
812 | 812 | { |
813 | 813 | $types = array(1 => 'gif', 2 => 'jpeg', 3 => 'png'); |
814 | 814 | |
815 | - $this->image_width = $D[0]; |
|
816 | - $this->image_height = $D[1]; |
|
817 | - $this->image_type = isset($types[$D[2]]) ? $types[$D[2]] : 'unknown'; |
|
818 | - $this->image_size_str = $D[3]; // string containing height and width |
|
815 | + $this->image_width = $D[0]; |
|
816 | + $this->image_height = $D[1]; |
|
817 | + $this->image_type = isset($types[$D[2]]) ? $types[$D[2]] : 'unknown'; |
|
818 | + $this->image_size_str = $D[3]; // string containing height and width |
|
819 | 819 | } |
820 | 820 | } |
821 | 821 | |
@@ -863,7 +863,7 @@ discard block |
||
863 | 863 | $this->file_type = 'image/jpeg'; |
864 | 864 | } |
865 | 865 | |
866 | - $img_mimes = array('image/gif', 'image/jpeg', 'image/png'); |
|
866 | + $img_mimes = array('image/gif', 'image/jpeg', 'image/png'); |
|
867 | 867 | |
868 | 868 | return in_array($this->file_type, $img_mimes, TRUE); |
869 | 869 | } |
@@ -1005,7 +1005,7 @@ discard block |
||
1005 | 1005 | return FALSE; |
1006 | 1006 | } |
1007 | 1007 | |
1008 | - $this->upload_path = preg_replace('/(.+?)\/*$/', '\\1/', $this->upload_path); |
|
1008 | + $this->upload_path = preg_replace('/(.+?)\/*$/', '\\1/', $this->upload_path); |
|
1009 | 1009 | return TRUE; |
1010 | 1010 | } |
1011 | 1011 | |
@@ -1049,9 +1049,9 @@ discard block |
||
1049 | 1049 | $ext = ''; |
1050 | 1050 | if (strpos($filename, '.') !== FALSE) |
1051 | 1051 | { |
1052 | - $parts = explode('.', $filename); |
|
1053 | - $ext = '.'.array_pop($parts); |
|
1054 | - $filename = implode('.', $parts); |
|
1052 | + $parts = explode('.', $filename); |
|
1053 | + $ext = '.'.array_pop($parts); |
|
1054 | + $filename = implode('.', $parts); |
|
1055 | 1055 | } |
1056 | 1056 | |
1057 | 1057 | return substr($filename, 0, ($length - strlen($ext))).$ext; |
@@ -327,19 +327,16 @@ discard block |
||
327 | 327 | if ($reflection->hasMethod('set_'.$key)) |
328 | 328 | { |
329 | 329 | $this->{'set_'.$key}($config[$key]); |
330 | - } |
|
331 | - else |
|
330 | + } else |
|
332 | 331 | { |
333 | 332 | $this->$key = $config[$key]; |
334 | 333 | } |
335 | - } |
|
336 | - else |
|
334 | + } else |
|
337 | 335 | { |
338 | 336 | $this->$key = $defaults[$key]; |
339 | 337 | } |
340 | 338 | } |
341 | - } |
|
342 | - else |
|
339 | + } else |
|
343 | 340 | { |
344 | 341 | foreach ($config as $key => &$value) |
345 | 342 | { |
@@ -348,8 +345,7 @@ discard block |
||
348 | 345 | if ($reflection->hasMethod('set_'.$key)) |
349 | 346 | { |
350 | 347 | $this->{'set_'.$key}($value); |
351 | - } |
|
352 | - else |
|
348 | + } else |
|
353 | 349 | { |
354 | 350 | $this->$key = $value; |
355 | 351 | } |
@@ -476,8 +472,7 @@ discard block |
||
476 | 472 | if (strpos($this->_file_name_override, '.') === FALSE) |
477 | 473 | { |
478 | 474 | $this->file_name .= $this->file_ext; |
479 | - } |
|
480 | - else |
|
475 | + } else |
|
481 | 476 | { |
482 | 477 | // An extension was provided, let's have it! |
483 | 478 | $this->file_ext = $this->get_extension($this->_file_name_override); |
@@ -671,8 +666,7 @@ discard block |
||
671 | 666 | { |
672 | 667 | $this->set_error('upload_bad_filename', 'debug'); |
673 | 668 | return FALSE; |
674 | - } |
|
675 | - else |
|
669 | + } else |
|
676 | 670 | { |
677 | 671 | return $new_filename; |
678 | 672 | } |
@@ -857,8 +851,7 @@ discard block |
||
857 | 851 | if (in_array($this->file_type, $png_mimes)) |
858 | 852 | { |
859 | 853 | $this->file_type = 'image/png'; |
860 | - } |
|
861 | - elseif (in_array($this->file_type, $jpeg_mimes)) |
|
854 | + } elseif (in_array($this->file_type, $jpeg_mimes)) |
|
862 | 855 | { |
863 | 856 | $this->file_type = 'image/jpeg'; |
864 | 857 | } |
@@ -1099,9 +1092,12 @@ discard block |
||
1099 | 1092 | |
1100 | 1093 | if (function_exists('getimagesize') && @getimagesize($file) !== FALSE) |
1101 | 1094 | { |
1102 | - if (($file = @fopen($file, 'rb')) === FALSE) // "b" to force binary |
|
1095 | + if (($file = @fopen($file, 'rb')) === FALSE) { |
|
1096 | + // "b" to force binary |
|
1103 | 1097 | { |
1104 | - return FALSE; // Couldn't open the file, return FALSE |
|
1098 | + return FALSE; |
|
1099 | + } |
|
1100 | + // Couldn't open the file, return FALSE |
|
1105 | 1101 | } |
1106 | 1102 | |
1107 | 1103 | $opening_bytes = fread($file, 256); |
@@ -1209,9 +1205,11 @@ discard block |
||
1209 | 1205 | if (function_exists('finfo_file')) |
1210 | 1206 | { |
1211 | 1207 | $finfo = @finfo_open(FILEINFO_MIME); |
1212 | - if (is_resource($finfo)) // It is possible that a FALSE value is returned, if there is no magic MIME database file found on the system |
|
1208 | + if (is_resource($finfo)) { |
|
1209 | + // It is possible that a FALSE value is returned, if there is no magic MIME database file found on the system |
|
1213 | 1210 | { |
1214 | 1211 | $mime = @finfo_file($finfo, $file['tmp_name']); |
1212 | + } |
|
1215 | 1213 | finfo_close($finfo); |
1216 | 1214 | |
1217 | 1215 | /* According to the comments section of the PHP manual page, |
@@ -1296,10 +1294,12 @@ discard block |
||
1296 | 1294 | if (function_exists('mime_content_type')) |
1297 | 1295 | { |
1298 | 1296 | $this->file_type = @mime_content_type($file['tmp_name']); |
1299 | - if (strlen($this->file_type) > 0) // It's possible that mime_content_type() returns FALSE or an empty string |
|
1297 | + if (strlen($this->file_type) > 0) { |
|
1298 | + // It's possible that mime_content_type() returns FALSE or an empty string |
|
1300 | 1299 | { |
1301 | 1300 | return; |
1302 | 1301 | } |
1302 | + } |
|
1303 | 1303 | } |
1304 | 1304 | |
1305 | 1305 | $this->file_type = $file['type']; |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | /** |
250 | 250 | * Compile the User Agent Data |
251 | 251 | * |
252 | - * @return bool |
|
252 | + * @return boolean|null |
|
253 | 253 | */ |
254 | 254 | protected function _compile_data() |
255 | 255 | { |
@@ -585,7 +585,7 @@ discard block |
||
585 | 585 | /** |
586 | 586 | * Get the referrer |
587 | 587 | * |
588 | - * @return bool |
|
588 | + * @return string |
|
589 | 589 | */ |
590 | 590 | public function referrer() |
591 | 591 | { |
@@ -496,8 +496,7 @@ |
||
496 | 496 | if (empty($_SERVER['HTTP_REFERER'])) |
497 | 497 | { |
498 | 498 | $this->referer = FALSE; |
499 | - } |
|
500 | - else |
|
499 | + } else |
|
501 | 500 | { |
502 | 501 | $referer_host = @parse_url($_SERVER['HTTP_REFERER'], PHP_URL_HOST); |
503 | 502 | $own_host = parse_url(config_item('base_url'), PHP_URL_HOST); |
@@ -446,7 +446,7 @@ discard block |
||
446 | 446 | * Values Parsing |
447 | 447 | * |
448 | 448 | * @param mixed $value |
449 | - * @return object |
|
449 | + * @return XML_RPC_Values |
|
450 | 450 | */ |
451 | 451 | public function values_parsing($value) |
452 | 452 | { |
@@ -530,7 +530,7 @@ discard block |
||
530 | 530 | * |
531 | 531 | * @param int $number |
532 | 532 | * @param string $message |
533 | - * @return object |
|
533 | + * @return XML_RPC_Response |
|
534 | 534 | */ |
535 | 535 | public function send_error_message($number, $message) |
536 | 536 | { |
@@ -543,7 +543,7 @@ discard block |
||
543 | 543 | * Send Response for Server Request |
544 | 544 | * |
545 | 545 | * @param array $response |
546 | - * @return object |
|
546 | + * @return XML_RPC_Response |
|
547 | 547 | */ |
548 | 548 | public function send_response($response) |
549 | 549 | { |
@@ -1116,7 +1116,7 @@ discard block |
||
1116 | 1116 | * Parse External XML-RPC Server's Response |
1117 | 1117 | * |
1118 | 1118 | * @param resource |
1119 | - * @return object |
|
1119 | + * @return XML_RPC_Response |
|
1120 | 1120 | */ |
1121 | 1121 | public function parseResponse($fp) |
1122 | 1122 | { |
@@ -1672,7 +1672,7 @@ discard block |
||
1672 | 1672 | /** |
1673 | 1673 | * Constructor |
1674 | 1674 | * |
1675 | - * @param mixed $val |
|
1675 | + * @param integer $val |
|
1676 | 1676 | * @param string $type |
1677 | 1677 | * @return void |
1678 | 1678 | */ |
@@ -1706,6 +1706,7 @@ discard block |
||
1706 | 1706 | * |
1707 | 1707 | * @param scalar |
1708 | 1708 | * @param string |
1709 | + * @param integer $val |
|
1709 | 1710 | * @return int |
1710 | 1711 | */ |
1711 | 1712 | public function addScalar($val, $type = 'string') |
@@ -1773,6 +1774,7 @@ discard block |
||
1773 | 1774 | * Add struct value |
1774 | 1775 | * |
1775 | 1776 | * @param object |
1777 | + * @param integer $vals |
|
1776 | 1778 | * @return int |
1777 | 1779 | */ |
1778 | 1780 | public function addStruct($vals) |
@@ -1914,7 +1914,7 @@ |
||
1914 | 1914 | * @param int unix timestamp |
1915 | 1915 | * @param bool |
1916 | 1916 | * @return string |
1917 | - */ |
|
1917 | + */ |
|
1918 | 1918 | public function iso8601_encode($time, $utc = FALSE) |
1919 | 1919 | { |
1920 | 1920 | return ($utc) ? strftime('%Y%m%dT%H:%i:%s', $time) : gmstrftime('%Y%m%dT%H:%i:%s', $time); |
@@ -60,140 +60,140 @@ discard block |
||
60 | 60 | * |
61 | 61 | * @var bool |
62 | 62 | */ |
63 | - public $debug = FALSE; |
|
63 | + public $debug = FALSE; |
|
64 | 64 | |
65 | 65 | /** |
66 | 66 | * I4 data type |
67 | 67 | * |
68 | 68 | * @var string |
69 | 69 | */ |
70 | - public $xmlrpcI4 = 'i4'; |
|
70 | + public $xmlrpcI4 = 'i4'; |
|
71 | 71 | |
72 | 72 | /** |
73 | 73 | * Integer data type |
74 | 74 | * |
75 | 75 | * @var string |
76 | 76 | */ |
77 | - public $xmlrpcInt = 'int'; |
|
77 | + public $xmlrpcInt = 'int'; |
|
78 | 78 | |
79 | 79 | /** |
80 | 80 | * Boolean data type |
81 | 81 | * |
82 | 82 | * @var string |
83 | 83 | */ |
84 | - public $xmlrpcBoolean = 'boolean'; |
|
84 | + public $xmlrpcBoolean = 'boolean'; |
|
85 | 85 | |
86 | 86 | /** |
87 | 87 | * Double data type |
88 | 88 | * |
89 | 89 | * @var string |
90 | 90 | */ |
91 | - public $xmlrpcDouble = 'double'; |
|
91 | + public $xmlrpcDouble = 'double'; |
|
92 | 92 | |
93 | 93 | /** |
94 | 94 | * String data type |
95 | 95 | * |
96 | 96 | * @var string |
97 | 97 | */ |
98 | - public $xmlrpcString = 'string'; |
|
98 | + public $xmlrpcString = 'string'; |
|
99 | 99 | |
100 | 100 | /** |
101 | 101 | * DateTime format |
102 | 102 | * |
103 | 103 | * @var string |
104 | 104 | */ |
105 | - public $xmlrpcDateTime = 'dateTime.iso8601'; |
|
105 | + public $xmlrpcDateTime = 'dateTime.iso8601'; |
|
106 | 106 | |
107 | 107 | /** |
108 | 108 | * Base64 data type |
109 | 109 | * |
110 | 110 | * @var string |
111 | 111 | */ |
112 | - public $xmlrpcBase64 = 'base64'; |
|
112 | + public $xmlrpcBase64 = 'base64'; |
|
113 | 113 | |
114 | 114 | /** |
115 | 115 | * Array data type |
116 | 116 | * |
117 | 117 | * @var string |
118 | 118 | */ |
119 | - public $xmlrpcArray = 'array'; |
|
119 | + public $xmlrpcArray = 'array'; |
|
120 | 120 | |
121 | 121 | /** |
122 | 122 | * Struct data type |
123 | 123 | * |
124 | 124 | * @var string |
125 | 125 | */ |
126 | - public $xmlrpcStruct = 'struct'; |
|
126 | + public $xmlrpcStruct = 'struct'; |
|
127 | 127 | |
128 | 128 | /** |
129 | 129 | * Data types list |
130 | 130 | * |
131 | 131 | * @var array |
132 | 132 | */ |
133 | - public $xmlrpcTypes = array(); |
|
133 | + public $xmlrpcTypes = array(); |
|
134 | 134 | |
135 | 135 | /** |
136 | 136 | * Valid parents list |
137 | 137 | * |
138 | 138 | * @var array |
139 | 139 | */ |
140 | - public $valid_parents = array(); |
|
140 | + public $valid_parents = array(); |
|
141 | 141 | |
142 | 142 | /** |
143 | 143 | * Response error numbers list |
144 | 144 | * |
145 | 145 | * @var array |
146 | 146 | */ |
147 | - public $xmlrpcerr = array(); |
|
147 | + public $xmlrpcerr = array(); |
|
148 | 148 | |
149 | 149 | /** |
150 | 150 | * Response error messages list |
151 | 151 | * |
152 | 152 | * @var string[] |
153 | 153 | */ |
154 | - public $xmlrpcstr = array(); |
|
154 | + public $xmlrpcstr = array(); |
|
155 | 155 | |
156 | 156 | /** |
157 | 157 | * Encoding charset |
158 | 158 | * |
159 | 159 | * @var string |
160 | 160 | */ |
161 | - public $xmlrpc_defencoding = 'UTF-8'; |
|
161 | + public $xmlrpc_defencoding = 'UTF-8'; |
|
162 | 162 | |
163 | 163 | /** |
164 | 164 | * XML-RPC client name |
165 | 165 | * |
166 | 166 | * @var string |
167 | 167 | */ |
168 | - public $xmlrpcName = 'XML-RPC for CodeIgniter'; |
|
168 | + public $xmlrpcName = 'XML-RPC for CodeIgniter'; |
|
169 | 169 | |
170 | 170 | /** |
171 | 171 | * XML-RPC version |
172 | 172 | * |
173 | 173 | * @var string |
174 | 174 | */ |
175 | - public $xmlrpcVersion = '1.1'; |
|
175 | + public $xmlrpcVersion = '1.1'; |
|
176 | 176 | |
177 | 177 | /** |
178 | 178 | * Start of user errors |
179 | 179 | * |
180 | 180 | * @var int |
181 | 181 | */ |
182 | - public $xmlrpcerruser = 800; |
|
182 | + public $xmlrpcerruser = 800; |
|
183 | 183 | |
184 | 184 | /** |
185 | 185 | * Start of XML parse errors |
186 | 186 | * |
187 | 187 | * @var int |
188 | 188 | */ |
189 | - public $xmlrpcerrxml = 100; |
|
189 | + public $xmlrpcerrxml = 100; |
|
190 | 190 | |
191 | 191 | /** |
192 | 192 | * Backslash replacement value |
193 | 193 | * |
194 | 194 | * @var string |
195 | 195 | */ |
196 | - public $xmlrpc_backslash = ''; |
|
196 | + public $xmlrpc_backslash = ''; |
|
197 | 197 | |
198 | 198 | /** |
199 | 199 | * XML-RPC Client object |
@@ -221,14 +221,14 @@ discard block |
||
221 | 221 | * |
222 | 222 | * @var string |
223 | 223 | */ |
224 | - public $message = ''; |
|
224 | + public $message = ''; |
|
225 | 225 | |
226 | 226 | /** |
227 | 227 | * Request error message |
228 | 228 | * |
229 | 229 | * @var string |
230 | 230 | */ |
231 | - public $error = ''; |
|
231 | + public $error = ''; |
|
232 | 232 | |
233 | 233 | /** |
234 | 234 | * XML-RPC result object |
@@ -242,14 +242,14 @@ discard block |
||
242 | 242 | * |
243 | 243 | * @var array |
244 | 244 | */ |
245 | - public $response = array(); // Response from remote server |
|
245 | + public $response = array(); // Response from remote server |
|
246 | 246 | |
247 | 247 | /** |
248 | 248 | * XSS Filter flag |
249 | 249 | * |
250 | 250 | * @var bool |
251 | 251 | */ |
252 | - public $xss_clean = TRUE; |
|
252 | + public $xss_clean = TRUE; |
|
253 | 253 | |
254 | 254 | // -------------------------------------------------------------------- |
255 | 255 | |
@@ -568,21 +568,21 @@ discard block |
||
568 | 568 | * |
569 | 569 | * @var string |
570 | 570 | */ |
571 | - public $path = ''; |
|
571 | + public $path = ''; |
|
572 | 572 | |
573 | 573 | /** |
574 | 574 | * Server hostname |
575 | 575 | * |
576 | 576 | * @var string |
577 | 577 | */ |
578 | - public $server = ''; |
|
578 | + public $server = ''; |
|
579 | 579 | |
580 | 580 | /** |
581 | 581 | * Server port |
582 | 582 | * |
583 | 583 | * @var int |
584 | 584 | */ |
585 | - public $port = 80; |
|
585 | + public $port = 80; |
|
586 | 586 | |
587 | 587 | /** |
588 | 588 | * |
@@ -604,42 +604,42 @@ discard block |
||
604 | 604 | * |
605 | 605 | * @var string |
606 | 606 | */ |
607 | - public $proxy = FALSE; |
|
607 | + public $proxy = FALSE; |
|
608 | 608 | |
609 | 609 | /** |
610 | 610 | * Proxy port |
611 | 611 | * |
612 | 612 | * @var int |
613 | 613 | */ |
614 | - public $proxy_port = 8080; |
|
614 | + public $proxy_port = 8080; |
|
615 | 615 | |
616 | 616 | /** |
617 | 617 | * Error number |
618 | 618 | * |
619 | 619 | * @var string |
620 | 620 | */ |
621 | - public $errno = ''; |
|
621 | + public $errno = ''; |
|
622 | 622 | |
623 | 623 | /** |
624 | 624 | * Error message |
625 | 625 | * |
626 | 626 | * @var string |
627 | 627 | */ |
628 | - public $errstring = ''; |
|
628 | + public $errstring = ''; |
|
629 | 629 | |
630 | 630 | /** |
631 | 631 | * Timeout in seconds |
632 | 632 | * |
633 | 633 | * @var int |
634 | 634 | */ |
635 | - public $timeout = 5; |
|
635 | + public $timeout = 5; |
|
636 | 636 | |
637 | 637 | /** |
638 | 638 | * No Multicall flag |
639 | 639 | * |
640 | 640 | * @var bool |
641 | 641 | */ |
642 | - public $no_multicall = FALSE; |
|
642 | + public $no_multicall = FALSE; |
|
643 | 643 | |
644 | 644 | // -------------------------------------------------------------------- |
645 | 645 | |
@@ -791,35 +791,35 @@ discard block |
||
791 | 791 | * |
792 | 792 | * @var mixed |
793 | 793 | */ |
794 | - public $val = 0; |
|
794 | + public $val = 0; |
|
795 | 795 | |
796 | 796 | /** |
797 | 797 | * Error number |
798 | 798 | * |
799 | 799 | * @var int |
800 | 800 | */ |
801 | - public $errno = 0; |
|
801 | + public $errno = 0; |
|
802 | 802 | |
803 | 803 | /** |
804 | 804 | * Error message |
805 | 805 | * |
806 | 806 | * @var string |
807 | 807 | */ |
808 | - public $errstr = ''; |
|
808 | + public $errstr = ''; |
|
809 | 809 | |
810 | 810 | /** |
811 | 811 | * Headers list |
812 | 812 | * |
813 | 813 | * @var array |
814 | 814 | */ |
815 | - public $headers = array(); |
|
815 | + public $headers = array(); |
|
816 | 816 | |
817 | 817 | /** |
818 | 818 | * XSS Filter flag |
819 | 819 | * |
820 | 820 | * @var bool |
821 | 821 | */ |
822 | - public $xss_clean = TRUE; |
|
822 | + public $xss_clean = TRUE; |
|
823 | 823 | |
824 | 824 | // -------------------------------------------------------------------- |
825 | 825 | |
@@ -928,7 +928,7 @@ discard block |
||
928 | 928 | */ |
929 | 929 | public function decode($array = NULL) |
930 | 930 | { |
931 | - $CI =& get_instance(); |
|
931 | + $CI = & get_instance(); |
|
932 | 932 | |
933 | 933 | if (is_array($array)) |
934 | 934 | { |
@@ -994,7 +994,7 @@ discard block |
||
994 | 994 | reset($xmlrpc_val->me['struct']); |
995 | 995 | $arr = array(); |
996 | 996 | |
997 | - while (list($key,$value) = each($xmlrpc_val->me['struct'])) |
|
997 | + while (list($key, $value) = each($xmlrpc_val->me['struct'])) |
|
998 | 998 | { |
999 | 999 | $arr[$key] = $this->xmlrpc_decoder($value); |
1000 | 1000 | } |
@@ -1054,14 +1054,14 @@ discard block |
||
1054 | 1054 | * |
1055 | 1055 | * @var array |
1056 | 1056 | */ |
1057 | - public $params = array(); |
|
1057 | + public $params = array(); |
|
1058 | 1058 | |
1059 | 1059 | /** |
1060 | 1060 | * XH? |
1061 | 1061 | * |
1062 | 1062 | * @var array |
1063 | 1063 | */ |
1064 | - public $xh = array(); |
|
1064 | + public $xh = array(); |
|
1065 | 1065 | |
1066 | 1066 | // -------------------------------------------------------------------- |
1067 | 1067 | |
@@ -1143,7 +1143,7 @@ discard block |
||
1143 | 1143 | // Check for HTTP 200 Response |
1144 | 1144 | if (strpos($data, 'HTTP') === 0 && ! preg_match('/^HTTP\/[0-9\.]+ 200 /', $data)) |
1145 | 1145 | { |
1146 | - $errstr = substr($data, 0, strpos($data, "\n")-1); |
|
1146 | + $errstr = substr($data, 0, strpos($data, "\n") - 1); |
|
1147 | 1147 | return new XML_RPC_Response(0, $this->xmlrpcerr['http_error'], $this->xmlrpcstr['http_error'].' ('.$errstr.')'); |
1148 | 1148 | } |
1149 | 1149 | |
@@ -1398,7 +1398,7 @@ discard block |
||
1398 | 1398 | case 'ARRAY': |
1399 | 1399 | $cur_val = array_shift($this->xh[$the_parser]['valuestack']); |
1400 | 1400 | $this->xh[$the_parser]['value'] = isset($cur_val['values']) ? $cur_val['values'] : array(); |
1401 | - $this->xh[$the_parser]['vt'] = strtolower($name); |
|
1401 | + $this->xh[$the_parser]['vt'] = strtolower($name); |
|
1402 | 1402 | break; |
1403 | 1403 | case 'NAME': |
1404 | 1404 | $this->xh[$the_parser]['valuestack'][0]['name'] = $this->xh[$the_parser]['ac']; |
@@ -1418,7 +1418,7 @@ discard block |
||
1418 | 1418 | } |
1419 | 1419 | elseif ($name === 'DATETIME.ISO8601') |
1420 | 1420 | { |
1421 | - $this->xh[$the_parser]['vt'] = $this->xmlrpcDateTime; |
|
1421 | + $this->xh[$the_parser]['vt'] = $this->xmlrpcDateTime; |
|
1422 | 1422 | $this->xh[$the_parser]['value'] = $this->xh[$the_parser]['ac']; |
1423 | 1423 | } |
1424 | 1424 | elseif ($name === 'BASE64') |
@@ -1430,7 +1430,7 @@ discard block |
||
1430 | 1430 | // Translated BOOLEAN values to TRUE AND FALSE |
1431 | 1431 | $this->xh[$the_parser]['value'] = (bool) $this->xh[$the_parser]['ac']; |
1432 | 1432 | } |
1433 | - elseif ($name=='DOUBLE') |
|
1433 | + elseif ($name == 'DOUBLE') |
|
1434 | 1434 | { |
1435 | 1435 | // we have a DOUBLE |
1436 | 1436 | // we must check that only 0123456789-.<space> are characters here |
@@ -1453,8 +1453,8 @@ discard block |
||
1453 | 1453 | // This if() detects if no scalar was inside <VALUE></VALUE> |
1454 | 1454 | if ($this->xh[$the_parser]['vt'] == 'value') |
1455 | 1455 | { |
1456 | - $this->xh[$the_parser]['value'] = $this->xh[$the_parser]['ac']; |
|
1457 | - $this->xh[$the_parser]['vt'] = $this->xmlrpcString; |
|
1456 | + $this->xh[$the_parser]['value'] = $this->xh[$the_parser]['ac']; |
|
1457 | + $this->xh[$the_parser]['vt'] = $this->xmlrpcString; |
|
1458 | 1458 | } |
1459 | 1459 | |
1460 | 1460 | // build the XML-RPC value out of the data received, and substitute it |
@@ -1559,7 +1559,7 @@ discard block |
||
1559 | 1559 | */ |
1560 | 1560 | public function output_parameters(array $array = array()) |
1561 | 1561 | { |
1562 | - $CI =& get_instance(); |
|
1562 | + $CI = & get_instance(); |
|
1563 | 1563 | |
1564 | 1564 | if ( ! empty($array)) |
1565 | 1565 | { |
@@ -1633,7 +1633,7 @@ discard block |
||
1633 | 1633 | reset($param->me['struct']); |
1634 | 1634 | $arr = array(); |
1635 | 1635 | |
1636 | - while (list($key,$value) = each($param->me['struct'])) |
|
1636 | + while (list($key, $value) = each($param->me['struct'])) |
|
1637 | 1637 | { |
1638 | 1638 | $arr[$key] = $this->decode_message($value); |
1639 | 1639 | } |
@@ -1658,14 +1658,14 @@ discard block |
||
1658 | 1658 | * |
1659 | 1659 | * @var array |
1660 | 1660 | */ |
1661 | - public $me = array(); |
|
1661 | + public $me = array(); |
|
1662 | 1662 | |
1663 | 1663 | /** |
1664 | 1664 | * Value type |
1665 | 1665 | * |
1666 | 1666 | * @var int |
1667 | 1667 | */ |
1668 | - public $mytype = 0; |
|
1668 | + public $mytype = 0; |
|
1669 | 1669 | |
1670 | 1670 | // -------------------------------------------------------------------- |
1671 | 1671 | |
@@ -1844,13 +1844,13 @@ discard block |
||
1844 | 1844 | switch ($typ) |
1845 | 1845 | { |
1846 | 1846 | case $this->xmlrpcBase64: |
1847 | - $rs .= '<'.$typ.'>'.base64_encode( (string) $val).'</'.$typ.">\n"; |
|
1847 | + $rs .= '<'.$typ.'>'.base64_encode((string) $val).'</'.$typ.">\n"; |
|
1848 | 1848 | break; |
1849 | 1849 | case $this->xmlrpcBoolean: |
1850 | - $rs .= '<'.$typ.'>'.( (bool) $val ? '1' : '0').'</'.$typ.">\n"; |
|
1850 | + $rs .= '<'.$typ.'>'.((bool) $val ? '1' : '0').'</'.$typ.">\n"; |
|
1851 | 1851 | break; |
1852 | 1852 | case $this->xmlrpcString: |
1853 | - $rs .= '<'.$typ.'>'.htmlspecialchars( (string) $val).'</'.$typ.">\n"; |
|
1853 | + $rs .= '<'.$typ.'>'.htmlspecialchars((string) $val).'</'.$typ.">\n"; |
|
1854 | 1854 | break; |
1855 | 1855 | default: |
1856 | 1856 | $rs .= '<'.$typ.'>'.$val.'</'.$typ.">\n"; |
@@ -455,8 +455,7 @@ discard block |
||
455 | 455 | if ( ! isset($value[1], $this->xmlrpcTypes[$value[1]])) |
456 | 456 | { |
457 | 457 | $temp = new XML_RPC_Values($value[0], (is_array($value[0]) ? 'array' : 'string')); |
458 | - } |
|
459 | - else |
|
458 | + } else |
|
460 | 459 | { |
461 | 460 | if (is_array($value[0]) && ($value[1] === 'struct' OR $value[1] === 'array')) |
462 | 461 | { |
@@ -468,8 +467,7 @@ discard block |
||
468 | 467 | |
469 | 468 | $temp = new XML_RPC_Values($value[0], $value[1]); |
470 | 469 | } |
471 | - } |
|
472 | - else |
|
470 | + } else |
|
473 | 471 | { |
474 | 472 | $temp = new XML_RPC_Values($value, 'string'); |
475 | 473 | } |
@@ -705,8 +703,7 @@ discard block |
||
705 | 703 | { |
706 | 704 | $server = $this->server; |
707 | 705 | $port = $this->port; |
708 | - } |
|
709 | - else |
|
706 | + } else |
|
710 | 707 | { |
711 | 708 | $server = $this->proxy; |
712 | 709 | $port = $this->proxy_port; |
@@ -747,8 +744,7 @@ discard block |
||
747 | 744 | if ($timestamp === 0) |
748 | 745 | { |
749 | 746 | $timestamp = time(); |
750 | - } |
|
751 | - elseif ($timestamp < (time() - $this->timeout)) |
|
747 | + } elseif ($timestamp < (time() - $this->timeout)) |
|
752 | 748 | { |
753 | 749 | $result = FALSE; |
754 | 750 | break; |
@@ -756,8 +752,7 @@ discard block |
||
756 | 752 | |
757 | 753 | usleep(250000); |
758 | 754 | continue; |
759 | - } |
|
760 | - else |
|
755 | + } else |
|
761 | 756 | { |
762 | 757 | $timestamp = 0; |
763 | 758 | } |
@@ -840,14 +835,12 @@ discard block |
||
840 | 835 | $this->errstr = htmlspecialchars($fstr, |
841 | 836 | (is_php('5.4') ? ENT_XML1 | ENT_NOQUOTES : ENT_NOQUOTES), |
842 | 837 | 'UTF-8'); |
843 | - } |
|
844 | - elseif ( ! is_object($val)) |
|
838 | + } elseif ( ! is_object($val)) |
|
845 | 839 | { |
846 | 840 | // programmer error, not an object |
847 | 841 | error_log("Invalid type '".gettype($val)."' (value: ".$val.') passed to XML_RPC_Response. Defaulting to empty value.'); |
848 | 842 | $this->val = new XML_RPC_Values(); |
849 | - } |
|
850 | - else |
|
843 | + } else |
|
851 | 844 | { |
852 | 845 | $this->val = $val; |
853 | 846 | } |
@@ -937,8 +930,7 @@ discard block |
||
937 | 930 | if (is_array($array[$key])) |
938 | 931 | { |
939 | 932 | $array[$key] = $this->decode($array[$key]); |
940 | - } |
|
941 | - elseif ($this->xss_clean) |
|
933 | + } elseif ($this->xss_clean) |
|
942 | 934 | { |
943 | 935 | $array[$key] = $CI->security->xss_clean($array[$key]); |
944 | 936 | } |
@@ -952,8 +944,7 @@ discard block |
||
952 | 944 | if (is_array($result)) |
953 | 945 | { |
954 | 946 | $result = $this->decode($result); |
955 | - } |
|
956 | - elseif ($this->xss_clean) |
|
947 | + } elseif ($this->xss_clean) |
|
957 | 948 | { |
958 | 949 | $result = $CI->security->xss_clean($result); |
959 | 950 | } |
@@ -976,8 +967,7 @@ discard block |
||
976 | 967 | if ($kind === 'scalar') |
977 | 968 | { |
978 | 969 | return $xmlrpc_val->scalarval(); |
979 | - } |
|
980 | - elseif ($kind === 'array') |
|
970 | + } elseif ($kind === 'array') |
|
981 | 971 | { |
982 | 972 | reset($xmlrpc_val->me); |
983 | 973 | $b = current($xmlrpc_val->me); |
@@ -988,8 +978,7 @@ discard block |
||
988 | 978 | $arr[] = $this->xmlrpc_decoder($xmlrpc_val->me['array'][$i]); |
989 | 979 | } |
990 | 980 | return $arr; |
991 | - } |
|
992 | - elseif ($kind === 'struct') |
|
981 | + } elseif ($kind === 'struct') |
|
993 | 982 | { |
994 | 983 | reset($xmlrpc_val->me['struct']); |
995 | 984 | $arr = array(); |
@@ -1202,8 +1191,7 @@ discard block |
||
1202 | 1191 | } |
1203 | 1192 | |
1204 | 1193 | return new XML_RPC_Response(0, $this->xmlrpcerr['invalid_return'], $this->xmlrpcstr['invalid_return'].' '.$this->xh[$pname]['isf_reason']); |
1205 | - } |
|
1206 | - elseif ( ! is_object($this->xh[$pname]['value'])) |
|
1194 | + } elseif ( ! is_object($this->xh[$pname]['value'])) |
|
1207 | 1195 | { |
1208 | 1196 | return new XML_RPC_Response(0, $this->xmlrpcerr['invalid_return'], $this->xmlrpcstr['invalid_return'].' '.$this->xh[$pname]['isf_reason']); |
1209 | 1197 | } |
@@ -1243,8 +1231,7 @@ discard block |
||
1243 | 1231 | } |
1244 | 1232 | |
1245 | 1233 | $r = new XML_RPC_Response($v, $errno, $errstr_v->scalarval()); |
1246 | - } |
|
1247 | - else |
|
1234 | + } else |
|
1248 | 1235 | { |
1249 | 1236 | $r = new XML_RPC_Response($v); |
1250 | 1237 | } |
@@ -1283,7 +1270,9 @@ discard block |
||
1283 | 1270 | $the_parser = (string) $the_parser; |
1284 | 1271 | |
1285 | 1272 | // If invalid nesting, then return |
1286 | - if ($this->xh[$the_parser]['isf'] > 1) return; |
|
1273 | + if ($this->xh[$the_parser]['isf'] > 1) { |
|
1274 | + return; |
|
1275 | + } |
|
1287 | 1276 | |
1288 | 1277 | // Evaluate and check for correct nesting of XML elements |
1289 | 1278 | if (count($this->xh[$the_parser]['stack']) === 0) |
@@ -1383,7 +1372,9 @@ discard block |
||
1383 | 1372 | { |
1384 | 1373 | $the_parser = (string) $the_parser; |
1385 | 1374 | |
1386 | - if ($this->xh[$the_parser]['isf'] > 1) return; |
|
1375 | + if ($this->xh[$the_parser]['isf'] > 1) { |
|
1376 | + return; |
|
1377 | + } |
|
1387 | 1378 | |
1388 | 1379 | // Remove current element from stack and set variable |
1389 | 1380 | // NOTE: If the XML validates, then we do not have to worry about |
@@ -1415,30 +1406,25 @@ discard block |
||
1415 | 1406 | if ($name === 'STRING') |
1416 | 1407 | { |
1417 | 1408 | $this->xh[$the_parser]['value'] = $this->xh[$the_parser]['ac']; |
1418 | - } |
|
1419 | - elseif ($name === 'DATETIME.ISO8601') |
|
1409 | + } elseif ($name === 'DATETIME.ISO8601') |
|
1420 | 1410 | { |
1421 | 1411 | $this->xh[$the_parser]['vt'] = $this->xmlrpcDateTime; |
1422 | 1412 | $this->xh[$the_parser]['value'] = $this->xh[$the_parser]['ac']; |
1423 | - } |
|
1424 | - elseif ($name === 'BASE64') |
|
1413 | + } elseif ($name === 'BASE64') |
|
1425 | 1414 | { |
1426 | 1415 | $this->xh[$the_parser]['value'] = base64_decode($this->xh[$the_parser]['ac']); |
1427 | - } |
|
1428 | - elseif ($name === 'BOOLEAN') |
|
1416 | + } elseif ($name === 'BOOLEAN') |
|
1429 | 1417 | { |
1430 | 1418 | // Translated BOOLEAN values to TRUE AND FALSE |
1431 | 1419 | $this->xh[$the_parser]['value'] = (bool) $this->xh[$the_parser]['ac']; |
1432 | - } |
|
1433 | - elseif ($name=='DOUBLE') |
|
1420 | + } elseif ($name=='DOUBLE') |
|
1434 | 1421 | { |
1435 | 1422 | // we have a DOUBLE |
1436 | 1423 | // we must check that only 0123456789-.<space> are characters here |
1437 | 1424 | $this->xh[$the_parser]['value'] = preg_match('/^[+-]?[eE0-9\t \.]+$/', $this->xh[$the_parser]['ac']) |
1438 | 1425 | ? (float) $this->xh[$the_parser]['ac'] |
1439 | 1426 | : 'ERROR_NON_NUMERIC_FOUND'; |
1440 | - } |
|
1441 | - else |
|
1427 | + } else |
|
1442 | 1428 | { |
1443 | 1429 | // we have an I4/INT |
1444 | 1430 | // we must check that only 0123456789-<space> are characters here |
@@ -1464,8 +1450,7 @@ discard block |
||
1464 | 1450 | { |
1465 | 1451 | // Array |
1466 | 1452 | $this->xh[$the_parser]['valuestack'][0]['values'][] = $temp; |
1467 | - } |
|
1468 | - else |
|
1453 | + } else |
|
1469 | 1454 | { |
1470 | 1455 | // Struct |
1471 | 1456 | $this->xh[$the_parser]['value'] = $temp; |
@@ -1517,7 +1502,10 @@ discard block |
||
1517 | 1502 | { |
1518 | 1503 | $the_parser = (string) $the_parser; |
1519 | 1504 | |
1520 | - if ($this->xh[$the_parser]['isf'] > 1) return; // XML Fault found already |
|
1505 | + if ($this->xh[$the_parser]['isf'] > 1) { |
|
1506 | + return; |
|
1507 | + } |
|
1508 | + // XML Fault found already |
|
1521 | 1509 | |
1522 | 1510 | // If a value has not been found |
1523 | 1511 | if ($this->xh[$the_parser]['lv'] !== 3) |
@@ -1568,8 +1556,7 @@ discard block |
||
1568 | 1556 | if (is_array($array[$key])) |
1569 | 1557 | { |
1570 | 1558 | $array[$key] = $this->output_parameters($array[$key]); |
1571 | - } |
|
1572 | - elseif ($key !== 'bits' && $this->xss_clean) |
|
1559 | + } elseif ($key !== 'bits' && $this->xss_clean) |
|
1573 | 1560 | { |
1574 | 1561 | // 'bits' is for the MetaWeblog API image bits |
1575 | 1562 | // @todo - this needs to be made more general purpose |
@@ -1589,8 +1576,7 @@ discard block |
||
1589 | 1576 | if (is_array($a_param)) |
1590 | 1577 | { |
1591 | 1578 | $parameters[] = $this->output_parameters($a_param); |
1592 | - } |
|
1593 | - else |
|
1579 | + } else |
|
1594 | 1580 | { |
1595 | 1581 | $parameters[] = ($this->xss_clean) ? $CI->security->xss_clean($a_param) : $a_param; |
1596 | 1582 | } |
@@ -1614,8 +1600,7 @@ discard block |
||
1614 | 1600 | if ($kind === 'scalar') |
1615 | 1601 | { |
1616 | 1602 | return $param->scalarval(); |
1617 | - } |
|
1618 | - elseif ($kind === 'array') |
|
1603 | + } elseif ($kind === 'array') |
|
1619 | 1604 | { |
1620 | 1605 | reset($param->me); |
1621 | 1606 | $b = current($param->me); |
@@ -1627,8 +1612,7 @@ discard block |
||
1627 | 1612 | } |
1628 | 1613 | |
1629 | 1614 | return $arr; |
1630 | - } |
|
1631 | - elseif ($kind === 'struct') |
|
1615 | + } elseif ($kind === 'struct') |
|
1632 | 1616 | { |
1633 | 1617 | reset($param->me['struct']); |
1634 | 1618 | $arr = array(); |
@@ -1687,12 +1671,10 @@ discard block |
||
1687 | 1671 | if ($this->xmlrpcTypes[$type] == 1) |
1688 | 1672 | { |
1689 | 1673 | $this->addScalar($val, $type); |
1690 | - } |
|
1691 | - elseif ($this->xmlrpcTypes[$type] == 2) |
|
1674 | + } elseif ($this->xmlrpcTypes[$type] == 2) |
|
1692 | 1675 | { |
1693 | 1676 | $this->addArray($val); |
1694 | - } |
|
1695 | - elseif ($this->xmlrpcTypes[$type] == 3) |
|
1677 | + } elseif ($this->xmlrpcTypes[$type] == 3) |
|
1696 | 1678 | { |
1697 | 1679 | $this->addStruct($val); |
1698 | 1680 | } |
@@ -1735,8 +1717,7 @@ discard block |
||
1735 | 1717 | $ar = $this->me['array']; |
1736 | 1718 | $ar[] = new XML_RPC_Values($val, $type); |
1737 | 1719 | $this->me['array'] = $ar; |
1738 | - } |
|
1739 | - else |
|
1720 | + } else |
|
1740 | 1721 | { |
1741 | 1722 | // a scalar, so set the value and remember we're scalar |
1742 | 1723 | $this->me[$type] = $val; |
@@ -311,6 +311,7 @@ discard block |
||
311 | 311 | * Executes the Method |
312 | 312 | * |
313 | 313 | * @param object |
314 | + * @param XML_RPC_Message $m |
|
314 | 315 | * @return mixed |
315 | 316 | */ |
316 | 317 | protected function _execute($m) |
@@ -419,7 +420,7 @@ discard block |
||
419 | 420 | * Server Function: List Methods |
420 | 421 | * |
421 | 422 | * @param mixed |
422 | - * @return object |
|
423 | + * @return XML_RPC_Response |
|
423 | 424 | */ |
424 | 425 | public function listMethods($m) |
425 | 426 | { |
@@ -446,7 +447,7 @@ discard block |
||
446 | 447 | * Server Function: Return Signature for Method |
447 | 448 | * |
448 | 449 | * @param mixed |
449 | - * @return object |
|
450 | + * @return XML_RPC_Response |
|
450 | 451 | */ |
451 | 452 | public function methodSignature($m) |
452 | 453 | { |
@@ -486,7 +487,7 @@ discard block |
||
486 | 487 | * Server Function: Doc String for Method |
487 | 488 | * |
488 | 489 | * @param mixed |
489 | - * @return object |
|
490 | + * @return XML_RPC_Response |
|
490 | 491 | */ |
491 | 492 | public function methodHelp($m) |
492 | 493 | { |
@@ -552,7 +553,7 @@ discard block |
||
552 | 553 | * Multi-call Function: Error Handling |
553 | 554 | * |
554 | 555 | * @param mixed |
555 | - * @return object |
|
556 | + * @return XML_RPC_Values |
|
556 | 557 | */ |
557 | 558 | public function multicall_error($err) |
558 | 559 | { |
@@ -571,7 +572,7 @@ discard block |
||
571 | 572 | * Multi-call Function: Processes method |
572 | 573 | * |
573 | 574 | * @param mixed |
574 | - * @return object |
|
575 | + * @return XML_RPC_Values |
|
575 | 576 | */ |
576 | 577 | public function do_multicall($call) |
577 | 578 | { |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | * |
80 | 80 | * @var array |
81 | 81 | */ |
82 | - public $system_methods = array(); |
|
82 | + public $system_methods = array(); |
|
83 | 83 | |
84 | 84 | /** |
85 | 85 | * Configuration object |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | |
221 | 221 | if ($data === '') |
222 | 222 | { |
223 | - $CI =& get_instance(); |
|
223 | + $CI = & get_instance(); |
|
224 | 224 | if ($CI->input->method() === 'post') |
225 | 225 | { |
226 | 226 | $data = $CI->input->raw_input_stream; |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | |
344 | 344 | if ($system_call === TRUE) |
345 | 345 | { |
346 | - if ( ! is_callable(array($this,$method_parts[1]))) |
|
346 | + if ( ! is_callable(array($this, $method_parts[1]))) |
|
347 | 347 | { |
348 | 348 | return new XML_RPC_Response(0, $this->xmlrpcerr['unknown_method'], $this->xmlrpcstr['unknown_method']); |
349 | 349 | } |
@@ -366,21 +366,21 @@ discard block |
||
366 | 366 | { |
367 | 367 | $current_sig = $sig[$i]; |
368 | 368 | |
369 | - if (count($current_sig) === count($m->params)+1) |
|
369 | + if (count($current_sig) === count($m->params) + 1) |
|
370 | 370 | { |
371 | 371 | for ($n = 0, $mc = count($m->params); $n < $mc; $n++) |
372 | 372 | { |
373 | 373 | $p = $m->params[$n]; |
374 | 374 | $pt = ($p->kindOf() === 'scalar') ? $p->scalarval() : $p->kindOf(); |
375 | 375 | |
376 | - if ($pt !== $current_sig[$n+1]) |
|
376 | + if ($pt !== $current_sig[$n + 1]) |
|
377 | 377 | { |
378 | - $pno = $n+1; |
|
379 | - $wanted = $current_sig[$n+1]; |
|
378 | + $pno = $n + 1; |
|
379 | + $wanted = $current_sig[$n + 1]; |
|
380 | 380 | |
381 | 381 | return new XML_RPC_Response(0, |
382 | 382 | $this->xmlrpcerr['incorrect_params'], |
383 | - $this->xmlrpcstr['incorrect_params'] . |
|
383 | + $this->xmlrpcstr['incorrect_params']. |
|
384 | 384 | ': Wanted '.$wanted.', got '.$pt.' at param '.$pno.')'); |
385 | 385 | } |
386 | 386 | } |
@@ -466,7 +466,7 @@ discard block |
||
466 | 466 | $inSig = $signature[$i]; |
467 | 467 | for ($j = 0, $jc = count($inSig); $j < $jc; $j++) |
468 | 468 | { |
469 | - $cursig[]= new XML_RPC_Values($inSig[$j], 'string'); |
|
469 | + $cursig[] = new XML_RPC_Values($inSig[$j], 'string'); |
|
470 | 470 | } |
471 | 471 | $sigs[] = new XML_RPC_Values($cursig, 'array'); |
472 | 472 | } |
@@ -263,12 +263,10 @@ discard block |
||
263 | 263 | xml_error_string(xml_get_error_code($parser)), |
264 | 264 | xml_get_current_line_number($parser))); |
265 | 265 | xml_parser_free($parser); |
266 | - } |
|
267 | - elseif ($parser_object->xh[$pname]['isf']) |
|
266 | + } elseif ($parser_object->xh[$pname]['isf']) |
|
268 | 267 | { |
269 | 268 | return new XML_RPC_Response(0, $this->xmlrpcerr['invalid_return'], $this->xmlrpcstr['invalid_return']); |
270 | - } |
|
271 | - else |
|
269 | + } else |
|
272 | 270 | { |
273 | 271 | xml_parser_free($parser); |
274 | 272 | |
@@ -347,8 +345,7 @@ discard block |
||
347 | 345 | { |
348 | 346 | return new XML_RPC_Response(0, $this->xmlrpcerr['unknown_method'], $this->xmlrpcstr['unknown_method']); |
349 | 347 | } |
350 | - } |
|
351 | - elseif (($objectCall && ! is_callable(array($method_parts[0], $method_parts[1]))) |
|
348 | + } elseif (($objectCall && ! is_callable(array($method_parts[0], $method_parts[1]))) |
|
352 | 349 | OR ( ! $objectCall && ! is_callable($this->methods[$methName]['function'])) |
353 | 350 | ) |
354 | 351 | { |
@@ -397,17 +394,14 @@ discard block |
||
397 | 394 | if ($method_parts[0] === 'this' && $system_call === TRUE) |
398 | 395 | { |
399 | 396 | return call_user_func(array($this, $method_parts[1]), $m); |
400 | - } |
|
401 | - elseif ($this->object === FALSE) |
|
397 | + } elseif ($this->object === FALSE) |
|
402 | 398 | { |
403 | 399 | return get_instance()->$method_parts[1]($m); |
404 | - } |
|
405 | - else |
|
400 | + } else |
|
406 | 401 | { |
407 | 402 | return $this->object->$method_parts[1]($m); |
408 | 403 | } |
409 | - } |
|
410 | - else |
|
404 | + } else |
|
411 | 405 | { |
412 | 406 | return call_user_func($this->methods[$methName]['function'], $m); |
413 | 407 | } |
@@ -498,8 +492,7 @@ discard block |
||
498 | 492 | $docstring = isset($this->methods[$method_name]['docstring']) ? $this->methods[$method_name]['docstring'] : ''; |
499 | 493 | |
500 | 494 | return new XML_RPC_Response(new XML_RPC_Values($docstring, 'string')); |
501 | - } |
|
502 | - else |
|
495 | + } else |
|
503 | 496 | { |
504 | 497 | return new XML_RPC_Response(0, $this->xmlrpcerr['introspect_unknown'], $this->xmlrpcstr['introspect_unknown']); |
505 | 498 | } |
@@ -578,8 +571,7 @@ discard block |
||
578 | 571 | if ($call->kindOf() !== 'struct') |
579 | 572 | { |
580 | 573 | return $this->multicall_error('notstruct'); |
581 | - } |
|
582 | - elseif ( ! $methName = $call->me['struct']['methodName']) |
|
574 | + } elseif ( ! $methName = $call->me['struct']['methodName']) |
|
583 | 575 | { |
584 | 576 | return $this->multicall_error('nomethod'); |
585 | 577 | } |
@@ -590,16 +582,13 @@ discard block |
||
590 | 582 | if ($methName->kindOf() !== 'scalar' OR $scalar_type !== 'string') |
591 | 583 | { |
592 | 584 | return $this->multicall_error('notstring'); |
593 | - } |
|
594 | - elseif ($scalar_value === 'system.multicall') |
|
585 | + } elseif ($scalar_value === 'system.multicall') |
|
595 | 586 | { |
596 | 587 | return $this->multicall_error('recursion'); |
597 | - } |
|
598 | - elseif ( ! $params = $call->me['struct']['params']) |
|
588 | + } elseif ( ! $params = $call->me['struct']['params']) |
|
599 | 589 | { |
600 | 590 | return $this->multicall_error('noparams'); |
601 | - } |
|
602 | - elseif ($params->kindOf() !== 'array') |
|
591 | + } elseif ($params->kindOf() !== 'array') |
|
603 | 592 | { |
604 | 593 | return $this->multicall_error('notarray'); |
605 | 594 | } |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | * If this is a newly created file/dir, we will set the time to 'now' |
149 | 149 | * |
150 | 150 | * @param string $dir path to file |
151 | - * @return array filemtime/filemdate |
|
151 | + * @return string filemtime/filemdate |
|
152 | 152 | */ |
153 | 153 | protected function _get_mod_time($dir) |
154 | 154 | { |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | * in the filename it will be placed within a directory. Make |
220 | 220 | * sure you use add_dir() first to create the folder. |
221 | 221 | * |
222 | - * @param mixed $filepath A single filepath or an array of file => data pairs |
|
222 | + * @param string $filepath A single filepath or an array of file => data pairs |
|
223 | 223 | * @param string $data Single file contents |
224 | 224 | * @return void |
225 | 225 | */ |
@@ -194,9 +194,9 @@ discard block |
||
194 | 194 | "\x50\x4b\x01\x02\x00\x00\x0a\x00\x00\x00\x00\x00" |
195 | 195 | .pack('v', $file_mtime) |
196 | 196 | .pack('v', $file_mdate) |
197 | - .pack('V',0) // crc32 |
|
198 | - .pack('V',0) // compressed filesize |
|
199 | - .pack('V',0) // uncompressed filesize |
|
197 | + .pack('V', 0) // crc32 |
|
198 | + .pack('V', 0) // compressed filesize |
|
199 | + .pack('V', 0) // uncompressed filesize |
|
200 | 200 | .pack('v', strlen($dir)) // length of pathname |
201 | 201 | .pack('v', 0) // extra field length |
202 | 202 | .pack('v', 0) // file comment length |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | |
457 | 457 | get_instance()->load->helper('download'); |
458 | 458 | $get_zip = $this->get_zip(); |
459 | - $zip_content =& $get_zip; |
|
459 | + $zip_content = & $get_zip; |
|
460 | 460 | |
461 | 461 | force_download($filename, $zip_content); |
462 | 462 | } |
@@ -232,8 +232,7 @@ discard block |
||
232 | 232 | $file_data = $this->_get_mod_time($path); |
233 | 233 | $this->_add_data($path, $data, $file_data['file_mtime'], $file_data['file_mdate']); |
234 | 234 | } |
235 | - } |
|
236 | - else |
|
235 | + } else |
|
237 | 236 | { |
238 | 237 | $file_data = $this->_get_mod_time($filepath); |
239 | 238 | $this->_add_data($filepath, $data, $file_data['file_mtime'], $file_data['file_mdate']); |
@@ -309,8 +308,7 @@ discard block |
||
309 | 308 | if (is_string($archive_filepath)) |
310 | 309 | { |
311 | 310 | $name = str_replace('\\', '/', $archive_filepath); |
312 | - } |
|
313 | - else |
|
311 | + } else |
|
314 | 312 | { |
315 | 313 | $name = str_replace('\\', '/', $path); |
316 | 314 | |
@@ -365,8 +363,7 @@ discard block |
||
365 | 363 | if (is_dir($path.$file)) |
366 | 364 | { |
367 | 365 | $this->read_dir($path.$file.DIRECTORY_SEPARATOR, $preserve_filepath, $root_path); |
368 | - } |
|
369 | - elseif (FALSE !== ($data = file_get_contents($path.$file))) |
|
366 | + } elseif (FALSE !== ($data = file_get_contents($path.$file))) |
|
370 | 367 | { |
371 | 368 | $name = str_replace(array('\\', '/'), DIRECTORY_SEPARATOR, $path); |
372 | 369 | if ($preserve_filepath === FALSE) |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * @link http://sprintphp.com |
30 | 30 | * @since Version 1.0 |
31 | 31 | */ |
32 | -if (!defined('BASEPATH')) exit('No direct script access allowed'); |
|
32 | +if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
|
33 | 33 | |
34 | 34 | //-------------------------------------------------------------------- |
35 | 35 | // Authentication Type |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | // |
41 | 41 | // Allowed values: 'basic', 'digest' |
42 | 42 | // |
43 | - $config['api.auth_type'] = 'basic'; |
|
43 | + $config['api.auth_type'] = 'basic'; |
|
44 | 44 | |
45 | 45 | //-------------------------------------------------------------------- |
46 | 46 | // Realm |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | // the username of the client. This will typically be either |
59 | 59 | // 'username' or 'email'. |
60 | 60 | // |
61 | - $config['api.auth_field'] = 'email'; |
|
61 | + $config['api.auth_field'] = 'email'; |
|
62 | 62 | |
63 | 63 | //-------------------------------------------------------------------- |
64 | 64 | // IP Blacklists |
@@ -29,7 +29,9 @@ |
||
29 | 29 | * @link http://sprintphp.com |
30 | 30 | * @since Version 1.0 |
31 | 31 | */ |
32 | -if (!defined('BASEPATH')) exit('No direct script access allowed'); |
|
32 | +if (!defined('BASEPATH')) { |
|
33 | + exit('No direct script access allowed'); |
|
34 | +} |
|
33 | 35 | |
34 | 36 | //-------------------------------------------------------------------- |
35 | 37 | // Allowed Environments |