Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
our_own_cloud_project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
die_coolen_jungs
our_own_cloud_project
Commits
d614c3b1
Commit
d614c3b1
authored
Jul 30, 2012
by
Thomas Tanghus
Browse files
Options
Downloads
Patches
Plain Diff
Code style.
parent
118d9e17
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
apps/contacts/lib/app.php
+69
-36
69 additions, 36 deletions
apps/contacts/lib/app.php
with
69 additions
and
36 deletions
apps/contacts/lib/app.php
+
69
−
36
View file @
d614c3b1
...
...
@@ -25,12 +25,28 @@ class OC_Contacts_App {
$addressbook
=
OC_Contacts_Addressbook
::
find
(
$id
);
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
();
}
...
...
@@ -142,7 +167,9 @@ 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
;
}
...
...
@@ -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
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment