aboutsummaryrefslogtreecommitdiffstats
path: root/settings
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2014-12-04 16:48:07 +0100
committerMorris Jobke <hey@morrisjobke.de>2014-12-08 22:42:37 +0100
commit0d4f0ab87182cf2cb588bd3285fe41b46f26ee4d (patch)
tree68ee815c2f06e4f6ef049d56f65fdbf2cf8c4d18 /settings
parent2d5fc9c1a6beec15f04277ccf1408b17f04631e9 (diff)
downloadnextcloud-server-0d4f0ab87182cf2cb588bd3285fe41b46f26ee4d.tar.gz
nextcloud-server-0d4f0ab87182cf2cb588bd3285fe41b46f26ee4d.zip
reduce OC_Preferences, OC_Config and \OCP\Config usage
* files_encryption * files_versions * files_trashbin * tests * status.php * core * server container
Diffstat (limited to 'settings')
-rw-r--r--settings/ajax/lostpassword.php2
-rw-r--r--settings/ajax/setlanguage.php2
-rw-r--r--settings/ajax/setquota.php2
-rw-r--r--settings/personal.php15
-rw-r--r--settings/users.php6
5 files changed, 15 insertions, 12 deletions
diff --git a/settings/ajax/lostpassword.php b/settings/ajax/lostpassword.php
index 395ba31f92b..b0fb20c4a7e 100644
--- a/settings/ajax/lostpassword.php
+++ b/settings/ajax/lostpassword.php
@@ -8,7 +8,7 @@ $l = \OC::$server->getL10N('settings');
// Get data
if( isset( $_POST['email'] ) && OC_Mail::validateAddress($_POST['email']) ) {
$email=trim($_POST['email']);
- OC_Preferences::setValue(OC_User::getUser(), 'settings', 'email', $email);
+ \OC::$server->getConfig()->setUserValue(OC_User::getUser(), 'settings', 'email', $email);
OC_JSON::success(array("data" => array( "message" => $l->t("Email saved") )));
}else{
OC_JSON::error(array("data" => array( "message" => $l->t("Invalid email") )));
diff --git a/settings/ajax/setlanguage.php b/settings/ajax/setlanguage.php
index a3988db85bb..a83212927bf 100644
--- a/settings/ajax/setlanguage.php
+++ b/settings/ajax/setlanguage.php
@@ -11,7 +11,7 @@ if( isset( $_POST['lang'] ) ) {
$languageCodes=OC_L10N::findAvailableLanguages();
$lang=$_POST['lang'];
if(array_search($lang, $languageCodes) or $lang === 'en') {
- OC_Preferences::setValue( OC_User::getUser(), 'core', 'lang', $lang );
+ \OC::$server->getConfig()->setUserValue( OC_User::getUser(), 'core', 'lang', $lang );
OC_JSON::success(array("data" => array( "message" => $l->t("Language changed") )));
}else{
OC_JSON::error(array("data" => array( "message" => $l->t("Invalid request") )));
diff --git a/settings/ajax/setquota.php b/settings/ajax/setquota.php
index f19506a0456..64a686e83d7 100644
--- a/settings/ajax/setquota.php
+++ b/settings/ajax/setquota.php
@@ -27,7 +27,7 @@ if($quota !== 'none' and $quota !== 'default') {
// Return Success story
if($username) {
- OC_Preferences::setValue($username, 'files', 'quota', $quota);
+ \OC::$server->getConfig()->setUserValue($username, 'files', 'quota', $quota);
}else{//set the default quota when no username is specified
if($quota === 'default') {//'default' as default quota makes no sense
$quota='none';
diff --git a/settings/personal.php b/settings/personal.php
index bef800ae7f1..f181c9cb2c1 100644
--- a/settings/personal.php
+++ b/settings/personal.php
@@ -9,6 +9,7 @@ OC_Util::checkLoggedIn();
$defaults = new OC_Defaults(); // initialize themable default strings and urls
$certificateManager = \OC::$server->getCertificateManager();
+$config = \OC::$server->getConfig();
// Highlight navigation entry
OC_Util::addScript( 'settings', 'personal' );
@@ -16,7 +17,7 @@ OC_Util::addStyle( 'settings', 'settings' );
\OC_Util::addVendorScript('strengthify/jquery.strengthify');
\OC_Util::addVendorStyle('strengthify/strengthify');
\OC_Util::addScript('files', 'jquery.fileupload');
-if (\OC_Config::getValue('enable_avatars', true) === true) {
+if ($config->getSystemValue('enable_avatars', true) === true) {
\OC_Util::addVendorScript('jcrop/js/jquery.Jcrop');
\OC_Util::addVendorStyle('jcrop/css/jquery.Jcrop');
}
@@ -26,9 +27,9 @@ OC_App::setActiveNavigationEntry( 'personal' );
$storageInfo=OC_Helper::getStorageInfo('/');
-$email=OC_Preferences::getValue(OC_User::getUser(), 'settings', 'email', '');
+$email=$config->getUserValue(OC_User::getUser(), 'settings', 'email', '');
-$userLang=OC_Preferences::getValue( OC_User::getUser(), 'core', 'lang', OC_L10N::findLanguage() );
+$userLang=$config->getUserValue( OC_User::getUser(), 'core', 'lang', OC_L10N::findLanguage() );
$languageCodes=OC_L10N::findAvailableLanguages();
//check if encryption was enabled in the past
@@ -74,9 +75,9 @@ usort( $languages, function ($a, $b) {
//links to clients
$clients = array(
- 'desktop' => OC_Config::getValue('customclient_desktop', $defaults->getSyncClientUrl()),
- 'android' => OC_Config::getValue('customclient_android', $defaults->getAndroidClientUrl()),
- 'ios' => OC_Config::getValue('customclient_ios', $defaults->getiOSClientUrl())
+ 'desktop' => $config->getSystemValue('customclient_desktop', $defaults->getSyncClientUrl()),
+ 'android' => $config->getSystemValue('customclient_android', $defaults->getAndroidClientUrl()),
+ 'ios' => $config->getSystemValue('customclient_ios', $defaults->getiOSClientUrl())
);
// Return template
@@ -95,7 +96,7 @@ $tmpl->assign('displayName', OC_User::getDisplayName());
$tmpl->assign('enableDecryptAll' , $enableDecryptAll);
$tmpl->assign('backupKeysExists' , $backupKeysExists);
$tmpl->assign('filesStillEncrypted' , $filesStillEncrypted);
-$tmpl->assign('enableAvatars', \OC_Config::getValue('enable_avatars', true));
+$tmpl->assign('enableAvatars', $config->getSystemValue('enable_avatars', true));
$tmpl->assign('avatarChangeSupported', OC_User::canUserChangeAvatar(OC_User::getUser()));
$tmpl->assign('certs', $certificateManager->listCertificates());
diff --git a/settings/users.php b/settings/users.php
index 85f160a1552..3da8017b883 100644
--- a/settings/users.php
+++ b/settings/users.php
@@ -21,6 +21,8 @@ $users = array();
$userManager = \OC_User::getManager();
$groupManager = \OC_Group::getManager();
+$config = \OC::$server->getConfig();
+
$isAdmin = OC_User::isAdminUser(OC_User::getUser());
$groupsInfo = new \OC\Group\MetaData(OC_User::getUser(), $isAdmin, $groupManager);
@@ -28,7 +30,7 @@ $groupsInfo->setSorting($groupsInfo::SORT_USERCOUNT);
list($adminGroup, $groups) = $groupsInfo->get();
$recoveryAdminEnabled = OC_App::isEnabled('files_encryption') &&
- OC_Appconfig::getValue( 'files_encryption', 'recoveryAdminEnabled' );
+ $config->getAppValue( 'files_encryption', 'recoveryAdminEnabled', null );
if($isAdmin) {
$accessibleUsers = OC_User::getDisplayNames('', 30);
@@ -59,7 +61,7 @@ $defaultQuotaIsUserDefined=array_search($defaultQuota, $quotaPreset)===false
// load users and quota
foreach($accessibleUsers as $uid => $displayName) {
- $quota = OC_Preferences::getValue($uid, 'files', 'quota', 'default');
+ $quota = $config->getUserValue($uid, 'files', 'quota', 'default');
$isQuotaUserDefined = array_search($quota, $quotaPreset) === false
&& array_search($quota, array('none', 'default')) === false;