From ceeb44bd04f2606bea4c94107850157719127581 Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Mon, 8 Aug 2016 23:31:26 +0200 Subject: [PATCH] Initial work on Apps page split: * interfaces for the Admin settings (IAdmin) and section (ISection) * SettingsManager service * example setup with LDAP app --- apps/user_ldap/appinfo/info.xml | 7 +- apps/user_ldap/lib/Settings/Admin.php | 115 ++++ apps/user_ldap/lib/Settings/Section.php | 67 ++ core/templates/untrustedDomain.php | 2 +- db_structure.xml | 94 +++ lib/private/Installer.php | 1 + lib/private/Server.php | 18 + lib/private/Settings/Admin/Encryption.php | 78 +++ lib/private/Settings/Admin/Logging.php | 87 +++ lib/private/Settings/Admin/Server.php | 114 ++++ lib/private/Settings/Admin/Sharing.php | 79 +++ lib/private/Settings/Admin/TipsTricks.php | 72 +++ lib/private/Settings/Manager.php | 297 +++++++++ lib/private/Settings/Section.php | 77 +++ lib/private/legacy/app.php | 5 +- lib/public/Settings/IAdmin.php | 48 ++ lib/public/Settings/IManager.php | 65 ++ lib/public/Settings/ISection.php | 51 ++ reset.php | 5 + settings/Application.php | 23 + .../Controller/AdminSettingsController.php | 114 ++++ settings/Controller/CheckSetupController.php | 2 +- settings/admin.php | 272 --------- settings/routes.php | 4 +- settings/templates/admin.php | 578 ------------------ settings/templates/admin/encryption.php | 92 +++ settings/templates/admin/frame.php | 47 ++ settings/templates/admin/logging.php | 88 +++ settings/templates/admin/server.php | 325 ++++++++++ settings/templates/admin/sharing.php | 109 ++++ settings/templates/admin/tipstricks.php | 49 ++ 31 files changed, 2129 insertions(+), 856 deletions(-) create mode 100644 apps/user_ldap/lib/Settings/Admin.php create mode 100644 apps/user_ldap/lib/Settings/Section.php create mode 100644 lib/private/Settings/Admin/Encryption.php create mode 100644 lib/private/Settings/Admin/Logging.php create mode 100644 lib/private/Settings/Admin/Server.php create mode 100644 lib/private/Settings/Admin/Sharing.php create mode 100644 lib/private/Settings/Admin/TipsTricks.php create mode 100644 lib/private/Settings/Manager.php create mode 100644 lib/private/Settings/Section.php create mode 100644 lib/public/Settings/IAdmin.php create mode 100644 lib/public/Settings/IManager.php create mode 100644 lib/public/Settings/ISection.php create mode 100644 reset.php create mode 100644 settings/Controller/AdminSettingsController.php delete mode 100644 settings/admin.php delete mode 100644 settings/templates/admin.php create mode 100644 settings/templates/admin/encryption.php create mode 100644 settings/templates/admin/frame.php create mode 100644 settings/templates/admin/logging.php create mode 100644 settings/templates/admin/server.php create mode 100644 settings/templates/admin/sharing.php create mode 100644 settings/templates/admin/tipstricks.php diff --git a/apps/user_ldap/appinfo/info.xml b/apps/user_ldap/appinfo/info.xml index b0984dcf62..dac4f62879 100644 --- a/apps/user_ldap/appinfo/info.xml +++ b/apps/user_ldap/appinfo/info.xml @@ -9,7 +9,7 @@ A user logs into ownCloud with their LDAP or AD credentials, and is granted acce AGPL Dominik Schmidt and Arthur Schiwon - 1.1.0 + 1.1.1 @@ -27,4 +27,9 @@ A user logs into ownCloud with their LDAP or AD credentials, and is granted acce OCA\User_LDAP\Jobs\UpdateGroups OCA\User_LDAP\Jobs\CleanUp + + + \OCA\User_LDAP\Settings\Admin + \OCA\User_LDAP\Settings\Section + diff --git a/apps/user_ldap/lib/Settings/Admin.php b/apps/user_ldap/lib/Settings/Admin.php new file mode 100644 index 0000000000..11e2627ded --- /dev/null +++ b/apps/user_ldap/lib/Settings/Admin.php @@ -0,0 +1,115 @@ + + * + * @author Arthur Schiwon + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * 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 + * along with this program. If not, see . + * + */ + +namespace OCA\User_LDAP\Settings; + + +use OCA\User_LDAP\Configuration; +use OCA\User_LDAP\Helper; +use OCP\IL10N; +use OCP\Settings\IAdmin; +use OCP\Template; + +class Admin implements IAdmin { + + /** @var IL10N */ + private $l; + + public function __construct(IL10N $l) { + $this->l = $l; + } + + /** + * @return Template all parameters are supposed to be assigned + */ + public function render() { + $settings = new Template('user_ldap', 'settings'); + + $helper = new Helper(); + $prefixes = $helper->getServerConfigurationPrefixes(); + $hosts = $helper->getServerConfigurationHosts(); + + $wizardHtml = ''; + $toc = []; + + $wControls = new Template('user_ldap', 'part.wizardcontrols'); + $wControls = $wControls->fetchPage(); + $sControls = new Template('user_ldap', 'part.settingcontrols'); + $sControls = $sControls->fetchPage(); + + $wizTabs = [ + ['tpl' => 'part.wizard-server', 'cap' => $this->l->t('Server')], + ['tpl' => 'part.wizard-userfilter', 'cap' => $this->l->t('Users')], + ['tpl' => 'part.wizard-loginfilter', 'cap' => $this->l->t('Login Attributes')], + ['tpl' => 'part.wizard-groupfilter', 'cap' => $this->l->t('Groups')], + ]; + $wizTabsCount = count($wizTabs); + for($i = 0; $i < $wizTabsCount; $i++) { + $tab = new Template('user_ldap', $wizTabs[$i]['tpl']); + if($i === 0) { + $tab->assign('serverConfigurationPrefixes', $prefixes); + $tab->assign('serverConfigurationHosts', $hosts); + } + $tab->assign('wizardControls', $wControls); + $wizardHtml .= $tab->fetchPage(); + $toc['#ldapWizard'.($i+1)] = $wizTabs[$i]['cap']; + } + + $settings->assign('tabs', $wizardHtml); + $settings->assign('toc', $toc); + $settings->assign('settingControls', $sControls); + + // assign default values + $config = new Configuration('', false); + $defaults = $config->getDefaults(); + foreach($defaults as $key => $default) { + $settings->assign($key.'_default', $default); + } + + return $settings; + } + + /** + * @return string the section ID, e.g. 'sharing' + */ + public function getSection() { + return 'ldap'; + } + + /** + * @return int whether the form should be rather on the top or bottom of + * the admin section. The forms are arranged in ascending order of the + * priority values. It is required to return a value between 0 and 100. + * + * E.g.: 70 + */ + public function getPriority() { + return 5; + } + + private function renderControls() { + $controls = new Template('user_ldap', 'part.settingcontrols'); + return $controls->fetchPage(); + + } +} diff --git a/apps/user_ldap/lib/Settings/Section.php b/apps/user_ldap/lib/Settings/Section.php new file mode 100644 index 0000000000..a10bd7cbb9 --- /dev/null +++ b/apps/user_ldap/lib/Settings/Section.php @@ -0,0 +1,67 @@ + + * + * @author Arthur Schiwon + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * 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 + * along with this program. If not, see . + * + */ + +namespace OCA\User_LDAP\Settings; + +use OCP\IL10N; +use OCP\Settings\ISection; + +class Section implements ISection { + /** @var IL10N */ + private $l; + + public function __construct(IL10N $l) { + $this->l = $l; + } + + /** + * returns the ID of the section. It is supposed to be a lower case string, + * e.g. 'ldap' + * + * @returns string + */ + public function getID() { + return 'ldap'; + } + + /** + * returns the translated name as it should be displayed, e.g. 'LDAP / AD + * integration'. Use the L10N service to translate it. + * + * @return string + */ + public function getName() { + return $this->l->t('LDAP / AD Integration'); + } + + /** + * @return int whether the form should be rather on the top or bottom of + * the settings navigation. The sections are arranged in ascending order of + * the priority values. It is required to return a value between 0 and 99. + * + * E.g.: 70 + */ + public function getPriority() { + return 25; + } +} diff --git a/core/templates/untrustedDomain.php b/core/templates/untrustedDomain.php index 46bad21682..735f83fede 100644 --- a/core/templates/untrustedDomain.php +++ b/core/templates/untrustedDomain.php @@ -10,7 +10,7 @@ t('Depending on your configuration, as an administrator you might also be able to use the button below to trust this domain.')); ?>

- + t('Add "%s" as trusted domain', array($_['domain']))); ?>

diff --git a/db_structure.xml b/db_structure.xml index 04c91ea494..f6955be8e0 100644 --- a/db_structure.xml +++ b/db_structure.xml @@ -1976,4 +1976,98 @@ + + + *dbprefix*admin_sections + + + + + id + text + + false + 64 + + + + class + text + + true + 255 + + + + priority + integer + + true + 1 + + + + admin_sections_id_index + true + + id + ascending + + + + +
+ + + + *dbprefix*admin_settings + + + + + id + integer + 0 + true + 1 + 4 + + + + class + text + + true + 255 + + + + + section + text + + false + 64 + + + + priority + integer + + true + 1 + + + + admin_sections_id_index + true + + id + ascending + + + + +
+ diff --git a/lib/private/Installer.php b/lib/private/Installer.php index eed97e18d9..a430078500 100644 --- a/lib/private/Installer.php +++ b/lib/private/Installer.php @@ -135,6 +135,7 @@ class Installer { } \OC_App::setupBackgroundJobs($info['background-jobs']); + \OC::$server->getSettingsManager()->setupSettings($info['settings']); //run appinfo/install.php if((!isset($data['noinstall']) or $data['noinstall']==false)) { diff --git a/lib/private/Server.php b/lib/private/Server.php index d5808d7f17..53c8ee8492 100644 --- a/lib/private/Server.php +++ b/lib/private/Server.php @@ -722,6 +722,17 @@ class Server extends ServerContainer implements IServerContainer { return $manager; }); + $this->registerService('SettingsManager', function(Server $c) { + $manager = new \OC\Settings\Manager( + $c->getLogger(), + $c->getDatabaseConnection(), + $c->getL10N('core'), + $c->getConfig(), + $c->getEncryptionManager(), + $c->getUserManager() + ); + return $manager; + }); } /** @@ -1425,4 +1436,11 @@ class Server extends ServerContainer implements IServerContainer { public function getLDAPProvider() { return $this->query('LDAPProvider'); } + + /** + * @return \OCP\Settings\IManager + */ + public function getSettingsManager() { + return $this->query('SettingsManager'); + } } diff --git a/lib/private/Settings/Admin/Encryption.php b/lib/private/Settings/Admin/Encryption.php new file mode 100644 index 0000000000..38197f7114 --- /dev/null +++ b/lib/private/Settings/Admin/Encryption.php @@ -0,0 +1,78 @@ + + * + * @author Arthur Schiwon + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * 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 + * along with this program. If not, see . + * + */ + +namespace OC\Settings\Admin; + +use OC\Encryption\Manager; +use OCP\IUserManager; +use OCP\Settings\IAdmin; +use OCP\Template; + +class Encryption implements IAdmin { + /** @var Manager */ + private $manager; + + /** @var IUserManager */ + private $userManager; + + public function __construct(Manager $manager, IUserManager $userManager) { + $this->manager = $manager; + $this->userManager = $userManager; + } + + /** + * @return Template all parameters are supposed to be assigned + */ + public function render() { + $parameters = [ + // Encryption API + 'encryptionEnabled' => $this->manager->isEnabled(), + 'encryptionReady' => $this->manager->isReady(), + 'externalBackendsEnabled' => count($this->userManager->getBackends()) > 1, + ]; + + $form = new Template('settings', 'admin/encryption'); + foreach ($parameters as $key => $value) { + $form->assign($key, $value); + } + return $form; + } + + /** + * @return string the section ID, e.g. 'sharing' + */ + public function getSection() { + return 'encryption'; + } + + /** + * @return int whether the form should be rather on the top or bottom of + * the admin section. The forms are arranged in ascending order of the + * priority values. It is required to return a value between 0 and 100. + * + * E.g.: 70 + */ + public function getPriority() { + return 0; + } +} diff --git a/lib/private/Settings/Admin/Logging.php b/lib/private/Settings/Admin/Logging.php new file mode 100644 index 0000000000..ead55810ec --- /dev/null +++ b/lib/private/Settings/Admin/Logging.php @@ -0,0 +1,87 @@ + + * + * @author Arthur Schiwon + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * 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 + * along with this program. If not, see . + * + */ + +namespace OC\Settings\Admin; + +use OC\Log\File as LogFile; +use OCP\IConfig; +use OCP\Settings\IAdmin; +use OCP\Template; + +class Logging implements IAdmin { + /** @var IConfig */ + private $config; + + public function __construct(IConfig $config) { + $this->config = $config; + } + + /** + * @return Template all parameters are supposed to be assigned + */ + public function render() { + $logType = $this->config->getSystemValue('log_type', 'file'); + $showLog = ($logType === 'file' || $logType === 'owncloud'); + + $numEntriesToLoad = 5; + $entries = LogFile::getEntries($numEntriesToLoad + 1); + $entriesRemaining = count($entries) > $numEntriesToLoad; + $entries = array_slice($entries, 0, $numEntriesToLoad); + + $logFileExists = file_exists(LogFile::getLogFilePath()) ; + $logFileSize = $logFileExists ? filesize(LogFile::getLogFilePath()) : 0; + + $parameters = [ + 'loglevel' => $this->config->getSystemValue('loglevel', 2), + 'entries' => $entries, + 'entriesremain' => $entriesRemaining, + 'doesLogFileExist' => $logFileExists, + 'logFileSize' => $logFileSize, + 'showLog' => $showLog, + ]; + + $form = new Template('settings', 'admin/logging'); + foreach ($parameters as $key => $value) { + $form->assign($key, $value); + } + return $form; + } + + /** + * @return string the section ID, e.g. 'sharing' + */ + public function getSection() { + return 'logging'; + } + + /** + * @return int whether the form should be rather on the top or bottom of + * the admin section. The forms are arranged in ascending order of the + * priority values. It is required to return a value between 0 and 100. + * + * E.g.: 70 + */ + public function getPriority() { + return 0; + } +} diff --git a/lib/private/Settings/Admin/Server.php b/lib/private/Settings/Admin/Server.php new file mode 100644 index 0000000000..c0f3584c0a --- /dev/null +++ b/lib/private/Settings/Admin/Server.php @@ -0,0 +1,114 @@ + + * + * @author Arthur Schiwon + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * 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 + * along with this program. If not, see . + * + */ + +namespace OC\Settings\Admin; + +use Doctrine\DBAL\Connection; +use Doctrine\DBAL\DBALException; +use Doctrine\DBAL\Platforms\SqlitePlatform; +use OCP\IConfig; +use OCP\IDBConnection; +use OCP\Settings\IAdmin; +use OCP\Template; + +class Server implements IAdmin { + + /** @var IDBConnection|Connection */ + private $db; + + /** @var IConfig */ + private $config; + + public function __construct(IDBConnection $db, IConfig $config) { + $this->db = $db; + $this->config = $config; + } + + /** + * @return Template all parameters are supposed to be assigned + */ + public function render() { + try { + if ($this->db->getDatabasePlatform() instanceof SqlitePlatform) { + $invalidTransactionIsolationLevel = false; + } else { + $invalidTransactionIsolationLevel = $this->db->getTransactionIsolation() !== Connection::TRANSACTION_READ_COMMITTED; + } + } catch (DBALException $e) { + // ignore + $invalidTransactionIsolationLevel = false; + } + + $parameters = [ + // Diagnosis + 'readOnlyConfigEnabled' => \OC_Helper::isReadOnlyConfigEnabled(), + 'isLocaleWorking' => \OC_Util::isSetLocaleWorking(), + 'isAnnotationsWorking' => \OC_Util::isAnnotationsWorking(), + 'checkForWorkingWellKnownSetup', $this->config->getSystemValue('check_for_working_wellknown_setup'), + 'has_fileinfo' => \OC_Util::fileInfoLoaded(), + 'invalidTransactionIsolationLevel' => $invalidTransactionIsolationLevel, + + // Background jobs + 'backgroundjobs_mode' => $this->config->getAppValue('core', 'backgroundjobs_mode', 'ajax'), + 'cron_log' => $this->config->getSystemValue('cron_log', true), + 'lastcron' => $this->config->getAppValue('core', 'lastcron', false), + + // Mail + 'sendmail_is_available' => (bool) \OC_Helper::findBinaryPath('sendmail'), + 'mail_domain' => $this->config->getSystemValue('mail_domain', ''), + 'mail_from_address' => $this->config->getSystemValue('mail_from_address', ''), + 'mail_smtpmode' => $this->config->getSystemValue('mail_smtpmode', ''), + 'mail_smtpsecure' => $this->config->getSystemValue('mail_smtpsecure', ''), + 'mail_smtphost' => $this->config->getSystemValue('mail_smtphost', ''), + 'mail_smtpport' => $this->config->getSystemValue('mail_smtpport', ''), + 'mail_smtpauthtype' => $this->config->getSystemValue('mail_smtpauthtype', ''), + 'mail_smtpauth' => $this->config->getSystemValue('mail_smtpauth', false), + 'mail_smtpname' => $this->config->getSystemValue('mail_smtpname', ''), + 'mail_smtppassword' => $this->config->getSystemValue('mail_smtppassword', ''), + ]; + + $form = new Template('settings', 'admin/server'); + foreach ($parameters as $key => $value) { + $form->assign($key, $value); + } + return $form; + } + + /** + * @return string the section ID, e.g. 'sharing' + */ + public function getSection() { + return 'server'; + } + + /** + * @return int whether the form should be rather on the top or bottom of + * the admin section. The forms are arranged in ascending order of the + * priority values. It is required to return a value between 0 and 100. + * + * E.g.: 70 + */ + public function getPriority() { + return 0; + } +} diff --git a/lib/private/Settings/Admin/Sharing.php b/lib/private/Settings/Admin/Sharing.php new file mode 100644 index 0000000000..7fefa4008a --- /dev/null +++ b/lib/private/Settings/Admin/Sharing.php @@ -0,0 +1,79 @@ + + * + * @author Arthur Schiwon + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * 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 + * along with this program. If not, see . + * + */ + +namespace OC\Settings\Admin; + +use OCP\IConfig; +use OCP\Settings\IAdmin; +use OCP\Template; + +class Sharing implements IAdmin { + /** @var IConfig */ + private $config; + + public function __construct(IConfig $config) { + $this->config = $config; + } + + /** + * @return Template all parameters are supposed to be assigned + */ + public function render() { + $excludeGroupsList = !is_null(json_decode($this->config->getAppValue('core', 'shareapi_exclude_groups_list', ''))) + ? implode('|', $this->config->getAppValue('core', 'shareapi_exclude_groups_list', '')) : ''; + + $parameters = [ + // Built-In Sharing + 'shareAPIEnabled' => $this->config->getAppValue('core', 'shareapi_enabled', 'yes'), + 'shareDefaultExpireDateSet' => $this->config->getAppValue('core', 'shareapi_default_expire_date', 'no'), + 'shareExpireAfterNDays' => $this->config->getAppValue('core', 'shareapi_expire_after_n_days', '7'), + 'shareEnforceExpireDate' => $this->config->getAppValue('core', 'shareapi_enforce_expire_date', 'no'), + 'shareExcludeGroups' => $this->config->getAppValue('core', 'shareapi_exclude_groups', 'no') === 'yes' ? true : false, + 'shareExcludedGroupsList' => $excludeGroupsList, + ]; + + $form = new Template('settings', 'admin/sharing'); + foreach ($parameters as $key => $value) { + $form->assign($key, $value); + } + return $form; + } + + /** + * @return string the section ID, e.g. 'sharing' + */ + public function getSection() { + return 'sharing'; + } + + /** + * @return int whether the form should be rather on the top or bottom of + * the admin section. The forms are arranged in ascending order of the + * priority values. It is required to return a value between 0 and 100. + * + * E.g.: 70 + */ + public function getPriority() { + return 0; + } +} diff --git a/lib/private/Settings/Admin/TipsTricks.php b/lib/private/Settings/Admin/TipsTricks.php new file mode 100644 index 0000000000..a0465f5e3c --- /dev/null +++ b/lib/private/Settings/Admin/TipsTricks.php @@ -0,0 +1,72 @@ + + * + * @author Arthur Schiwon + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * 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 + * along with this program. If not, see . + * + */ + +namespace OC\Settings\Admin; + +use OCP\IConfig; +use OCP\Settings\IAdmin; +use OCP\Template; + +class TipsTricks implements IAdmin { + /** @var IConfig */ + private $config; + + public function __construct(IConfig $config) { + $this->config = $config; + } + + /** + * @return Template all parameters are supposed to be assigned + */ + public function render() { + $databaseOverload = (strpos($this->config->getSystemValue('dbtype'), 'sqlite') !== false); + + $parameters = [ + 'databaseOverload' => $databaseOverload, + ]; + + $form = new Template('settings', 'admin/tipstricks'); + foreach ($parameters as $key => $value) { + $form->assign($key, $value); + } + return $form; + } + + /** + * @return string the section ID, e.g. 'sharing' + */ + public function getSection() { + return 'tips-tricks'; + } + + /** + * @return int whether the form should be rather on the top or bottom of + * the admin section. The forms are arranged in ascending order of the + * priority values. It is required to return a value between 0 and 100. + * + * E.g.: 70 + */ + public function getPriority() { + return 0; + } +} diff --git a/lib/private/Settings/Manager.php b/lib/private/Settings/Manager.php new file mode 100644 index 0000000000..b7d02ddd34 --- /dev/null +++ b/lib/private/Settings/Manager.php @@ -0,0 +1,297 @@ + + * + * @author Arthur Schiwon + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * 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 + * along with this program. If not, see . + * + */ + +namespace OC\Settings; + +use OCP\AppFramework\QueryException; +use OCP\Encryption\IManager as EncryptionManager; +use OCP\IConfig; +use OCP\IDBConnection; +use OCP\IL10N; +use OCP\ILogger; +use OCP\IUserManager; +use OCP\Settings\IAdmin; +use OCP\Settings\IManager; +use OCP\Settings\ISection; + +class Manager implements IManager { + const TABLE_ADMIN_SETTINGS = 'admin_settings'; + const TABLE_ADMIN_SECTIONS = 'admin_sections'; + + /** @var ILogger */ + /** @var ILogger */ + private $log; + + /** @var IDBConnection */ + private $dbc; + + /** @var IL10N */ + private $l; + + /** @var IConfig */ + private $config; + + /** @var EncryptionManager */ + private $encryptionManager; + + /** @var IUserManager */ + private $userManager; + + public function __construct( + ILogger $log, + IDBConnection $dbc, + IL10N $l, + IConfig $config, + EncryptionManager $encryptionManager, + IUserManager $userManager + ) { + $this->log = $log; + $this->dbc = $dbc; + $this->l = $l; + $this->config = $config; + $this->encryptionManager = $encryptionManager; + $this->userManager = $userManager; + } + + /** + * @inheritdoc + */ + public function setupSettings(array $settings) { + if(isset($settings[IManager::KEY_ADMIN_SECTION])) { + $this->setupAdminSection($settings[IManager::KEY_ADMIN_SECTION]); + } + if(isset($settings[IManager::KEY_ADMIN_SETTINGS])) { + $this->setupAdminSettings($settings[IManager::KEY_ADMIN_SETTINGS]); + } + } + + private function setupAdminSection($sectionClassName) { + if(!class_exists($sectionClassName)) { + $this->log->debug('Could not find admin section class ' . $sectionClassName); + return; + } + try { + $section = $this->query($sectionClassName); + } catch (QueryException $e) { + // cancel + return; + } + + if(!$section instanceof ISection) { + $this->log->error( + 'Admin section instance must implement \OCP\ISection. Invalid class: {class}', + ['class' => $sectionClassName] + ); + return; + } + if(!$this->hasAdminSection($section)) { + $this->addAdminSection($section); + } + } + + private function addAdminSection(ISection $section) { + $this->add(self::TABLE_ADMIN_SECTIONS, [ + 'id' => $section->getID(), + 'class' => get_class($section), + 'priority' => $section->getPriority(), + ]); + } + + private function addAdminSettings(IAdmin $settings) { + $this->add(self::TABLE_ADMIN_SETTINGS, [ + 'class' => get_class($settings), + 'section' => $settings->getSection(), + 'priority' => $settings->getPriority(), + ]); + } + + private function add($table, $values) { + $query = $this->dbc->getQueryBuilder(); + $values = array_map(function($value) use ($query) { + return $query->createNamedParameter($value); + }, $values); + $query->insert($table)->values($values); + $query->execute(); + } + + private function hasAdminSection(ISection $section) { + return $this->has(self::TABLE_ADMIN_SECTIONS, 'id', $section->getID()); + } + + private function hasAdminSettings($pageClass) { + return $this->has(self::TABLE_ADMIN_SETTINGS, 'class', $pageClass); + } + + + private function has($table, $idCol, $id) { + $query = $this->dbc->getQueryBuilder(); + $query->select($idCol) + ->from($table) + ->where($query->expr()->eq($idCol, $query->createNamedParameter($id))) + ->setMaxResults(1); + + $result = $query->execute(); + $row = $result->fetch(); + $result->closeCursor(); + + return (bool) $row; + } + + private function setupAdminSettings($settingsClassName) { + if(!class_exists($settingsClassName)) { + $this->log->debug('Could not find admin section class ' . $settingsClassName); + return; + } + + try { + $settings = $this->query($settingsClassName); + } catch (QueryException $e) { + // cancel + return; + } + + if(!$settings instanceof IAdmin) { + $this->log->error( + 'Admin section instance must implement \OCP\ISection. Invalid class: {class}', + ['class' => $settingsClassName] + ); + return; + } + if(!$this->hasAdminSettings($settings)) { + $this->addAdminSettings($settings); + } + } + + private function query($className) { + try { + return \OC::$server->query($className); + } catch (QueryException $e) { + $this->log->logException($e); + throw $e; + } + } + + /** + * returns a list of the admin sections + * + * @return ISection[] + */ + public function getAdminSections() { + $query = $this->dbc->getQueryBuilder(); + $query->select(['class', 'priority']) + ->from(self::TABLE_ADMIN_SECTIONS); + + // built-in sections + $sections = [ + 0 => [new Section('server', $this->l->t('Server Settings'), 0)], + 5 => [new Section('sharing', $this->l->t('Sharing'), 0)], + //15 => [new Section('collaboration', $this->l->t('Collaboration'), 0)], + //30 => [new Section('theming', $this->l->t('Theming'), 0)], + 45 => [new Section('encryption', $this->l->t('Encryption'), 0)], + 90 => [new Section('logging', $this->l->t('Logging'), 0)], + 98 => [new Section('additional', $this->l->t('Additional Settings'), 0)], + 99 => [new Section('tips-tricks', $this->l->t('Tips & Tricks'), 0)], + ]; + + $result = $query->execute(); + while($row = $result->fetch()) { + if(!isset($sections[$row['priority']])) { + $sections[$row['priority']] = []; + } + try { + $sections[$row['priority']][] = $this->query($row['class']); + } catch (QueryException $e) { + // skip + } + } + $result->closeCursor(); + + ksort($sections); + return $sections; + } + + private function getBuiltInAdminSettings($section) { + $forms = []; + try { + if($section === 'server') { + /** @var IAdmin $form */ + $form = new Admin\Server($this->dbc, $this->config); + $forms[$form->getPriority()] = [$form]; + } + if($section === 'encryption') { + /** @var IAdmin $form */ + $form = new Admin\Encryption($this->encryptionManager, $this->userManager); + $forms[$form->getPriority()] = [$form]; + } + if($section === 'sharing') { + /** @var IAdmin $form */ + $form = new Admin\Sharing($this->config); + $forms[$form->getPriority()] = [$form]; + } + if($section === 'logging') { + /** @var IAdmin $form */ + $form = new Admin\Logging($this->config); + $forms[$form->getPriority()] = [$form]; + } + if($section === 'tips-tricks') { + /** @var IAdmin $form */ + $form = new Admin\TipsTricks($this->config); + $forms[$form->getPriority()] = [$form]; + } + } catch (QueryException $e) { + // skip + } + return $forms; + } + + private function getAdminSettingsFromDB($section, &$settings) { + $query = $this->dbc->getQueryBuilder(); + $query->select(['class', 'priority']) + ->from(self::TABLE_ADMIN_SETTINGS) + ->where($query->expr()->eq('section', $this->dbc->getQueryBuilder()->createParameter('section'))) + ->setParameter('section', $section); + + $result = $query->execute(); + while($row = $result->fetch()) { + if(!isset($settings[$row['priority']])) { + $settings[$row['priority']] = []; + } + try { + $settings[$row['priority']][] = $this->query($row['class']); + } catch (QueryException $e) { + // skip + } + } + $result->closeCursor(); + + ksort($settings); + } + + public function getAdminSettings($section) { + $settings = $this->getBuiltInAdminSettings($section); + $this->getAdminSettingsFromDB($section, $settings); + return $settings; + } + + +} diff --git a/lib/private/Settings/Section.php b/lib/private/Settings/Section.php new file mode 100644 index 0000000000..2ea614b365 --- /dev/null +++ b/lib/private/Settings/Section.php @@ -0,0 +1,77 @@ + + * + * @author Arthur Schiwon + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * 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 + * along with this program. If not, see . + * + */ + + +namespace OC\Settings; + + +use OCP\Settings\ISection; + +class Section implements ISection { + + /** @var string */ + private $id; + + /** @var string */ + private $name; + + /** @var int */ + private $priority; + + public function __construct($id, $name, $priority) { + $this->id = $id; + $this->name = $name; + $this->priority = $priority; + } + + /** + * returns the ID of the section. It is supposed to be a lower case string, + * e.g. 'ldap' + * + * @returns string + */ + public function getID() { + return $this->id; + } + + /** + * returns the translated name as it should be displayed, e.g. 'LDAP / AD + * integration'. Use the L10N service to translate it. + * + * @return string + */ + public function getName() { + return $this->name; + } + + /** + * @return int whether the form should be rather on the top or bottom of + * the settings navigation. The sections are arranged in ascending order of + * the priority values. It is required to return a value between 0 and 99. + * + * E.g.: 70 + */ + public function getPriority() { + return $this->priority; + } +} diff --git a/lib/private/legacy/app.php b/lib/private/legacy/app.php index 5395d1daee..39f2f1a0ef 100644 --- a/lib/private/legacy/app.php +++ b/lib/private/legacy/app.php @@ -471,7 +471,7 @@ class OC_App { $settings[] = array( "id" => "admin", "order" => 1000, - "href" => $urlGenerator->linkToRoute('settings_admin'), + "href" => $urlGenerator->linkToRoute('settings.AdminSettings.index'), "name" => $l->t("Admin"), "icon" => $urlGenerator->imagePath("settings", "admin.svg") ); @@ -1199,6 +1199,9 @@ class OC_App { include $appPath . '/appinfo/update.php'; } self::setupBackgroundJobs($appData['background-jobs']); + if(isset($appData['settings']) && is_array($appData['settings'])) { + \OC::$server->getSettingsManager()->setupSettings($appData['settings']); + } //set remote/public handlers if (array_key_exists('ocsid', $appData)) { diff --git a/lib/public/Settings/IAdmin.php b/lib/public/Settings/IAdmin.php new file mode 100644 index 0000000000..ce52e3da72 --- /dev/null +++ b/lib/public/Settings/IAdmin.php @@ -0,0 +1,48 @@ + + * + * @author Arthur Schiwon + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * 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 + * along with this program. If not, see . + * + */ + +namespace OCP\Settings; + +use OCP\Template; + +interface IAdmin { + + /** + * @return Template all parameters are supposed to be assigned + */ + public function render(); + + /** + * @return string the section ID, e.g. 'sharing' + */ + public function getSection(); + + /** + * @return int whether the form should be rather on the top or bottom of + * the admin section. The forms are arranged in ascending order of the + * priority values. It is required to return a value between 0 and 100. + * + * E.g.: 70 + */ + public function getPriority(); +} diff --git a/lib/public/Settings/IManager.php b/lib/public/Settings/IManager.php new file mode 100644 index 0000000000..ba0d9da59a --- /dev/null +++ b/lib/public/Settings/IManager.php @@ -0,0 +1,65 @@ + + * + * @author Arthur Schiwon + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * 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 + * along with this program. If not, see . + * + */ + +namespace OCP\Settings; + + +interface IManager { + /** + * @since 9.1.0 + */ + const KEY_ADMIN_SETTINGS = 'admin'; + + /** + * @since 9.1.0 + */ + const KEY_ADMIN_SECTION = 'admin-section'; + + /** + * sets up settings according to data specified by an apps info.xml, within + * the element. + * + * @param array $settings an associative array, allowed keys are as specified + * by the KEY_ constant of this interface. The value + * must always be a class name, implement either + * IAdmin or ISection. I.e. only one section and admin + * setting can be configured per app. + * @since 9.1.0 + */ + public function setupSettings(array $settings); + + /** + * returns a list of the admin sections + * + * @return array array of ISection[] where key is the priority + */ + public function getAdminSections(); + + /** + * returns a list of the admin settings + * + * @param string $section the section id for which to load the settings + * @return array array of IAdmin[] where key is the priority + */ + public function getAdminSettings($section); +} diff --git a/lib/public/Settings/ISection.php b/lib/public/Settings/ISection.php new file mode 100644 index 0000000000..7802c9b5d6 --- /dev/null +++ b/lib/public/Settings/ISection.php @@ -0,0 +1,51 @@ + + * + * @author Arthur Schiwon + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * 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 + * along with this program. If not, see . + * + */ + +namespace OCP\Settings; + +interface ISection { + /** + * returns the ID of the section. It is supposed to be a lower case string, + * e.g. 'ldap' + * + * @returns string + */ + public function getID(); + + /** + * returns the translated name as it should be displayed, e.g. 'LDAP / AD + * integration'. Use the L10N service to translate it. + * + * @return string + */ + public function getName(); + + /** + * @return int whether the form should be rather on the top or bottom of + * the settings navigation. The sections are arranged in ascending order of + * the priority values. It is required to return a value between 0 and 99. + * + * E.g.: 70 + */ + public function getPriority(); +} diff --git a/reset.php b/reset.php new file mode 100644 index 0000000000..f1b772e1cd --- /dev/null +++ b/reset.php @@ -0,0 +1,5 @@ +setPassword('master', 'master'); diff --git a/settings/Application.php b/settings/Application.php index 6db5e2aabf..09ca0807e6 100644 --- a/settings/Application.php +++ b/settings/Application.php @@ -32,6 +32,7 @@ namespace OC\Settings; use OC\Files\View; use OC\Server; +use OC\Settings\Controller\AdminSettingsController; use OC\Settings\Controller\AppSettingsController; use OC\Settings\Controller\AuthSettingsController; use OC\Settings\Controller\CertificateController; @@ -178,6 +179,19 @@ class Application extends App { $c->query('Logger') ); }); + $container->registerService('AdminSettingsController', function(IContainer $c) { + return new AdminSettingsController( + $c->query('AppName'), + $c->query('Request'), + $c->query('INavigationManager'), + $c->query('L10N'), + $c->query('Config'), + $c->query('EncryptionManager'), + $c->query('UserManager'), + $c->query('DatabaseConnection'), + $c->query('SettingsManager') + ); + }); /** * Middleware @@ -269,5 +283,14 @@ class Application extends App { $server = $c->query('ServerContainer'); return $server->getIntegrityCodeChecker(); }); + $container->registerService('EventDispatcher', function (IContainer $c) { + return $c->query('ServerContainer')->getEventDispatcher(); + }); + $container->registerService('EncryptionManager', function (IContainer $c) { + return $c->query('ServerContainer')->getEncryptionManager(); + }); + $container->registerService('SettingsManager', function (IContainer $c) { + return $c->query('ServerContainer')->getSettingsManager(); + }); } } diff --git a/settings/Controller/AdminSettingsController.php b/settings/Controller/AdminSettingsController.php new file mode 100644 index 0000000000..68707addfe --- /dev/null +++ b/settings/Controller/AdminSettingsController.php @@ -0,0 +1,114 @@ + + * + * @author Arthur Schiwon + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * 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 + * along with this program. If not, see . + * + */ + +namespace OC\Settings\Controller; + +use Doctrine\DBAL\Connection; +use OCP\AppFramework\Controller; +use OCP\AppFramework\Http\TemplateResponse; +use OC\Encryption\Manager as EncryptionManager; +use OCP\IConfig; +use OCP\IDBConnection; +use OCP\IL10N; +use OCP\INavigationManager; +use OCP\IRequest; +use OCP\IUserManager; +use OCP\Settings\IManager as ISettingsManager; + +/** + * @package OC\Settings\Controller + */ +class AdminSettingsController extends Controller { + + /** @var INavigationManager */ + private $navigationManager; + + /** @var ISettingsManager */ + private $settingsManager; + + public function __construct( + $appName, + IRequest $request, + INavigationManager $navigationManager, + IL10N $l, + IConfig $config, + EncryptionManager $encryptionManager, + IUserManager $userManager, + IDBConnection $db, + ISettingsManager $settingsManager + ) { + parent::__construct($appName, $request); + $this->navigationManager = $navigationManager; + $this->settingsManager = $settingsManager; + } + + /** + * @param string $section + * @return TemplateResponse + * + * @NoCSRFRequired + */ + public function index($section) { + $this->navigationManager->setActiveEntry('admin'); + + $templateParams = []; + $templateParams = array_merge($templateParams, $this->getNavigationParameters()); + $templateParams = array_merge($templateParams, $this->getSettings($section)); + + return new TemplateResponse('settings', 'admin/frame', $templateParams); + } + + public function form() { + + } + + private function getSettings($section) { + $settings = $this->settingsManager->getAdminSettings($section); + $html = ''; + foreach ($settings as $prioritizedSettings) { + foreach ($prioritizedSettings as $setting) { + /** @var \OCP\Settings\IAdmin $setting */ + $form = $setting->render(); + $html .= $form->fetchPage(); + } + } + return ['content' => $html]; + } + + private function getNavigationParameters() { + $a = 'anchor'; + $name = 'section-name'; + + $sections = $this->settingsManager->getAdminSections(); + $templateParameters = []; + foreach($sections as $prioritizedSections) { + foreach ($prioritizedSections as $section) { + $templateParameters[] = [$a => $section->getID(), $name => $section->getName()]; + } + } + + return [ + 'forms' => $templateParameters + ]; + } +} diff --git a/settings/Controller/CheckSetupController.php b/settings/Controller/CheckSetupController.php index 13e7e44362..0441c507f3 100644 --- a/settings/Controller/CheckSetupController.php +++ b/settings/Controller/CheckSetupController.php @@ -290,7 +290,7 @@ class CheckSetupController extends Controller { public function rescanFailedIntegrityCheck() { $this->checker->runInstanceVerification(); return new RedirectResponse( - $this->urlGenerator->linkToRoute('settings_admin') + $this->urlGenerator->linkToRoute('settings.AdminSettings.index') ); } diff --git a/settings/admin.php b/settings/admin.php deleted file mode 100644 index a458c813c1..0000000000 --- a/settings/admin.php +++ /dev/null @@ -1,272 +0,0 @@ - - * @author Björn Schießle - * @author Georg Ehrke - * @author Jan-Christoph Borchardt - * @author Joas Schilling - * @author Lukas Reschke - * @author Martin Mattel - * @author Morris Jobke - * @author Robin Appelman - * @author Roeland Jago Douma - * @author Thomas Müller - * @author Vincent Petry - * - * @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 - * - */ - -use OC\Lock\NoopLockingProvider; - -OC_Util::checkAdminUser(); -\OC::$server->getNavigationManager()->setActiveEntry("admin"); - -$template = new OC_Template('settings', 'admin', 'user'); -$l = \OC::$server->getL10N('settings'); - -OC_Util::addScript('settings', 'certificates'); -OC_Util::addScript('files', 'jquery.fileupload'); - -\OC::$server->getEventDispatcher()->dispatch('OC\Settings\Admin::loadAdditionalScripts'); - -$logType = \OC::$server->getConfig()->getSystemValue('log_type', 'file'); -$showLog = ($logType === 'file' || $logType === 'owncloud'); -$numEntriesToLoad = 3; -$entries = \OC\Log\File::getEntries($numEntriesToLoad + 1); -$entriesRemaining = count($entries) > $numEntriesToLoad; -$entries = array_slice($entries, 0, $numEntriesToLoad); -$logFilePath = \OC\Log\File::getLogFilePath(); -$doesLogFileExist = file_exists($logFilePath); -$logFileSize = 0; -if($doesLogFileExist) { - $logFileSize = filesize($logFilePath); -} - -$config = \OC::$server->getConfig(); -$appConfig = \OC::$server->getAppConfig(); -$request = \OC::$server->getRequest(); -$certificateManager = \OC::$server->getCertificateManager(null); -$urlGenerator = \OC::$server->getURLGenerator(); - -// Should we display sendmail as an option? -$template->assign('sendmail_is_available', (bool) \OC_Helper::findBinaryPath('sendmail')); - -$template->assign('loglevel', $config->getSystemValue("loglevel", 2)); -$template->assign('mail_domain', $config->getSystemValue("mail_domain", '')); -$template->assign('mail_from_address', $config->getSystemValue("mail_from_address", '')); -$template->assign('mail_smtpmode', $config->getSystemValue("mail_smtpmode", '')); -$template->assign('mail_smtpsecure', $config->getSystemValue("mail_smtpsecure", '')); -$template->assign('mail_smtphost', $config->getSystemValue("mail_smtphost", '')); -$template->assign('mail_smtpport', $config->getSystemValue("mail_smtpport", '')); -$template->assign('mail_smtpauthtype', $config->getSystemValue("mail_smtpauthtype", '')); -$template->assign('mail_smtpauth', $config->getSystemValue("mail_smtpauth", false)); -$template->assign('mail_smtpname', $config->getSystemValue("mail_smtpname", '')); -$template->assign('mail_smtppassword', $config->getSystemValue("mail_smtppassword", '')); -$template->assign('entries', $entries); -$template->assign('entriesremain', $entriesRemaining); -$template->assign('logFileSize', $logFileSize); -$template->assign('doesLogFileExist', $doesLogFileExist); -$template->assign('showLog', $showLog); -$template->assign('readOnlyConfigEnabled', OC_Helper::isReadOnlyConfigEnabled()); -$template->assign('isLocaleWorking', OC_Util::isSetLocaleWorking()); -$template->assign('isAnnotationsWorking', OC_Util::isAnnotationsWorking()); -$template->assign('checkForWorkingWellKnownSetup', $config->getSystemValue('check_for_working_wellknown_setup', true)); -$template->assign('has_fileinfo', OC_Util::fileInfoLoaded()); -$template->assign('backgroundjobs_mode', $appConfig->getValue('core', 'backgroundjobs_mode', 'ajax')); -$template->assign('cron_log', $config->getSystemValue('cron_log', true)); -$template->assign('lastcron', $appConfig->getValue('core', 'lastcron', false)); -$template->assign('shareAPIEnabled', $appConfig->getValue('core', 'shareapi_enabled', 'yes')); -$template->assign('shareDefaultExpireDateSet', $appConfig->getValue('core', 'shareapi_default_expire_date', 'no')); -$template->assign('shareExpireAfterNDays', $appConfig->getValue('core', 'shareapi_expire_after_n_days', '7')); -$template->assign('shareEnforceExpireDate', $appConfig->getValue('core', 'shareapi_enforce_expire_date', 'no')); -$excludeGroups = $appConfig->getValue('core', 'shareapi_exclude_groups', 'no') === 'yes' ? true : false; -$template->assign('shareExcludeGroups', $excludeGroups); -$excludedGroupsList = $appConfig->getValue('core', 'shareapi_exclude_groups_list', ''); -$excludedGroupsList = json_decode($excludedGroupsList); -$template->assign('shareExcludedGroupsList', !is_null($excludedGroupsList) ? implode('|', $excludedGroupsList) : ''); -$template->assign('encryptionEnabled', \OC::$server->getEncryptionManager()->isEnabled()); -$backends = \OC::$server->getUserManager()->getBackends(); -$externalBackends = (count($backends) > 1) ? true : false; -$template->assign('encryptionReady', \OC::$server->getEncryptionManager()->isReady()); -$template->assign('externalBackendsEnabled', $externalBackends); - -/** @var \Doctrine\DBAL\Connection $connection */ -$connection = \OC::$server->getDatabaseConnection(); -try { - if ($connection->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\SqlitePlatform) { - $template->assign('invalidTransactionIsolationLevel', false); - } else { - $template->assign('invalidTransactionIsolationLevel', $connection->getTransactionIsolation() !== \Doctrine\DBAL\Connection::TRANSACTION_READ_COMMITTED); - } -} catch (\Doctrine\DBAL\DBALException $e) { - // ignore - $template->assign('invalidTransactionIsolationLevel', false); -} - -$encryptionModules = \OC::$server->getEncryptionManager()->getEncryptionModules(); -$defaultEncryptionModuleId = \OC::$server->getEncryptionManager()->getDefaultEncryptionModuleId(); - -$encModulues = array(); -foreach ($encryptionModules as $module) { - $encModulues[$module['id']]['displayName'] = $module['displayName']; - $encModulues[$module['id']]['default'] = false; - if ($module['id'] === $defaultEncryptionModuleId) { - $encModulues[$module['id']]['default'] = true; - } -} -$template->assign('encryptionModules', $encModulues); - -// If the current web root is non-empty but the web root from the config is, -// and system cron is used, the URL generator fails to build valid URLs. -$shouldSuggestOverwriteCliUrl = $config->getAppValue('core', 'backgroundjobs_mode', 'ajax') === 'cron' && - \OC::$WEBROOT && \OC::$WEBROOT !== '/' && - !$config->getSystemValue('overwrite.cli.url', ''); -$suggestedOverwriteCliUrl = ($shouldSuggestOverwriteCliUrl) ? \OC::$WEBROOT : ''; -$template->assign('suggestedOverwriteCliUrl', $suggestedOverwriteCliUrl); - -$template->assign('allowLinks', $appConfig->getValue('core', 'shareapi_allow_links', 'yes')); -$template->assign('enforceLinkPassword', \OCP\Util::isPublicLinkPasswordRequired()); -$template->assign('allowPublicUpload', $appConfig->getValue('core', 'shareapi_allow_public_upload', 'yes')); -$template->assign('allowResharing', $appConfig->getValue('core', 'shareapi_allow_resharing', 'yes')); -$template->assign('allowPublicMailNotification', $appConfig->getValue('core', 'shareapi_allow_public_notification', 'no')); -$template->assign('allowMailNotification', $appConfig->getValue('core', 'shareapi_allow_mail_notification', 'no')); -$template->assign('allowShareDialogUserEnumeration', $appConfig->getValue('core', 'shareapi_allow_share_dialog_user_enumeration', 'yes')); -$template->assign('onlyShareWithGroupMembers', \OC\Share\Share::shareWithGroupMembersOnly()); -$template->assign('allowGroupSharing', $appConfig->getValue('core', 'shareapi_allow_group_sharing', 'yes')); -$databaseOverload = (strpos(\OCP\Config::getSystemValue('dbtype'), 'sqlite') !== false); -$template->assign('databaseOverload', $databaseOverload); -$template->assign('cronErrors', $appConfig->getValue('core', 'cronErrors')); - -// warn if php is not setup properly to get system variables with getenv -$path = getenv('PATH'); -$template->assign('getenvServerNotWorking', empty($path)); - -// warn if outdated version of a memcache module is used -$caches = [ - 'apcu' => ['name' => $l->t('APCu'), 'version' => '4.0.6'], - 'redis' => ['name' => $l->t('Redis'), 'version' => '2.2.5'], -]; - -$outdatedCaches = []; -foreach ($caches as $php_module => $data) { - $isOutdated = extension_loaded($php_module) && version_compare(phpversion($php_module), $data['version'], '<'); - if ($isOutdated) { - $outdatedCaches[$php_module] = $data; - } -} -$template->assign('OutdatedCacheWarning', $outdatedCaches); - -// add hardcoded forms from the template -$forms = OC_App::getForms('admin'); - -if ($config->getSystemValue('enable_certificate_management', false)) { - $certificatesTemplate = new OC_Template('settings', 'certificates'); - $certificatesTemplate->assign('type', 'admin'); - $certificatesTemplate->assign('uploadRoute', 'settings.Certificate.addSystemRootCertificate'); - $certificatesTemplate->assign('certs', $certificateManager->listCertificates()); - $certificatesTemplate->assign('urlGenerator', $urlGenerator); - $forms[] = $certificatesTemplate->fetchPage(); -} - -$formsAndMore = array(); -if ($request->getServerProtocol() !== 'https' || !OC_Util::isAnnotationsWorking() || - $suggestedOverwriteCliUrl || !OC_Util::isSetLocaleWorking() || - !OC_Util::fileInfoLoaded() || $databaseOverload -) { - $formsAndMore[] = array('anchor' => 'security-warning', 'section-name' => $l->t('Security & setup warnings')); -} -$formsAndMore[] = array('anchor' => 'shareAPI', 'section-name' => $l->t('Sharing')); -$formsAndMore[] = ['anchor' => 'encryptionAPI', 'section-name' => $l->t('Server-side encryption')]; - -// Prioritize fileSharingSettings and files_external and move updater to the version -$fileSharingSettings = $filesExternal = $updaterAppPanel = $ocDefaultEncryptionModulePanel = ''; -foreach ($forms as $index => $form) { - if (strpos($form, 'id="fileSharingSettings"')) { - $fileSharingSettings = $form; - unset($forms[$index]); - continue; - } - if (strpos($form, 'id="files_external"')) { - $filesExternal = $form; - unset($forms[$index]); - continue; - } - if (strpos($form, 'class="updater-admin"')) { - $updaterAppPanel = $form; - unset($forms[$index]); - continue; - } - if (strpos($form, 'id="ocDefaultEncryptionModule"')) { - $ocDefaultEncryptionModulePanel = $form; - unset($forms[$index]); - continue; - } -} -if ($filesExternal) { - $formsAndMore[] = array('anchor' => 'files_external', 'section-name' => $l->t('External Storage')); -} - -$template->assign('fileSharingSettings', $fileSharingSettings); -$template->assign('filesExternal', $filesExternal); -$template->assign('updaterAppPanel', $updaterAppPanel); -$template->assign('ocDefaultEncryptionModulePanel', $ocDefaultEncryptionModulePanel); -$lockingProvider = \OC::$server->getLockingProvider(); -if ($lockingProvider instanceof NoopLockingProvider) { - $template->assign('fileLockingType', 'none'); -} else if ($lockingProvider instanceof \OC\Lock\DBLockingProvider) { - $template->assign('fileLockingType', 'db'); -} else { - $template->assign('fileLockingType', 'cache'); -} - -$formsMap = array_map(function ($form) { - if (preg_match('%([^>]*)>.*?)%i', $form, $regs)) { - $sectionName = str_replace('', '', $regs[0]); - $sectionName = str_replace('', '', $sectionName); - $anchor = strtolower($sectionName); - $anchor = str_replace(' ', '-', $anchor); - - return array( - 'anchor' => $anchor, - 'section-name' => $sectionName, - 'form' => $form - ); - } - return array( - 'form' => $form - ); -}, $forms); - -$formsAndMore = array_merge($formsAndMore, $formsMap); - -// add bottom hardcoded forms from the template -$formsAndMore[] = ['anchor' => 'backgroundjobs', 'section-name' => $l->t('Cron')]; -$formsAndMore[] = ['anchor' => 'mail_general_settings', 'section-name' => $l->t('Email server')]; -$formsAndMore[] = ['anchor' => 'log-section', 'section-name' => $l->t('Log')]; -$formsAndMore[] = ['anchor' => 'admin-tips', 'section-name' => $l->t('Tips & tricks')]; -if ($updaterAppPanel) { - $formsAndMore[] = ['anchor' => 'updater', 'section-name' => $l->t('Updates')]; -} - -$template->assign('forms', $formsAndMore); - -$template->printPage(); - -$util = new \OC_Util(); -$util->createHtaccessTestFile(\OC::$server->getConfig()); - diff --git a/settings/routes.php b/settings/routes.php index 94732b3192..f77da543e1 100644 --- a/settings/routes.php +++ b/settings/routes.php @@ -64,6 +64,8 @@ $application->registerRoutes($this, [ ['name' => 'Certificate#removePersonalRootCertificate', 'url' => '/settings/personal/certificate/{certificateIdentifier}', 'verb' => 'DELETE'], ['name' => 'Certificate#addSystemRootCertificate', 'url' => '/settings/admin/certificate', 'verb' => 'POST'], ['name' => 'Certificate#removeSystemRootCertificate', 'url' => '/settings/admin/certificate/{certificateIdentifier}', 'verb' => 'DELETE'], + ['name' => 'AdminSettings#index', 'url' => '/settings/admin/{section}', 'verb' => 'GET', 'defaults' => ['section' => 'server']], + ['name' => 'AdminSettings#form', 'url' => '/settings/admin/{section}', 'verb' => 'GET'], ] ]); @@ -76,8 +78,6 @@ $this->create('settings_personal', '/settings/personal') ->actionInclude('settings/personal.php'); $this->create('settings_users', '/settings/users') ->actionInclude('settings/users.php'); -$this->create('settings_admin', '/settings/admin') - ->actionInclude('settings/admin.php'); // Settings ajax actions // users $this->create('settings_ajax_setquota', '/settings/ajax/setquota.php') diff --git a/settings/templates/admin.php b/settings/templates/admin.php deleted file mode 100644 index 74fe585962..0000000000 --- a/settings/templates/admin.php +++ /dev/null @@ -1,578 +0,0 @@ - - * This file is licensed under the Affero General Public License version 3 or later. - * See the COPYING-README file. - */ -/** - * @var array $_ - * @var \OCP\IL10N $l - * @var OC_Defaults $theme - */ - -style('settings', 'settings'); -script('settings', [ 'settings', 'admin', 'log'] ); -script('core', ['multiselect', 'setupchecks']); -vendor_script('select2/select2'); -vendor_style('select2/select2'); - -$levels = ['Debug', 'Info', 'Warning', 'Error', 'Fatal']; -$levelLabels = [ - $l->t( 'Everything (fatal issues, errors, warnings, info, debug)' ), - $l->t( 'Info, warnings, errors and fatal issues' ), - $l->t( 'Warnings, errors and fatal issues' ), - $l->t( 'Errors and fatal issues' ), - $l->t( 'Fatal issues only' ), -]; - -$mail_smtpauthtype = [ - '' => $l->t('None'), - 'LOGIN' => $l->t('Login'), - 'PLAIN' => $l->t('Plain'), - 'NTLM' => $l->t('NT LAN Manager'), -]; - -$mail_smtpsecure = [ - '' => $l->t('None'), - 'ssl' => $l->t('SSL'), - 'tls' => $l->t('TLS'), -]; - -$mail_smtpmode = [ - 'php', - 'smtp', -]; -if ($_['sendmail_is_available']) { - $mail_smtpmode[] = 'sendmail'; -} -if ($_['mail_smtpmode'] == 'qmail') { - $mail_smtpmode[] = 'qmail'; -} -?> - -
-
    - %s", \OCP\Util::sanitizeHTML($anchor), \OCP\Util::sanitizeHTML($sectionName))); - } - }?> -
-
- -
- -
-

t('Security & setup warnings'));?>

