admin.php 5.06 KB
Newer Older
1
2
3
4
5
6
7
<?php
/**
 * 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.
 */

8
OC_Util::checkAdminUser();
9
10

OC_Util::addStyle( "settings", "settings" );
Robin Appelman's avatar
Robin Appelman committed
11
OC_Util::addScript( "settings", "admin" );
Robin Appelman's avatar
Robin Appelman committed
12
OC_Util::addScript( "settings", "log" );
13
OC_Util::addScript( 'core', 'multiselect' );
14
15
16
17
OC_App::setActiveNavigationEntry( "admin" );

$tmpl = new OC_Template( 'settings', 'admin', 'user');
$forms=OC_App::getForms('admin');
Lukas Reschke's avatar
Lukas Reschke committed
18
$htaccessworking=OC_Util::isHtaccessWorking();
Robin Appelman's avatar
Robin Appelman committed
19
20

$entries=OC_Log_Owncloud::getEntries(3);
21
$entriesremain = count(OC_Log_Owncloud::getEntries(4)) > 3;
22
$config = \OC::$server->getConfig();
23

24
// Should we display sendmail as an option?
25
$tmpl->assign('sendmail_is_available', (bool) findBinaryPath('sendmail'));
26

27
$tmpl->assign('loglevel', OC_Config::getValue( "loglevel", 2 ));
28
29
30
31
32
33
34
35
36
37
$tmpl->assign('mail_domain', OC_Config::getValue( "mail_domain", '' ));
$tmpl->assign('mail_from_address', OC_Config::getValue( "mail_from_address", '' ));
$tmpl->assign('mail_smtpmode', OC_Config::getValue( "mail_smtpmode", '' ));
$tmpl->assign('mail_smtpsecure', OC_Config::getValue( "mail_smtpsecure", '' ));
$tmpl->assign('mail_smtphost', OC_Config::getValue( "mail_smtphost", '' ));
$tmpl->assign('mail_smtpport', OC_Config::getValue( "mail_smtpport", '' ));
$tmpl->assign('mail_smtpauthtype', OC_Config::getValue( "mail_smtpauthtype", '' ));
$tmpl->assign('mail_smtpauth', OC_Config::getValue( "mail_smtpauth", false ));
$tmpl->assign('mail_smtpname', OC_Config::getValue( "mail_smtpname", '' ));
$tmpl->assign('mail_smtppassword', OC_Config::getValue( "mail_smtppassword", '' ));
Felix Moeller's avatar
Felix Moeller committed
38
$tmpl->assign('entries', $entries);
39
$tmpl->assign('entriesremain', $entriesremain);
Felix Moeller's avatar
Felix Moeller committed
40
$tmpl->assign('htaccessworking', $htaccessworking);
41
$tmpl->assign('internetconnectionworking', OC_Util::isInternetConnectionEnabled() ? OC_Util::isInternetConnectionWorking() : 'disabled');
Bart Visscher's avatar
Bart Visscher committed
42
$tmpl->assign('isLocaleWorking', OC_Util::isSetLocaleWorking());
43
$tmpl->assign('isPhpCharSetUtf8', OC_Util::isPhpCharSetUtf8());
44
$tmpl->assign('isAnnotationsWorking', OC_Util::isAnnotationsWorking());
45
$tmpl->assign('isWebDavWorking', OC_Util::isWebDAVWorking());
46
$tmpl->assign('has_fileinfo', OC_Util::fileInfoLoaded());
47
$tmpl->assign('old_php', OC_Util::isPHPoutdated());
48
$tmpl->assign('backgroundjobs_mode', OC_Appconfig::getValue('core', 'backgroundjobs_mode', 'ajax'));
kondou's avatar
kondou committed
49
50
$tmpl->assign('cron_log', OC_Config::getValue('cron_log', true));
$tmpl->assign('lastcron', OC_Appconfig::getValue('core', 'lastcron', false));
51
$tmpl->assign('shareAPIEnabled', OC_Appconfig::getValue('core', 'shareapi_enabled', 'yes'));
52
53
54
$tmpl->assign('shareDefaultExpireDateSet', OC_Appconfig::getValue('core', 'shareapi_default_expire_date', 'no'));
$tmpl->assign('shareExpireAfterNDays', OC_Appconfig::getValue('core', 'shareapi_expire_after_n_days', '7'));
$tmpl->assign('shareEnforceExpireDate', OC_Appconfig::getValue('core', 'shareapi_enforce_expire_date', 'no'));
55
56
57
$excludeGroups = OC_Appconfig::getValue('core', 'shareapi_exclude_groups', 'no') === 'yes' ? true : false;
$tmpl->assign('shareExcludeGroups', $excludeGroups);
$excludedGroupsList = OC_Appconfig::getValue('core', 'shareapi_exclude_groups_list', '');
58
$tmpl->assign('shareExcludedGroupsList', $excludedGroupsList);
59
60

