mirror of
https://github.com/owncloudarchive/contacts.git
synced 2024-11-28 10:24:11 +01:00
Scrutinizer Auto-Fixes
This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com
This commit is contained in:
parent
b82e877b0b
commit
cf7c31b6bb
@ -38,7 +38,7 @@ abstract class AbstractPIMObject implements IPIMObject {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param integer $permission
|
* @param integer $permission
|
||||||
* @return boolean
|
* @return integer
|
||||||
*/
|
*/
|
||||||
public function hasPermission($permission) {
|
public function hasPermission($permission) {
|
||||||
return $this->getPermissions() & $permission;
|
return $this->getPermissions() & $permission;
|
||||||
|
@ -23,7 +23,6 @@
|
|||||||
namespace OCA\Contacts;
|
namespace OCA\Contacts;
|
||||||
use OCA\Contacts\Utils\JSONSerializer;
|
use OCA\Contacts\Utils\JSONSerializer;
|
||||||
use OCA\Contacts\Utils\Properties;
|
use OCA\Contacts\Utils\Properties;
|
||||||
use OCA\Contacts\Utils\TemporaryPhoto;
|
|
||||||
use OCA\Contacts\VObject\VCard;
|
use OCA\Contacts\VObject\VCard;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -71,22 +70,22 @@ class AddressbookProvider implements \OCP\IAddressBook {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* In comparison to getKey() this function returns a human readable (maybe translated) name
|
* In comparison to getKey() this function returns a human readable (maybe translated) name
|
||||||
* @return mixed
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getDisplayName() {
|
public function getDisplayName() {
|
||||||
return $this->addressBook->getDisplayName();
|
return $this->addressBook->getDisplayName();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return mixed
|
* @return integer
|
||||||
*/
|
*/
|
||||||
public function getPermissions() {
|
public function getPermissions() {
|
||||||
return $this->addressBook->getPermissions();
|
return $this->addressBook->getPermissions();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $pattern
|
* @param string $pattern
|
||||||
* @param $searchProperties
|
* @param string[] $searchProperties
|
||||||
* @param $options
|
* @param $options
|
||||||
* @return array|false
|
* @return array|false
|
||||||
*/
|
*/
|
||||||
@ -177,7 +176,7 @@ SQL;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $properties
|
* @param $properties
|
||||||
* @return mixed
|
* @return Contact|null
|
||||||
*/
|
*/
|
||||||
public function createOrUpdate($properties) {
|
public function createOrUpdate($properties) {
|
||||||
$addressBook = $this->getAddressbook();
|
$addressBook = $this->getAddressbook();
|
||||||
|
@ -175,7 +175,7 @@ abstract class AbstractBackend {
|
|||||||
* cannot determine the number.
|
* cannot determine the number.
|
||||||
*
|
*
|
||||||
* @param string $addressBookId
|
* @param string $addressBookId
|
||||||
* @return integer|null
|
* @return integer
|
||||||
*/
|
*/
|
||||||
public function numContacts($addressBookId) {
|
public function numContacts($addressBookId) {
|
||||||
|
|
||||||
@ -313,7 +313,7 @@ abstract class AbstractBackend {
|
|||||||
* Same as getContacts except that either 'carddata' or 'vcard' is mandatory.
|
* Same as getContacts except that either 'carddata' or 'vcard' is mandatory.
|
||||||
*
|
*
|
||||||
* @param string $addressBookId
|
* @param string $addressBookId
|
||||||
* @param mixed $id
|
* @param string $id
|
||||||
* @param array $options - Optional options
|
* @param array $options - Optional options
|
||||||
* @return array|null
|
* @return array|null
|
||||||
*/
|
*/
|
||||||
@ -401,7 +401,7 @@ abstract class AbstractBackend {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Query whether a backend or an address book is active
|
* @brief Query whether a backend or an address book is active
|
||||||
* @param string $addressbookid If null it checks whether the backend is activated.
|
* @param string $addressBookId If null it checks whether the backend is activated.
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function isActive($addressBookId = null) {
|
public function isActive($addressBookId = null) {
|
||||||
@ -415,7 +415,7 @@ abstract class AbstractBackend {
|
|||||||
/**
|
/**
|
||||||
* @brief Activate a backend or an address book
|
* @brief Activate a backend or an address book
|
||||||
* @param bool active
|
* @param bool active
|
||||||
* @param string $addressbookid If null it activates the backend.
|
* @param string $addressBookId If null it activates the backend.
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public function setActive($active, $addressBookId = null) {
|
public function setActive($active, $addressBookId = null) {
|
||||||
@ -429,7 +429,6 @@ abstract class AbstractBackend {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief get all the preferences for the addressbook
|
* @brief get all the preferences for the addressbook
|
||||||
* @param string $id
|
|
||||||
* @return array Format array('param1' => 'value', 'param2' => 'value')
|
* @return array Format array('param1' => 'value', 'param2' => 'value')
|
||||||
*/
|
*/
|
||||||
public function getPreferences($addressBookId) {
|
public function getPreferences($addressBookId) {
|
||||||
@ -442,7 +441,6 @@ abstract class AbstractBackend {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief sets the preferences for the addressbook given in parameter
|
* @brief sets the preferences for the addressbook given in parameter
|
||||||
* @param string $id
|
|
||||||
* @param array the preferences, format array('param1' => 'value', 'param2' => 'value')
|
* @param array the preferences, format array('param1' => 'value', 'param2' => 'value')
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
@ -455,6 +453,9 @@ abstract class AbstractBackend {
|
|||||||
: false;
|
: false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $addressbookid
|
||||||
|
*/
|
||||||
public function removePreferences($addressbookid) {
|
public function removePreferences($addressbookid) {
|
||||||
$key = $this->combinedKey($addressbookid);
|
$key = $this->combinedKey($addressbookid);
|
||||||
$key = 'prefs_' . $key;
|
$key = 'prefs_' . $key;
|
||||||
|
@ -22,10 +22,10 @@
|
|||||||
|
|
||||||
namespace OCA\Contacts\Backend;
|
namespace OCA\Contacts\Backend;
|
||||||
|
|
||||||
use OCA\Contacts\Contact,
|
use OCA\Contacts\Contact;
|
||||||
OCA\Contacts\VObject\VCard,
|
use OCA\Contacts\VObject\VCard;
|
||||||
OCA\Contacts\Utils\Properties,
|
use OCA\Contacts\Utils\Properties;
|
||||||
Sabre\VObject\Reader;
|
use Sabre\VObject\Reader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Backend class for a users own contacts.
|
* Backend class for a users own contacts.
|
||||||
@ -73,8 +73,6 @@ class Database extends AbstractBackend {
|
|||||||
/**
|
/**
|
||||||
* Sets up the backend
|
* Sets up the backend
|
||||||
*
|
*
|
||||||
* @param string $addressBooksTableName
|
|
||||||
* @param string $cardsTableName
|
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
$userid = null,
|
$userid = null,
|
||||||
@ -179,6 +177,7 @@ class Database extends AbstractBackend {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
|
* @param string|false $addressBookId
|
||||||
*/
|
*/
|
||||||
public function hasAddressBook($addressBookId) {
|
public function hasAddressBook($addressBookId) {
|
||||||
|
|
||||||
@ -268,7 +267,6 @@ class Database extends AbstractBackend {
|
|||||||
* 'displayname' MUST be present.
|
* 'displayname' MUST be present.
|
||||||
*
|
*
|
||||||
* @param array $properties
|
* @param array $properties
|
||||||
* @param array $options - Optional (backend specific options)
|
|
||||||
* @return string|false The ID if the newly created AddressBook or false on error.
|
* @return string|false The ID if the newly created AddressBook or false on error.
|
||||||
*/
|
*/
|
||||||
public function createAddressBook(array $properties) {
|
public function createAddressBook(array $properties) {
|
||||||
@ -356,7 +354,6 @@ class Database extends AbstractBackend {
|
|||||||
* property indexes and category/group relations by itself.
|
* property indexes and category/group relations by itself.
|
||||||
*
|
*
|
||||||
* @param string $addressBookId
|
* @param string $addressBookId
|
||||||
* @param array $options - Optional (backend specific options)
|
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function deleteAddressBook($addressBookId) {
|
public function deleteAddressBook($addressBookId) {
|
||||||
@ -420,8 +417,7 @@ class Database extends AbstractBackend {
|
|||||||
* Returns the number of contacts in a specific address book.
|
* Returns the number of contacts in a specific address book.
|
||||||
*
|
*
|
||||||
* @param string $addressBookId
|
* @param string $addressBookId
|
||||||
* @param bool $omitdata Don't fetch the entire carddata or vcard.
|
* @return null|integer
|
||||||
* @return array
|
|
||||||
*/
|
*/
|
||||||
public function numContacts($addressBookId) {
|
public function numContacts($addressBookId) {
|
||||||
|
|
||||||
@ -555,6 +551,10 @@ class Database extends AbstractBackend {
|
|||||||
return $row;
|
return $row;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string|false $addressBookId
|
||||||
|
* @param false|string $id
|
||||||
|
*/
|
||||||
public function hasContact($addressBookId, $id) {
|
public function hasContact($addressBookId, $id) {
|
||||||
try {
|
try {
|
||||||
return $this->getContact($addressBookId, $id) !== null;
|
return $this->getContact($addressBookId, $id) !== null;
|
||||||
@ -575,9 +575,9 @@ class Database extends AbstractBackend {
|
|||||||
* set, or the contact has a UID. If neither is set, it will fail.
|
* set, or the contact has a UID. If neither is set, it will fail.
|
||||||
*
|
*
|
||||||
* @param string $addressBookId
|
* @param string $addressBookId
|
||||||
* @param VCard|string $contact
|
* @param string $contact
|
||||||
* @param array $options - Optional (backend specific options)
|
* @param array $options - Optional (backend specific options)
|
||||||
* @return string|bool The identifier for the new contact or false on error.
|
* @return false|string The identifier for the new contact or false on error.
|
||||||
*/
|
*/
|
||||||
public function createContact($addressBookId, $contact, array $options = array()) {
|
public function createContact($addressBookId, $contact, array $options = array()) {
|
||||||
//\OCP\Util::writeLog('contacts', __METHOD__.' addressBookId: ' . $addressBookId, \OCP\Util::DEBUG);
|
//\OCP\Util::writeLog('contacts', __METHOD__.' addressBookId: ' . $addressBookId, \OCP\Util::DEBUG);
|
||||||
@ -644,8 +644,8 @@ class Database extends AbstractBackend {
|
|||||||
* Updates a contact
|
* Updates a contact
|
||||||
*
|
*
|
||||||
* @param string $addressBookId
|
* @param string $addressBookId
|
||||||
* @param string|array $id Contact ID
|
* @param false|string $id Contact ID
|
||||||
* @param VCard|string $contact
|
* @param string $contact
|
||||||
* @param array $options - Optional (backend specific options)
|
* @param array $options - Optional (backend specific options)
|
||||||
* @see getContact
|
* @see getContact
|
||||||
* @return bool
|
* @return bool
|
||||||
@ -743,7 +743,7 @@ class Database extends AbstractBackend {
|
|||||||
* Deletes a contact
|
* Deletes a contact
|
||||||
*
|
*
|
||||||
* @param string $addressBookId
|
* @param string $addressBookId
|
||||||
* @param string|array $id
|
* @param false|string $id
|
||||||
* @param array $options - Optional (backend specific options)
|
* @param array $options - Optional (backend specific options)
|
||||||
* @see getContact
|
* @see getContact
|
||||||
* @return bool
|
* @return bool
|
||||||
@ -828,7 +828,7 @@ class Database extends AbstractBackend {
|
|||||||
/**
|
/**
|
||||||
* @brief Get the contact id from the uri.
|
* @brief Get the contact id from the uri.
|
||||||
*
|
*
|
||||||
* @param mixed $addressBookId,$id
|
* @param string $addressBookId
|
||||||
* @returns int | null
|
* @returns int | null
|
||||||
*/
|
*/
|
||||||
public function getIdFromUri($addressBookId,$uri) {
|
public function getIdFromUri($addressBookId,$uri) {
|
||||||
|
@ -22,7 +22,6 @@
|
|||||||
|
|
||||||
namespace OCA\Contacts\Backend;
|
namespace OCA\Contacts\Backend;
|
||||||
|
|
||||||
use OCA\Contacts\Contact;
|
|
||||||
use OCA\Contacts\VObject\VCard;
|
use OCA\Contacts\VObject\VCard;
|
||||||
use Sabre\VObject\Reader;
|
use Sabre\VObject\Reader;
|
||||||
use OCA\Contacts\Connector\LdapConnector;
|
use OCA\Contacts\Connector\LdapConnector;
|
||||||
@ -90,7 +89,7 @@ class Ldap extends AbstractBackend {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief close the current connection
|
* @brief close the current connection
|
||||||
* @return boolean closing success
|
* @return boolean|null closing success
|
||||||
*/
|
*/
|
||||||
public function ldapCloseConnection() {
|
public function ldapCloseConnection() {
|
||||||
if (self::ldapIsConnected()) {
|
if (self::ldapIsConnected()) {
|
||||||
@ -199,7 +198,7 @@ class Ldap extends AbstractBackend {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief adds a new ldap entry
|
* @brief adds a new ldap entry
|
||||||
* @param $ldapDN the new DN (must be unique)
|
* @param string $ldapDN the new DN (must be unique)
|
||||||
* @param $ldapValues the ldif values
|
* @param $ldapValues the ldif values
|
||||||
* @return boolean insert status
|
* @return boolean insert status
|
||||||
*/
|
*/
|
||||||
@ -212,7 +211,7 @@ class Ldap extends AbstractBackend {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief modify a ldap entry
|
* @brief modify a ldap entry
|
||||||
* @param $ldapDN the DN (must exists)
|
* @param string $ldapDN the DN (must exists)
|
||||||
* @param $ldapValues the ldif values
|
* @param $ldapValues the ldif values
|
||||||
* @return boolean modify status
|
* @return boolean modify status
|
||||||
*/
|
*/
|
||||||
@ -225,7 +224,7 @@ class Ldap extends AbstractBackend {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief delete a ldap entry
|
* @brief delete a ldap entry
|
||||||
* @param $ldapDN the DN (must exists)
|
* @param string $ldapDN the DN (must exists)
|
||||||
* @return boolean delete status
|
* @return boolean delete status
|
||||||
*/
|
*/
|
||||||
public function ldapDelete($ldapDN) {
|
public function ldapDelete($ldapDN) {
|
||||||
@ -239,7 +238,6 @@ class Ldap extends AbstractBackend {
|
|||||||
/**
|
/**
|
||||||
* Sets up the backend
|
* Sets up the backend
|
||||||
*
|
*
|
||||||
* @param string $cardsTableName
|
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
$userid = null,
|
$userid = null,
|
||||||
@ -252,7 +250,6 @@ class Ldap extends AbstractBackend {
|
|||||||
/**
|
/**
|
||||||
* Returns the list of active addressbooks for a specific user.
|
* Returns the list of active addressbooks for a specific user.
|
||||||
*
|
*
|
||||||
* @param string $userid
|
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getAddressBooksForUser(array $options = array()) {
|
public function getAddressBooksForUser(array $options = array()) {
|
||||||
@ -471,7 +468,6 @@ class Ldap extends AbstractBackend {
|
|||||||
* TODO: Some sort of ETag?
|
* TODO: Some sort of ETag?
|
||||||
*
|
*
|
||||||
* @param string $addressbookid
|
* @param string $addressbookid
|
||||||
* @param bool $omitdata Don't fetch the entire carddata or vcard.
|
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getContacts($addressbookid, array $options = array()) {
|
public function getContacts($addressbookid, array $options = array()) {
|
||||||
@ -522,7 +518,7 @@ class Ldap extends AbstractBackend {
|
|||||||
* Same as getContacts except that either 'carddata' or 'vcard' is mandatory.
|
* Same as getContacts except that either 'carddata' or 'vcard' is mandatory.
|
||||||
*
|
*
|
||||||
* @param string $addressbookid
|
* @param string $addressbookid
|
||||||
* @param mixed $id
|
* @param mixed $ids
|
||||||
* @return array|bool
|
* @return array|bool
|
||||||
*/
|
*/
|
||||||
public function getContact($addressbookid, $ids, array $options = array()) {
|
public function getContact($addressbookid, $ids, array $options = array()) {
|
||||||
@ -564,7 +560,7 @@ class Ldap extends AbstractBackend {
|
|||||||
/**
|
/**
|
||||||
* @brief construct a vcard in Sabre format
|
* @brief construct a vcard in Sabre format
|
||||||
* @param integer $aid Addressbook Id
|
* @param integer $aid Addressbook Id
|
||||||
* @param OC_VObject $card VCard
|
* @param OC_VObject $vcard VCard
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public static function getSabreFormatCard($aid, $vcard) {
|
public static function getSabreFormatCard($aid, $vcard) {
|
||||||
@ -597,7 +593,6 @@ class Ldap extends AbstractBackend {
|
|||||||
* Creates a new contact
|
* Creates a new contact
|
||||||
*
|
*
|
||||||
* @param string $addressbookid
|
* @param string $addressbookid
|
||||||
* @param VCard|string $carddata
|
|
||||||
* @return string|bool The identifier for the new contact or false on error.
|
* @return string|bool The identifier for the new contact or false on error.
|
||||||
*/
|
*/
|
||||||
public function createContact($addressbookid, $contact, array $options = array()) {
|
public function createContact($addressbookid, $contact, array $options = array()) {
|
||||||
|
@ -86,7 +86,6 @@ class Backend extends \Sabre\CardDAV\Backend\AbstractBackend {
|
|||||||
* well as the return value.
|
* well as the return value.
|
||||||
*
|
*
|
||||||
* @param mixed $addressbookid
|
* @param mixed $addressbookid
|
||||||
* @param PropPatch $mutations
|
|
||||||
* @see \Sabre\DAV\IProperties::updateProperties
|
* @see \Sabre\DAV\IProperties::updateProperties
|
||||||
* @return bool|array
|
* @return bool|array
|
||||||
*/
|
*/
|
||||||
|
@ -22,8 +22,7 @@
|
|||||||
|
|
||||||
namespace OCA\Contacts\Connector;
|
namespace OCA\Contacts\Connector;
|
||||||
|
|
||||||
use Sabre\VObject\Component,
|
use Sabre\VObject\StringUtil;
|
||||||
Sabre\VObject\StringUtil;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstract class used to implement import classes
|
* Abstract class used to implement import classes
|
||||||
@ -33,6 +32,9 @@ abstract class ImportConnector {
|
|||||||
// XML Configuration, class SimpleXml format
|
// XML Configuration, class SimpleXml format
|
||||||
protected $configContent;
|
protected $configContent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param \SimpleXMLElement $xml_config
|
||||||
|
*/
|
||||||
public function __construct($xml_config = null) {
|
public function __construct($xml_config = null) {
|
||||||
if ($xml_config != null) {
|
if ($xml_config != null) {
|
||||||
$this->setConfig($xml_config);
|
$this->setConfig($xml_config);
|
||||||
|
@ -179,7 +179,7 @@ class ImportCsvConnector extends ImportConnector {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief gets the import entry corresponding to the position given in parameter
|
* @brief gets the import entry corresponding to the position given in parameter
|
||||||
* @param $position the position to look for in the connector
|
* @param string $position the position to look for in the connector
|
||||||
* @return int|false
|
* @return int|false
|
||||||
*/
|
*/
|
||||||
private function getImportEntryFromPosition($position) {
|
private function getImportEntryFromPosition($position) {
|
||||||
|
@ -22,9 +22,9 @@
|
|||||||
|
|
||||||
namespace OCA\Contacts\Connector;
|
namespace OCA\Contacts\Connector;
|
||||||
|
|
||||||
use Sabre\VObject\Component,
|
use Sabre\VObject\Component;
|
||||||
Sabre\VObject\StringUtil,
|
use Sabre\VObject\StringUtil;
|
||||||
Sabre\VObject;
|
use Sabre\VObject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Implementation of the LDIF import format
|
* @brief Implementation of the LDIF import format
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
namespace OCA\Contacts\Connector;
|
namespace OCA\Contacts\Connector;
|
||||||
use Sabre\VObject\Component;
|
|
||||||
|
|
||||||
class LdapConnector {
|
class LdapConnector {
|
||||||
|
|
||||||
@ -45,7 +44,7 @@ class LdapConnector {
|
|||||||
* @brief transform a ldap entry into an VCard object
|
* @brief transform a ldap entry into an VCard object
|
||||||
* for each ldap entry which is like "property: value"
|
* for each ldap entry which is like "property: value"
|
||||||
* to a VCard entry which is like "PROPERTY[;PARAMETER=param]:value"
|
* to a VCard entry which is like "PROPERTY[;PARAMETER=param]:value"
|
||||||
* @param array $ldap_entry
|
* @param array $ldapEntry
|
||||||
* @return OC_VCard
|
* @return OC_VCard
|
||||||
*/
|
*/
|
||||||
public function ldapToVCard($ldapEntry) {
|
public function ldapToVCard($ldapEntry) {
|
||||||
@ -102,7 +101,7 @@ class LdapConnector {
|
|||||||
* creates the property if it doesn't exists yet
|
* creates the property if it doesn't exists yet
|
||||||
* @param $vcard the vcard to get or create the properties with
|
* @param $vcard the vcard to get or create the properties with
|
||||||
* @param $v_param the parameter the find
|
* @param $v_param the parameter the find
|
||||||
* @param $index the position of the property in the vcard to find
|
* @param integer $index the position of the property in the vcard to find
|
||||||
*/
|
*/
|
||||||
public function getOrCreateVCardProperty(&$vcard, $v_param, $index) {
|
public function getOrCreateVCardProperty(&$vcard, $v_param, $index) {
|
||||||
|
|
||||||
@ -309,7 +308,7 @@ class LdapConnector {
|
|||||||
* @brief updates the ldifEntry with $ldifNewValues
|
* @brief updates the ldifEntry with $ldifNewValues
|
||||||
* @param $ldifEntry the array to modify
|
* @param $ldifEntry the array to modify
|
||||||
* @param $ldifNewValues the new values
|
* @param $ldifNewValues the new values
|
||||||
* @return boolean
|
* @return boolean|null
|
||||||
*/
|
*/
|
||||||
public function updateLdifProperty(&$ldifEntries, $ldifNewValues) {
|
public function updateLdifProperty(&$ldifEntries, $ldifNewValues) {
|
||||||
foreach ($ldifNewValues as $key => $value) {
|
foreach ($ldifNewValues as $key => $value) {
|
||||||
|
@ -22,8 +22,8 @@
|
|||||||
|
|
||||||
namespace OCA\Contacts;
|
namespace OCA\Contacts;
|
||||||
|
|
||||||
use Sabre\VObject\Property,
|
use Sabre\VObject\Property;
|
||||||
OCA\Contacts\Utils\Properties;
|
use OCA\Contacts\Utils\Properties;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Subclass this class or implement IPIMObject interface for PIM objects
|
* Subclass this class or implement IPIMObject interface for PIM objects
|
||||||
@ -179,7 +179,7 @@ class Contact extends VObject\VCard implements IPIMObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string|null
|
* @return string
|
||||||
* TODO: Cache result.
|
* TODO: Cache result.
|
||||||
*/
|
*/
|
||||||
public function getETag() {
|
public function getETag() {
|
||||||
@ -212,7 +212,7 @@ class Contact extends VObject\VCard implements IPIMObject {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param integer $permission
|
* @param integer $permission
|
||||||
* @return bool
|
* @return integer
|
||||||
*/
|
*/
|
||||||
public function hasPermission($permission) {
|
public function hasPermission($permission) {
|
||||||
return $this->getPermissions() & $permission;
|
return $this->getPermissions() & $permission;
|
||||||
@ -456,7 +456,7 @@ class Contact extends VObject\VCard implements IPIMObject {
|
|||||||
* Get a property index in the contact by the checksum of its serialized value
|
* Get a property index in the contact by the checksum of its serialized value
|
||||||
*
|
*
|
||||||
* @param string $checksum An 8 char m5d checksum.
|
* @param string $checksum An 8 char m5d checksum.
|
||||||
* @return \Sabre\VObject\Property Property by reference
|
* @return integer Property by reference
|
||||||
* @throws An exception with error code 404 if the property is not found.
|
* @throws An exception with error code 404 if the property is not found.
|
||||||
*/
|
*/
|
||||||
public function getPropertyIndexByChecksum($checksum) {
|
public function getPropertyIndexByChecksum($checksum) {
|
||||||
@ -790,6 +790,9 @@ class Contact extends VObject\VCard implements IPIMObject {
|
|||||||
$this->setSaved(false);
|
$this->setSaved(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param boolean $state
|
||||||
|
*/
|
||||||
public function setRetrieved($state) {
|
public function setRetrieved($state) {
|
||||||
$this->props['retrieved'] = $state;
|
$this->props['retrieved'] = $state;
|
||||||
}
|
}
|
||||||
|
@ -10,21 +10,22 @@
|
|||||||
|
|
||||||
namespace OCA\Contacts\Controller;
|
namespace OCA\Contacts\Controller;
|
||||||
|
|
||||||
use OCA\Contacts\App,
|
use OCA\Contacts\App;
|
||||||
OCA\Contacts\JSONResponse,
|
use OCA\Contacts\JSONResponse;
|
||||||
OCA\Contacts\Controller,
|
use OCA\Contacts\Controller;
|
||||||
Sabre\VObject,
|
use OCA\Contacts\ImportManager;
|
||||||
OCA\Contacts\VObject\VCard as MyVCard,
|
use OCP\IRequest;
|
||||||
OCA\Contacts\ImportManager,
|
use OCP\ICache;
|
||||||
OCP\IRequest,
|
use OCP\ITags;
|
||||||
OCP\ICache,
|
|
||||||
OCP\ITags;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Controller importing contacts
|
* Controller importing contacts
|
||||||
*/
|
*/
|
||||||
class ImportController extends Controller {
|
class ImportController extends Controller {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $appName
|
||||||
|
*/
|
||||||
public function __construct($appName, IRequest $request, App $app, ICache $cache, ITags $tags) {
|
public function __construct($appName, IRequest $request, App $app, ICache $cache, ITags $tags) {
|
||||||
parent::__construct($appName, $request, $app);
|
parent::__construct($appName, $request, $app);
|
||||||
$this->cache = $cache;
|
$this->cache = $cache;
|
||||||
@ -274,8 +275,8 @@ class ImportController extends Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $pct
|
* @param integer $pct
|
||||||
* @param $total
|
* @param integer $total
|
||||||
* @param $progresskey
|
* @param $progresskey
|
||||||
*/
|
*/
|
||||||
protected function writeProcess($pct, $total, $progresskey) {
|
protected function writeProcess($pct, $total, $progresskey) {
|
||||||
@ -285,9 +286,9 @@ class ImportController extends Controller {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $view
|
* @param $view
|
||||||
* @param $filename
|
* @param string $filename
|
||||||
* @param $progresskey
|
* @param $progresskey
|
||||||
* @param $response
|
* @param JSONResponse $response
|
||||||
*/
|
*/
|
||||||
protected function cleanup($view, $filename, $progresskey, $response) {
|
protected function cleanup($view, $filename, $progresskey, $response) {
|
||||||
if (!$view->unlink('/imports/' . $filename)) {
|
if (!$view->unlink('/imports/' . $filename)) {
|
||||||
|
@ -10,19 +10,19 @@
|
|||||||
|
|
||||||
namespace OCA\Contacts;
|
namespace OCA\Contacts;
|
||||||
|
|
||||||
use OCP\AppFramework\App as MainApp,
|
use OCP\AppFramework\App as MainApp;
|
||||||
OCP\AppFramework\IAppContainer,
|
use OCP\AppFramework\IAppContainer;
|
||||||
OCA\Contacts\App,
|
use OCA\Contacts\App;
|
||||||
OCA\Contacts\Middleware\Http as HttpMiddleware,
|
use OCA\Contacts\Middleware\Http as HttpMiddleware;
|
||||||
OCA\Contacts\Controller\PageController,
|
use OCA\Contacts\Controller\PageController;
|
||||||
OCA\Contacts\Controller\AddressBookController,
|
use OCA\Contacts\Controller\AddressBookController;
|
||||||
OCA\Contacts\Controller\BackendController,
|
use OCA\Contacts\Controller\BackendController;
|
||||||
OCA\Contacts\Controller\GroupController,
|
use OCA\Contacts\Controller\GroupController;
|
||||||
OCA\Contacts\Controller\ContactController,
|
use OCA\Contacts\Controller\ContactController;
|
||||||
OCA\Contacts\Controller\ContactPhotoController,
|
use OCA\Contacts\Controller\ContactPhotoController;
|
||||||
OCA\Contacts\Controller\SettingsController,
|
use OCA\Contacts\Controller\SettingsController;
|
||||||
OCA\Contacts\Controller\ImportController,
|
use OCA\Contacts\Controller\ImportController;
|
||||||
OCA\Contacts\Controller\ExportController;
|
use OCA\Contacts\Controller\ExportController;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class manages our app actions
|
* This class manages our app actions
|
||||||
|
@ -42,7 +42,7 @@ class Hooks{
|
|||||||
/**
|
/**
|
||||||
* @brief Add default Addressbook for a certain user
|
* @brief Add default Addressbook for a certain user
|
||||||
* @param paramters parameters from postCreateUser-Hook
|
* @param paramters parameters from postCreateUser-Hook
|
||||||
* @return array
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public static function userCreated($parameters) {
|
public static function userCreated($parameters) {
|
||||||
//Addressbook::addDefault($parameters['uid']);
|
//Addressbook::addDefault($parameters['uid']);
|
||||||
|
@ -21,17 +21,18 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
namespace OCA\Contacts;
|
namespace OCA\Contacts;
|
||||||
use Sabre\VObject\Component;
|
|
||||||
use OCA\Contacts\Connector\ImportCsvConnector;
|
use OCA\Contacts\Connector\ImportCsvConnector;
|
||||||
use OCA\Contacts\Connector\ImportVCardConnector;
|
use OCA\Contacts\Connector\ImportVCardConnector;
|
||||||
use OCA\Contacts\Connector\ImportLdifConnector;
|
use OCA\Contacts\Connector\ImportLdifConnector;
|
||||||
use OCA\Contacts\Addressbook;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Manages the import with basic functionalities
|
* Manages the import with basic functionalities
|
||||||
*/
|
*/
|
||||||
class ImportManager {
|
class ImportManager {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $path
|
||||||
|
*/
|
||||||
private function loadXmlFile($path) {
|
private function loadXmlFile($path) {
|
||||||
if (file_exists($path)) {
|
if (file_exists($path)) {
|
||||||
$format = simplexml_load_file ( $path );
|
$format = simplexml_load_file ( $path );
|
||||||
@ -72,7 +73,6 @@ class ImportManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief get all the preferences for the addressbook
|
* @brief get all the preferences for the addressbook
|
||||||
* @param string $id
|
|
||||||
* @return SimpleXml
|
* @return SimpleXml
|
||||||
*/
|
*/
|
||||||
public function getType($typeName) {
|
public function getType($typeName) {
|
||||||
|
@ -29,7 +29,7 @@ class Addressbook implements \OCP\Share_Backend_Collection {
|
|||||||
* @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
|
||||||
* @param string Owner of the item
|
* @param string Owner of the item
|
||||||
* @return mixed|array|false Source
|
* @return boolean Source
|
||||||
*
|
*
|
||||||
* Return an array if the item is file dependent, the array needs two keys: 'item' and 'file'
|
* Return an array if the item is file dependent, the array needs two keys: 'item' and 'file'
|
||||||
* Return false if the item does not exist for the user
|
* Return false if the item does not exist for the user
|
||||||
|
@ -23,8 +23,8 @@
|
|||||||
namespace OCA\Contacts\Utils;
|
namespace OCA\Contacts\Utils;
|
||||||
|
|
||||||
use OCA\Contacts\VObject;
|
use OCA\Contacts\VObject;
|
||||||
use OCA\Contacts\Contact,
|
use OCA\Contacts\Contact;
|
||||||
OCA\Contacts\Utils\Properties;
|
use OCA\Contacts\Utils\Properties;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class serializes properties, components an
|
* This class serializes properties, components an
|
||||||
|
@ -195,7 +195,7 @@ Class Properties {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief returns the default categories of ownCloud
|
* @brief returns the default categories of ownCloud
|
||||||
* @return (array) $categories
|
* @return string[] $categories
|
||||||
*/
|
*/
|
||||||
public static function getDefaultCategories() {
|
public static function getDefaultCategories() {
|
||||||
$l10n = self::$l10n;
|
$l10n = self::$l10n;
|
||||||
|
@ -22,8 +22,8 @@
|
|||||||
|
|
||||||
namespace OCA\Contacts\Utils;
|
namespace OCA\Contacts\Utils;
|
||||||
|
|
||||||
use OCP\ICache,
|
use OCP\ICache;
|
||||||
OCP\Image;
|
use OCP\Image;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class is used for getting a temporary contact photo for cropping.
|
* This class is used for getting a temporary contact photo for cropping.
|
||||||
@ -98,9 +98,6 @@ class TemporaryPhoto {
|
|||||||
/**
|
/**
|
||||||
* Returns an instance of a subclass of this class
|
* Returns an instance of a subclass of this class
|
||||||
*
|
*
|
||||||
* @param \OCP\IServerContainer $server
|
|
||||||
* @param int|null $type One of the pre-defined types.
|
|
||||||
* @param mixed|null $data Whatever data is needed to load the photo.
|
|
||||||
*/
|
*/
|
||||||
public static function create(ICache $cache, $type = null, $data = null) {
|
public static function create(ICache $cache, $type = null, $data = null) {
|
||||||
if (isset(self::$classMap[$type])) {
|
if (isset(self::$classMap[$type])) {
|
||||||
|
@ -22,9 +22,9 @@
|
|||||||
|
|
||||||
namespace OCA\Contacts\Utils\TemporaryPhoto;
|
namespace OCA\Contacts\Utils\TemporaryPhoto;
|
||||||
|
|
||||||
use OCA\Contacts\Contact as ContactObject,
|
use OCA\Contacts\Contact as ContactObject;
|
||||||
OCA\Contacts\Utils\TemporaryPhoto as BaseTemporaryPhoto,
|
use OCA\Contacts\Utils\TemporaryPhoto as BaseTemporaryPhoto;
|
||||||
OCP\ICache;
|
use OCP\ICache;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class loads the PHOTO or LOGO property from a contact.
|
* This class loads the PHOTO or LOGO property from a contact.
|
||||||
|
@ -22,12 +22,11 @@
|
|||||||
|
|
||||||
namespace OCA\Contacts\Utils\TemporaryPhoto;
|
namespace OCA\Contacts\Utils\TemporaryPhoto;
|
||||||
|
|
||||||
use OCA\Contacts\Contact as ContactObject,
|
use OCA\Contacts\Utils\TemporaryPhoto as BaseTemporaryPhoto;
|
||||||
OCA\Contacts\Utils\TemporaryPhoto as BaseTemporaryPhoto,
|
use OCP\IRequest;
|
||||||
OCP\IRequest,
|
use OCP\AppFramework\Http;
|
||||||
OCP\AppFramework\Http,
|
use OCP\Image;
|
||||||
OCP\Image,
|
use OCP\ICache;
|
||||||
OCP\ICache;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class loads an image from the virtual file system.
|
* This class loads an image from the virtual file system.
|
||||||
|
@ -15,6 +15,9 @@ class Mock extends AbstractBackend {
|
|||||||
public $contacts;
|
public $contacts;
|
||||||
public $userid;
|
public $userid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $userid
|
||||||
|
*/
|
||||||
function __construct($userid = null, $addressBooks = null, $contacts = null) {
|
function __construct($userid = null, $addressBooks = null, $contacts = null) {
|
||||||
|
|
||||||
$this->userid = $userid ? $userid : \OC::$server->getUserSession()->getUser()->getUId();
|
$this->userid = $userid ? $userid : \OC::$server->getUserSession()->getUser()->getUId();
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
|
|
||||||
namespace OCA\Contacts;
|
namespace OCA\Contacts;
|
||||||
|
|
||||||
use Sabre\VObject\Reader;
|
|
||||||
use OCA\Contacts\Utils\JSONSerializer;
|
use OCA\Contacts\Utils\JSONSerializer;
|
||||||
|
|
||||||
require_once __DIR__ . '/backend/mock.php';
|
require_once __DIR__ . '/backend/mock.php';
|
||||||
|
Loading…
Reference in New Issue
Block a user