2001-08-08 01:04:05 +02:00
|
|
|
<?php
|
2001-08-14 00:05:50 +02:00
|
|
|
/**************************************************************************\
|
2001-11-23 18:54:13 +01:00
|
|
|
* phpGroupWare API - SOAP functions *
|
2001-08-14 00:05:50 +02:00
|
|
|
* This file written by dietrich@ganx4.com *
|
|
|
|
* shared functions and vars for use with soap client/server *
|
|
|
|
* -------------------------------------------------------------------------*
|
|
|
|
* This library is free software; you can redistribute it and/or modify it *
|
|
|
|
* under the terms of the GNU Lesser General Public License as published by *
|
|
|
|
* the Free Software Foundation; either version 2.1 of the License, *
|
|
|
|
* or any later version. *
|
|
|
|
* This library is distributed in the hope that it will be useful, but *
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
|
|
|
* See the GNU Lesser General Public License for more details. *
|
|
|
|
* You should have received a copy of the GNU Lesser General Public License *
|
|
|
|
* along with this library; if not, write to the Free Software Foundation, *
|
|
|
|
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
|
|
|
|
\**************************************************************************/
|
2001-08-08 01:04:05 +02:00
|
|
|
|
2001-08-14 00:05:50 +02:00
|
|
|
/* $Id$ */
|
|
|
|
|
|
|
|
$GLOBALS['soapTypes'] = array(
|
2001-08-08 01:04:05 +02:00
|
|
|
'i4' => 1,
|
|
|
|
'int' => 1,
|
|
|
|
'boolean' => 1,
|
|
|
|
'string' => 1,
|
|
|
|
'double' => 1,
|
|
|
|
'float' => 1,
|
|
|
|
'dateTime' => 1,
|
|
|
|
'timeInstant' => 1,
|
|
|
|
'dateTime' => 1,
|
|
|
|
'base64Binary' => 1,
|
|
|
|
'base64' => 1,
|
|
|
|
'array' => 2,
|
|
|
|
'Array' => 2,
|
|
|
|
'SOAPStruct' => 3,
|
|
|
|
'ur-type' => 2
|
|
|
|
);
|
|
|
|
|
2001-08-14 00:05:50 +02:00
|
|
|
while(list($key,$val) = each($GLOBALS['soapTypes']))
|
2001-08-08 01:04:05 +02:00
|
|
|
{
|
2001-08-14 00:05:50 +02:00
|
|
|
$GLOBALS['soapKeys'][] = $val;
|
2001-08-08 01:04:05 +02:00
|
|
|
}
|
|
|
|
|
2001-08-14 00:05:50 +02:00
|
|
|
$GLOBALS['typemap'] = array(
|
2001-08-08 01:04:05 +02:00
|
|
|
'http://soapinterop.org/xsd' => array('SOAPStruct'),
|
|
|
|
'http://schemas.xmlsoap.org/soap/encoding/' => array('base64'),
|
2001-08-14 00:05:50 +02:00
|
|
|
'http://www.w3.org/1999/XMLSchema' => $GLOBALS['soapKeys']
|
2001-08-08 01:04:05 +02:00
|
|
|
);
|
|
|
|
|
2001-08-14 00:05:50 +02:00
|
|
|
$GLOBALS['namespaces'] = array(
|
2001-08-08 01:04:05 +02:00
|
|
|
'http://schemas.xmlsoap.org/soap/envelope/' => 'SOAP-ENV',
|
|
|
|
'http://www.w3.org/1999/XMLSchema-instance' => 'xsi',
|
|
|
|
'http://www.w3.org/1999/XMLSchema' => 'xsd',
|
|
|
|
'http://schemas.xmlsoap.org/soap/encoding/' => 'SOAP-ENC',
|
|
|
|
'http://soapinterop.org/xsd' => 'si'
|
|
|
|
);
|
|
|
|
|
2001-08-14 00:05:50 +02:00
|
|
|
/*
|
2001-11-23 18:54:13 +01:00
|
|
|
NOTE: already defined in xml_functions
|
2001-08-08 01:04:05 +02:00
|
|
|
$xmlEntities = array(
|
|
|
|
'quot' => '"',
|
|
|
|
'amp' => '&',
|
|
|
|
'lt' => '<',
|
|
|
|
'gt' => '>',
|
|
|
|
'apos' => "'"
|
|
|
|
);
|
2001-08-14 00:05:50 +02:00
|
|
|
*/
|
2001-08-08 01:04:05 +02:00
|
|
|
|
2001-08-14 00:05:50 +02:00
|
|
|
$GLOBALS['soap_defencoding'] = 'UTF-8';
|
2001-08-18 22:31:47 +02:00
|
|
|
|
2001-08-27 12:42:19 +02:00
|
|
|
function system_login($m1,$m2,$m3)
|
2001-08-18 22:31:47 +02:00
|
|
|
{
|
2001-08-27 12:42:19 +02:00
|
|
|
$server_name = trim($m1);
|
|
|
|
$username = trim($m2);
|
|
|
|
$password = trim($m3);
|
2001-08-18 22:31:47 +02:00
|
|
|
|
2001-11-23 18:54:13 +01:00
|
|
|
list($sessionid,$kp3) = $GLOBALS['phpgw']->session->create_server($username.'@'.$server_name,$password,'text');
|
2001-08-18 22:31:47 +02:00
|
|
|
|
2001-08-27 12:42:19 +02:00
|
|
|
if(!$sessionid && !$kp3)
|
|
|
|
{
|
|
|
|
if($server_name)
|
|
|
|
{
|
|
|
|
$user = $username.'@'.$server_name;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$user = $username;
|
|
|
|
}
|
2001-11-23 18:54:13 +01:00
|
|
|
$sessionid = $GLOBALS['phpgw']->session->create($user,$password,'text');
|
2001-08-27 12:42:19 +02:00
|
|
|
$kp3 = $GLOBALS['phpgw']->session->kp3;
|
|
|
|
$domain = $GLOBALS['phpgw']->session->account_domain;
|
|
|
|
}
|
2001-08-18 22:31:47 +02:00
|
|
|
if($sessionid && $kp3)
|
|
|
|
{
|
|
|
|
$rtrn = array(
|
2001-08-27 12:42:19 +02:00
|
|
|
CreateObject('phpgwapi.soapval','domain','string',$domain),
|
|
|
|
CreateObject('phpgwapi.soapval','sessionid','string',$sessionid),
|
2001-08-18 22:31:47 +02:00
|
|
|
CreateObject('phpgwapi.soapval','kp3','string',$kp3)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-08-27 12:42:19 +02:00
|
|
|
$rtrn = array(CreateObject('phpgwapi.soapval','GOAWAY','string',$username));
|
2001-08-18 22:31:47 +02:00
|
|
|
}
|
2001-08-27 13:36:48 +02:00
|
|
|
$r = CreateObject('phpgwapi.soapmsg','system_loginResponse',$rtrn);
|
|
|
|
return $r;
|
2001-08-18 22:31:47 +02:00
|
|
|
}
|
2001-08-18 22:37:33 +02:00
|
|
|
|
2001-08-27 12:42:19 +02:00
|
|
|
function system_logout($m1,$m2)
|
2001-08-18 22:37:33 +02:00
|
|
|
{
|
2001-08-27 12:42:19 +02:00
|
|
|
$sessionid = $m1;
|
|
|
|
$kp3 = $m2;
|
2001-08-18 22:37:33 +02:00
|
|
|
|
2001-08-27 12:42:19 +02:00
|
|
|
$username = $GLOBALS['phpgw']->session->account_lid;
|
|
|
|
$later = $GLOBALS['phpgw']->session->destroy();
|
2001-08-18 22:37:33 +02:00
|
|
|
|
2001-08-27 12:42:19 +02:00
|
|
|
if($later)
|
2001-08-18 22:37:33 +02:00
|
|
|
{
|
|
|
|
$rtrn = array(
|
2001-08-27 12:42:19 +02:00
|
|
|
CreateObject('phpgwapi.soapval','GOODBYE','string',$username)
|
2001-08-18 22:37:33 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-08-18 23:32:22 +02:00
|
|
|
$rtrn = array(
|
2001-08-27 12:42:19 +02:00
|
|
|
CreateObject('phpgwapi.soapval','OOPS','string','WHAT?')
|
2001-08-18 23:32:22 +02:00
|
|
|
);
|
2001-08-18 22:37:33 +02:00
|
|
|
}
|
2001-08-27 13:36:48 +02:00
|
|
|
$r = CreateObject('phpgwapi.soapmsg','system_logoutResponse',$rtrn);
|
|
|
|
return $r;
|
2001-08-18 22:37:33 +02:00
|
|
|
}
|
2001-08-08 01:04:05 +02:00
|
|
|
?>
|