[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] sync/inc/class.bo_sync.inc.php, 1.42
From: |
nomail |
Subject: |
[Phpgroupware-cvs] sync/inc/class.bo_sync.inc.php, 1.42 |
Date: |
Wed, 9 Jun 2004 20:35:09 +0200 |
Update of /sync/inc
Modified Files:
Branch:
class.bo_sync.inc.php
date: 2004/06/09 18:35:09; author: mkaemmerer; state: Exp; lines: +34 -27
Log Message:
- new sourceinfo and mimetype handling
=====================================================================
Index: sync/inc/class.bo_sync.inc.php
diff -u sync/inc/class.bo_sync.inc.php:1.41 sync/inc/class.bo_sync.inc.php:1.42
--- sync/inc/class.bo_sync.inc.php:1.41 Mon Jun 7 15:56:51 2004
+++ sync/inc/class.bo_sync.inc.php Wed Jun 9 18:35:09 2004
@@ -116,8 +116,16 @@
// switch user if device is authorized and the user is different from
current one
if (($ret >= 0) and ($phpgw_accountid <>
$GLOBALS['phpgw_info']['user']['account_id']))
{
- $sess = $this->SwitchUser($ret);
+ // store session data in local process, because the user
+ // switching destroys them
+ $session_data =
$GLOBALS['phpgw']->session->appsession('session_data','sync');
+
+ $sess = $this->SwitchUser($ret);
+
+ // restore session data again
+ $GLOBALS['phpgw']->session->appsession('session_data','sync',
$session_data);
+
if ($this->debug)
error_log("AuthenticateSyncDevice: got new session: " . $sess);
}
@@ -167,8 +175,10 @@
*/
function readDeviceInfoByID($deviceid) {
+ /*
if ($this->debug)
- error_log("readPrincipalByID device: [$deviceid]");
+ error_log("readPrincipalByID device: [$deviceid]");
+ */
$result = $this->so->GetDeviceInfo($deviceid);
if (! is_array($result)) return array();
@@ -210,20 +220,14 @@
return array(-2, $LUID, null);
} else
{
-
- // temporary work around for palm vcard problem: palm uses vcard 3.0,
others 2.1 (Weblicon Client)
- // will be replaced by mime version handling from device information
later
- // Synthesis uses also 3.0 for PocketPC
- // sync4j for ppc uses 17 chars length URI and 3.0
- $devinfo = $this->so->GetDeviceInfo($deviceid);
- if ((strpos($devinfo['uri'], "Palm") > 0) || (strpos($devinfo['uri'],
"ebliconSync_") > 0)
- || (strlen($devinfo['uri']) == 20) ||(strlen($devinfo['uri']) == 17))
- {
- error_log('Temporary fix: Detected Palm, Sync4j or Synthesis Client,
using MIME Version 3.0');
- $data = $this->ipc->getData($GUID, $mimetype, '3.0');
+ $session_data =
$GLOBALS['phpgw']->session->appsession('session_data','sync');
+ if (isset($session_data))
+ {
+ $mimetype =
$session_data['sync_currentsourceinfo']['contentType.RX.type'];
+ $mimeversion =
$session_data['sync_currentsourceinfo']['contentType.RX.version'];
}
- else
- $data = $this->ipc->getData($GUID, $mimetype);
+
+ $data = $this->ipc->getData($GUID, $mimetype, $mimeversion);
if ($data == false)
{
@@ -248,11 +252,12 @@
* If the module
* changes the data or LUID (if it is new), then the new data
* and LUID is returned
+ * Mimetype and version will be overriden by session data, if possible
+ *
* @param integer $deviceid is the deviceid of the device which whant to
* do the sync
* @param string $source Source-URI of the source to sync
* @param string $LUID - the Items Unique Identifier ID (also called key)
- * @param string $mimetype - holds the mimetype of Itemdata
* @param mixed $Itemdata - holds the Item binary data (base64encoded)
* @return boolean true if SyncItem is successful set
*/
@@ -261,18 +266,22 @@
// set the responsible IPC class of the responsible module
if ($this->GetIpcforSource($source) == false) return false;
+ $session_data =
$GLOBALS['phpgw']->session->appsession('session_data','sync');
+ if (isset($session_data))
+ {
+ $mimetype =
$session_data['sync_currentsourceinfo']['contentType.TX.type'];
+ $mimeversion =
$session_data['sync_currentsourceinfo']['contentType.TX.version'];
+ }
+
// get the mapped GUID
$GUID = $this->so->getGUIDExt($deviceid, $source, $LUID);
if ($GUID == -1)
{
// no GUID found -> then we have to replace not add
-
- $data = $GLOBALS['phpgw']->session->appsession('session_data','sync');
-
- $result = $this->ipc->addData($Itemdata, $mimetype, '',
$data['syncstart_timestamp']);
-
+ $result = $this->ipc->addData($Itemdata, $mimetype, $mimeversion,
$session_data['syncstart_timestamp']);
+
if ($this->debug)
- error_log("setSyncItem: new item with result: $result and timestamp:
".$data['syncstart_timestamp']);
+ error_log("setSyncItem: new item with result: $result and timestamp:
".$session_data['syncstart_timestamp']);
if (! is_bool($result))
{
@@ -284,12 +293,10 @@
else
{
// LUID found -> then we have to add
- $data = $GLOBALS['phpgw']->session->appsession('session_data','sync');
+ $result = $this->ipc->replaceData($GUID, $Itemdata, $mimetype,
$mimeversion, $session_data['syncstart_timestamp']);
if ($this->debug)
- error_log("setSyncItem: replacing item $GUID, timestamp:
".$data['syncstart_timestamp']);;
-
- $result = $this->ipc->replaceData($GUID, $Itemdata, $mimetype, '',
$data['syncstart_timestamp']);
+ error_log("setSyncItem: replacing item $GUID, timestamp:
".$session_data['syncstart_timestamp']);;
}
if (is_bool($result))
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] sync/inc/class.bo_sync.inc.php, 1.42,
nomail <=