1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Copyright (c) 2011, Robin Appelman <[email protected]> |
4
|
|
|
* This file is licensed under the Affero General Public License version 3 or later. |
5
|
|
|
* See the COPYING-README file. |
6
|
|
|
*/ |
7
|
|
|
|
8
|
|
|
OC_Util::checkAdminUser(); |
9
|
|
|
|
10
|
|
|
OCP\Util::addStyle('settings', 'settings'); |
11
|
|
|
OCP\Util::addScript('settings', 'settings'); |
12
|
|
|
OCP\Util::addScript( "settings", "admin" ); |
13
|
|
|
OCP\Util::addScript( "settings", "log" ); |
14
|
|
|
OCP\Util::addScript( 'core', 'multiselect' ); |
15
|
|
|
OCP\Util::addScript('core', 'select2/select2'); |
16
|
|
|
OCP\Util::addStyle('core', 'select2/select2'); |
17
|
|
|
OCP\Util::addScript('core', 'setupchecks'); |
18
|
|
|
OC_App::setActiveNavigationEntry( "admin" ); |
19
|
|
|
|
20
|
|
|
$tmpl = new OC_Template( 'settings', 'admin', 'user'); |
21
|
|
|
$forms=OC_App::getForms('admin'); |
22
|
|
|
$htaccessworking=OC_Util::isHtaccessWorking(); |
23
|
|
|
|
24
|
|
|
$entries=OC_Log_Owncloud::getEntries(3); |
25
|
|
|
$entriesremain = count(OC_Log_Owncloud::getEntries(4)) > 3; |
26
|
|
|
$config = \OC::$server->getConfig(); |
27
|
|
|
|
28
|
|
|
// Should we display sendmail as an option? |
29
|
|
|
$tmpl->assign('sendmail_is_available', (bool) findBinaryPath('sendmail')); |
30
|
|
|
|
31
|
|
|
$tmpl->assign('loglevel', OC_Config::getValue( "loglevel", 2 )); |
32
|
|
|
$tmpl->assign('mail_domain', OC_Config::getValue( "mail_domain", '' )); |
33
|
|
|
$tmpl->assign('mail_from_address', OC_Config::getValue( "mail_from_address", '' )); |
34
|
|
|
$tmpl->assign('mail_smtpmode', OC_Config::getValue( "mail_smtpmode", '' )); |
35
|
|
|
$tmpl->assign('mail_smtpsecure', OC_Config::getValue( "mail_smtpsecure", '' )); |
36
|
|
|
$tmpl->assign('mail_smtphost', OC_Config::getValue( "mail_smtphost", '' )); |
37
|
|
|
$tmpl->assign('mail_smtpport', OC_Config::getValue( "mail_smtpport", '' )); |
38
|
|
|
$tmpl->assign('mail_smtpauthtype', OC_Config::getValue( "mail_smtpauthtype", '' )); |
39
|
|
|
$tmpl->assign('mail_smtpauth', OC_Config::getValue( "mail_smtpauth", false )); |
40
|
|
|
$tmpl->assign('mail_smtpname', OC_Config::getValue( "mail_smtpname", '' )); |
41
|
|
|
$tmpl->assign('mail_smtppassword', OC_Config::getValue( "mail_smtppassword", '' )); |
42
|
|
|
$tmpl->assign('entries', $entries); |
43
|
|
|
$tmpl->assign('entriesremain', $entriesremain); |
44
|
|
|
$tmpl->assign('htaccessworking', $htaccessworking); |
45
|
|
|
$tmpl->assign('readOnlyConfigEnabled', OC_Helper::isReadOnlyConfigEnabled()); |
46
|
|
|
$tmpl->assign('isLocaleWorking', OC_Util::isSetLocaleWorking()); |
47
|
|
|
$tmpl->assign('isAnnotationsWorking', OC_Util::isAnnotationsWorking()); |
48
|
|
|
$tmpl->assign('has_fileinfo', OC_Util::fileInfoLoaded()); |
49
|
|
|
$tmpl->assign('old_php', OC_Util::isPHPoutdated()); |
50
|
|
|
$tmpl->assign('backgroundjobs_mode', OC_Appconfig::getValue('core', 'backgroundjobs_mode', 'ajax')); |
51
|
|
|
$tmpl->assign('cron_log', OC_Config::getValue('cron_log', true)); |
52
|
|
|
$tmpl->assign('lastcron', OC_Appconfig::getValue('core', 'lastcron', false)); |
|
|
|
|
53
|
|
|
$tmpl->assign('shareAPIEnabled', OC_Appconfig::getValue('core', 'shareapi_enabled', 'yes')); |
54
|
|
|
$tmpl->assign('shareDefaultExpireDateSet', OC_Appconfig::getValue('core', 'shareapi_default_expire_date', 'no')); |
55
|
|
|
$tmpl->assign('shareExpireAfterNDays', OC_Appconfig::getValue('core', 'shareapi_expire_after_n_days', '7')); |
56
|
|
|
$tmpl->assign('shareEnforceExpireDate', OC_Appconfig::getValue('core', 'shareapi_enforce_expire_date', 'no')); |
57
|
|
|
$excludeGroups = OC_Appconfig::getValue('core', 'shareapi_exclude_groups', 'no') === 'yes' ? true : false; |
58
|
|
|
$tmpl->assign('shareExcludeGroups', $excludeGroups); |
59
|
|
|
$excludedGroupsList = OC_Appconfig::getValue('core', 'shareapi_exclude_groups_list', ''); |
60
|
|
|
|
61
|
|
|
$excludedGroupsList = explode(',', $excludedGroupsList); // FIXME: this should be JSON! |
62
|
|
|
$tmpl->assign('shareExcludedGroupsList', implode('|', $excludedGroupsList)); |
63
|
|
|
|
64
|
|
|
// Check if connected using HTTPS |
65
|
|
|
$tmpl->assign('isConnectedViaHTTPS', OC_Request::serverProtocol() === 'https'); |
66
|
|
|
$tmpl->assign('enforceHTTPSEnabled', OC_Config::getValue( "forcessl", false)); |
67
|
|
|
|
68
|
|
|
// If the current webroot is non-empty but the webroot from the config is, |
69
|
|
|
// and system cron is used, the URL generator fails to build valid URLs. |
70
|
|
|
$shouldSuggestOverwriteWebroot = $config->getAppValue('core', 'backgroundjobs_mode', 'ajax') === 'cron' && |
71
|
|
|
\OC::$WEBROOT && \OC::$WEBROOT !== '/' && |
72
|
|
|
!$config->getSystemValue('overwritewebroot', ''); |
73
|
|
|
$tmpl->assign('suggestedOverwriteWebroot', ($shouldSuggestOverwriteWebroot) ? \OC::$WEBROOT : ''); |
74
|
|
|
|
75
|
|
|
$tmpl->assign('allowLinks', OC_Appconfig::getValue('core', 'shareapi_allow_links', 'yes')); |
76
|
|
|
$tmpl->assign('enforceLinkPassword', \OCP\Util::isPublicLinkPasswordRequired()); |
77
|
|
|
$tmpl->assign('allowPublicUpload', OC_Appconfig::getValue('core', 'shareapi_allow_public_upload', 'yes')); |
78
|
|
|
$tmpl->assign('allowResharing', OC_Appconfig::getValue('core', 'shareapi_allow_resharing', 'yes')); |
79
|
|
|
$tmpl->assign('allowMailNotification', OC_Appconfig::getValue('core', 'shareapi_allow_mail_notification', 'no')); |
80
|
|
|
$tmpl->assign('onlyShareWithGroupMembers', \OC\Share\Share::shareWithGroupMembersOnly()); |
81
|
|
|
$tmpl->assign('forms', array()); |
82
|
|
|
foreach($forms as $form) { |
83
|
|
|
$tmpl->append('forms', $form); |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
$databaseOverload = (strpos(\OCP\Config::getSystemValue('dbtype'), 'sqlite') !== false); |
87
|
|
|
$tmpl->assign('databaseOverload', $databaseOverload); |
88
|
|
|
|
89
|
|
|
$tmpl->printPage(); |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* Try to find a programm |
93
|
|
|
* |
94
|
|
|
* @param string $program |
95
|
|
|
* @return null|string |
96
|
|
|
*/ |
97
|
|
View Code Duplication |
function findBinaryPath($program) { |
|
|
|
|
98
|
|
|
if (OC_Helper::is_function_enabled('exec')) { |
99
|
|
|
exec('command -v ' . escapeshellarg($program) . ' 2> /dev/null', $output, $returnCode); |
100
|
|
|
if ($returnCode === 0 && count($output) > 0) { |
101
|
|
|
return escapeshellcmd($output[0]); |
102
|
|
|
} |
103
|
|
|
} |
104
|
|
|
return null; |
105
|
|
|
} |
106
|
|
|
|
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: