diff --git a/apps/calendar/ajax/changeview.php b/apps/calendar/ajax/changeview.php index f53eb288b793c837fe15933ed59be32fe7880489..a637e62aad1c0e9985c41451a4198de575680be2 100755 --- a/apps/calendar/ajax/changeview.php +++ b/apps/calendar/ajax/changeview.php @@ -17,6 +17,6 @@ switch($view){ OC_JSON::error(array('message'=>'unexspected parameter: ' . $view)); exit; } -OC_Preferences::setValue(OCP\USER::getUser(), 'calendar', 'currentview', $view); +OCP\Config::setUserValue(OCP\USER::getUser(), 'calendar', 'currentview', $view); OC_JSON::success(); ?> diff --git a/apps/calendar/ajax/event/new.form.php b/apps/calendar/ajax/event/new.form.php index a2fa48edf8a55f688ac213033f6727d26a62f94f..376149b57c305bde4c5221858c372b8ceb07a844 100755 --- a/apps/calendar/ajax/event/new.form.php +++ b/apps/calendar/ajax/event/new.form.php @@ -22,12 +22,12 @@ $end = $_POST['end']; $allday = $_POST['allday']; if (!$end){ - $duration = OC_Preferences::getValue( OCP\USER::getUser(), 'calendar', 'duration', '60'); + $duration = OCP\Config::getUserValue( OCP\USER::getUser(), 'calendar', 'duration', '60'); $end = $start + ($duration * 60); } $start = new DateTime('@'.$start); $end = new DateTime('@'.$end); -$timezone = OC_Preferences::getValue(OCP\USER::getUser(), 'calendar', 'timezone', date_default_timezone_get()); +$timezone = OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'timezone', date_default_timezone_get()); $start->setTimezone(new DateTimeZone($timezone)); $end->setTimezone(new DateTimeZone($timezone)); diff --git a/apps/calendar/ajax/settings/getfirstday.php b/apps/calendar/ajax/settings/getfirstday.php index 3fe89c5bc566d528bc7a1681777d84d8df489a5c..dfc8b304b690f6b3d7154ac0c45671f0bf8433ad 100755 --- a/apps/calendar/ajax/settings/getfirstday.php +++ b/apps/calendar/ajax/settings/getfirstday.php @@ -7,6 +7,6 @@ */ OC_JSON::checkLoggedIn(); -$firstday = OC_Preferences::getValue( OCP\USER::getUser(), 'calendar', 'firstday', 'mo'); +$firstday = OCP\Config::getUserValue( OCP\USER::getUser(), 'calendar', 'firstday', 'mo'); OC_JSON::encodedPrint(array('firstday' => $firstday)); ?> diff --git a/apps/calendar/ajax/settings/gettimezonedetection.php b/apps/calendar/ajax/settings/gettimezonedetection.php index a5a71670ca93b4197e37bb022eaebe0f292ae97f..be01807bbb44da2967ccdaed77e88223acd32d2d 100755 --- a/apps/calendar/ajax/settings/gettimezonedetection.php +++ b/apps/calendar/ajax/settings/gettimezonedetection.php @@ -8,4 +8,4 @@ OC_JSON::checkLoggedIn(); OC_JSON::checkAppEnabled('calendar'); -OC_JSON::success(array('detection' => OC_Preferences::getValue(OCP\USER::getUser(), 'calendar', 'timezonedetection'))); \ No newline at end of file +OC_JSON::success(array('detection' => OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'timezonedetection'))); \ No newline at end of file diff --git a/apps/calendar/ajax/settings/guesstimezone.php b/apps/calendar/ajax/settings/guesstimezone.php index 9b86c305e44c1c2681a6eb753bfcfbebd44db90c..19aa778472d182d8a6fb13190a0f5794760cf954 100755 --- a/apps/calendar/ajax/settings/guesstimezone.php +++ b/apps/calendar/ajax/settings/guesstimezone.php @@ -17,11 +17,11 @@ $lng = $_GET['long']; $timezone = OC_Geo::timezone($lat, $lng); -if($timezone == OC_Preferences::getValue(OCP\USER::getUser(), 'calendar', 'timezone')){ +if($timezone == OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'timezone')){ OC_JSON::success(); exit; } -OC_Preferences::setValue(OCP\USER::getUser(), 'calendar', 'timezone', $timezone); +OCP\Config::setUserValue(OCP\USER::getUser(), 'calendar', 'timezone', $timezone); $message = array('message'=> $l->t('New Timezone:') . $timezone); OC_JSON::success($message); ?> \ No newline at end of file diff --git a/apps/calendar/ajax/settings/setfirstday.php b/apps/calendar/ajax/settings/setfirstday.php index 232a51733ba75934bb75a492220c091e77e11b7b..0c6ab695365cac42c1b36e7c6cd29cafc58f41ca 100755 --- a/apps/calendar/ajax/settings/setfirstday.php +++ b/apps/calendar/ajax/settings/setfirstday.php @@ -8,7 +8,7 @@ OC_JSON::checkLoggedIn(); if(isset($_POST["firstday"])){ - OC_Preferences::setValue(OCP\USER::getUser(), 'calendar', 'firstday', $_POST["firstday"]); + OCP\Config::setUserValue(OCP\USER::getUser(), 'calendar', 'firstday', $_POST["firstday"]); OC_JSON::success(); }else{ OC_JSON::error(); diff --git a/apps/calendar/ajax/settings/settimeformat.php b/apps/calendar/ajax/settings/settimeformat.php index 428cb4220a116f0649e314fa8d45b49ffaa9eda2..d648545d9ca08d38bff5af923c8165f2875956a3 100755 --- a/apps/calendar/ajax/settings/settimeformat.php +++ b/apps/calendar/ajax/settings/settimeformat.php @@ -8,7 +8,7 @@ OC_JSON::checkLoggedIn(); if(isset($_POST["timeformat"])){ - OC_Preferences::setValue(OCP\USER::getUser(), 'calendar', 'timeformat', $_POST["timeformat"]); + OCP\Config::setUserValue(OCP\USER::getUser(), 'calendar', 'timeformat', $_POST["timeformat"]); OC_JSON::success(); }else{ OC_JSON::error(); diff --git a/apps/calendar/ajax/settings/settimezone.php b/apps/calendar/ajax/settings/settimezone.php index efc23c0f9795161c1b635c645e10dab83a336190..abe14bd0ec7d411ec4428c820dbc2a809335ada8 100755 --- a/apps/calendar/ajax/settings/settimezone.php +++ b/apps/calendar/ajax/settings/settimezone.php @@ -18,7 +18,7 @@ OC_JSON::checkAppEnabled('calendar'); // Get data if( isset( $_POST['timezone'] ) ){ $timezone=$_POST['timezone']; - OC_Preferences::setValue( OCP\USER::getUser(), 'calendar', 'timezone', $timezone ); + OCP\Config::setUserValue( OCP\USER::getUser(), 'calendar', 'timezone', $timezone ); OC_JSON::success(array('data' => array( 'message' => $l->t('Timezone changed') ))); }else{ OC_JSON::error(array('data' => array( 'message' => $l->t('Invalid request') ))); diff --git a/apps/calendar/ajax/settings/timeformat.php b/apps/calendar/ajax/settings/timeformat.php index cec0939481524286f6f7b53c1b4862505bd136b7..dbcfcb29b42968c69836fb679b5640fc06d83962 100755 --- a/apps/calendar/ajax/settings/timeformat.php +++ b/apps/calendar/ajax/settings/timeformat.php @@ -7,6 +7,6 @@ */ OC_JSON::checkLoggedIn(); -$timeformat = OC_Preferences::getValue( OCP\USER::getUser(), 'calendar', 'timeformat', "24"); +$timeformat = OCP\Config::getUserValue( OCP\USER::getUser(), 'calendar', 'timeformat', "24"); OC_JSON::encodedPrint(array("timeformat" => $timeformat)); ?> diff --git a/apps/calendar/ajax/settings/timezonedetection.php b/apps/calendar/ajax/settings/timezonedetection.php index 17bd740beea616e8e89e5559c0b2947ba200f90a..8cb375183bba17bdf74a6e0f6abff2c86454382a 100755 --- a/apps/calendar/ajax/settings/timezonedetection.php +++ b/apps/calendar/ajax/settings/timezonedetection.php @@ -10,9 +10,9 @@ OC_JSON::checkLoggedIn(); OC_JSON::checkAppEnabled('calendar'); if(array_key_exists('timezonedetection', $_POST)){ if($_POST['timezonedetection'] == 'on'){ - OC_Preferences::setValue(OCP\USER::getUser(), 'calendar', 'timezonedetection', 'true'); + OCP\Config::setUserValue(OCP\USER::getUser(), 'calendar', 'timezonedetection', 'true'); }else{ - OC_Preferences::setValue(OCP\USER::getUser(), 'calendar', 'timezonedetection', 'false'); + OCP\Config::setUserValue(OCP\USER::getUser(), 'calendar', 'timezonedetection', 'false'); } OC_JSON::success(); }else{ diff --git a/apps/calendar/index.php b/apps/calendar/index.php index 0a77bdbf2ba82cbfead6f2d12e650730f19346a6..dcc7e25e3ecdc3100b8d7b9b1d1ef01e9842cf3b 100755 --- a/apps/calendar/index.php +++ b/apps/calendar/index.php @@ -29,21 +29,21 @@ OC_Hook::emit('OC_Calendar', 'getSources', array('sources' => &$eventSources)); $categories = OC_Calendar_App::getCategoryOptions(); //Fix currentview for fullcalendar -if(OC_Preferences::getValue(OCP\USER::getUser(), 'calendar', 'currentview', 'month') == "oneweekview"){ - OC_Preferences::setValue(OCP\USER::getUser(), "calendar", "currentview", "agendaWeek"); +if(OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'currentview', 'month') == "oneweekview"){ + OCP\Config::setUserValue(OCP\USER::getUser(), "calendar", "currentview", "agendaWeek"); } -if(OC_Preferences::getValue(OCP\USER::getUser(), 'calendar', 'currentview', 'month') == "onemonthview"){ - OC_Preferences::setValue(OCP\USER::getUser(), "calendar", "currentview", "month"); +if(OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'currentview', 'month') == "onemonthview"){ + OCP\Config::setUserValue(OCP\USER::getUser(), "calendar", "currentview", "month"); } -if(OC_Preferences::getValue(OCP\USER::getUser(), 'calendar', 'currentview', 'month') == "listview"){ - OC_Preferences::setValue(OCP\USER::getUser(), "calendar", "currentview", "list"); +if(OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'currentview', 'month') == "listview"){ + OCP\Config::setUserValue(OCP\USER::getUser(), "calendar", "currentview", "list"); } OCP\Util::addscript('3rdparty/fullcalendar', 'fullcalendar'); OCP\Util::addStyle('3rdparty/fullcalendar', 'fullcalendar'); OCP\Util::addscript('3rdparty/timepicker', 'jquery.ui.timepicker'); OCP\Util::addStyle('3rdparty/timepicker', 'jquery.ui.timepicker'); -if(OC_Preferences::getValue(OCP\USER::getUser(), "calendar", "timezone") == null || OC_Preferences::getValue(OCP\USER::getUser(), 'calendar', 'timezonedetection') == 'true'){ +if(OCP\Config::getUserValue(OCP\USER::getUser(), "calendar", "timezone") == null || OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'timezonedetection') == 'true'){ OCP\Util::addscript('calendar', 'geo'); } OCP\Util::addscript('calendar', 'calendar'); diff --git a/apps/calendar/lib/app.php b/apps/calendar/lib/app.php index 7a52bf08dc7df5f4c97efb56b757862ccc3fb8ac..f3e9bea86a3e21a0248bc677c60b838b50ca03c8 100755 --- a/apps/calendar/lib/app.php +++ b/apps/calendar/lib/app.php @@ -9,7 +9,7 @@ * This class manages our app actions */ OC_Calendar_App::$l10n = new OC_L10N('calendar'); -OC_Calendar_App::$tz = OC_Preferences::getValue(OCP\USER::getUser(), 'calendar', 'timezone', date_default_timezone_get()); +OC_Calendar_App::$tz = OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'timezone', date_default_timezone_get()); class OC_Calendar_App{ const CALENDAR = 'calendar'; const EVENT = 'event'; diff --git a/apps/calendar/lib/object.php b/apps/calendar/lib/object.php index d8e9d5fb9461ed2f38b89d358256256a32b9d8e9..018bf5beff1194a46c7c71925ba7d55c0efe5c23 100755 --- a/apps/calendar/lib/object.php +++ b/apps/calendar/lib/object.php @@ -761,7 +761,7 @@ class OC_Calendar_Object{ $vevent->setDateTime('DTSTART', $start, Sabre_VObject_Property_DateTime::DATE); $vevent->setDateTime('DTEND', $end, Sabre_VObject_Property_DateTime::DATE); }else{ - $timezone = OC_Preferences::getValue(OCP\USER::getUser(), 'calendar', 'timezone', date_default_timezone_get()); + $timezone = OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'timezone', date_default_timezone_get()); $timezone = new DateTimeZone($timezone); $start = new DateTime($from.' '.$fromtime, $timezone); $end = new DateTime($to.' '.$totime, $timezone); diff --git a/apps/calendar/lib/search.php b/apps/calendar/lib/search.php index 3291e505249b1c3437c992255bef428e9de75f1e..03516b3b70c31007987fc70cb1a1f8cddfa7f300 100755 --- a/apps/calendar/lib/search.php +++ b/apps/calendar/lib/search.php @@ -12,7 +12,7 @@ class OC_Search_Provider_Calendar extends OC_Search_Provider{ }else{ $searchquery[] = $query; } - $user_timezone = OC_Preferences::getValue(OCP\USER::getUser(), 'calendar', 'timezone', date_default_timezone_get()); + $user_timezone = OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'timezone', date_default_timezone_get()); $l = new OC_l10n('calendar'); foreach($calendars as $calendar){ $objects = OC_Calendar_Object::all($calendar['id']); diff --git a/apps/calendar/settings.php b/apps/calendar/settings.php index d6195108a2d8d91d18c894dec8845dd6ff57b56c..981df9ffafdd58e0af6324c08e9a98ae9937f216 100755 --- a/apps/calendar/settings.php +++ b/apps/calendar/settings.php @@ -7,7 +7,7 @@ */ $tmpl = new OC_Template( 'calendar', 'settings'); -$timezone=OC_Preferences::getValue(OCP\USER::getUser(),'calendar','timezone',''); +$timezone=OCP\Config::getUserValue(OCP\USER::getUser(),'calendar','timezone',''); $tmpl->assign('timezone',$timezone); $tmpl->assign('timezones',DateTimeZone::listIdentifiers()); diff --git a/apps/calendar/templates/calendar.php b/apps/calendar/templates/calendar.php index 4285dc0f833df60c7ef6fb46211bbff119f9e6d7..7e767e367324ef006152cc0d85e384a6c2f1e117 100755 --- a/apps/calendar/templates/calendar.php +++ b/apps/calendar/templates/calendar.php @@ -1,13 +1,13 @@ <script type='text/javascript'> - var defaultView = '<?php echo OC_Preferences::getValue(OCP\USER::getUser(), 'calendar', 'currentview', 'month') ?>'; + var defaultView = '<?php echo OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'currentview', 'month') ?>'; var eventSources = <?php echo json_encode($_['eventSources']) ?>; var categories = <?php echo json_encode($_['categories']); ?>; var dayNames = <?php echo json_encode($l->tA(array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'))) ?>; var dayNamesShort = <?php echo json_encode($l->tA(array('Sun.', 'Mon.', 'Tue.', 'Wed.', 'Thu.', 'Fri.', 'Sat.'))) ?>; var monthNames = <?php echo json_encode($l->tA(array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'))) ?>; var monthNamesShort = <?php echo json_encode($l->tA(array('Jan.', 'Feb.', 'Mar.', 'Apr.', 'May.', 'Jun.', 'Jul.', 'Aug.', 'Sep.', 'Oct.', 'Nov.', 'Dec.'))) ?>; - var agendatime = '<?php echo ((int) OC_Preferences::getValue(OCP\USER::getUser(), 'calendar', 'timeformat', '24') == 24 ? 'HH:mm' : 'hh:mm tt'); ?>{ - <?php echo ((int) OC_Preferences::getValue(OCP\USER::getUser(), 'calendar', 'timeformat', '24') == 24 ? 'HH:mm' : 'hh:mm tt'); ?>}'; - var defaulttime = '<?php echo ((int) OC_Preferences::getValue(OCP\USER::getUser(), 'calendar', 'timeformat', '24') == 24 ? 'HH:mm' : 'hh:mm tt'); ?>'; + var agendatime = '<?php echo ((int) OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'timeformat', '24') == 24 ? 'HH:mm' : 'hh:mm tt'); ?>{ - <?php echo ((int) OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'timeformat', '24') == 24 ? 'HH:mm' : 'hh:mm tt'); ?>}'; + var defaulttime = '<?php echo ((int) OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'timeformat', '24') == 24 ? 'HH:mm' : 'hh:mm tt'); ?>'; var allDayText = '<?php echo addslashes($l->t('All day')) ?>'; var newcalendar = '<?php echo addslashes($l->t('New Calendar')) ?>'; var missing_field = '<?php echo addslashes($l->t('Missing fields')) ?>'; @@ -20,7 +20,7 @@ var missing_field_startsbeforeends = '<?php echo addslashes($l->t('The event ends before it starts')) ?>'; var missing_field_dberror = '<?php echo addslashes($l->t('There was a database fail')) ?>'; var totalurl = '<?php echo OCP\Util::linkToAbsolute('calendar', 'caldav.php'); ?>/calendars'; - var firstDay = '<?php echo (OC_Preferences::getValue(OCP\USER::getUser(), 'calendar', 'firstday', 'mo') == 'mo' ? '1' : '0'); ?>'; + var firstDay = '<?php echo (OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'firstday', 'mo') == 'mo' ? '1' : '0'); ?>'; $(document).ready(function() { <?php if(array_key_exists('showevent', $_)){ diff --git a/apps/contacts/lib/addressbook.php b/apps/contacts/lib/addressbook.php index 6aed959044704d7c770f66c4f6dbde721e665396..b4bcc20d3bb0989c4f62cb0a00d885fc306815cd 100755 --- a/apps/contacts/lib/addressbook.php +++ b/apps/contacts/lib/addressbook.php @@ -168,7 +168,7 @@ class OC_Contacts_Addressbook{ if(is_null($uid)){ $uid = OCP\USER::getUser(); } - $prefbooks = OC_Preferences::getValue($uid,'contacts','openaddressbooks',null); + $prefbooks = OCP\Config::getUserValue($uid,'contacts','openaddressbooks',null); if(!$prefbooks){ $addressbooks = OC_Contacts_Addressbook::all($uid); if(count($addressbooks) == 0){ @@ -176,7 +176,7 @@ class OC_Contacts_Addressbook{ $addressbooks = OC_Contacts_Addressbook::all($uid); } $prefbooks = $addressbooks[0]['id']; - OC_Preferences::setValue($uid,'contacts','openaddressbooks',$prefbooks); + OCP\Config::setUserValue($uid,'contacts','openaddressbooks',$prefbooks); } return explode(';',$prefbooks); } @@ -235,7 +235,7 @@ class OC_Contacts_Addressbook{ $openaddressbooks = self::cleanArray($openaddressbooks, false); sort($openaddressbooks, SORT_NUMERIC); // FIXME: I alway end up with a ';' prepending when imploding the array..? - OC_Preferences::setValue(OCP\USER::getUser(),'contacts','openaddressbooks',implode(';', $openaddressbooks)); + OCP\Config::setUserValue(OCP\USER::getUser(),'contacts','openaddressbooks',implode(';', $openaddressbooks)); return true; } diff --git a/apps/contacts/templates/index.php b/apps/contacts/templates/index.php index aa3885c4523a65b9cfa923f719b7f11f13bdd218..ab797deb16989a7f3c4ec40a0146ceccf0469526 100755 --- a/apps/contacts/templates/index.php +++ b/apps/contacts/templates/index.php @@ -1,7 +1,7 @@ <script type='text/javascript'> var totalurl = '<?php echo OCP\Util::linkToAbsolute('contacts', 'carddav.php'); ?>/addressbooks'; var categories = <?php echo json_encode($_['categories']); ?>; - var lang = '<?php echo OC_Preferences::getValue(OCP\USER::getUser(), 'core', 'lang', 'en'); ?>'; + var lang = '<?php echo OCP\Config::getUserValue(OCP\USER::getUser(), 'core', 'lang', 'en'); ?>'; </script> <div id="leftcontent" class="leftcontent"> <ul id="contacts"> diff --git a/apps/files_sharing/ajax/email.php b/apps/files_sharing/ajax/email.php index b74e163b8415af56024a811842ff56725c9b18cb..84202a23f5c4f5adc9fd67e35d720349988188c5 100755 --- a/apps/files_sharing/ajax/email.php +++ b/apps/files_sharing/ajax/email.php @@ -6,7 +6,7 @@ $user = OCP\USER::getUser(); $subject = $user + ' ' + 'shared a file with you'; $link = $_POST['link'] + '&f=' + $_POST['f']; $text = $user + ' ' + 'shared the file' + ' ' + $_POST['f'] + ' ' + 'with you.' + ' ' + 'It is available for download here:' + ' ' + $link; -$fromaddress = OC_Preferences::getValue($user, 'settings', 'email', 'sharing-noreply@'.$_SERVER['HTTP_HOST']); +$fromaddress = OCP\Config::getUserValue($user, 'settings', 'email', 'sharing-noreply@'.$_SERVER['HTTP_HOST']); OC_Mail::send($_POST['toaddress'], $_POST['toaddress'], $subject, $text, $fromaddress, $user); ?> \ No newline at end of file diff --git a/apps/gallery/ajax/galleryOp.php b/apps/gallery/ajax/galleryOp.php index aaf4a7d8658cdd95d4347e5cea646fd7d814cbd4..75b18c6f7bf48bdb5ebdf1ae207ab004a13c62f8 100755 --- a/apps/gallery/ajax/galleryOp.php +++ b/apps/gallery/ajax/galleryOp.php @@ -74,18 +74,18 @@ function handleStoreSettings($root, $order) { return; } - $current_root = OC_Preferences::getValue(OCP\USER::getUser(),'gallery', 'root', '/'); + $current_root = OCP\Config::getUserValue(OCP\USER::getUser(),'gallery', 'root', '/'); $root = trim($root); $root = rtrim($root, '/').'/'; $rescan = $current_root==$root?'no':'yes'; - OC_Preferences::setValue(OCP\USER::getUser(), 'gallery', 'root', $root); - OC_Preferences::setValue(OCP\USER::getUser(), 'gallery', 'order', $order); + OCP\Config::setUserValue(OCP\USER::getUser(), 'gallery', 'root', $root); + OCP\Config::setUserValue(OCP\USER::getUser(), 'gallery', 'order', $order); OC_JSON::success(array('rescan' => $rescan)); } function handleGetGallery($path) { $a = array(); - $root = OC_Preferences::getValue(OCP\USER::getUser(),'gallery', 'root', '/'); + $root = OCP\Config::getUserValue(OCP\USER::getUser(),'gallery', 'root', '/'); $path = utf8_decode(rtrim($root.$path,'/')); if($path == '') $path = '/'; $pathLen = strlen($path); @@ -127,7 +127,7 @@ function handleGetGallery($path) { function handleShare($path, $share, $recursive) { $recursive = $recursive == 'true' ? 1 : 0; $owner = OCP\USER::getUser(); - $root = OC_Preferences::getValue(OCP\USER::getUser(),'gallery', 'root', '/'); + $root = OCP\Config::getUserValue(OCP\USER::getUser(),'gallery', 'root', '/'); $path = utf8_decode(rtrim($root.$path,'/')); if($path == '') $path = '/'; $r = OC_Gallery_Album::find($owner, null, $path); diff --git a/apps/gallery/lib/album.php b/apps/gallery/lib/album.php index 8775cd52e11596a12d12b29b5a59e5327c1fac14..f58140c499999b501b71b9afecbd18236090cf04 100755 --- a/apps/gallery/lib/album.php +++ b/apps/gallery/lib/album.php @@ -79,7 +79,7 @@ class OC_Gallery_Album { $sql .= ' AND parent_path = ?'; $args[] = $parent; } - $order = OC_Preferences::getValue($owner, 'gallery', 'order', 'ASC'); + $order = OCP\Config::getUserValue($owner, 'gallery', 'order', 'ASC'); $sql .= ' ORDER BY album_name ' . $order; $stmt = OC_DB::prepare($sql); diff --git a/apps/gallery/lib/hooks_handlers.php b/apps/gallery/lib/hooks_handlers.php index 525afc4127e89fc7f7f60d36e52088147a30d4be..678d3fe7531920c23396f97e374bdfeeaa3afb01 100755 --- a/apps/gallery/lib/hooks_handlers.php +++ b/apps/gallery/lib/hooks_handlers.php @@ -59,7 +59,7 @@ class OC_Gallery_Hooks_Handlers { } public static function pathInRoot($path) { - $root = OC_Preferences::getValue(OCP\USER::getUser(), 'gallery', 'root', '/'); + $root = OCP\Config::getUserValue(OCP\USER::getUser(), 'gallery', 'root', '/'); return substr($path, 0, strlen($path)>strlen($root)?strlen($root):strlen($path)) == $root; } diff --git a/apps/gallery/lib/photo.php b/apps/gallery/lib/photo.php index 7885ce2bf5605160ee4ada58306ab3a0bdb232f7..010eb9ab91bf8477909e65d24b44e866adb2add4 100755 --- a/apps/gallery/lib/photo.php +++ b/apps/gallery/lib/photo.php @@ -98,6 +98,6 @@ class OC_Gallery_Photo { } public static function getGalleryRoot() { - return OC_Preferences::getValue(OCP\USER::getUser(), 'gallery', 'root', ''); + return OCP\Config::getUserValue(OCP\USER::getUser(), 'gallery', 'root', ''); } } diff --git a/apps/gallery/lib/scanner.php b/apps/gallery/lib/scanner.php index 11c7541a75fefb3ab40c2a1498bc1c9054773192..7a137cb3f508eeffdb2856e81d1df1635d43e041 100755 --- a/apps/gallery/lib/scanner.php +++ b/apps/gallery/lib/scanner.php @@ -24,7 +24,7 @@ class OC_Gallery_Scanner { public static function getGalleryRoot() { - return OC_Preferences::getValue(OCP\USER::getUser(), 'gallery', 'root', '/'); + return OCP\Config::getUserValue(OCP\USER::getUser(), 'gallery', 'root', '/'); } public static function getScanningRoot() { return OC_Filesystem::getRoot().self::getGalleryRoot(); diff --git a/apps/gallery/templates/index.php b/apps/gallery/templates/index.php index c9a6fb15627485eaed8c0c0d383bcf79f2788ca8..854e4480bcf6177baa93999cc565f53878773e40 100755 --- a/apps/gallery/templates/index.php +++ b/apps/gallery/templates/index.php @@ -9,7 +9,7 @@ OCP\Util::addscript('files_imageviewer', 'jquery.fancybox-1.3.4.pack'); OCP\Util::addStyle( 'files_imageviewer', 'jquery.fancybox-1.3.4' ); $l = OC_L10N::get('gallery'); ?> -<script type="text/javascript">var gallery_scanning_root='<? echo OC_Preferences::getValue(OCP\USER::getUser(), 'gallery', 'root', '/'); ?>'; var gallery_default_order = '<? echo OC_Preferences::getValue(OCP\USER::getUser(), 'gallery', 'order', 'ASC'); ?>';</script> +<script type="text/javascript">var gallery_scanning_root='<? echo OCP\Config::getUserValue(OCP\USER::getUser(), 'gallery', 'root', '/'); ?>'; var gallery_default_order = '<? echo OCP\Config::getUserValue(OCP\USER::getUser(), 'gallery', 'order', 'ASC'); ?>';</script> <div id="controls"> <div id="scan"> <div id="scanprogressbar"></div> diff --git a/apps/media/ajax/api.php b/apps/media/ajax/api.php index 3238ebcc679fb53ef902e8c94a211035cc996ca3..d648e6fe975e005b667f8d24c14b0038c5ae2b2f 100755 --- a/apps/media/ajax/api.php +++ b/apps/media/ajax/api.php @@ -54,10 +54,10 @@ if($arguments['action']){ case 'delete': $path=$arguments['path']; OC_MEDIA_COLLECTION::deleteSongByPath($path); - $paths=explode(PATH_SEPARATOR,OC_Preferences::getValue(OCP\USER::getUser(),'media','paths','')); + $paths=explode(PATH_SEPARATOR,OCP\Config::getUserValue(OCP\USER::getUser(),'media','paths','')); if(array_search($path,$paths)!==false){ unset($paths[array_search($path,$paths)]); - OC_Preferences::setValue(OCP\USER::getUser(),'media','paths',implode(PATH_SEPARATOR,$paths)); + OCP\Config::setUserValue(OCP\USER::getUser(),'media','paths',implode(PATH_SEPARATOR,$paths)); } case 'get_collection': $data=array(); diff --git a/apps/media/ajax/autoupdate.php b/apps/media/ajax/autoupdate.php index 24a7e2463f07f754b70cf1a342b95a8010d19839..1efbea3acefd2d18f8768b424810971c6a08171a 100755 --- a/apps/media/ajax/autoupdate.php +++ b/apps/media/ajax/autoupdate.php @@ -32,7 +32,7 @@ OC_JSON::checkAppEnabled('media'); $autoUpdate=(isset($_GET['autoupdate']) and $_GET['autoupdate']=='true'); -OC_Preferences::setValue(OCP\USER::getUser(),'media','autoupdate',(integer)$autoUpdate); +OCP\Config::setUserValue(OCP\USER::getUser(),'media','autoupdate',(integer)$autoUpdate); OC_JSON::success(array('data' => $autoUpdate)); ?> diff --git a/apps/user_ldap/user_ldap.php b/apps/user_ldap/user_ldap.php index 40cf1db67ce974ccb0794e8caf2766f5fe925ded..1a37630aad472da08b89740ad53ceeb10e241701 100755 --- a/apps/user_ldap/user_ldap.php +++ b/apps/user_ldap/user_ldap.php @@ -87,7 +87,7 @@ class OC_USER_LDAP extends OC_User_Backend { $quota = false; } $quota = $quota != -1 ? $quota : $this->ldap_quota_def; - OC_Preferences::setValue($uid, 'files', 'quota', OCP\Util::computerFileSize($quota)); + OCP\Config::setUserValue($uid, 'files', 'quota', OCP\Util::computerFileSize($quota)); } private function setEmail( $uid ) { @@ -95,7 +95,7 @@ class OC_USER_LDAP extends OC_User_Backend { return false; $email = $this->ldap_dc[$this->ldap_email_attr][0]; - OC_Preferences::setValue($uid, 'settings', 'email', $email); + OCP\Config::setUserValue($uid, 'settings', 'email', $email); } //Connect to LDAP and store the resource diff --git a/apps/user_openid/settings.php b/apps/user_openid/settings.php index 33a3f232a17707a9aea4534e405907db69330939..cdffab0bc25b95687adc2132819ce786327aaf57 100755 --- a/apps/user_openid/settings.php +++ b/apps/user_openid/settings.php @@ -1,7 +1,7 @@ <?php $tmpl = new OC_Template( 'user_openid', 'settings'); -$identity=OC_Preferences::getValue(OCP\USER::getUser(),'user_openid','identity',''); +$identity=OCP\Config::getUserValue(OCP\USER::getUser(),'user_openid','identity',''); $tmpl->assign('identity',$identity); OCP\Util::addscript('user_openid','settings'); diff --git a/lib/public/config.php b/lib/public/config.php index cbc7d916cf4f942b581acd9b8c9d06117d0a0fbe..5681f20e3b33d744c8ce98f1df762b9fcdd2ecd6 100644 --- a/lib/public/config.php +++ b/lib/public/config.php @@ -92,6 +92,41 @@ class Config { } + /** + * @brief Gets the preference + * @param $user user + * @param $app app + * @param $key key + * @param $default = null, default value if the key does not exist + * @returns the value or $default + * + * This function gets a value from the prefernces table. If the key does + * not exist the default value will be returnes + */ + public static function getUserValue( $user, $app, $key, $default = null ){ + return(\OC_Preferences::getValue( $user, $app, $key, $default )); + } + + + /** + * @brief sets a value in the preferences + * @param $user user + * @param $app app + * @param $key key + * @param $value value + * @returns true/false + * + * Adds a value to the preferences. If the key did not exist before, it + * will be added automagically. + */ + public static function setUserValue( $user, $app, $key, $value ){ + return(\OC_Preferences::setValue( $user, $app, $key, $value )); + } + + + + + }