-
    - -
  • - t('php does not seem to be setup properly to query system environment variables. The test with getenv("PATH") only returns an empty response.')); ?>
    - t('Please check the installation documentation ↗ for php configuration notes and the php configuration of your server, especially when using php-fpm.', link_to_docs('admin-php-fpm'))); ?> -
  • - -
  • - t('The Read-Only config has been enabled. This prevents setting some configurations via the web-interface. Furthermore, the file needs to be made writable manually for every update.')); ?> -
  • - -
  • - t('PHP is apparently setup to strip inline doc blocks. This will make several core apps inaccessible.')); ?>
    - t('This is probably caused by a cache/accelerator such as Zend OPcache or eAccelerator.')); ?> -
  • - -
  • - t('Your database does not run with "READ COMMITTED" transaction isolation level. This can cause problems when multiple actions are executed in parallel.')); ?> -
  • - $data) { - ?> -
  • - t('%1$s below version %2$s is installed, for stability and performance reasons we recommend updating to a newer %1$s version.', $data)); ?> -
  • - -
  • - t('The PHP module \'fileinfo\' is missing. We strongly recommend to enable this module to get best results with mime-type detection.')); ?> -
  • - -
  • - t('Transactional file locking is disabled, this might lead to issues with race conditions. Enable \'filelocking.enabled\' in config.php to avoid these problems. See the documentation ↗ for more information.', link_to_docs('admin-transactional-locking'))); ?> -
  • - -
  • - t('System locale can not be set to a one which supports UTF-8.')); - ?> -
    - t('This means that there might be problems with certain characters in file names.')); - ?> -
    - t('We strongly suggest installing the required packages on your system to support one of the following locales: %s.', [$locales])); - ?> -
  • - -
  • - t('If your installation is not installed in the root of the domain and uses system cron, there can be issues with the URL generation. To avoid these problems, please set the "overwrite.cli.url" option in your config.php file to the webroot path of your installation (Suggested: "%s")', $_['suggestedOverwriteCliUrl'])); ?> -
  • - -
  • - t('It was not possible to execute the cronjob via CLI. The following technical errors have appeared:')); ?> -
    -
      - error)) {?> -
    1. error) ?> hint) ?>
    2. - -
    -
  • - -
