@@ -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 | * |
@@ -132,8 +134,7 @@ discard block |
||
| 132 | 134 | if (defined('ENVIRONMENT') AND is_file(APPPATH.'config/'.ENVIRONMENT.'/routes.php')) |
| 133 | 135 | { |
| 134 | 136 | include(APPPATH.'config/'.ENVIRONMENT.'/routes.php'); |
| 135 | - } |
|
| 136 | - elseif (is_file(APPPATH.'config/routes.php')) |
|
| 137 | + } elseif (is_file(APPPATH.'config/routes.php')) |
|
| 137 | 138 | { |
| 138 | 139 | include(APPPATH.'config/routes.php'); |
| 139 | 140 | } |
@@ -195,8 +196,7 @@ discard block |
||
| 195 | 196 | $this->set_class($x[0]); |
| 196 | 197 | $this->set_method($x[1]); |
| 197 | 198 | $this->_set_request($x); |
| 198 | - } |
|
| 199 | - else |
|
| 199 | + } else |
|
| 200 | 200 | { |
| 201 | 201 | $this->set_class($this->default_controller); |
| 202 | 202 | $this->set_method('index'); |
@@ -237,8 +237,7 @@ discard block |
||
| 237 | 237 | { |
| 238 | 238 | // A standard method request |
| 239 | 239 | $this->set_method($segments[1]); |
| 240 | - } |
|
| 241 | - else |
|
| 240 | + } else |
|
| 242 | 241 | { |
| 243 | 242 | // This lets the "routed" segment array identify that the default |
| 244 | 243 | // index method is being used. |
@@ -295,14 +294,12 @@ discard block |
||
| 295 | 294 | $this->set_method(isset($x[1]) ? $x[1] : 'index'); |
| 296 | 295 | |
| 297 | 296 | return $x; |
| 298 | - } |
|
| 299 | - else |
|
| 297 | + } else |
|
| 300 | 298 | { |
| 301 | 299 | show_404($this->fetch_directory().$segments[0]); |
| 302 | 300 | } |
| 303 | 301 | } |
| 304 | - } |
|
| 305 | - else |
|
| 302 | + } else |
|
| 306 | 303 | { |
| 307 | 304 | // Is the method being specified in the route? |
| 308 | 305 | if (strpos($this->default_controller, '/') !== FALSE) |
@@ -311,8 +308,7 @@ discard block |
||
| 311 | 308 | |
| 312 | 309 | $this->set_class($x[0]); |
| 313 | 310 | $this->set_method($x[1]); |
| 314 | - } |
|
| 315 | - else |
|
| 311 | + } else |
|
| 316 | 312 | { |
| 317 | 313 | $this->set_class($this->default_controller); |
| 318 | 314 | $this->set_method('index'); |
@@ -1,4 +1,6 @@ |
||
| 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 | * |
@@ -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 | * |
@@ -135,8 +137,7 @@ discard block |
||
| 135 | 137 | { |
| 136 | 138 | $this->_set_uri_string($this->_detect_uri()); |
| 137 | 139 | return; |
| 138 | - } |
|
| 139 | - elseif ($uri == 'CLI') |
|
| 140 | + } elseif ($uri == 'CLI') |
|
| 140 | 141 | { |
| 141 | 142 | $this->_set_uri_string($this->_parse_cli_args()); |
| 142 | 143 | return; |
@@ -163,7 +164,7 @@ discard block |
||
| 163 | 164 | $pos = strpos($str, "_json"); |
| 164 | 165 | if($pos > 0 && !isset($_SERVER['HTTP_X_REQUESTED_WITH'])){ |
| 165 | 166 | $this->uri_string = str_replace('_json', '', trim($str, '/')); |
| 166 | - }else{ |
|
| 167 | + } else{ |
|
| 167 | 168 | // If the URI contains only a slash we'll kill it |
| 168 | 169 | $this->uri_string = ($str == '/') ? '' : $str; |
| 169 | 170 | } |
@@ -192,8 +193,7 @@ discard block |
||
| 192 | 193 | if (strpos($uri, $_SERVER['SCRIPT_NAME']) === 0) |
| 193 | 194 | { |
| 194 | 195 | $uri = substr($uri, strlen($_SERVER['SCRIPT_NAME'])); |
| 195 | - } |
|
| 196 | - elseif (strpos($uri, dirname($_SERVER['SCRIPT_NAME'])) === 0) |
|
| 196 | + } elseif (strpos($uri, dirname($_SERVER['SCRIPT_NAME'])) === 0) |
|
| 197 | 197 | { |
| 198 | 198 | $uri = substr($uri, strlen(dirname($_SERVER['SCRIPT_NAME']))); |
| 199 | 199 | } |
@@ -210,8 +210,7 @@ discard block |
||
| 210 | 210 | { |
| 211 | 211 | $_SERVER['QUERY_STRING'] = $parts[1]; |
| 212 | 212 | parse_str($_SERVER['QUERY_STRING'], $_GET); |
| 213 | - } |
|
| 214 | - else |
|
| 213 | + } else |
|
| 215 | 214 | { |
| 216 | 215 | $_SERVER['QUERY_STRING'] = ''; |
| 217 | 216 | $_GET = array(); |
@@ -426,8 +425,7 @@ discard block |
||
| 426 | 425 | { |
| 427 | 426 | $total_segments = 'total_segments'; |
| 428 | 427 | $segment_array = 'segment_array'; |
| 429 | - } |
|
| 430 | - else |
|
| 428 | + } else |
|
| 431 | 429 | { |
| 432 | 430 | $total_segments = 'total_rsegments'; |
| 433 | 431 | $segment_array = 'rsegment_array'; |
@@ -468,8 +466,7 @@ discard block |
||
| 468 | 466 | if ($i % 2) |
| 469 | 467 | { |
| 470 | 468 | $retval[$lastval] = $seg; |
| 471 | - } |
|
| 472 | - else |
|
| 469 | + } else |
|
| 473 | 470 | { |
| 474 | 471 | $retval[$seg] = FALSE; |
| 475 | 472 | $lastval = $seg; |
@@ -565,8 +562,7 @@ discard block |
||
| 565 | 562 | if ($where == 'trailing') |
| 566 | 563 | { |
| 567 | 564 | $leading = ''; |
| 568 | - } |
|
| 569 | - elseif ($where == 'leading') |
|
| 565 | + } elseif ($where == 'leading') |
|
| 570 | 566 | { |
| 571 | 567 | $trailing = ''; |
| 572 | 568 | } |
@@ -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 | * |
@@ -695,8 +697,7 @@ discard block |
||
| 695 | 697 | $void = array_shift($this->_ci_helper_paths); |
| 696 | 698 | $void = array_shift($this->_ci_view_paths); |
| 697 | 699 | $void = array_shift($config->_config_paths); |
| 698 | - } |
|
| 699 | - else |
|
| 700 | + } else |
|
| 700 | 701 | { |
| 701 | 702 | $path = rtrim($path, '/').'/'; |
| 702 | 703 | foreach (array('_ci_library_paths', '_ci_model_paths', '_ci_helper_paths') as $var) |
@@ -753,8 +754,7 @@ discard block |
||
| 753 | 754 | { |
| 754 | 755 | $_ci_x = explode('/', $_ci_path); |
| 755 | 756 | $_ci_file = end($_ci_x); |
| 756 | - } |
|
| 757 | - else |
|
| 757 | + } else |
|
| 758 | 758 | { |
| 759 | 759 | $_ci_ext = pathinfo($_ci_view, PATHINFO_EXTENSION); |
| 760 | 760 | $_ci_file = ($_ci_ext == '') ? $_ci_view.'.php' : $_ci_view; |
@@ -827,8 +827,7 @@ discard block |
||
| 827 | 827 | if ((bool) @ini_get('short_open_tag') === FALSE AND config_item('rewrite_short_tags') == TRUE) |
| 828 | 828 | { |
| 829 | 829 | echo eval('?>'.preg_replace("/;*\s*\?>/", "; ?>", str_replace('<?=', '<?php echo ', file_get_contents($_ci_path)))); |
| 830 | - } |
|
| 831 | - else |
|
| 830 | + } else |
|
| 832 | 831 | { |
| 833 | 832 | include($_ci_path); // include() vs include_once() allows for multiple views with the same name |
| 834 | 833 | } |
@@ -856,8 +855,7 @@ discard block |
||
| 856 | 855 | if (ob_get_level() > $this->_ci_ob_level + 1) |
| 857 | 856 | { |
| 858 | 857 | ob_end_flush(); |
| 859 | - } |
|
| 860 | - else |
|
| 858 | + } else |
|
| 861 | 859 | { |
| 862 | 860 | $_ci_CI->output->append_output(ob_get_contents()); |
| 863 | 861 | @ob_end_clean(); |
@@ -1025,18 +1023,15 @@ discard block |
||
| 1025 | 1023 | { |
| 1026 | 1024 | include($path .'config/'.ENVIRONMENT.'/'.strtolower($class).'.php'); |
| 1027 | 1025 | break; |
| 1028 | - } |
|
| 1029 | - elseif (defined('ENVIRONMENT') AND file_exists($path .'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php')) |
|
| 1026 | + } elseif (defined('ENVIRONMENT') AND file_exists($path .'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php')) |
|
| 1030 | 1027 | { |
| 1031 | 1028 | include($path .'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php'); |
| 1032 | 1029 | break; |
| 1033 | - } |
|
| 1034 | - elseif (file_exists($path .'config/'.strtolower($class).'.php')) |
|
| 1030 | + } elseif (file_exists($path .'config/'.strtolower($class).'.php')) |
|
| 1035 | 1031 | { |
| 1036 | 1032 | include($path .'config/'.strtolower($class).'.php'); |
| 1037 | 1033 | break; |
| 1038 | - } |
|
| 1039 | - elseif (file_exists($path .'config/'.ucfirst(strtolower($class)).'.php')) |
|
| 1034 | + } elseif (file_exists($path .'config/'.ucfirst(strtolower($class)).'.php')) |
|
| 1040 | 1035 | { |
| 1041 | 1036 | include($path .'config/'.ucfirst(strtolower($class)).'.php'); |
| 1042 | 1037 | break; |
@@ -1050,17 +1045,14 @@ discard block |
||
| 1050 | 1045 | if (class_exists('CI_'.$class)) |
| 1051 | 1046 | { |
| 1052 | 1047 | $name = 'CI_'.$class; |
| 1053 | - } |
|
| 1054 | - elseif (class_exists(config_item('subclass_prefix').$class)) |
|
| 1048 | + } elseif (class_exists(config_item('subclass_prefix').$class)) |
|
| 1055 | 1049 | { |
| 1056 | 1050 | $name = config_item('subclass_prefix').$class; |
| 1057 | - } |
|
| 1058 | - else |
|
| 1051 | + } else |
|
| 1059 | 1052 | { |
| 1060 | 1053 | $name = $class; |
| 1061 | 1054 | } |
| 1062 | - } |
|
| 1063 | - else |
|
| 1055 | + } else |
|
| 1064 | 1056 | { |
| 1065 | 1057 | $name = $prefix.$class; |
| 1066 | 1058 | } |
@@ -1079,8 +1071,7 @@ discard block |
||
| 1079 | 1071 | if (is_null($object_name)) |
| 1080 | 1072 | { |
| 1081 | 1073 | $classvar = ( ! isset($this->_ci_varmap[$class])) ? $class : $this->_ci_varmap[$class]; |
| 1082 | - } |
|
| 1083 | - else |
|
| 1074 | + } else |
|
| 1084 | 1075 | { |
| 1085 | 1076 | $classvar = $object_name; |
| 1086 | 1077 | } |
@@ -1093,8 +1084,7 @@ discard block |
||
| 1093 | 1084 | if ($config !== NULL) |
| 1094 | 1085 | { |
| 1095 | 1086 | $CI->$classvar = new $name($config); |
| 1096 | - } |
|
| 1097 | - else |
|
| 1087 | + } else |
|
| 1098 | 1088 | { |
| 1099 | 1089 | $CI->$classvar = new $name; |
| 1100 | 1090 | } |
@@ -1116,8 +1106,7 @@ discard block |
||
| 1116 | 1106 | if (defined('ENVIRONMENT') AND file_exists(APPPATH.'config/'.ENVIRONMENT.'/autoload.php')) |
| 1117 | 1107 | { |
| 1118 | 1108 | include(APPPATH.'config/'.ENVIRONMENT.'/autoload.php'); |
| 1119 | - } |
|
| 1120 | - else |
|
| 1109 | + } else |
|
| 1121 | 1110 | { |
| 1122 | 1111 | include(APPPATH.'config/autoload.php'); |
| 1123 | 1112 | } |
@@ -1231,8 +1220,7 @@ discard block |
||
| 1231 | 1220 | if ( ! is_array($filename)) |
| 1232 | 1221 | { |
| 1233 | 1222 | return array(strtolower(str_replace('.php', '', str_replace($extension, '', $filename)).$extension)); |
| 1234 | - } |
|
| 1235 | - else |
|
| 1223 | + } else |
|
| 1236 | 1224 | { |
| 1237 | 1225 | foreach ($filename as $key => $val) |
| 1238 | 1226 | { |
@@ -1,4 +1,6 @@ |
||
| 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 | * |
@@ -1,4 +1,6 @@ |
||
| 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 | * |
@@ -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 | * |
@@ -58,13 +60,11 @@ discard block |
||
| 58 | 60 | { |
| 59 | 61 | define('MB_ENABLED', TRUE); |
| 60 | 62 | mb_internal_encoding('UTF-8'); |
| 61 | - } |
|
| 62 | - else |
|
| 63 | + } else |
|
| 63 | 64 | { |
| 64 | 65 | define('MB_ENABLED', FALSE); |
| 65 | 66 | } |
| 66 | - } |
|
| 67 | - else |
|
| 67 | + } else |
|
| 68 | 68 | { |
| 69 | 69 | log_message('debug', "UTF-8 Support Disabled"); |
| 70 | 70 | define('UTF8_ENABLED', FALSE); |
@@ -127,12 +127,10 @@ discard block |
||
| 127 | 127 | if (function_exists('iconv')) |
| 128 | 128 | { |
| 129 | 129 | $str = @iconv($encoding, 'UTF-8', $str); |
| 130 | - } |
|
| 131 | - elseif (function_exists('mb_convert_encoding')) |
|
| 130 | + } elseif (function_exists('mb_convert_encoding')) |
|
| 132 | 131 | { |
| 133 | 132 | $str = @mb_convert_encoding($str, 'UTF-8', $encoding); |
| 134 | - } |
|
| 135 | - else |
|
| 133 | + } else |
|
| 136 | 134 | { |
| 137 | 135 | return FALSE; |
| 138 | 136 | } |
@@ -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 | } |
@@ -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 | * |
@@ -95,8 +97,7 @@ discard block |
||
| 95 | 97 | if (is_array($val)) |
| 96 | 98 | { |
| 97 | 99 | $template = $this->_parse_pair($key, $val, $template); |
| 98 | - } |
|
| 99 | - else |
|
| 100 | + } else |
|
| 100 | 101 | { |
| 101 | 102 | $template = $this->_parse_single($key, (string)$val, $template); |
| 102 | 103 | } |
@@ -172,8 +173,7 @@ discard block |
||
| 172 | 173 | if ( ! is_array($val)) |
| 173 | 174 | { |
| 174 | 175 | $temp = $this->_parse_single($key, $val, $temp); |
| 175 | - } |
|
| 176 | - else |
|
| 176 | + } else |
|
| 177 | 177 | { |
| 178 | 178 | $temp = $this->_parse_pair($key, $val, $temp); |
| 179 | 179 | } |