Overview

Packages

  • None
  • SyncMl

Classes

  • Horde_SyncMl
  • Horde_SyncMl_Backend
  • Horde_SyncMl_Backend_Horde
  • Horde_SyncMl_Command
  • Horde_SyncMl_Command_Alert
  • Horde_SyncMl_Command_Final
  • Horde_SyncMl_Command_Get
  • Horde_SyncMl_Command_Map
  • Horde_SyncMl_Command_Put
  • Horde_SyncMl_Command_Replace
  • Horde_SyncMl_Command_Results
  • Horde_SyncMl_Command_Status
  • Horde_SyncMl_Command_Sync
  • Horde_SyncMl_Command_SyncHdr
  • Horde_SyncMl_ContentHandler
  • Horde_SyncMl_DataStore
  • Horde_SyncMl_Device
  • Horde_SyncMl_Device_Nokia
  • Horde_SyncMl_Device_P800
  • Horde_SyncMl_Device_sync4j
  • Horde_SyncMl_Device_Sync4JMozilla
  • Horde_SyncMl_Device_Synthesis
  • Horde_SyncMl_DeviceInfo
  • Horde_SyncMl_Property
  • Horde_SyncMl_PropertyParameter
  • Horde_SyncMl_State
  • Horde_SyncMl_Sync
  • Horde_SyncMl_SyncElement
  • Horde_SyncMl_Translation
  • Horde_SyncMl_XmlOutput
  • Overview
  • Package
  • Class
  • Tree
 1: <?php
 2: /**
 3:  * The Horde_SyncMl_Device_Nokia:: class provides functionality that is
 4:  * specific to the Nokia SyncML clients.
 5:  *
 6:  * Copyright 2005-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  Karsten Fourmont <karsten@horde.org>
12:  * @package SyncMl
13:  */
14: class Horde_SyncMl_Device_Nokia extends Horde_SyncMl_Device
15: {
16:     /**
17:      * Converts the content received from the client for the backend.
18:      *
19:      * @param string $content      The content to convert.
20:      * @param string $contentType  The content type of the content.
21:      *
22:      * @return array  Two-element array with the converted content and the
23:      *                (possibly changed) new content type.
24:      */
25:     public function convertClient2Server($content, $contentType)
26:     {
27:         list($content, $contentType) =
28:             parent::convertClient2Server($content, $contentType);
29: 
30:         /* At least the Nokia E series seems to prefix category values with
31:          * X-, see bugs #6849 and #7824. */
32:         $di = $GLOBALS['backend']->state->deviceInfo;
33:         if ($di->Mod[0] == 'E') {
34:             $content = preg_replace('/(\r\n|\r|\n)CATEGORIES:X-/',
35:                                     '\1CATEGORIES:', $content, 1);
36:         }
37: 
38:         $GLOBALS['backend']->logFile(
39:             Horde_SyncMl_Backend::LOGFILE_DATA,
40:             "\nInput converted for server ($contentType):\n$content\n");
41: 
42:         return array($content, $contentType);
43:     }
44: 
45:     /**
46:      * Converts the content from the backend to a format suitable for the
47:      * client device.
48:      *
49:      * Strips the UID (primary key) information as client and server might use
50:      * different ones.
51:      *
52:      * Charset conversions might be added here too.
53:      *
54:      * @param string $content      The content to convert
55:      * @param string $contentType  The content type of content as returned
56:      *                             from the backend
57:      * @param string $database     The server database URI.
58:      *
59:      * @return array  Three-element array with the converted content, the
60:      *                (possibly changed) new content type, and encoding type
61:      *                (like b64 as used by Funambol).
62:      */
63:     public function convertServer2Client($content, $contentType, $database)
64:     {
65:         $database = $GLOBALS['backend']->normalize($database);
66: 
67:         list($content, $contentType, $encodingType) =
68:             parent::convertServer2Client($content, $contentType, $database);
69: 
70:         $content = preg_replace('/(\r\n|\r|\n)PHOTO;ENCODING=b[^:]*:(.+?)(\r\n|\r|\n)/',
71:                                 '\1PHOTO;ENCODING=BASE64:\1\2\1\1',
72:                                 $content, 1);
73: 
74:         $GLOBALS['backend']->logFile(
75:             Horde_SyncMl_Backend::LOGFILE_DATA,
76:             "\nOutput converted for client ($contentType):\n$content\n");
77: 
78:         return array($content, $contentType, null);
79:     }
80: 
81:     public function handleTasksInCalendar()
82:     {
83:         return true;
84:     }
85: 
86:     /**
87:      * Some devices accept datetimes only in local time format:
88:      * DTSTART:20061222T130000
89:      * instead of the more robust (and default) UTC time:
90:      * DTSTART:20061222T110000Z
91:      */
92:     public function useLocalTime()
93:     {
94:         return true;
95:     }
96: }
97: 
API documentation generated by ApiGen