Contacts: Better parameter names in addressbook share backend
This commit is contained in:
parent
be03ee29f0
commit
6d971d3b1d
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
class OC_Share_Backend_Addressbook implements OCP\Share_Backend_Collection {
|
class OC_Share_Backend_Addressbook implements OCP\Share_Backend_Collection {
|
||||||
const FORMAT_ADDRESSBOOKS = 1;
|
const FORMAT_ADDRESSBOOKS = 1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the source of the item to be stored in the database
|
* @brief Get the source of the item to be stored in the database
|
||||||
* @param string Item
|
* @param string Item
|
||||||
|
@ -19,9 +20,9 @@ class OC_Share_Backend_Addressbook implements OCP\Share_Backend_Collection {
|
||||||
*
|
*
|
||||||
* The formatItems() function will translate the source returned back into the item
|
* The formatItems() function will translate the source returned back into the item
|
||||||
*/
|
*/
|
||||||
public function isValidSource($item, $uid) {
|
public function isValidSource($itemSource, $uidOwner) {
|
||||||
$addressbook = OC_Contacts_Addressbook::find( $item );
|
$addressbook = OC_Contacts_Addressbook::find( $itemSource );
|
||||||
if( $addressbook === false || $addressbook['userid'] != $uid) {
|
if( $addressbook === false || $addressbook['userid'] != $uidOwner) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -37,8 +38,8 @@ class OC_Share_Backend_Addressbook implements OCP\Share_Backend_Collection {
|
||||||
* This function needs to verify that the user does not already have an item with this name.
|
* This function needs to verify that the user does not already have an item with this name.
|
||||||
* If it does generate a new name e.g. name_#
|
* If it does generate a new name e.g. name_#
|
||||||
*/
|
*/
|
||||||
public function generateTarget($item, $uid, $exclude = null) {
|
public function generateTarget($itemSource, $shareWith, $exclude = null) {
|
||||||
$addressbook = OC_Contacts_Addressbook::find( $item );
|
$addressbook = OC_Contacts_Addressbook::find( $itemSource );
|
||||||
$user_addressbooks = array();
|
$user_addressbooks = array();
|
||||||
foreach(OC_Contacts_Addressbook::all($uid) as $user_addressbook) {
|
foreach(OC_Contacts_Addressbook::all($uid) as $user_addressbook) {
|
||||||
$user_addressbooks[] = $user_addressbook['displayname'];
|
$user_addressbooks[] = $user_addressbook['displayname'];
|
||||||
|
@ -77,9 +78,9 @@ class OC_Share_Backend_Addressbook implements OCP\Share_Backend_Collection {
|
||||||
return $addressbooks;
|
return $addressbooks;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getChildren($item) {
|
public function getChildren($itemSource) {
|
||||||
$query = OCP\DB::prepare('SELECT id FROM *PREFIX*contacts_cards WHERE addressbookid = ?');
|
$query = OCP\DB::prepare('SELECT id FROM *PREFIX*contacts_cards WHERE addressbookid = ?');
|
||||||
$result = $query->execute(array($item));
|
$result = $query->execute(array($itemSource));
|
||||||
$sources = array();
|
$sources = array();
|
||||||
while ($contact = $result->fetchRow()) {
|
while ($contact = $result->fetchRow()) {
|
||||||
$sources[] = $contact['id'];
|
$sources[] = $contact['id'];
|
||||||
|
|
Loading…
Reference in New Issue