From 0285d5b6e27302378fff18cfc2e4f3ef0c0ce5eb Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 5 Mar 2014 14:53:20 +0100 Subject: Hide QMail when not selected and hide sendmail when not available on the server Fix #7559 --- settings/admin.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'settings/admin.php') diff --git a/settings/admin.php b/settings/admin.php index 42477bfc1ca..47028a701db 100755 --- a/settings/admin.php +++ b/settings/admin.php @@ -20,6 +20,11 @@ $htaccessworking=OC_Util::isHtAccessWorking(); $entries=OC_Log_Owncloud::getEntries(3); $entriesremain = count(OC_Log_Owncloud::getEntries(4)) > 3; +// Should we display sendmail as an option? +if (ini_get('sendmail_path') || file_exists('/usr/sbin/sendmail') || file_exists('/var/qmail/bin/sendmail')) { + $tmpl->assign('sendmail_is_available', true); +} + $tmpl->assign('loglevel', OC_Config::getValue( "loglevel", 2 )); $tmpl->assign('mail_domain', OC_Config::getValue( "mail_domain", '' )); $tmpl->assign('mail_from_address', OC_Config::getValue( "mail_from_address", '' )); -- cgit v1.2.3 From efbca04ab42112e617b81153c68ae51f29241663 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 12 Mar 2014 11:47:21 +0100 Subject: Use command -v to check for sendmail Fix #7559 --- settings/admin.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'settings/admin.php') diff --git a/settings/admin.php b/settings/admin.php index 47028a701db..80b038d2ef6 100755 --- a/settings/admin.php +++ b/settings/admin.php @@ -21,7 +21,7 @@ $entries=OC_Log_Owncloud::getEntries(3); $entriesremain = count(OC_Log_Owncloud::getEntries(4)) > 3; // Should we display sendmail as an option? -if (ini_get('sendmail_path') || file_exists('/usr/sbin/sendmail') || file_exists('/var/qmail/bin/sendmail')) { +if (findBinaryPath('sendmailsendmail')) { $tmpl->assign('sendmail_is_available', true); } @@ -66,3 +66,17 @@ foreach($forms as $form) { $tmpl->append('forms', $form); } $tmpl->printPage(); + +/** + * Try to find a programm + * + * @param string $program + * @return null|string + */ +function findBinaryPath($program) { + exec('command -v ' . escapeshellarg($program) . ' 2> /dev/null', $output, $returnCode); + if ($returnCode === 0 && count($output) > 0) { + return escapeshellcmd($output[0]); + } + return null; +} -- cgit v1.2.3