- -
-
- - - - -
-
- -
-
- -
-

t('Sharing'));?>

- -

- /> -
-

-

- /> -
-

- -

- /> -
- - /> -
- - /> -
- - /> -
- -

-

- t( 'Expire after ' )); ?> - ' /> - t( 'days' )); ?> - /> -
-

-

- /> -
-

-

- /> -
-

-

- /> -
-

-

- /> -
-

-

- /> -
-

-

- -
- t('These groups will still be able to receive shares, but not to initiate them.')); ?> -

-

- /> -
-

- - -
- - - - -
- - -
-

t('Cron'));?>

- -

- - - - t("Last cron job execution: %s.", [$relative_time]));?> - - - - - t("Last cron job execution: %s. Something seems wrong.", [$relative_time]));?> - - - - t("Cron was not executed yet!")); - endif; ?> -

- - - -

- > -
- t("Execute one task with each page loaded")); ?> -

-

- > -
- t("cron.php is registered at a webcron service to call cron.php every 15 minutes over http.")); ?> -

-

- > -
- t("Use system's cron service to call the cron.php file every 15 minutes.")); ?> -

-
- -
-

t('Server-side encryption')); ?>

- - -

- /> -
-

- - - -
-
- t('No encryption module loaded, please enable an encryption module in the app menu.')); - } else { ?> -

t('Select default encryption module:')) ?>

