From 2965a981b7ec22866fbdf2d567d87e2d068d3617 Mon Sep 17 00:00:00 2001
From: Thomas Bruederli <thomas@roundcube.net>
Date: Fri, 31 Jul 2015 16:04:08 -0400
Subject: [PATCH] Allow to search and import missing PGP pubkeys from keyservers using Publickey.js
---
plugins/example_addressbook/example_addressbook_backend.php | 62 ++++++++++++++++++++++++++----
1 files changed, 53 insertions(+), 9 deletions(-)
diff --git a/plugins/example_addressbook/example_addressbook_backend.php b/plugins/example_addressbook/example_addressbook_backend.php
index ad6b89d..8c143c2 100644
--- a/plugins/example_addressbook/example_addressbook_backend.php
+++ b/plugins/example_addressbook/example_addressbook_backend.php
@@ -11,20 +11,28 @@
{
public $primary_key = 'ID';
public $readonly = true;
-
+ public $groups = true;
+
private $filter;
private $result;
-
- public function __construct()
+ private $name;
+
+ public function __construct($name)
{
$this->ready = true;
+ $this->name = $name;
}
-
+
+ public function get_name()
+ {
+ return $this->name;
+ }
+
public function set_search_set($filter)
{
$this->filter = $filter;
}
-
+
public function get_search_set()
{
return $this->filter;
@@ -36,15 +44,23 @@
$this->filter = null;
}
+ function list_groups($search = null)
+ {
+ return array(
+ array('ID' => 'testgroup1', 'name' => "Testgroup"),
+ array('ID' => 'testgroup2', 'name' => "Sample Group"),
+ );
+ }
+
public function list_records($cols=null, $subset=0)
{
$this->result = $this->count();
$this->result->add(array('ID' => '111', 'name' => "Example Contact", 'firstname' => "Example", 'surname' => "Contact", 'email' => "example@roundcube.net"));
-
+
return $this->result;
}
- public function search($fields, $value, $strict=false, $select=true)
+ public function search($fields, $value, $strict=false, $select=true, $nocount=false, $required=array())
{
// no search implemented, just list all records
return $this->list_records();
@@ -65,8 +81,36 @@
$this->list_records();
$first = $this->result->first();
$sql_arr = $first['ID'] == $id ? $first : null;
-
+
return $assoc && $sql_arr ? $sql_arr : $this->result;
}
-
+
+
+ function create_group($name)
+ {
+ $result = false;
+
+ return $result;
+ }
+
+ function delete_group($gid)
+ {
+ return false;
+ }
+
+ function rename_group($gid, $newname)
+ {
+ return $newname;
+ }
+
+ function add_to_group($group_id, $ids)
+ {
+ return false;
+ }
+
+ function remove_from_group($group_id, $ids)
+ {
+ return false;
+ }
+
}
--
Gitblit v1.9.1