1: <?php
2: /**
3: * Handle GetHierarchy requests from older activesync clients.
4: *
5: * Logic adapted from Z-Push, original copyright notices below.
6: *
7: * Copyright 2009-2012 Horde LLC (http://www.horde.org/)
8: *
9: * @author Michael J. Rubinsky <mrubinsk@horde.org>
10: * @package ActiveSync
11: */
12: /**
13: * Zarafa Deutschland GmbH, www.zarafaserver.de
14: * This file is distributed under GPL-2.0.
15: * Consult COPYING file for details
16: */
17: class Horde_ActiveSync_Request_GetHierarchy extends Horde_ActiveSync_Request_Base
18: {
19: /**
20: * Handle request
21: *
22: * @return boolean
23: */
24: public function handle()
25: {
26: $folders = $this->_driver->getHierarchy();
27: if (!$folders) {
28: return false;
29: }
30:
31: /* save folder-ids for fourther syncing */
32: $this->_stateMachine->setFolderData($this->_device, $folders);
33:
34: $this->_encoder->StartWBXML();
35: $this->_encoder->startTag(self::FOLDERHIERARCHY_FOLDERS);
36:
37: foreach ($folders as $folder) {
38: $this->_encoder->startTag(self::FOLDERHIERARCHY_FOLDER);
39: $folder->encodeStream($this->_encoder);
40: $this->_encoder->endTag();
41: }
42: $this->_encoder->endTag();
43:
44: return true;
45: }
46: }