Overview

Packages

  • None
  • Rpc

Classes

  • Horde_Rpc
  • Horde_Rpc_ActiveSync
  • Horde_Rpc_Exception
  • Horde_Rpc_Phpgw
  • Horde_Rpc_Soap
  • Horde_Rpc_Syncml
  • Horde_Rpc_Syncml_Wbxml
  • Horde_Rpc_Translation
  • Horde_Rpc_Webdav
  • Horde_Rpc_Webdav2
  • Horde_Rpc_Xmlrpc
  • Overview
  • Package
  • Class
  • Tree
 1: <?php
 2: /**
 3:  * The Horde_Rpc_Syncml class provides a SyncML implementation of the Horde
 4:  * RPC system.
 5:  *
 6:  * Copyright 2003-2012 Horde LLC (http://www.horde.org/)
 7:  *
 8:  * See the enclosed file COPYING for license information (LGPL). If you
 9:  * did not receive this file, see http://www.horde.org/licenses/lgpl21.
10:  *
11:  * @author  Chuck Hagenbuch <chuck@horde.org>
12:  * @author  Anthony Mills <amills@pyramid6.com>
13:  * @package Rpc
14:  */
15: class Horde_Rpc_Syncml extends Horde_Rpc
16: {
17:     /**
18:      * SyncML handles authentication internally, so bypass the RPC framework
19:      * auth check by just returning true here.
20:      */
21:     function authorize()
22:     {
23:         return true;
24:     }
25: 
26:     /**
27:      * Sends an RPC request to the server and returns the result.
28:      *
29:      * @param string $request  The raw request string.
30:      *
31:      * @return string  The XML encoded response from the server.
32:      */
33:     function getResponse($request)
34:     {
35:         $backendparms = array(
36:             /* Write debug output to this dir, must be writeable be web
37:              * server. */
38:             'debug_dir' => '/tmp/sync',
39:             /* Log all (wb)xml packets received or sent to debug_dir. */
40:             'debug_files' => true,
41:             /* Log everything. */
42:             'log_level' => 'DEBUG');
43: 
44:         /* Create the backend. */
45:         $GLOBALS['backend'] = Horde_SyncMl_Backend::factory('Horde', $backendparms);
46: 
47:         /* Handle request. */
48:         $h = new Horde_SyncMl_ContentHandler();
49:         $response = $h->process(
50:             $request, $this->getResponseContentType(),
51:             Horde::url($GLOBALS['registry']->get('webroot', 'horde') . '/rpc.php',
52:                        true, -1));
53: 
54:         /* Close the backend. */
55:         $GLOBALS['backend']->close();
56: 
57:         return $response;
58:     }
59: 
60:     /**
61:      * Returns the Content-Type of the response.
62:      *
63:      * @return string  The MIME Content-Type of the RPC response.
64:      */
65:     function getResponseContentType()
66:     {
67:         return 'application/vnd.syncml+xml';
68:     }
69: 
70: }
71: 
API documentation generated by ApiGen