| [ PHPXref.com ] | [ Generated: Sun Jul 20 19:31:32 2008 ] | [ phpAdsNew 2.0.8 ] |
| [ Index ] [ Variables ] [ Functions ] [ Classes ] [ Constants ] [ Statistics ] | ||
[Summary view] [Print] [Text view]
1 <?php // $Revision: 2.0.2.8 $ 2 3 /************************************************************************/ 4 /* phpAdsNew */ 5 /* ========= */ 6 /* */ 7 /* Copyright (c) 1999,2000,2001 Edd Dumbill */ 8 /* For more information visit: http://www.phpadsnew.com */ 9 /************************************************************************/ 10 11 12 13 /*********************************************************/ 14 /* XML-RPC client code */ 15 /*********************************************************/ 16 17 // Copyright (c) 1999,2000,2002 Edd Dumbill. 18 // All rights reserved. 19 // 20 // Redistribution and use in source and binary forms, with or without 21 // modification, are permitted provided that the following conditions 22 // are met: 23 // 24 // * Redistributions of source code must retain the above copyright 25 // notice, this list of conditions and the following disclaimer. 26 // 27 // * Redistributions in binary form must reproduce the above 28 // copyright notice, this list of conditions and the following 29 // disclaimer in the documentation and/or other materials provided 30 // with the distribution. 31 // 32 // * Neither the name of the "XML-RPC for PHP" nor the names of its 33 // contributors may be used to endorse or promote products derived 34 // from this software without specific prior written permission. 35 // 36 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 37 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 38 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 39 // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 40 // REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 41 // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 42 // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 43 // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 44 // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 45 // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 46 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 47 // OF THE POSSIBILITY OF SUCH DAMAGE. 48 49 // Disabled automatic loading of library. 50 // Niels Leenheer <niels@creatype.nl 51 /* 52 if (!function_exists('xml_parser_create')) { 53 // Win 32 fix. From: "Leo West" <lwest@imaginet.fr> 54 if($WINDIR) { 55 dl("php3_xml.dll"); 56 } else { 57 dl("xml.so"); 58 } 59 } 60 */ 61 62 // G. Giunta 2005/01/29: declare global these variables, 63 // so that xmlrpc.inc will work even if included from within a function 64 // NB: it will give warnings in PHP3, so we comment it out 65 // Milosch: Next round, maybe we should explicitly request these via $GLOBALS where used. 66 if (phpversion() >= '4') 67 { 68 global $xmlrpcI4; 69 global $xmlrpcInt; 70 global $xmlrpcDouble; 71 global $xmlrpcBoolean; 72 global $xmlrpcString; 73 global $xmlrpcDateTime; 74 global $xmlrpcBase64; 75 global $xmlrpcArray; 76 global $xmlrpcStruct; 77 78 global $xmlrpcTypes; 79 global $xmlrpc_valid_parents; 80 global $xmlEntities; 81 global $xmlrpcerr; 82 global $xmlrpcstr; 83 global $xmlrpc_defencoding; 84 global $xmlrpc_internalencoding; 85 global $xmlrpcName; 86 global $xmlrpcVersion; 87 global $xmlrpcerruser; 88 global $xmlrpcerrxml; 89 global $xmlrpc_backslash; 90 global $_xh; 91 } 92 $xmlrpcI4='i4'; 93 $xmlrpcInt='int'; 94 $xmlrpcBoolean='boolean'; 95 $xmlrpcDouble='double'; 96 $xmlrpcString='string'; 97 $xmlrpcDateTime='dateTime.iso8601'; 98 $xmlrpcBase64='base64'; 99 $xmlrpcArray='array'; 100 $xmlrpcStruct='struct'; 101 102 $xmlrpcTypes=array( 103 $xmlrpcI4 => 1, 104 $xmlrpcInt => 1, 105 $xmlrpcBoolean => 1, 106 $xmlrpcString => 1, 107 $xmlrpcDouble => 1, 108 $xmlrpcDateTime => 1, 109 $xmlrpcBase64 => 1, 110 $xmlrpcArray => 2, 111 $xmlrpcStruct => 3 112 ); 113 114 $xmlrpc_valid_parents = array( 115 'BOOLEAN' => array('VALUE'), 116 'I4' => array('VALUE'), 117 'INT' => array('VALUE'), 118 'STRING' => array('VALUE'), 119 'DOUBLE' => array('VALUE'), 120 'DATETIME.ISO8601' => array('VALUE'), 121 'BASE64' => array('VALUE'), 122 'ARRAY' => array('VALUE'), 123 'STRUCT' => array('VALUE'), 124 'PARAM' => array('PARAMS'), 125 'METHODNAME' => array('METHODCALL'), 126 'PARAMS' => array('METHODCALL', 'METHODRESPONSE'), 127 'MEMBER' => array('STRUCT'), 128 'NAME' => array('MEMBER'), 129 'DATA' => array('ARRAY'), 130 'FAULT' => array('METHODRESPONSE'), 131 'VALUE' => array('MEMBER', 'DATA', 'PARAM', 'FAULT'), 132 ); 133 134 $xmlEntities=array( 135 'amp' => '&', 136 'quot' => '"', 137 'lt' => '<', 138 'gt' => '>', 139 'apos' => "'" 140 ); 141 142 $xmlrpcerr['unknown_method']=1; 143 $xmlrpcstr['unknown_method']='Unknown method'; 144 $xmlrpcerr['invalid_return']=2; 145 $xmlrpcstr['invalid_return']='Invalid return payload: enable debugging to examine incoming payload'; 146 $xmlrpcerr['incorrect_params']=3; 147 $xmlrpcstr['incorrect_params']='Incorrect parameters passed to method'; 148 $xmlrpcerr['introspect_unknown']=4; 149 $xmlrpcstr['introspect_unknown']="Can't introspect: method unknown"; 150 $xmlrpcerr['http_error']=5; 151 $xmlrpcstr['http_error']="Didn't receive 200 OK from remote server."; 152 $xmlrpcerr['no_data']=6; 153 $xmlrpcstr['no_data']='No data received from server.'; 154 $xmlrpcerr['no_ssl']=7; 155 $xmlrpcstr['no_ssl']='No SSL support compiled in.'; 156 $xmlrpcerr['curl_fail']=8; 157 $xmlrpcstr['curl_fail']='CURL error'; 158 $xmlrpcerr['invalid_request']=15; 159 $xmlrpcstr['invalid_request']='Invalid request payload'; 160 161 $xmlrpcerr['multicall_notstruct'] = 9; 162 $xmlrpcstr['multicall_notstruct'] = 'system.multicall expected struct'; 163 $xmlrpcerr['multicall_nomethod'] = 10; 164 $xmlrpcstr['multicall_nomethod'] = 'missing methodName'; 165 $xmlrpcerr['multicall_notstring'] = 11; 166 $xmlrpcstr['multicall_notstring'] = 'methodName is not a string'; 167 $xmlrpcerr['multicall_recursion'] = 12; 168 $xmlrpcstr['multicall_recursion'] = 'recursive system.multicall forbidden'; 169 $xmlrpcerr['multicall_noparams'] = 13; 170 $xmlrpcstr['multicall_noparams'] = 'missing params'; 171 $xmlrpcerr['multicall_notarray'] = 14; 172 $xmlrpcstr['multicall_notarray'] = 'params is not an array'; 173 174 // The charset encoding expected by the server for received messages and 175 // by the client for received responses 176 $xmlrpc_defencoding='UTF-8'; 177 // The encoding used by PHP. 178 // String values received will be converted to this. 179 $xmlrpc_internalencoding='ISO-8859-1'; 180 181 $xmlrpcName='XML-RPC for PHP'; 182 $xmlrpcVersion='1.2'; 183 184 // let user errors start at 800 185 $xmlrpcerruser=800; 186 // let XML parse errors start at 100 187 $xmlrpcerrxml=100; 188 189 // formulate backslashes for escaping regexp 190 $xmlrpc_backslash=chr(92).chr(92); 191 192 // used to store state during parsing 193 // quick explanation of components: 194 // ac - used to accumulate values 195 // isf - used to indicate a fault 196 // lv - used to indicate "looking for a value": implements 197 // the logic to allow values with no types to be strings 198 // params - used to store parameters in method calls 199 // method - used to store method name 200 // stack - array with genealogy of xml elements names: 201 // used to validate nesting of xmlrpc elements 202 203 $_xh=array(); 204 205 /** 206 * To help correct communication of non-ascii chars inside strings, regardless 207 * of the charset used when sending requests, parsing them, sending responses 208 * and parsing responses, convert all non-ascii chars present in the message 209 * into their equivalent 'charset entity'. Charset entities enumerated this way 210 * are independent of the charset encoding used to transmit them, and all XML 211 * parsers are bound to understand them. 212 */ 213 function xmlrpc_entity_decode($string) 214 { 215 $top=split('&', $string); 216 $op=''; 217 $i=0; 218 while($i<sizeof($top)) 219 { 220 if (ereg("^([#a-zA-Z0-9]+);", $top[$i], $regs)) 221 { 222 $op.=ereg_replace("^[#a-zA-Z0-9]+;", 223 xmlrpc_lookup_entity($regs[1]), 224 $top[$i]); 225 } 226 else 227 { 228 if ($i==0) 229 { 230 $op=$top[$i]; 231 } 232 else 233 { 234 $op.='&' . $top[$i]; 235 } 236 } 237 $i++; 238 } 239 return $op; 240 } 241 242 function xmlrpc_lookup_entity($ent) 243 { 244 global $xmlEntities; 245 246 if (isset($xmlEntities[strtolower($ent)])) 247 { 248 return $xmlEntities[strtolower($ent)]; 249 } 250 if (ereg("^#([0-9]+)$", $ent, $regs)) 251 { 252 return chr($regs[1]); 253 } 254 return '?'; 255 } 256 257 /** 258 * These entities originate from HTML specs (1.1, proposed 2.0, etc), 259 * and are taken directly from php-4.3.1/ext/mbstring/html_entities.c. 260 * Until php provides functionality to translate these entities in its 261 * core library, use this function. 262 */ 263 function xmlrpc_html_entity_xlate($data = '') 264 { 265 $entities = array( 266 " " => " ", 267 "¡" => "¡", 268 "¢" => "¢", 269 "£" => "£", 270 "¤" => "¤", 271 "¥" => "¥", 272 "¦" => "¦", 273 "§" => "§", 274 "¨" => "¨", 275 "©" => "©", 276 "ª" => "ª", 277 "«" => "«", 278 "¬" => "¬", 279 "­" => "­", 280 "®" => "®", 281 "¯" => "¯", 282 "°" => "°", 283 "±" => "±", 284 "²" => "²", 285 "³" => "³", 286 "´" => "´", 287 "µ" => "µ", 288 "¶" => "¶", 289 "·" => "·", 290 "¸" => "¸", 291 "¹" => "¹", 292 "º" => "º", 293 "»" => "»", 294 "¼" => "¼", 295 "½" => "½", 296 "¾" => "¾", 297 "¿" => "¿", 298 "À" => "À", 299 "Á" => "Á", 300 "Â" => "Â", 301 "Ã" => "Ã", 302 "Ä" => "Ä", 303 "Å" => "Å", 304 "Æ" => "Æ", 305 "Ç" => "Ç", 306 "È" => "È", 307 "É" => "É", 308 "Ê" => "Ê", 309 "Ë" => "Ë", 310 "Ì" => "Ì", 311 "Í" => "Í", 312 "Î" => "Î", 313 "Ï" => "Ï", 314 "Ð" => "Ð", 315 "Ñ" => "Ñ", 316 "Ò" => "Ò", 317 "Ó" => "Ó", 318 "Ô" => "Ô", 319 "Õ" => "Õ", 320 "Ö" => "Ö", 321 "×" => "×", 322 "Ø" => "Ø", 323 "Ù" => "Ù", 324 "Ú" => "Ú", 325 "Û" => "Û", 326 "Ü" => "Ü", 327 "Ý" => "Ý", 328 "Þ" => "Þ", 329 "ß" => "ß", 330 "à" => "à", 331 "á" => "á", 332 "â" => "â", 333 "ã" => "ã", 334 "ä" => "ä", 335 "å" => "å", 336 "æ" => "æ", 337 "ç" => "ç", 338 "è" => "è", 339 "é" => "é", 340 "ê" => "ê", 341 "ë" => "ë", 342 "ì" => "ì", 343 "í" => "í", 344 "î" => "î", 345 "ï" => "ï", 346 "ð" => "ð", 347 "ñ" => "ñ", 348 "ò" => "ò", 349 "ó" => "ó", 350 "ô" => "ô", 351 "õ" => "õ", 352 "ö" => "ö", 353 "÷" => "÷", 354 "ø" => "ø", 355 "ù" => "ù", 356 "ú" => "ú", 357 "û" => "û", 358 "ü" => "ü", 359 "ý" => "ý", 360 "þ" => "þ", 361 "ÿ" => "ÿ", 362 "Œ" => "Œ", 363 "œ" => "œ", 364 "Š" => "Š", 365 "š" => "š", 366 "Ÿ" => "Ÿ", 367 "ƒ" => "ƒ", 368 "ˆ" => "ˆ", 369 "˜" => "˜", 370 "Α" => "Α", 371 "Β" => "Β", 372 "Γ" => "Γ", 373 "Δ" => "Δ", 374 "Ε" => "Ε", 375 "Ζ" => "Ζ", 376 "Η" => "Η", 377 "Θ" => "Θ", 378 "Ι" => "Ι", 379 "Κ" => "Κ", 380 "Λ" => "Λ", 381 "Μ" => "Μ", 382 "Ν" => "Ν", 383 "Ξ" => "Ξ", 384 "Ο" => "Ο", 385 "Π" => "Π", 386 "Ρ" => "Ρ", 387 "Σ" => "Σ", 388 "Τ" => "Τ", 389 "Υ" => "Υ", 390 "Φ" => "Φ", 391 "Χ" => "Χ", 392 "Ψ" => "Ψ", 393 "Ω" => "Ω", 394 "β" => "β", 395 "γ" => "γ", 396 "δ" => "δ", 397 "ε" => "ε", 398 "ζ" => "ζ", 399 "η" => "η", 400 "θ" => "θ", 401 "ι" => "ι", 402 "κ" => "κ", 403 "λ" => "λ", 404 "μ" => "μ", 405 "ν" => "ν", 406 "ξ" => "ξ", 407 "ο" => "ο", 408 "π" => "π", 409 "ρ" => "ρ", 410 "ς" => "ς", 411 "σ" => "σ", 412 "τ" => "τ", 413 "υ" => "υ", 414 "φ" => "φ", 415 "χ" => "χ", 416 "ψ" => "ψ", 417 "ω" => "ω", 418 "ϑ" => "ϑ", 419 "ϒ" => "ϒ", 420 "ϖ" => "ϖ", 421 " " => " ", 422 " " => " ", 423 " " => " ", 424 "‌" => "‌", 425 "‍" => "‍", 426 "‎" => "‎", 427 "‏" => "‏", 428 "–" => "–", 429 "—" => "—", 430 "‘" => "‘", 431 "’" => "’", 432 "‚" => "‚", 433 "“" => "“", 434 "”" => "”", 435 "„" => "„", 436 "†" => "†", 437 "‡" => "‡", 438 "•" => "•", 439 "…" => "…", 440 "‰" => "‰", 441 "′" => "′", 442 "″" => "″", 443 "‹" => "‹", 444 "›" => "›", 445 "‾" => "‾", 446 "⁄" => "⁄", 447 "€" => "€", 448 "℘" => "℘", 449 "ℑ" => "ℑ", 450 "ℜ" => "ℜ", 451 "™" => "™", 452 "ℵ" => "ℵ", 453 "←" => "←", 454 "↑" => "↑", 455 "→" => "→", 456 "↓" => "↓", 457 "↔" => "↔", 458 "↵" => "↵", 459 "⇐" => "⇐", 460 "⇑" => "⇑", 461 "⇒" => "⇒", 462 "⇓" => "⇓", 463 "⇔" => "⇔", 464 "∀" => "∀", 465 "∂" => "∂", 466 "∃" => "∃", 467 "∅" => "∅", 468 "∇" => "∇", 469 "∈" => "∈", 470 "∉" => "∉", 471 "∋" => "∋", 472 "∏" => "∏", 473 "∑" => "∑", 474 "−" => "−", 475 "∗" => "∗", 476 "√" => "√", 477 "∝" => "∝", 478 "∞" => "∞", 479 "∠" => "∠", 480 "∧" => "∧", 481 "∨" => "∨", 482 "∩" => "∩", 483 "∪" => "∪", 484 "∫" => "∫", 485 "∴" => "∴", 486 "∼" => "∼", 487 "≅" => "≅", 488 "≈" => "≈", 489 "≠" => "≠", 490 "≡" => "≡", 491 "≤" => "≤", 492 "≥" => "≥", 493 "⊂" => "⊂", 494 "⊃" => "⊃", 495 "⊄" => "⊄", 496 "⊆" => "⊆", 497 "⊇" => "⊇", 498 "⊕" => "⊕", 499 "⊗" => "⊗", 500 "⊥" => "⊥", 501 "⋅" => "⋅", 502 "⌈" => "⌈", 503 "⌉" => "⌉", 504 "⌊" => "⌊", 505 "⌋" => "⌋", 506 "⟨" => "〈", 507 "⟩" => "〉", 508 "◊" => "◊", 509 "♠" => "♠", 510 "♣" => "♣", 511 "♥" => "♥", 512 "♦" => "♦"); 513 return strtr($data, $entities); 514 } 515 516 function xmlrpc_encode_entitites($data) 517 { 518 $length = strlen($data); 519 $escapeddata = ""; 520 for($position = 0; $position < $length; $position++) 521 { 522 $character = substr($data, $position, 1); 523 $code = Ord($character); 524 switch($code) { 525 case 34: 526 $character = """; 527 break; 528 case 38: 529 $character = "&"; 530 break; 531 case 39: 532 $character = "'"; 533 break; 534 case 60: 535 $character = "<"; 536 break; 537 case 62: 538 $character = ">"; 539 break; 540 default: 541 if ($code < 32 || $code > 159) 542 $character = ("&#".strval($code).";"); 543 break; 544 } 545 $escapeddata .= $character; 546 } 547 return $escapeddata; 548 } 549 550 function xmlrpc_se($parser, $name, $attrs) 551 { 552 global $_xh, $xmlrpcDateTime, $xmlrpcString, $xmlrpc_valid_parents; 553 554 // if invalid xmlrpc already detected, skip all processing 555 if ($_xh[$parser]['isf'] < 2) 556 { 557 558 // check for correct element nesting 559 // top level element can only be of 2 types 560 if (count($_xh[$parser]['stack']) == 0) 561 { 562 if ($name != 'METHODRESPONSE' && $name != 'METHODCALL') 563 { 564 $_xh[$parser]['isf'] = 2; 565 $_xh[$parser]['isf_reason'] = 'missing top level xmlrpc element'; 566 return; 567 } 568 } 569 else 570 { 571 // not top level element: see if parent is OK 572 if (!in_array($_xh[$parser]['stack'][0], $xmlrpc_valid_parents[$name])) 573 { 574 $_xh[$parser]['isf'] = 2; 575 $_xh[$parser]['isf_reason'] = "xmlrpc element $name cannot be child of {$_xh[$parser]['stack'][0]}"; 576 return; 577 } 578 } 579 580 switch($name) 581 { 582 case 'STRUCT': 583 case 'ARRAY': 584 //$_xh[$parser]['st'].='array('; 585 //$_xh[$parser]['cm']++; 586 // this last line turns quoting off 587 // this means if we get an empty array we'll 588 // simply get a bit of whitespace in the eval 589 //$_xh[$parser]['qt']=0; 590 591 // create an empty array to hold child values, and push it onto appropriate stack 592 $cur_val = array(); 593 $cur_val['values'] = array(); 594 $cur_val['type'] = $name; 595 array_unshift($_xh[$parser]['valuestack'], $cur_val); 596 break; 597 case 'METHODNAME': 598 case 'NAME': 599 //$_xh[$parser]['st'].='"'; 600 $_xh[$parser]['ac']=''; 601 break; 602 case 'FAULT': 603 $_xh[$parser]['isf']=1; 604 break; 605 case 'PARAM': 606 //$_xh[$parser]['st']=''; 607 // clear value, so we can check later if no value will passed for this param/member 608 $_xh[$parser]['value']=null; 609 break; 610 case 'VALUE': 611 //$_xh[$parser]['st'].='new xmlrpcval('; 612 // look for a value: if this is still true by the 613 // time we reach the end tag for value then the type is string 614 // by implication 615 $_xh[$parser]['vt']='value'; 616 $_xh[$parser]['ac']=''; 617 //$_xh[$parser]['qt']=0; 618 $_xh[$parser]['lv']=1; 619 break; 620 case 'I4': 621 case 'INT': 622 case 'STRING': 623 case 'BOOLEAN': 624 case 'DOUBLE': 625 case 'DATETIME.ISO8601': 626 case 'BASE64': 627 if ($_xh[$parser]['vt']!='value') 628 { 629 //two data elements inside a value: an error occurred! 630 $_xh[$parser]['isf'] = 2; 631 $_xh[$parser]['isf_reason'] = "$name element following a {$_xh[$parser]['vt']} element inside a single value"; 632 return; 633 } 634 635 // reset the accumulator 636 $_xh[$parser]['ac']=''; 637 638 /*if ($name=='DATETIME.ISO8601' || $name=='STRING') 639 { 640 $_xh[$parser]['qt']=1; 641 if ($name=='DATETIME.ISO8601') 642 { 643 $_xh[$parser]['vt']=$xmlrpcDateTime; 644 } 645 } 646 elseif ($name=='BASE64') 647 { 648 $_xh[$parser]['qt']=2; 649 } 650 else 651 { 652 // No quoting is required here -- but 653 // at the end of the element we must check 654 // for data format errors. 655 $_xh[$parser]['qt']=0; 656 }*/ 657 break; 658 case 'MEMBER': 659 //$_xh[$parser]['ac']=''; 660 // avoid warnings later on if no NAME is found before VALUE inside 661 // a struct member predefining member name as NULL 662 $_xh[$parser]['valuestack'][0]['name'] = ''; 663 // clear value, so we can check later if no value will passed for this param/member 664 $_xh[$parser]['value']=null; 665 break; 666 case 'DATA': 667 case 'METHODCALL': 668 case 'METHODRESPONSE': 669 case 'PARAMS': 670 // valid elements that add little to processing 671 break; 672 default: 673 /// INVALID ELEMENT: RAISE ISF so that it is later recognized!!! 674 $_xh[$parser]['isf'] = 2; 675 $_xh[$parser]['isf_reason'] = "found not-xmlrpc xml element $name"; 676 break; 677 } 678 679 // Save current element name to stack, to validate nesting 680 array_unshift($_xh[$parser]['stack'], $name); 681 682 if ($name!='VALUE') 683 { 684 $_xh[$parser]['lv']=0; 685 } 686 } 687 } 688 689 function xmlrpc_ee($parser, $name) 690 { 691 global $_xh,$xmlrpcTypes,$xmlrpcString,$xmlrpcDateTime; 692 693 if ($_xh[$parser]['isf'] < 2) 694 { 695 696 // push this element name from stack 697 // NB: if XML validates, correct opening/closing is guaranteed and 698 // we do not have to check for $name == $curr_elem. 699 // we also checked for proper nesting at start of elements... 700 $curr_elem = array_shift($_xh[$parser]['stack']); 701 702 switch($name) 703 { 704 case 'STRUCT': 705 case 'ARRAY': 706 //if ($_xh[$parser]['cm'] && substr($_xh[$parser]['st'], -1) ==',') 707 //{ 708 // $_xh[$parser]['st']=substr($_xh[$parser]['st'],0,-1); 709 //} 710 //$_xh[$parser]['st'].=')'; 711 712 // fetch out of stack array of values, and promote it to current value 713 $cur_val = array_shift($_xh[$parser]['valuestack']); 714 $_xh[$parser]['value'] = $cur_val['values']; 715 716 $_xh[$parser]['vt']=strtolower($name); 717 //$_xh[$parser]['cm']--; 718 break; 719 case 'NAME': 720 //$_xh[$parser]['st'].= $_xh[$parser]['ac'] . '" => '; 721 $_xh[$parser]['valuestack'][0]['name'] = $_xh[$parser]['ac']; 722 break; 723 case 'BOOLEAN': 724 case 'I4': 725 case 'INT': 726 case 'STRING': 727 case 'DOUBLE': 728 case 'DATETIME.ISO8601': 729 case 'BASE64': 730 $_xh[$parser]['vt']=strtolower($name); 731 //if ($_xh[$parser]['qt']==1) 732 if ($name=='STRING') 733 { 734 // we use double quotes rather than single so backslashification works OK 735 //$_xh[$parser]['st'].='"'. $_xh[$parser]['ac'] . '"'; 736 $_xh[$parser]['value']=$_xh[$parser]['ac']; 737 } 738 elseif ($name=='DATETIME.ISO8601') 739 { 740 $_xh[$parser]['vt']=$xmlrpcDateTime; 741 $_xh[$parser]['value']=$_xh[$parser]['ac']; 742 } 743 elseif ($name=='BASE64') 744 { 745 //$_xh[$parser]['st'].='base64_decode("'. $_xh[$parser]['ac'] . '")'; 746 747 ///@todo check for failure of base64 decoding / catch warnings 748 $_xh[$parser]['value']=base64_decode($_xh[$parser]['ac']); 749 } 750 elseif ($name=='BOOLEAN') 751 { 752 // special case here: we translate boolean 1 or 0 into PHP 753 // constants true or false 754 // NB: this simple checks helps a lot sanitizing input, ie no 755 // security problems around here 756 if ($_xh[$parser]['ac']=='1') 757 { 758 //$_xh[$parser]['ac']='true'; 759 $_xh[