port oc_preferences

This commit is contained in:
Frank Karlitschek 2012-05-02 15:54:34 +02:00
parent ff66600bc0
commit 82a61e2e1a
30 changed files with 84 additions and 49 deletions

View File

@ -17,6 +17,6 @@ switch($view){
OC_JSON::error(array('message'=>'unexspected parameter: ' . $view)); OC_JSON::error(array('message'=>'unexspected parameter: ' . $view));
exit; exit;
} }
OC_Preferences::setValue(OCP\USER::getUser(), 'calendar', 'currentview', $view); OCP\Config::setUserValue(OCP\USER::getUser(), 'calendar', 'currentview', $view);
OC_JSON::success(); OC_JSON::success();
?> ?>

View File

@ -22,12 +22,12 @@ $end = $_POST['end'];
$allday = $_POST['allday']; $allday = $_POST['allday'];
if (!$end){ 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); $end = $start + ($duration * 60);
} }
$start = new DateTime('@'.$start); $start = new DateTime('@'.$start);
$end = new DateTime('@'.$end); $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)); $start->setTimezone(new DateTimeZone($timezone));
$end->setTimezone(new DateTimeZone($timezone)); $end->setTimezone(new DateTimeZone($timezone));

View File

@ -7,6 +7,6 @@
*/ */
OC_JSON::checkLoggedIn(); 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)); OC_JSON::encodedPrint(array('firstday' => $firstday));
?> ?>

View File

@ -8,4 +8,4 @@
OC_JSON::checkLoggedIn(); OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('calendar'); OC_JSON::checkAppEnabled('calendar');
OC_JSON::success(array('detection' => OC_Preferences::getValue(OCP\USER::getUser(), 'calendar', 'timezonedetection'))); OC_JSON::success(array('detection' => OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'timezonedetection')));

View File

@ -17,11 +17,11 @@ $lng = $_GET['long'];
$timezone = OC_Geo::timezone($lat, $lng); $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(); OC_JSON::success();
exit; 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); $message = array('message'=> $l->t('New Timezone:') . $timezone);
OC_JSON::success($message); OC_JSON::success($message);
?> ?>

View File

