summaryrefslogtreecommitdiffstats
path: root/lib/vcategories.php
diff options
context:
space:
mode:
authorThomas Tanghus <thomas@tanghus.net>2012-05-13 15:07:07 +0200
committerThomas Tanghus <thomas@tanghus.net>2012-05-13 15:07:07 +0200
commit3926e2d4f3d786be64230350db982a695d329d97 (patch)
tree002846d1553562dcb13156c02d83407cfcb48f6e /lib/vcategories.php
parent5ac10a9c0eecfa6fe49c314954c506972f275e24 (diff)
downloadnextcloud-server-3926e2d4f3d786be64230350db982a695d329d97.tar.gz
nextcloud-server-3926e2d4f3d786be64230350db982a695d329d97.zip
VCategories: Made a small check for categories that seems to resolv the problems in Calender. Also reverts the changes from 9e6221b229410599c28045d1956bb6e84d33cadc.
Diffstat (limited to 'lib/vcategories.php')
-rw-r--r--lib/vcategories.php16
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/vcategories.php b/lib/vcategories.php
index 7b3844bf689..d6351e2858c 100644
--- a/lib/vcategories.php
+++ b/lib/vcategories.php
@@ -96,7 +96,7 @@ class OC_VCategories {
}
}
if(count($newones) > 0) {
- $this->categories = @array_merge($this->categories, $newones);
+ $this->categories = array_merge($this->categories, $newones);
if($sync === true) {
$this->save();
}
@@ -146,10 +146,14 @@ class OC_VCategories {
* @brief Save the list with categories
*/
private function save() {
- usort($this->categories, 'strnatcasecmp'); // usort to also renumber the keys
- $escaped_categories = serialize($this->categories);
- OC_Log::write('core','OC_VCategories::save: '.print_r($this->categories, true), OC_Log::DEBUG);
- OC_Preferences::setValue($this->user, $this->app, self::PREF_CATEGORIES_LABEL, $escaped_categories);
+ if(is_array($this->categories)) {
+ usort($this->categories, 'strnatcasecmp'); // usort to also renumber the keys
+ $escaped_categories = serialize($this->categories);
+ OC_Preferences::setValue($this->user, $this->app, self::PREF_CATEGORIES_LABEL, $escaped_categories);
+ OC_Log::write('core','OC_VCategories::save: '.print_r($this->categories, true), OC_Log::DEBUG);
+ } else {
+ OC_Log::write('core','OC_VCategories::save: $this->categories is not an array! '.print_r($this->categories, true), OC_Log::ERROR);
+ }
}
/**
@@ -199,7 +203,7 @@ class OC_VCategories {
// case-insensitive in_array
private function in_arrayi($needle, $haystack) {
- return in_array(strtolower($needle), @array_map('strtolower', $haystack));
+ return in_array(strtolower($needle), array_map('strtolower', $haystack));
}
// case-insensitive array_search