phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] sync/inc/class.bo_sync.inc.php, 1.25


From: nomail
Subject: [Phpgroupware-cvs] sync/inc/class.bo_sync.inc.php, 1.25
Date: Thu, 20 May 2004 13:40:55 -0000

Update of /sync/inc
Modified Files:
        Branch: 
          class.bo_sync.inc.php

date: 2004/04/14 17:47:03;  author: mkaemmerer;  state: Exp;  lines: +14 -7

Log Message:
- moved base64_decode from bo to ipc classes
- added todo's for documentation
- do not switch user if user is already logged in
=====================================================================
No syntax errors detected in -
=====================================================================
Index: sync/inc/class.bo_sync.inc.php
diff -u sync/inc/class.bo_sync.inc.php:1.24 sync/inc/class.bo_sync.inc.php:1.25
--- sync/inc/class.bo_sync.inc.php:1.24 Thu Mar 18 12:57:50 2004
+++ sync/inc/class.bo_sync.inc.php      Wed Apr 14 17:47:03 2004
@@ -67,12 +67,14 @@
     * @param string $password clear text password of user to authenticate
     * @param string $device_id is the device_id of the device which whant to 
     *        do the sync
+    * //!! Todo: return parameter is array
     * @return int deviceid (db-entry-id) >= 0 if is successful 
     */
        
        function AuthenticateSyncDevice($URI, $username, $password)
     {
       $device_id = $this->so->GetDevice($URI, $username, $password);
+      $phpgw_accountid = $this->so->GetAccountIDfromUsername($username, 
$password);
       if ($device_id >= 0)
       {
         // device already exists
@@ -81,15 +83,17 @@
          // compare to phpGW username/password -> add device, if user exists
          if ($GLOBALS['phpgw']->auth->authenticate($username, $password, 
'text'))
         {
-          $phpgw_accountid = $this->so->GetAccountIDfromUsername($username, 
$password);
           $ret = $this->so->AddDevice($phpgw_accountid, $URI, $username, 
$password);
                } else {
           // no user, no device -> return error
           $ret = -1;
         }
       }
-      // Switch user if device is authorized
-      if ($ret >= 0) $sess = $this->SwitchUser($ret);
+      // 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);
+      }
 
       if ($this->debug)
         error_log("new session: " . $sess);     
@@ -166,8 +170,10 @@
        
        // 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
        $devinfo = $this->so->GetDeviceInfo($device_id);
-       if ((strpos($devinfo['uri'], "Palm") > 0) || (strpos($devinfo['uri'], 
"ebliconSync_") > 0))
+       if ((strpos($devinfo['uri'], "Palm") > 0) || (strpos($devinfo['uri'], 
"ebliconSync_") > 0) 
+          || strlen($devinfo['uri'] == 20))
          $data = $this->ipc->getData($GUID, $mimetype, '3.0');
        else
          $data = $this->ipc->getData($GUID, $mimetype);
@@ -213,7 +219,7 @@
       if ($GUID == -1)
       {
         // no GUID found -> then we have to replace not add
-        $result = $this->ipc->addData(base64_decode($Itemdata), $mimetype);
+        $result = $this->ipc->addData($Itemdata, $mimetype);
         if ($this->debug)
           error_log("setSyncItem: new Item with Result: $result");
         if (! is_bool($result))
@@ -228,7 +234,7 @@
         // LUID found -> then we have to add
         if ($this->debug)
           error_log("setSyncItem: replacing Item $GUID");
-        $result = $this->ipc->replaceData($GUID, base64_decode($Itemdata), 
$mimetype);
+        $result = $this->ipc->replaceData($GUID, $Itemdata, $mimetype);
       }
       if (is_bool($result))
       {
@@ -405,6 +411,7 @@
     function addClientMappings($device_id, $source, $mapping) {
       // cache channelid for our $deviceid and $source
       $channelid = $this->so->GetChannelIDfromSourceAndDeviceID($device_id, 
$source);
+      error_log("channelid: $channelid");
       
       foreach($mapping as $LUID => $GUID)
       {




reply via email to

[Prev in Thread] Current Thread [Next in Thread]