edit_dic.mod 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <?php
  2. /**
  3. * edit_dic.mod
  4. *
  5. * Squirrelspell module
  6. *
  7. * This module lets the user edit his/her personal dictionary.
  8. *
  9. * @author Konstantin Riabitsev <icon at duke.edu>
  10. * @copyright &copy; 1999-2006 The SquirrelMail Project Team
  11. * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  12. * @version $Id$
  13. * @package plugins
  14. * @subpackage squirrelspell
  15. */
  16. global $color;
  17. $pre_msg = '<p>'
  18. . _("Please check any words you wish to delete from your dictionary.")
  19. . "</p>\n";
  20. $pre_msg .= "<table border=\"0\" width=\"95%\" align=\"center\">\n";
  21. /**
  22. * Get how many dictionaries this user has defined.
  23. */
  24. $langs=sqspell_getSettings();
  25. foreach ($langs as $lang) {
  26. /**
  27. * Get all words from this language dictionary.
  28. */
  29. $lang_words = sqspell_getLang($lang);
  30. if (! empty($lang_words)){
  31. /**
  32. * There are words in this dictionary. If this is the first
  33. * language we're processing, prepend the output with the
  34. * "header" message.
  35. */
  36. if (!isset($msg) || !$msg) {
  37. $msg = $pre_msg;
  38. }
  39. $msg .= "<tr bgcolor=\"$color[0]\" align=\"center\"><th>"
  40. . sprintf( _("%s dictionary"), $lang ) . '</th></tr>'
  41. . '<tr><td align="center">'
  42. . '<form method="post">'
  43. . '<input type="hidden" name="MOD" value="forget_me" />'
  44. . '<input type="hidden" name="sqspell_use_app" value="'
  45. . $lang . '" />'
  46. . '<table border="0" width="95%" align="center">'
  47. . '<tr>'
  48. . "<td valign=\"top\">\n";
  49. /**
  50. * Do some fancy stuff to separate the words into three
  51. * columns.
  52. */
  53. for ($j=0; $j<sizeof($lang_words); $j++){
  54. if ($j==intval(sizeof($lang_words)/3)
  55. || $j==intval(sizeof($lang_words)/3*2)){
  56. $msg .= "</td><td valign=\"top\">\n";
  57. }
  58. $msg .= "<input type=\"checkbox\" name=\"words_ary[]\" "
  59. . 'value="'.htmlspecialchars($lang_words[$j]). '" /> '
  60. . htmlspecialchars($lang_words[$j]) . "<br />\n";
  61. }
  62. $msg .= '</td></tr></table></td></tr>'
  63. . "<tr bgcolor=\"$color[0]\" align=\"center\"><td>"
  64. . '<input type="submit" value="' . _("Delete checked words")
  65. . '" /></form>'
  66. . '</td></tr><tr><td><hr />'
  67. . "</td></tr>\n";
  68. }
  69. }
  70. /**
  71. * Check if all dictionaries were empty.
  72. */
  73. if (! isset($msg)) {
  74. $msg = '<p>' . _("No words in your personal dictionary.") . '</p>';
  75. } else {
  76. $msg .= '</table>';
  77. }
  78. sqspell_makePage(_("Edit your Personal Dictionary"), null, $msg);
  79. /**
  80. * For Emacs weenies:
  81. * Local variables:
  82. * mode: php
  83. * End:
  84. * vim: syntax=php
  85. */