Eliminated all eveil chdir statements.
[squirrelmail.git] / plugins / newmail / newmail_opt.php
CommitLineData
4508b1b6 1<?php
2d4c15d6 2
8d6a115b 3/**
4 * newmails_opt.php
5 *
6 * Copyright (c) 1999-2002 The SquirrelMail Project Team
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$
12 */
4508b1b6 13
8d6a115b 14define('SM_PATH','../../');
d0dbdb14 15
8d6a115b 16/* SquirrelMail required files. */
17require_once(SM_PATH . 'include/validate.php');
18require_once(SM_PATH . 'functions/page_header.php');
19require_once(SM_PATH . 'functions/display_messages.php');
20require_once(SM_PATH . 'functions/imap.php');
21require_once(SM_PATH . 'functions/array.php');
22require_once(SM_PATH . 'include/load_prefs.php');
3d75ef16 23
24 displayPageHeader($color, 'None');
25
cc61478a 26 $media_enable = getPref($data_dir,$username, 'newmail_enable', 'FALSE' );
3d75ef16 27 $media_popup = getPref($data_dir, $username,'newmail_popup');
28 $media_allbox = getPref($data_dir,$username,'newmail_allbox');
29 $media_recent = getPref($data_dir,$username,'newmail_recent');
30 $media_changetitle = getPref($data_dir,$username,'newmail_changetitle');
cc61478a 31 $media = getPref($data_dir,$username,'newmail_media', '../plugins/newmail/sounds/Notify.wav');
3d75ef16 32
412303e0 33 // Set $allowsound to false if you don't want sound files available
34 $allowsound = "true";
35
6206f6c4 36 echo html_tag( 'table', '', 'center', '', 'width="95%" border="0" cellpadding="1" cellspacing="0"' ) . "\n" .
4cf43843 37 html_tag( 'tr', "\n" .
38 html_tag( 'td', '<b>' . _("Options") . ' - ' . _("New Mail Notification") . '</b>', 'center', $color[0] )
39 ) . "\n" .
40 html_tag( 'tr' ) . "\n" .
41 html_tag( 'td', '', 'left' );
412303e0 42 if ($allowsound == "true") {
4cf43843 43 echo html_tag( 'p',
44 _("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.")
45 ) . "\n";
412303e0 46 }
4cf43843 47 echo html_tag( 'p',
48 _("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.")
49 ) . "\n" .
50 html_tag( 'p',
51 _("Selecting the <b>Show popup</b> option will enable the showing of a popup window when unseen mail is in your folders (requires JavaScript).")
52 ) . "\n" .
53 html_tag( 'p',
54 _("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.")
55 ) . "\n" .
56 html_tag( 'p',
57 _("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.")
58 );
412303e0 59 if ($allowsound == "true") {
4cf43843 60 echo html_tag( 'p',
61 _("Select from the list of <b>server files</b> the media file to play when new mail arrives. Selecting <b>local media</b> will play the file specified in the <b>local media file</b> box to play from the local computer. If no file is specified, the system will use a default from the server.")
62 ) . "\n";
3d75ef16 63 }
412303e0 64 echo '<form action="../../src/options.php" method=post>'.
4cf43843 65 html_tag( 'table', '', '', '', 'width="100%" cellpadding="0" cellspacing="2" border="0"' ) . "\n" .
66 html_tag( 'tr' ) . "\n" .
67 html_tag( 'td', '&nbsp', 'right', '', 'nowrap' ) . "\n";
412303e0 68 if ($allowsound == "true") {
4cf43843 69 echo html_tag( 'td', '', 'left' ) .
70 '<input type="checkbox" ';
412303e0 71 if ($media_enable == 'on') {
72 echo 'checked ';
73 }
4cf43843 74 echo 'name="media_enable"><b> ' . _("Enable Media Playing") . '</b></td>'.
75 '</tr>' . "\n";
412303e0 76 }
4cf43843 77 echo html_tag( 'tr' ) . "\n" .
78 html_tag( 'td', '&nbsp', 'right', '', 'nowrap' ) . "\n" .
79 html_tag( 'td', '', 'left' ) .
80 '<input type="checkbox" ';
3d75ef16 81 if ($media_allbox == 'on') {
82 echo 'checked ';
83 }
4cf43843 84 echo 'name="media_allbox"><b> ' . _("Check all boxes, not just INBOX") . '</b></td>'.
85 '</tr>'. "\n" .
86 html_tag( 'tr' ) . "\n" .
87 html_tag( 'td', '&nbsp', 'right', '', 'nowrap' ) . "\n" .
88 html_tag( 'td', '', 'left' ) .
89 '<input type="checkbox" ';
3d75ef16 90 if ($media_recent == 'on') {
91 echo 'checked ';
92 }
4cf43843 93 echo 'name="media_recent"><b> ' . _("Count only messages that are RECENT") . '</b></td>'.
94 '</tr>'. "\n" .
95 html_tag( 'tr' ) . "\n" .
96 html_tag( 'td', '&nbsp', 'right', '', 'nowrap' ) . "\n" .
97 html_tag( 'td', '', 'left' ) .
98 '<input type="checkbox" ';
3d75ef16 99 if ($media_changetitle == 'on') {
100 echo 'checked ';
101 }
4cf43843 102 echo 'name="media_changetitle"><b> ' . _("Change title on supported browsers.") . '</b> &nbsp; (' . _("requires JavaScript to work") . ')</td>'.
103 '</tr>'. "\n" .
104 html_tag( 'tr' ) . "\n" .
105 html_tag( 'td', '&nbsp', 'right', '', 'nowrap' ) . "\n" .
106 html_tag( 'td', '', 'left' ) .
107 '<input type="checkbox" ';
3d75ef16 108 if($media_popup == 'on') {
109 echo 'checked ';
110 }
4cf43843 111 echo 'name="media_popup"><b> ' . _("Show popup window on new mail") . '</b> &nbsp; (' . _("requires JavaScript to work") . ')</td>'.
112 '</tr>' . "\n";
412303e0 113 if ($allowsound == "true") {
4cf43843 114 echo html_tag( 'tr' ) . "\n" .
115 html_tag( 'td', _("Select server file:"), 'right', '', 'nowrap' ) . "\n" .
116 html_tag( 'td', '', 'left' ) .
117 '<select name="media_sel">'. "\n" .
118 '<option value="(local media)">' . _("(local media)") . '</option>' . "\n";
3d75ef16 119
120 // Iterate sound files for options
121
122 $d = dir('../plugins/newmail/sounds');
123 while($entry=$d->read()) {
124 $fname = $d->path . "/" . $entry;
cc61478a 125 if ($entry != '..' && $entry != '.') {
4cf43843 126 echo "<option ";
3d75ef16 127 if ($fname == $media) {
4cf43843 128 echo "selected ";
3d75ef16 129 }
4cf43843 130 echo "value=\"" . $fname . "\">" . $entry . "</option>\n";
3d75ef16 131 }
132 }
133 $d->close();
4cf43843 134 echo '</select>'.
3d75ef16 135 '<input type="submit" value=" ' . _("Try") . ' " name="test" onClick="'.
136 "window.open('testsound.php?sound='+media_sel.options[media_sel.selectedIndex].value, 'TestSound',".
137 "'width=150,height=30,scrollbars=no');".
138 'return false;'.
139 '">'.
140 '</td>'.
141 '</tr>'.
4cf43843 142 html_tag( 'tr', "\n" .
143 html_tag( 'td', _("Local Media File:"), 'right', '', 'nowrap' ) .
144 html_tag( 'td', '<input type="file" size="40" name="media_file">', 'left' )
145 ) . "\n" .
146 html_tag( 'tr', "\n" .
147 html_tag( 'td', _("Current File:"), 'right', '', 'nowrap' ) .
148 html_tag( 'td', '<input type="hidden" value="' . $media . '" name="media_default">' . $media . '', 'left' )
149 ) . "\n";
412303e0 150 }
4cf43843 151 echo html_tag( 'tr', "\n" .
152 html_tag( 'td', '&nbsp;' ) .
153 html_tag( 'td',
154 '<input type="hidden" name="optmode" value="submit">'.
155 '<input type="submit" value="' . _("Submit") . '" name="submit_newmail">',
156 'left' )
157 ) . "\n" .
158 '</table>'. "\n" .
159 '</form>'. "\n" .
160 '</td></tr></table>'. "\n" .
3d75ef16 161'</body></html>';
162
15e6162e 163?>