X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=blobdiff_plain;f=plugins%2Ffortune%2Ffunctions.php;h=059a9db43cdb39019a8f55e3a3519c454f3f994d;hp=460e6e2ef44b62748aab5af9d48422d6f8678ce7;hb=75b7d0427336801badc83fecdd4b25da55c6bb81;hpb=6c84ba1ec45ab854c37b6f65c5b4d84ab1c7aad4 diff --git a/plugins/fortune/functions.php b/plugins/fortune/functions.php index 460e6e2e..059a9db4 100644 --- a/plugins/fortune/functions.php +++ b/plugins/fortune/functions.php @@ -1,8 +1,9 @@ \n". - "
\n". - "
\n"; - echo '
'; - if (!$exist) { - echo sprintf(_("%s is not found."),$fortune_location); - } else { - echo "
" . _("Today's Fortune") . "
\n";
-        htmlspecialchars(system($fortune_command));
-        echo "
\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'); } -?>