@ -8,7 +8,7 @@
OC_JSON::checkLoggedIn(); OC_JSON::checkLoggedIn();
if(isset($_POST["firstday"])){ 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(); OC_JSON::success();
}else{ }else{
OC_JSON::error(); OC_JSON::error();

View File

@ -8,7 +8,7 @@
OC_JSON::checkLoggedIn(); OC_JSON::checkLoggedIn();
if(isset($_POST["timeformat"])){ 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(); OC_JSON::success();
}else{ }else{
OC_JSON::error(); OC_JSON::error();

View File

@ -18,7 +18,7 @@ OC_JSON::checkAppEnabled('calendar');
// Get data // Get data
if( isset( $_POST['timezone'] ) ){ if( isset( $_POST['timezone'] ) ){
$timezone=$_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') ))); OC_JSON::success(array('data' => array( 'message' => $l->t('Timezone changed') )));
}else{ }else{
OC_JSON::error(array('data' => array( 'message' => $l->t('Invalid request') ))); OC_JSON::error(array('data' => array( 'message' => $l->t('Invalid request') )));

View File

@ -7,6 +7,6 @@
*/ */
OC_JSON::checkLoggedIn(); 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)); OC_JSON::encodedPrint(array("timeformat" => $timeformat));
?> ?>

View File

@ -10,9 +10,9 @@ OC_JSON::checkLoggedIn();
OC_JSON::checkAppEnabled('calendar'); OC_JSON::checkAppEnabled('calendar');
if(array_key_exists('timezonedetection', $_POST)){ if(array_key_exists('timezonedetection', $_POST)){
if($_POST['timezonedetection'] == 'on'){ if($_POST['timezonedetection'] == 'on'){
OC_Preferences::setValue(OCP\USER::getUser(), 'calendar', 'timezonedetection', 'true'); OCP\Config::setUserValue(OCP\USER::getUser(), 'calendar', 'timezonedetection', 'true');
}else{ }else{
OC_Preferences::setValue(OCP\USER::getUser(), 'calendar', 'timezonedetection', 'false'); OCP\Config::setUserValue(OCP\USER::getUser(), 'calendar', 'timezonedetection', 'false');
} }
OC_JSON::success(); OC_JSON::success();
}else{ }else{

View File

@ -29,21 +29,21 @@ OC_Hook::emit('OC_Calendar', 'getSources', array('sources' => &$eventSources));
$categories = OC_Calendar_App::getCategoryOptions(); $categories = OC_Calendar_App::getCategoryOptions();
//Fix currentview for fullcalendar //Fix currentview for fullcalendar
if(OC_Preferences::getValue(OCP\USER::getUser(), 'calendar', 'currentview', 'month') == "oneweekview"){ if(OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'currentview', 'month') == "oneweekview"){
OC_Preferences::setValue(OCP\USER::getUser(), "calendar", "currentview", "agendaWeek"); OCP\Config::setUserValue(OCP\USER::getUser(), "calendar", "currentview", "agendaWeek");
} }
if(OC_Preferences::getValue(OCP\USER::getUser(), 'calendar', 'currentview', 'month') == "onemonthview"){ if(OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'currentview', 'month') == "onemonthview"){
OC_Preferences::setValue(OCP\USER::getUser(), "calendar", "currentview", "month"); OCP\Config::setUserValue(OCP\USER::getUser(), "calendar", "currentview", "month");
} }
if(OC_Preferences::getValue(OCP\USER::getUser(), 'calendar', 'currentview', 'month') == "listview"){ if(OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'currentview', 'month') == "listview"){
OC_Preferences::setValue(OCP\USER::getUser(), "calendar", "currentview", "list"); OCP\Config::setUserValue(OCP\USER::getUser(), "calendar", "currentview", "list");
} }
OCP\Util::addscript('3rdparty/fullcalendar', 'fullcalendar'); OCP\Util::addscript('3rdparty/fullcalendar', 'fullcalendar');
OCP\Util::addStyle('3rdparty/fullcalendar', 'fullcalendar'); OCP\Util::addStyle('3rdparty/fullcalendar', 'fullcalendar');
OCP\Util::addscript('3rdparty/timepicker', 'jquery.ui.timepicker'); OCP\Util::addscript('3rdparty/timepicker', 'jquery.ui.timepicker');
OCP\Util::addStyle('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', 'geo');
} }
OCP\Util::addscript('calendar', 'calendar'); OCP\Util::addscript('calendar', 'calendar');

View File