-
- $module): ?> - > - -
- - - -
- -
-
- t('You need to migrate your encryption keys from the old encryption (ownCloud <= 8.0) to the new one. Please enable the "Default encryption module" and run \'occ encryption:migrate\'')); - } elseif ($_['encryptionReady'] === false && $_['externalBackendsEnabled'] === false) { - p($l->t('You need to migrate your encryption keys from the old encryption (ownCloud <= 8.0) to the new one.')); ?> - - -
-
-
- -
-
-

t('Email server'));?>

- - -

t('This is used for sending out notifications.')); ?>

- -

- - - - - -

- -

- - ' />@ - ' /> -

- - - - -
-
- -
- -
- t( 'Test email settings' )); ?> - - -
- -
-

t('Log'));?>

- - - - - - - - - - - -
- level]);?> - - app);?> - - message);?> - - time)){ - p(OC_Util::formatDate($entry->time)); - } else { - p($entry->time); - }?> - user) ? p($entry->user) : p('--') ?>
-

t('What to log'));?>

- - 0): ?> - t('Download logfile'));?> - - - - - - (100 * 1024 * 1024)): ?> -
- - t('The logfile is bigger than 100 MB. Downloading it may take some time!')); ?> - - - -
- -
-

t('Tips & tricks'));?>

