summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorThomas Tanghus <thomas@tanghus.net>2012-07-30 05:31:06 +0200
committerThomas Tanghus <thomas@tanghus.net>2012-07-30 05:31:06 +0200
commitd614c3b1d5be7e05ce7248dc4a7b67f04a64a3d8 (patch)
tree5b0b69aea4905661eb42bdf584e0eb1645bcc2de /apps
parent118d9e17b6afe5c3c763737226a90307f67a03b9 (diff)
downloadnextcloud-server-d614c3b1d5be7e05ce7248dc4a7b67f04a64a3d8.tar.gz
nextcloud-server-d614c3b1d5be7e05ce7248dc4a7b67f04a64a3d8.zip
Code style.
Diffstat (limited to 'apps')
-rw-r--r--apps/contacts/lib/app.php105
1 files changed, 69 insertions, 36 deletions
diff --git a/apps/contacts/lib/app.php b/apps/contacts/lib/app.php
index 689149367fa..46e03240dc2 100644
--- a/apps/contacts/lib/app.php
+++ b/apps/contacts/lib/app.php
@@ -23,14 +23,30 @@ class OC_Contacts_App {
public static function getAddressbook($id) {
$addressbook = OC_Contacts_Addressbook::find( $id );
- if( $addressbook === false || $addressbook['userid'] != OCP\USER::getUser()) {
+ if($addressbook === false || $addressbook['userid'] != OCP\USER::getUser()) {
if ($addressbook === false) {
- OCP\Util::writeLog('contacts', 'Addressbook not found: '. $id, OCP\Util::ERROR);
- OCP\JSON::error(array('data' => array( 'message' => self::$l10n->t('Addressbook not found.'))));
+ OCP\Util::writeLog('contacts',
+ 'Addressbook not found: '. $id,
+ OCP\Util::ERROR);
+ OCP\JSON::error(
+ array(
+ 'data' => array(
+ 'message' => self::$l10n->t('Addressbook not found.')
+ )
+ )
+ );
}
else {
- OCP\Util::writeLog('contacts', 'Addressbook('.$id.') is not from '.OCP\USER::getUser(), OCP\Util::ERROR);
- OCP\JSON::error(array('data' => array( 'message' => self::$l10n->t('This is not your addressbook.'))));
+ OCP\Util::writeLog('contacts',
+ 'Addressbook('.$id.') is not from '.OCP\USER::getUser(),
+ OCP\Util::ERROR);
+ OCP\JSON::error(
+ array(
+ 'data' => array(
+ 'message' => self::$l10n->t('This is not your addressbook.')
+ )
+ )
+ );
}
exit();
}
@@ -40,8 +56,17 @@ class OC_Contacts_App {
public static function getContactObject($id) {
$card = OC_Contacts_VCard::find( $id );
if( $card === false ) {
- OCP\Util::writeLog('contacts', 'Contact could not be found: '.$id, OCP\Util::ERROR);
- OCP\JSON::error(array('data' => array( 'message' => self::$l10n->t('Contact could not be found.').' '.print_r($id, true))));
+ OCP\Util::writeLog('contacts',
+ 'Contact could not be found: '.$id,
+ OCP\Util::ERROR);
+ OCP\JSON::error(
+ array(
+ 'data' => array(
+ 'message' => self::$l10n->t('Contact could not be found.')
+ .' '.print_r($id, true)
+ )
+ )
+ );
exit();
}
@@ -110,29 +135,29 @@ class OC_Contacts_App {
public static function getTypesOfProperty($prop) {
$l = self::$l10n;
switch($prop) {
- case 'ADR':
- return array(
- 'WORK' => $l->t('Work'),
- 'HOME' => $l->t('Home'),
- );
- case 'TEL':
- return array(
- 'HOME' => $l->t('Home'),
- 'CELL' => $l->t('Mobile'),
- 'WORK' => $l->t('Work'),
- 'TEXT' => $l->t('Text'),
- 'VOICE' => $l->t('Voice'),
- 'MSG' => $l->t('Message'),
- 'FAX' => $l->t('Fax'),
- 'VIDEO' => $l->t('Video'),
- 'PAGER' => $l->t('Pager'),
- );
- case 'EMAIL':
- return array(
- 'WORK' => $l->t('Work'),
- 'HOME' => $l->t('Home'),
- 'INTERNET' => $l->t('Internet'),
- );
+ case 'ADR':
+ return array(
+ 'WORK' => $l->t('Work'),
+ 'HOME' => $l->t('Home'),
+ );
+ case 'TEL':
+ return array(
+ 'HOME' => $l->t('Home'),
+ 'CELL' => $l->t('Mobile'),
+ 'WORK' => $l->t('Work'),
+ 'TEXT' => $l->t('Text'),
+ 'VOICE' => $l->t('Voice'),
+ 'MSG' => $l->t('Message'),
+ 'FAX' => $l->t('Fax'),
+ 'VIDEO' => $l->t('Video'),
+ 'PAGER' => $l->t('Pager'),
+ );
+ case 'EMAIL':
+ return array(
+ 'WORK' => $l->t('Work'),
+ 'HOME' => $l->t('Home'),
+ 'INTERNET' => $l->t('Internet'),
+ );
}
}
@@ -142,11 +167,13 @@ class OC_Contacts_App {
*/
protected static function getVCategories() {
if (is_null(self::$categories)) {
- self::$categories = new OC_VCategories('contacts', null, self::getDefaultCategories());
+ self::$categories = new OC_VCategories('contacts',
+ null,
+ self::getDefaultCategories());
}
return self::$categories;
}
-
+
/**
* @brief returns the categories for the user
* @return (Array) $categories
@@ -183,7 +210,7 @@ class OC_Contacts_App {
(string)self::$l10n->t('Work'),
);
}
-
+
/**
* scan vcards for categories.
* @param $vccontacts VCards to scan. null to check all vcards for the current user.
@@ -198,14 +225,20 @@ class OC_Contacts_App {
}
$start = 0;
$batchsize = 10;
- while($vccontacts = OC_Contacts_VCard::all($vcaddressbookids, $start, $batchsize)){
+ while($vccontacts =
+ OC_Contacts_VCard::all($vcaddressbookids, $start, $batchsize)) {
$cards = array();
foreach($vccontacts as $vccontact) {
$cards[] = $vccontact['carddata'];
}
- OCP\Util::writeLog('contacts', __CLASS__.'::'.__METHOD__.', scanning: '.$batchsize.' starting from '.$start, OCP\Util::DEBUG);
+ OCP\Util::writeLog('contacts',
+ __CLASS__.'::'.__METHOD__
+ .', scanning: '.$batchsize.' starting from '.$start,
+ OCP\Util::DEBUG);
// only reset on first batch.
- self::getVCategories()->rescan($cards, true, ($start == 0 ? true : false));
+ self::getVCategories()->rescan($cards,
+ true,
+ ($start == 0 ? true : false));
$start += $batchsize;
}
}