[ Index ]
 

Code source de Horde 3.1.3

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/lib/SyncML/Device/ -> Nokia.php (source)

   1  <?php
   2  /**
   3   * The SyncML_Device_Nokia:: class provides functionality that is
   4   * specific to the Nokia SyncML clients.
   5   *
   6   * Copyright 2005-2006 Karsten Fourmont <karsten@horde.org>
   7   *
   8   * See the enclosed file COPYING for license information (LGPL). If you did not
   9   * receive this file, see http://www.fsf.org/copyleft/lgpl.html.
  10   *
  11   * $Horde: framework/SyncML/SyncML/Device/Nokia.php,v 1.2.2.3 2006/05/01 12:05:14 jan Exp $
  12   *
  13   * @author  Karsten Fourmont <karsten@horde.org>
  14   * @package SyncML
  15   */
  16  class SyncML_Device_Nokia extends SyncML_Device {
  17  
  18      /**
  19       * Converts the content from the backend to a format suitable for the
  20       * client device.
  21       *
  22       * Strips the uid (primary key) information as client and server might use
  23       * different ones.
  24       *
  25       * @param string $content       The content to convert
  26       * @param string $contentType   The contentType of content as returned from
  27       *                              the backend
  28       * @return array                array($newcontent, $newcontentType):
  29       *                              the converted content and the
  30       *                              (possibly changed) new ContentType.
  31       */
  32      function convertServer2Client($content, $contentType)
  33      {
  34          global $backend;
  35  
  36          list($content, $contentType) =
  37              parent::convertServer2Client($content, $contentType);
  38  
  39          // FIXME: just swapping out the version number in the header
  40          // so that the client doesn't immediately deny with a "Format
  41          // not supported". See http://bugs.horde.org/ticket/?id=1881.
  42          $content = preg_replace('/(\r\n|\r|\n)VERSION:2.0/', '\1VERSION:1.0', $content, 1);
  43  
  44          if (DEBUGLOG_ICALENDARDATA) {
  45              $fp = @fopen('/tmp/sync/log.txt', 'a');
  46              if ($fp) {
  47                  @fwrite($fp, "\noutput converted for client ($contentType):\n");
  48                  @fwrite($fp, $content . "\n");
  49                  @fclose($fp);
  50              }
  51          }
  52  
  53          return array($content, $contentType);
  54      }
  55  
  56      /* Nokia currently expects notes as text/plain. Maybe we can extract
  57       * this from DevInf rather than hardcode it.
  58       */
  59  
  60     function getPreferredContentType($type)
  61      {
  62           if ($type == 'notes') {
  63              return 'text/plain';
  64          }
  65          return parent::getPreferredContentType($type);
  66      }
  67  
  68     function handleTasksInCalendar()
  69     {
  70        return true;      
  71     }
  72  }


Généré le : Sun Feb 25 18:01:28 2007 par Balluche grâce à PHPXref 0.7