adding variable test
[squirrelmail.git] / plugins / translate / options.php
CommitLineData
849bdf42 1<?php
849bdf42 2
8d6a115b 3/**
4 * options.php
5 *
76911253 6 * Copyright (c) 1999-2003 The SquirrelMail Project Team
8d6a115b 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$
ea5f4b8e 12 * @package plugins
13 * @subpackage translate
8d6a115b 14 */
aa7fb30c 15
ea5f4b8e 16/**
17 * Path for SquirrelMail required files.
18 * @ignore
19 */
92219031 20define('SM_PATH','../../');
8d6a115b 21
22/* SquirrelMail required files. */
23require_once(SM_PATH . 'include/validate.php');
24require_once(SM_PATH . 'functions/strings.php');
25require_once(SM_PATH . 'functions/page_header.php');
26require_once(SM_PATH . 'functions/display_messages.php');
27require_once(SM_PATH . 'functions/imap.php');
8d6a115b 28require_once(SM_PATH . 'include/load_prefs.php');
29
30 displayPageHeader($color, 'None');
849bdf42 31
04f6008a 32 if (isset($_POST['submit_translate']) && $_POST['submit_translate'] ) {
33 if (isset($_POST['translate_translate_server'])) {
34 setPref($data_dir, $username, 'translate_server', $_POST['translate_translate_server']);
e38ebf4d 35 } else {
36 setPref($data_dir, $username, 'translate_server', 'babelfish');
37 }
38
04f6008a 39 if (isset($_POST['translate_translate_location'])) {
40 setPref($data_dir, $username, 'translate_location', $_POST['translate_translate_location']);
e38ebf4d 41 } else {
42 setPref($data_dir, $username, 'translate_location', 'center');
43 }
44
04f6008a 45 if (isset($_POST['translate_translate_show_read'])) {
e38ebf4d 46 setPref($data_dir, $username, 'translate_show_read', '1');
47 } else {
48 setPref($data_dir, $username, 'translate_show_read', '');
49 }
50
04f6008a 51 if (isset($_POST['translate_translate_show_send'])) {
e38ebf4d 52 setPref($data_dir, $username, 'translate_show_send', '1');
53 } else {
54 setPref($data_dir, $username, 'translate_show_send', '');
55 }
56
04f6008a 57 if (isset($_POST['translate_translate_same_window'])) {
e38ebf4d 58 setPref($data_dir, $username, 'translate_same_window', '1');
59 } else {
60 setPref($data_dir, $username, 'translate_same_window', '');
61 }
62 }
63
64 $translate_server = getPref($data_dir, $username, 'translate_server');
65 if ($translate_server == '') {
849bdf42 66 $translate_server = 'babelfish';
e38ebf4d 67 }
68 $translate_location = getPref($data_dir, $username, 'translate_location');
69 if ($translate_location == '') {
849bdf42 70 $translate_location = 'center';
e38ebf4d 71 }
72 $translate_show_read = getPref($data_dir, $username, 'translate_show_read');
73 $translate_show_send = getPref($data_dir, $username, 'translate_show_send');
74 $translate_same_window = getPref($data_dir, $username, 'translate_same_window');
75
849bdf42 76
77 function ShowOption($Var, $value, $Desc)
78 {
79 $Var = 'translate_' . $Var;
38a7b6a0 80
849bdf42 81 global $$Var;
38a7b6a0 82
849bdf42 83 echo '<option value="' . $value . '"';
84 if ($$Var == $value)
85 {
86 echo ' SELECTED';
87 }
88 echo '>' . $Desc . "</option>\n";
89 }
38a7b6a0 90
91 function ShowTrad( $tit, $com, $url ) {
92
93 echo "<li><b>$tit</b> - ".
94 $com .
95 "[ <a href=\"$url\" target=\"_blank\">$tit</a> ]</li>";
96
97 }
849bdf42 98
99?>
6206f6c4 100 <table width="95%" align=center border=0 cellpadding=1 cellspacing=0><tr><td bgcolor="<?php echo $color[0] ?>">
38a7b6a0 101 <center><b><?php echo _("Options") . ' - '. _("Translator"); ?></b></center>
849bdf42 102 </td></tr></table>
103
04f6008a 104 <?php if (isset($_POST['submit_translate']) && $_POST['submit_translate'] ) {
105 print "<center><h4>"._("Saved Translation Options")."</h4></center>\n";
106 }?>
107
38a7b6a0 108 <p><?php echo _("Your server options are as follows:"); ?></p>
849bdf42 109
38a7b6a0 110 <ul>
111<?php
112 ShowTrad( 'Babelfish',
b0abf4b1 113 _("Maximum of 1000 characters translated, powered by Systran").
114 "<br>".sprintf(_("Number of supported language pairs: %s"),"19")." " ,
38a7b6a0 115 'http://babelfish.altavista.com/' );
90dbea5c 116// ShowTrad( 'Translator.Go.com',
117// _("10 language pairs, maximum of 25 kilobytes translated, powered by Systran"),
118// 'http://translator.go.com/' );
38a7b6a0 119 ShowTrad( 'Dictionary.com',
b0abf4b1 120 _("No known limits, powered by Systran").
121 "<br>".sprintf(_("Number of supported language pairs: %s"),"12")." " ,
38a7b6a0 122 'http://www.dictionary.com/translate' );
df7b27c1 123 ShowTrad( 'Google Translate',
124 _("No known limits, powered by Systran").
125 "<br>".sprintf(_("Number of supported language pairs: %s"),"12")." " ,
126 'http://www.google.com/translate' );
38a7b6a0 127 ShowTrad( 'GPLTrans',
b0abf4b1 128 _("No known limits, powered by GPLTrans (free, open source)").
129 "<br>".sprintf(_("Number of supported language pairs: %s"),"8")." " ,
38a7b6a0 130 'http://www.translator.cx/' );
df7b27c1 131 ShowTrad( 'InterTran',
132 _("No known limits, powered by Translation Experts's InterTran").
133 "<br>".sprintf(_("Number of supported languages: %s"),"28")." " ,
134 'http://www.tranexp.com/' );
eaf943d2 135 ShowTrad( 'OTEnet',
b0abf4b1 136 _("Hellenic translations, no known limits, powered by Systran").
60b628ea 137 "<br>".sprintf(_("Number of supported language pairs: %s"),"20")." " ,
eaf943d2 138 'http://systran.otenet.gr/' );
b0abf4b1 139 ShowTrad( 'PROMT',
140 _("Russian translations, maximum of 500 characters translated").
141 "<br>".sprintf(_("Number of supported language pairs: %s"),"12")." " ,
142 'http://www.translate.ru/' );
38a7b6a0 143?>
849bdf42 144 </ul>
38a7b6a0 145 <p>
146<?php
e38ebf4d 147 echo _("You also decide if you want the translation box displayed, and where it will be located.") .
148 "<form action=\"$PHP_SELF\" method=post>".
149 '<table border=0 cellpadding=0 cellspacing=2>'.
150 '<tr><td align=right nowrap>' .
151 _("Select your translator:") .
152 '</td>'.
153 '<td><select name="translate_translate_server">';
154
849bdf42 155 ShowOption('server', 'babelfish', 'Babelfish');
90dbea5c 156// ShowOption('server', 'go', 'Go.com');
849bdf42 157 ShowOption('server', 'dictionary', 'Dictionary.com');
df7b27c1 158 ShowOption('server', 'google', 'Google Translate');
159 ShowOption('server', 'gpltrans', 'GPLTrans');
160 ShowOption('server', 'intertran', 'Intertran');
161 ShowOption('server', 'otenet', 'OTEnet');
b0abf4b1 162 ShowOption('server', 'promt', 'PROMT');
38a7b6a0 163 echo '</select>' .
164 '</td></tr>' .
df7b27c1 165 '<tr>'.html_tag('td',_("When reading:"),'right','','nowrap').
38a7b6a0 166 '<td><input type=checkbox name="translate_translate_show_read"';
167 if ($translate_show_read)
168 echo " CHECKED";
169 echo '> - ' . _("Show translation box") .
170 ' <select name="translate_translate_location">';
171 ShowOption('location', 'left', _("to the left"));
172 ShowOption('location', 'center', _("in the center"));
173 ShowOption('location', 'right', _("to the right"));
174 echo '</select><br>'.
175 '<input type=checkbox name="translate_translate_same_window"';
176 if ($translate_same_window)
177 echo " CHECKED";
178 echo '> - ' . _("Translate inside the SquirrelMail frames").
179 '</td></tr>'.
df7b27c1 180 '<tr>'.html_tag('td',_("When composing:"),'right','','nowrap').
38a7b6a0 181 '<td><input type=checkbox name="translate_translate_show_send"';
849bdf42 182 if ($translate_show_send)
183 echo " CHECKED";
38a7b6a0 184 echo '> - ' . _("Not yet functional, currently does nothing") .
185 '</td></tr>'.
186 '<tr><td></td><td>'.
187 '<input type="submit" value="' . _("Submit") . '" name="submit_translate">'.
188 '</td></tr>'.
189 '</table>'.
dcc1cc82 190 '</form>'.
191"</body></html>\n";
e38ebf4d 192
15e6162e 193?>