From 5e161094e74d78a358a5dd405d562931600fff8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Lehrke?= Date: Sun, 12 Sep 2010 12:36:40 +0000 Subject: [PATCH] Allow to check only readable items in content history --- phpgwapi/inc/horde/Horde/SyncML/State_egw.php | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/phpgwapi/inc/horde/Horde/SyncML/State_egw.php b/phpgwapi/inc/horde/Horde/SyncML/State_egw.php index 1297b53491..787c791724 100644 --- a/phpgwapi/inc/horde/Horde/SyncML/State_egw.php +++ b/phpgwapi/inc/horde/Horde/SyncML/State_egw.php @@ -77,12 +77,26 @@ class EGW_SyncML_State extends Horde_SyncML_State * @param string$_appName the appname example: infolog_notes * @param string $_action can be modify, add or delete * @param string $_ts timestamp where to start searching from + * @param array $readableItems (optional) readable items of current user * @return array containing syncIDs with changes */ - function getHistory($_appName, $_action, $_ts) { - $guidList = array (); - $syncIdList = array (); - $idList = $GLOBALS['egw']->contenthistory->getHistory($_appName, $_action, $_ts); + function getHistory($_appName, $_action, $_ts, $readableItems = false) { + $guidList = array(); + $syncIdList = array(); + $userItems = false; + if (is_array($readableItems)) + { + $userItems = array(); + foreach($readableItems as $guid) + { + if (preg_match('/'.$_appName.'-(\d+)$/', $guid, $matches)) + { + // We use only the real items' ids + $userItems[] = $matches[1]; + } + } + } + $idList = $GLOBALS['egw']->contenthistory->getHistory($_appName, $_action, $_ts, $userItems); foreach ($idList as $idItem) { if ($idItem) // ignore inconsistent entries @@ -244,7 +258,7 @@ class EGW_SyncML_State extends Horde_SyncML_State ), __LINE__, __FILE__, false, '', 'syncml') as $row) { $guids[] = $row['map_guid']; } - return $guids ? $guids : false; + return $guids; } /**