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