2011-08-22 23:40:13 +00:00
|
|
|
<?php
|
|
|
|
/**
|
2015-03-26 10:44:34 +00:00
|
|
|
* @author Arthur Schiwon <blizzz@owncloud.com>
|
|
|
|
* @author Bart Visscher <bartv@thisnet.nl>
|
2015-06-25 09:43:55 +00:00
|
|
|
* @author Björn Schießle <schiessle@owncloud.com>
|
2015-03-26 10:44:34 +00:00
|
|
|
* @author Frank Karlitschek <frank@owncloud.org>
|
|
|
|
* @author Georg Ehrke <georg@owncloud.com>
|
|
|
|
* @author Jan-Christoph Borchardt <hey@jancborchardt.net>
|
|
|
|
* @author Joas Schilling <nickvergessen@owncloud.com>
|
|
|
|
* @author Lukas Reschke <lukas@owncloud.com>
|
2015-06-25 09:43:55 +00:00
|
|
|
* @author Martin Mattel <martin.mattel@diemattels.at>
|
2015-03-26 10:44:34 +00:00
|
|
|
* @author Morris Jobke <hey@morrisjobke.de>
|
|
|
|
* @author Robin Appelman <icewind@owncloud.com>
|
|
|
|
* @author Thomas Müller <thomas.mueller@tmit.eu>
|
|
|
|
* @author Vincent Petry <pvince81@owncloud.com>
|
|
|
|
*
|
|
|
|
* @copyright Copyright (c) 2015, ownCloud, Inc.
|
|
|
|
* @license AGPL-3.0
|
|
|
|
*
|
|
|
|
* This code is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License, version 3,
|
|
|
|
* as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Affero General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Affero General Public License, version 3,
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
|
|
|
*
|
2011-08-22 23:40:13 +00:00
|
|
|
*/
|
2015-02-26 10:37:37 +00:00
|
|
|
|
2015-05-29 09:54:05 +00:00
|
|
|
use OC\Lock\NoopLockingProvider;
|
|
|
|
|
2011-09-18 19:31:56 +00:00
|
|
|
OC_Util::checkAdminUser();
|
2014-10-30 12:44:40 +00:00
|
|
|
OC_App::setActiveNavigationEntry("admin");
|
2011-08-22 23:40:13 +00:00
|
|
|
|
2014-10-30 12:44:40 +00:00
|
|
|
$template = new OC_Template('settings', 'admin', 'user');
|
2015-06-02 13:03:27 +00:00
|
|
|
$l = OC_L10N::get('settings');
|
2014-10-30 12:44:40 +00:00
|
|
|
|
2014-12-20 21:44:41 +00:00
|
|
|
$showLog = (\OC::$server->getConfig()->getSystemValue('log_type', 'owncloud') === 'owncloud');
|
|
|
|
$numEntriesToLoad = 3;
|
|
|
|
$entries = OC_Log_Owncloud::getEntries($numEntriesToLoad + 1);
|
|
|
|
$entriesRemaining = count($entries) > $numEntriesToLoad;
|
|
|
|
$entries = array_slice($entries, 0, $numEntriesToLoad);
|
|
|
|
$logFilePath = OC_Log_Owncloud::getLogFilePath();
|
|
|
|
$doesLogFileExist = file_exists($logFilePath);
|
2015-07-29 18:41:34 +00:00
|
|
|
$logFileSize = 0;
|
|
|
|
if($doesLogFileExist) {
|
|
|
|
$logFileSize = filesize($logFilePath);
|
|
|
|
}
|
2014-08-18 07:40:42 +00:00
|
|
|
$config = \OC::$server->getConfig();
|
2014-10-30 12:44:40 +00:00
|
|
|
$appConfig = \OC::$server->getAppConfig();
|
2015-02-10 12:02:48 +00:00
|
|
|
$request = \OC::$server->getRequest();
|
2012-08-04 15:38:31 +00:00
|
|
|
|
2014-03-05 13:53:20 +00:00
|
|
|
// Should we display sendmail as an option?
|
2014-11-20 11:37:59 +00:00
|
|
|
$template->assign('sendmail_is_available', (bool) \OC_Helper::findBinaryPath('sendmail'));
|
2014-10-30 12:44:40 +00:00
|
|
|
|
|
|
|
$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);
|
2014-12-20 21:44:41 +00:00
|
|
|
$template->assign('logFileSize', $logFileSize);
|
|
|
|
$template->assign('doesLogFileExist', $doesLogFileExist);
|
|
|
|
$template->assign('showLog', $showLog);
|
2014-11-25 15:12:12 +00:00
|
|
|
$template->assign('readOnlyConfigEnabled', OC_Helper::isReadOnlyConfigEnabled());
|
2014-10-30 12:44:40 +00:00
|
|
|
$template->assign('isLocaleWorking', OC_Util::isSetLocaleWorking());
|
|
|
|
$template->assign('isAnnotationsWorking', OC_Util::isAnnotationsWorking());
|
|
|
|
$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', '');
|
2014-09-10 12:30:02 +00:00
|
|
|
$excludedGroupsList = explode(',', $excludedGroupsList); // FIXME: this should be JSON!
|
2014-10-30 12:44:40 +00:00
|
|
|
$template->assign('shareExcludedGroupsList', implode('|', $excludedGroupsList));
|
2015-01-14 19:39:23 +00:00
|
|
|
$template->assign('encryptionEnabled', \OC::$server->getEncryptionManager()->isEnabled());
|
2015-04-09 14:07:15 +00:00
|
|
|
$backends = \OC::$server->getUserManager()->getBackends();
|
|
|
|
$externalBackends = (count($backends) > 1) ? true : false;
|
2015-04-07 16:05:54 +00:00
|
|
|
$template->assign('encryptionReady', \OC::$server->getEncryptionManager()->isReady());
|
2015-04-09 14:07:15 +00:00
|
|
|
$template->assign('externalBackendsEnabled', $externalBackends);
|
2015-04-20 09:11:52 +00:00
|
|
|
|
2015-01-14 19:39:23 +00:00
|
|
|
$encryptionModules = \OC::$server->getEncryptionManager()->getEncryptionModules();
|
2015-04-20 09:11:52 +00:00
|
|
|
$defaultEncryptionModuleId = \OC::$server->getEncryptionManager()->getDefaultEncryptionModuleId();
|
2015-04-09 14:07:15 +00:00
|
|
|
|
2015-01-14 19:39:23 +00:00
|
|
|
$encModulues = array();
|
|
|
|
foreach ($encryptionModules as $module) {
|
2015-04-14 14:48:39 +00:00
|
|
|
$encModulues[$module['id']]['displayName'] = $module['displayName'];
|
|
|
|
$encModulues[$module['id']]['default'] = false;
|
2015-04-18 08:20:13 +00:00
|
|
|
if ($module['id'] === $defaultEncryptionModuleId) {
|
2015-04-14 14:48:39 +00:00
|
|
|
$encModulues[$module['id']]['default'] = true;
|
2015-01-14 19:39:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
$template->assign('encryptionModules', $encModulues);
|
2013-01-11 13:18:51 +00:00
|
|
|
|
2014-10-30 12:44:40 +00:00
|
|
|
// If the current web root is non-empty but the web root from the config is,
|
2014-08-18 07:40:42 +00:00
|
|
|
// and system cron is used, the URL generator fails to build valid URLs.
|
2015-01-07 08:02:33 +00:00
|
|
|
$shouldSuggestOverwriteCliUrl = $config->getAppValue('core', 'backgroundjobs_mode', 'ajax') === 'cron' &&
|
2014-08-18 07:40:42 +00:00
|
|
|
\OC::$WEBROOT && \OC::$WEBROOT !== '/' &&
|
2015-01-07 08:02:33 +00:00
|
|
|
!$config->getSystemValue('overwrite.cli.url', '');
|
|
|
|
$suggestedOverwriteCliUrl = ($shouldSuggestOverwriteCliUrl) ? \OC::$WEBROOT : '';
|
|
|
|
$template->assign('suggestedOverwriteCliUrl', $suggestedOverwriteCliUrl);
|
2014-06-03 06:01:39 +00:00
|
|
|
|
2014-10-30 12:44:40 +00:00
|
|
|
$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'));
|
2014-09-22 10:13:44 +00:00
|
|
|
$template->assign('allowPublicMailNotification', $appConfig->getValue('core', 'shareapi_allow_public_notification', 'no'));
|
2014-10-30 12:44:40 +00:00
|
|
|
$template->assign('allowMailNotification', $appConfig->getValue('core', 'shareapi_allow_mail_notification', 'no'));
|
|
|
|
$template->assign('onlyShareWithGroupMembers', \OC\Share\Share::shareWithGroupMembersOnly());
|
2014-06-03 10:02:23 +00:00
|
|
|
$databaseOverload = (strpos(\OCP\Config::getSystemValue('dbtype'), 'sqlite') !== false);
|
2014-10-30 12:44:40 +00:00
|
|
|
$template->assign('databaseOverload', $databaseOverload);
|
2015-02-27 19:04:52 +00:00
|
|
|
$template->assign('cronErrors', $appConfig->getValue('core', 'cronErrors'));
|
2014-10-30 12:44:40 +00:00
|
|
|
|
2015-04-23 08:58:13 +00:00
|
|
|
// warn if php is not setup properly to get system variables with getenv
|
2015-04-27 12:28:31 +00:00
|
|
|
$path = getenv('PATH');
|
|
|
|
$template->assign('getenvServerNotWorking', empty($path));
|
2015-04-23 08:58:13 +00:00
|
|
|
|
2015-01-18 17:50:46 +00:00
|
|
|
// warn if Windows is used
|
|
|
|
$template->assign('WindowsWarning', OC_Util::runningOnWindows());
|
2014-10-30 12:44:40 +00:00
|
|
|
|
2015-06-02 13:03:27 +00:00
|
|
|
// 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);
|
2015-02-16 21:36:08 +00:00
|
|
|
|
2014-10-30 12:44:40 +00:00
|
|
|
// add hardcoded forms from the template
|
|
|
|
$forms = OC_App::getForms('admin');
|
|
|
|
$formsAndMore = array();
|
2015-02-10 12:02:48 +00:00
|
|
|
if ($request->getServerProtocol() !== 'https' || !OC_Util::isAnnotationsWorking() ||
|
2015-02-24 22:34:38 +00:00
|
|
|
$suggestedOverwriteCliUrl || !OC_Util::isSetLocaleWorking() ||
|
2014-12-04 09:45:28 +00:00
|
|
|
!OC_Util::fileInfoLoaded() || $databaseOverload
|
2014-10-30 12:44:40 +00:00
|
|
|
) {
|
2015-03-23 13:27:57 +00:00
|
|
|
$formsAndMore[] = array('anchor' => 'security-warning', 'section-name' => $l->t('Security & setup warnings'));
|
2014-10-30 12:44:40 +00:00
|
|
|
}
|
2015-03-26 19:26:41 +00:00
|
|
|
$formsAndMore[] = array('anchor' => 'shareAPI', 'section-name' => $l->t('Sharing'));
|
2015-05-04 09:51:02 +00:00
|
|
|
$formsAndMore[] = ['anchor' => 'encryptionAPI', 'section-name' => $l->t('Server-side encryption')];
|
2015-03-26 19:26:41 +00:00
|
|
|
|
|
|
|
// Prioritize fileSharingSettings and files_external and move updater to the version
|
2015-05-04 09:51:02 +00:00
|
|
|
$fileSharingSettings = $filesExternal = $updaterAppPanel = $ocDefaultEncryptionModulePanel = '';
|
2015-03-26 19:26:41 +00:00
|
|
|
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;
|
|
|
|
}
|
2015-05-04 09:51:02 +00:00
|
|
|
if (strpos($form, 'id="ocDefaultEncryptionModule"')) {
|
|
|
|
$ocDefaultEncryptionModulePanel = $form;
|
|
|
|
unset($forms[$index]);
|
|
|
|
continue;
|
|
|
|
}
|
2015-03-26 19:26:41 +00:00
|
|
|
}
|
|
|
|
if ($filesExternal) {
|
|
|
|
$formsAndMore[] = array('anchor' => 'files_external', 'section-name' => $l->t('External Storage'));
|
|
|
|
}
|
2015-03-31 12:50:31 +00:00
|
|
|
|
2015-03-26 19:26:41 +00:00
|
|
|
$template->assign('fileSharingSettings', $fileSharingSettings);
|
|
|
|
$template->assign('filesExternal', $filesExternal);
|
|
|
|
$template->assign('updaterAppPanel', $updaterAppPanel);
|
2015-05-04 09:51:02 +00:00
|
|
|
$template->assign('ocDefaultEncryptionModulePanel', $ocDefaultEncryptionModulePanel);
|
2015-05-29 09:54:05 +00:00
|
|
|
if (\OC::$server->getLockingProvider() instanceof NoopLockingProvider) {
|
|
|
|
$template->assign('fileLockingEnabled', false);
|
|
|
|
} else {
|
|
|
|
$template->assign('fileLockingEnabled', true);
|
|
|
|
}
|
2014-10-30 12:44:40 +00:00
|
|
|
|
|
|
|
$formsMap = array_map(function ($form) {
|
2015-07-26 20:56:16 +00:00
|
|
|
if (preg_match('%(<h2(?P<class>[^>]*)>.*?</h2>)%i', $form, $regs)) {
|
|
|
|
$sectionName = str_replace('<h2'.$regs['class'].'>', '', $regs[0]);
|
2014-10-30 12:44:40 +00:00
|
|
|
$sectionName = str_replace('</h2>', '', $sectionName);
|
|
|
|
$anchor = strtolower($sectionName);
|
|
|
|
$anchor = str_replace(' ', '-', $anchor);
|
|
|
|
|
|
|
|
return array(
|
2014-11-11 17:26:42 +00:00
|
|
|
'anchor' => 'goto-' . $anchor,
|
2014-10-30 12:44:40 +00:00
|
|
|
'section-name' => $sectionName,
|
|
|
|
'form' => $form
|
|
|
|
);
|
|
|
|
}
|
|
|
|
return array(
|
|
|
|
'form' => $form
|
|
|
|
);
|
|
|
|
}, $forms);
|
|
|
|
|
|
|
|
$formsAndMore = array_merge($formsAndMore, $formsMap);
|
|
|
|
|
|
|
|
// add bottom hardcoded forms from the template
|
2015-03-31 12:50:31 +00:00
|
|
|
$formsAndMore[] = ['anchor' => 'backgroundjobs', 'section-name' => $l->t('Cron')];
|
2015-04-17 15:57:25 +00:00
|
|
|
$formsAndMore[] = ['anchor' => 'mail_general_settings', 'section-name' => $l->t('Email server')];
|
2015-03-31 12:50:31 +00:00
|
|
|
$formsAndMore[] = ['anchor' => 'log-section', 'section-name' => $l->t('Log')];
|
2015-07-30 15:34:09 +00:00
|
|
|
$formsAndMore[] = ['anchor' => 'server-status', 'section-name' => $l->t('Server status')];
|
2015-03-31 12:50:31 +00:00
|
|
|
$formsAndMore[] = ['anchor' => 'admin-tips', 'section-name' => $l->t('Tips & tricks')];
|
2015-03-26 21:34:32 +00:00
|
|
|
if ($updaterAppPanel) {
|
2015-03-31 12:50:31 +00:00
|
|
|
$formsAndMore[] = ['anchor' => 'updater', 'section-name' => $l->t('Updates')];
|
2015-03-26 21:34:32 +00:00
|
|
|
}
|
2014-10-30 12:44:40 +00:00
|
|
|
|
|
|
|
$template->assign('forms', $formsAndMore);
|
2014-06-03 06:01:39 +00:00
|
|
|
|
2014-10-30 12:44:40 +00:00
|
|
|
$template->printPage();
|