2011-08-23 03:40:13 +04:00
|
|
|
<?php
|
|
|
|
/**
|
2015-02-26 13:37:37 +03:00
|
|
|
* Copyright (c) 2011, Robin Appelman <icewind1991@gmail.com>
|
|
|
|
* This file is licensed under the Affero General Public License version 3 or later.
|
|
|
|
* See the COPYING-README file.
|
2011-08-23 03:40:13 +04:00
|
|
|
*/
|
2015-02-26 13:37:37 +03:00
|
|
|
|
2011-09-18 23:31:56 +04:00
|
|
|
OC_Util::checkAdminUser();
|
2014-10-30 15:44:40 +03:00
|
|
|
OC_App::setActiveNavigationEntry("admin");
|
2011-08-23 03:40:13 +04:00
|
|
|
|
2014-10-30 15:44:40 +03:00
|
|
|
$template = new OC_Template('settings', 'admin', 'user');
|
|
|
|
|
2014-12-21 00:44:41 +03: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);
|
|
|
|
$logFileSize = filesize($logFilePath);
|
2014-08-18 11:40:42 +04:00
|
|
|
$config = \OC::$server->getConfig();
|
2014-10-30 15:44:40 +03:00
|
|
|
$appConfig = \OC::$server->getAppConfig();
|
2015-02-10 15:02:48 +03:00
|
|
|
$request = \OC::$server->getRequest();
|
2012-08-04 19:38:31 +04:00
|
|
|
|
2014-03-05 17:53:20 +04:00
|
|
|
// Should we display sendmail as an option?
|
2014-11-20 14:37:59 +03:00
|
|
|
$template->assign('sendmail_is_available', (bool) \OC_Helper::findBinaryPath('sendmail'));
|
2014-10-30 15:44:40 +03: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-21 00:44:41 +03:00
|
|
|
$template->assign('logFileSize', $logFileSize);
|
|
|
|
$template->assign('doesLogFileExist', $doesLogFileExist);
|
|
|
|
$template->assign('showLog', $showLog);
|
2014-11-25 18:12:12 +03:00
|
|
|
$template->assign('readOnlyConfigEnabled', OC_Helper::isReadOnlyConfigEnabled());
|
2014-10-30 15:44:40 +03: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 16:30:02 +04:00
|
|
|
$excludedGroupsList = explode(',', $excludedGroupsList); // FIXME: this should be JSON!
|
2014-10-30 15:44:40 +03:00
|
|
|
$template->assign('shareExcludedGroupsList', implode('|', $excludedGroupsList));
|
2013-01-11 17:18:51 +04:00
|
|
|
|
|
|
|
// Check if connected using HTTPS
|
2015-02-10 15:02:48 +03:00
|
|
|
$template->assign('isConnectedViaHTTPS', $request->getServerProtocol() === 'https');
|
2014-11-03 12:55:52 +03:00
|
|
|
$template->assign('enforceHTTPSEnabled', $config->getSystemValue('forcessl', false));
|
|
|
|
$template->assign('forceSSLforSubdomainsEnabled', $config->getSystemValue('forceSSLforSubdomains', false));
|
2013-01-11 17:18:51 +04:00
|
|
|
|
2014-10-30 15:44:40 +03:00
|
|
|
// If the current web root is non-empty but the web root from the config is,
|
2014-08-18 11:40:42 +04:00
|
|
|
// and system cron is used, the URL generator fails to build valid URLs.
|
2015-01-07 11:02:33 +03:00
|
|
|
$shouldSuggestOverwriteCliUrl = $config->getAppValue('core', 'backgroundjobs_mode', 'ajax') === 'cron' &&
|
2014-08-18 11:40:42 +04:00
|
|
|
\OC::$WEBROOT && \OC::$WEBROOT !== '/' &&
|
2015-01-07 11:02:33 +03:00
|
|
|
!$config->getSystemValue('overwrite.cli.url', '');
|
|
|
|
$suggestedOverwriteCliUrl = ($shouldSuggestOverwriteCliUrl) ? \OC::$WEBROOT : '';
|
|
|
|
$template->assign('suggestedOverwriteCliUrl', $suggestedOverwriteCliUrl);
|
2014-06-03 10:01:39 +04:00
|
|
|
|
2014-10-30 15:44:40 +03: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 14:13:44 +04:00
|
|
|
$template->assign('allowPublicMailNotification', $appConfig->getValue('core', 'shareapi_allow_public_notification', 'no'));
|
2014-10-30 15:44:40 +03:00
|
|
|
$template->assign('allowMailNotification', $appConfig->getValue('core', 'shareapi_allow_mail_notification', 'no'));
|
|
|
|
$template->assign('onlyShareWithGroupMembers', \OC\Share\Share::shareWithGroupMembersOnly());
|
2014-06-03 14:02:23 +04:00
|
|
|
$databaseOverload = (strpos(\OCP\Config::getSystemValue('dbtype'), 'sqlite') !== false);
|
2014-10-30 15:44:40 +03:00
|
|
|
$template->assign('databaseOverload', $databaseOverload);
|
|
|
|
|
2015-01-18 20:50:46 +03:00
|
|
|
// warn if Windows is used
|
|
|
|
$template->assign('WindowsWarning', OC_Util::runningOnWindows());
|
2014-10-30 15:44:40 +03:00
|
|
|
|
2015-02-17 00:36:08 +03:00
|
|
|
// warn if outdated version of APCu is used
|
|
|
|
$template->assign('ApcuOutdatedWarning',
|
|
|
|
extension_loaded('apcu') && version_compare(phpversion('apc'), '4.0.6') === -1);
|
|
|
|
|
2014-10-30 15:44:40 +03:00
|
|
|
// add hardcoded forms from the template
|
|
|
|
$forms = OC_App::getForms('admin');
|
|
|
|
$l = OC_L10N::get('settings');
|
|
|
|
$formsAndMore = array();
|
2015-02-10 15:02:48 +03:00
|
|
|
if ($request->getServerProtocol() !== 'https' || !OC_Util::isAnnotationsWorking() ||
|
2015-02-25 01:34:38 +03:00
|
|
|
$suggestedOverwriteCliUrl || !OC_Util::isSetLocaleWorking() ||
|
2014-12-04 12:45:28 +03:00
|
|
|
!OC_Util::fileInfoLoaded() || $databaseOverload
|
2014-10-30 15:44:40 +03:00
|
|
|
) {
|
|
|
|
$formsAndMore[] = array('anchor' => 'security-warning', 'section-name' => $l->t('Security & Setup Warnings'));
|
|
|
|
}
|
|
|
|
|
|
|
|
$formsMap = array_map(function ($form) {
|
|
|
|
if (preg_match('%(<h2[^>]*>.*?</h2>)%i', $form, $regs)) {
|
|
|
|
$sectionName = str_replace('<h2>', '', $regs[0]);
|
|
|
|
$sectionName = str_replace('</h2>', '', $sectionName);
|
|
|
|
$anchor = strtolower($sectionName);
|
|
|
|
$anchor = str_replace(' ', '-', $anchor);
|
|
|
|
|
|
|
|
return array(
|
2014-11-11 20:26:42 +03:00
|
|
|
'anchor' => 'goto-' . $anchor,
|
2014-10-30 15:44:40 +03:00
|
|
|
'section-name' => $sectionName,
|
|
|
|
'form' => $form
|
|
|
|
);
|
|
|
|
}
|
|
|
|
return array(
|
|
|
|
'form' => $form
|
|
|
|
);
|
|
|
|
}, $forms);
|
|
|
|
|
|
|
|
$formsAndMore = array_merge($formsAndMore, $formsMap);
|
|
|
|
|
|
|
|
// add bottom hardcoded forms from the template
|
|
|
|
$formsAndMore[] = array('anchor' => 'backgroundjobs', 'section-name' => $l->t('Cron'));
|
|
|
|
$formsAndMore[] = array('anchor' => 'shareAPI', 'section-name' => $l->t('Sharing'));
|
|
|
|
$formsAndMore[] = array('anchor' => 'security', 'section-name' => $l->t('Security'));
|
|
|
|
$formsAndMore[] = array('anchor' => 'mail_general_settings', 'section-name' => $l->t('Email Server'));
|
2014-10-30 16:59:13 +03:00
|
|
|
$formsAndMore[] = array('anchor' => 'log-section', 'section-name' => $l->t('Log'));
|
2014-10-30 15:44:40 +03:00
|
|
|
|
|
|
|
$template->assign('forms', $formsAndMore);
|
2014-06-03 10:01:39 +04:00
|
|
|
|
2014-10-30 15:44:40 +03:00
|
|
|
$template->printPage();
|