@@ -25,8 +25,8 @@ |
||
25 | 25 | OCP\JSON::callCheck(); |
26 | 26 | |
27 | 27 | if (!array_key_exists('appid', $_POST)) { |
28 | - OC_JSON::error(); |
|
29 | - exit; |
|
28 | + OC_JSON::error(); |
|
29 | + exit; |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | $appId = (string)$_POST['appid']; |
@@ -31,10 +31,10 @@ |
||
31 | 31 | $groups = isset($_POST['groups']) ? (array)$_POST['groups'] : null; |
32 | 32 | |
33 | 33 | try { |
34 | - $app = OC_App::cleanAppId((string)$_POST['appid']); |
|
35 | - OC_App::enable($app, $groups); |
|
36 | - OC_JSON::success(['data' => ['update_required' => \OC_App::shouldUpgrade($app)]]); |
|
34 | + $app = OC_App::cleanAppId((string)$_POST['appid']); |
|
35 | + OC_App::enable($app, $groups); |
|
36 | + OC_JSON::success(['data' => ['update_required' => \OC_App::shouldUpgrade($app)]]); |
|
37 | 37 | } catch (Exception $e) { |
38 | - \OCP\Util::writeLog('core', $e->getMessage(), \OCP\Util::ERROR); |
|
39 | - OC_JSON::error(array("data" => array("message" => $e->getMessage()) )); |
|
38 | + \OCP\Util::writeLog('core', $e->getMessage(), \OCP\Util::ERROR); |
|
39 | + OC_JSON::error(array("data" => array("message" => $e->getMessage()) )); |
|
40 | 40 | } |
@@ -33,9 +33,9 @@ discard block |
||
33 | 33 | $group = (string)$_POST['group']; |
34 | 34 | |
35 | 35 | if($username === OC_User::getUser() && $group === "admin" && OC_User::isAdminUser($username)) { |
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')))); |
|
38 | - exit(); |
|
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')))); |
|
38 | + exit(); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | $isUserAccessible = false; |
@@ -44,20 +44,20 @@ discard block |
||
44 | 44 | $targetUserObject = \OC::$server->getUserManager()->get($username); |
45 | 45 | $targetGroupObject = \OC::$server->getGroupManager()->get($group); |
46 | 46 | if($targetUserObject !== null && $currentUserObject !== null && $targetGroupObject !== null) { |
47 | - $isUserAccessible = \OC::$server->getGroupManager()->getSubAdmin()->isUserAccessible($currentUserObject, $targetUserObject); |
|
48 | - $isGroupAccessible = \OC::$server->getGroupManager()->getSubAdmin()->isSubAdminofGroup($currentUserObject, $targetGroupObject); |
|
47 | + $isUserAccessible = \OC::$server->getGroupManager()->getSubAdmin()->isUserAccessible($currentUserObject, $targetUserObject); |
|
48 | + $isGroupAccessible = \OC::$server->getGroupManager()->getSubAdmin()->isSubAdminofGroup($currentUserObject, $targetGroupObject); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | if(!OC_User::isAdminUser(OC_User::getUser()) |
52 | - && (!$isUserAccessible |
|
53 | - || !$isGroupAccessible)) { |
|
54 | - $l = \OC::$server->getL10N('core'); |
|
55 | - OC_JSON::error(array( 'data' => array( 'message' => $l->t('Authentication error') ))); |
|
56 | - exit(); |
|
52 | + && (!$isUserAccessible |
|
53 | + || !$isGroupAccessible)) { |
|
54 | + $l = \OC::$server->getL10N('core'); |
|
55 | + OC_JSON::error(array( 'data' => array( 'message' => $l->t('Authentication error') ))); |
|
56 | + exit(); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | if(!OC_Group::groupExists($group)) { |
60 | - OC_Group::createGroup($group); |
|
60 | + OC_Group::createGroup($group); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | $l = \OC::$server->getL10N('settings'); |
@@ -67,19 +67,19 @@ discard block |
||
67 | 67 | |
68 | 68 | // Toggle group |
69 | 69 | if( OC_Group::inGroup( $username, $group )) { |
70 | - $action = "remove"; |
|
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); |
|
70 | + $action = "remove"; |
|
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); |
|
74 | 74 | } |
75 | 75 | else{ |
76 | - $success = OC_Group::addToGroup( $username, $group ); |
|
76 | + $success = OC_Group::addToGroup( $username, $group ); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | // Return Success story |
80 | 80 | if( $success ) { |
81 | - OC_JSON::success(array("data" => array( "username" => $username, "action" => $action, "groupname" => $group ))); |
|
81 | + OC_JSON::success(array("data" => array( "username" => $username, "action" => $action, "groupname" => $group ))); |
|
82 | 82 | } |
83 | 83 | else{ |
84 | - OC_JSON::error(array("data" => array( "message" => $error ))); |
|
84 | + OC_JSON::error(array("data" => array( "message" => $error ))); |
|
85 | 85 | } |
@@ -38,32 +38,32 @@ |
||
38 | 38 | $currentUserObject = \OC::$server->getUserSession()->getUser(); |
39 | 39 | $targetUserObject = \OC::$server->getUserManager()->get($username); |
40 | 40 | if($targetUserObject !== null && $currentUserObject !== null) { |
41 | - $isUserAccessible = \OC::$server->getGroupManager()->getSubAdmin()->isUserAccessible($currentUserObject, $targetUserObject); |
|
41 | + $isUserAccessible = \OC::$server->getGroupManager()->getSubAdmin()->isUserAccessible($currentUserObject, $targetUserObject); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | if(($username === '' && !OC_User::isAdminUser(OC_User::getUser())) |
45 | - || (!OC_User::isAdminUser(OC_User::getUser()) |
|
46 | - && !$isUserAccessible)) { |
|
47 | - $l = \OC::$server->getL10N('core'); |
|
48 | - OC_JSON::error(array( 'data' => array( 'message' => $l->t('Authentication error') ))); |
|
49 | - exit(); |
|
45 | + || (!OC_User::isAdminUser(OC_User::getUser()) |
|
46 | + && !$isUserAccessible)) { |
|
47 | + $l = \OC::$server->getL10N('core'); |
|
48 | + OC_JSON::error(array( 'data' => array( 'message' => $l->t('Authentication error') ))); |
|
49 | + exit(); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | //make sure the quota is in the expected format |
53 | 53 | $quota= (string)$_POST["quota"]; |
54 | 54 | if($quota !== 'none' and $quota !== 'default') { |
55 | - $quota= OC_Helper::computerFileSize($quota); |
|
56 | - $quota=OC_Helper::humanFileSize($quota); |
|
55 | + $quota= OC_Helper::computerFileSize($quota); |
|
56 | + $quota=OC_Helper::humanFileSize($quota); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | // Return Success story |
60 | 60 | if($username) { |
61 | - $targetUserObject->setQuota($quota); |
|
61 | + $targetUserObject->setQuota($quota); |
|
62 | 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 | - } |
|
66 | - \OC::$server->getAppConfig()->setValue('files', 'default_quota', $quota); |
|
63 | + if($quota === 'default') {//'default' as default quota makes no sense |
|
64 | + $quota='none'; |
|
65 | + } |
|
66 | + \OC::$server->getAppConfig()->setValue('files', 'default_quota', $quota); |
|
67 | 67 | } |
68 | 68 | OC_JSON::success(array("data" => array( "username" => $username , 'quota' => $quota))); |
69 | 69 |
@@ -25,8 +25,8 @@ discard block |
||
25 | 25 | OCP\JSON::callCheck(); |
26 | 26 | |
27 | 27 | if (!array_key_exists('appid', $_POST)) { |
28 | - OC_JSON::error(); |
|
29 | - exit; |
|
28 | + OC_JSON::error(); |
|
29 | + exit; |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | $appId = (string)$_POST['appid']; |
@@ -34,11 +34,11 @@ discard block |
||
34 | 34 | |
35 | 35 | $result = OC_App::installApp($appId); |
36 | 36 | if($result !== false) { |
37 | - // FIXME: Clear the cache - move that into some sane helper method |
|
38 | - \OC::$server->getMemCacheFactory()->create('settings')->remove('listApps-0'); |
|
39 | - \OC::$server->getMemCacheFactory()->create('settings')->remove('listApps-1'); |
|
40 | - OC_JSON::success(array('data' => array('appid' => $appId))); |
|
37 | + // FIXME: Clear the cache - move that into some sane helper method |
|
38 | + \OC::$server->getMemCacheFactory()->create('settings')->remove('listApps-0'); |
|
39 | + \OC::$server->getMemCacheFactory()->create('settings')->remove('listApps-1'); |
|
40 | + OC_JSON::success(array('data' => array('appid' => $appId))); |
|
41 | 41 | } else { |
42 | - $l = \OC::$server->getL10N('settings'); |
|
43 | - OC_JSON::error(array("data" => array( "message" => $l->t("Couldn't remove app.") ))); |
|
42 | + $l = \OC::$server->getL10N('settings'); |
|
43 | + OC_JSON::error(array("data" => array( "message" => $l->t("Couldn't remove app.") ))); |
|
44 | 44 | } |
@@ -25,8 +25,8 @@ discard block |
||
25 | 25 | OCP\JSON::callCheck(); |
26 | 26 | |
27 | 27 | if (!array_key_exists('appid', $_POST)) { |
28 | - OC_JSON::error(); |
|
29 | - exit; |
|
28 | + OC_JSON::error(); |
|
29 | + exit; |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | $appId = (string)$_POST['appid']; |
@@ -34,11 +34,11 @@ discard block |
||
34 | 34 | |
35 | 35 | $result = OC_App::removeApp($appId); |
36 | 36 | if($result !== false) { |
37 | - // FIXME: Clear the cache - move that into some sane helper method |
|
38 | - \OC::$server->getMemCacheFactory()->create('settings')->remove('listApps-0'); |
|
39 | - \OC::$server->getMemCacheFactory()->create('settings')->remove('listApps-1'); |
|
40 | - OC_JSON::success(array('data' => array('appid' => $appId))); |
|
37 | + // FIXME: Clear the cache - move that into some sane helper method |
|
38 | + \OC::$server->getMemCacheFactory()->create('settings')->remove('listApps-0'); |
|
39 | + \OC::$server->getMemCacheFactory()->create('settings')->remove('listApps-1'); |
|
40 | + OC_JSON::success(array('data' => array('appid' => $appId))); |
|
41 | 41 | } else { |
42 | - $l = \OC::$server->getL10N('settings'); |
|
43 | - OC_JSON::error(array("data" => array( "message" => $l->t("Couldn't remove app.") ))); |
|
42 | + $l = \OC::$server->getL10N('settings'); |
|
43 | + OC_JSON::error(array("data" => array( "message" => $l->t("Couldn't remove app.") ))); |
|
44 | 44 | } |
@@ -29,27 +29,27 @@ |
||
29 | 29 | |
30 | 30 | try { |
31 | 31 | |
32 | - require_once __DIR__ . '/lib/base.php'; |
|
32 | + require_once __DIR__ . '/lib/base.php'; |
|
33 | 33 | |
34 | - $systemConfig = \OC::$server->getSystemConfig(); |
|
34 | + $systemConfig = \OC::$server->getSystemConfig(); |
|
35 | 35 | |
36 | - $installed = (bool) $systemConfig->getValue('installed', false); |
|
37 | - $maintenance = (bool) $systemConfig->getValue('maintenance', false); |
|
38 | - $values=array( |
|
39 | - 'installed'=>$installed, |
|
40 | - 'maintenance' => $maintenance, |
|
41 | - 'version'=>implode('.', \OCP\Util::getVersion()), |
|
42 | - 'versionstring'=>OC_Util::getVersionString(), |
|
43 | - 'edition'=> $installed ? OC_Util::getEditionString() : ''); |
|
44 | - if (OC::$CLI) { |
|
45 | - print_r($values); |
|
46 | - } else { |
|
47 | - header('Access-Control-Allow-Origin: *'); |
|
48 | - header('Content-Type: application/json'); |
|
49 | - echo json_encode($values); |
|
50 | - } |
|
36 | + $installed = (bool) $systemConfig->getValue('installed', false); |
|
37 | + $maintenance = (bool) $systemConfig->getValue('maintenance', false); |
|
38 | + $values=array( |
|
39 | + 'installed'=>$installed, |
|
40 | + 'maintenance' => $maintenance, |
|
41 | + 'version'=>implode('.', \OCP\Util::getVersion()), |
|
42 | + 'versionstring'=>OC_Util::getVersionString(), |
|
43 | + 'edition'=> $installed ? OC_Util::getEditionString() : ''); |
|
44 | + if (OC::$CLI) { |
|
45 | + print_r($values); |
|
46 | + } else { |
|
47 | + header('Access-Control-Allow-Origin: *'); |
|
48 | + header('Content-Type: application/json'); |
|
49 | + echo json_encode($values); |
|
50 | + } |
|
51 | 51 | |
52 | 52 | } catch (Exception $ex) { |
53 | - OC_Response::setStatus(OC_Response::STATUS_INTERNAL_SERVER_ERROR); |
|
54 | - \OCP\Util::writeLog('remote', $ex->getMessage(), \OCP\Util::FATAL); |
|
53 | + OC_Response::setStatus(OC_Response::STATUS_INTERNAL_SERVER_ERROR); |
|
54 | + \OCP\Util::writeLog('remote', $ex->getMessage(), \OCP\Util::FATAL); |
|
55 | 55 | } |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | - /** @var array $_ */ |
|
3 | - /** @var OC_L10N $l */ |
|
2 | + /** @var array $_ */ |
|
3 | + /** @var OC_L10N $l */ |
|
4 | 4 | |
5 | 5 | style('core', ['styles', 'header']); |
6 | 6 | ?> |
@@ -27,61 +27,61 @@ |
||
27 | 27 | */ |
28 | 28 | try { |
29 | 29 | |
30 | - require_once __DIR__ . '/lib/base.php'; |
|
31 | - if (\OCP\Util::needUpgrade()) { |
|
32 | - // since the behavior of apps or remotes are unpredictable during |
|
33 | - // an upgrade, return a 503 directly |
|
34 | - OC_Response::setStatus(OC_Response::STATUS_SERVICE_UNAVAILABLE); |
|
35 | - OC_Template::printErrorPage('Service unavailable'); |
|
36 | - exit; |
|
37 | - } |
|
30 | + require_once __DIR__ . '/lib/base.php'; |
|
31 | + if (\OCP\Util::needUpgrade()) { |
|
32 | + // since the behavior of apps or remotes are unpredictable during |
|
33 | + // an upgrade, return a 503 directly |
|
34 | + OC_Response::setStatus(OC_Response::STATUS_SERVICE_UNAVAILABLE); |
|
35 | + OC_Template::printErrorPage('Service unavailable'); |
|
36 | + exit; |
|
37 | + } |
|
38 | 38 | |
39 | - OC::checkMaintenanceMode(); |
|
40 | - OC::checkSingleUserMode(true); |
|
41 | - $request = \OC::$server->getRequest(); |
|
42 | - $pathInfo = $request->getPathInfo(); |
|
39 | + OC::checkMaintenanceMode(); |
|
40 | + OC::checkSingleUserMode(true); |
|
41 | + $request = \OC::$server->getRequest(); |
|
42 | + $pathInfo = $request->getPathInfo(); |
|
43 | 43 | |
44 | - if (!$pathInfo && $request->getParam('service', '') === '') { |
|
45 | - header('HTTP/1.0 404 Not Found'); |
|
46 | - exit; |
|
47 | - } elseif ($request->getParam('service', '')) { |
|
48 | - $service = $request->getParam('service', ''); |
|
49 | - } else { |
|
50 | - $pathInfo = trim($pathInfo, '/'); |
|
51 | - list($service) = explode('/', $pathInfo); |
|
52 | - } |
|
53 | - $file = OCP\CONFIG::getAppValue('core', 'public_' . strip_tags($service)); |
|
54 | - if (is_null($file)) { |
|
55 | - header('HTTP/1.0 404 Not Found'); |
|
56 | - exit; |
|
57 | - } |
|
44 | + if (!$pathInfo && $request->getParam('service', '') === '') { |
|
45 | + header('HTTP/1.0 404 Not Found'); |
|
46 | + exit; |
|
47 | + } elseif ($request->getParam('service', '')) { |
|
48 | + $service = $request->getParam('service', ''); |
|
49 | + } else { |
|
50 | + $pathInfo = trim($pathInfo, '/'); |
|
51 | + list($service) = explode('/', $pathInfo); |
|
52 | + } |
|
53 | + $file = OCP\CONFIG::getAppValue('core', 'public_' . strip_tags($service)); |
|
54 | + if (is_null($file)) { |
|
55 | + header('HTTP/1.0 404 Not Found'); |
|
56 | + exit; |
|
57 | + } |
|
58 | 58 | |
59 | - $parts = explode('/', $file, 2); |
|
60 | - $app = $parts[0]; |
|
59 | + $parts = explode('/', $file, 2); |
|
60 | + $app = $parts[0]; |
|
61 | 61 | |
62 | - // Load all required applications |
|
63 | - \OC::$REQUESTEDAPP = $app; |
|
64 | - OC_App::loadApps(array('authentication')); |
|
65 | - OC_App::loadApps(array('filesystem', 'logging')); |
|
62 | + // Load all required applications |
|
63 | + \OC::$REQUESTEDAPP = $app; |
|
64 | + OC_App::loadApps(array('authentication')); |
|
65 | + OC_App::loadApps(array('filesystem', 'logging')); |
|
66 | 66 | |
67 | - if (!\OC::$server->getAppManager()->isInstalled($app)) { |
|
68 | - throw new Exception('App not installed: ' . $app); |
|
69 | - } |
|
70 | - OC_App::loadApp($app); |
|
71 | - OC_User::setIncognitoMode(true); |
|
67 | + if (!\OC::$server->getAppManager()->isInstalled($app)) { |
|
68 | + throw new Exception('App not installed: ' . $app); |
|
69 | + } |
|
70 | + OC_App::loadApp($app); |
|
71 | + OC_User::setIncognitoMode(true); |
|
72 | 72 | |
73 | - $baseuri = OC::$WEBROOT . '/public.php/' . $service . '/'; |
|
73 | + $baseuri = OC::$WEBROOT . '/public.php/' . $service . '/'; |
|
74 | 74 | |
75 | - require_once OC_App::getAppPath($app) . '/' . $parts[1]; |
|
75 | + require_once OC_App::getAppPath($app) . '/' . $parts[1]; |
|
76 | 76 | |
77 | 77 | } catch (\OC\ServiceUnavailableException $ex) { |
78 | - //show the user a detailed error page |
|
79 | - OC_Response::setStatus(OC_Response::STATUS_SERVICE_UNAVAILABLE); |
|
80 | - \OCP\Util::writeLog('remote', $ex->getMessage(), \OCP\Util::FATAL); |
|
81 | - OC_Template::printExceptionErrorPage($ex); |
|
78 | + //show the user a detailed error page |
|
79 | + OC_Response::setStatus(OC_Response::STATUS_SERVICE_UNAVAILABLE); |
|
80 | + \OCP\Util::writeLog('remote', $ex->getMessage(), \OCP\Util::FATAL); |
|
81 | + OC_Template::printExceptionErrorPage($ex); |
|
82 | 82 | } catch (Exception $ex) { |
83 | - //show the user a detailed error page |
|
84 | - OC_Response::setStatus(OC_Response::STATUS_INTERNAL_SERVER_ERROR); |
|
85 | - \OCP\Util::writeLog('remote', $ex->getMessage(), \OCP\Util::FATAL); |
|
86 | - OC_Template::printExceptionErrorPage($ex); |
|
83 | + //show the user a detailed error page |
|
84 | + OC_Response::setStatus(OC_Response::STATUS_INTERNAL_SERVER_ERROR); |
|
85 | + \OCP\Util::writeLog('remote', $ex->getMessage(), \OCP\Util::FATAL); |
|
86 | + OC_Template::printExceptionErrorPage($ex); |
|
87 | 87 | } |