|
|
@ -27,28 +27,37 @@
|
|
|
|
* }
|
|
|
|
* }
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Note, the requirement that your XmlRpc client provides cookies with each request.
|
|
|
|
* 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');
|
|
|
|
require_once('Zend/XmlRpc/Server.php');
|
|
|
|
$server = new Zend_XmlRpc_Server();
|
|
|
|
$server = new Zend_XmlRpc_Server();
|
|
|
|
session_start();
|
|
|
|
session_start();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* @param string $username
|
|
|
|
|
|
|
|
* @param string $password
|
|
|
|
|
|
|
|
* @return boolean true on success, else false.
|
|
|
|
|
|
|
|
*/
|
|
|
|
function login($username, $password) {
|
|
|
|
function login($username, $password) {
|
|
|
|
if(UserHandler::login($username, $password)) {
|
|
|
|
if(UserHandler::login($username, $password)) {
|
|
|
|
session_regenerate_id();
|
|
|
|
session_regenerate_id();
|
|
|
|
$_SESSION['authenticated'] = true;
|
|
|
|
$_SESSION['authenticated'] = true;
|
|
|
|
$_SESSION['username'] = $username;
|
|
|
|
$_SESSION['username'] = $username;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(!isset($_SESSION['authenticated'])) {
|
|
|
|
if(!isset($_SESSION['authenticated'])) {
|
|
|
|
$server->addFunction('login', 'login');
|
|
|
|
$server->addFunction('login', 'login');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
$server->addClass('user', 'UserProxy');
|
|
|
|
$server->setClass('UserProxy', 'user');
|
|
|
|
$server->addClass('vacation', 'VacationProxy');
|
|
|
|
$server->setClass('VacationProxy', 'vacation');
|
|
|
|
$server->addClass('alias', 'AliasProxy');
|
|
|
|
$server->setClass('AliasProxy', 'alias');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
echo $server->handle();
|
|
|
|
echo $server->handle();
|
|
|
|
|
|
|
|
|
|
|
|