File manager - Edit - /home/jardides/www/Jardi-design/images/administrator/ajax.tar
Back
update.php 0000604 00000023235 15247115677 0006557 0 ustar 00 <?php /** * @copyright Copyright (c) 2016, ownCloud, Inc. * * @author Björn Schießle <bjoern@schiessle.org> * @author Joas Schilling <coding@schilljs.com> * @author Lukas Reschke <lukas@statuscode.ch> * @author Michael Gapczynski <GapczynskiM@gmail.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <robin@icewind.nl> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Victor Dubiniuk <dubiniuk@owncloud.com> * @author Vincent Petry <pvince81@owncloud.com> * * @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/> * */ use Symfony\Component\EventDispatcher\GenericEvent; if (strpos(@ini_get('disable_functions'), 'set_time_limit') === false) { @set_time_limit(0); } require_once '../../lib/base.php'; $l = \OC::$server->getL10N('core'); $eventSource = \OC::$server->createEventSource(); // need to send an initial message to force-init the event source, // which will then trigger its own CSRF check and produces its own CSRF error // message $eventSource->send('success', (string)$l->t('Preparing update')); class FeedBackHandler { /** @var integer */ private $progressStateMax = 100; /** @var integer */ private $progressStateStep = 0; /** @var string */ private $currentStep; public function __construct(\OCP\IEventSource $eventSource, \OCP\IL10N $l10n) { $this->eventSource = $eventSource; $this->l10n = $l10n; } public function handleRepairFeedback($event) { if (!$event instanceof GenericEvent) { return; } switch ($event->getSubject()) { case '\OC\Repair::startProgress': $this->progressStateMax = $event->getArgument(0); $this->progressStateStep = 0; $this->currentStep = $event->getArgument(1); break; case '\OC\Repair::advance': $this->progressStateStep += $event->getArgument(0); $desc = $event->getArgument(1); if (empty($desc)) { $desc = $this->currentStep; } $this->eventSource->send('success', (string)$this->l10n->t('[%d / %d]: %s', [$this->progressStateStep, $this->progressStateMax, $desc])); break; case '\OC\Repair::finishProgress': $this->progressStateMax = $this->progressStateStep; $this->eventSource->send('success', (string)$this->l10n->t('[%d / %d]: %s', [$this->progressStateStep, $this->progressStateMax, $this->currentStep])); break; case '\OC\Repair::step': break; case '\OC\Repair::info': break; case '\OC\Repair::warning': $this->eventSource->send('notice', (string)$this->l10n->t('Repair warning: ') . $event->getArgument(0)); break; case '\OC\Repair::error': $this->eventSource->send('notice', (string)$this->l10n->t('Repair error: ') . $event->getArgument(0)); break; } } } if (OC::checkUpgrade(false)) { $config = \OC::$server->getSystemConfig(); if ($config->getValue('upgrade.disable-web', false)) { $eventSource->send('failure', (string)$l->t('Please use the command line updater because automatic updating is disabled in the config.php.')); $eventSource->close(); exit(); } // if a user is currently logged in, their session must be ignored to // avoid side effects \OC_User::setIncognitoMode(true); $logger = \OC::$server->getLogger(); $config = \OC::$server->getConfig(); $updater = new \OC\Updater( $config, \OC::$server->getIntegrityCodeChecker(), $logger ); $incompatibleApps = []; $disabledThirdPartyApps = []; $dispatcher = \OC::$server->getEventDispatcher(); $dispatcher->addListener('\OC\DB\Migrator::executeSql', function($event) use ($eventSource, $l) { if ($event instanceof GenericEvent) { $eventSource->send('success', (string)$l->t('[%d / %d]: %s', [$event[0], $event[1], $event->getSubject()])); } }); $dispatcher->addListener('\OC\DB\Migrator::checkTable', function($event) use ($eventSource, $l) { if ($event instanceof GenericEvent) { $eventSource->send('success', (string)$l->t('[%d / %d]: Checking table %s', [$event[0], $event[1], $event->getSubject()])); } }); $feedBack = new FeedBackHandler($eventSource, $l); $dispatcher->addListener('\OC\Repair::startProgress', [$feedBack, 'handleRepairFeedback']); $dispatcher->addListener('\OC\Repair::advance', [$feedBack, 'handleRepairFeedback']); $dispatcher->addListener('\OC\Repair::finishProgress', [$feedBack, 'handleRepairFeedback']); $dispatcher->addListener('\OC\Repair::step', [$feedBack, 'handleRepairFeedback']); $dispatcher->addListener('\OC\Repair::info', [$feedBack, 'handleRepairFeedback']); $dispatcher->addListener('\OC\Repair::warning', [$feedBack, 'handleRepairFeedback']); $dispatcher->addListener('\OC\Repair::error', [$feedBack, 'handleRepairFeedback']); $updater->listen('\OC\Updater', 'maintenanceEnabled', function () use ($eventSource, $l) { $eventSource->send('success', (string)$l->t('Turned on maintenance mode')); }); $updater->listen('\OC\Updater', 'maintenanceDisabled', function () use ($eventSource, $l) { $eventSource->send('success', (string)$l->t('Turned off maintenance mode')); }); $updater->listen('\OC\Updater', 'maintenanceActive', function () use ($eventSource, $l) { $eventSource->send('success', (string)$l->t('Maintenance mode is kept active')); }); $updater->listen('\OC\Updater', 'dbUpgradeBefore', function () use($eventSource, $l) { $eventSource->send('success', (string)$l->t('Updating database schema')); }); $updater->listen('\OC\Updater', 'dbUpgrade', function () use ($eventSource, $l) { $eventSource->send('success', (string)$l->t('Updated database')); }); $updater->listen('\OC\Updater', 'dbSimulateUpgradeBefore', function () use($eventSource, $l) { $eventSource->send('success', (string)$l->t('Checking whether the database schema can be updated (this can take a long time depending on the database size)')); }); $updater->listen('\OC\Updater', 'dbSimulateUpgrade', function () use ($eventSource, $l) { $eventSource->send('success', (string)$l->t('Checked database schema update')); }); $updater->listen('\OC\Updater', 'appUpgradeCheckBefore', function () use ($eventSource, $l) { $eventSource->send('success', (string)$l->t('Checking updates of apps')); }); $updater->listen('\OC\Updater', 'checkAppStoreAppBefore', function ($app) use ($eventSource, $l) { $eventSource->send('success', (string)$l->t('Checking for update of app "%s" in appstore', [$app])); }); $updater->listen('\OC\Updater', 'upgradeAppStoreApp', function ($app) use ($eventSource, $l) { $eventSource->send('success', (string)$l->t('Update app "%s" from appstore', [$app])); }); $updater->listen('\OC\Updater', 'checkAppStoreApp', function ($app) use ($eventSource, $l) { $eventSource->send('success', (string)$l->t('Checked for update of app "%s" in appstore', [$app])); }); $updater->listen('\OC\Updater', 'appSimulateUpdate', function ($app) use ($eventSource, $l) { $eventSource->send('success', (string)$l->t('Checking whether the database schema for %s can be updated (this can take a long time depending on the database size)', [$app])); }); $updater->listen('\OC\Updater', 'appUpgradeCheck', function () use ($eventSource, $l) { $eventSource->send('success', (string)$l->t('Checked database schema update for apps')); }); $updater->listen('\OC\Updater', 'appUpgrade', function ($app, $version) use ($eventSource, $l) { $eventSource->send('success', (string)$l->t('Updated "%s" to %s', array($app, $version))); }); $updater->listen('\OC\Updater', 'incompatibleAppDisabled', function ($app) use (&$incompatibleApps) { $incompatibleApps[]= $app; }); $updater->listen('\OC\Updater', 'thirdPartyAppDisabled', function ($app) use (&$disabledThirdPartyApps) { $disabledThirdPartyApps[]= $app; }); $updater->listen('\OC\Updater', 'failure', function ($message) use ($eventSource, $config) { $eventSource->send('failure', $message); $eventSource->close(); $config->setSystemValue('maintenance', false); }); $updater->listen('\OC\Updater', 'setDebugLogLevel', function ($logLevel, $logLevelName) use($eventSource, $l) { $eventSource->send('success', (string)$l->t('Set log level to debug')); }); $updater->listen('\OC\Updater', 'resetLogLevel', function ($logLevel, $logLevelName) use($eventSource, $l) { $eventSource->send('success', (string)$l->t('Reset log level')); }); $updater->listen('\OC\Updater', 'startCheckCodeIntegrity', function () use($eventSource, $l) { $eventSource->send('success', (string)$l->t('Starting code integrity check')); }); $updater->listen('\OC\Updater', 'finishedCheckCodeIntegrity', function () use($eventSource, $l) { $eventSource->send('success', (string)$l->t('Finished code integrity check')); }); try { $updater->upgrade(); } catch (\Exception $e) { $eventSource->send('failure', get_class($e) . ': ' . $e->getMessage()); $eventSource->close(); exit(); } $disabledApps = []; foreach ($disabledThirdPartyApps as $app) { $disabledApps[$app] = (string) $l->t('%s (3rdparty)', [$app]); } foreach ($incompatibleApps as $app) { $disabledApps[$app] = (string) $l->t('%s (incompatible)', [$app]); } if (!empty($disabledApps)) { $eventSource->send('notice', (string)$l->t('Following apps have been disabled: %s', implode(', ', $disabledApps))); } } else { $eventSource->send('notice', (string)$l->t('Already up to date')); } $eventSource->send('done', ''); $eventSource->close(); navigationdetect.php 0000604 00000001662 15247161164 0010615 0 ustar 00 <?php /** * @copyright Copyright (c) 2016, ownCloud, Inc. * * @author Robin Appelman <robin@icewind.nl> * @author Robin McCorkell <robin@mccorkell.me.uk> * * @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]); uninstallapp.php 0000604 00000003442 15247161164 0007775 0 ustar 00 <?php /** * @copyright Copyright (c) 2016, ownCloud, Inc. * * @author Georg Ehrke <georg@owncloud.com> * @author Lukas Reschke <lukas@statuscode.ch> * @author Robin Appelman <robin@icewind.nl> * * @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(); $lastConfirm = (int) \OC::$server->getSession()->get('last-password-confirm'); if ($lastConfirm < (time() - 30 * 60 + 15)) { // allow 15 seconds delay $l = \OC::$server->getL10N('core'); OC_JSON::error(array( 'data' => array( 'message' => $l->t('Password confirmation is required')))); exit(); } 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.") ))); } setquota.php 0000604 00000005460 15247161164 0007132 0 ustar 00 <?php /** * @copyright Copyright (c) 2016, ownCloud, Inc. * * @author Arthur Schiwon <blizzz@arthur-schiwon.de> * @author Bart Visscher <bartv@thisnet.nl> * @author Björn Schießle <bjoern@schiessle.org> * @author Christopher Schäpers <kondou@ts.unde.re> * @author Felix Moeller <mail@felixmoeller.de> * @author Georg Ehrke <georg@owncloud.com> * @author Lukas Reschke <lukas@statuscode.ch> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <robin@icewind.nl> * @author Thomas Müller <thomas.mueller@tmit.eu> * * @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(); $lastConfirm = (int) \OC::$server->getSession()->get('last-password-confirm'); if ($lastConfirm < (time() - 30 * 60 + 15)) { // allow 15 seconds delay $l = \OC::$server->getL10N('core'); OC_JSON::error(array( 'data' => array( 'message' => $l->t('Password confirmation is required')))); exit(); } $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))); disableapp.php 0000604 00000002614 15247161164 0007367 0 ustar 00 <?php /** * @copyright Copyright (c) 2016, ownCloud, Inc. * * @author Georg Ehrke <georg@owncloud.com> * @author Kamil Domanski <kdomanski@kdemail.net> * @author Lukas Reschke <lukas@statuscode.ch> * * @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(); $lastConfirm = (int) \OC::$server->getSession()->get('last-password-confirm'); if ($lastConfirm < (time() - 30 * 60 + 15)) { // allow 15 seconds delay $l = \OC::$server->getL10N('core'); OC_JSON::error(array( 'data' => array( 'message' => $l->t('Password confirmation is required')))); exit(); } if (!array_key_exists('appid', $_POST)) { OC_JSON::error(); exit; } $appIds = (array)$_POST['appid']; foreach($appIds as $appId) { $appId = OC_App::cleanAppId($appId); OC_App::disable($appId); } OC_JSON::success(); togglesubadmins.php 0000604 00000003534 15247161164 0010454 0 ustar 00 <?php /** * @copyright Copyright (c) 2016, ownCloud, Inc. * * @author Bart Visscher <bartv@thisnet.nl> * @author Georg Ehrke <georg@owncloud.com> * @author Lukas Reschke <lukas@statuscode.ch> * * @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(); $lastConfirm = (int) \OC::$server->getSession()->get('last-password-confirm'); if ($lastConfirm < (time() - 30 * 60 + 15)) { // allow 15 seconds delay $l = \OC::$server->getL10N('core'); OC_JSON::error(array( 'data' => array( 'message' => $l->t('Password confirmation is required')))); exit(); } $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(); enableapp.php 0000604 00000003717 15247161164 0007217 0 ustar 00 <?php /** * @copyright Copyright (c) 2016, ownCloud, Inc. * * @author Bart Visscher <bartv@thisnet.nl> * @author Christopher Schäpers <kondou@ts.unde.re> * @author Joas Schilling <coding@schilljs.com> * @author Kamil Domanski <kdomanski@kdemail.net> * @author Lukas Reschke <lukas@statuscode.ch> * @author Robin Appelman <robin@icewind.nl> * @author Thomas Müller <thomas.mueller@tmit.eu> * * @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(); $lastConfirm = (int) \OC::$server->getSession()->get('last-password-confirm'); if ($lastConfirm < (time() - 30 * 60 + 15)) { // allow 15 seconds delay $l = \OC::$server->getL10N('core'); OC_JSON::error(array( 'data' => array( 'message' => $l->t('Password confirmation is required')))); exit(); } $groups = isset($_POST['groups']) ? (array)$_POST['groups'] : null; $appIds = isset($_POST['appIds']) ? (array)$_POST['appIds'] : []; try { $updateRequired = false; foreach($appIds as $appId) { $app = new OC_App(); $appId = OC_App::cleanAppId($appId); $app->enable($appId, $groups); if(\OC_App::shouldUpgrade($appId)) { $updateRequired = true; } } OC_JSON::success(['data' => ['update_required' => $updateRequired]]); } catch (Exception $e) { \OCP\Util::writeLog('core', $e->getMessage(), \OCP\Util::ERROR); OC_JSON::error(array("data" => array("message" => $e->getMessage()) )); } updateapp.php 0000604 00000003734 15247161164 0007252 0 ustar 00 <?php /** * @copyright Copyright (c) 2016, ownCloud, Inc. * * @author Christopher Schäpers <kondou@ts.unde.re> * @author Frank Karlitschek <frank@karlitschek.de> * @author Georg Ehrke <georg@owncloud.com> * @author Lukas Reschke <lukas@statuscode.ch> * @author Robin Appelman <robin@icewind.nl> * @author Thomas Müller <thomas.mueller@tmit.eu> * * @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']; $appId = OC_App::cleanAppId($appId); $config = \OC::$server->getConfig(); $config->setSystemValue('maintenance', true); try { $installer = new \OC\Installer( \OC::$server->getAppFetcher(), \OC::$server->getHTTPClientService(), \OC::$server->getTempManager(), \OC::$server->getLogger(), \OC::$server->getConfig() ); $result = $installer->updateAppstoreApp($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.") ))); } wizard.php 0000604 00000010266 15247162426 0006567 0 ustar 00 <?php /** * @copyright Copyright (c) 2016, ownCloud, Inc. * * @author Arthur Schiwon <blizzz@arthur-schiwon.de> * @author Joas Schilling <coding@schilljs.com> * @author Lukas Reschke <lukas@statuscode.ch> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <robin@icewind.nl> * @author Thomas Müller <thomas.mueller@tmit.eu> * * @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/> * */ // Check user and app status OCP\JSON::checkAdminUser(); OCP\JSON::checkAppEnabled('user_ldap'); OCP\JSON::callCheck(); $l = \OC::$server->getL10N('user_ldap'); if(!isset($_POST['action'])) { \OCP\JSON::error(array('message' => $l->t('No action specified'))); } $action = (string)$_POST['action']; if(!isset($_POST['ldap_serverconfig_chooser'])) { \OCP\JSON::error(array('message' => $l->t('No configuration specified'))); } $prefix = (string)$_POST['ldap_serverconfig_chooser']; $ldapWrapper = new \OCA\User_LDAP\LDAP(); $configuration = new \OCA\User_LDAP\Configuration($prefix); $con = new \OCA\User_LDAP\Connection($ldapWrapper, $prefix, null); $con->setConfiguration($configuration->getConfiguration()); $con->ldapConfigurationActive = true; $con->setIgnoreValidation(true); $userManager = new \OCA\User_LDAP\User\Manager( \OC::$server->getConfig(), new \OCA\User_LDAP\FilesystemHelper(), new \OCA\User_LDAP\LogWrapper(), \OC::$server->getAvatarManager(), new \OCP\Image(), \OC::$server->getDatabaseConnection(), \OC::$server->getUserManager(), \OC::$server->getNotificationManager()); $access = new \OCA\User_LDAP\Access($con, $ldapWrapper, $userManager, new \OCA\User_LDAP\Helper( \OC::$server->getConfig() )); $wizard = new \OCA\User_LDAP\Wizard($configuration, $ldapWrapper, $access); switch($action) { case 'guessPortAndTLS': case 'guessBaseDN': case 'detectEmailAttribute': case 'detectUserDisplayNameAttribute': case 'determineGroupMemberAssoc': case 'determineUserObjectClasses': case 'determineGroupObjectClasses': case 'determineGroupsForUsers': case 'determineGroupsForGroups': case 'determineAttributes': case 'getUserListFilter': case 'getUserLoginFilter': case 'getGroupFilter': case 'countUsers': case 'countGroups': case 'countInBaseDN': try { $result = $wizard->$action(); if($result !== false) { OCP\JSON::success($result->getResultArray()); exit; } } catch (\Exception $e) { \OCP\JSON::error(array('message' => $e->getMessage(), 'code' => $e->getCode())); exit; } \OCP\JSON::error(); exit; break; case 'testLoginName': { try { $loginName = $_POST['ldap_test_loginname']; $result = $wizard->$action($loginName); if($result !== false) { OCP\JSON::success($result->getResultArray()); exit; } } catch (\Exception $e) { \OCP\JSON::error(array('message' => $e->getMessage())); exit; } \OCP\JSON::error(); exit; break; } case 'save': $key = isset($_POST['cfgkey']) ? $_POST['cfgkey'] : false; $val = isset($_POST['cfgval']) ? $_POST['cfgval'] : null; if($key === false || is_null($val)) { \OCP\JSON::error(array('message' => $l->t('No data specified'))); exit; } $cfg = array($key => $val); $setParameters = array(); $configuration->setConfiguration($cfg, $setParameters); if(!in_array($key, $setParameters)) { \OCP\JSON::error(array('message' => $l->t($key. ' Could not set configuration %s', $setParameters[0]))); exit; } $configuration->saveConfiguration(); //clear the cache on save $connection = new \OCA\User_LDAP\Connection($ldapWrapper, $prefix); $connection->clearCache(); OCP\JSON::success(); break; default: \OCP\JSON::error(array('message' => $l->t('Action does not exist'))); break; } setConfiguration.php 0000604 00000003362 15247162426 0010611 0 ustar 00 <?php /** * @copyright Copyright (c) 2016, ownCloud, Inc. * * @author Arthur Schiwon <blizzz@arthur-schiwon.de> * @author Christopher Schäpers <kondou@ts.unde.re> * @author Joas Schilling <coding@schilljs.com> * @author Lennart Rosam <hello@takuto.de> * @author Lukas Reschke <lukas@statuscode.ch> * @author Morris Jobke <hey@morrisjobke.de> * * @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/> * */ // Check user and app status OCP\JSON::checkAdminUser(); OCP\JSON::checkAppEnabled('user_ldap'); OCP\JSON::callCheck(); $prefix = (string)$_POST['ldap_serverconfig_chooser']; // Checkboxes are not submitted, when they are unchecked. Set them manually. // only legacy checkboxes (Advanced and Expert tab) need to be handled here, // the Wizard-like tabs handle it on their own $chkboxes = array('ldap_configuration_active', 'ldap_override_main_server', 'ldap_turn_off_cert_check'); foreach($chkboxes as $boxid) { if(!isset($_POST[$boxid])) { $_POST[$boxid] = 0; } } $ldapWrapper = new OCA\User_LDAP\LDAP(); $connection = new \OCA\User_LDAP\Connection($ldapWrapper, $prefix); $connection->setConfiguration($_POST); $connection->saveConfiguration(); OCP\JSON::success(); getConfiguration.php 0000604 00000002773 15247162426 0010602 0 ustar 00 <?php /** * @copyright Copyright (c) 2016, ownCloud, Inc. * * @author Arthur Schiwon <blizzz@arthur-schiwon.de> * @author Christopher Schäpers <kondou@ts.unde.re> * @author Joas Schilling <coding@schilljs.com> * @author Lukas Reschke <lukas@statuscode.ch> * @author Morris Jobke <hey@morrisjobke.de> * * @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/> * */ // Check user and app status OCP\JSON::checkAdminUser(); OCP\JSON::checkAppEnabled('user_ldap'); OCP\JSON::callCheck(); $prefix = (string)$_POST['ldap_serverconfig_chooser']; $ldapWrapper = new OCA\User_LDAP\LDAP(); $connection = new \OCA\User_LDAP\Connection($ldapWrapper, $prefix); $configuration = $connection->getConfiguration(); if (isset($configuration['ldap_agent_password']) && $configuration['ldap_agent_password'] !== '') { // hide password $configuration['ldap_agent_password'] = '**PASSWORD SET**'; } OCP\JSON::success(array('configuration' => $configuration)); deleteConfiguration.php 0000604 00000002730 15247162426 0011256 0 ustar 00 <?php /** * @copyright Copyright (c) 2016, ownCloud, Inc. * * @author Arthur Schiwon <blizzz@arthur-schiwon.de> * @author Bart Visscher <bartv@thisnet.nl> * @author Joas Schilling <coding@schilljs.com> * @author Lukas Reschke <lukas@statuscode.ch> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <robin@icewind.nl> * @author Thomas Müller <thomas.mueller@tmit.eu> * * @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/> * */ // Check user and app status OCP\JSON::checkAdminUser(); OCP\JSON::checkAppEnabled('user_ldap'); OCP\JSON::callCheck(); $prefix = (string)$_POST['ldap_serverconfig_chooser']; $helper = new \OCA\User_LDAP\Helper(\OC::$server->getConfig()); if($helper->deleteServerConfiguration($prefix)) { OCP\JSON::success(); } else { $l = \OC::$server->getL10N('user_ldap'); OCP\JSON::error(array('message' => $l->t('Failed to delete the server configuration'))); } getNewServerConfigPrefix.php 0000604 00000003406 15247162426 0012211 0 ustar 00 <?php /** * @copyright Copyright (c) 2016, ownCloud, Inc. * * @author Arthur Schiwon <blizzz@arthur-schiwon.de> * @author Joas Schilling <coding@schilljs.com> * @author Morris Jobke <hey@morrisjobke.de> * * @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/> * */ // Check user and app status OCP\JSON::checkAdminUser(); OCP\JSON::checkAppEnabled('user_ldap'); OCP\JSON::callCheck(); $helper = new \OCA\User_LDAP\Helper(\OC::$server->getConfig()); $serverConnections = $helper->getServerConfigurationPrefixes(); sort($serverConnections); $lk = array_pop($serverConnections); $ln = intval(str_replace('s', '', $lk)); $nk = 's'.str_pad($ln+1, 2, '0', STR_PAD_LEFT); $resultData = array('configPrefix' => $nk); $newConfig = new \OCA\User_LDAP\Configuration($nk, false); if(isset($_POST['copyConfig'])) { $originalConfig = new \OCA\User_LDAP\Configuration($_POST['copyConfig']); $newConfig->setConfiguration($originalConfig->getConfiguration()); } else { $configuration = new \OCA\User_LDAP\Configuration($nk, false); $newConfig->setConfiguration($configuration->getDefaults()); $resultData['defaults'] = $configuration->getDefaults(); } $newConfig->saveConfiguration(); OCP\JSON::success($resultData); clearMappings.php 0000604 00000003151 15247162426 0010047 0 ustar 00 <?php /** * @copyright Copyright (c) 2016, ownCloud, Inc. * * @author Arthur Schiwon <blizzz@arthur-schiwon.de> * @author Christopher Schäpers <kondou@ts.unde.re> * @author Lukas Reschke <lukas@statuscode.ch> * @author Morris Jobke <hey@morrisjobke.de> * * @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/> * */ use OCA\User_LDAP\Mapping\UserMapping; use OCA\User_LDAP\Mapping\GroupMapping; // Check user and app status OCP\JSON::checkAdminUser(); OCP\JSON::checkAppEnabled('user_ldap'); OCP\JSON::callCheck(); $subject = (string)$_POST['ldap_clear_mapping']; $mapping = null; if($subject === 'user') { $mapping = new UserMapping(\OC::$server->getDatabaseConnection()); } else if($subject === 'group') { $mapping = new GroupMapping(\OC::$server->getDatabaseConnection()); } try { if(is_null($mapping) || !$mapping->clear()) { $l = \OC::$server->getL10N('user_ldap'); throw new \Exception($l->t('Failed to clear the mappings.')); } OCP\JSON::success(); } catch (\Exception $e) { OCP\JSON::error(array('message' => $e->getMessage())); } testConfiguration.php 0000604 00000006377 15247162426 0011006 0 ustar 00 <?php /** * @copyright Copyright (c) 2016, ownCloud, Inc. * * @author Arthur Schiwon <blizzz@arthur-schiwon.de> * @author Bart Visscher <bartv@thisnet.nl> * @author Joas Schilling <coding@schilljs.com> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <robin@icewind.nl> * @author Thomas Müller <thomas.mueller@tmit.eu> * * @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/> * */ // Check user and app status OCP\JSON::checkAdminUser(); OCP\JSON::checkAppEnabled('user_ldap'); OCP\JSON::callCheck(); $l = \OC::$server->getL10N('user_ldap'); $ldapWrapper = new OCA\User_LDAP\LDAP(); $connection = new \OCA\User_LDAP\Connection($ldapWrapper, $_POST['ldap_serverconfig_chooser']); try { $configurationOk = true; $conf = $connection->getConfiguration(); if ($conf['ldap_configuration_active'] === '0') { //needs to be true, otherwise it will also fail with an irritating message $conf['ldap_configuration_active'] = '1'; $configurationOk = $connection->setConfiguration($conf); } if ($configurationOk) { //Configuration is okay /* * Clossing the session since it won't be used from this point on. There might be a potential * race condition if a second request is made: either this request or the other might not * contact the LDAP backup server the first time when it should, but there shouldn't be any * problem with that other than the extra connection. */ \OC::$server->getSession()->close(); if ($connection->bind()) { /* * This shiny if block is an ugly hack to find out whether anonymous * bind is possible on AD or not. Because AD happily and constantly * replies with success to any anonymous bind request, we need to * fire up a broken operation. If AD does not allow anonymous bind, * it will end up with LDAP error code 1 which is turned into an * exception by the LDAP wrapper. We catch this. Other cases may * pass (like e.g. expected syntax error). */ try { $ldapWrapper->read($connection->getConnectionResource(), '', 'objectClass=*', array('dn')); } catch (\Exception $e) { if($e->getCode() === 1) { OCP\JSON::error(array('message' => $l->t('Invalid configuration: Anonymous binding is not allowed.'))); exit; } } OCP\JSON::success(array('message' => $l->t('Valid configuration, connection established!'))); } else { OCP\JSON::error(array('message' => $l->t('Valid configuration, but binding failed. Please check the server settings and credentials.'))); } } else { OCP\JSON::error(array('message' => $l->t('Invalid configuration. Please have a look at the logs for further details.'))); } } catch (\Exception $e) { OCP\JSON::error(array('message' => $e->getMessage())); } shareinfo.php 0000604 00000007257 15247164562 0007256 0 ustar 00 <?php /** * @copyright Copyright (c) 2016, ownCloud, Inc. * * @author Bjoern Schiessle <bjoern@schiessle.org> * @author Björn Schießle <bjoern@schiessle.org> * @author Lukas Reschke <lukas@statuscode.ch> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin Appelman <robin@icewind.nl> * @author Roeland Jago Douma <roeland@famdouma.nl> * @author Stefan Weil <sw@weilnetz.de> * @author Vincent Petry <pvince81@owncloud.com> * * @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::checkAppEnabled('files_sharing'); if (!isset($_GET['t'])) { \OC_Response::setStatus(400); //400 Bad Request exit; } $federatedSharingApp = new \OCA\FederatedFileSharing\AppInfo\Application(); $federatedShareProvider = $federatedSharingApp->getFederatedShareProvider(); if ($federatedShareProvider->isOutgoingServer2serverShareEnabled() === false) { \OC_Response::setStatus(404); // 404 not found exit; } $token = $_GET['t']; $password = null; if (isset($_POST['password'])) { $password = $_POST['password']; } $relativePath = null; if (isset($_GET['dir'])) { $relativePath = $_GET['dir']; } $data = \OCA\Files_Sharing\Helper::setupFromToken($token, $relativePath, $password); /** @var \OCP\Share\IShare $share */ $share = $data['share']; // Load the files $path = $data['realPath']; $isWritable = $share->getPermissions() & (\OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_CREATE); if (!$isWritable) { // FIXME: should not add storage wrappers outside of preSetup, need to find a better way $previousLog = \OC\Files\Filesystem::logWarningWhenAddingStorageWrapper(false); \OC\Files\Filesystem::addStorageWrapper('readonly', function ($mountPoint, $storage) { return new \OC\Files\Storage\Wrapper\PermissionsMask(array('storage' => $storage, 'mask' => \OCP\Constants::PERMISSION_READ + \OCP\Constants::PERMISSION_SHARE)); }); \OC\Files\Filesystem::logWarningWhenAddingStorageWrapper($previousLog); } $rootInfo = \OC\Files\Filesystem::getFileInfo($path); $rootView = new \OC\Files\View(''); if($rootInfo === false || !($share->getPermissions() & \OCP\Constants::PERMISSION_READ)) { OCP\JSON::error(array('data' => 'Share is not readable.')); exit(); } /** * @param \OCP\Files\FileInfo $dir * @param \OC\Files\View $view * @return array */ function getChildInfo($dir, $view, $sharePermissions) { $children = $view->getDirectoryContent($dir->getPath()); $result = array(); foreach ($children as $child) { $formatted = \OCA\Files\Helper::formatFileInfo($child); if ($child->getType() === 'dir') { $formatted['children'] = getChildInfo($child, $view, $sharePermissions); } $formatted['mtime'] = $formatted['mtime'] / 1000; $formatted['permissions'] = $sharePermissions & (int)$formatted['permissions']; $result[] = $formatted; } return $result; } $result = \OCA\Files\Helper::formatFileInfo($rootInfo); $result['mtime'] = $result['mtime'] / 1000; $result['permissions'] = (int)$result['permissions'] & $share->getPermissions(); if ($rootInfo->getType() === 'dir') { $result['children'] = getChildInfo($rootInfo, $rootView, $share->getPermissions()); } OCP\JSON::success(array('data' => $result));
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0 |
proxy
|
phpinfo
|
Settings