options.php 5.9 KB

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