source: trunk/phpgwapi/inc/soap_functions.inc.php @ 2

Revision 2, 4.6 KB checked in by niltonneto, 17 years ago (diff)

Removida todas as tags usadas pelo CVS ($Id, $Source).
Primeira versão no CVS externo.

  • Property svn:eol-style set to native
  • Property svn:executable set to *
Line 
1<?php
2        /**************************************************************************\
3        * phpGroupWare API - SOAP functions                                        *
4        * This file written by dietrich@ganx4.com                                  *
5        * shared functions and vars for use with soap client/server                *
6        * -------------------------------------------------------------------------*
7        * This library is free software; you can redistribute it and/or modify it  *
8        * under the terms of the GNU Lesser General Public License as published by *
9        * the Free Software Foundation; either version 2.1 of the License,         *
10        * or any later version.                                                    *
11        * This library is distributed in the hope that it will be useful, but      *
12        * WITHOUT ANY WARRANTY; without even the implied warranty of               *
13        * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                     *
14        * See the GNU Lesser General Public License for more details.              *
15        * You should have received a copy of the GNU Lesser General Public License *
16        * along with this library; if not, write to the Free Software Foundation,  *
17        * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA            *
18        \**************************************************************************/
19
20
21        $GLOBALS['soapTypes'] = array(
22                'i4'           => 1,
23                'int'          => 1,
24                'boolean'      => 1,
25                'string'       => 1,
26                'double'       => 1,
27                'float'        => 1,
28                'dateTime'     => 1,
29                'timeInstant'  => 1,
30                'dateTime'     => 1,
31                'base64Binary' => 1,
32                'base64'       => 1,
33                'array'        => 2,
34                'Array'        => 2,
35                'SOAPStruct'   => 3,
36                'ur-type'      => 2
37        );
38
39        while(list($key,$val) = each($GLOBALS['soapTypes']))
40        {
41                $GLOBALS['soapKeys'][] = $val;
42        }
43
44        $GLOBALS['typemap'] = array(
45                'http://soapinterop.org/xsd'                => array('SOAPStruct'),
46                'http://schemas.xmlsoap.org/soap/encoding/' => array('base64'),
47                'http://www.w3.org/1999/XMLSchema'          => $GLOBALS['soapKeys']
48        );
49
50        $GLOBALS['namespaces'] = array(
51                'http://schemas.xmlsoap.org/soap/envelope/' => 'SOAP-ENV',
52                'http://www.w3.org/1999/XMLSchema-instance' => 'xsi',
53                'http://www.w3.org/1999/XMLSchema'          => 'xsd',
54                'http://schemas.xmlsoap.org/soap/encoding/' => 'SOAP-ENC',
55                'http://soapinterop.org/xsd'                => 'si'
56        );
57
58        /*
59        NOTE: already defined in xml_functions
60        $xmlEntities = array(
61                'quot' => '"',
62                'amp'  => '&',
63                'lt'   => '<',
64                'gt'   => '>',
65                'apos' => "'"
66        );
67        */
68
69        $GLOBALS['soap_defencoding'] = 'UTF-8';
70
71        function system_login($m1,$m2,$m3)
72        {
73                $server_name = trim($m1);
74                $username    = trim($m2);
75                $password    = trim($m3);
76
77                list($sessionid,$kp3) = $GLOBALS['phpgw']->session->create_server($username.'@'.$server_name,$password,'text');
78
79                if(!$sessionid && !$kp3)
80                {
81                        if($server_name)
82                        {
83                                $user = $username.'@'.$server_name;
84                        }
85                        else
86                        {
87                                $user = $username;
88                        }
89                        $sessionid = $GLOBALS['phpgw']->session->create($user,$password,'text');
90                        $kp3 = $GLOBALS['phpgw']->session->kp3;
91                        $domain = $GLOBALS['phpgw']->session->account_domain;
92                }
93                if($sessionid && $kp3)
94                {
95                        $rtrn = array(
96                                CreateObject('phpgwapi.soapval','domain','string',$domain),
97                                CreateObject('phpgwapi.soapval','sessionid','string',$sessionid),
98                                CreateObject('phpgwapi.soapval','kp3','string',$kp3)
99                        );
100                }
101                else
102                {
103                        $rtrn = array(CreateObject('phpgwapi.soapval','GOAWAY','string',$username));
104                }
105                return $rtrn;
106        }
107
108        function system_logout($m1,$m2)
109        {
110                $sessionid   = $m1;
111                $kp3         = $m2;
112               
113                $later = $GLOBALS['phpgw']->session->destroy($sessionid,$kp3);
114
115                if($later)
116                {
117                        $rtrn = array(
118                                CreateObject('phpgwapi.soapval','GOODBYE','string','XOXO')
119                        );
120                }
121                else
122                {
123                        $rtrn = array(
124                                CreateObject('phpgwapi.soapval','OOPS','string','WHAT?')
125                        );
126                }
127                return $rtrn;
128        }
129
130        /*
131        function system_listApps()
132        {
133                $GLOBALS['phpgw']->db->query("SELECT * FROM phpgw_applications WHERE app_enabled<3",__LINE__,__FILE__);
134                $apps = array();
135                if($GLOBALS['phpgw']->db->num_rows())
136                {
137                        while ($GLOBALS['phpgw']->db->next_record())
138                        {
139                                $name   = $GLOBALS['phpgw']->db->f('app_name');
140                                $title  = $GLOBALS['phpgw']->db->f('app_title');
141                                $status = $GLOBALS['phpgw']->db->f('app_enabled');
142                                $version= $GLOBALS['phpgw']->db->f('app_version');
143                                $apps[$name] = array(
144                                        CreateObject('phpgwapi.soapval','title','string',$title),
145                                        CreateObject('phpgwapi.soapval','name','string',$name),
146                                        CreateObject('phpgwapi.soapval','status','string',$status),
147                                        CreateObject('phpgwapi.soapval','version','string',$version)
148                                );
149                        }
150                }
151                return $apps;
152        }
153        */
154?>
Note: See TracBrowser for help on using the repository browser.