Eliminated all eveil chdir statements.
[squirrelmail.git] / plugins / translate / options.php
1 <?php
2
3 /**
4 * options.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 * Pick your translator to translate the body of incoming mail messages
10 *
11 * $Id$
12 */
13
14 /* Path for SquirrelMail required files. */
15 define('SM_PATH','../../');
16
17 /* SquirrelMail required files. */
18 require_once(SM_PATH . 'include/validate.php');
19 require_once(SM_PATH . 'functions/strings.php');
20 require_once(SM_PATH . 'functions/page_header.php');
21 require_once(SM_PATH . 'functions/display_messages.php');
22 require_once(SM_PATH . 'functions/imap.php');
23 require_once(SM_PATH . 'functions/array.php');
24 require_once(SM_PATH . 'functions/i18n.php');
25 require_once(SM_PATH . 'include/load_prefs.php');
26
27 displayPageHeader($color, 'None');
28
29 if (isset($submit_translate) && $submit_translate ) {
30 if (isset($translate_translate_server)) {
31 setPref($data_dir, $username, 'translate_server', $translate_translate_server);
32 } else {
33 setPref($data_dir, $username, 'translate_server', 'babelfish');
34 }
35
36 if (isset($translate_translate_location)) {
37 setPref($data_dir, $username, 'translate_location', $translate_translate_location);
38 } else {
39 setPref($data_dir, $username, 'translate_location', 'center');
40 }
41
42 if (isset($translate_translate_show_read)) {
43 setPref($data_dir, $username, 'translate_show_read', '1');
44 } else {
45 setPref($data_dir, $username, 'translate_show_read', '');
46 }
47
48 if (isset($translate_translate_show_send)) {
49 setPref($data_dir, $username, 'translate_show_send', '1');
50 } else {
51 setPref($data_dir, $username, 'translate_show_send', '');
52 }
53
54 if (isset($translate_translate_same_window)) {
55 setPref($data_dir, $username, 'translate_same_window', '1');
56 } else {
57 setPref($data_dir, $username, 'translate_same_window', '');
58 }
59 }
60
61 $translate_server = getPref($data_dir, $username, 'translate_server');
62 if ($translate_server == '') {
63 $translate_server = 'babelfish';
64 }
65 $translate_location = getPref($data_dir, $username, 'translate_location');
66 if ($translate_location == '') {
67 $translate_location = 'center';
68 }
69 $translate_show_read = getPref($data_dir, $username, 'translate_show_read');
70 $translate_show_send = getPref($data_dir, $username, 'translate_show_send');
71 $translate_same_window = getPref($data_dir, $username, 'translate_same_window');
72
73
74 function ShowOption($Var, $value, $Desc)
75 {
76 $Var = 'translate_' . $Var;
77
78 global $$Var;
79
80 echo '<option value="' . $value . '"';
81 if ($$Var == $value)
82 {
83 echo ' SELECTED';
84 }
85 echo '>' . $Desc . "</option>\n";
86 }
87
88 function ShowTrad( $tit, $com, $url ) {
89
90 echo "<li><b>$tit</b> - ".
91 $com .
92 "[ <a href=\"$url\" target=\"_blank\">$tit</a> ]</li>";
93
94 }
95
96 ?>
97 <table width="95%" align=center border=0 cellpadding=1 cellspacing=0><tr><td bgcolor="<?php echo $color[0] ?>">
98 <center><b><?php echo _("Options") . ' - '. _("Translator"); ?></b></center>
99 </td></tr></table>
100
101 <p><?php echo _("Your server options are as follows:"); ?></p>
102
103 <ul>
104 <?php
105 ShowTrad( 'Babelfish',
106 _("13 language pairs, maximum of 1000 characters translated, powered by Systran"),
107 'http://babelfish.altavista.com/' );
108 ShowTrad( 'Translator.Go.com',
109 _("10 language pairs, maximum of 25 kilobytes translated, powered by Systran"),
110 'http://translator.go.com/' );
111 ShowTrad( 'Dictionary.com',
112 _("12 language pairs, no known limits, powered by Systran"),
113 'http://www.dictionary.com/translate' );
114 ShowTrad( 'InterTran',
115 _("767 language pairs, no known limits, powered by Translation Experts's InterTran"),
116 'http://www.tranexp.com/' );
117 ShowTrad( 'GPLTrans',
118 _("8 language pairs, no known limits, powered by GPLTrans (free, open source)"),
119 'http://www.translator.cx/' );
120 ?>
121 </ul>
122 <p>
123 <?php
124 echo _("You also decide if you want the translation box displayed, and where it will be located.") .
125 "<form action=\"$PHP_SELF\" method=post>".
126 '<table border=0 cellpadding=0 cellspacing=2>'.
127 '<tr><td align=right nowrap>' .
128 _("Select your translator:") .
129 '</td>'.
130 '<td><select name="translate_translate_server">';
131
132 ShowOption('server', 'babelfish', 'Babelfish');
133 ShowOption('server', 'go', 'Go.com');
134 ShowOption('server', 'dictionary', 'Dictionary.com');
135 ShowOption('server', 'intertran', 'Intertran');
136 ShowOption('server', 'gpltrans', 'GPLTrans');
137 echo '</select>' .
138 '</td></tr>' .
139 '<tr><td align=right nowrap>' .
140 _("When reading:") .
141 '</td>'.
142 '<td><input type=checkbox name="translate_translate_show_read"';
143 if ($translate_show_read)
144 echo " CHECKED";
145 echo '> - ' . _("Show translation box") .
146 ' <select name="translate_translate_location">';
147 ShowOption('location', 'left', _("to the left"));
148 ShowOption('location', 'center', _("in the center"));
149 ShowOption('location', 'right', _("to the right"));
150 echo '</select><br>'.
151 '<input type=checkbox name="translate_translate_same_window"';
152 if ($translate_same_window)
153 echo " CHECKED";
154 echo '> - ' . _("Translate inside the SquirrelMail frames").
155 '</td></tr>'.
156 '<tr><td align=right nowrap>'.
157 _("When composing:") . '</td>'.
158 '<td><input type=checkbox name="translate_translate_show_send"';
159 if ($translate_show_send)
160 echo " CHECKED";
161 echo '> - ' . _("Not yet functional, currently does nothing") .
162 '</td></tr>'.
163 '<tr><td></td><td>'.
164 '<input type="submit" value="' . _("Submit") . '" name="submit_translate">'.
165 '</td></tr>'.
166 '</table>'.
167 '</form>'.
168 "</body></html>\n";
169
170 ?>