@ -9,7 +9,7 @@
* This class manages our app actions * This class manages our app actions
*/ */
OC_Calendar_App::$l10n = new OC_L10N('calendar'); 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{ class OC_Calendar_App{
const CALENDAR = 'calendar'; const CALENDAR = 'calendar';
const EVENT = 'event'; const EVENT = 'event';

View File

@ -761,7 +761,7 @@ class OC_Calendar_Object{
$vevent->setDateTime('DTSTART', $start, Sabre_VObject_Property_DateTime::DATE); $vevent->setDateTime('DTSTART', $start, Sabre_VObject_Property_DateTime::DATE);
$vevent->setDateTime('DTEND', $end, Sabre_VObject_Property_DateTime::DATE); $vevent->setDateTime('DTEND', $end, Sabre_VObject_Property_DateTime::DATE);
}else{ }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); $timezone = new DateTimeZone($timezone);
$start = new DateTime($from.' '.$fromtime, $timezone); $start = new DateTime($from.' '.$fromtime, $timezone);
$end = new DateTime($to.' '.$totime, $timezone); $end = new DateTime($to.' '.$totime, $timezone);

View File

@ -12,7 +12,7 @@ class OC_Search_Provider_Calendar extends OC_Search_Provider{
}else{ }else{
$searchquery[] = $query; $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'); $l = new OC_l10n('calendar');
foreach($calendars as $calendar){ foreach($calendars as $calendar){
$objects = OC_Calendar_Object::all($calendar['id']); $objects = OC_Calendar_Object::all($calendar['id']);

View File

@ -7,7 +7,7 @@
*/ */
$tmpl = new OC_Template( 'calendar', 'settings'); $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('timezone',$timezone);
$tmpl->assign('timezones',DateTimeZone::listIdentifiers()); $tmpl->assign('timezones',DateTimeZone::listIdentifiers());

View File

@ -1,13 +1,13 @@
<script type='text/javascript'> <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 eventSources = <?php echo json_encode($_['eventSources']) ?>;
var categories = <?php echo json_encode($_['categories']); ?>; var categories = <?php echo json_encode($_['categories']); ?>;
var dayNames = <?php echo json_encode($l->tA(array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'))) ?>; 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 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 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 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 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) OC_Preferences::getValue(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 allDayText = '<?php echo addslashes($l->t('All day')) ?>';
var newcalendar = '<?php echo addslashes($l->t('New Calendar')) ?>'; var newcalendar = '<?php echo addslashes($l->t('New Calendar')) ?>';
var missing_field = '<?php echo addslashes($l->t('Missing fields')) ?>'; 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_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 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 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() { $(document).ready(function() {
<?php <?php
if(array_key_exists('showevent', $_)){ if(array_key_exists('showevent', $_)){

View File

@ -168,7 +168,7 @@ class OC_Contacts_Addressbook{
if(is_null($uid)){ if(is_null($uid)){
$uid = OCP\USER::getUser(); $uid = OCP\USER::getUser();
} }
$prefbooks = OC_Preferences::getValue($uid,'contacts','openaddressbooks',null); $prefbooks = OCP\Config::getUserValue($uid,'contacts','openaddressbooks',null);
if(!$prefbooks){ if(!$prefbooks){
$addressbooks = OC_Contacts_Addressbook::all($uid); $addressbooks = OC_Contacts_Addressbook::all($uid);
if(count($addressbooks) == 0){ if(count($addressbooks) == 0){
@ -176,7 +176,7 @@ class OC_Contacts_Addressbook{
$addressbooks = OC_Contacts_Addressbook::all($uid); $addressbooks = OC_Contacts_Addressbook::all($uid);
} }
$prefbooks = $addressbooks[0]['id']; $prefbooks = $addressbooks[0]['id'];
OC_Preferences::setValue($uid,'contacts','openaddressbooks',$prefbooks); OCP\Config::setUserValue($uid,'contacts','openaddressbooks',$prefbooks);
} }
return explode(';',$prefbooks); return explode(';',$prefbooks);
} }
@ -235,7 +235,7 @@ class OC_Contacts_Addressbook{
$openaddressbooks = self::cleanArray($openaddressbooks, false); $openaddressbooks = self::cleanArray($openaddressbooks, false);
sort($openaddressbooks, SORT_NUMERIC); sort($openaddressbooks, SORT_NUMERIC);
// FIXME: I alway end up with a ';' prepending when imploding the array..? // 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; return true;
} }

View File

@ -1,7 +1,7 @@
<script type='text/javascript'> <script type='text/javascript'>
var totalurl = '<?php echo OCP\Util::linkToAbsolute('contacts', 'carddav.php'); ?>/addressbooks'; var totalurl = '<?php echo OCP\Util::linkToAbsolute('contacts', 'carddav.php'); ?>/addressbooks';
var categories = <?php echo json_encode($_['categories']); ?>; 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> </script>
<div id="leftcontent" class="leftcontent"> <div id="leftcontent" class="leftcontent">
<ul id="contacts"> <ul id="contacts">

View File

@ -6,7 +6,7 @@ $user = OCP\USER::getUser();
$subject = $user + ' ' + 'shared a file with you'; $subject = $user + ' ' + 'shared a file with you';
$link = $_POST['link'] + '&f=' + $_POST['f']; $link = $_POST['link'] + '&f=' + $_POST['f'];
$text = $user + ' ' + 'shared the file' + ' ' + $_POST['f'] + ' ' + 'with you.' + ' ' + 'It is available for download here:' + ' ' + $link; $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); OC_Mail::send($_POST['toaddress'], $_POST['toaddress'], $subject, $text, $fromaddress, $user);
?> ?>

View File

@ -74,18 +74,18 @@ function handleStoreSettings($root, $order) {
return; 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 = trim($root);
$root = rtrim($root, '/').'/'; $root = rtrim($root, '/').'/';
$rescan = $current_root==$root?'no':'yes'; $rescan = $current_root==$root?'no':'yes';
OC_Preferences::setValue(OCP\USER::getUser(), 'gallery', 'root', $root); OCP\Config::setUserValue(OCP\USER::getUser(), 'gallery', 'root', $root);
OC_Preferences::setValue(OCP\USER::getUser(), 'gallery', 'order', $order); OCP\Config::setUserValue(OCP\USER::getUser(), 'gallery', 'order', $order);
OC_JSON::success(array('rescan' => $rescan)); OC_JSON::success(array('rescan' => $rescan));
} }
function handleGetGallery($path) { function handleGetGallery($path) {
$a = array(); $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,'/')); $path = utf8_decode(rtrim($root.$path,'/'));
if($path == '') $path = '/'; if($path == '') $path = '/';
$pathLen = strlen($path); $pathLen = strlen($path);
@ -127,7 +127,7 @@ function handleGetGallery($path) {
function handleShare($path, $share, $recursive) { function handleShare($path, $share, $recursive) {
$recursive = $recursive == 'true' ? 1 : 0; $recursive = $recursive == 'true' ? 1 : 0;
$owner = OCP\USER::getUser(); $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,'/')); $path = utf8_decode(rtrim($root.$path,'/'));
if($path == '') $path = '/'; if($path == '') $path = '/';
$r = OC_Gallery_Album::find($owner, null, $path); $r = OC_Gallery_Album::find($owner, null, $path);

View File

@ -79,7 +79,7 @@ class OC_Gallery_Album {
$sql .= ' AND parent_path = ?'; $sql .= ' AND parent_path = ?';
$args[] = $parent; $args[] = $parent;
} }
$order = OC_Preferences::getValue($owner, 'gallery', 'order', 'ASC'); $order = OCP\Config::getUserValue($owner, 'gallery', 'order', 'ASC');
$sql .= ' ORDER BY album_name ' . $order; $sql .= ' ORDER BY album_name ' . $order;
$stmt = OC_DB::prepare($sql); $stmt = OC_DB::prepare($sql);

View File

@ -59,7 +59,7 @@ class OC_Gallery_Hooks_Handlers {
} }
public static function pathInRoot($path) { 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; return substr($path, 0, strlen($path)>strlen($root)?strlen($root):strlen($path)) == $root;
} }

View File

@ -98,6 +98,6 @@ class OC_Gallery_Photo {
} }
public static function getGalleryRoot() { public static function getGalleryRoot() {
return OC_Preferences::getValue(OCP\USER::getUser(), 'gallery', 'root', ''); return OCP\Config::getUserValue(OCP\USER::getUser(), 'gallery', 'root', '');
} }
} }

View File

@ -24,7 +24,7 @@
class OC_Gallery_Scanner { class OC_Gallery_Scanner {
public static function getGalleryRoot() { 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() { public static function getScanningRoot() {
return OC_Filesystem::getRoot().self::getGalleryRoot(); return OC_Filesystem::getRoot().self::getGalleryRoot();

View File

@ -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' ); OCP\Util::addStyle( 'files_imageviewer', 'jquery.fancybox-1.3.4' );
$l = OC_L10N::get('gallery'); $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="controls">
<div id="scan"> <div id="scan">
<div id="scanprogressbar"></div> <div id="scanprogressbar"></div>

View File

@ -54,10 +54,10 @@ if($arguments['action']){
case 'delete': case 'delete':
$path=$arguments['path']; $path=$arguments['path'];
OC_MEDIA_COLLECTION::deleteSongByPath($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){ if(array_search($path,$paths)!==false){
unset($paths[array_search($path,$paths)]); 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': case 'get_collection':
$data=array(); $data=array();

View File

@ -32,7 +32,7 @@ OC_JSON::checkAppEnabled('media');
$autoUpdate=(isset($_GET['autoupdate']) and $_GET['autoupdate']=='true'); $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)); OC_JSON::success(array('data' => $autoUpdate));
?> ?>

View File

@ -87,7 +87,7 @@ class OC_USER_LDAP extends OC_User_Backend {
$quota = false; $quota = false;
} }
$quota = $quota != -1 ? $quota : $this->ldap_quota_def; $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 ) { private function setEmail( $uid ) {
@ -95,7 +95,7 @@ class OC_USER_LDAP extends OC_User_Backend {
return false; return false;
$email = $this->ldap_dc[$this->ldap_email_attr][0]; $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 //Connect to LDAP and store the resource

View File

@ -1,7 +1,7 @@
<?php <?php
$tmpl = new OC_Template( 'user_openid', 'settings'); $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); $tmpl->assign('identity',$identity);
OCP\Util::addscript('user_openid','settings'); OCP\Util::addscript('user_openid','settings');

View File

@ -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 ));
}
} }