/** * Converts the content received from the client for the backend. * * @param string $content The content to convert. * @param string $contentType The content type of the content. * * @return array Two-element array with the converted content and the * (possibly changed) new content type. */ public function convertClient2Server($content, $contentType) { list($content, $contentType) = parent::convertClient2Server($content, $contentType); /* At least the Nokia E series seems to prefix category values with * X-, see bugs #6849 and #7824. */ $di = $GLOBALS['backend']->state->deviceInfo; if ($di->Mod[0] == 'E') { $content = preg_replace('/(\\r\\n|\\r|\\n)CATEGORIES:X-/', '\\1CATEGORIES:', $content, 1); } $GLOBALS['backend']->logFile(Horde_SyncMl_Backend::LOGFILE_DATA, "\nInput converted for server ({$contentType}):\n{$content}\n"); return array($content, $contentType); }
/** * Convert the content. * * @param string $content The content to convert. * @param string $contentType The contentType of the content. * @return array array($newcontent, $newcontentType): * the converted content and the * (possibly changed) new ContentType. */ public function convertClient2Server($content, $contentType) { list($content, $contentType) = parent::convertClient2Server($content, $contentType); $di = $GLOBALS['backend']->state->deviceInfo; if (stristr($di->Mod, 'palm') === false) { // Some special priority handling is required. Synthesis uses 1 // (high), 2 (medium), 3(low), at least for my windows mobile // device. convert these to valid priority settings: $content = preg_replace('/(\\r\\n|\\r|\\n)PRIORITY:3(\\r\\n|\\r|\\n)/', '\\1PRIORITY:5\\2', $content, 1); $content = preg_replace('/(\\r\\n|\\r|\\n)PRIORITY:2(\\r\\n|\\r|\\n)/', '\\1PRIORITY:3\\2', $content, 1); } $GLOBALS['backend']->logFile(Horde_SyncMl_Backend::LOGFILE_DATA, "\ninput converted for server ({$contentType}):\n{$content}\n"); return array($content, $contentType); }
/** * Convert the content. * * @param string $content The content to convert. * @param string $contentType The contentType of the content. * @return array array($newcontent, $newcontentType): * the converted content and the * (possibly changed) new ContentType. */ public function convertClient2Server($content, $contentType) { list($content, $contentType) = parent::convertClient2Server($content, $contentType); /* P800 sends categories as "X-Category". Remove the "X-". * @todo: This hack only works with a single category. */ $content = preg_replace('/(\\r\\n|\\r|\\n)CATEGORIES:X-/', '\\1CATEGORIES:', $content, 1); /* P800 sends all day events as s.th. like * DTSTART:20050505T000000Z^M * DTEND:20050505T240000Z^M * This is no longer an all day event when converted to local timezone. * So manually handle this. */ if (preg_match('/(\\r\\n|\\r|\\n)DTSTART:.*T000000Z(\\r\\n|\\r|\\n)/', $content) && preg_match('/(\\r\\n|\\r|\\n)DTEND:(\\d\\d\\d\\d)(\\d\\d)(\\d\\d)T240000Z(\\r\\n|\\r|\\n)/', $content, $m)) { $content = preg_replace('/(\\r\\n|\\r|\\n)DTSTART:(.*)T000000Z(\\r\\n|\\r|\\n)/', "\$1DTSTART;VALUE=DATE:\$2\$3", $content); /* End timestamp must be converted to next day's date. Or maybe * not? */ $s = date('Ymd', mktime(0, 0, 0, $m[3], $m[4], $m[2])); $content = preg_replace('/(\\r\\n|\\r|\\n)DTEND:(.*)T240000Z(\\r\\n|\\r|\\n)/', "\$1DTEND;VALUE=DATE:{$s}\$3", $content); } $GLOBALS['backend']->logFile(Horde_SyncMl_Backend::LOGFILE_DATA, "\ninput converted for server ({$contentType}):\n{$content}\n"); return array($content, $contentType); }
/** * Convert the content. */ public function convertClient2Server($content, $contentType) { list($content, $contentType) = parent::convertClient2Server($content, $contentType); switch ($contentType) { case 'text/x-s4j-sifn': case 'text/x-sifn': $content = Horde_SyncMl_Device_sync4j::sif2vnote($content); $contentType = 'text/x-vnote'; break; case 'text/x-s4j-sifc': case 'text/x-sifc': $content = Horde_SyncMl_Device_sync4j::sif2vcard($content); $contentType = 'text/x-vcard'; break; case 'text/x-s4j-sife': case 'text/x-sife': $content = Horde_SyncMl_Device_sync4j::sif2vevent($content); $contentType = 'text/calendar'; break; case 'text/x-s4j-sift': case 'text/x-sift': $content = Horde_SyncMl_Device_sync4j::sif2vtodo($content); $contentType = 'text/calendar'; break; case 'text/calendar': case 'text/x-vcalendar': $si = $GLOBALS['backend']->state->sourceURI; if (stristr($si, 'fol-') !== false) { // The Funambol Outlook connector uses invalid STATUS // values. Actually it maps MeetingStatus values of the // Outlook event to the STATUS property, which is // completely useless. So drop the STATUS altogether. $content = preg_replace('/^STATUS:.*\\r?\\n/im', '', $content); } break; } $GLOBALS['backend']->logFile(Horde_SyncMl_Backend::LOGFILE_DATA, "\nInput converted for server ({$contentType}):\n{$content}\n"); return array($content, $contentType); }