summaryrefslogtreecommitdiff
path: root/program
diff options
context:
space:
mode:
Diffstat (limited to 'program')
-rw-r--r--program/lib/Roundcube/rcube_addressbook.php16
-rw-r--r--program/steps/addressbook/delete.inc2
-rw-r--r--program/steps/addressbook/export.inc4
-rw-r--r--program/steps/addressbook/func.inc18
-rw-r--r--program/steps/addressbook/list.inc2
-rw-r--r--program/steps/addressbook/search.inc2
6 files changed, 21 insertions, 23 deletions
diff --git a/program/lib/Roundcube/rcube_addressbook.php b/program/lib/Roundcube/rcube_addressbook.php
index 421062772..cbc3c6773 100644
--- a/program/lib/Roundcube/rcube_addressbook.php
+++ b/program/lib/Roundcube/rcube_addressbook.php
@@ -524,6 +524,22 @@ abstract class rcube_addressbook
}
/**
+ * Create a unique key for sorting contacts
+ */
+ public static function compose_contact_key($contact, $sort_col)
+ {
+ $key = $contact[$sort_col] . ':' . $row['sourceid'];
+
+ // add email to a key to not skip contacts with the same name (#1488375)
+ if (!empty($contact['email'])) {
+ $key .= ':' . implode(':', (array)$contact['email']);
+ }
+
+ return $key;
+ }
+
+
+ /**
* Compare search value with contact data
*
* @param string $colname Data name
diff --git a/program/steps/addressbook/delete.inc b/program/steps/addressbook/delete.inc
index 81b8a0970..56118583c 100644
--- a/program/steps/addressbook/delete.inc
+++ b/program/steps/addressbook/delete.inc
@@ -93,7 +93,7 @@ if (($search_request = $_REQUEST['_search']) && isset($_SESSION['search'][$searc
while ($row = $result->next()) {
$row['sourceid'] = $s;
- $key = rcmail_contact_key($row, $sort_col);
+ $key = rcube_addressbook::compose_contact_key($row, $sort_col);
$records[$key] = $row;
}
unset($result);
diff --git a/program/steps/addressbook/export.inc b/program/steps/addressbook/export.inc
index fc9f23fa1..15bf8b0d4 100644
--- a/program/steps/addressbook/export.inc
+++ b/program/steps/addressbook/export.inc
@@ -61,7 +61,7 @@ if (!empty($_REQUEST['_search']) && isset($_SESSION['search'][$_REQUEST['_search
}
$record['sourceid'] = $s;
- $key = rcmail_contact_key($record, $sort_col);
+ $key = rcube_addressbook::compose_contact_key($record, $sort_col);
$records[$key] = $record;
}
@@ -109,7 +109,7 @@ else if (!empty($_REQUEST['_cid'])) {
}
$record['sourceid'] = $s;
- $key = rcmail_contact_key($record, $sort_col);
+ $key = rcube_addressbook::compose_contact_key($record, $sort_col);
$records[$key] = $record;
}
}
diff --git a/program/steps/addressbook/func.inc b/program/steps/addressbook/func.inc
index 2f47483de..7fb862d5e 100644
--- a/program/steps/addressbook/func.inc
+++ b/program/steps/addressbook/func.inc
@@ -733,24 +733,6 @@ function rcmail_format_date_col($val)
}
-function rcmail_contact_key($row, $sort_col)
-{
- $key = $row[$sort_col] . ':' . $row['sourceid'];
-
- // add email to a key to not skip contacts with the same name (#1488375)
- if (!empty($row['email'])) {
- if (is_array($row['email'])) {
- $key .= ':' . implode(':', $row['email']);
- }
- else {
- $key .= ':' . $row['email'];
- }
- }
-
- return $key;
-}
-
-
/**
* Returns contact ID(s) and source(s) from GET/POST data
*
diff --git a/program/steps/addressbook/list.inc b/program/steps/addressbook/list.inc
index 06a1e10a3..1bb28658b 100644
--- a/program/steps/addressbook/list.inc
+++ b/program/steps/addressbook/list.inc
@@ -49,7 +49,7 @@ if (!empty($_REQUEST['_search']) && isset($_SESSION['search'][$_REQUEST['_search
while ($row = $result->next()) {
$row['sourceid'] = $s;
- $key = rcmail_contact_key($row, $sort_col);
+ $key = rcube_addressbook::compose_contact_key($row, $sort_col);
$records[$key] = $row;
}
unset($result);
diff --git a/program/steps/addressbook/search.inc b/program/steps/addressbook/search.inc
index bbd9b9a76..d153c255a 100644
--- a/program/steps/addressbook/search.inc
+++ b/program/steps/addressbook/search.inc
@@ -184,7 +184,7 @@ function rcmail_contact_search()
while ($row = $result->next()) {
$row['sourceid'] = $s['id'];
- $key = rcmail_contact_key($row, $sort_col);
+ $key = rcube_addressbook::compose_contact_key($row, $sort_col);
$records[$key] = $row;
}