rtl alignment fix
[squirrelmail.git] / plugins / fortune / setup.php
CommitLineData
9b5edd1d 1<?php
2
3/**
4 * plugins/fortune/setup.php
5 *
76911253 6 * Copyright (c) 1999-2003 The SquirrelMail Project Team
9b5edd1d 7 * Licensed under the GNU GPL. For full terms see the file COPYING.
8 *
9 * Original code contributed by paulm@spider.org
10 *
11 * Simple SquirrelMail WebMail Plugin that displays the output of
12 * fortune above the message listing.
13 *
14 * $Id$
ea5f4b8e 15 * @package plugins
16 * @subpackage fortune
9b5edd1d 17 */
18
ea5f4b8e 19/**
20*
21*/
9b5edd1d 22function squirrelmail_plugin_init_fortune() {
23 global $squirrelmail_plugin_hooks;
24
25 $squirrelmail_plugin_hooks['mailbox_index_before']['fortune'] = 'fortune';
26 $squirrelmail_plugin_hooks['options_display_inside']['fortune'] = 'fortune_options';
27 $squirrelmail_plugin_hooks['options_display_save']['fortune'] = 'fortune_save';
28 $squirrelmail_plugin_hooks['loading_prefs']['fortune'] = 'fortune_load';
29}
30
31function fortune() {
32 global $fortune_visible, $color;
33
34 if (!$fortune_visible) {
35 return;
36 }
37
38 $fortune_location = '/usr/games/fortune';
ecaf45ec 39 $exist = file_exists($fortune_location);
9b5edd1d 40 echo "<center><table cellpadding=0 cellspacing=0 border=0 bgcolor=$color[10]><tr><td><table width=100% cellpadding=2 cellspacing=1 border=0 bgcolor=\"$color[5]\"><tr><td align=center>";
41 echo '<TABLE><TR><TD>';
42 if (!$exist) {
75d3419e 43 echo "$fortune_location" . _(" not found.");
9b5edd1d 44 } else {
75d3419e 45 echo "<CENTER><FONT=3><EM>" . _("Today's Fortune") . "</EM><BR></FONT></CENTER><pre>";
9b5edd1d 46 system($fortune_location);
47 }
48
49 echo '</pre></TD></TR></TABLE></td></tr></table></td></tr></table></center>';
50}
51
52function fortune_load() {
53 global $username, $data_dir, $fortune_visible;
54
55 $fortune_visible = getPref($data_dir, $username, 'fortune_visible');
56}
57
58function fortune_options() {
59 global $fortune_visible;
60
a75e70b1 61 echo "<tr>" . html_tag('td',_("Fortunes:"),'right','','nowrap') . "\n";
9b5edd1d 62 echo '<td><input name="fortune_fortune_visible" type=CHECKBOX';
63 if ($fortune_visible)
64 echo ' CHECKED';
75d3419e 65 echo "> " . _("Show fortunes at top of mailbox") . "</td></tr>\n";
9b5edd1d 66}
67
68function fortune_save() {
69 global $username,$data_dir;
9b5edd1d 70
6a85a764 71 if (isset($_POST['fortune_fortune_visible'])) {
9b5edd1d 72 setPref($data_dir, $username, 'fortune_visible', '1');
73 } else {
74 setPref($data_dir, $username, 'fortune_visible', '');
75 }
76}
77
78?>