@@ -105,7 +105,7 @@ |
||
| 105 | 105 | * and "_end" respectively). It then compiles the execution times for |
| 106 | 106 | * all points and returns it as an array |
| 107 | 107 | * |
| 108 | - * @return array |
|
| 108 | + * @return string |
|
| 109 | 109 | */ |
| 110 | 110 | protected function _compile_benchmarks() |
| 111 | 111 | { |
@@ -53,12 +53,12 @@ discard block |
||
| 53 | 53 | |
| 54 | 54 | public function __construct($config = array()) |
| 55 | 55 | { |
| 56 | - $this->CI =& get_instance(); |
|
| 56 | + $this->CI = & get_instance(); |
|
| 57 | 57 | $this->CI->load->language('profiler'); |
| 58 | 58 | |
| 59 | 59 | if (isset($config['query_toggle_count'])) |
| 60 | 60 | { |
| 61 | - $this->_query_toggle_count = (int) $config['query_toggle_count']; |
|
| 61 | + $this->_query_toggle_count = (int)$config['query_toggle_count']; |
|
| 62 | 62 | unset($config['query_toggle_count']); |
| 63 | 63 | } |
| 64 | 64 | |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | // Let's determine which databases are currently connected to |
| 161 | 161 | foreach (get_object_vars($this->CI) as $CI_object) |
| 162 | 162 | { |
| 163 | - if (is_object($CI_object) && is_subclass_of(get_class($CI_object), 'CI_DB') ) |
|
| 163 | + if (is_object($CI_object) && is_subclass_of(get_class($CI_object), 'CI_DB')) |
|
| 164 | 164 | { |
| 165 | 165 | $dbs[] = $CI_object; |
| 166 | 166 | } |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | $output .= '<legend style="color:#0000FF;"> '.$this->CI->lang->line('profiler_queries').' </legend>'; |
| 175 | 175 | $output .= "\n"; |
| 176 | 176 | $output .= "\n\n<table style='border:none; width:100%;'>\n"; |
| 177 | - $output .="<tr><td style='width:100%;color:#0000FF;font-weight:normal;background-color:#eee;padding:5px'>".$this->CI->lang->line('profiler_no_db')."</td></tr>\n"; |
|
| 177 | + $output .= "<tr><td style='width:100%;color:#0000FF;font-weight:normal;background-color:#eee;padding:5px'>".$this->CI->lang->line('profiler_no_db')."</td></tr>\n"; |
|
| 178 | 178 | $output .= "</table>\n"; |
| 179 | 179 | $output .= "</fieldset>"; |
| 180 | 180 | |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | // Key words we want bolded |
| 188 | 188 | $highlight = array('SELECT', 'DISTINCT', 'FROM', 'WHERE', 'AND', 'LEFT JOIN', 'ORDER BY', 'GROUP BY', 'LIMIT', 'INSERT', 'INTO', 'VALUES', 'UPDATE', 'OR ', 'HAVING', 'OFFSET', 'NOT IN', 'IN', 'LIKE', 'NOT LIKE', 'COUNT', 'MAX', 'MIN', 'ON', 'AS', 'AVG', 'SUM', '(', ')'); |
| 189 | 189 | |
| 190 | - $output = "\n\n"; |
|
| 190 | + $output = "\n\n"; |
|
| 191 | 191 | |
| 192 | 192 | $count = 0; |
| 193 | 193 | |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | $output .= "<tr><td style='width:50%;color:#000;background-color:#ddd;padding:5px'>$_GET[".$key."] </td><td style='width:50%;padding:5px;color:#cd6e00;font-weight:normal;background-color:#ddd;'>"; |
| 274 | 274 | if (is_array($val)) |
| 275 | 275 | { |
| 276 | - $output .= "<pre>" . htmlspecialchars(stripslashes(print_r($val, true))) . "</pre>"; |
|
| 276 | + $output .= "<pre>".htmlspecialchars(stripslashes(print_r($val, true)))."</pre>"; |
|
| 277 | 277 | } |
| 278 | 278 | else |
| 279 | 279 | { |
@@ -322,7 +322,7 @@ discard block |
||
| 322 | 322 | $output .= "<tr><td style='width:50%;padding:5px;color:#000;background-color:#ddd;'>$_POST[".$key."] </td><td style='width:50%;padding:5px;color:#009900;font-weight:normal;background-color:#ddd;'>"; |
| 323 | 323 | if (is_array($val)) |
| 324 | 324 | { |
| 325 | - $output .= "<pre>" . htmlspecialchars(stripslashes(print_r($val, TRUE))) . "</pre>"; |
|
| 325 | + $output .= "<pre>".htmlspecialchars(stripslashes(print_r($val, TRUE)))."</pre>"; |
|
| 326 | 326 | } |
| 327 | 327 | else |
| 328 | 328 | { |
@@ -439,7 +439,7 @@ discard block |
||
| 439 | 439 | |
| 440 | 440 | $output .= "\n\n<table style='width:100%;display:none' id='ci_profiler_httpheaders_table'>\n"; |
| 441 | 441 | |
| 442 | - foreach (array('HTTP_ACCEPT', 'HTTP_USER_AGENT', 'HTTP_CONNECTION', 'SERVER_PORT', 'SERVER_NAME', 'REMOTE_ADDR', 'SERVER_SOFTWARE', 'HTTP_ACCEPT_LANGUAGE', 'SCRIPT_NAME', 'REQUEST_METHOD',' HTTP_HOST', 'REMOTE_HOST', 'CONTENT_TYPE', 'SERVER_PROTOCOL', 'QUERY_STRING', 'HTTP_ACCEPT_ENCODING', 'HTTP_X_FORWARDED_FOR') as $header) |
|
| 442 | + foreach (array('HTTP_ACCEPT', 'HTTP_USER_AGENT', 'HTTP_CONNECTION', 'SERVER_PORT', 'SERVER_NAME', 'REMOTE_ADDR', 'SERVER_SOFTWARE', 'HTTP_ACCEPT_LANGUAGE', 'SCRIPT_NAME', 'REQUEST_METHOD', ' HTTP_HOST', 'REMOTE_HOST', 'CONTENT_TYPE', 'SERVER_PROTOCOL', 'QUERY_STRING', 'HTTP_ACCEPT_ENCODING', 'HTTP_X_FORWARDED_FOR') as $header) |
|
| 443 | 443 | { |
| 444 | 444 | $val = (isset($_SERVER[$header])) ? $_SERVER[$header] : ''; |
| 445 | 445 | $output .= "<tr><td style='vertical-align: top;width:50%;padding:5px;color:#900;background-color:#ddd;'>".$header." </td><td style='width:50%;padding:5px;color:#000;background-color:#ddd;'>".$val."</td></tr>\n"; |
@@ -1,4 +1,6 @@ discard block |
||
| 1 | -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
|
| 1 | +<?php if ( ! defined('BASEPATH')) { |
|
| 2 | + exit('No direct script access allowed'); |
|
| 3 | +} |
|
| 2 | 4 | /** |
| 3 | 5 | * CodeIgniter |
| 4 | 6 | * |
@@ -213,8 +215,7 @@ discard block |
||
| 213 | 215 | if (count($db->queries) == 0) |
| 214 | 216 | { |
| 215 | 217 | $output .= "<tr><td style='width:100%;color:#0000FF;font-weight:normal;background-color:#eee;padding:5px;'>".$this->CI->lang->line('profiler_no_queries')."</td></tr>\n"; |
| 216 | - } |
|
| 217 | - else |
|
| 218 | + } else |
|
| 218 | 219 | { |
| 219 | 220 | foreach ($db->queries as $key => $val) |
| 220 | 221 | { |
@@ -258,8 +259,7 @@ discard block |
||
| 258 | 259 | if (count($_GET) == 0) |
| 259 | 260 | { |
| 260 | 261 | $output .= "<div style='color:#cd6e00;font-weight:normal;padding:4px 0 4px 0'>".$this->CI->lang->line('profiler_no_get')."</div>"; |
| 261 | - } |
|
| 262 | - else |
|
| 262 | + } else |
|
| 263 | 263 | { |
| 264 | 264 | $output .= "\n\n<table style='width:100%; border:none'>\n"; |
| 265 | 265 | |
@@ -274,8 +274,7 @@ discard block |
||
| 274 | 274 | if (is_array($val)) |
| 275 | 275 | { |
| 276 | 276 | $output .= "<pre>" . htmlspecialchars(stripslashes(print_r($val, true))) . "</pre>"; |
| 277 | - } |
|
| 278 | - else |
|
| 277 | + } else |
|
| 279 | 278 | { |
| 280 | 279 | $output .= htmlspecialchars(stripslashes($val)); |
| 281 | 280 | } |
@@ -307,8 +306,7 @@ discard block |
||
| 307 | 306 | if (count($_POST) == 0) |
| 308 | 307 | { |
| 309 | 308 | $output .= "<div style='color:#009900;font-weight:normal;padding:4px 0 4px 0'>".$this->CI->lang->line('profiler_no_post')."</div>"; |
| 310 | - } |
|
| 311 | - else |
|
| 309 | + } else |
|
| 312 | 310 | { |
| 313 | 311 | $output .= "\n\n<table style='width:100%'>\n"; |
| 314 | 312 | |
@@ -323,8 +321,7 @@ discard block |
||
| 323 | 321 | if (is_array($val)) |
| 324 | 322 | { |
| 325 | 323 | $output .= "<pre>" . htmlspecialchars(stripslashes(print_r($val, TRUE))) . "</pre>"; |
| 326 | - } |
|
| 327 | - else |
|
| 324 | + } else |
|
| 328 | 325 | { |
| 329 | 326 | $output .= htmlspecialchars(stripslashes($val)); |
| 330 | 327 | } |
@@ -356,8 +353,7 @@ discard block |
||
| 356 | 353 | if ($this->CI->uri->uri_string == '') |
| 357 | 354 | { |
| 358 | 355 | $output .= "<div style='color:#000;font-weight:normal;padding:4px 0 4px 0'>".$this->CI->lang->line('profiler_no_uri')."</div>"; |
| 359 | - } |
|
| 360 | - else |
|
| 356 | + } else |
|
| 361 | 357 | { |
| 362 | 358 | $output .= "<div style='color:#000;font-weight:normal;padding:4px 0 4px 0'>".$this->CI->uri->uri_string."</div>"; |
| 363 | 359 | } |
@@ -409,8 +405,7 @@ discard block |
||
| 409 | 405 | if (function_exists('memory_get_usage') && ($usage = memory_get_usage()) != '') |
| 410 | 406 | { |
| 411 | 407 | $output .= "<div style='color:#5a0099;font-weight:normal;padding:4px 0 4px 0'>".number_format($usage).' bytes</div>'; |
| 412 | - } |
|
| 413 | - else |
|
| 408 | + } else |
|
| 414 | 409 | { |
| 415 | 410 | $output .= "<div style='color:#5a0099;font-weight:normal;padding:4px 0 4px 0'>".$this->CI->lang->line('profiler_no_memory')."</div>"; |
| 416 | 411 | } |
@@ -423,6 +423,7 @@ discard block |
||
| 423 | 423 | * |
| 424 | 424 | * @access public |
| 425 | 425 | * @param string |
| 426 | + * @param string $item |
|
| 426 | 427 | * @return string |
| 427 | 428 | */ |
| 428 | 429 | function userdata($item) |
@@ -614,7 +615,7 @@ discard block |
||
| 614 | 615 | * Get the "now" time |
| 615 | 616 | * |
| 616 | 617 | * @access private |
| 617 | - * @return string |
|
| 618 | + * @return integer |
|
| 618 | 619 | */ |
| 619 | 620 | function _get_time() |
| 620 | 621 | { |
@@ -26,24 +26,24 @@ discard block |
||
| 26 | 26 | */ |
| 27 | 27 | class CI_Session { |
| 28 | 28 | |
| 29 | - var $sess_encrypt_cookie = FALSE; |
|
| 30 | - var $sess_use_database = FALSE; |
|
| 29 | + var $sess_encrypt_cookie = FALSE; |
|
| 30 | + var $sess_use_database = FALSE; |
|
| 31 | 31 | var $sess_table_name = ''; |
| 32 | 32 | var $sess_expiration = 7200; |
| 33 | 33 | var $sess_expire_on_close = FALSE; |
| 34 | 34 | var $sess_match_ip = FALSE; |
| 35 | 35 | var $sess_match_useragent = TRUE; |
| 36 | - var $sess_cookie_name = 'ci_session'; |
|
| 36 | + var $sess_cookie_name = 'ci_session'; |
|
| 37 | 37 | var $cookie_prefix = ''; |
| 38 | - var $cookie_path = ''; |
|
| 38 | + var $cookie_path = ''; |
|
| 39 | 39 | var $cookie_domain = ''; |
| 40 | 40 | var $cookie_secure = FALSE; |
| 41 | - var $sess_time_to_update = 300; |
|
| 41 | + var $sess_time_to_update = 300; |
|
| 42 | 42 | var $encryption_key = ''; |
| 43 | 43 | var $flashdata_key = 'flash'; |
| 44 | 44 | var $time_reference = 'time'; |
| 45 | 45 | var $gc_probability = 5; |
| 46 | - var $userdata = array(); |
|
| 46 | + var $userdata = array(); |
|
| 47 | 47 | var $CI; |
| 48 | 48 | var $now; |
| 49 | 49 | |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | log_message('debug', "Session Class Initialized"); |
| 59 | 59 | |
| 60 | 60 | // Set the super object to a local variable for use throughout the class |
| 61 | - $this->CI =& get_instance(); |
|
| 61 | + $this->CI = & get_instance(); |
|
| 62 | 62 | |
| 63 | 63 | // Set all the session preferences, which can either be set |
| 64 | 64 | // manually via the $params array above or via the config file |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | // set to zero we'll set the expiration two years from now. |
| 96 | 96 | if ($this->sess_expiration == 0) |
| 97 | 97 | { |
| 98 | - $this->sess_expiration = (60*60*24*365*2); |
|
| 98 | + $this->sess_expiration = (60 * 60 * 24 * 365 * 2); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | // Set the cookie name |
@@ -152,11 +152,11 @@ discard block |
||
| 152 | 152 | else |
| 153 | 153 | { |
| 154 | 154 | // encryption was not used, so we need to check the md5 hash |
| 155 | - $hash = substr($session, strlen($session)-32); // get last 32 chars |
|
| 156 | - $session = substr($session, 0, strlen($session)-32); |
|
| 155 | + $hash = substr($session, strlen($session) - 32); // get last 32 chars |
|
| 156 | + $session = substr($session, 0, strlen($session) - 32); |
|
| 157 | 157 | |
| 158 | 158 | // Does the md5 hash match? This is to prevent manipulation of session data in userspace |
| 159 | - if ($hash !== md5($session.$this->encryption_key)) |
|
| 159 | + if ($hash !== md5($session.$this->encryption_key)) |
|
| 160 | 160 | { |
| 161 | 161 | log_message('error', 'The session cookie data did not match what was expected. This could be a possible hacking attempt.'); |
| 162 | 162 | $this->sess_destroy(); |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | // Before continuing, we need to determine if there is any custom data to deal with. |
| 267 | 267 | // Let's determine this by removing the default indexes to see if there's anything left in the array |
| 268 | 268 | // and set the session data while we're at it |
| 269 | - foreach (array('session_id','ip_address','user_agent','last_activity') as $val) |
|
| 269 | + foreach (array('session_id', 'ip_address', 'user_agent', 'last_activity') as $val) |
|
| 270 | 270 | { |
| 271 | 271 | unset($custom_userdata[$val]); |
| 272 | 272 | $cookie_userdata[$val] = $this->userdata[$val]; |
@@ -376,7 +376,7 @@ discard block |
||
| 376 | 376 | { |
| 377 | 377 | // set cookie explicitly to only have our session data |
| 378 | 378 | $cookie_data = array(); |
| 379 | - foreach (array('session_id','ip_address','user_agent','last_activity') as $val) |
|
| 379 | + foreach (array('session_id', 'ip_address', 'user_agent', 'last_activity') as $val) |
|
| 380 | 380 | { |
| 381 | 381 | $cookie_data[$val] = $this->userdata[$val]; |
| 382 | 382 | } |
@@ -1,4 +1,6 @@ discard block |
||
| 1 | -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
|
| 1 | +<?php if ( ! defined('BASEPATH')) { |
|
| 2 | + exit('No direct script access allowed'); |
|
| 3 | +} |
|
| 2 | 4 | /** |
| 3 | 5 | * CodeIgniter |
| 4 | 6 | * |
@@ -106,8 +108,7 @@ discard block |
||
| 106 | 108 | if ( ! $this->sess_read()) |
| 107 | 109 | { |
| 108 | 110 | $this->sess_create(); |
| 109 | - } |
|
| 110 | - else |
|
| 111 | + } else |
|
| 111 | 112 | { |
| 112 | 113 | $this->sess_update(); |
| 113 | 114 | } |
@@ -148,8 +149,7 @@ discard block |
||
| 148 | 149 | if ($this->sess_encrypt_cookie == TRUE) |
| 149 | 150 | { |
| 150 | 151 | $session = $this->CI->encrypt->decode($session); |
| 151 | - } |
|
| 152 | - else |
|
| 152 | + } else |
|
| 153 | 153 | { |
| 154 | 154 | // encryption was not used, so we need to check the md5 hash |
| 155 | 155 | $hash = substr($session, strlen($session)-32); // get last 32 chars |
@@ -277,8 +277,7 @@ discard block |
||
| 277 | 277 | if (count($custom_userdata) === 0) |
| 278 | 278 | { |
| 279 | 279 | $custom_userdata = ''; |
| 280 | - } |
|
| 281 | - else |
|
| 280 | + } else |
|
| 282 | 281 | { |
| 283 | 282 | // Serialize the custom data array so we can store it |
| 284 | 283 | $custom_userdata = $this->_serialize($custom_userdata); |
@@ -622,8 +621,7 @@ discard block |
||
| 622 | 621 | { |
| 623 | 622 | $now = time(); |
| 624 | 623 | $time = mktime(gmdate("H", $now), gmdate("i", $now), gmdate("s", $now), gmdate("m", $now), gmdate("d", $now), gmdate("Y", $now)); |
| 625 | - } |
|
| 626 | - else |
|
| 624 | + } else |
|
| 627 | 625 | { |
| 628 | 626 | $time = time(); |
| 629 | 627 | } |
@@ -652,8 +650,7 @@ discard block |
||
| 652 | 650 | if ($this->sess_encrypt_cookie == TRUE) |
| 653 | 651 | { |
| 654 | 652 | $cookie_data = $this->CI->encrypt->encode($cookie_data); |
| 655 | - } |
|
| 656 | - else |
|
| 653 | + } else |
|
| 657 | 654 | { |
| 658 | 655 | // if encryption is not used, we provide an md5 hash to prevent userside tampering |
| 659 | 656 | $cookie_data = $cookie_data.md5($cookie_data.$this->encryption_key); |
@@ -695,8 +692,7 @@ discard block |
||
| 695 | 692 | $data[$key] = str_replace('\\', '{{slash}}', $val); |
| 696 | 693 | } |
| 697 | 694 | } |
| 698 | - } |
|
| 699 | - else |
|
| 695 | + } else |
|
| 700 | 696 | { |
| 701 | 697 | if (is_string($data)) |
| 702 | 698 | { |
@@ -146,6 +146,7 @@ discard block |
||
| 146 | 146 | * |
| 147 | 147 | * @access private |
| 148 | 148 | * @return string |
| 149 | + * @param integer $t |
|
| 149 | 150 | */ |
| 150 | 151 | function _ft($t, $b, $c, $d) |
| 151 | 152 | { |
@@ -165,7 +166,8 @@ discard block |
||
| 165 | 166 | * Determine the additive constant |
| 166 | 167 | * |
| 167 | 168 | * @access private |
| 168 | - * @return string |
|
| 169 | + * @return integer |
|
| 170 | + * @param integer $t |
|
| 169 | 171 | */ |
| 170 | 172 | function _kt($t) |
| 171 | 173 | { |
@@ -210,6 +212,7 @@ discard block |
||
| 210 | 212 | * |
| 211 | 213 | * @access private |
| 212 | 214 | * @return integer |
| 215 | + * @param integer $cnt |
|
| 213 | 216 | */ |
| 214 | 217 | function _rol($num, $cnt) |
| 215 | 218 | { |
@@ -74,10 +74,10 @@ discard block |
||
| 74 | 74 | |
| 75 | 75 | $x[$n * 16 - 1] = strlen($str) * 8; |
| 76 | 76 | |
| 77 | - $a = 1732584193; |
|
| 77 | + $a = 1732584193; |
|
| 78 | 78 | $b = -271733879; |
| 79 | 79 | $c = -1732584194; |
| 80 | - $d = 271733878; |
|
| 80 | + $d = 271733878; |
|
| 81 | 81 | $e = -1009589776; |
| 82 | 82 | |
| 83 | 83 | for ($i = 0; $i < count($x); $i += 16) |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | $bin = substr($bin, 0, strlen($bin) - $b); |
| 238 | 238 | } |
| 239 | 239 | |
| 240 | - for ($i=0; $i < $b; $i++) |
|
| 240 | + for ($i = 0; $i < $b; $i++) |
|
| 241 | 241 | { |
| 242 | 242 | $bin = "0".$bin; |
| 243 | 243 | } |
@@ -1,4 +1,6 @@ discard block |
||
| 1 | -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
|
| 1 | +<?php if ( ! defined('BASEPATH')) { |
|
| 2 | + exit('No direct script access allowed'); |
|
| 3 | +} |
|
| 2 | 4 | /** |
| 3 | 5 | * CodeIgniter |
| 4 | 6 | * |
@@ -93,8 +95,7 @@ discard block |
||
| 93 | 95 | if ($j < 16) |
| 94 | 96 | { |
| 95 | 97 | $w[$j] = $x[$i + $j]; |
| 96 | - } |
|
| 97 | - else |
|
| 98 | + } else |
|
| 98 | 99 | { |
| 99 | 100 | $w[$j] = $this->_rol($w[$j - 3] ^ $w[$j - 8] ^ $w[$j - 14] ^ $w[$j - 16], 1); |
| 100 | 101 | } |
@@ -149,12 +150,15 @@ discard block |
||
| 149 | 150 | */ |
| 150 | 151 | function _ft($t, $b, $c, $d) |
| 151 | 152 | { |
| 152 | - if ($t < 20) |
|
| 153 | - return ($b & $c) | ((~$b) & $d); |
|
| 154 | - if ($t < 40) |
|
| 155 | - return $b ^ $c ^ $d; |
|
| 156 | - if ($t < 60) |
|
| 157 | - return ($b & $c) | ($b & $d) | ($c & $d); |
|
| 153 | + if ($t < 20) { |
|
| 154 | + return ($b & $c) | ((~$b) & $d); |
|
| 155 | + } |
|
| 156 | + if ($t < 40) { |
|
| 157 | + return $b ^ $c ^ $d; |
|
| 158 | + } |
|
| 159 | + if ($t < 60) { |
|
| 160 | + return ($b & $c) | ($b & $d) | ($c & $d); |
|
| 161 | + } |
|
| 158 | 162 | |
| 159 | 163 | return $b ^ $c ^ $d; |
| 160 | 164 | } |
@@ -172,16 +176,13 @@ discard block |
||
| 172 | 176 | if ($t < 20) |
| 173 | 177 | { |
| 174 | 178 | return 1518500249; |
| 175 | - } |
|
| 176 | - else if ($t < 40) |
|
| 179 | + } else if ($t < 40) |
|
| 177 | 180 | { |
| 178 | 181 | return 1859775393; |
| 179 | - } |
|
| 180 | - else if ($t < 60) |
|
| 182 | + } else if ($t < 60) |
|
| 181 | 183 | { |
| 182 | 184 | return -1894007588; |
| 183 | - } |
|
| 184 | - else |
|
| 185 | + } else |
|
| 185 | 186 | { |
| 186 | 187 | return -899497514; |
| 187 | 188 | } |
@@ -231,8 +232,7 @@ discard block |
||
| 231 | 232 | if (strlen($bin) < $b) |
| 232 | 233 | { |
| 233 | 234 | $bin = 0; |
| 234 | - } |
|
| 235 | - else |
|
| 235 | + } else |
|
| 236 | 236 | { |
| 237 | 237 | $bin = substr($bin, 0, strlen($bin) - $b); |
| 238 | 238 | } |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | * |
| 50 | 50 | * @access public |
| 51 | 51 | * @param array |
| 52 | - * @return void |
|
| 52 | + * @return false|null |
|
| 53 | 53 | */ |
| 54 | 54 | function set_template($template) |
| 55 | 55 | { |
@@ -395,7 +395,7 @@ discard block |
||
| 395 | 395 | * |
| 396 | 396 | * @access public |
| 397 | 397 | * @param object |
| 398 | - * @return void |
|
| 398 | + * @return false|null |
|
| 399 | 399 | */ |
| 400 | 400 | function _set_from_object($query) |
| 401 | 401 | { |
@@ -433,7 +433,7 @@ discard block |
||
| 433 | 433 | * |
| 434 | 434 | * @access public |
| 435 | 435 | * @param array |
| 436 | - * @return void |
|
| 436 | + * @return false|null |
|
| 437 | 437 | */ |
| 438 | 438 | function _set_from_array($data, $set_heading = TRUE) |
| 439 | 439 | { |
@@ -28,13 +28,13 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | class CI_Table { |
| 30 | 30 | |
| 31 | - var $rows = array(); |
|
| 31 | + var $rows = array(); |
|
| 32 | 32 | var $heading = array(); |
| 33 | - var $auto_heading = TRUE; |
|
| 33 | + var $auto_heading = TRUE; |
|
| 34 | 34 | var $caption = NULL; |
| 35 | 35 | var $template = NULL; |
| 36 | 36 | var $newline = "\n"; |
| 37 | - var $empty_cells = ""; |
|
| 37 | + var $empty_cells = ""; |
|
| 38 | 38 | var $function = FALSE; |
| 39 | 39 | |
| 40 | 40 | public function __construct() |
@@ -268,7 +268,7 @@ discard block |
||
| 268 | 268 | if ($this->caption) |
| 269 | 269 | { |
| 270 | 270 | $out .= $this->newline; |
| 271 | - $out .= '<caption>' . $this->caption . '</caption>'; |
|
| 271 | + $out .= '<caption>'.$this->caption.'</caption>'; |
|
| 272 | 272 | $out .= $this->newline; |
| 273 | 273 | } |
| 274 | 274 | |
@@ -383,9 +383,9 @@ discard block |
||
| 383 | 383 | */ |
| 384 | 384 | function clear() |
| 385 | 385 | { |
| 386 | - $this->rows = array(); |
|
| 387 | - $this->heading = array(); |
|
| 388 | - $this->auto_heading = TRUE; |
|
| 386 | + $this->rows = array(); |
|
| 387 | + $this->heading = array(); |
|
| 388 | + $this->auto_heading = TRUE; |
|
| 389 | 389 | } |
| 390 | 390 | |
| 391 | 391 | // -------------------------------------------------------------------- |
@@ -495,7 +495,7 @@ discard block |
||
| 495 | 495 | */ |
| 496 | 496 | function _default_template() |
| 497 | 497 | { |
| 498 | - return array ( |
|
| 498 | + return array( |
|
| 499 | 499 | 'table_open' => '<table border="0" cellpadding="4" cellspacing="0">', |
| 500 | 500 | |
| 501 | 501 | 'thead_open' => '<thead>', |
@@ -1,4 +1,6 @@ discard block |
||
| 1 | -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
|
| 1 | +<?php if ( ! defined('BASEPATH')) { |
|
| 2 | + exit('No direct script access allowed'); |
|
| 3 | +} |
|
| 2 | 4 | /** |
| 3 | 5 | * CodeIgniter |
| 4 | 6 | * |
@@ -185,15 +187,13 @@ discard block |
||
| 185 | 187 | if (is_array($val) && isset($val['data'])) |
| 186 | 188 | { |
| 187 | 189 | $args[$key] = $val; |
| 188 | - } |
|
| 189 | - else |
|
| 190 | + } else |
|
| 190 | 191 | { |
| 191 | 192 | $args[$key] = array('data' => $val); |
| 192 | 193 | } |
| 193 | 194 | } |
| 194 | 195 | } |
| 195 | - } |
|
| 196 | - else |
|
| 196 | + } else |
|
| 197 | 197 | { |
| 198 | 198 | foreach ($args as $key => $val) |
| 199 | 199 | { |
@@ -239,8 +239,7 @@ discard block |
||
| 239 | 239 | if (is_object($table_data)) |
| 240 | 240 | { |
| 241 | 241 | $this->_set_from_object($table_data); |
| 242 | - } |
|
| 243 | - elseif (is_array($table_data)) |
|
| 242 | + } elseif (is_array($table_data)) |
|
| 244 | 243 | { |
| 245 | 244 | $set_heading = (count($this->heading) == 0 AND $this->auto_heading == FALSE) ? FALSE : TRUE; |
| 246 | 245 | $this->_set_from_array($table_data, $set_heading); |
@@ -341,14 +340,12 @@ discard block |
||
| 341 | 340 | if ($cell === "" OR $cell === NULL) |
| 342 | 341 | { |
| 343 | 342 | $out .= $this->empty_cells; |
| 344 | - } |
|
| 345 | - else |
|
| 343 | + } else |
|
| 346 | 344 | { |
| 347 | 345 | if ($function !== FALSE && is_callable($function)) |
| 348 | 346 | { |
| 349 | 347 | $out .= call_user_func($function, $cell); |
| 350 | - } |
|
| 351 | - else |
|
| 348 | + } else |
|
| 352 | 349 | { |
| 353 | 350 | $out .= $cell; |
| 354 | 351 | } |
@@ -449,8 +446,7 @@ discard block |
||
| 449 | 446 | if ($i == 0 AND count($data) > 1 AND count($this->heading) == 0 AND $set_heading == TRUE) |
| 450 | 447 | { |
| 451 | 448 | $this->heading = $this->_prep_args($row); |
| 452 | - } |
|
| 453 | - else |
|
| 449 | + } else |
|
| 454 | 450 | { |
| 455 | 451 | $this->rows[] = $this->_prep_args($row); |
| 456 | 452 | } |
@@ -226,6 +226,7 @@ discard block |
||
| 226 | 226 | * @access public |
| 227 | 227 | * @param string |
| 228 | 228 | * @param string |
| 229 | + * @param string $data |
|
| 229 | 230 | * @return bool |
| 230 | 231 | */ |
| 231 | 232 | function process($url, $data) |
@@ -399,6 +400,7 @@ discard block |
||
| 399 | 400 | * |
| 400 | 401 | * @access public |
| 401 | 402 | * @param string |
| 403 | + * @param string $str |
|
| 402 | 404 | * @return string |
| 403 | 405 | */ |
| 404 | 406 | function convert_xml($str) |
@@ -512,6 +514,7 @@ discard block |
||
| 512 | 514 | * |
| 513 | 515 | * @access public |
| 514 | 516 | * @param string |
| 517 | + * @param string $msg |
|
| 515 | 518 | * @return void |
| 516 | 519 | */ |
| 517 | 520 | function set_error($msg) |
@@ -28,12 +28,12 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | class CI_Trackback { |
| 30 | 30 | |
| 31 | - var $time_format = 'local'; |
|
| 32 | - var $charset = 'UTF-8'; |
|
| 33 | - var $data = array('url' => '', 'title' => '', 'excerpt' => '', 'blog_name' => '', 'charset' => ''); |
|
| 34 | - var $convert_ascii = TRUE; |
|
| 35 | - var $response = ''; |
|
| 36 | - var $error_msg = array(); |
|
| 31 | + var $time_format = 'local'; |
|
| 32 | + var $charset = 'UTF-8'; |
|
| 33 | + var $data = array('url' => '', 'title' => '', 'excerpt' => '', 'blog_name' => '', 'charset' => ''); |
|
| 34 | + var $convert_ascii = TRUE; |
|
| 35 | + var $response = ''; |
|
| 36 | + var $error_msg = array(); |
|
| 37 | 37 | |
| 38 | 38 | /** |
| 39 | 39 | * Constructor |
@@ -251,12 +251,12 @@ discard block |
||
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | // Transfer the data |
| 254 | - fputs ($fp, "POST " . $path . " HTTP/1.0\r\n" ); |
|
| 255 | - fputs ($fp, "Host: " . $target['host'] . "\r\n" ); |
|
| 256 | - fputs ($fp, "Content-type: application/x-www-form-urlencoded\r\n" ); |
|
| 257 | - fputs ($fp, "Content-length: " . strlen($data) . "\r\n" ); |
|
| 258 | - fputs ($fp, "Connection: close\r\n\r\n" ); |
|
| 259 | - fputs ($fp, $data); |
|
| 254 | + fputs($fp, "POST ".$path." HTTP/1.0\r\n"); |
|
| 255 | + fputs($fp, "Host: ".$target['host']."\r\n"); |
|
| 256 | + fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n"); |
|
| 257 | + fputs($fp, "Content-length: ".strlen($data)."\r\n"); |
|
| 258 | + fputs($fp, "Connection: close\r\n\r\n"); |
|
| 259 | + fputs($fp, $data); |
|
| 260 | 260 | |
| 261 | 261 | // Was it successful? |
| 262 | 262 | $this->response = ""; |
@@ -359,30 +359,30 @@ discard block |
||
| 359 | 359 | if (strpos($url, '?') !== FALSE) |
| 360 | 360 | { |
| 361 | 361 | $tb_array = explode('/', $url); |
| 362 | - $tb_end = $tb_array[count($tb_array)-1]; |
|
| 362 | + $tb_end = $tb_array[count($tb_array) - 1]; |
|
| 363 | 363 | |
| 364 | 364 | if ( ! is_numeric($tb_end)) |
| 365 | 365 | { |
| 366 | - $tb_end = $tb_array[count($tb_array)-2]; |
|
| 366 | + $tb_end = $tb_array[count($tb_array) - 2]; |
|
| 367 | 367 | } |
| 368 | 368 | |
| 369 | 369 | $tb_array = explode('=', $tb_end); |
| 370 | - $tb_id = $tb_array[count($tb_array)-1]; |
|
| 370 | + $tb_id = $tb_array[count($tb_array) - 1]; |
|
| 371 | 371 | } |
| 372 | 372 | else |
| 373 | 373 | { |
| 374 | 374 | $url = rtrim($url, '/'); |
| 375 | 375 | |
| 376 | 376 | $tb_array = explode('/', $url); |
| 377 | - $tb_id = $tb_array[count($tb_array)-1]; |
|
| 377 | + $tb_id = $tb_array[count($tb_array) - 1]; |
|
| 378 | 378 | |
| 379 | 379 | if ( ! is_numeric($tb_id)) |
| 380 | 380 | { |
| 381 | - $tb_id = $tb_array[count($tb_array)-2]; |
|
| 381 | + $tb_id = $tb_array[count($tb_array) - 2]; |
|
| 382 | 382 | } |
| 383 | 383 | } |
| 384 | 384 | |
| 385 | - if ( ! preg_match ("/^([0-9]+)$/", $tb_id)) |
|
| 385 | + if ( ! preg_match("/^([0-9]+)$/", $tb_id)) |
|
| 386 | 386 | { |
| 387 | 387 | return FALSE; |
| 388 | 388 | } |
@@ -406,14 +406,14 @@ discard block |
||
| 406 | 406 | $temp = '__TEMP_AMPERSANDS__'; |
| 407 | 407 | |
| 408 | 408 | $str = preg_replace("/&#(\d+);/", "$temp\\1;", $str); |
| 409 | - $str = preg_replace("/&(\w+);/", "$temp\\1;", $str); |
|
| 409 | + $str = preg_replace("/&(\w+);/", "$temp\\1;", $str); |
|
| 410 | 410 | |
| 411 | - $str = str_replace(array("&","<",">","\"", "'", "-"), |
|
| 411 | + $str = str_replace(array("&", "<", ">", "\"", "'", "-"), |
|
| 412 | 412 | array("&", "<", ">", """, "'", "-"), |
| 413 | 413 | $str); |
| 414 | 414 | |
| 415 | - $str = preg_replace("/$temp(\d+);/","&#\\1;",$str); |
|
| 416 | - $str = preg_replace("/$temp(\w+);/","&\\1;", $str); |
|
| 415 | + $str = preg_replace("/$temp(\d+);/", "&#\\1;", $str); |
|
| 416 | + $str = preg_replace("/$temp(\w+);/", "&\\1;", $str); |
|
| 417 | 417 | |
| 418 | 418 | return $str; |
| 419 | 419 | } |
@@ -470,9 +470,9 @@ discard block |
||
| 470 | 470 | */ |
| 471 | 471 | function convert_ascii($str) |
| 472 | 472 | { |
| 473 | - $count = 1; |
|
| 474 | - $out = ''; |
|
| 475 | - $temp = array(); |
|
| 473 | + $count = 1; |
|
| 474 | + $out = ''; |
|
| 475 | + $temp = array(); |
|
| 476 | 476 | |
| 477 | 477 | for ($i = 0, $s = strlen($str); $i < $s; $i++) |
| 478 | 478 | { |
@@ -1,4 +1,6 @@ discard block |
||
| 1 | -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
|
| 1 | +<?php if ( ! defined('BASEPATH')) { |
|
| 2 | + exit('No direct script access allowed'); |
|
| 3 | +} |
|
| 2 | 4 | /** |
| 3 | 5 | * CodeIgniter |
| 4 | 6 | * |
@@ -89,12 +91,10 @@ discard block |
||
| 89 | 91 | if ($item == 'excerpt') |
| 90 | 92 | { |
| 91 | 93 | $$item = $this->convert_ascii($$item); |
| 92 | - } |
|
| 93 | - elseif ($item == 'title') |
|
| 94 | + } elseif ($item == 'title') |
|
| 94 | 95 | { |
| 95 | 96 | $$item = $this->convert_ascii($$item); |
| 96 | - } |
|
| 97 | - elseif ($item == 'blog_name') |
|
| 97 | + } elseif ($item == 'blog_name') |
|
| 98 | 98 | { |
| 99 | 99 | $$item = $this->convert_ascii($$item); |
| 100 | 100 | } |
@@ -368,8 +368,7 @@ discard block |
||
| 368 | 368 | |
| 369 | 369 | $tb_array = explode('=', $tb_end); |
| 370 | 370 | $tb_id = $tb_array[count($tb_array)-1]; |
| 371 | - } |
|
| 372 | - else |
|
| 371 | + } else |
|
| 373 | 372 | { |
| 374 | 373 | $url = rtrim($url, '/'); |
| 375 | 374 | |
@@ -385,8 +384,7 @@ discard block |
||
| 385 | 384 | if ( ! preg_match ("/^([0-9]+)$/", $tb_id)) |
| 386 | 385 | { |
| 387 | 386 | return FALSE; |
| 388 | - } |
|
| 389 | - else |
|
| 387 | + } else |
|
| 390 | 388 | { |
| 391 | 389 | return $tb_id; |
| 392 | 390 | } |
@@ -481,8 +479,7 @@ discard block |
||
| 481 | 479 | if ($ordinal < 128) |
| 482 | 480 | { |
| 483 | 481 | $out .= $str[$i]; |
| 484 | - } |
|
| 485 | - else |
|
| 482 | + } else |
|
| 486 | 483 | { |
| 487 | 484 | if (count($temp) == 0) |
| 488 | 485 | { |
@@ -251,6 +251,7 @@ |
||
| 251 | 251 | * |
| 252 | 252 | * @access public |
| 253 | 253 | * @param string |
| 254 | + * @param string $str |
|
| 254 | 255 | * @return string |
| 255 | 256 | */ |
| 256 | 257 | function format_characters($str) |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | var $block_elements = 'address|blockquote|div|dl|fieldset|form|h\d|hr|noscript|object|ol|p|pre|script|table|ul'; |
| 31 | 31 | |
| 32 | 32 | // Elements that should not have <p> and <br /> tags within them. |
| 33 | - var $skip_elements = 'p|pre|ol|ul|dl|object|table|h\d'; |
|
| 33 | + var $skip_elements = 'p|pre|ol|ul|dl|object|table|h\d'; |
|
| 34 | 34 | |
| 35 | 35 | // Tags we want the parser to completely ignore when splitting the string. |
| 36 | 36 | var $inline_elements = 'a|abbr|acronym|b|bdo|big|br|button|cite|code|del|dfn|em|i|img|ins|input|label|map|kbd|q|samp|select|small|span|strong|sub|sup|textarea|tt|var'; |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | // [2] = <closing tag> |
| 125 | 125 | // Etc... |
| 126 | 126 | // } |
| 127 | - $chunks = preg_split('/(<(?:[^<>]+(?:"[^"]*"|\'[^\']*\')?)+>)/', $str, -1, PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY); |
|
| 127 | + $chunks = preg_split('/(<(?:[^<>]+(?:"[^"]*"|\'[^\']*\')?)+>)/', $str, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); |
|
| 128 | 128 | |
| 129 | 129 | // Build our finalized string. We cycle through the array, skipping tags, and processing the contained text |
| 130 | 130 | $str = ''; |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | { |
| 144 | 144 | if (preg_match("#".$this->skip_elements."#", $match[2])) |
| 145 | 145 | { |
| 146 | - $process = ($match[1] == '/') ? TRUE : FALSE; |
|
| 146 | + $process = ($match[1] == '/') ? TRUE : FALSE; |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | if ($match[1] == '') |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | return $str; |
| 325 | 325 | } |
| 326 | 326 | |
| 327 | - if (strpos($str, "\n") === FALSE && ! in_array($this->last_block_element, $this->inner_block_required)) |
|
| 327 | + if (strpos($str, "\n") === FALSE && ! in_array($this->last_block_element, $this->inner_block_required)) |
|
| 328 | 328 | { |
| 329 | 329 | return $str; |
| 330 | 330 | } |
@@ -341,7 +341,7 @@ discard block |
||
| 341 | 341 | // We trim off the right-side new line so that the closing </p> tag |
| 342 | 342 | // will be positioned immediately following the string, matching |
| 343 | 343 | // the behavior of the opening <p> tag |
| 344 | - $str = '<p>'.rtrim($str).'</p>'; |
|
| 344 | + $str = '<p>'.rtrim($str).'</p>'; |
|
| 345 | 345 | } |
| 346 | 346 | |
| 347 | 347 | // Remove empty paragraphs if they are on the first line, as this |
@@ -367,7 +367,7 @@ discard block |
||
| 367 | 367 | */ |
| 368 | 368 | function _protect_characters($match) |
| 369 | 369 | { |
| 370 | - return str_replace(array("'",'"','--',' '), array('{@SQ}', '{@DQ}', '{@DD}', '{@NBS}'), $match[0]); |
|
| 370 | + return str_replace(array("'", '"', '--', ' '), array('{@SQ}', '{@DQ}', '{@DD}', '{@NBS}'), $match[0]); |
|
| 371 | 371 | } |
| 372 | 372 | |
| 373 | 373 | // -------------------------------------------------------------------- |
@@ -381,7 +381,7 @@ discard block |
||
| 381 | 381 | */ |
| 382 | 382 | function nl2br_except_pre($str) |
| 383 | 383 | { |
| 384 | - $ex = explode("pre>",$str); |
|
| 384 | + $ex = explode("pre>", $str); |
|
| 385 | 385 | $ct = count($ex); |
| 386 | 386 | |
| 387 | 387 | $newstr = ""; |
@@ -1,4 +1,6 @@ discard block |
||
| 1 | -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
|
| 1 | +<?php if ( ! defined('BASEPATH')) { |
|
| 2 | + exit('No direct script access allowed'); |
|
| 3 | +} |
|
| 2 | 4 | /** |
| 3 | 5 | * CodeIgniter |
| 4 | 6 | * |
@@ -228,8 +230,7 @@ discard block |
||
| 228 | 230 | if ($reduce_linebreaks === TRUE) |
| 229 | 231 | { |
| 230 | 232 | $table['#<p>\n*</p>#'] = ''; |
| 231 | - } |
|
| 232 | - else |
|
| 233 | + } else |
|
| 233 | 234 | { |
| 234 | 235 | // If we have empty paragraph tags we add a non-breaking space |
| 235 | 236 | // otherwise most browsers won't treat them as true paragraphs |
@@ -390,14 +391,14 @@ discard block |
||
| 390 | 391 | if (($i % 2) == 0) |
| 391 | 392 | { |
| 392 | 393 | $newstr .= nl2br($ex[$i]); |
| 393 | - } |
|
| 394 | - else |
|
| 394 | + } else |
|
| 395 | 395 | { |
| 396 | 396 | $newstr .= $ex[$i]; |
| 397 | 397 | } |
| 398 | 398 | |
| 399 | - if ($ct - 1 != $i) |
|
| 400 | - $newstr .= "pre>"; |
|
| 399 | + if ($ct - 1 != $i) { |
|
| 400 | + $newstr .= "pre>"; |
|
| 401 | + } |
|
| 401 | 402 | } |
| 402 | 403 | |
| 403 | 404 | return $newstr; |
@@ -385,6 +385,8 @@ discard block |
||
| 385 | 385 | * |
| 386 | 386 | * @param string |
| 387 | 387 | * @param string |
| 388 | + * @param string $path |
|
| 389 | + * @param string $filename |
|
| 388 | 390 | * @return string |
| 389 | 391 | */ |
| 390 | 392 | public function set_filename($path, $filename) |
@@ -732,6 +734,7 @@ discard block |
||
| 732 | 734 | * Extract the file extension |
| 733 | 735 | * |
| 734 | 736 | * @param string |
| 737 | + * @param string $filename |
|
| 735 | 738 | * @return string |
| 736 | 739 | */ |
| 737 | 740 | public function get_extension($filename) |
@@ -746,6 +749,7 @@ discard block |
||
| 746 | 749 | * Clean the file name for security |
| 747 | 750 | * |
| 748 | 751 | * @param string |
| 752 | + * @param string $filename |
|
| 749 | 753 | * @return string |
| 750 | 754 | */ |
| 751 | 755 | public function clean_file_name($filename) |
@@ -790,6 +794,8 @@ discard block |
||
| 790 | 794 | * Limit the File Name Length |
| 791 | 795 | * |
| 792 | 796 | * @param string |
| 797 | + * @param string $filename |
|
| 798 | + * @param integer $length |
|
| 793 | 799 | * @return string |
| 794 | 800 | */ |
| 795 | 801 | public function limit_filename_length($filename, $length) |
@@ -885,6 +891,7 @@ discard block |
||
| 885 | 891 | * Set an error message |
| 886 | 892 | * |
| 887 | 893 | * @param string |
| 894 | + * @param string $msg |
|
| 888 | 895 | * @return void |
| 889 | 896 | */ |
| 890 | 897 | public function set_error($msg) |
@@ -938,6 +945,7 @@ discard block |
||
| 938 | 945 | * the "allowed types" set by the developer |
| 939 | 946 | * |
| 940 | 947 | * @param string |
| 948 | + * @param string $mime |
|
| 941 | 949 | * @return string |
| 942 | 950 | */ |
| 943 | 951 | public function mimes_types($mime) |
@@ -26,33 +26,33 @@ discard block |
||
| 26 | 26 | */ |
| 27 | 27 | class CI_Upload { |
| 28 | 28 | |
| 29 | - public $max_size = 0; |
|
| 30 | - public $max_width = 0; |
|
| 31 | - public $max_height = 0; |
|
| 32 | - public $max_filename = 0; |
|
| 33 | - public $allowed_types = ""; |
|
| 29 | + public $max_size = 0; |
|
| 30 | + public $max_width = 0; |
|
| 31 | + public $max_height = 0; |
|
| 32 | + public $max_filename = 0; |
|
| 33 | + public $allowed_types = ""; |
|
| 34 | 34 | public $file_temp = ""; |
| 35 | 35 | public $file_name = ""; |
| 36 | 36 | public $orig_name = ""; |
| 37 | 37 | public $file_type = ""; |
| 38 | 38 | public $file_size = ""; |
| 39 | - public $file_ext = ""; |
|
| 39 | + public $file_ext = ""; |
|
| 40 | 40 | public $upload_path = ""; |
| 41 | 41 | public $overwrite = FALSE; |
| 42 | 42 | public $encrypt_name = FALSE; |
| 43 | - public $is_image = FALSE; |
|
| 43 | + public $is_image = FALSE; |
|
| 44 | 44 | public $image_width = ''; |
| 45 | 45 | public $image_height = ''; |
| 46 | - public $image_type = ''; |
|
| 47 | - public $image_size_str = ''; |
|
| 46 | + public $image_type = ''; |
|
| 47 | + public $image_size_str = ''; |
|
| 48 | 48 | public $error_msg = array(); |
| 49 | - public $mimes = array(); |
|
| 50 | - public $remove_spaces = TRUE; |
|
| 49 | + public $mimes = array(); |
|
| 50 | + public $remove_spaces = TRUE; |
|
| 51 | 51 | public $xss_clean = FALSE; |
| 52 | 52 | public $temp_prefix = "temp_file_"; |
| 53 | 53 | public $client_name = ''; |
| 54 | 54 | |
| 55 | - protected $_file_name_override = ''; |
|
| 55 | + protected $_file_name_override = ''; |
|
| 56 | 56 | |
| 57 | 57 | /** |
| 58 | 58 | * Constructor |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | { |
| 163 | 163 | $error = ( ! isset($_FILES[$field]['error'])) ? 4 : $_FILES[$field]['error']; |
| 164 | 164 | |
| 165 | - switch($error) |
|
| 165 | + switch ($error) |
|
| 166 | 166 | { |
| 167 | 167 | case 1: // UPLOAD_ERR_INI_SIZE |
| 168 | 168 | $this->set_error('upload_file_exceeds_limit'); |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | // An extension was provided, lets have it! |
| 225 | 225 | else |
| 226 | 226 | { |
| 227 | - $this->file_ext = $this->get_extension($this->_file_name_override); |
|
| 227 | + $this->file_ext = $this->get_extension($this->_file_name_override); |
|
| 228 | 228 | } |
| 229 | 229 | |
| 230 | 230 | if ( ! $this->is_allowed_filetype(TRUE)) |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | // Convert the file size to kilobytes |
| 238 | 238 | if ($this->file_size > 0) |
| 239 | 239 | { |
| 240 | - $this->file_size = round($this->file_size/1024, 2); |
|
| 240 | + $this->file_size = round($this->file_size / 1024, 2); |
|
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | // Is the file size within the allowed maximum? |
@@ -342,7 +342,7 @@ discard block |
||
| 342 | 342 | */ |
| 343 | 343 | public function data() |
| 344 | 344 | { |
| 345 | - return array ( |
|
| 345 | + return array( |
|
| 346 | 346 | 'file_name' => $this->file_name, |
| 347 | 347 | 'file_type' => $this->file_type, |
| 348 | 348 | 'file_path' => $this->upload_path, |
@@ -433,7 +433,7 @@ discard block |
||
| 433 | 433 | */ |
| 434 | 434 | public function set_max_filesize($n) |
| 435 | 435 | { |
| 436 | - $this->max_size = ((int) $n < 0) ? 0: (int) $n; |
|
| 436 | + $this->max_size = ((int)$n < 0) ? 0 : (int)$n; |
|
| 437 | 437 | } |
| 438 | 438 | |
| 439 | 439 | // -------------------------------------------------------------------- |
@@ -446,7 +446,7 @@ discard block |
||
| 446 | 446 | */ |
| 447 | 447 | public function set_max_filename($n) |
| 448 | 448 | { |
| 449 | - $this->max_filename = ((int) $n < 0) ? 0: (int) $n; |
|
| 449 | + $this->max_filename = ((int)$n < 0) ? 0 : (int)$n; |
|
| 450 | 450 | } |
| 451 | 451 | |
| 452 | 452 | // -------------------------------------------------------------------- |
@@ -459,7 +459,7 @@ discard block |
||
| 459 | 459 | */ |
| 460 | 460 | public function set_max_width($n) |
| 461 | 461 | { |
| 462 | - $this->max_width = ((int) $n < 0) ? 0: (int) $n; |
|
| 462 | + $this->max_width = ((int)$n < 0) ? 0 : (int)$n; |
|
| 463 | 463 | } |
| 464 | 464 | |
| 465 | 465 | // -------------------------------------------------------------------- |
@@ -472,7 +472,7 @@ discard block |
||
| 472 | 472 | */ |
| 473 | 473 | public function set_max_height($n) |
| 474 | 474 | { |
| 475 | - $this->max_height = ((int) $n < 0) ? 0: (int) $n; |
|
| 475 | + $this->max_height = ((int)$n < 0) ? 0 : (int)$n; |
|
| 476 | 476 | } |
| 477 | 477 | |
| 478 | 478 | // -------------------------------------------------------------------- |
@@ -516,10 +516,10 @@ discard block |
||
| 516 | 516 | { |
| 517 | 517 | $types = array(1 => 'gif', 2 => 'jpeg', 3 => 'png'); |
| 518 | 518 | |
| 519 | - $this->image_width = $D['0']; |
|
| 520 | - $this->image_height = $D['1']; |
|
| 521 | - $this->image_type = ( ! isset($types[$D['2']])) ? 'unknown' : $types[$D['2']]; |
|
| 522 | - $this->image_size_str = $D['3']; // string containing height and width |
|
| 519 | + $this->image_width = $D['0']; |
|
| 520 | + $this->image_height = $D['1']; |
|
| 521 | + $this->image_type = ( ! isset($types[$D['2']])) ? 'unknown' : $types[$D['2']]; |
|
| 522 | + $this->image_size_str = $D['3']; // string containing height and width |
|
| 523 | 523 | } |
| 524 | 524 | } |
| 525 | 525 | } |
@@ -643,7 +643,7 @@ discard block |
||
| 643 | 643 | */ |
| 644 | 644 | public function is_allowed_filesize() |
| 645 | 645 | { |
| 646 | - if ($this->max_size != 0 AND $this->file_size > $this->max_size) |
|
| 646 | + if ($this->max_size != 0 AND $this->file_size > $this->max_size) |
|
| 647 | 647 | { |
| 648 | 648 | return FALSE; |
| 649 | 649 | } |
@@ -722,7 +722,7 @@ discard block |
||
| 722 | 722 | return FALSE; |
| 723 | 723 | } |
| 724 | 724 | |
| 725 | - $this->upload_path = preg_replace("/(.+?)\/*$/", "\\1/", $this->upload_path); |
|
| 725 | + $this->upload_path = preg_replace("/(.+?)\/*$/", "\\1/", $this->upload_path); |
|
| 726 | 726 | return TRUE; |
| 727 | 727 | } |
| 728 | 728 | |
@@ -765,17 +765,17 @@ discard block |
||
| 765 | 765 | '/', |
| 766 | 766 | "%20", |
| 767 | 767 | "%22", |
| 768 | - "%3c", // < |
|
| 769 | - "%253c", // < |
|
| 770 | - "%3e", // > |
|
| 771 | - "%0e", // > |
|
| 772 | - "%28", // ( |
|
| 773 | - "%29", // ) |
|
| 774 | - "%2528", // ( |
|
| 775 | - "%26", // & |
|
| 776 | - "%24", // $ |
|
| 777 | - "%3f", // ? |
|
| 778 | - "%3b", // ; |
|
| 768 | + "%3c", // < |
|
| 769 | + "%253c", // < |
|
| 770 | + "%3e", // > |
|
| 771 | + "%0e", // > |
|
| 772 | + "%28", // ( |
|
| 773 | + "%29", // ) |
|
| 774 | + "%2528", // ( |
|
| 775 | + "%26", // & |
|
| 776 | + "%24", // $ |
|
| 777 | + "%3f", // ? |
|
| 778 | + "%3b", // ; |
|
| 779 | 779 | "%3d" // = |
| 780 | 780 | ); |
| 781 | 781 | |
@@ -802,9 +802,9 @@ discard block |
||
| 802 | 802 | $ext = ''; |
| 803 | 803 | if (strpos($filename, '.') !== FALSE) |
| 804 | 804 | { |
| 805 | - $parts = explode('.', $filename); |
|
| 806 | - $ext = '.'.array_pop($parts); |
|
| 807 | - $filename = implode('.', $parts); |
|
| 805 | + $parts = explode('.', $filename); |
|
| 806 | + $ext = '.'.array_pop($parts); |
|
| 807 | + $filename = implode('.', $parts); |
|
| 808 | 808 | } |
| 809 | 809 | |
| 810 | 810 | return substr($filename, 0, ($length - strlen($ext))).$ext; |
@@ -875,7 +875,7 @@ discard block |
||
| 875 | 875 | return FALSE; |
| 876 | 876 | } |
| 877 | 877 | |
| 878 | - $CI =& get_instance(); |
|
| 878 | + $CI = & get_instance(); |
|
| 879 | 879 | return $CI->security->xss_clean($data, TRUE); |
| 880 | 880 | } |
| 881 | 881 | |
@@ -889,7 +889,7 @@ discard block |
||
| 889 | 889 | */ |
| 890 | 890 | public function set_error($msg) |
| 891 | 891 | { |
| 892 | - $CI =& get_instance(); |
|
| 892 | + $CI = & get_instance(); |
|
| 893 | 893 | $CI->lang->load('upload'); |
| 894 | 894 | |
| 895 | 895 | if (is_array($msg)) |
@@ -984,9 +984,9 @@ discard block |
||
| 984 | 984 | return $filename; |
| 985 | 985 | } |
| 986 | 986 | |
| 987 | - $parts = explode('.', $filename); |
|
| 988 | - $ext = array_pop($parts); |
|
| 989 | - $filename = array_shift($parts); |
|
| 987 | + $parts = explode('.', $filename); |
|
| 988 | + $ext = array_pop($parts); |
|
| 989 | + $filename = array_shift($parts); |
|
| 990 | 990 | |
| 991 | 991 | foreach ($parts as $part) |
| 992 | 992 | { |
@@ -1019,7 +1019,7 @@ discard block |
||
| 1019 | 1019 | protected function _file_mime_type($file) |
| 1020 | 1020 | { |
| 1021 | 1021 | // Use if the Fileinfo extension, if available (only versions above 5.3 support the FILEINFO_MIME_TYPE flag) |
| 1022 | - if ( (float) substr(phpversion(), 0, 3) >= 5.3 && function_exists('finfo_file')) |
|
| 1022 | + if ((float)substr(phpversion(), 0, 3) >= 5.3 && function_exists('finfo_file')) |
|
| 1023 | 1023 | { |
| 1024 | 1024 | $finfo = new finfo(FILEINFO_MIME_TYPE); |
| 1025 | 1025 | if ($finfo !== FALSE) // This is possible, if there is no magic MIME database file found on the system |
@@ -1055,7 +1055,7 @@ discard block |
||
| 1055 | 1055 | if (DIRECTORY_SEPARATOR !== '\\' && function_exists('exec')) |
| 1056 | 1056 | { |
| 1057 | 1057 | $output = array(); |
| 1058 | - @exec('file --brief --mime-type ' . escapeshellarg($file['tmp_path']), $output, $return_code); |
|
| 1058 | + @exec('file --brief --mime-type '.escapeshellarg($file['tmp_path']), $output, $return_code); |
|
| 1059 | 1059 | if ($return_code === 0 && strlen($output[0]) > 0) // A return status code != 0 would mean failed execution |
| 1060 | 1060 | { |
| 1061 | 1061 | $this->file_type = rtrim($output[0]); |
@@ -1,4 +1,6 @@ discard block |
||
| 1 | -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
|
| 1 | +<?php if ( ! defined('BASEPATH')) { |
|
| 2 | + exit('No direct script access allowed'); |
|
| 3 | +} |
|
| 2 | 4 | /** |
| 3 | 5 | * CodeIgniter |
| 4 | 6 | * |
@@ -116,13 +118,11 @@ discard block |
||
| 116 | 118 | if (method_exists($this, $method)) |
| 117 | 119 | { |
| 118 | 120 | $this->$method($config[$key]); |
| 119 | - } |
|
| 120 | - else |
|
| 121 | + } else |
|
| 121 | 122 | { |
| 122 | 123 | $this->$key = $config[$key]; |
| 123 | 124 | } |
| 124 | - } |
|
| 125 | - else |
|
| 125 | + } else |
|
| 126 | 126 | { |
| 127 | 127 | $this->$key = $val; |
| 128 | 128 | } |
@@ -416,8 +416,7 @@ discard block |
||
| 416 | 416 | { |
| 417 | 417 | $this->set_error('upload_bad_filename'); |
| 418 | 418 | return FALSE; |
| 419 | - } |
|
| 420 | - else |
|
| 419 | + } else |
|
| 421 | 420 | { |
| 422 | 421 | return $new_filename; |
| 423 | 422 | } |
@@ -625,8 +624,7 @@ discard block |
||
| 625 | 624 | { |
| 626 | 625 | return TRUE; |
| 627 | 626 | } |
| 628 | - } |
|
| 629 | - elseif ($mime == $this->file_type) |
|
| 627 | + } elseif ($mime == $this->file_type) |
|
| 630 | 628 | { |
| 631 | 629 | return TRUE; |
| 632 | 630 | } |
@@ -646,8 +644,7 @@ discard block |
||
| 646 | 644 | if ($this->max_size != 0 AND $this->file_size > $this->max_size) |
| 647 | 645 | { |
| 648 | 646 | return FALSE; |
| 649 | - } |
|
| 650 | - else |
|
| 647 | + } else |
|
| 651 | 648 | { |
| 652 | 649 | return TRUE; |
| 653 | 650 | } |
@@ -852,9 +849,12 @@ discard block |
||
| 852 | 849 | |
| 853 | 850 | if (function_exists('getimagesize') && @getimagesize($file) !== FALSE) |
| 854 | 851 | { |
| 855 | - if (($file = @fopen($file, 'rb')) === FALSE) // "b" to force binary |
|
| 852 | + if (($file = @fopen($file, 'rb')) === FALSE) { |
|
| 853 | + // "b" to force binary |
|
| 856 | 854 | { |
| 857 | - return FALSE; // Couldn't open the file, return FALSE |
|
| 855 | + return FALSE; |
|
| 856 | + } |
|
| 857 | + // Couldn't open the file, return FALSE |
|
| 858 | 858 | } |
| 859 | 859 | |
| 860 | 860 | $opening_bytes = fread($file, 256); |
@@ -900,8 +900,7 @@ discard block |
||
| 900 | 900 | $this->error_msg[] = $msg; |
| 901 | 901 | log_message('error', $msg); |
| 902 | 902 | } |
| 903 | - } |
|
| 904 | - else |
|
| 903 | + } else |
|
| 905 | 904 | { |
| 906 | 905 | $msg = ($CI->lang->line($msg) == FALSE) ? $msg : $CI->lang->line($msg); |
| 907 | 906 | $this->error_msg[] = $msg; |
@@ -949,12 +948,10 @@ discard block |
||
| 949 | 948 | if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/mimes.php')) |
| 950 | 949 | { |
| 951 | 950 | include(APPPATH.'config/'.ENVIRONMENT.'/mimes.php'); |
| 952 | - } |
|
| 953 | - elseif (is_file(APPPATH.'config/mimes.php')) |
|
| 951 | + } elseif (is_file(APPPATH.'config/mimes.php')) |
|
| 954 | 952 | { |
| 955 | 953 | include(APPPATH.'config//mimes.php'); |
| 956 | - } |
|
| 957 | - else |
|
| 954 | + } else |
|
| 958 | 955 | { |
| 959 | 956 | return FALSE; |
| 960 | 957 | } |
@@ -993,8 +990,7 @@ discard block |
||
| 993 | 990 | if ( ! in_array(strtolower($part), $this->allowed_types) OR $this->mimes_types(strtolower($part)) === FALSE) |
| 994 | 991 | { |
| 995 | 992 | $filename .= '.'.$part.'_'; |
| 996 | - } |
|
| 997 | - else |
|
| 993 | + } else |
|
| 998 | 994 | { |
| 999 | 995 | $filename .= '.'.$part; |
| 1000 | 996 | } |
@@ -1022,9 +1018,11 @@ discard block |
||
| 1022 | 1018 | if ( (float) substr(phpversion(), 0, 3) >= 5.3 && function_exists('finfo_file')) |
| 1023 | 1019 | { |
| 1024 | 1020 | $finfo = new finfo(FILEINFO_MIME_TYPE); |
| 1025 | - if ($finfo !== FALSE) // This is possible, if there is no magic MIME database file found on the system |
|
| 1021 | + if ($finfo !== FALSE) { |
|
| 1022 | + // This is possible, if there is no magic MIME database file found on the system |
|
| 1026 | 1023 | { |
| 1027 | 1024 | $file_type = $finfo->file($file['tmp_name']); |
| 1025 | + } |
|
| 1028 | 1026 | |
| 1029 | 1027 | /* According to the comments section of the PHP manual page, |
| 1030 | 1028 | * it is possible that this function returns an empty string |
@@ -1056,9 +1054,11 @@ discard block |
||
| 1056 | 1054 | { |
| 1057 | 1055 | $output = array(); |
| 1058 | 1056 | @exec('file --brief --mime-type ' . escapeshellarg($file['tmp_path']), $output, $return_code); |
| 1059 | - if ($return_code === 0 && strlen($output[0]) > 0) // A return status code != 0 would mean failed execution |
|
| 1057 | + if ($return_code === 0 && strlen($output[0]) > 0) { |
|
| 1058 | + // A return status code != 0 would mean failed execution |
|
| 1060 | 1059 | { |
| 1061 | 1060 | $this->file_type = rtrim($output[0]); |
| 1061 | + } |
|
| 1062 | 1062 | return; |
| 1063 | 1063 | } |
| 1064 | 1064 | } |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | * Compile the User Agent Data |
| 137 | 137 | * |
| 138 | 138 | * @access private |
| 139 | - * @return bool |
|
| 139 | + * @return boolean|null |
|
| 140 | 140 | */ |
| 141 | 141 | private function _compile_data() |
| 142 | 142 | { |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | * Set the Platform |
| 158 | 158 | * |
| 159 | 159 | * @access private |
| 160 | - * @return mixed |
|
| 160 | + * @return boolean|null |
|
| 161 | 161 | */ |
| 162 | 162 | private function _set_platform() |
| 163 | 163 | { |
@@ -473,7 +473,7 @@ discard block |
||
| 473 | 473 | * Get the referrer |
| 474 | 474 | * |
| 475 | 475 | * @access public |
| 476 | - * @return bool |
|
| 476 | + * @return string |
|
| 477 | 477 | */ |
| 478 | 478 | public function referrer() |
| 479 | 479 | { |
@@ -28,10 +28,10 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | class CI_User_agent { |
| 30 | 30 | |
| 31 | - var $agent = NULL; |
|
| 31 | + var $agent = NULL; |
|
| 32 | 32 | |
| 33 | - var $is_browser = FALSE; |
|
| 34 | - var $is_robot = FALSE; |
|
| 33 | + var $is_browser = FALSE; |
|
| 34 | + var $is_robot = FALSE; |
|
| 35 | 35 | var $is_mobile = FALSE; |
| 36 | 36 | |
| 37 | 37 | var $languages = array(); |
@@ -42,11 +42,11 @@ discard block |
||
| 42 | 42 | var $mobiles = array(); |
| 43 | 43 | var $robots = array(); |
| 44 | 44 | |
| 45 | - var $platform = ''; |
|
| 45 | + var $platform = ''; |
|
| 46 | 46 | var $browser = ''; |
| 47 | 47 | var $version = ''; |
| 48 | 48 | var $mobile = ''; |
| 49 | - var $robot = ''; |
|
| 49 | + var $robot = ''; |
|
| 50 | 50 | |
| 51 | 51 | /** |
| 52 | 52 | * Constructor |
@@ -1,4 +1,6 @@ discard block |
||
| 1 | -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
|
| 1 | +<?php if ( ! defined('BASEPATH')) { |
|
| 2 | + exit('No direct script access allowed'); |
|
| 3 | +} |
|
| 2 | 4 | /** |
| 3 | 5 | * CodeIgniter |
| 4 | 6 | * |
@@ -87,12 +89,10 @@ discard block |
||
| 87 | 89 | if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/user_agents.php')) |
| 88 | 90 | { |
| 89 | 91 | include(APPPATH.'config/'.ENVIRONMENT.'/user_agents.php'); |
| 90 | - } |
|
| 91 | - elseif (is_file(APPPATH.'config/user_agents.php')) |
|
| 92 | + } elseif (is_file(APPPATH.'config/user_agents.php')) |
|
| 92 | 93 | { |
| 93 | 94 | include(APPPATH.'config/user_agents.php'); |
| 94 | - } |
|
| 95 | - else |
|
| 95 | + } else |
|
| 96 | 96 | { |
| 97 | 97 | return FALSE; |
| 98 | 98 | } |
@@ -369,6 +369,9 @@ discard block |
||
| 369 | 369 | $this->path = $path; |
| 370 | 370 | } |
| 371 | 371 | |
| 372 | + /** |
|
| 373 | + * @param XML_RPC_Message $msg |
|
| 374 | + */ |
|
| 372 | 375 | function send($msg) |
| 373 | 376 | { |
| 374 | 377 | if (is_array($msg)) |
@@ -544,6 +547,9 @@ discard block |
||
| 544 | 547 | // XML-RPC Object to PHP Types |
| 545 | 548 | //------------------------------------- |
| 546 | 549 | |
| 550 | + /** |
|
| 551 | + * @param integer $xmlrpc_val |
|
| 552 | + */ |
|
| 547 | 553 | function xmlrpc_decoder($xmlrpc_val) |
| 548 | 554 | { |
| 549 | 555 | $kind = $xmlrpc_val->kindOf(); |
@@ -1234,6 +1240,9 @@ discard block |
||
| 1234 | 1240 | } |
| 1235 | 1241 | } |
| 1236 | 1242 | |
| 1243 | + /** |
|
| 1244 | + * @param integer $val |
|
| 1245 | + */ |
|
| 1237 | 1246 | function addScalar($val, $type='string') |
| 1238 | 1247 | { |
| 1239 | 1248 | $typeof = $this->xmlrpcTypes[$type]; |
@@ -1291,6 +1300,9 @@ discard block |
||
| 1291 | 1300 | return 1; |
| 1292 | 1301 | } |
| 1293 | 1302 | |
| 1303 | + /** |
|
| 1304 | + * @param integer $vals |
|
| 1305 | + */ |
|
| 1294 | 1306 | function addStruct($vals) |
| 1295 | 1307 | { |
| 1296 | 1308 | if ($this->mytype != 0) |
@@ -32,38 +32,38 @@ discard block |
||
| 32 | 32 | */ |
| 33 | 33 | class CI_Xmlrpc { |
| 34 | 34 | |
| 35 | - var $debug = FALSE; // Debugging on or off |
|
| 36 | - var $xmlrpcI4 = 'i4'; |
|
| 37 | - var $xmlrpcInt = 'int'; |
|
| 38 | - var $xmlrpcBoolean = 'boolean'; |
|
| 35 | + var $debug = FALSE; // Debugging on or off |
|
| 36 | + var $xmlrpcI4 = 'i4'; |
|
| 37 | + var $xmlrpcInt = 'int'; |
|
| 38 | + var $xmlrpcBoolean = 'boolean'; |
|
| 39 | 39 | var $xmlrpcDouble = 'double'; |
| 40 | 40 | var $xmlrpcString = 'string'; |
| 41 | - var $xmlrpcDateTime = 'dateTime.iso8601'; |
|
| 41 | + var $xmlrpcDateTime = 'dateTime.iso8601'; |
|
| 42 | 42 | var $xmlrpcBase64 = 'base64'; |
| 43 | 43 | var $xmlrpcArray = 'array'; |
| 44 | 44 | var $xmlrpcStruct = 'struct'; |
| 45 | 45 | |
| 46 | 46 | var $xmlrpcTypes = array(); |
| 47 | - var $valid_parents = array(); |
|
| 48 | - var $xmlrpcerr = array(); // Response numbers |
|
| 49 | - var $xmlrpcstr = array(); // Response strings |
|
| 47 | + var $valid_parents = array(); |
|
| 48 | + var $xmlrpcerr = array(); // Response numbers |
|
| 49 | + var $xmlrpcstr = array(); // Response strings |
|
| 50 | 50 | |
| 51 | 51 | var $xmlrpc_defencoding = 'UTF-8'; |
| 52 | - var $xmlrpcName = 'XML-RPC for CodeIgniter'; |
|
| 52 | + var $xmlrpcName = 'XML-RPC for CodeIgniter'; |
|
| 53 | 53 | var $xmlrpcVersion = '1.1'; |
| 54 | 54 | var $xmlrpcerruser = 800; // Start of user errors |
| 55 | - var $xmlrpcerrxml = 100; // Start of XML Parse errors |
|
| 56 | - var $xmlrpc_backslash = ''; // formulate backslashes for escaping regexp |
|
| 55 | + var $xmlrpcerrxml = 100; // Start of XML Parse errors |
|
| 56 | + var $xmlrpc_backslash = ''; // formulate backslashes for escaping regexp |
|
| 57 | 57 | |
| 58 | 58 | var $client; |
| 59 | 59 | var $method; |
| 60 | 60 | var $data; |
| 61 | - var $message = ''; |
|
| 62 | - var $error = ''; // Error string for request |
|
| 61 | + var $message = ''; |
|
| 62 | + var $error = ''; // Error string for request |
|
| 63 | 63 | var $result; |
| 64 | - var $response = array(); // Response from remote server |
|
| 64 | + var $response = array(); // Response from remote server |
|
| 65 | 65 | |
| 66 | - var $xss_clean = TRUE; |
|
| 66 | + var $xss_clean = TRUE; |
|
| 67 | 67 | |
| 68 | 68 | //------------------------------------- |
| 69 | 69 | // VALUES THAT MULTIPLE CLASSES NEED |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | |
| 72 | 72 | public function __construct($config = array()) |
| 73 | 73 | { |
| 74 | - $this->xmlrpcName = $this->xmlrpcName; |
|
| 74 | + $this->xmlrpcName = $this->xmlrpcName; |
|
| 75 | 75 | $this->xmlrpc_backslash = chr(92).chr(92); |
| 76 | 76 | |
| 77 | 77 | // Types for info sent back and forth |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | $this->xmlrpcerr['http_error'] = '5'; |
| 121 | 121 | $this->xmlrpcstr['http_error'] = "Did not receive a '200 OK' response from remote server."; |
| 122 | 122 | $this->xmlrpcerr['no_data'] = '6'; |
| 123 | - $this->xmlrpcstr['no_data'] ='No data received from server.'; |
|
| 123 | + $this->xmlrpcstr['no_data'] = 'No data received from server.'; |
|
| 124 | 124 | |
| 125 | 125 | $this->initialize($config); |
| 126 | 126 | |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | // Take URL and parse it |
| 152 | 152 | //------------------------------------- |
| 153 | 153 | |
| 154 | - function server($url, $port=80) |
|
| 154 | + function server($url, $port = 80) |
|
| 155 | 155 | { |
| 156 | 156 | if (substr($url, 0, 4) != "http") |
| 157 | 157 | { |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | // Set Timeout |
| 176 | 176 | //------------------------------------- |
| 177 | 177 | |
| 178 | - function timeout($seconds=5) |
|
| 178 | + function timeout($seconds = 5) |
|
| 179 | 179 | { |
| 180 | 180 | if ( ! is_null($this->client) && is_int($seconds)) |
| 181 | 181 | { |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | |
| 274 | 274 | function send_request() |
| 275 | 275 | { |
| 276 | - $this->message = new XML_RPC_Message($this->method,$this->data); |
|
| 276 | + $this->message = new XML_RPC_Message($this->method, $this->data); |
|
| 277 | 277 | $this->message->debug = $this->debug; |
| 278 | 278 | |
| 279 | 279 | if ( ! $this->result = $this->client->send($this->message)) |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | |
| 320 | 320 | function send_error_message($number, $message) |
| 321 | 321 | { |
| 322 | - return new XML_RPC_Response('0',$number, $message); |
|
| 322 | + return new XML_RPC_Response('0', $number, $message); |
|
| 323 | 323 | } |
| 324 | 324 | // END |
| 325 | 325 | |
@@ -353,14 +353,14 @@ discard block |
||
| 353 | 353 | class XML_RPC_Client extends CI_Xmlrpc |
| 354 | 354 | { |
| 355 | 355 | var $path = ''; |
| 356 | - var $server = ''; |
|
| 356 | + var $server = ''; |
|
| 357 | 357 | var $port = 80; |
| 358 | - var $errno = ''; |
|
| 359 | - var $errstring = ''; |
|
| 360 | - var $timeout = 5; |
|
| 361 | - var $no_multicall = FALSE; |
|
| 358 | + var $errno = ''; |
|
| 359 | + var $errstring = ''; |
|
| 360 | + var $timeout = 5; |
|
| 361 | + var $no_multicall = FALSE; |
|
| 362 | 362 | |
| 363 | - public function __construct($path, $server, $port=80) |
|
| 363 | + public function __construct($path, $server, $port = 80) |
|
| 364 | 364 | { |
| 365 | 365 | parent::__construct(); |
| 366 | 366 | |
@@ -374,7 +374,7 @@ discard block |
||
| 374 | 374 | if (is_array($msg)) |
| 375 | 375 | { |
| 376 | 376 | // Multi-call disabled |
| 377 | - $r = new XML_RPC_Response(0, $this->xmlrpcerr['multicall_recursion'],$this->xmlrpcstr['multicall_recursion']); |
|
| 377 | + $r = new XML_RPC_Response(0, $this->xmlrpcerr['multicall_recursion'], $this->xmlrpcstr['multicall_recursion']); |
|
| 378 | 378 | return $r; |
| 379 | 379 | } |
| 380 | 380 | |
@@ -383,12 +383,12 @@ discard block |
||
| 383 | 383 | |
| 384 | 384 | function sendPayload($msg) |
| 385 | 385 | { |
| 386 | - $fp = @fsockopen($this->server, $this->port,$this->errno, $this->errstr, $this->timeout); |
|
| 386 | + $fp = @fsockopen($this->server, $this->port, $this->errno, $this->errstr, $this->timeout); |
|
| 387 | 387 | |
| 388 | 388 | if ( ! is_resource($fp)) |
| 389 | 389 | { |
| 390 | 390 | error_log($this->xmlrpcstr['http_error']); |
| 391 | - $r = new XML_RPC_Response(0, $this->xmlrpcerr['http_error'],$this->xmlrpcstr['http_error']); |
|
| 391 | + $r = new XML_RPC_Response(0, $this->xmlrpcerr['http_error'], $this->xmlrpcstr['http_error']); |
|
| 392 | 392 | return $r; |
| 393 | 393 | } |
| 394 | 394 | |
@@ -403,7 +403,7 @@ discard block |
||
| 403 | 403 | $op .= "Host: {$this->server}$r"; |
| 404 | 404 | $op .= "Content-Type: text/xml$r"; |
| 405 | 405 | $op .= "User-Agent: {$this->xmlrpcName}$r"; |
| 406 | - $op .= "Content-Length: ".strlen($msg->payload). "$r$r"; |
|
| 406 | + $op .= "Content-Length: ".strlen($msg->payload)."$r$r"; |
|
| 407 | 407 | $op .= $msg->payload; |
| 408 | 408 | |
| 409 | 409 | |
@@ -447,7 +447,7 @@ discard block |
||
| 447 | 447 | else if ( ! is_object($val)) |
| 448 | 448 | { |
| 449 | 449 | // programmer error, not an object |
| 450 | - error_log("Invalid type '" . gettype($val) . "' (value: $val) passed to XML_RPC_Response. Defaulting to empty value."); |
|
| 450 | + error_log("Invalid type '".gettype($val)."' (value: $val) passed to XML_RPC_Response. Defaulting to empty value."); |
|
| 451 | 451 | $this->val = new XML_RPC_Values(); |
| 452 | 452 | } |
| 453 | 453 | else |
@@ -481,11 +481,11 @@ discard block |
||
| 481 | 481 | <struct> |
| 482 | 482 | <member> |
| 483 | 483 | <name>faultCode</name> |
| 484 | - <value><int>' . $this->errno . '</int></value> |
|
| 484 | + <value><int>' . $this->errno.'</int></value> |
|
| 485 | 485 | </member> |
| 486 | 486 | <member> |
| 487 | 487 | <name>faultString</name> |
| 488 | - <value><string>' . $this->errstr . '</string></value> |
|
| 488 | + <value><string>' . $this->errstr.'</string></value> |
|
| 489 | 489 | </member> |
| 490 | 490 | </struct> |
| 491 | 491 | </value> |
@@ -493,17 +493,17 @@ discard block |
||
| 493 | 493 | } |
| 494 | 494 | else |
| 495 | 495 | { |
| 496 | - $result .= "<params>\n<param>\n" . |
|
| 497 | - $this->val->serialize_class() . |
|
| 496 | + $result .= "<params>\n<param>\n". |
|
| 497 | + $this->val->serialize_class(). |
|
| 498 | 498 | "</param>\n</params>"; |
| 499 | 499 | } |
| 500 | 500 | $result .= "\n</methodResponse>"; |
| 501 | 501 | return $result; |
| 502 | 502 | } |
| 503 | 503 | |
| 504 | - function decode($array=FALSE) |
|
| 504 | + function decode($array = FALSE) |
|
| 505 | 505 | { |
| 506 | - $CI =& get_instance(); |
|
| 506 | + $CI = & get_instance(); |
|
| 507 | 507 | |
| 508 | 508 | if ($array !== FALSE && is_array($array)) |
| 509 | 509 | { |
@@ -555,7 +555,7 @@ discard block |
||
| 555 | 555 | elseif ($kind == 'array') |
| 556 | 556 | { |
| 557 | 557 | reset($xmlrpc_val->me); |
| 558 | - list($a,$b) = each($xmlrpc_val->me); |
|
| 558 | + list($a, $b) = each($xmlrpc_val->me); |
|
| 559 | 559 | $size = count($b); |
| 560 | 560 | |
| 561 | 561 | $arr = array(); |
@@ -571,7 +571,7 @@ discard block |
||
| 571 | 571 | reset($xmlrpc_val->me['struct']); |
| 572 | 572 | $arr = array(); |
| 573 | 573 | |
| 574 | - while (list($key,$value) = each($xmlrpc_val->me['struct'])) |
|
| 574 | + while (list($key, $value) = each($xmlrpc_val->me['struct'])) |
|
| 575 | 575 | { |
| 576 | 576 | $arr[$key] = $this->xmlrpc_decoder($value); |
| 577 | 577 | } |
@@ -584,7 +584,7 @@ discard block |
||
| 584 | 584 | // ISO-8601 time to server or UTC time |
| 585 | 585 | //------------------------------------- |
| 586 | 586 | |
| 587 | - function iso8601_decode($time, $utc=0) |
|
| 587 | + function iso8601_decode($time, $utc = 0) |
|
| 588 | 588 | { |
| 589 | 589 | // return a timet in the localtime, or UTC |
| 590 | 590 | $t = 0; |
@@ -611,17 +611,17 @@ discard block |
||
| 611 | 611 | { |
| 612 | 612 | var $payload; |
| 613 | 613 | var $method_name; |
| 614 | - var $params = array(); |
|
| 615 | - var $xh = array(); |
|
| 614 | + var $params = array(); |
|
| 615 | + var $xh = array(); |
|
| 616 | 616 | |
| 617 | - public function __construct($method, $pars=0) |
|
| 617 | + public function __construct($method, $pars = 0) |
|
| 618 | 618 | { |
| 619 | 619 | parent::__construct(); |
| 620 | 620 | |
| 621 | 621 | $this->method_name = $method; |
| 622 | 622 | if (is_array($pars) && count($pars) > 0) |
| 623 | 623 | { |
| 624 | - for ($i=0; $i<count($pars); $i++) |
|
| 624 | + for ($i = 0; $i < count($pars); $i++) |
|
| 625 | 625 | { |
| 626 | 626 | // $pars[$i] = XML_RPC_Values |
| 627 | 627 | $this->params[] = $pars[$i]; |
@@ -636,10 +636,10 @@ discard block |
||
| 636 | 636 | function createPayload() |
| 637 | 637 | { |
| 638 | 638 | $this->payload = "<?xml version=\"1.0\"?".">\r\n<methodCall>\r\n"; |
| 639 | - $this->payload .= '<methodName>' . $this->method_name . "</methodName>\r\n"; |
|
| 639 | + $this->payload .= '<methodName>'.$this->method_name."</methodName>\r\n"; |
|
| 640 | 640 | $this->payload .= "<params>\r\n"; |
| 641 | 641 | |
| 642 | - for ($i=0; $i<count($this->params); $i++) |
|
| 642 | + for ($i = 0; $i < count($this->params); $i++) |
|
| 643 | 643 | { |
| 644 | 644 | // $p = XML_RPC_Values |
| 645 | 645 | $p = $this->params[$i]; |
@@ -669,7 +669,7 @@ discard block |
||
| 669 | 669 | if ($this->debug === TRUE) |
| 670 | 670 | { |
| 671 | 671 | echo "<pre>"; |
| 672 | - echo "---DATA---\n" . htmlspecialchars($data) . "\n---END DATA---\n\n"; |
|
| 672 | + echo "---DATA---\n".htmlspecialchars($data)."\n---END DATA---\n\n"; |
|
| 673 | 673 | echo "</pre>"; |
| 674 | 674 | } |
| 675 | 675 | |
@@ -691,8 +691,8 @@ discard block |
||
| 691 | 691 | |
| 692 | 692 | if (strncmp($data, 'HTTP', 4) == 0 && ! preg_match('/^HTTP\/[0-9\.]+ 200 /', $data)) |
| 693 | 693 | { |
| 694 | - $errstr= substr($data, 0, strpos($data, "\n")-1); |
|
| 695 | - $r = new XML_RPC_Response(0, $this->xmlrpcerr['http_error'], $this->xmlrpcstr['http_error']. ' (' . $errstr . ')'); |
|
| 694 | + $errstr = substr($data, 0, strpos($data, "\n") - 1); |
|
| 695 | + $r = new XML_RPC_Response(0, $this->xmlrpcerr['http_error'], $this->xmlrpcstr['http_error'].' ('.$errstr.')'); |
|
| 696 | 696 | return $r; |
| 697 | 697 | } |
| 698 | 698 | |
@@ -702,11 +702,11 @@ discard block |
||
| 702 | 702 | |
| 703 | 703 | $parser = xml_parser_create($this->xmlrpc_defencoding); |
| 704 | 704 | |
| 705 | - $this->xh[$parser] = array(); |
|
| 706 | - $this->xh[$parser]['isf'] = 0; |
|
| 707 | - $this->xh[$parser]['ac'] = ''; |
|
| 708 | - $this->xh[$parser]['headers'] = array(); |
|
| 709 | - $this->xh[$parser]['stack'] = array(); |
|
| 705 | + $this->xh[$parser] = array(); |
|
| 706 | + $this->xh[$parser]['isf'] = 0; |
|
| 707 | + $this->xh[$parser]['ac'] = ''; |
|
| 708 | + $this->xh[$parser]['headers'] = array(); |
|
| 709 | + $this->xh[$parser]['stack'] = array(); |
|
| 710 | 710 | $this->xh[$parser]['valuestack'] = array(); |
| 711 | 711 | $this->xh[$parser]['isf_reason'] = 0; |
| 712 | 712 | |
@@ -762,12 +762,12 @@ discard block |
||
| 762 | 762 | echo "---Invalid Return---\n\n"; |
| 763 | 763 | } |
| 764 | 764 | |
| 765 | - $r = new XML_RPC_Response(0, $this->xmlrpcerr['invalid_return'],$this->xmlrpcstr['invalid_return'].' '.$this->xh[$parser]['isf_reason']); |
|
| 765 | + $r = new XML_RPC_Response(0, $this->xmlrpcerr['invalid_return'], $this->xmlrpcstr['invalid_return'].' '.$this->xh[$parser]['isf_reason']); |
|
| 766 | 766 | return $r; |
| 767 | 767 | } |
| 768 | 768 | elseif ( ! is_object($this->xh[$parser]['value'])) |
| 769 | 769 | { |
| 770 | - $r = new XML_RPC_Response(0, $this->xmlrpcerr['invalid_return'],$this->xmlrpcstr['invalid_return'].' '.$this->xh[$parser]['isf_reason']); |
|
| 770 | + $r = new XML_RPC_Response(0, $this->xmlrpcerr['invalid_return'], $this->xmlrpcstr['invalid_return'].' '.$this->xh[$parser]['isf_reason']); |
|
| 771 | 771 | return $r; |
| 772 | 772 | } |
| 773 | 773 | |
@@ -789,9 +789,9 @@ discard block |
||
| 789 | 789 | echo "---END HEADERS---\n\n"; |
| 790 | 790 | } |
| 791 | 791 | |
| 792 | - echo "---DATA---\n" . htmlspecialchars($data) . "\n---END DATA---\n\n"; |
|
| 792 | + echo "---DATA---\n".htmlspecialchars($data)."\n---END DATA---\n\n"; |
|
| 793 | 793 | |
| 794 | - echo "---PARSED---\n" ; |
|
| 794 | + echo "---PARSED---\n"; |
|
| 795 | 795 | var_dump($this->xh[$parser]['value']); |
| 796 | 796 | echo "\n---END PARSED---</pre>"; |
| 797 | 797 | } |
@@ -870,7 +870,7 @@ discard block |
||
| 870 | 870 | } |
| 871 | 871 | } |
| 872 | 872 | |
| 873 | - switch($name) |
|
| 873 | + switch ($name) |
|
| 874 | 874 | { |
| 875 | 875 | case 'STRUCT': |
| 876 | 876 | case 'ARRAY': |
@@ -956,13 +956,13 @@ discard block |
||
| 956 | 956 | |
| 957 | 957 | $curr_elem = array_shift($this->xh[$the_parser]['stack']); |
| 958 | 958 | |
| 959 | - switch($name) |
|
| 959 | + switch ($name) |
|
| 960 | 960 | { |
| 961 | 961 | case 'STRUCT': |
| 962 | 962 | case 'ARRAY': |
| 963 | 963 | $cur_val = array_shift($this->xh[$the_parser]['valuestack']); |
| 964 | 964 | $this->xh[$the_parser]['value'] = ( ! isset($cur_val['values'])) ? array() : $cur_val['values']; |
| 965 | - $this->xh[$the_parser]['vt'] = strtolower($name); |
|
| 965 | + $this->xh[$the_parser]['vt'] = strtolower($name); |
|
| 966 | 966 | break; |
| 967 | 967 | case 'NAME': |
| 968 | 968 | $this->xh[$the_parser]['valuestack'][0]['name'] = $this->xh[$the_parser]['ac']; |
@@ -980,16 +980,16 @@ discard block |
||
| 980 | 980 | { |
| 981 | 981 | $this->xh[$the_parser]['value'] = $this->xh[$the_parser]['ac']; |
| 982 | 982 | } |
| 983 | - elseif ($name=='DATETIME.ISO8601') |
|
| 983 | + elseif ($name == 'DATETIME.ISO8601') |
|
| 984 | 984 | { |
| 985 | - $this->xh[$the_parser]['vt'] = $this->xmlrpcDateTime; |
|
| 985 | + $this->xh[$the_parser]['vt'] = $this->xmlrpcDateTime; |
|
| 986 | 986 | $this->xh[$the_parser]['value'] = $this->xh[$the_parser]['ac']; |
| 987 | 987 | } |
| 988 | - elseif ($name=='BASE64') |
|
| 988 | + elseif ($name == 'BASE64') |
|
| 989 | 989 | { |
| 990 | 990 | $this->xh[$the_parser]['value'] = base64_decode($this->xh[$the_parser]['ac']); |
| 991 | 991 | } |
| 992 | - elseif ($name=='BOOLEAN') |
|
| 992 | + elseif ($name == 'BOOLEAN') |
|
| 993 | 993 | { |
| 994 | 994 | // Translated BOOLEAN values to TRUE AND FALSE |
| 995 | 995 | if ($this->xh[$the_parser]['ac'] == '1') |
@@ -1001,7 +1001,7 @@ discard block |
||
| 1001 | 1001 | $this->xh[$the_parser]['value'] = FALSE; |
| 1002 | 1002 | } |
| 1003 | 1003 | } |
| 1004 | - elseif ($name=='DOUBLE') |
|
| 1004 | + elseif ($name == 'DOUBLE') |
|
| 1005 | 1005 | { |
| 1006 | 1006 | // we have a DOUBLE |
| 1007 | 1007 | // we must check that only 0123456789-.<space> are characters here |
@@ -1032,10 +1032,10 @@ discard block |
||
| 1032 | 1032 | break; |
| 1033 | 1033 | case 'VALUE': |
| 1034 | 1034 | // This if() detects if no scalar was inside <VALUE></VALUE> |
| 1035 | - if ($this->xh[$the_parser]['vt']=='value') |
|
| 1035 | + if ($this->xh[$the_parser]['vt'] == 'value') |
|
| 1036 | 1036 | { |
| 1037 | - $this->xh[$the_parser]['value'] = $this->xh[$the_parser]['ac']; |
|
| 1038 | - $this->xh[$the_parser]['vt'] = $this->xmlrpcString; |
|
| 1037 | + $this->xh[$the_parser]['value'] = $this->xh[$the_parser]['ac']; |
|
| 1038 | + $this->xh[$the_parser]['vt'] = $this->xmlrpcString; |
|
| 1039 | 1039 | } |
| 1040 | 1040 | |
| 1041 | 1041 | // build the XML-RPC value out of the data received, and substitute it |
@@ -1053,7 +1053,7 @@ discard block |
||
| 1053 | 1053 | } |
| 1054 | 1054 | break; |
| 1055 | 1055 | case 'MEMBER': |
| 1056 | - $this->xh[$the_parser]['ac']=''; |
|
| 1056 | + $this->xh[$the_parser]['ac'] = ''; |
|
| 1057 | 1057 | |
| 1058 | 1058 | // If value add to array in the stack for the last element built |
| 1059 | 1059 | if ($this->xh[$the_parser]['value']) |
@@ -1062,7 +1062,7 @@ discard block |
||
| 1062 | 1062 | } |
| 1063 | 1063 | break; |
| 1064 | 1064 | case 'DATA': |
| 1065 | - $this->xh[$the_parser]['ac']=''; |
|
| 1065 | + $this->xh[$the_parser]['ac'] = ''; |
|
| 1066 | 1066 | break; |
| 1067 | 1067 | case 'PARAM': |
| 1068 | 1068 | if ($this->xh[$the_parser]['value']) |
@@ -1111,11 +1111,11 @@ discard block |
||
| 1111 | 1111 | } |
| 1112 | 1112 | |
| 1113 | 1113 | |
| 1114 | - function addParam($par) { $this->params[]=$par; } |
|
| 1114 | + function addParam($par) { $this->params[] = $par; } |
|
| 1115 | 1115 | |
| 1116 | - function output_parameters($array=FALSE) |
|
| 1116 | + function output_parameters($array = FALSE) |
|
| 1117 | 1117 | { |
| 1118 | - $CI =& get_instance(); |
|
| 1118 | + $CI = & get_instance(); |
|
| 1119 | 1119 | |
| 1120 | 1120 | if ($array !== FALSE && is_array($array)) |
| 1121 | 1121 | { |
@@ -1169,11 +1169,11 @@ discard block |
||
| 1169 | 1169 | elseif ($kind == 'array') |
| 1170 | 1170 | { |
| 1171 | 1171 | reset($param->me); |
| 1172 | - list($a,$b) = each($param->me); |
|
| 1172 | + list($a, $b) = each($param->me); |
|
| 1173 | 1173 | |
| 1174 | 1174 | $arr = array(); |
| 1175 | 1175 | |
| 1176 | - for($i = 0; $i < count($b); $i++) |
|
| 1176 | + for ($i = 0; $i < count($b); $i++) |
|
| 1177 | 1177 | { |
| 1178 | 1178 | $arr[] = $this->decode_message($param->me['array'][$i]); |
| 1179 | 1179 | } |
@@ -1186,7 +1186,7 @@ discard block |
||
| 1186 | 1186 | |
| 1187 | 1187 | $arr = array(); |
| 1188 | 1188 | |
| 1189 | - while (list($key,$value) = each($param->me['struct'])) |
|
| 1189 | + while (list($key, $value) = each($param->me['struct'])) |
|
| 1190 | 1190 | { |
| 1191 | 1191 | $arr[$key] = $this->decode_message($value); |
| 1192 | 1192 | } |
@@ -1208,10 +1208,10 @@ discard block |
||
| 1208 | 1208 | */ |
| 1209 | 1209 | class XML_RPC_Values extends CI_Xmlrpc |
| 1210 | 1210 | { |
| 1211 | - var $me = array(); |
|
| 1212 | - var $mytype = 0; |
|
| 1211 | + var $me = array(); |
|
| 1212 | + var $mytype = 0; |
|
| 1213 | 1213 | |
| 1214 | - public function __construct($val=-1, $type='') |
|
| 1214 | + public function __construct($val = -1, $type = '') |
|
| 1215 | 1215 | { |
| 1216 | 1216 | parent::__construct(); |
| 1217 | 1217 | |
@@ -1221,7 +1221,7 @@ discard block |
||
| 1221 | 1221 | |
| 1222 | 1222 | if ($this->xmlrpcTypes[$type] == 1) |
| 1223 | 1223 | { |
| 1224 | - $this->addScalar($val,$type); |
|
| 1224 | + $this->addScalar($val, $type); |
|
| 1225 | 1225 | } |
| 1226 | 1226 | elseif ($this->xmlrpcTypes[$type] == 2) |
| 1227 | 1227 | { |
@@ -1234,11 +1234,11 @@ discard block |
||
| 1234 | 1234 | } |
| 1235 | 1235 | } |
| 1236 | 1236 | |
| 1237 | - function addScalar($val, $type='string') |
|
| 1237 | + function addScalar($val, $type = 'string') |
|
| 1238 | 1238 | { |
| 1239 | 1239 | $typeof = $this->xmlrpcTypes[$type]; |
| 1240 | 1240 | |
| 1241 | - if ($this->mytype==1) |
|
| 1241 | + if ($this->mytype == 1) |
|
| 1242 | 1242 | { |
| 1243 | 1243 | echo '<strong>XML_RPC_Values</strong>: scalar can have only one value<br />'; |
| 1244 | 1244 | return 0; |
@@ -1252,13 +1252,13 @@ discard block |
||
| 1252 | 1252 | |
| 1253 | 1253 | if ($type == $this->xmlrpcBoolean) |
| 1254 | 1254 | { |
| 1255 | - if (strcasecmp($val,'true')==0 OR $val==1 OR ($val==true && strcasecmp($val,'false'))) |
|
| 1255 | + if (strcasecmp($val, 'true') == 0 OR $val == 1 OR ($val == true && strcasecmp($val, 'false'))) |
|
| 1256 | 1256 | { |
| 1257 | 1257 | $val = 1; |
| 1258 | 1258 | } |
| 1259 | 1259 | else |
| 1260 | 1260 | { |
| 1261 | - $val=0; |
|
| 1261 | + $val = 0; |
|
| 1262 | 1262 | } |
| 1263 | 1263 | } |
| 1264 | 1264 | |
@@ -1282,7 +1282,7 @@ discard block |
||
| 1282 | 1282 | { |
| 1283 | 1283 | if ($this->mytype != 0) |
| 1284 | 1284 | { |
| 1285 | - echo '<strong>XML_RPC_Values</strong>: already initialized as a [' . $this->kindOf() . ']<br />'; |
|
| 1285 | + echo '<strong>XML_RPC_Values</strong>: already initialized as a ['.$this->kindOf().']<br />'; |
|
| 1286 | 1286 | return 0; |
| 1287 | 1287 | } |
| 1288 | 1288 | |
@@ -1295,7 +1295,7 @@ discard block |
||
| 1295 | 1295 | { |
| 1296 | 1296 | if ($this->mytype != 0) |
| 1297 | 1297 | { |
| 1298 | - echo '<strong>XML_RPC_Values</strong>: already initialized as a [' . $this->kindOf() . ']<br />'; |
|
| 1298 | + echo '<strong>XML_RPC_Values</strong>: already initialized as a ['.$this->kindOf().']<br />'; |
|
| 1299 | 1299 | return 0; |
| 1300 | 1300 | } |
| 1301 | 1301 | $this->mytype = $this->xmlrpcTypes['struct']; |
@@ -1305,7 +1305,7 @@ discard block |
||
| 1305 | 1305 | |
| 1306 | 1306 | function kindOf() |
| 1307 | 1307 | { |
| 1308 | - switch($this->mytype) |
|
| 1308 | + switch ($this->mytype) |
|
| 1309 | 1309 | { |
| 1310 | 1310 | case 3: |
| 1311 | 1311 | return 'struct'; |
@@ -1325,7 +1325,7 @@ discard block |
||
| 1325 | 1325 | { |
| 1326 | 1326 | $rs = ''; |
| 1327 | 1327 | |
| 1328 | - switch($this->xmlrpcTypes[$typ]) |
|
| 1328 | + switch ($this->xmlrpcTypes[$typ]) |
|
| 1329 | 1329 | { |
| 1330 | 1330 | case 3: |
| 1331 | 1331 | // struct |
@@ -1342,24 +1342,24 @@ discard block |
||
| 1342 | 1342 | case 2: |
| 1343 | 1343 | // array |
| 1344 | 1344 | $rs .= "<array>\n<data>\n"; |
| 1345 | - for($i=0; $i < count($val); $i++) |
|
| 1345 | + for ($i = 0; $i < count($val); $i++) |
|
| 1346 | 1346 | { |
| 1347 | 1347 | $rs .= $this->serializeval($val[$i]); |
| 1348 | 1348 | } |
| 1349 | - $rs.="</data>\n</array>\n"; |
|
| 1349 | + $rs .= "</data>\n</array>\n"; |
|
| 1350 | 1350 | break; |
| 1351 | 1351 | case 1: |
| 1352 | 1352 | // others |
| 1353 | 1353 | switch ($typ) |
| 1354 | 1354 | { |
| 1355 | 1355 | case $this->xmlrpcBase64: |
| 1356 | - $rs .= "<{$typ}>" . base64_encode((string)$val) . "</{$typ}>\n"; |
|
| 1356 | + $rs .= "<{$typ}>".base64_encode((string)$val)."</{$typ}>\n"; |
|
| 1357 | 1357 | break; |
| 1358 | 1358 | case $this->xmlrpcBoolean: |
| 1359 | - $rs .= "<{$typ}>" . ((bool)$val ? '1' : '0') . "</{$typ}>\n"; |
|
| 1359 | + $rs .= "<{$typ}>".((bool)$val ? '1' : '0')."</{$typ}>\n"; |
|
| 1360 | 1360 | break; |
| 1361 | 1361 | case $this->xmlrpcString: |
| 1362 | - $rs .= "<{$typ}>" . htmlspecialchars((string)$val). "</{$typ}>\n"; |
|
| 1362 | + $rs .= "<{$typ}>".htmlspecialchars((string)$val)."</{$typ}>\n"; |
|
| 1363 | 1363 | break; |
| 1364 | 1364 | default: |
| 1365 | 1365 | $rs .= "<{$typ}>{$val}</{$typ}>\n"; |
@@ -1389,7 +1389,7 @@ discard block |
||
| 1389 | 1389 | function scalarval() |
| 1390 | 1390 | { |
| 1391 | 1391 | reset($this->me); |
| 1392 | - list($a,$b) = each($this->me); |
|
| 1392 | + list($a, $b) = each($this->me); |
|
| 1393 | 1393 | return $b; |
| 1394 | 1394 | } |
| 1395 | 1395 | |
@@ -1400,7 +1400,7 @@ discard block |
||
| 1400 | 1400 | |
| 1401 | 1401 | // Useful for sending time in XML-RPC |
| 1402 | 1402 | |
| 1403 | - function iso8601_encode($time, $utc=0) |
|
| 1403 | + function iso8601_encode($time, $utc = 0) |
|
| 1404 | 1404 | { |
| 1405 | 1405 | if ($utc == 1) |
| 1406 | 1406 | { |
@@ -1,4 +1,6 @@ discard block |
||
| 1 | -<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); |
|
| 1 | +<?php if ( ! defined('BASEPATH')) { |
|
| 2 | + exit('No direct script access allowed'); |
|
| 3 | +} |
|
| 2 | 4 | /** |
| 3 | 5 | * CodeIgniter |
| 4 | 6 | * |
@@ -237,13 +239,11 @@ discard block |
||
| 237 | 239 | if (is_array($value[0])) |
| 238 | 240 | { |
| 239 | 241 | $temp = new XML_RPC_Values($value['0'], 'array'); |
| 240 | - } |
|
| 241 | - else |
|
| 242 | + } else |
|
| 242 | 243 | { |
| 243 | 244 | $temp = new XML_RPC_Values($value['0'], 'string'); |
| 244 | 245 | } |
| 245 | - } |
|
| 246 | - elseif (is_array($value['0']) && ($value['1'] == 'struct' OR $value['1'] == 'array')) |
|
| 246 | + } elseif (is_array($value['0']) && ($value['1'] == 'struct' OR $value['1'] == 'array')) |
|
| 247 | 247 | { |
| 248 | 248 | while (list($k) = each($value['0'])) |
| 249 | 249 | { |
@@ -251,13 +251,11 @@ discard block |
||
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | $temp = new XML_RPC_Values($value['0'], $value['1']); |
| 254 | - } |
|
| 255 | - else |
|
| 254 | + } else |
|
| 256 | 255 | { |
| 257 | 256 | $temp = new XML_RPC_Values($value['0'], $value['1']); |
| 258 | 257 | } |
| 259 | - } |
|
| 260 | - else |
|
| 258 | + } else |
|
| 261 | 259 | { |
| 262 | 260 | $temp = new XML_RPC_Values($value, 'string'); |
| 263 | 261 | } |
@@ -280,8 +278,7 @@ discard block |
||
| 280 | 278 | { |
| 281 | 279 | $this->error = $this->result->errstr; |
| 282 | 280 | return FALSE; |
| 283 | - } |
|
| 284 | - elseif ( ! is_object($this->result->val)) |
|
| 281 | + } elseif ( ! is_object($this->result->val)) |
|
| 285 | 282 | { |
| 286 | 283 | $this->error = $this->result->errstr; |
| 287 | 284 | return FALSE; |
@@ -443,14 +440,12 @@ discard block |
||
| 443 | 440 | // error |
| 444 | 441 | $this->errno = $code; |
| 445 | 442 | $this->errstr = htmlentities($fstr); |
| 446 | - } |
|
| 447 | - else if ( ! is_object($val)) |
|
| 443 | + } else if ( ! is_object($val)) |
|
| 448 | 444 | { |
| 449 | 445 | // programmer error, not an object |
| 450 | 446 | error_log("Invalid type '" . gettype($val) . "' (value: $val) passed to XML_RPC_Response. Defaulting to empty value."); |
| 451 | 447 | $this->val = new XML_RPC_Values(); |
| 452 | - } |
|
| 453 | - else |
|
| 448 | + } else |
|
| 454 | 449 | { |
| 455 | 450 | $this->val = $val; |
| 456 | 451 | } |
@@ -490,8 +485,7 @@ discard block |
||
| 490 | 485 | </struct> |
| 491 | 486 | </value> |
| 492 | 487 | </fault>'; |
| 493 | - } |
|
| 494 | - else |
|
| 488 | + } else |
|
| 495 | 489 | { |
| 496 | 490 | $result .= "<params>\n<param>\n" . |
| 497 | 491 | $this->val->serialize_class() . |
@@ -512,24 +506,21 @@ discard block |
||
| 512 | 506 | if (is_array($array[$key])) |
| 513 | 507 | { |
| 514 | 508 | $array[$key] = $this->decode($array[$key]); |
| 515 | - } |
|
| 516 | - else |
|
| 509 | + } else |
|
| 517 | 510 | { |
| 518 | 511 | $array[$key] = ($this->xss_clean) ? $CI->security->xss_clean($array[$key]) : $array[$key]; |
| 519 | 512 | } |
| 520 | 513 | } |
| 521 | 514 | |
| 522 | 515 | $result = $array; |
| 523 | - } |
|
| 524 | - else |
|
| 516 | + } else |
|
| 525 | 517 | { |
| 526 | 518 | $result = $this->xmlrpc_decoder($this->val); |
| 527 | 519 | |
| 528 | 520 | if (is_array($result)) |
| 529 | 521 | { |
| 530 | 522 | $result = $this->decode($result); |
| 531 | - } |
|
| 532 | - else |
|
| 523 | + } else |
|
| 533 | 524 | { |
| 534 | 525 | $result = ($this->xss_clean) ? $CI->security->xss_clean($result) : $result; |
| 535 | 526 | } |
@@ -551,8 +542,7 @@ discard block |
||
| 551 | 542 | if ($kind == 'scalar') |
| 552 | 543 | { |
| 553 | 544 | return $xmlrpc_val->scalarval(); |
| 554 | - } |
|
| 555 | - elseif ($kind == 'array') |
|
| 545 | + } elseif ($kind == 'array') |
|
| 556 | 546 | { |
| 557 | 547 | reset($xmlrpc_val->me); |
| 558 | 548 | list($a,$b) = each($xmlrpc_val->me); |
@@ -565,8 +555,7 @@ discard block |
||
| 565 | 555 | $arr[] = $this->xmlrpc_decoder($xmlrpc_val->me['array'][$i]); |
| 566 | 556 | } |
| 567 | 557 | return $arr; |
| 568 | - } |
|
| 569 | - elseif ($kind == 'struct') |
|
| 558 | + } elseif ($kind == 'struct') |
|
| 570 | 559 | { |
| 571 | 560 | reset($xmlrpc_val->me['struct']); |
| 572 | 561 | $arr = array(); |
@@ -764,8 +753,7 @@ discard block |
||
| 764 | 753 | |
| 765 | 754 | $r = new XML_RPC_Response(0, $this->xmlrpcerr['invalid_return'],$this->xmlrpcstr['invalid_return'].' '.$this->xh[$parser]['isf_reason']); |
| 766 | 755 | return $r; |
| 767 | - } |
|
| 768 | - elseif ( ! is_object($this->xh[$parser]['value'])) |
|
| 756 | + } elseif ( ! is_object($this->xh[$parser]['value'])) |
|
| 769 | 757 | { |
| 770 | 758 | $r = new XML_RPC_Response(0, $this->xmlrpcerr['invalid_return'],$this->xmlrpcstr['invalid_return'].' '.$this->xh[$parser]['isf_reason']); |
| 771 | 759 | return $r; |
@@ -815,8 +803,7 @@ discard block |
||
| 815 | 803 | } |
| 816 | 804 | |
| 817 | 805 | $r = new XML_RPC_Response($v, $errno, $errstr_v->scalarval()); |
| 818 | - } |
|
| 819 | - else |
|
| 806 | + } else |
|
| 820 | 807 | { |
| 821 | 808 | $r = new XML_RPC_Response($v); |
| 822 | 809 | } |
@@ -846,7 +833,9 @@ discard block |
||
| 846 | 833 | function open_tag($the_parser, $name, $attrs) |
| 847 | 834 | { |
| 848 | 835 | // If invalid nesting, then return |
| 849 | - if ($this->xh[$the_parser]['isf'] > 1) return; |
|
| 836 | + if ($this->xh[$the_parser]['isf'] > 1) { |
|
| 837 | + return; |
|
| 838 | + } |
|
| 850 | 839 | |
| 851 | 840 | // Evaluate and check for correct nesting of XML elements |
| 852 | 841 | |
@@ -858,8 +847,7 @@ discard block |
||
| 858 | 847 | $this->xh[$the_parser]['isf_reason'] = 'Top level XML-RPC element is missing'; |
| 859 | 848 | return; |
| 860 | 849 | } |
| 861 | - } |
|
| 862 | - else |
|
| 850 | + } else |
|
| 863 | 851 | { |
| 864 | 852 | // not top level element: see if parent is OK |
| 865 | 853 | if ( ! in_array($this->xh[$the_parser]['stack'][0], $this->valid_parents[$name], TRUE)) |
@@ -936,7 +924,9 @@ discard block |
||
| 936 | 924 | // Add current element name to stack, to allow validation of nesting |
| 937 | 925 | array_unshift($this->xh[$the_parser]['stack'], $name); |
| 938 | 926 | |
| 939 | - if ($name != 'VALUE') $this->xh[$the_parser]['lv'] = 0; |
|
| 927 | + if ($name != 'VALUE') { |
|
| 928 | + $this->xh[$the_parser]['lv'] = 0; |
|
| 929 | + } |
|
| 940 | 930 | } |
| 941 | 931 | // END |
| 942 | 932 | |
@@ -947,7 +937,9 @@ discard block |
||
| 947 | 937 | |
| 948 | 938 | function closing_tag($the_parser, $name) |
| 949 | 939 | { |
| 950 | - if ($this->xh[$the_parser]['isf'] > 1) return; |
|
| 940 | + if ($this->xh[$the_parser]['isf'] > 1) { |
|
| 941 | + return; |
|
| 942 | + } |
|
| 951 | 943 | |
| 952 | 944 | // Remove current element from stack and set variable |
| 953 | 945 | // NOTE: If the XML validates, then we do not have to worry about |
@@ -979,50 +971,42 @@ discard block |
||
| 979 | 971 | if ($name == 'STRING') |
| 980 | 972 | { |
| 981 | 973 | $this->xh[$the_parser]['value'] = $this->xh[$the_parser]['ac']; |
| 982 | - } |
|
| 983 | - elseif ($name=='DATETIME.ISO8601') |
|
| 974 | + } elseif ($name=='DATETIME.ISO8601') |
|
| 984 | 975 | { |
| 985 | 976 | $this->xh[$the_parser]['vt'] = $this->xmlrpcDateTime; |
| 986 | 977 | $this->xh[$the_parser]['value'] = $this->xh[$the_parser]['ac']; |
| 987 | - } |
|
| 988 | - elseif ($name=='BASE64') |
|
| 978 | + } elseif ($name=='BASE64') |
|
| 989 | 979 | { |
| 990 | 980 | $this->xh[$the_parser]['value'] = base64_decode($this->xh[$the_parser]['ac']); |
| 991 | - } |
|
| 992 | - elseif ($name=='BOOLEAN') |
|
| 981 | + } elseif ($name=='BOOLEAN') |
|
| 993 | 982 | { |
| 994 | 983 | // Translated BOOLEAN values to TRUE AND FALSE |
| 995 | 984 | if ($this->xh[$the_parser]['ac'] == '1') |
| 996 | 985 | { |
| 997 | 986 | $this->xh[$the_parser]['value'] = TRUE; |
| 998 | - } |
|
| 999 | - else |
|
| 987 | + } else |
|
| 1000 | 988 | { |
| 1001 | 989 | $this->xh[$the_parser]['value'] = FALSE; |
| 1002 | 990 | } |
| 1003 | - } |
|
| 1004 | - elseif ($name=='DOUBLE') |
|
| 991 | + } elseif ($name=='DOUBLE') |
|
| 1005 | 992 | { |
| 1006 | 993 | // we have a DOUBLE |
| 1007 | 994 | // we must check that only 0123456789-.<space> are characters here |
| 1008 | 995 | if ( ! preg_match('/^[+-]?[eE0-9\t \.]+$/', $this->xh[$the_parser]['ac'])) |
| 1009 | 996 | { |
| 1010 | 997 | $this->xh[$the_parser]['value'] = 'ERROR_NON_NUMERIC_FOUND'; |
| 1011 | - } |
|
| 1012 | - else |
|
| 998 | + } else |
|
| 1013 | 999 | { |
| 1014 | 1000 | $this->xh[$the_parser]['value'] = (double)$this->xh[$the_parser]['ac']; |
| 1015 | 1001 | } |
| 1016 | - } |
|
| 1017 | - else |
|
| 1002 | + } else |
|
| 1018 | 1003 | { |
| 1019 | 1004 | // we have an I4/INT |
| 1020 | 1005 | // we must check that only 0123456789-<space> are characters here |
| 1021 | 1006 | if ( ! preg_match('/^[+-]?[0-9\t ]+$/', $this->xh[$the_parser]['ac'])) |
| 1022 | 1007 | { |
| 1023 | 1008 | $this->xh[$the_parser]['value'] = 'ERROR_NON_NUMERIC_FOUND'; |
| 1024 | - } |
|
| 1025 | - else |
|
| 1009 | + } else |
|
| 1026 | 1010 | { |
| 1027 | 1011 | $this->xh[$the_parser]['value'] = (int)$this->xh[$the_parser]['ac']; |
| 1028 | 1012 | } |
@@ -1045,8 +1029,7 @@ discard block |
||
| 1045 | 1029 | { |
| 1046 | 1030 | // Array |
| 1047 | 1031 | $this->xh[$the_parser]['valuestack'][0]['values'][] = $temp; |
| 1048 | - } |
|
| 1049 | - else |
|
| 1032 | + } else |
|
| 1050 | 1033 | { |
| 1051 | 1034 | // Struct |
| 1052 | 1035 | $this->xh[$the_parser]['value'] = $temp; |
@@ -1091,7 +1074,10 @@ discard block |
||
| 1091 | 1074 | |
| 1092 | 1075 | function character_data($the_parser, $data) |
| 1093 | 1076 | { |
| 1094 | - if ($this->xh[$the_parser]['isf'] > 1) return; // XML Fault found already |
|
| 1077 | + if ($this->xh[$the_parser]['isf'] > 1) { |
|
| 1078 | + return; |
|
| 1079 | + } |
|
| 1080 | + // XML Fault found already |
|
| 1095 | 1081 | |
| 1096 | 1082 | // If a value has not been found |
| 1097 | 1083 | if ($this->xh[$the_parser]['lv'] != 3) |
@@ -1124,8 +1110,7 @@ discard block |
||
| 1124 | 1110 | if (is_array($array[$key])) |
| 1125 | 1111 | { |
| 1126 | 1112 | $array[$key] = $this->output_parameters($array[$key]); |
| 1127 | - } |
|
| 1128 | - else |
|
| 1113 | + } else |
|
| 1129 | 1114 | { |
| 1130 | 1115 | // 'bits' is for the MetaWeblog API image bits |
| 1131 | 1116 | // @todo - this needs to be made more general purpose |
@@ -1134,8 +1119,7 @@ discard block |
||
| 1134 | 1119 | } |
| 1135 | 1120 | |
| 1136 | 1121 | $parameters = $array; |
| 1137 | - } |
|
| 1138 | - else |
|
| 1122 | + } else |
|
| 1139 | 1123 | { |
| 1140 | 1124 | $parameters = array(); |
| 1141 | 1125 | |
@@ -1146,8 +1130,7 @@ discard block |
||
| 1146 | 1130 | if (is_array($a_param)) |
| 1147 | 1131 | { |
| 1148 | 1132 | $parameters[] = $this->output_parameters($a_param); |
| 1149 | - } |
|
| 1150 | - else |
|
| 1133 | + } else |
|
| 1151 | 1134 | { |
| 1152 | 1135 | $parameters[] = ($this->xss_clean) ? $CI->security->xss_clean($a_param) : $a_param; |
| 1153 | 1136 | } |
@@ -1165,8 +1148,7 @@ discard block |
||
| 1165 | 1148 | if ($kind == 'scalar') |
| 1166 | 1149 | { |
| 1167 | 1150 | return $param->scalarval(); |
| 1168 | - } |
|
| 1169 | - elseif ($kind == 'array') |
|
| 1151 | + } elseif ($kind == 'array') |
|
| 1170 | 1152 | { |
| 1171 | 1153 | reset($param->me); |
| 1172 | 1154 | list($a,$b) = each($param->me); |
@@ -1179,8 +1161,7 @@ discard block |
||
| 1179 | 1161 | } |
| 1180 | 1162 | |
| 1181 | 1163 | return $arr; |
| 1182 | - } |
|
| 1183 | - elseif ($kind == 'struct') |
|
| 1164 | + } elseif ($kind == 'struct') |
|
| 1184 | 1165 | { |
| 1185 | 1166 | reset($param->me['struct']); |
| 1186 | 1167 | |
@@ -1222,12 +1203,10 @@ discard block |
||
| 1222 | 1203 | if ($this->xmlrpcTypes[$type] == 1) |
| 1223 | 1204 | { |
| 1224 | 1205 | $this->addScalar($val,$type); |
| 1225 | - } |
|
| 1226 | - elseif ($this->xmlrpcTypes[$type] == 2) |
|
| 1206 | + } elseif ($this->xmlrpcTypes[$type] == 2) |
|
| 1227 | 1207 | { |
| 1228 | 1208 | $this->addArray($val); |
| 1229 | - } |
|
| 1230 | - elseif ($this->xmlrpcTypes[$type] == 3) |
|
| 1209 | + } elseif ($this->xmlrpcTypes[$type] == 3) |
|
| 1231 | 1210 | { |
| 1232 | 1211 | $this->addStruct($val); |
| 1233 | 1212 | } |
@@ -1255,8 +1234,7 @@ discard block |
||
| 1255 | 1234 | if (strcasecmp($val,'true')==0 OR $val==1 OR ($val==true && strcasecmp($val,'false'))) |
| 1256 | 1235 | { |
| 1257 | 1236 | $val = 1; |
| 1258 | - } |
|
| 1259 | - else |
|
| 1237 | + } else |
|
| 1260 | 1238 | { |
| 1261 | 1239 | $val=0; |
| 1262 | 1240 | } |
@@ -1268,8 +1246,7 @@ discard block |
||
| 1268 | 1246 | $ar = $this->me['array']; |
| 1269 | 1247 | $ar[] = new XML_RPC_Values($val, $type); |
| 1270 | 1248 | $this->me['array'] = $ar; |
| 1271 | - } |
|
| 1272 | - else |
|
| 1249 | + } else |
|
| 1273 | 1250 | { |
| 1274 | 1251 | // a scalar, so set the value and remember we're scalar |
| 1275 | 1252 | $this->me[$type] = $val; |
@@ -1405,13 +1382,13 @@ discard block |
||
| 1405 | 1382 | if ($utc == 1) |
| 1406 | 1383 | { |
| 1407 | 1384 | $t = strftime("%Y%m%dT%H:%i:%s", $time); |
| 1408 | - } |
|
| 1409 | - else |
|
| 1385 | + } else |
|
| 1410 | 1386 | { |
| 1411 | - if (function_exists('gmstrftime')) |
|
| 1412 | - $t = gmstrftime("%Y%m%dT%H:%i:%s", $time); |
|
| 1413 | - else |
|
| 1414 | - $t = strftime("%Y%m%dT%H:%i:%s", $time - date('Z')); |
|
| 1387 | + if (function_exists('gmstrftime')) { |
|
| 1388 | + $t = gmstrftime("%Y%m%dT%H:%i:%s", $time); |
|
| 1389 | + } else { |
|
| 1390 | + $t = strftime("%Y%m%dT%H:%i:%s", $time - date('Z')); |
|
| 1391 | + } |
|
| 1415 | 1392 | } |
| 1416 | 1393 | return $t; |
| 1417 | 1394 | } |