aboutsummaryrefslogtreecommitdiffstats
path: root/settings/ajax
diff options
context:
space:
mode:
Diffstat (limited to 'settings/ajax')
-rw-r--r--settings/ajax/disableapp.php35
-rw-r--r--settings/ajax/enableapp.php39
-rw-r--r--settings/ajax/installapp.php43
-rw-r--r--settings/ajax/navigationdetect.php27
-rw-r--r--settings/ajax/setlanguage.php45
-rw-r--r--settings/ajax/setquota.php68
-rw-r--r--settings/ajax/togglegroups.php84
-rw-r--r--settings/ajax/togglesubadmins.php45
-rw-r--r--settings/ajax/uninstallapp.php43
-rw-r--r--settings/ajax/updateapp.php66
10 files changed, 0 insertions, 495 deletions
diff --git a/settings/ajax/disableapp.php b/settings/ajax/disableapp.php
deleted file mode 100644
index 5d86168287b..00000000000
--- a/settings/ajax/disableapp.php
+++ /dev/null
@@ -1,35 +0,0 @@
-<?php
-/**
- * @author Georg Ehrke <georg@owncloud.com>
- * @author Kamil Domanski <kdomanski@kdemail.net>
- * @author Lukas Reschke <lukas@owncloud.com>
- *
- * @copyright Copyright (c) 2016, ownCloud, Inc.
- * @license AGPL-3.0
- *
- * This code is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License, version 3,
- * along with this program. If not, see <http://www.gnu.org/licenses/>
- *
- */
-OCP\JSON::checkAdminUser();
-OCP\JSON::callCheck();
-
-if (!array_key_exists('appid', $_POST)) {
- OC_JSON::error();
- exit;
-}
-
-$appId = (string)$_POST['appid'];
-$appId = OC_App::cleanAppId($appId);
-
-OC_App::disable($appId);
-OC_JSON::success();
diff --git a/settings/ajax/enableapp.php b/settings/ajax/enableapp.php
deleted file mode 100644
index 57b6e919995..00000000000
--- a/settings/ajax/enableapp.php
+++ /dev/null
@@ -1,39 +0,0 @@
-<?php
-/**
- * @author Bart Visscher <bartv@thisnet.nl>
- * @author Christopher Schäpers <kondou@ts.unde.re>
- * @author Joas Schilling <nickvergessen@owncloud.com>
- * @author Kamil Domanski <kdomanski@kdemail.net>
- * @author Lukas Reschke <lukas@owncloud.com>
- * @author Robin Appelman <icewind@owncloud.com>
- * @author Thomas Müller <thomas.mueller@tmit.eu>
- *
- * @copyright Copyright (c) 2016, ownCloud, Inc.
- * @license AGPL-3.0
- *
- * This code is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License, version 3,
- * along with this program. If not, see <http://www.gnu.org/licenses/>
- *
- */
-OC_JSON::checkAdminUser();
-OCP\JSON::callCheck();
-
-$groups = isset($_POST['groups']) ? (array)$_POST['groups'] : null;
-
-try {
- $app = OC_App::cleanAppId((string)$_POST['appid']);
- OC_App::enable($app, $groups);
- OC_JSON::success(['data' => ['update_required' => \OC_App::shouldUpgrade($app)]]);
-} catch (Exception $e) {
- \OCP\Util::writeLog('core', $e->getMessage(), \OCP\Util::ERROR);
- OC_JSON::error(array("data" => array("message" => $e->getMessage()) ));
-}
diff --git a/settings/ajax/installapp.php b/settings/ajax/installapp.php
deleted file mode 100644
index 96f5ad9d91c..00000000000
--- a/settings/ajax/installapp.php
+++ /dev/null
@@ -1,43 +0,0 @@
-<?php
-/**
- * @author Georg Ehrke <georg@owncloud.com>
- * @author Lukas Reschke <lukas@owncloud.com>
- * @author Robin Appelman <icewind@owncloud.com>
- *
- * @copyright Copyright (c) 2016, ownCloud, Inc.
- * @license AGPL-3.0
- *
- * This code is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License, version 3,
- * along with this program. If not, see <http://www.gnu.org/licenses/>
- *
- */
-OCP\JSON::checkAdminUser();
-OCP\JSON::callCheck();
-
-if (!array_key_exists('appid', $_POST)) {
- OC_JSON::error();
- exit;
-}
-
-$appId = (string)$_POST['appid'];
-$appId = OC_App::cleanAppId($appId);
-
-$result = OC_App::installApp($appId);
-if($result !== false) {
- // FIXME: Clear the cache - move that into some sane helper method
- \OC::$server->getMemCacheFactory()->create('settings')->remove('listApps-0');
- \OC::$server->getMemCacheFactory()->create('settings')->remove('listApps-1');
- OC_JSON::success(array('data' => array('appid' => $appId)));
-} else {
- $l = \OC::$server->getL10N('settings');
- OC_JSON::error(array("data" => array( "message" => $l->t("Couldn't remove app.") )));
-}
diff --git a/settings/ajax/navigationdetect.php b/settings/ajax/navigationdetect.php
deleted file mode 100644
index 61ec93a79b5..00000000000
--- a/settings/ajax/navigationdetect.php
+++ /dev/null
@@ -1,27 +0,0 @@
-<?php
-/**
- * @author Robin Appelman <icewind@owncloud.com>
- * @author Robin McCorkell <robin@mccorkell.me.uk>
- *
- * @copyright Copyright (c) 2016, ownCloud, Inc.
- * @license AGPL-3.0
- *
- * This code is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License, version 3,
- * along with this program. If not, see <http://www.gnu.org/licenses/>
- *
- */
-OC_Util::checkAdminUser();
-OCP\JSON::callCheck();
-
-$navigation = \OC_App::getNavigation();
-
-OCP\JSON::success(['nav_entries' => $navigation]);
diff --git a/settings/ajax/setlanguage.php b/settings/ajax/setlanguage.php
deleted file mode 100644
index cf59151ccf1..00000000000
--- a/settings/ajax/setlanguage.php
+++ /dev/null
@@ -1,45 +0,0 @@
-<?php
-/**
- * @author Bart Visscher <bartv@thisnet.nl>
- * @author Christopher Schäpers <kondou@ts.unde.re>
- * @author Joas Schilling <nickvergessen@owncloud.com>
- * @author Lukas Reschke <lukas@owncloud.com>
- * @author Morris Jobke <hey@morrisjobke.de>
- * @author Robin Appelman <icewind@owncloud.com>
- * @author Thomas Müller <thomas.mueller@tmit.eu>
- *
- * @copyright Copyright (c) 2016, ownCloud, Inc.
- * @license AGPL-3.0
- *
- * This code is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License, version 3,
- * along with this program. If not, see <http://www.gnu.org/licenses/>
- *
- */
-$l = \OC::$server->getL10N('settings');
-
-OC_JSON::checkLoggedIn();
-OCP\JSON::callCheck();
-
-
-// Get data
-if( isset( $_POST['lang'] ) ) {
- $languageCodes = \OC::$server->getL10NFactory()->findAvailableLanguages();
- $lang = (string)$_POST['lang'];
- if(array_search($lang, $languageCodes) or $lang === 'en') {
- \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") )));
- }
-}else{
- OC_JSON::error(array("data" => array( "message" => $l->t("Invalid request") )));
-}
diff --git a/settings/ajax/setquota.php b/settings/ajax/setquota.php
deleted file mode 100644
index 0c974daaeed..00000000000
--- a/settings/ajax/setquota.php
+++ /dev/null
@@ -1,68 +0,0 @@
-<?php
-/**
- * @author Arthur Schiwon <blizzz@owncloud.com>
- * @author Bart Visscher <bartv@thisnet.nl>
- * @author Björn Schießle <schiessle@owncloud.com>
- * @author Christopher Schäpers <kondou@ts.unde.re>
- * @author Felix Moeller <mail@felixmoeller.de>
- * @author Georg Ehrke <georg@owncloud.com>
- * @author Lukas Reschke <lukas@owncloud.com>
- * @author Morris Jobke <hey@morrisjobke.de>
- * @author Robin Appelman <icewind@owncloud.com>
- * @author Thomas Müller <thomas.mueller@tmit.eu>
- *
- * @copyright Copyright (c) 2016, ownCloud, Inc.
- * @license AGPL-3.0
- *
- * This code is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License, version 3,
- * along with this program. If not, see <http://www.gnu.org/licenses/>
- *
- */
-
-OC_JSON::checkSubAdminUser();
-OCP\JSON::callCheck();
-
-$username = isset($_POST["username"]) ? (string)$_POST["username"] : '';
-
-$isUserAccessible = false;
-$currentUserObject = \OC::$server->getUserSession()->getUser();
-$targetUserObject = \OC::$server->getUserManager()->get($username);
-if($targetUserObject !== null && $currentUserObject !== null) {
- $isUserAccessible = \OC::$server->getGroupManager()->getSubAdmin()->isUserAccessible($currentUserObject, $targetUserObject);
-}
-
-if(($username === '' && !OC_User::isAdminUser(OC_User::getUser()))
- || (!OC_User::isAdminUser(OC_User::getUser())
- && !$isUserAccessible)) {
- $l = \OC::$server->getL10N('core');
- OC_JSON::error(array( 'data' => array( 'message' => $l->t('Authentication error') )));
- exit();
-}
-
-//make sure the quota is in the expected format
-$quota= (string)$_POST["quota"];
-if($quota !== 'none' and $quota !== 'default') {
- $quota= OC_Helper::computerFileSize($quota);
- $quota=OC_Helper::humanFileSize($quota);
-}
-
-// Return Success story
-if($username) {
- $targetUserObject->setQuota($quota);
-}else{//set the default quota when no username is specified
- if($quota === 'default') {//'default' as default quota makes no sense
- $quota='none';
- }
- \OC::$server->getAppConfig()->setValue('files', 'default_quota', $quota);
-}
-OC_JSON::success(array("data" => array( "username" => $username , 'quota' => $quota)));
-
diff --git a/settings/ajax/togglegroups.php b/settings/ajax/togglegroups.php
deleted file mode 100644
index 8cf51ab707f..00000000000
--- a/settings/ajax/togglegroups.php
+++ /dev/null
@@ -1,84 +0,0 @@
-<?php
-/**
- * @author Bart Visscher <bartv@thisnet.nl>
- * @author Christopher Schäpers <kondou@ts.unde.re>
- * @author Georg Ehrke <georg@owncloud.com>
- * @author Jakob Sack <mail@jakobsack.de>
- * @author Lukas Reschke <lukas@owncloud.com>
- * @author Robin Appelman <icewind@owncloud.com>
- * @author Thomas Müller <thomas.mueller@tmit.eu>
- *
- * @copyright Copyright (c) 2016, ownCloud, Inc.
- * @license AGPL-3.0
- *
- * This code is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License, version 3,
- * along with this program. If not, see <http://www.gnu.org/licenses/>
- *
- */
-OC_JSON::checkSubAdminUser();
-OCP\JSON::callCheck();
-
-$success = true;
-$username = (string)$_POST['username'];
-$group = (string)$_POST['group'];
-
-if($username === OC_User::getUser() && $group === "admin" && OC_User::isAdminUser($username)) {
- $l = \OC::$server->getL10N('core');
- OC_JSON::error(array( 'data' => array( 'message' => $l->t('Admins can\'t remove themself from the admin group'))));
- exit();
-}
-
-$isUserAccessible = false;
-$isGroupAccessible = false;
-$currentUserObject = \OC::$server->getUserSession()->getUser();
-$targetUserObject = \OC::$server->getUserManager()->get($username);
-$targetGroupObject = \OC::$server->getGroupManager()->get($group);
-if($targetUserObject !== null && $currentUserObject !== null && $targetGroupObject !== null) {
- $isUserAccessible = \OC::$server->getGroupManager()->getSubAdmin()->isUserAccessible($currentUserObject, $targetUserObject);
- $isGroupAccessible = \OC::$server->getGroupManager()->getSubAdmin()->isSubAdminofGroup($currentUserObject, $targetGroupObject);
-}
-
-if(!OC_User::isAdminUser(OC_User::getUser())
- && (!$isUserAccessible
- || !$isGroupAccessible)) {
- $l = \OC::$server->getL10N('core');
- OC_JSON::error(array( 'data' => array( 'message' => $l->t('Authentication error') )));
- exit();
-}
-
-if(!OC_Group::groupExists($group)) {
- OC_Group::createGroup($group);
-}
-
-$l = \OC::$server->getL10N('settings');
-
-$error = $l->t("Unable to add user to group %s", $group);
-$action = "add";
-
-// Toggle group
-if( OC_Group::inGroup( $username, $group )) {
- $action = "remove";
- $error = $l->t("Unable to remove user from group %s", $group);
- $success = OC_Group::removeFromGroup( $username, $group );
- $usersInGroup=OC_Group::usersInGroup($group);
-}
-else{
- $success = OC_Group::addToGroup( $username, $group );
-}
-
-// Return Success story
-if( $success ) {
- OC_JSON::success(array("data" => array( "username" => $username, "action" => $action, "groupname" => $group )));
-}
-else{
- OC_JSON::error(array("data" => array( "message" => $error )));
-}
diff --git a/settings/ajax/togglesubadmins.php b/settings/ajax/togglesubadmins.php
deleted file mode 100644
index afeaa1acfa0..00000000000
--- a/settings/ajax/togglesubadmins.php
+++ /dev/null
@@ -1,45 +0,0 @@
-<?php
-/**
- * @author Bart Visscher <bartv@thisnet.nl>
- * @author Georg Ehrke <georg@owncloud.com>
- * @author Lukas Reschke <lukas@owncloud.com>
- *
- * @copyright Copyright (c) 2016, ownCloud, Inc.
- * @license AGPL-3.0
- *
- * This code is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License, version 3,
- * along with this program. If not, see <http://www.gnu.org/licenses/>
- *
- */
-OC_JSON::checkAdminUser();
-OCP\JSON::callCheck();
-
-$username = (string)$_POST['username'];
-$group = (string)$_POST['group'];
-
-$subAdminManager = \OC::$server->getGroupManager()->getSubAdmin();
-$targetUserObject = \OC::$server->getUserManager()->get($username);
-$targetGroupObject = \OC::$server->getGroupManager()->get($group);
-
-$isSubAdminOfGroup = false;
-if($targetUserObject !== null && $targetUserObject !== null) {
- $isSubAdminOfGroup = $subAdminManager->isSubAdminofGroup($targetUserObject, $targetGroupObject);
-}
-
-// Toggle group
-if($isSubAdminOfGroup) {
- $subAdminManager->deleteSubAdmin($targetUserObject, $targetGroupObject);
-} else {
- $subAdminManager->createSubAdmin($targetUserObject, $targetGroupObject);
-}
-
-OC_JSON::success();
diff --git a/settings/ajax/uninstallapp.php b/settings/ajax/uninstallapp.php
deleted file mode 100644
index 7ff20a1c999..00000000000
--- a/settings/ajax/uninstallapp.php
+++ /dev/null
@@ -1,43 +0,0 @@
-<?php
-/**
- * @author Georg Ehrke <georg@owncloud.com>
- * @author Lukas Reschke <lukas@owncloud.com>
- * @author Robin Appelman <icewind@owncloud.com>
- *
- * @copyright Copyright (c) 2016, ownCloud, Inc.
- * @license AGPL-3.0
- *
- * This code is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License, version 3,
- * along with this program. If not, see <http://www.gnu.org/licenses/>
- *
- */
-OCP\JSON::checkAdminUser();
-OCP\JSON::callCheck();
-
-if (!array_key_exists('appid', $_POST)) {
- OC_JSON::error();
- exit;
-}
-
-$appId = (string)$_POST['appid'];
-$appId = OC_App::cleanAppId($appId);
-
-$result = OC_App::removeApp($appId);
-if($result !== false) {
- // FIXME: Clear the cache - move that into some sane helper method
- \OC::$server->getMemCacheFactory()->create('settings')->remove('listApps-0');
- \OC::$server->getMemCacheFactory()->create('settings')->remove('listApps-1');
- OC_JSON::success(array('data' => array('appid' => $appId)));
-} else {
- $l = \OC::$server->getL10N('settings');
- OC_JSON::error(array("data" => array( "message" => $l->t("Couldn't remove app.") )));
-}
diff --git a/settings/ajax/updateapp.php b/settings/ajax/updateapp.php
deleted file mode 100644
index 8521914884f..00000000000
--- a/settings/ajax/updateapp.php
+++ /dev/null
@@ -1,66 +0,0 @@
-<?php
-/**
- * @author Christopher Schäpers <kondou@ts.unde.re>
- * @author Frank Karlitschek <frank@owncloud.org>
- * @author Georg Ehrke <georg@owncloud.com>
- * @author Lukas Reschke <lukas@owncloud.com>
- * @author Robin Appelman <icewind@owncloud.com>
- * @author Thomas Müller <thomas.mueller@tmit.eu>
- *
- * @copyright Copyright (c) 2016, ownCloud, Inc.
- * @license AGPL-3.0
- *
- * This code is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License, version 3,
- * along with this program. If not, see <http://www.gnu.org/licenses/>
- *
- */
-OCP\JSON::checkAdminUser();
-OCP\JSON::callCheck();
-
-if (!array_key_exists('appid', $_POST)) {
- OCP\JSON::error(array(
- 'message' => 'No AppId given!'
- ));
- return;
-}
-
-$appId = (string)$_POST['appid'];
-
-if (!is_numeric($appId)) {
- $appId = \OC::$server->getAppConfig()->getValue($appId, 'ocsid', null);
- if ($appId === null) {
- OCP\JSON::error(array(
- 'message' => 'No OCS-ID found for app!'
- ));
- exit;
- }
-}
-
-$appId = OC_App::cleanAppId($appId);
-
-$config = \OC::$server->getConfig();
-$config->setSystemValue('maintenance', true);
-try {
- $result = OC_Installer::updateAppByOCSId($appId);
- $config->setSystemValue('maintenance', false);
-} catch(Exception $ex) {
- $config->setSystemValue('maintenance', false);
- OC_JSON::error(array("data" => array( "message" => $ex->getMessage() )));
- return;
-}
-
-if($result !== false) {
- OC_JSON::success(array('data' => array('appid' => $appId)));
-} else {
- $l = \OC::$server->getL10N('settings');
- OC_JSON::error(array("data" => array( "message" => $l->t("Couldn't update app.") )));
-}