- -
- - -
- - -
-

t('Version'));?>

-

getTitle()); ?>

-

-
- - - - -
diff --git a/settings/templates/admin/encryption.php b/settings/templates/admin/encryption.php new file mode 100644 index 0000000000..d4c3be8b2c --- /dev/null +++ b/settings/templates/admin/encryption.php @@ -0,0 +1,92 @@ + + * + * @author Arthur Schiwon + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * 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 + * along with this program. If not, see . + * + */ + +/** @var \OCP\IL10N $l */ +/** @var array $_ */ + +?> + +
+

t('Server-side encryption')); ?>

+ + +

+ /> +
+

+ + + +
+
+ t('No encryption module loaded, please enable an encryption module in the app menu.')); + } else { ?> +

t('Select default encryption module:')) ?>

+
+ $module): ?> + > + +
+ + + +
+ +
+
+ t('You need to migrate your encryption keys from the old encryption (ownCloud <= 8.0) to the new one. Please enable the "Default encryption module" and run \'occ encryption:migrate\'')); + } elseif ($_['encryptionReady'] === false && $_['externalBackendsEnabled'] === false) { + p($l->t('You need to migrate your encryption keys from the old encryption (ownCloud <= 8.0) to the new one.')); ?> + + +
+
+
diff --git a/settings/templates/admin/frame.php b/settings/templates/admin/frame.php new file mode 100644 index 0000000000..e0fee1555a --- /dev/null +++ b/settings/templates/admin/frame.php @@ -0,0 +1,47 @@ + + * + * @author Arthur Schiwon + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * 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 + * along with this program. If not, see . + * + */ + +style('settings', 'settings'); +script('settings', [ 'settings', 'admin', 'log', 'certificates'] ); +script('core', ['multiselect', 'setupchecks']); +script('files', 'jquery.fileupload'); +vendor_script('select2/select2'); +vendor_style('select2/select2'); + +?> + +
+
    + getURLGenerator()->linkToRoute('settings.AdminSettings.index', ['section' => $form['anchor']]); + $sectionName = $form['section-name']; + print_unescaped(sprintf("
  • %s
  • ", \OCP\Util::sanitizeHTML($anchor), \OCP\Util::sanitizeHTML($sectionName))); + } + }?> +
+
+ +
+ +
diff --git a/settings/templates/admin/logging.php b/settings/templates/admin/logging.php new file mode 100644 index 0000000000..2f60629c42 --- /dev/null +++ b/settings/templates/admin/logging.php @@ -0,0 +1,88 @@ + + * + * @author Arthur Schiwon + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * 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 + * along with this program. If not, see . + * + */ + +/** @var \OCP\IL10N $l */ +/** @var array $_ */ + +$levels = ['Debug', 'Info', 'Warning', 'Error', 'Fatal']; +$levelLabels = [ + $l->t( 'Everything (fatal issues, errors, warnings, info, debug)' ), + $l->t( 'Info, warnings, errors and fatal issues' ), + $l->t( 'Warnings, errors and fatal issues' ), + $l->t( 'Errors and fatal issues' ), + $l->t( 'Fatal issues only' ), +]; + +?> + +
+

t('Log'));?>

+ + + + + + + + + + + +
+ level]);?> + + app);?> + + message);?> + + time)){ + p(OC_Util::formatDate($entry->time)); + } else { + p($entry->time); + }?> + user) ? p($entry->user) : p('--') ?>
+

