cvs: php4 /pear/XML RPC.php /pear/XML/RPC Server.php

From: Date: Fri, 20 Apr 2001 12:47:32 +0000
Subject: cvs: php4 /pear/XML RPC.php /pear/XML/RPC Server.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-62@lists.php.net to get a copy of this message
ssb Fri Apr 20 05:47:32 2001 EDT Modified files: /php4/pear/XML RPC.php /php4/pear/XML/RPC Server.php Log: * made XML_RPC "include-from-within-a-function" safe

Index: php4/pear/XML/RPC.php diff -u php4/pear/XML/RPC.php:1.4 php4/pear/XML/RPC.php:1.5 --- php4/pear/XML/RPC.php:1.4 Fri Apr 20 05:12:35 2001 +++ php4/pear/XML/RPC.php Fri Apr 20 05:47:32 2001 @@ -1,7 +1,7 @@ <?php // by Edd Dumbill (C) 1999-2000 // <edd@usefulinc.com> -// $Id: RPC.php,v 1.4 2001/04/20 12:12:35 ssb Exp $ +// $Id: RPC.php,v 1.5 2001/04/20 12:47:32 ssb Exp $ // License is granted to use or modify this software ("XML-RPC for PHP") // for commercial or non-commercial use provided the copyright of the author @@ -29,55 +29,55 @@ } } -$XML_RPC_I4="i4"; -$XML_RPC_Int="int"; -$XML_RPC_Boolean="boolean"; -$XML_RPC_Double="double"; -$XML_RPC_String="string"; -$XML_RPC_DateTime="dateTime.iso8601"; -$XML_RPC_Base64="base64"; -$XML_RPC_Array="array"; -$XML_RPC_Struct="struct"; - -$XML_RPC_Types=array($XML_RPC_I4 => 1, - $XML_RPC_Int => 1, - $XML_RPC_Boolean => 1, - $XML_RPC_String => 1, - $XML_RPC_Double => 1, - $XML_RPC_DateTime => 1, - $XML_RPC_Base64 => 1, - $XML_RPC_Array => 2, - $XML_RPC_Struct => 3); - -$xmlEntities=array("quot" => '"', - "amp" => "&", - "lt" => "<", - "gt" => ">", - "apos" => "'"); - -$XML_RPC_err["unknown_method"]=1; -$XML_RPC_str["unknown_method"]="Unknown method"; -$XML_RPC_err["invalid_return"]=2; -$XML_RPC_str["invalid_return"]="Invalid return payload: enabling debugging to examine incoming payload"; -$XML_RPC_err["incorrect_params"]=3; -$XML_RPC_str["incorrect_params"]="Incorrect parameters passed to method"; -$XML_RPC_err["introspect_unknown"]=4; -$XML_RPC_str["introspect_unknown"]="Can't introspect: method unknown"; -$XML_RPC_err["http_error"]=5; -$XML_RPC_str["http_error"]="Didn't receive 200 OK from remote server."; +$GLOBALS['XML_RPC_I4']="i4"; +$GLOBALS['XML_RPC_Int']="int"; +$GLOBALS['XML_RPC_Boolean']="boolean"; +$GLOBALS['XML_RPC_Double']="double"; +$GLOBALS['XML_RPC_String']="string"; +$GLOBALS['XML_RPC_DateTime']="dateTime.iso8601"; +$GLOBALS['XML_RPC_Base64']="base64"; +$GLOBALS['XML_RPC_Array']="array"; +$GLOBALS['XML_RPC_Struct']="struct"; + +$GLOBALS['XML_RPC_Types']=array($GLOBALS['XML_RPC_I4'] => 1, + $GLOBALS['XML_RPC_Int'] => 1, + $GLOBALS['XML_RPC_Boolean'] => 1, + $GLOBALS['XML_RPC_String'] => 1, + $GLOBALS['XML_RPC_Double'] => 1, + $GLOBALS['XML_RPC_DateTime'] => 1, + $GLOBALS['XML_RPC_Base64'] => 1, + $GLOBALS['XML_RPC_Array'] => 2, + $GLOBALS['XML_RPC_Struct'] => 3); + +$GLOBALS['XML_RPC_entities']=array("quot" => '"', + "amp" => "&", + "lt" => "<", + "gt" => ">", + "apos" => "'"); + +$GLOBALS['XML_RPC_err']["unknown_method"]=1; +$GLOBALS['XML_RPC_str']["unknown_method"]="Unknown method"; +$GLOBALS['XML_RPC_err']["invalid_return"]=2; +$GLOBALS['XML_RPC_str']["invalid_return"]="Invalid return payload: enabling debugging to examine incoming payload"; +$GLOBALS['XML_RPC_err']["incorrect_params"]=3; +$GLOBALS['XML_RPC_str']["incorrect_params"]="Incorrect parameters passed to method"; +$GLOBALS['XML_RPC_err']["introspect_unknown"]=4; +$GLOBALS['XML_RPC_str']["introspect_unknown"]="Can't introspect: method unknown"; +$GLOBALS['XML_RPC_err']["http_error"]=5; +$GLOBALS['XML_RPC_str']["http_error"]="Didn't receive 200 OK from remote server."; -$XML_RPC_defencoding="UTF-8"; +$GLOBALS['XML_RPC_defencoding']="UTF-8"; // let user errors start at 800 -$XML_RPC_erruser=800; +$GLOBALS['XML_RPC_erruser']=800; // let XML parse errors start at 100 -$XML_RPC_errxml=100; +$GLOBALS['XML_RPC_errxml']=100; // formulate backslashes for escaping regexp -$XML_RPC_backslash=chr(92).chr(92); +$GLOBALS['XML_RPC_backslash']=chr(92).chr(92); -$XML_RPC_twoslash=$XML_RPC_backslash . $XML_RPC_backslash; -$XML_RPC_twoslash="2SLS"; +$GLOBALS['XML_RPC_twoslash']=$GLOBALS['XML_RPC_backslash'] . $GLOBALS['XML_RPC_backslash']; +$GLOBALS['XML_RPC_twoslash']="2SLS"; // used to store state during parsing // quick explanation of components: // st - used to build up a string for evaluation @@ -90,7 +90,7 @@ // params - used to store parameters in method calls // method - used to store method name -$_xh=array(); +$GLOBALS['XML_RPC_xh']=array(); function XML_RPC_entity_decode($string) { @@ -113,45 +113,47 @@ return $op; } + function XML_RPC_lookup_entity($ent) { - global $xmlEntities; + global $XML_RPC_entities; - if ($xmlEntities[strtolower($ent)]) - return $xmlEntities[strtolower($ent)]; + if ($XML_RPC_entities[strtolower($ent)]) + return $XML_RPC_entities[strtolower($ent)]; if (ereg("^#([0-9]+)$", $ent, $regs)) return chr($regs[1]); return "?"; } + function XML_RPC_se($parser, $name, $attrs) { - global $_xh, $XML_RPC_DateTime, $XML_RPC_String; + global $XML_RPC_xh, $XML_RPC_DateTime, $XML_RPC_String; switch($name) { case "STRUCT": case "ARRAY": - $_xh[$parser]['st'].="array("; - $_xh[$parser]['cm']++; + $XML_RPC_xh[$parser]['st'].="array("; + $XML_RPC_xh[$parser]['cm']++; // this last line turns quoting off // this means if we get an empty array we'll // simply get a bit of whitespace in the eval - $_xh[$parser]['qt']=0; + $XML_RPC_xh[$parser]['qt']=0; break; case "NAME": - $_xh[$parser]['st'].="'"; $_xh[$parser]['ac']=""; + $XML_RPC_xh[$parser]['st'].="'"; $XML_RPC_xh[$parser]['ac']=""; break; case "FAULT": - $_xh[$parser]['isf']=1; + $XML_RPC_xh[$parser]['isf']=1; break; case "PARAM": - $_xh[$parser]['st']=""; + $XML_RPC_xh[$parser]['st']=""; break; case "VALUE": - $_xh[$parser]['st'].="new XML_RPC_Value("; - $_xh[$parser]['lv']=1; - $_xh[$parser]['vt']=$XML_RPC_String; - $_xh[$parser]['ac']=""; + $XML_RPC_xh[$parser]['st'].="new XML_RPC_Value("; + $XML_RPC_xh[$parser]['lv']=1; + $XML_RPC_xh[$parser]['vt']=$XML_RPC_String; + $XML_RPC_xh[$parser]['ac']=""; // look for a value: if this is still 1 by the // time we reach the first data segment then the type is string // by implication and we need to add in a quote @@ -164,54 +166,54 @@ case "DOUBLE": case "DATETIME.ISO8601": case "BASE64": - $_xh[$parser]['ac']=""; // reset the accumulator + $XML_RPC_xh[$parser]['ac']=""; // reset the accumulator if ($name=="DATETIME.ISO8601" || $name=="STRING") { - $_xh[$parser]['qt']=1; + $XML_RPC_xh[$parser]['qt']=1; if ($name=="DATETIME.ISO8601") - $_xh[$parser]['vt']=$XML_RPC_DateTime; + $XML_RPC_xh[$parser]['vt']=$XML_RPC_DateTime; } else if ($name=="BASE64") { - $_xh[$parser]['qt']=2; + $XML_RPC_xh[$parser]['qt']=2; } else { - $_xh[$parser]['qt']=0; + $XML_RPC_xh[$parser]['qt']=0; } break; case "MEMBER": - $_xh[$parser]['ac']=""; + $XML_RPC_xh[$parser]['ac']=""; break; default: break; } - if ($name!="VALUE") $_xh[$parser]['lv']=0; + if ($name!="VALUE") $XML_RPC_xh[$parser]['lv']=0; } function XML_RPC_ee($parser, $name) { - global $_xh,$XML_RPC_Types,$XML_RPC_String; + global $XML_RPC_xh,$XML_RPC_Types,$XML_RPC_String; switch($name) { case "STRUCT": case "ARRAY": - if ($_xh[$parser]['cm'] && substr($_xh[$parser]['st'], -1) ==',') { - $_xh[$parser]['st']=substr($_xh[$parser]['st'],0,-1); + if ($XML_RPC_xh[$parser]['cm'] && substr($XML_RPC_xh[$parser]['st'], -1) ==',') { + $XML_RPC_xh[$parser]['st']=substr($XML_RPC_xh[$parser]['st'],0,-1); } - $_xh[$parser]['st'].=")"; - $_xh[$parser]['vt']=strtolower($name); - $_xh[$parser]['cm']--; + $XML_RPC_xh[$parser]['st'].=")"; + $XML_RPC_xh[$parser]['vt']=strtolower($name); + $XML_RPC_xh[$parser]['cm']--; break; case "NAME": - $_xh[$parser]['st'].= $_xh[$parser]['ac'] . "' => "; + $XML_RPC_xh[$parser]['st'].= $XML_RPC_xh[$parser]['ac'] . "' => "; break; case "BOOLEAN": // special case here: we translate boolean 1 or 0 into PHP // constants true or false - if ($_xh[$parser]['ac']=='1') - $_xh[$parser]['ac']="true"; + if ($XML_RPC_xh[$parser]['ac']=='1') + $XML_RPC_xh[$parser]['ac']="true"; else - $_xh[$parser]['ac']="false"; - $_xh[$parser]['vt']=strtolower($name); + $XML_RPC_xh[$parser]['ac']="false"; + $XML_RPC_xh[$parser]['vt']=strtolower($name); // Drop through intentionally. case "I4": case "INT": @@ -219,91 +221,94 @@ case "DOUBLE": case "DATETIME.ISO8601": case "BASE64": - if ($_xh[$parser]['qt']==1) { + if ($XML_RPC_xh[$parser]['qt']==1) { // we use double quotes rather than single so backslashification works OK - $_xh[$parser]['st'].="\"". $_xh[$parser]['ac'] . "\""; - } else if ($_xh[$parser]['qt']==2) { - $_xh[$parser]['st'].="base64_decode('". $_xh[$parser]['ac'] . "')"; + $XML_RPC_xh[$parser]['st'].="\"". $XML_RPC_xh[$parser]['ac'] . "\""; + } else if ($XML_RPC_xh[$parser]['qt']==2) { + $XML_RPC_xh[$parser]['st'].="base64_decode('". $XML_RPC_xh[$parser]['ac'] . "')"; } else { - $_xh[$parser]['st'].=$_xh[$parser]['ac']; + $XML_RPC_xh[$parser]['st'].=$XML_RPC_xh[$parser]['ac']; } - $_xh[$parser]['ac']=""; $_xh[$parser]['qt']=0; + $XML_RPC_xh[$parser]['ac']=""; $XML_RPC_xh[$parser]['qt']=0; break; case "VALUE": // deal with a string value - if (strlen($_xh[$parser]['ac'])>0 && - $_xh[$parser]['vt']==$XML_RPC_String) { - $_xh[$parser]['st'].="\"". $_xh[$parser]['ac'] . "\""; + if (strlen($XML_RPC_xh[$parser]['ac'])>0 && + $XML_RPC_xh[$parser]['vt']==$XML_RPC_String) { + $XML_RPC_xh[$parser]['st'].="\"". $XML_RPC_xh[$parser]['ac'] . "\""; } // This if() detects if no scalar was inside <VALUE></VALUE> // and pads an empty "". - if($_xh[$parser]['st'][strlen($_xh[$parser]['st'])-1] == '(') { - $_xh[$parser]['st'].= '""'; + if($XML_RPC_xh[$parser]['st'][strlen($XML_RPC_xh[$parser]['st'])-1] == '(') { + $XML_RPC_xh[$parser]['st'].= '""'; } - $_xh[$parser]['st'].=", '" . $_xh[$parser]['vt'] . "')"; - if ($_xh[$parser]['cm']) $_xh[$parser]['st'].=","; + $XML_RPC_xh[$parser]['st'].=", '" . $XML_RPC_xh[$parser]['vt'] . "')"; + if ($XML_RPC_xh[$parser]['cm']) $XML_RPC_xh[$parser]['st'].=","; break; case "MEMBER": - $_xh[$parser]['ac']=""; $_xh[$parser]['qt']=0; + $XML_RPC_xh[$parser]['ac']=""; $XML_RPC_xh[$parser]['qt']=0; break; case "DATA": - $_xh[$parser]['ac']=""; $_xh[$parser]['qt']=0; + $XML_RPC_xh[$parser]['ac']=""; $XML_RPC_xh[$parser]['qt']=0; break; case "PARAM": - $_xh[$parser]['params'][]=$_xh[$parser]['st']; + $XML_RPC_xh[$parser]['params'][]=$XML_RPC_xh[$parser]['st']; break; case "METHODNAME": - $_xh[$parser]['method']=ereg_replace("^[\n\r\t ]+", "", $_xh[$parser]['ac']); + $XML_RPC_xh[$parser]['method']=ereg_replace("^[\n\r\t ]+", "", $XML_RPC_xh[$parser]['ac']); break; case "BOOLEAN": // special case here: we translate boolean 1 or 0 into PHP // constants true or false - if ($_xh[$parser]['ac']=='1') - $_xh[$parser]['ac']="true"; + if ($XML_RPC_xh[$parser]['ac']=='1') + $XML_RPC_xh[$parser]['ac']="true"; else - $_xh[$parser]['ac']="false"; - $_xh[$parser]['vt']=strtolower($name); + $XML_RPC_xh[$parser]['ac']="false"; + $XML_RPC_xh[$parser]['vt']=strtolower($name); break; default: break; } // if it's a valid type name, set the type if ($XML_RPC_Types[strtolower($name)]) { - $_xh[$parser]['vt']=strtolower($name); + $XML_RPC_xh[$parser]['vt']=strtolower($name); } } + function XML_RPC_cd($parser, $data) { - global $_xh, $XML_RPC_backslash, $XML_RPC_twoslash; + global $XML_RPC_xh, $XML_RPC_backslash, $XML_RPC_twoslash; //if (ereg("^[\n\r \t]+$", $data)) return; // print "adding [${data}]\n"; - if ($_xh[$parser]['lv']==1) { - $_xh[$parser]['qt']=1; - $_xh[$parser]['lv']=2; + if ($XML_RPC_xh[$parser]['lv']==1) { + $XML_RPC_xh[$parser]['qt']=1; + $XML_RPC_xh[$parser]['lv']=2; } - if ($_xh[$parser]['qt']) { // quoted string - $_xh[$parser]['ac'].=str_replace('\$', '\\$', + if ($XML_RPC_xh[$parser]['qt']) { // quoted string + $XML_RPC_xh[$parser]['ac'].=str_replace('\$', '\\$', str_replace('"', '\"', str_replace(chr(92),$XML_RPC_backslash, $data))); } else - $_xh[$parser]['ac'].=$data; + $XML_RPC_xh[$parser]['ac'].=$data; } + function XML_RPC_dh($parser, $data) { - global $_xh; + global $XML_RPC_xh; if (substr($data, 0, 1) == "&" && substr($data, -1, 1) == ";") { - if ($_xh[$parser]['lv']==1) { - $_xh[$parser]['qt']=1; - $_xh[$parser]['lv']=2; + if ($XML_RPC_xh[$parser]['lv']==1) { + $XML_RPC_xh[$parser]['qt']=1; + $XML_RPC_xh[$parser]['lv']=2; } - $_xh[$parser]['ac'].=$data; + $XML_RPC_xh[$parser]['ac'].=$data; } } + // date helpers function XML_RPC_iso8601_encode($timet, $utc=0) { @@ -331,6 +336,7 @@ return $t; } + function XML_RPC_iso8601_decode($idate, $utc=0) { // return a timet in the localtime, or UTC @@ -346,6 +352,7 @@ return $t; } + /**************************************************************** * xmlrpc_decode takes a message in PHP xmlrpc object format and * * tranlates it into native PHP types. * @@ -379,6 +386,7 @@ } } + /**************************************************************** * xmlrpc_encode takes native php types and encodes them into * * xmlrpc PHP object format. * @@ -633,17 +641,17 @@ function parseResponse($data="") { - global $_xh,$XML_RPC_err,$XML_RPC_str; + global $XML_RPC_xh,$XML_RPC_err,$XML_RPC_str; global $XML_RPC_defencoding; $parser = xml_parser_create($XML_RPC_defencoding); - $_xh[$parser]=array(); + $XML_RPC_xh[$parser]=array(); - $_xh[$parser]['st']=""; - $_xh[$parser]['cm']=0; - $_xh[$parser]['isf']=0; - $_xh[$parser]['ac']=""; + $XML_RPC_xh[$parser]['st']=""; + $XML_RPC_xh[$parser]['cm']=0; + $XML_RPC_xh[$parser]['isf']=0; + $XML_RPC_xh[$parser]['ac']=""; xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, true); xml_set_element_handler($parser, "XML_RPC_se", "XML_RPC_ee"); @@ -668,7 +676,7 @@ return $r; } // gotta get rid of headers here - if ((!$hdrfnd) && ereg("^(.*)\r\n\r\n",$data,$_xh[$parser]['ha'])) { + if ((!$hdrfnd) && ereg("^(.*)\r\n\r\n",$data,$XML_RPC_xh[$parser]['ha'])) { $data=ereg_replace("^.*\r\n\r\n", "", $data); $hdrfnd=1; } @@ -690,18 +698,18 @@ xml_parser_free($parser); if ($this->debug) { print "<PRE>---EVALING---[" . - strlen($_xh[$parser]['st']) . " chars]---\n" . - htmlspecialchars($_xh[$parser]['st']) . ";\n---END---</PRE>"; + strlen($XML_RPC_xh[$parser]['st']) . " chars]---\n" . + htmlspecialchars($XML_RPC_xh[$parser]['st']) . ";\n---END---</PRE>"; } - if (strlen($_xh[$parser]['st'])==0) { + if (strlen($XML_RPC_xh[$parser]['st'])==0) { // then something odd has happened // and it's time to generate a client side error // indicating something odd went on $r=new XML_RPC_Response(0, $XML_RPC_err["invalid_return"], $XML_RPC_str["invalid_return"]); } else { - eval('$v=' . $_xh[$parser]['st'] . '; $allOK=1;'); - if ($_xh[$parser]['isf']) { + eval('$v=' . $XML_RPC_xh[$parser]['st'] . '; $allOK=1;'); + if ($XML_RPC_xh[$parser]['isf']) { $f=$v->structmem("faultCode"); $fs=$v->structmem("faultString"); $r=new XML_RPC_Response($v, $f->scalarval(), @@ -710,7 +718,7 @@ $r=new XML_RPC_Response($v); } } - $r->hdrs=split('\r?\n', $_xh[$parser]['ha'][1]); + $r->hdrs=split('\r?\n', $XML_RPC_xh[$parser]['ha'][1]); return $r; } Index: php4/pear/XML/RPC/Server.php diff -u php4/pear/XML/RPC/Server.php:1.1 php4/pear/XML/RPC/Server.php:1.2 --- php4/pear/XML/RPC/Server.php:1.1 Fri Apr 20 05:12:35 2001 +++ php4/pear/XML/RPC/Server.php Fri Apr 20 05:47:32 2001 @@ -1,7 +1,7 @@ <?php // by Edd Dumbill (C) 1999,2000 // <edd@usefulinc.com> -// $Id: Server.php,v 1.1 2001/04/20 12:12:35 ssb Exp $ +// $Id: Server.php,v 1.2 2001/04/20 12:47:32 ssb Exp $ // License is granted to use or modify this software ("XML-RPC for PHP") // for commercial or non-commercial use provided the copyright of the author @@ -26,9 +26,11 @@ require_once "XML/RPC.php"; // listMethods: either a string, or nothing -$XML_RPC_Server_listMethods_sig=array(array($XML_RPC_Array, $XML_RPC_String), - array($XML_RPC_Array)); -$XML_RPC_Server_listMethods_doc='This method lists all the methods that the XML-RPC server knows how to dispatch'; +$GLOBALS['XML_RPC_Server_listMethods_sig']= + array(array($GLOBALS['XML_RPC_Array'], $GLOBALS['XML_RPC_String']), + array($GLOBALS['XML_RPC_Array'])); +$GLOBALS['XML_RPC_Server_listMethods_doc']= + 'This method lists all the methods that the XML-RPC server knows how to dispatch'; function XML_RPC_Server_listMethods($server, $m) { @@ -47,8 +49,10 @@ return new XML_RPC_Response($v); } -$XML_RPC_Server_methodSignature_sig=array(array($XML_RPC_Array, $XML_RPC_String)); -$XML_RPC_Server_methodSignature_doc='Returns an array of known signatures (an array of arrays) for the method name passed. If no signatures are known, returns a none-array (test for type != array to detect missing signature)'; +$GLOBALS['XML_RPC_Server_methodSignature_sig'= + array(array($GLOBALS['XML_RPC_Array'], $GLOBALS['XML_RPC_String'])); +$GLOBALS['XML_RPC_Server_methodSignature_doc']= + 'Returns an array of known signatures (an array of arrays) for the method name passed. If no signatures are known, returns a none-array (test for type != array to detect missing signature)'; function XML_RPC_Server_methodSignature($server, $m) { @@ -86,8 +90,10 @@ return $r; } -$XML_RPC_Server_methodHelp_sig=array(array($XML_RPC_String, $XML_RPC_String)); -$XML_RPC_Server_methodHelp_doc='Returns help text if defined for the method passed, otherwise returns an empty string'; +$GLOBALS['XML_RPC_Server_methodHelp_sig']= + array(array($GLOBALS['XML_RPC_String'], $GLOBALS['XML_RPC_String'])); +$GLOBALS['XML_RPC_Server_methodHelp_doc']= + 'Returns help text if defined for the method passed, otherwise returns an empty string'; function XML_RPC_Server_methodHelp($server, $m) { @@ -116,24 +122,24 @@ return $r; } -$XML_RPC_Server_dmap=array( +$GLOBALS['XML_RPC_Server_dmap']=array( "system.listMethods" => array("function" => "XML_RPC_Server_listMethods", - "signature" => $XML_RPC_Server_listMethods_sig, - "docstring" => $XML_RPC_Server_listMethods_doc), + "signature" => $GLOBALS['XML_RPC_Server_listMethods_sig'], + "docstring" => $GLOBALS['XML_RPC_Server_listMethods_doc']), "system.methodHelp" => array("function" => "XML_RPC_Server_methodHelp", - "signature" => $XML_RPC_Server_methodHelp_sig, - "docstring" => $XML_RPC_Server_methodHelp_doc), + "signature" => $GLOBALS['XML_RPC_Server_methodHelp_sig'], + "docstring" => $GLOBALS['XML_RPC_Server_methodHelp_doc']), "system.methodSignature" => array("function" => "XML_RPC_Server_methodSignature", - "signature" => $XML_RPC_Server_methodSignature_sig, - "docstring" => $XML_RPC_Server_methodSignature_doc) + "signature" => $GLOBALS['XML_RPC_Server_methodSignature_sig'], + "docstring" => $GLOBALS['XML_RPC_Server_methodSignature_doc']) ); -$XML_RPC_Server_debuginfo=""; +$GLOBALS['XML_RPC_Server_debuginfo']=""; function XML_RPC_Server_debugmsg($m) { @@ -211,7 +217,7 @@ function parseRequest($data="") { - global $_xh,$HTTP_RAW_POST_DATA; + global $XML_RPC_xh,$HTTP_RAW_POST_DATA; global $XML_RPC_err, $XML_RPC_str, $XML_RPC_errxml, $XML_RPC_defencoding, $XML_RPC_Server_dmap; @@ -220,12 +226,12 @@ } $parser = xml_parser_create($XML_RPC_defencoding); - $_xh[$parser]=array(); - $_xh[$parser]['st']=""; - $_xh[$parser]['cm']=0; - $_xh[$parser]['isf']=0; - $_xh[$parser]['params']=array(); - $_xh[$parser]['method']=""; + $XML_RPC_xh[$parser]=array(); + $XML_RPC_xh[$parser]['st']=""; + $XML_RPC_xh[$parser]['cm']=0; + $XML_RPC_xh[$parser]['isf']=0; + $XML_RPC_xh[$parser]['params']=array(); + $XML_RPC_xh[$parser]['method']=""; // decompose incoming XML into request structure @@ -243,16 +249,16 @@ xml_parser_free($parser); } else { xml_parser_free($parser); - $m=new XML_RPC_Message($_xh[$parser]['method']); + $m=new XML_RPC_Message($XML_RPC_xh[$parser]['method']); // now add parameters in - for($i=0; $i<sizeof($_xh[$parser]['params']); $i++) { - // print "<!-- " . $_xh[$parser]['params'][$i]. "-->\n"; - $plist.="$i - " . $_xh[$parser]['params'][$i]. " \n"; - eval('$m->addParam(' . $_xh[$parser]['params'][$i]. ");"); + for($i=0; $i<sizeof($XML_RPC_xh[$parser]['params']); $i++) { + // print "<!-- " . $XML_RPC_xh[$parser]['params'][$i]. "-->\n"; + $plist.="$i - " . $XML_RPC_xh[$parser]['params'][$i]. " \n"; + eval('$m->addParam(' . $XML_RPC_xh[$parser]['params'][$i]. ");"); } XML_RPC_Server_debugmsg($plist); // now to deal with the method - $methName=$_xh[$parser]['method']; + $methName=$XML_RPC_xh[$parser]['method']; if (ereg("^system\.", $methName)) { $dmap=$XML_RPC_Server_dmap; $sysCall=1; } else {
« previous php.pear.cvs (#62) next »