HTML escaping.
[squirrelmail.git] / plugins / newmail / newmail_opt.php
CommitLineData
4508b1b6 1<?php
2d4c15d6 2
8d6a115b 3/**
4 * newmails_opt.php
5 *
82d304a0 6 * Copyright (c) 1999-2004 The SquirrelMail Project Team
8d6a115b 7 * Licensed under the GNU GPL. For full terms see the file COPYING.
8 *
9 * Displays all options relating to new mail sounds
10 *
11 * $Id$
ea5f4b8e 12 * @package plugins
13 * @subpackage newmail
8d6a115b 14 */
4508b1b6 15
ea5f4b8e 16/** @ignore */
8d6a115b 17define('SM_PATH','../../');
d0dbdb14 18
8d6a115b 19/* SquirrelMail required files. */
20require_once(SM_PATH . 'include/validate.php');
21require_once(SM_PATH . 'functions/page_header.php');
22require_once(SM_PATH . 'functions/display_messages.php');
23require_once(SM_PATH . 'functions/imap.php');
8d6a115b 24require_once(SM_PATH . 'include/load_prefs.php');
3d75ef16 25
692ca6b7 26displayPageHeader($color, 'None');
3d75ef16 27
692ca6b7 28$media_enable = getPref($data_dir,$username, 'newmail_enable', 'FALSE' );
29$media_popup = getPref($data_dir, $username,'newmail_popup');
30$media_allbox = getPref($data_dir,$username,'newmail_allbox');
31$media_recent = getPref($data_dir,$username,'newmail_recent');
32$media_changetitle = getPref($data_dir,$username,'newmail_changetitle');
33$media = getPref($data_dir,$username,'newmail_media', '(none)');
3d75ef16 34
692ca6b7 35// Set $allowsound to false if you don't want sound files available
36$allowsound = "true";
412303e0 37
692ca6b7 38echo html_tag( 'table', '', 'center', '', 'width="95%" border="0" cellpadding="1" cellspacing="0"' ) . "\n" .
39 html_tag( 'tr', "\n" .
4cf43843 40 html_tag( 'td', '<b>' . _("Options") . ' - ' . _("New Mail Notification") . '</b>', 'center', $color[0] )
692ca6b7 41 ) . "\n" .
4cf43843 42 html_tag( 'tr' ) . "\n" .
43 html_tag( 'td', '', 'left' );
692ca6b7 44if ($allowsound == "true") {
45 echo html_tag( 'p',
4cf43843 46 _("Select <b>Enable Media Playing</b> to turn on playing a media file when unseen mail is in your folders. When enabled, you can specify the media file to play in the provided file box.")
692ca6b7 47 ) . "\n";
48}
49 echo html_tag( 'p',
50 _("The <b>Check all boxes, not just INBOX</b> option will check ALL of your folders for unseen mail, not just the inbox for notification.")
51 ) . "\n" .
52 html_tag( 'p',
4cf43843 53 _("Selecting the <b>Show popup</b> option will enable the showing of a popup window when unseen mail is in your folders (requires JavaScript).")
54 ) . "\n" .
55 html_tag( 'p',
56 _("Use the <b>Check RECENT</b> to only check for messages that are recent. Recent messages are those that have just recently showed up and have not been \"viewed\" or checked yet. This can prevent being continuously annoyed by sounds or popups for unseen mail.")
57 ) . "\n" .
58 html_tag( 'p',
59 _("Selecting the <b>Change title</b> option will change the title in some browsers to let you know when you have new mail (requires JavaScript, and only works in IE but you won't see errors with other browsers). This will always tell you if you have new mail, even if you have <b>Check RECENT</b> enabled.")
60 );
412303e0 61 if ($allowsound == "true") {
4cf43843 62 echo html_tag( 'p',
692ca6b7 63 _("Select from the list of <b>server files</b> the media file to play when new mail arrives. If no file is specified, \"(none)\", no sound will be used.")
4cf43843 64 ) . "\n";
3d75ef16 65 }
692ca6b7 66 echo '<form action="'.sqm_baseuri().'src/options.php" method=post>'.
4cf43843 67 html_tag( 'table', '', '', '', 'width="100%" cellpadding="0" cellspacing="2" border="0"' ) . "\n" .
68 html_tag( 'tr' ) . "\n" .
8e724112 69 html_tag( 'td', '&nbsp;', 'right', '', 'nowrap' ) . "\n";
412303e0 70 if ($allowsound == "true") {
692ca6b7 71 echo html_tag( 'td', '', 'left' ) .
72 '<input type="checkbox" ';
412303e0 73 if ($media_enable == 'on') {
74 echo 'checked ';
75 }
4cf43843 76 echo 'name="media_enable"><b> ' . _("Enable Media Playing") . '</b></td>'.
77 '</tr>' . "\n";
412303e0 78 }
4cf43843 79 echo html_tag( 'tr' ) . "\n" .
8e724112 80 html_tag( 'td', '&nbsp;', 'right', '', 'nowrap' ) . "\n" .
4cf43843 81 html_tag( 'td', '', 'left' ) .
82 '<input type="checkbox" ';
3d75ef16 83 if ($media_allbox == 'on') {
84 echo 'checked ';
85 }
4cf43843 86 echo 'name="media_allbox"><b> ' . _("Check all boxes, not just INBOX") . '</b></td>'.
87 '</tr>'. "\n" .
88 html_tag( 'tr' ) . "\n" .
8e724112 89 html_tag( 'td', '&nbsp;', 'right', '', 'nowrap' ) . "\n" .
4cf43843 90 html_tag( 'td', '', 'left' ) .
91 '<input type="checkbox" ';
3d75ef16 92 if ($media_recent == 'on') {
93 echo 'checked ';
94 }
4cf43843 95 echo 'name="media_recent"><b> ' . _("Count only messages that are RECENT") . '</b></td>'.
96 '</tr>'. "\n" .
97 html_tag( 'tr' ) . "\n" .
8e724112 98 html_tag( 'td', '&nbsp;', 'right', '', 'nowrap' ) . "\n" .
4cf43843 99 html_tag( 'td', '', 'left' ) .
100 '<input type="checkbox" ';
3d75ef16 101 if ($media_changetitle == 'on') {
102 echo 'checked ';
103 }
4cf43843 104 echo 'name="media_changetitle"><b> ' . _("Change title on supported browsers.") . '</b> &nbsp; (' . _("requires JavaScript to work") . ')</td>'.
105 '</tr>'. "\n" .
106 html_tag( 'tr' ) . "\n" .
8e724112 107 html_tag( 'td', '&nbsp;', 'right', '', 'nowrap' ) . "\n" .
4cf43843 108 html_tag( 'td', '', 'left' ) .
109 '<input type="checkbox" ';
3d75ef16 110 if($media_popup == 'on') {
111 echo 'checked ';
112 }
4cf43843 113 echo 'name="media_popup"><b> ' . _("Show popup window on new mail") . '</b> &nbsp; (' . _("requires JavaScript to work") . ')</td>'.
114 '</tr>' . "\n";
412303e0 115 if ($allowsound == "true") {
4cf43843 116 echo html_tag( 'tr' ) . "\n" .
117 html_tag( 'td', _("Select server file:"), 'right', '', 'nowrap' ) . "\n" .
118 html_tag( 'td', '', 'left' ) .
692ca6b7 119 '<select name="media_sel">'. "\n".
120 '<option value="(none)"';
121 if ( $media == '(none)') {
122 echo 'selected ';
123 }
124 echo '>' . _("(none)") . '</option>' . "\n";
3d75ef16 125
126 // Iterate sound files for options
cd7fc9e6 127 $d = dir(SM_PATH . 'plugins/newmail/sounds');
3d75ef16 128 while($entry=$d->read()) {
692ca6b7 129 $fname = get_location () . '/sounds/' . $entry;
130 if ($entry != '..' && $entry != '.' && $entry != 'CVS') {
131 echo '<option ';
3d75ef16 132 if ($fname == $media) {
692ca6b7 133 echo 'selected ';
3d75ef16 134 }
692ca6b7 135 echo 'value="' . $fname . '">' . $entry . "</option>\n";
3d75ef16 136 }
137 }
138 $d->close();
4cf43843 139 echo '</select>'.
3d75ef16 140 '<input type="submit" value=" ' . _("Try") . ' " name="test" onClick="'.
141 "window.open('testsound.php?sound='+media_sel.options[media_sel.selectedIndex].value, 'TestSound',".
692ca6b7 142 "'width=150,height=30,scrollbars=no');".
3d75ef16 143 'return false;'.
144 '">'.
145 '</td>'.
146 '</tr>'.
4cf43843 147 html_tag( 'tr', "\n" .
4cf43843 148 html_tag( 'td', _("Current File:"), 'right', '', 'nowrap' ) .
149 html_tag( 'td', '<input type="hidden" value="' . $media . '" name="media_default">' . $media . '', 'left' )
150 ) . "\n";
412303e0 151 }
4cf43843 152 echo html_tag( 'tr', "\n" .
153 html_tag( 'td', '&nbsp;' ) .
154 html_tag( 'td',
155 '<input type="hidden" name="optmode" value="submit">'.
156 '<input type="submit" value="' . _("Submit") . '" name="submit_newmail">',
157 'left' )
158 ) . "\n" .
159 '</table>'. "\n" .
160 '</form>'. "\n" .
dcc1cc82 161 '</td></tr></table>'. "\n" .
162'</body></html>';
3d75ef16 163
dcc1cc82 164?>