From 3ed6989c2320d8a405133f777e2a772f648e1fa0 Mon Sep 17 00:00:00 2001 From: David Goodwin Date: Sun, 15 Mar 2009 21:26:20 +0000 Subject: [PATCH] fix bugs found in initial testing git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@582 a1433add-5e2c-0410-b055-b7f2511e0802 --- xmlrpc.php | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/xmlrpc.php b/xmlrpc.php index 323cf7eb..dfdcf57c 100644 --- a/xmlrpc.php +++ b/xmlrpc.php @@ -27,28 +27,37 @@ * } * * Note, the requirement that your XmlRpc client provides cookies with each request. - * If it does not do this, then your authentication details will not persist across requests. + * If it does not do this, then your authentication details will not persist across requests, and + * this XMLRPC interface will not work. */ +require_once(dirname(__FILE__) . '/common.php'); require_once('Zend/XmlRpc/Server.php'); $server = new Zend_XmlRpc_Server(); session_start(); +/** + * @param string $username + * @param string $password + * @return boolean true on success, else false. + */ function login($username, $password) { if(UserHandler::login($username, $password)) { session_regenerate_id(); $_SESSION['authenticated'] = true; $_SESSION['username'] = $username; + return true; } + return false; } if(!isset($_SESSION['authenticated'])) { $server->addFunction('login', 'login'); } else { - $server->addClass('user', 'UserProxy'); - $server->addClass('vacation', 'VacationProxy'); - $server->addClass('alias', 'AliasProxy'); + $server->setClass('UserProxy', 'user'); + $server->setClass('VacationProxy', 'vacation'); + $server->setClass('AliasProxy', 'alias'); } echo $server->handle();