Completed
Pull Request — stable9 (#4232)
by Lukas
25:41 queued 15:25
created
settings/ajax/setlanguage.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -32,15 +32,15 @@
 block discarded – undo
32 32
 
33 33
 
34 34
 // Get data
35
-if( isset( $_POST['lang'] ) ) {
35
+if (isset($_POST['lang'])) {
36 36
 	$languageCodes = \OC::$server->getL10NFactory()->findAvailableLanguages();
37
-	$lang = (string)$_POST['lang'];
38
-	if(array_search($lang, $languageCodes) or $lang === 'en') {
39
-		\OC::$server->getConfig()->setUserValue( OC_User::getUser(), 'core', 'lang', $lang );
40
-		OC_JSON::success(array("data" => array( "message" => $l->t("Language changed") )));
41
-	}else{
42
-		OC_JSON::error(array("data" => array( "message" => $l->t("Invalid request") )));
37
+	$lang = (string) $_POST['lang'];
38
+	if (array_search($lang, $languageCodes) or $lang === 'en') {
39
+		\OC::$server->getConfig()->setUserValue(OC_User::getUser(), 'core', 'lang', $lang);
40
+		OC_JSON::success(array("data" => array("message" => $l->t("Language changed"))));
41
+	} else {
42
+		OC_JSON::error(array("data" => array("message" => $l->t("Invalid request"))));
43 43
 	}
44
-}else{
45
-	OC_JSON::error(array("data" => array( "message" => $l->t("Invalid request") )));
44
+} else {
45
+	OC_JSON::error(array("data" => array("message" => $l->t("Invalid request"))));
46 46
 }
Please login to merge, or discard this patch.
settings/ajax/togglesubadmins.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -24,20 +24,20 @@
 block discarded – undo
24 24
 OC_JSON::checkAdminUser();
25 25
 OCP\JSON::callCheck();
26 26
 
27
-$username = (string)$_POST['username'];
28
-$group = (string)$_POST['group'];
27
+$username = (string) $_POST['username'];
28
+$group = (string) $_POST['group'];
29 29
 
30 30
 $subAdminManager = \OC::$server->getGroupManager()->getSubAdmin();
31 31
 $targetUserObject = \OC::$server->getUserManager()->get($username);
32 32
 $targetGroupObject = \OC::$server->getGroupManager()->get($group);
33 33
 
34 34
 $isSubAdminOfGroup = false;
35
-if($targetUserObject !== null && $targetUserObject !== null) {
35
+if ($targetUserObject !== null && $targetUserObject !== null) {
36 36
 	$isSubAdminOfGroup = $subAdminManager->isSubAdminofGroup($targetUserObject, $targetGroupObject);
37 37
 }
38 38
 
39 39
 // Toggle group
40
-if($isSubAdminOfGroup) {
40
+if ($isSubAdminOfGroup) {
41 41
 	$subAdminManager->deleteSubAdmin($targetUserObject, $targetGroupObject);
42 42
 } else {
43 43
 	$subAdminManager->createSubAdmin($targetUserObject, $targetGroupObject);
Please login to merge, or discard this patch.
settings/ajax/disableapp.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
 	exit;
30 30
 }
31 31
 
32
-$appId = (string)$_POST['appid'];
32
+$appId = (string) $_POST['appid'];
33 33
 $appId = OC_App::cleanAppId($appId);
34 34
 
35 35
 OC_App::disable($appId);
Please login to merge, or discard this patch.
settings/ajax/enableapp.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -28,13 +28,13 @@
 block discarded – undo
28 28
 OC_JSON::checkAdminUser();
29 29
 OCP\JSON::callCheck();
30 30
 
31
-$groups = isset($_POST['groups']) ? (array)$_POST['groups'] : null;
31
+$groups = isset($_POST['groups']) ? (array) $_POST['groups'] : null;
32 32
 
33 33
 try {
34
-	$app = OC_App::cleanAppId((string)$_POST['appid']);
34
+	$app = OC_App::cleanAppId((string) $_POST['appid']);
35 35
 	OC_App::enable($app, $groups);
36 36
 	OC_JSON::success(['data' => ['update_required' => \OC_App::shouldUpgrade($app)]]);
37 37
 } catch (Exception $e) {
38 38
 	\OCP\Util::writeLog('core', $e->getMessage(), \OCP\Util::ERROR);
39
-	OC_JSON::error(array("data" => array("message" => $e->getMessage()) ));
39
+	OC_JSON::error(array("data" => array("message" => $e->getMessage())));
40 40
 }
Please login to merge, or discard this patch.
settings/ajax/togglegroups.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -29,12 +29,12 @@  discard block
 block discarded – undo
29 29
 OCP\JSON::callCheck();
30 30
 
31 31
 $success = true;
32
-$username = (string)$_POST['username'];
33
-$group = (string)$_POST['group'];
32
+$username = (string) $_POST['username'];
33
+$group = (string) $_POST['group'];
34 34
 
35
-if($username === OC_User::getUser() && $group === "admin" &&  OC_User::isAdminUser($username)) {
35
+if ($username === OC_User::getUser() && $group === "admin" && OC_User::isAdminUser($username)) {
36 36
 	$l = \OC::$server->getL10N('core');
37
-	OC_JSON::error(array( 'data' => array( 'message' => $l->t('Admins can\'t remove themself from the admin group'))));
37
+	OC_JSON::error(array('data' => array('message' => $l->t('Admins can\'t remove themself from the admin group'))));
38 38
 	exit();
39 39
 }
40 40
 
@@ -43,20 +43,20 @@  discard block
 block discarded – undo
43 43
 $currentUserObject = \OC::$server->getUserSession()->getUser();
44 44
 $targetUserObject = \OC::$server->getUserManager()->get($username);
45 45
 $targetGroupObject = \OC::$server->getGroupManager()->get($group);
46
-if($targetUserObject !== null && $currentUserObject !== null && $targetGroupObject !== null) {
46
+if ($targetUserObject !== null && $currentUserObject !== null && $targetGroupObject !== null) {
47 47
 	$isUserAccessible = \OC::$server->getGroupManager()->getSubAdmin()->isUserAccessible($currentUserObject, $targetUserObject);
48 48
 	$isGroupAccessible = \OC::$server->getGroupManager()->getSubAdmin()->isSubAdminofGroup($currentUserObject, $targetGroupObject);
49 49
 }
50 50
 
51
-if(!OC_User::isAdminUser(OC_User::getUser())
51
+if (!OC_User::isAdminUser(OC_User::getUser())
52 52
 	&& (!$isUserAccessible
53 53
 		|| !$isGroupAccessible)) {
54 54
 	$l = \OC::$server->getL10N('core');
55
-	OC_JSON::error(array( 'data' => array( 'message' => $l->t('Authentication error') )));
55
+	OC_JSON::error(array('data' => array('message' => $l->t('Authentication error'))));
56 56
 	exit();
57 57
 }
58 58
 
59
-if(!OC_Group::groupExists($group)) {
59
+if (!OC_Group::groupExists($group)) {
60 60
 	OC_Group::createGroup($group);
61 61
 }
62 62
 
@@ -66,20 +66,20 @@  discard block
 block discarded – undo
66 66
 $action = "add";
67 67
 
68 68
 // Toggle group
69
-if( OC_Group::inGroup( $username, $group )) {
69
+if (OC_Group::inGroup($username, $group)) {
70 70
 	$action = "remove";
71 71
 	$error = $l->t("Unable to remove user from group %s", $group);
72
-	$success = OC_Group::removeFromGroup( $username, $group );
73
-	$usersInGroup=OC_Group::usersInGroup($group);
72
+	$success = OC_Group::removeFromGroup($username, $group);
73
+	$usersInGroup = OC_Group::usersInGroup($group);
74 74
 }
75
-else{
76
-	$success = OC_Group::addToGroup( $username, $group );
75
+else {
76
+	$success = OC_Group::addToGroup($username, $group);
77 77
 }
78 78
 
79 79
 // Return Success story
80
-if( $success ) {
81
-	OC_JSON::success(array("data" => array( "username" => $username, "action" => $action, "groupname" => $group )));
80
+if ($success) {
81
+	OC_JSON::success(array("data" => array("username" => $username, "action" => $action, "groupname" => $group)));
82 82
 }
83
-else{
84
-	OC_JSON::error(array("data" => array( "message" => $error )));
83
+else {
84
+	OC_JSON::error(array("data" => array("message" => $error)));
85 85
 }
Please login to merge, or discard this patch.
settings/ajax/setquota.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -32,38 +32,38 @@
 block discarded – undo
32 32
 OC_JSON::checkSubAdminUser();
33 33
 OCP\JSON::callCheck();
34 34
 
35
-$username = isset($_POST["username"]) ? (string)$_POST["username"] : '';
35
+$username = isset($_POST["username"]) ? (string) $_POST["username"] : '';
36 36
 
37 37
 $isUserAccessible = false;
38 38
 $currentUserObject = \OC::$server->getUserSession()->getUser();
39 39
 $targetUserObject = \OC::$server->getUserManager()->get($username);
40
-if($targetUserObject !== null && $currentUserObject !== null) {
40
+if ($targetUserObject !== null && $currentUserObject !== null) {
41 41
 	$isUserAccessible = \OC::$server->getGroupManager()->getSubAdmin()->isUserAccessible($currentUserObject, $targetUserObject);
42 42
 }
43 43
 
44
-if(($username === '' && !OC_User::isAdminUser(OC_User::getUser()))
44
+if (($username === '' && !OC_User::isAdminUser(OC_User::getUser()))
45 45
 	|| (!OC_User::isAdminUser(OC_User::getUser())
46 46
 		&& !$isUserAccessible)) {
47 47
 	$l = \OC::$server->getL10N('core');
48
-	OC_JSON::error(array( 'data' => array( 'message' => $l->t('Authentication error') )));
48
+	OC_JSON::error(array('data' => array('message' => $l->t('Authentication error'))));
49 49
 	exit();
50 50
 }
51 51
 
52 52
 //make sure the quota is in the expected format
53
-$quota= (string)$_POST["quota"];
54
-if($quota !== 'none' and $quota !== 'default') {
55
-	$quota= OC_Helper::computerFileSize($quota);
56
-	$quota=OC_Helper::humanFileSize($quota);
53
+$quota = (string) $_POST["quota"];
54
+if ($quota !== 'none' and $quota !== 'default') {
55
+	$quota = OC_Helper::computerFileSize($quota);
56
+	$quota = OC_Helper::humanFileSize($quota);
57 57
 }
58 58
 
59 59
 // Return Success story
60
-if($username) {
60
+if ($username) {
61 61
 	$targetUserObject->setQuota($quota);
62
-}else{//set the default quota when no username is specified
63
-	if($quota === 'default') {//'default' as default quota makes no sense
64
-		$quota='none';
62
+} else {//set the default quota when no username is specified
63
+	if ($quota === 'default') {//'default' as default quota makes no sense
64
+		$quota = 'none';
65 65
 	}
66 66
 	\OC::$server->getAppConfig()->setValue('files', 'default_quota', $quota);
67 67
 }
68
-OC_JSON::success(array("data" => array( "username" => $username , 'quota' => $quota)));
68
+OC_JSON::success(array("data" => array("username" => $username, 'quota' => $quota)));
69 69
 
Please login to merge, or discard this patch.
settings/ajax/installapp.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -29,16 +29,16 @@
 block discarded – undo
29 29
 	exit;
30 30
 }
31 31
 
32
-$appId = (string)$_POST['appid'];
32
+$appId = (string) $_POST['appid'];
33 33
 $appId = OC_App::cleanAppId($appId);
34 34
 
35 35
 $result = OC_App::installApp($appId);
36
-if($result !== false) {
36
+if ($result !== false) {
37 37
 	// FIXME: Clear the cache - move that into some sane helper method
38 38
 	\OC::$server->getMemCacheFactory()->create('settings')->remove('listApps-0');
39 39
 	\OC::$server->getMemCacheFactory()->create('settings')->remove('listApps-1');
40 40
 	OC_JSON::success(array('data' => array('appid' => $appId)));
41 41
 } else {
42 42
 	$l = \OC::$server->getL10N('settings');
43
-	OC_JSON::error(array("data" => array( "message" => $l->t("Couldn't remove app.") )));
43
+	OC_JSON::error(array("data" => array("message" => $l->t("Couldn't remove app."))));
44 44
 }
Please login to merge, or discard this patch.
settings/ajax/uninstallapp.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -29,16 +29,16 @@
 block discarded – undo
29 29
 	exit;
30 30
 }
31 31
 
32
-$appId = (string)$_POST['appid'];
32
+$appId = (string) $_POST['appid'];
33 33
 $appId = OC_App::cleanAppId($appId);
34 34
 
35 35
 $result = OC_App::removeApp($appId);
36
-if($result !== false) {
36
+if ($result !== false) {
37 37
 	// FIXME: Clear the cache - move that into some sane helper method
38 38
 	\OC::$server->getMemCacheFactory()->create('settings')->remove('listApps-0');
39 39
 	\OC::$server->getMemCacheFactory()->create('settings')->remove('listApps-1');
40 40
 	OC_JSON::success(array('data' => array('appid' => $appId)));
41 41
 } else {
42 42
 	$l = \OC::$server->getL10N('settings');
43
-	OC_JSON::error(array("data" => array( "message" => $l->t("Couldn't remove app.") )));
43
+	OC_JSON::error(array("data" => array("message" => $l->t("Couldn't remove app."))));
44 44
 }
Please login to merge, or discard this patch.
status.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,13 +29,13 @@
 block discarded – undo
29 29
 
30 30
 try {
31 31
 
32
-	require_once __DIR__ . '/lib/base.php';
32
+	require_once __DIR__.'/lib/base.php';
33 33
 
34 34
 	$systemConfig = \OC::$server->getSystemConfig();
35 35
 
36 36
 	$installed = (bool) $systemConfig->getValue('installed', false);
37 37
 	$maintenance = (bool) $systemConfig->getValue('maintenance', false);
38
-	$values=array(
38
+	$values = array(
39 39
 		'installed'=>$installed,
40 40
 		'maintenance' => $maintenance,
41 41
 		'version'=>implode('.', \OCP\Util::getVersion()),
Please login to merge, or discard this patch.