summaryrefslogtreecommitdiff
path: root/roundcubemail/program/include
diff options
context:
space:
mode:
authorthomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c>2011-10-10 20:15:46 +0000
committerthomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c>2011-10-10 20:15:46 +0000
commit4dc279dae5fb66d8210a80c5f7f748b7df86cee9 (patch)
tree2ef14884c8184e8bfe9d9919c7df959cca4d1b04 /roundcubemail/program/include
parent77a043ad524b982dd05ed54343b2361a25829a9b (diff)
Contact groups can have direct email addresses => distribution lists; enable 'compose' command for the selected group
git-svn-id: https://svn.roundcube.net/trunk@5328 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program/include')
-rw-r--r--roundcubemail/program/include/rcube_addressbook.php12
-rw-r--r--roundcubemail/program/include/rcube_contacts.php33
2 files changed, 41 insertions, 4 deletions
diff --git a/roundcubemail/program/include/rcube_addressbook.php b/roundcubemail/program/include/rcube_addressbook.php
index 88f0aa900..7270f42fd 100644
--- a/roundcubemail/program/include/rcube_addressbook.php
+++ b/roundcubemail/program/include/rcube_addressbook.php
@@ -296,6 +296,18 @@ abstract class rcube_addressbook
}
/**
+ * Get group properties such as name and email address(es)
+ *
+ * @param string Group identifier
+ * @return array Group properties as hash array
+ */
+ function get_group($group_id)
+ {
+ /* empty for address books don't supporting groups */
+ return null;
+ }
+
+ /**
* Create a contact group with the given name
*
* @param string The group name
diff --git a/roundcubemail/program/include/rcube_contacts.php b/roundcubemail/program/include/rcube_contacts.php
index c810ce60e..a2eeffc8a 100644
--- a/roundcubemail/program/include/rcube_contacts.php
+++ b/roundcubemail/program/include/rcube_contacts.php
@@ -164,6 +164,29 @@ class rcube_contacts extends rcube_addressbook
/**
+ * Get group properties such as name and email address(es)
+ *
+ * @param string Group identifier
+ * @return array Group properties as hash array
+ */
+ function get_group($group_id)
+ {
+ $sql_result = $this->db->query(
+ "SELECT * FROM ".get_table_name($this->db_groups).
+ " WHERE del<>1".
+ " AND contactgroup_id=?".
+ " AND user_id=?",
+ $group_id, $this->user_id);
+
+ if ($sql_result && ($sql_arr = $this->db->fetch_assoc($sql_result))) {
+ $sql_arr['ID'] = $sql_arr['contactgroup_id'];
+ return $sql_arr;
+ }
+
+ return null;
+ }
+
+ /**
* List the current set of contact records
*
* @param array List of cols to show, Null means all
@@ -774,8 +797,9 @@ class rcube_contacts extends rcube_addressbook
$sql_result = $this->db->query(
"UPDATE ".get_table_name($this->db_groups).
" SET del=1, changed=".$this->db->now().
- " WHERE contactgroup_id=?",
- $gid
+ " WHERE contactgroup_id=?".
+ " AND user_id=?",
+ $gid, $this->user_id
);
$this->cache = null;
@@ -799,8 +823,9 @@ class rcube_contacts extends rcube_addressbook
$sql_result = $this->db->query(
"UPDATE ".get_table_name($this->db_groups).
" SET name=?, changed=".$this->db->now().
- " WHERE contactgroup_id=?",
- $name, $gid
+ " WHERE contactgroup_id=?".
+ " AND user_id=?",
+ $name, $gid, $this->user_id
);
return $this->db->affected_rows() ? $name : false;