X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=blobdiff_plain;f=plugins%2Ffortune%2Ffunctions.php;h=059a9db43cdb39019a8f55e3a3519c454f3f994d;hp=fe1b9c627428c134400fde15faa36bee89564224;hb=7f0dbd10f69bc6e80ae98f86bca0b970e2131f1a;hpb=ee2375c0962984cbdf0c05a204e7e8eab8fb279a;ds=inline
diff --git a/plugins/fortune/functions.php b/plugins/fortune/functions.php
index fe1b9c62..059a9db4 100644
--- a/plugins/fortune/functions.php
+++ b/plugins/fortune/functions.php
@@ -1,8 +1,9 @@
\n".
- "\n".
- "\n";
- echo '';
- if (!$exist) {
- printf(_("%s is not found."),$fortune_location);
- } else {
- echo "" . _("Today's Fortune") . "\n" .
- htmlspecialchars(shell_exec($fortune_command)) .
- " \n";
+ /* if pclose return != 0, popen command failed. Yes, I know that it is broken when --enable-sigchild is used */
+ if (pclose($handle)) {
+ // i18n: %s shows executed fortune cookie command.
+ $fortune = sprintf(_("Unable to execute \"%s\"."),$fortune_command);
}
- echo ' |
| |
';
+ $oTemplate->assign('color', $color);
+ $oTemplate->assign('fortune', htmlspecialchars($fortune));
+ $output = $oTemplate->fetch('plugins/fortune/mailbox_index_before.tpl');
+ return array('mailbox_index_before' => $output);
+
}
/**
@@ -90,4 +83,3 @@ function fortune_function_load() {
$fortune_visible = getPref($data_dir, $username, 'fortune_visible');
}
-?>