// Check if connected using HTTPS
61
$tmpl->assign('isConnectedViaHTTPS', OC_Request::serverProtocol() === 'https');
62
$tmpl->assign('enforceHTTPSEnabled', OC_Config::getValue( "forcessl", false));
63

64
65
66
67
68
69
70
// If the current webroot is non-empty but the webroot from the config is,
// and system cron is used, the URL generator fails to build valid URLs.
$shouldSuggestOverwriteWebroot = $config->getAppValue('core', 'backgroundjobs_mode', 'ajax') === 'cron' &&
	\OC::$WEBROOT && \OC::$WEBROOT !== '/' &&
	!$config->getSystemValue('overwritewebroot', '');
$tmpl->assign('suggestedOverwriteWebroot', ($shouldSuggestOverwriteWebroot) ? \OC::$WEBROOT : '');

71
$tmpl->assign('allowLinks', OC_Appconfig::getValue('core', 'shareapi_allow_links', 'yes'));
72
$tmpl->assign('enforceLinkPassword', \OCP\Util::isPublicLinkPasswordRequired());
73
$tmpl->assign('allowPublicUpload', OC_Appconfig::getValue('core', 'shareapi_allow_public_upload', 'yes'));
74
$tmpl->assign('allowResharing', OC_Appconfig::getValue('core', 'shareapi_allow_resharing', 'yes'));
75
$tmpl->assign('allowMailNotification', OC_Appconfig::getValue('core', 'shareapi_allow_mail_notification', 'no'));
Bjoern Schiessle's avatar
Bjoern Schiessle committed
76
$tmpl->assign('onlyShareWithGroupMembers', \OC\Share\Share::shareWithGroupMembersOnly());
Felix Moeller's avatar
Felix Moeller committed
77
$tmpl->assign('forms', array());
Thomas Mueller's avatar
Thomas Mueller committed
78
foreach($forms as $form) {
Felix Moeller's avatar
Felix Moeller committed
79
	$tmpl->append('forms', $form);
80
}
Morris Jobke's avatar
Morris Jobke committed
81

Morris Jobke's avatar
Morris Jobke committed
82
$databaseOverload = (strpos(\OCP\Config::getSystemValue('dbtype'), 'sqlite') !== false);
83
$tmpl->assign('databaseOverload', $databaseOverload);
Morris Jobke's avatar
Morris Jobke committed
84

85
$tmpl->printPage();
86
87
88
89
90
91
92
93

/**
 * Try to find a programm
 *
 * @param string $program
 * @return null|string
 */
function findBinaryPath($program) {
94
95
96
97
98
	if (OC_Helper::is_function_enabled('exec')) {
		exec('command -v ' . escapeshellarg($program) . ' 2> /dev/null', $output, $returnCode);
		if ($returnCode === 0 && count($output) > 0) {
			return escapeshellcmd($output[0]);
		}
99
100
101
	}
	return null;
}