t('What to log'));?>

+ + 0): ?> + t('Download logfile'));?> + + + + + + (100 * 1024 * 1024)): ?> +
+ + t('The logfile is bigger than 100 MB. Downloading it may take some time!')); ?> + + + +
diff --git a/settings/templates/admin/server.php b/settings/templates/admin/server.php new file mode 100644 index 0000000000..1bf068de39 --- /dev/null +++ b/settings/templates/admin/server.php @@ -0,0 +1,325 @@ + + * + * @author Arthur Schiwon + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * 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 + * along with this program. If not, see . + * + */ + +/** @var \OCP\IL10N $l */ +/** @var array $_ */ + +$mail_smtpauthtype = [ + '' => $l->t('None'), + 'LOGIN' => $l->t('Login'), + 'PLAIN' => $l->t('Plain'), + 'NTLM' => $l->t('NT LAN Manager'), +]; + +$mail_smtpsecure = [ + '' => $l->t('None'), + 'ssl' => $l->t('SSL'), + 'tls' => $l->t('TLS'), +]; + +$mail_smtpmode = [ + 'php', + 'smtp', +]; +if ($_['sendmail_is_available']) { + $mail_smtpmode[] = 'sendmail'; +} +if ($_['mail_smtpmode'] == 'qmail') { + $mail_smtpmode[] = 'qmail'; +} +?> + +
+

