Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2014-03-12 14:47:21 +0400
committerJoas Schilling <nickvergessen@gmx.de>2014-03-12 14:47:21 +0400
commitefbca04ab42112e617b81153c68ae51f29241663 (patch)
tree15891a2b01ef2ea874746c01c2d13ecf75e55503 /settings
parent0285d5b6e27302378fff18cfc2e4f3ef0c0ce5eb (diff)
Use command -v to check for sendmail
Fix #7559
Diffstat (limited to 'settings')
-rwxr-xr-xsettings/admin.php16
1 files changed, 15 insertions, 1 deletions
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;
+}