phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] api/interface/class.interface_xmlrpc.php, 1.1.2.12


From: nomail
Subject: [Phpgroupware-cvs] api/interface/class.interface_xmlrpc.php, 1.1.2.12
Date: Thu, 20 May 2004 21:41:08 -0000

Update of /api/interface
Modified Files:
        Branch: proposal-branch
          class.interface_xmlrpc.php

date: 2004/04/16 20:59:49;  author: seek3r;  state: Exp;  lines: +37 -36

Log Message:
bringing savannah cvs back up to date with what we were doing on our private 
cvs server. We will not be doing dev from this cvs tree
=====================================================================
No syntax errors detected in -
=====================================================================
Index: api/interface/class.interface_xmlrpc.php
diff -u api/interface/class.interface_xmlrpc.php:1.1.2.11 
api/interface/class.interface_xmlrpc.php:1.1.2.12
--- api/interface/class.interface_xmlrpc.php:1.1.2.11   Thu Dec 25 02:20:18 2003
+++ api/interface/class.interface_xmlrpc.php    Fri Apr 16 20:59:49 2004
@@ -31,26 +31,27 @@
                var $inputs;
                var $method_result;
                var $indent = '';
-               var $first_input = True;
+               var $first_input = true;
                
                function api_interface()
                {
                        $this->parse();
                        $GLOBALS['phpgw_data']['api']['op'] = $this->op;
-                       $GLOBALS['phpgw_data']['server']['session_method'] = 
'url';
+                       $_SESSION['phpgw_data']['server']['session_method'] = 
'url';
                }
 
-               function output($result, $debug = False)
+               function output($result, $debug = false)
                {
+                       define('PHPGW_FINISHED', true);
                        if(!$debug)
                        {
                                header('Content-type: text/xml');
                                header('Content-Length: '.strlen($result));
-                               echo $result;
+                               return $result;
                        }
                        else
                        {
-                               echo htmlentities($result);
+                               return htmlentities($result);
                        }
                }
 
@@ -61,7 +62,7 @@
 
                function login()
                {
-                       $GLOBALS['phpgw']->finish(False);
+                       $GLOBALS['phpgw']->finish(false);
                        $this->xmlrpc_fault('1', 'Please login.');
                }
 
@@ -69,8 +70,7 @@
                {
                        $newsid = $GLOBALS['phpgw']->session->sid();
                        $result = "<?xml 
version=\"1.0\"?>\n<methodResponse>\n<params>\n<param>\n<value>\n<base64>".base64_encode($newsid)."</base64>\n</value>\n</param>\n</params>\n</methodResponse>";
-                       $GLOBALS['phpgw']->session->save_data();
-                       $this->output($result);
+                       echo $this->output($result);
                        exit;
                }
                
@@ -116,25 +116,29 @@
 
                function sendtoclient()
                {
-                       $xml_result =  
$GLOBALS['phpgw']->base_xml->export_xml();
-                       $api_data = xml2var($xml_result);
-
+                       if (defined('MISBEHAVEDAPP'))
+                       {
+                               $this->xmlrpc_fault(1, 'method returned faulty 
data. may not be xml-rpc compliant.');
+                       }
+                       
                        switch ($this->methodName)
                        {
                                case 'system.listMethods':
-                                       $this->system_listMethods();
-                                       return;
+                                       return $this->system_listMethods();
                                case 'system.methodSignature':
-                                       $this->system_methodSignature();
-                                       return;
+                                       return $this->system_methodSignature();
                                case 'system.methodHelp':
-                                       $this->system_methodHelp();
-                                       return;                                 
+                                       return $this->system_methodHelp();
                        }
-                       
-                       if(empty($this->method_result) && 
isset($api_data['APP']))
+
+                       if(empty($this->method_result))
                        {
-                               $this->method_result = $api_data['APP'];
+                               $xml_result =  
$GLOBALS['phpgw']->base_xml->export_xml();
+                               $api_data = xml2var($xml_result);
+                               if(isset($api_data['APP']))
+                               {
+                                       $this->method_result = $api_data['APP'];
+                               }
                        }
                        
                        /* Constructing the XML doc */
@@ -177,7 +181,7 @@
                        
                        $response_packet .= "</methodResponse>";
                        
-                       $this->output($response_packet);
+                       return $this->output($response_packet);
                }
                
                function parse()
@@ -194,7 +198,7 @@
                        }
                        $tmp = explode ("\n", $GLOBALS['HTTP_RAW_POST_DATA']);
                        $num = count($tmp);
-                       $hit_start = False;
+                       $hit_start = false;
                        $xmlrpc_input = '';
                        for ($i=0; $i < $num; $i++)
                        {
@@ -204,7 +208,7 @@
                                }
                                elseif(stristr($tmp[$i], '<?xml'))
                                {
-                                       $hit_start = True;
+                                       $hit_start = true;
                                        $xmlrpc_input .= $tmp[$i]."\n";
                                }
                        }
@@ -219,7 +223,7 @@
                        unset($xml_index, $xml_vals);
                        
if(!isset($this->xml_vals[$this->xml_index['methodName'][0]]['value']))
                        {
-                               $GLOBALS['phpgw']->finish(False);
+                               $GLOBALS['phpgw']->finish(false);
                                $this->xmlrpc_fault('1', 'Invalid xmlrpc 
packet. methodName missing.');
                        }
 
@@ -286,17 +290,17 @@
                                        {
                                                if($this->input_num == 1)
                                                {
-                                                       
$GLOBALS['HTTP_GET_VARS']['phpgw_user'] = $value;
+                                                       $_GET['phpgw_user'] = 
$value;
                                                }
                                                elseif($this->input_num == 2)
                                                {
-                                                       
$GLOBALS['HTTP_GET_VARS']['phpgw_pass'] = $value;
+                                                       $_GET['phpgw_pass'] = 
$value;
                                                }
                                                return;
                                        }
                                        elseif($this->input_num == 1)
                                        {
-                                               
$GLOBALS['HTTP_GET_VARS']['sid'] = $value;
+                                               $_GET['sid'] = $value;
                                                return;
                                        }
                                        else
@@ -538,8 +542,7 @@
                                }
                                $result .= 
"</data>\n</array>\n</value>\n</param>\n</params>\n</methodResponse>";
                        }
-                       $this->output($result);
-                       exit;
+                       return $this->output($result);
                }
 
                function system_methodSignature()
@@ -573,8 +576,7 @@
                                        $result .= 
"</data>\n</array></value>\n</data>\n</array></value>\n</param>\n</params>\n";
                                }
                                $result .= "</methodResponse>\n";
-                               $this->output($result);
-                               exit;
+                               return $this->output($result);
                        }
                        
elseif(isset($GLOBALS['docs'][$app]['classes'][$app.'_'.$class]['functions'][$func])
 && !$GLOBALS['phpgw']->acl->check($methodname, 1))
                        {
@@ -614,8 +616,7 @@
                                        $result .= "</param>\n</params>\n";
                                }
                                $result .= "</methodResponse>\n";
-                               $this->output($result);
-                               exit;
+                               return $this->output($result);
                        }
                        
elseif(isset($GLOBALS['docs'][$app]['classes'][$app.'_'.$class]['functions'][$func])
 && !$GLOBALS['phpgw']->acl->check($methodname, 1))
                        {
@@ -646,7 +647,7 @@
                        $error_result .= "              </value>\n";
                        $error_result .= "      </fault>\n";
                        $error_result .= "</methodResponse>\n";
-                       $this->output($error_result);
+                       echo $this->output($error_result);
                        exit;
                }       
        }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]