t('Security & setup warnings'));?>

+
    + +
  • + t('php does not seem to be setup properly to query system environment variables. The test with getenv("PATH") only returns an empty response.')); ?>
    + t('Please check the installation documentation ↗ for php configuration notes and the php configuration of your server, especially when using php-fpm.', link_to_docs('admin-php-fpm'))); ?> +
  • + +
  • + t('The Read-Only config has been enabled. This prevents setting some configurations via the web-interface. Furthermore, the file needs to be made writable manually for every update.')); ?> +
  • + +
  • + t('PHP is apparently setup to strip inline doc blocks. This will make several core apps inaccessible.')); ?>
    + t('This is probably caused by a cache/accelerator such as Zend OPcache or eAccelerator.')); ?> +
  • + +
  • + t('Your database does not run with "READ COMMITTED" transaction isolation level. This can cause problems when multiple actions are executed in parallel.')); ?> +
  • + $data) { + ?> +
  • + t('%1$s below version %2$s is installed, for stability and performance reasons we recommend updating to a newer %1$s version.', $data)); ?> +
  • + +
  • + t('The PHP module \'fileinfo\' is missing. We strongly recommend to enable this module to get best results with mime-type detection.')); ?> +
  • + +
  • + t('Transactional file locking is disabled, this might lead to issues with race conditions. Enable \'filelocking.enabled\' in config.php to avoid these problems. See the documentation ↗ for more information.', link_to_docs('admin-transactional-locking'))); ?> +
  • + +
  • + t('System locale can not be set to a one which supports UTF-8.')); + ?> +
    + t('This means that there might be problems with certain characters in file names.')); + ?> +
    + t('We strongly suggest installing the required packages on your system to support one of the following locales: %s.', [$locales])); + ?> +
  • + +
  • + t('If your installation is not installed in the root of the domain and uses system cron, there can be issues with the URL generation. To avoid these problems, please set the "overwrite.cli.url" option in your config.php file to the webroot path of your installation (Suggested: "%s")', $_['suggestedOverwriteCliUrl'])); ?> +
  • + +
  • + t('It was not possible to execute the cronjob via CLI. The following technical errors have appeared:')); ?> +
    +
      + error)) {?> +
    1. error) ?> hint) ?>
    2. + +
    +
  • + +
