phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] sync/inc/class.so_sync.inc.php, 1.23


From: nomail
Subject: [Phpgroupware-cvs] sync/inc/class.so_sync.inc.php, 1.23
Date: Thu, 20 May 2004 14:06:30 -0000

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

date: 2004/04/06 09:30:55;  author: mkaemmerer;  state: Exp;  lines: +18 -9

Log Message:
- misc bugfixes
=====================================================================
No syntax errors detected in -
=====================================================================
Index: sync/inc/class.so_sync.inc.php
diff -u sync/inc/class.so_sync.inc.php:1.22 sync/inc/class.so_sync.inc.php:1.23
--- sync/inc/class.so_sync.inc.php:1.22 Mon Mar 15 16:59:28 2004
+++ sync/inc/class.so_sync.inc.php      Tue Apr  6 09:30:55 2004
@@ -124,19 +124,21 @@
     * Get all devices for a given phpGW user
     *
     * @param string $account_id internal phpGW account id (same as 
$GLOBALS['phpgw_info']['user']['account_id']) of the user who owns this device 
-    * @param array &$devicelist output-var which holds the devicelist
+    * @param array &$devicelist output var which holds the devicelist
     * @return boolean true if the user has devices
     */
     
     function GetDeviceList($account_id, &$devicelist)
     {
       $devicelist = array();
-      $result = false;
-      $GLOBALS['phpgw']->db->query("SELECT deviceid,uri FROM phpgw_syncdevices 
WHERE accountid='".$account_id."'",__LINE__,__FILE__);
+      $result = $GLOBALS['phpgw']->db->query("SELECT deviceid, accountid, uri, 
description, username FROM phpgw_syncdevices WHERE 
accountid='".$account_id."'",__LINE__,__FILE__);
       while ($GLOBALS['phpgw']->db->next_record())
       {
-        $result = true;
-        $devicelist[$GLOBALS['phpgw']->db->f('deviceid')] = 
$GLOBALS['phpgw']->db->f('uri');
+        $devicelist[$GLOBALS['phpgw']->db->f('deviceid')] = array(
+          $GLOBALS['phpgw']->db->f('accountid'),
+          $GLOBALS['phpgw']->db->f('uri'),
+          $GLOBALS['phpgw']->db->f('description'),
+          $GLOBALS['phpgw']->db->f('username'));
       }
       
       return $result;
@@ -169,7 +171,7 @@
     }
     
     /**
-     * Delete a Device from the database
+     * Delete a Device with all connected ressources from the database
      *
      * @param string $DeviceID unique internal identifier of the device
      * @return boolean DeviceID of the deleted device
@@ -177,8 +179,15 @@
 
     function DeleteDevice($DeviceID)
     {
+      // todo: error handling
       $GLOBALS['phpgw']->db->query("DELETE FROM phpgw_syncdevices WHERE 
deviceid='".$DeviceID."'",__LINE__,__FILE__);
-      return $GLOBALS['phpgw']->db->f('deviceid');
+      
+      
+      $GLOBALS['phpgw']->db->query("DELETE FROM phpgw_syncdevices WHERE 
deviceid='".$DeviceID."'",__LINE__,__FILE__);
+      $GLOBALS['phpgw']->db->query("DELETE FROM phpgw_syncchannels WHERE 
deviceid='".$DeviceID."'",__LINE__,__FILE__);
+      
+      
+      return $GLOBALS['phpgw']->db->f('deviceid');      
     }
 
     /******************************************************************/
@@ -310,7 +319,7 @@
         if (!$GLOBALS['phpgw']->db->next_record())
         {
           $GLOBALS['phpgw']->db->query("INSERT INTO phpgw_syncchannels 
(deviceid, sourceid, lastanchor, startsync, stopsync) "
-            . "VALUES ('$deviceid','$sourceid', 0, 0, 0)",__LINE__,__FILE__);
+            . "VALUES ('$deviceid','$sourceid', '', 0, 0)",__LINE__,__FILE__);
           return 
$GLOBALS['phpgw']->db->get_last_insert_id('phpgw_syncchannels', 'channelid');
         } else
           return $GLOBALS['phpgw']->db->f('channelid');




reply via email to

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