~ubuntu-branches/ubuntu/saucy/horde3/saucy

« back to all changes in this revision

Viewing changes to lib/Horde/RPC/webdav.php

  • Committer: Bazaar Package Importer
  • Author(s): Ola Lundqvist
  • Date: 2005-05-04 23:08:08 UTC
  • Revision ID: james.westby@ubuntu.com-20050504230808-p4hf3hk28o3v7wir
Tags: upstream-3.0.4
ImportĀ upstreamĀ versionĀ 3.0.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
 
 
3
include_once 'HTTP/WebDAV/Server.php';
 
4
 
 
5
/**
 
6
 * The Horde_RPC_webdav class provides a WebDAV implementation of the
 
7
 * Horde RPC system.
 
8
 *
 
9
 * $Horde: framework/RPC/RPC/webdav.php,v 1.1.12.1 2005/01/03 12:19:12 jan Exp $
 
10
 *
 
11
 * Copyright 2004-2005 Chuck Hagenbuch <chuck@horde.org>
 
12
 *
 
13
 * See the enclosed file COPYING for license information (LGPL). If you
 
14
 * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
 
15
 *
 
16
 * @author  Chuck Hagenbuch <chuck@horde.org>
 
17
 * @version $Revision: 1.1.12.1 $
 
18
 * @since   Horde 3.0
 
19
 * @package Horde_RPC
 
20
 */
 
21
class Horde_RPC_webdav extends Horde_RPC {
 
22
 
 
23
    /**
 
24
     * Resource handler for the WebDAV server.
 
25
     * @var object HTTP_WebDAV_Server_Horde $_server
 
26
     */
 
27
    var $_server;
 
28
 
 
29
    /**
 
30
     * WebDav server constructor.
 
31
     *
 
32
     * @access private
 
33
     * @return object   An RPC server instance
 
34
     */
 
35
    function Horde_RPC_xmlrpc()
 
36
    {
 
37
        parent::Horde_RPC();
 
38
 
 
39
        $this->_server = &new HTTP_WebDAV_Server_Horde();
 
40
    }
 
41
 
 
42
    /**
 
43
     * Sends an RPC request to the server and returns the result.
 
44
     *
 
45
     * @param string    The raw request string.
 
46
     *
 
47
     * @return string   The XML encoded response from the server.
 
48
     */
 
49
    function getResponse($request)
 
50
    {
 
51
        $this->_server->ServeRequest();
 
52
        exit;
 
53
    }
 
54
 
 
55
    /**
 
56
     * WebDAV handles authentication internally, so bypass the
 
57
     * system-level auth check by just returning true here.
 
58
     */
 
59
    function authorize()
 
60
    {
 
61
        return true;
 
62
    }
 
63
 
 
64
}
 
65
 
 
66
/**
 
67
 * Horde extension of the base HTTP_WebDAV_Server class.
 
68
 *
 
69
 * @package Horde_RPC
 
70
 */
 
71
class HTTP_WebDAV_Server_Horde extends HTTP_WebDAV_Server {
 
72
 
 
73
    /**
 
74
     * GET implementation.
 
75
     *
 
76
     * @param array &$params  Array of input and output parameters.
 
77
     * <br><b>input</b><ul>
 
78
     * <li> path - 
 
79
     * </ul>
 
80
     * <br><b>output</b><ul>
 
81
     * <li> size - 
 
82
     * </ul>
 
83
     *
 
84
     * @return integer  HTTP-Statuscode.
 
85
     */
 
86
    function GET(&$params)
 
87
    {
 
88
        return true;
 
89
    }
 
90
 
 
91
    /**
 
92
     * Check authentication. We always return true here since we
 
93
     * handle permissions based on the resource that's requested, but
 
94
     * we do record the authenticated user for later use.
 
95
     *
 
96
     * @param string $type      Authentication type, e.g. "basic" or "digest"
 
97
     * @param string $username  Transmitted username.
 
98
     * @param string $password  Transmitted password.
 
99
     *
 
100
     * @return boolean  Authentication status. Always true.
 
101
     */
 
102
    function check_auth($type, $username, $password)
 
103
    {
 
104
        $auth = &Auth::singleton($GLOBALS['conf']['auth']['driver']);
 
105
        $auth->authenticate($username, array('password' => $password));
 
106
 
 
107
        return true;
 
108
    }
 
109
 
 
110
}