+ +
+
+ + + + +
+
+ +
+
+ +
+

t('Cron'));?>

+ +

+ + + + t("Last cron job execution: %s.", [$relative_time]));?> + + + + + t("Last cron job execution: %s. Something seems wrong.", [$relative_time]));?> + + + + t("Cron was not executed yet!")); + endif; ?> +

+ + + +

+ > +
+ t("Execute one task with each page loaded")); ?> +

+

+ > +
+ t("cron.php is registered at a webcron service to call cron.php every 15 minutes over http.")); ?> +

+

+ > +
+ t("Use system's cron service to call the cron.php file every 15 minutes.")); ?> +

+
+ +
+
+

t('Email server'));?>

+ + +

t('This is used for sending out notifications.')); ?>

+ +

+ + + + + +

+ +

+ + ' />@ + ' /> +

+ + + + +
+
+ +
+ +
+ t( 'Test email settings' )); ?> + + +
+ +
+

t('Version'));?>

+

getTitle()); ?>

+

+
diff --git a/settings/templates/admin/sharing.php b/settings/templates/admin/sharing.php new file mode 100644 index 0000000000..c81f7e2ae1 --- /dev/null +++ b/settings/templates/admin/sharing.php @@ -0,0 +1,109 @@ + + * + * @author Arthur Schiwon + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * 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 + * along with this program. If not, see . + * + */ + +/** @var \OCP\IL10N $l */ +/** @var array $_ */ + +?> + +
+

t('Sharing'));?>

+ +

+ /> +
+

+

+ /> +
+

+ +

+ /> +
+ + /> +
+ + /> +
+ + /> +
+ +

+

+ t( 'Expire after ' )); ?> + ' /> + t( 'days' )); ?> + /> +
+

+

+ /> +
+

+

+ /> +
+

+

+ /> +
+

+

+ /> +
+

+

+ /> +
+

+

+ +
+ t('These groups will still be able to receive shares, but not to initiate them.')); ?> +

+

+ /> +
+

+ + +
diff --git a/settings/templates/admin/tipstricks.php b/settings/templates/admin/tipstricks.php new file mode 100644 index 0000000000..e924a96dea --- /dev/null +++ b/settings/templates/admin/tipstricks.php @@ -0,0 +1,49 @@ + + * + * @author Arthur Schiwon + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * 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 + * along with this program. If not, see . + * + */ + +/** @var \OCP\IL10N $l */ +/** @var array $_ */ + +?> + +
+

t('Tips & tricks'));?>

+ +