summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2012-09-20 12:23:03 (GMT)
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-09-21 12:01:39 (GMT)
commit352907e740bdb88a62d40c2a83edd3431f525eeb (patch)
tree0eca691c3a0609d1f20d2fafe462e915c9ac5c95
parent6601556cc58bf66006d1cd61ee212a3d47ef7fd7 (diff)
downloadkolab-syncroton-352907e740bdb88a62d40c2a83edd3431f525eeb.tar.gz
Clean up and simplify last commits
-rw-r--r--lib/kolab_sync_backend.php17
-rw-r--r--lib/kolab_sync_data.php15
2 files changed, 6 insertions, 26 deletions
diff --git a/lib/kolab_sync_backend.php b/lib/kolab_sync_backend.php
index a8fc4f2..1950159 100644
--- a/lib/kolab_sync_backend.php
+++ b/lib/kolab_sync_backend.php
@@ -110,23 +110,6 @@ class kolab_sync_backend
$this->storage->set_pagesize(999999);
}
- public static function default_type_id_for_type($type) {
- if (!isset(self::$types[$type])) {
- return $type;
- }
-
- $type_str = self::$types[$type];
-
- $default_type_str = self::$types[$type] . ".default";
-
- $default_type_id = array_search($default_type_str, self::$types);
-
- if (!$default_type_id) {
- return $type;
- } else {
- return $default_type_id;
- }
- }
/**
* List known devices
diff --git a/lib/kolab_sync_data.php b/lib/kolab_sync_data.php
index 0cdb25c..9b647f5 100644
--- a/lib/kolab_sync_data.php
+++ b/lib/kolab_sync_data.php
@@ -183,19 +183,18 @@ abstract class kolab_sync_data implements Syncroton_Data_IData
*/
public function getAllFolders()
{
- $_list = array();
$list = array();
// device supports multiple folders ?
if (in_array(strtolower($this->device->devicetype), array('iphone', 'ipad', 'thundertine', 'windowsphone'))) {
// get the folders the user has access to
- $_list = $this->backend->folders_list($this->device->deviceid, $this->modelName);
+ $list = $this->backend->folders_list($this->device->deviceid, $this->modelName);
}
else if ($default = $this->getDefaultFolder()) {
- $_list = array($default['serverId'] => $default);
+ $list = array($default['serverId'] => $default);
}
- foreach ($_list as $idx => $folder) {
+ foreach ($list as $idx => $folder) {
$list[$idx] = new Syncroton_Model_Folder($folder);
}
@@ -207,8 +206,6 @@ abstract class kolab_sync_data implements Syncroton_Data_IData
*/
protected function getDefaultFolder()
{
- $default = null;
-
// Check if there's any folder configured for sync
$folders = $this->backend->folders_list($this->device->deviceid, $this->modelName);
@@ -225,10 +222,10 @@ abstract class kolab_sync_data implements Syncroton_Data_IData
// Return first on the list if there's no default
if (empty($default)) {
- $keys = array_keys($folders);
- $key = array_shift($keys);
+ $key = array_shift(array_keys($folders));
$default = $folders[$key];
- $default['type'] = kolab_sync_backend::default_type_id_for_type($default['type']);
+ // make sure the type is default here
+ $default['type'] = $this->defaultFolderType;
}
// Remember real folder ID and set ID/name to root folder