2001-08-08 01:04:49 +02:00
|
|
|
<?php
|
2003-08-28 16:16:30 +02:00
|
|
|
/**************************************************************************\
|
2003-10-21 02:06:44 +02:00
|
|
|
* eGroupWare xmlrpc server *
|
2004-01-01 16:38:15 +01:00
|
|
|
* http://www.egroupware.org *
|
2003-10-21 02:06:44 +02:00
|
|
|
* This file written by Miles Lott <milos@groupwhere.org> *
|
2003-08-28 16:16:30 +02:00
|
|
|
* -------------------------------------------- *
|
|
|
|
* This program is free software; you can redistribute it and/or modify it *
|
|
|
|
* under the terms of the GNU General Public License as published by the *
|
|
|
|
* Free Software Foundation; either version 2 of the License, or (at your *
|
|
|
|
* option) any later version. *
|
|
|
|
\**************************************************************************/
|
|
|
|
|
|
|
|
/* $Id$ */
|
|
|
|
/* $Source$ */
|
2005-06-18 22:29:17 +02:00
|
|
|
/*list($usec, $sec) = explode(" ", microtime());
|
|
|
|
$GLOBALS['concisus']['script_start'] = ((float)$usec + (float)$sec);*/
|
2003-08-28 16:16:30 +02:00
|
|
|
|
2006-10-03 17:18:03 +02:00
|
|
|
$GLOBALS['egw_info'] = array(
|
|
|
|
'flags' => array(
|
|
|
|
'currentapp' => 'login',
|
|
|
|
'noheader' => True,
|
|
|
|
'disable_Template_class' => True
|
|
|
|
)
|
2001-08-08 01:04:49 +02:00
|
|
|
);
|
2008-08-21 08:21:32 +02:00
|
|
|
include('./header.inc.php');
|
|
|
|
|
|
|
|
include_once(EGW_API_INC . '/xml_functions.inc.php');
|
|
|
|
include_once(EGW_API_INC . '/soap_functions.inc.php'); // not sure that's neccessary, but I have no way to test
|
2001-08-08 01:04:49 +02:00
|
|
|
|
2005-06-18 22:29:17 +02:00
|
|
|
//viniciuscb: a secure way to know if we're in a xmlrpc call...
|
2005-07-08 07:00:14 +02:00
|
|
|
$GLOBALS['egw_info']['server']['xmlrpc'] = true;
|
2005-06-18 22:29:17 +02:00
|
|
|
|
2003-10-21 02:04:56 +02:00
|
|
|
$server = CreateObject('phpgwapi.xmlrpc_server');
|
2005-07-08 07:00:14 +02:00
|
|
|
|
2003-10-21 02:04:56 +02:00
|
|
|
/* uncomment here if you want to show all of the testing functions for compatibility */
|
2005-07-08 07:00:14 +02:00
|
|
|
//include(EGW_API_INC . '/xmlrpc.interop.php');
|
2005-09-19 05:37:07 +02:00
|
|
|
|
2005-09-10 12:39:36 +02:00
|
|
|
if (!$GLOBALS['egw_info']['server']['xmlrpc_enabled'])
|
|
|
|
{
|
|
|
|
$server->xmlrpc_error(9999,'xmlrpc service is not enabled in the eGroupWare system configuration');
|
|
|
|
exit;
|
|
|
|
}
|
2003-10-21 02:04:56 +02:00
|
|
|
|
2005-09-19 05:37:07 +02:00
|
|
|
/* Note: this command only available natively in Apache (Netscape/iPlanet/SunONE in php >= 4.3.3) */
|
|
|
|
if(!function_exists('getallheaders'))
|
|
|
|
{
|
|
|
|
function getallheaders()
|
|
|
|
{
|
|
|
|
settype($headers,'array');
|
|
|
|
foreach($_SERVER as $h => $v)
|
|
|
|
{
|
2009-06-08 18:21:14 +02:00
|
|
|
if(preg_match('/HTTP_(.+)/',$h,$hp))
|
2005-09-19 05:37:07 +02:00
|
|
|
{
|
|
|
|
$headers[$hp[1]] = $v;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $headers;
|
|
|
|
}
|
|
|
|
}
|
2003-08-28 16:16:30 +02:00
|
|
|
$headers = getallheaders();
|
2005-09-19 05:37:07 +02:00
|
|
|
|
2004-03-12 18:58:55 +01:00
|
|
|
//print_r($headers);
|
2005-06-30 21:01:19 +02:00
|
|
|
$isodate = $headers['isoDate'] ? $headers['isoDate'] : $headers['isodate'];
|
|
|
|
$isodate = ($isodate == 'simple') ? True : False;
|
|
|
|
$server->setSimpleDate($isodate);
|
2004-03-12 18:58:55 +01:00
|
|
|
$auth_header = $headers['Authorization'] ? $headers['Authorization'] : $headers['authorization'];
|
|
|
|
|
2009-06-08 18:21:14 +02:00
|
|
|
if(preg_match('/Basic *([^ ]*)/i',$auth_header,$auth))
|
2001-08-20 01:55:58 +02:00
|
|
|
{
|
2004-03-12 18:58:55 +01:00
|
|
|
list($sessionid,$kp3) = explode(':',base64_decode($auth[1]));
|
|
|
|
//echo "auth='$auth[1]', sessionid='$sessionid', kp3='$kp3'\n";
|
2003-08-28 16:16:30 +02:00
|
|
|
}
|
2004-03-13 18:54:26 +01:00
|
|
|
else
|
|
|
|
{
|
|
|
|
$sessionid = get_var('sessionid',array('COOKIE','GET'));
|
|
|
|
$kp3 = get_var('kp3',array('COOKIE','GET'));
|
|
|
|
}
|
2005-07-08 07:00:14 +02:00
|
|
|
$server->authed = $GLOBALS['egw']->session->verify($sessionid,$kp3);
|
2003-08-28 16:16:30 +02:00
|
|
|
|
2005-06-18 22:29:17 +02:00
|
|
|
if (!$server->authed and isset($_SERVER['PHP_AUTH_USER']) and isset($_SERVER['PHP_AUTH_PW']))
|
|
|
|
{
|
2005-07-08 07:00:14 +02:00
|
|
|
$authed = $GLOBALS['egw']->session->create($login.'@'.$domain, $_SERVER['PHP_AUTH_PW'], 'text');
|
2005-06-18 22:29:17 +02:00
|
|
|
|
|
|
|
if ($authed)
|
|
|
|
{
|
|
|
|
$server->authed = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-03-13 18:54:26 +01:00
|
|
|
$server->service($_SERVER['HTTP_RAW_POST_DATA']);
|