| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | ** EDIT_DIC.MOD.PHP -- Squirrelspell module |
| 5 | ** |
| 6 | ** Copyright (c) 1999-2001 The SquirrelMail development team |
| 7 | ** Licensed under the GNU GPL. For full terms see the file COPYING. |
| 8 | ** |
| 9 | ** This module handles the encryption/decryption of the user dictionary |
| 10 | ** if the user so chooses from the options page. |
| 11 | ** |
| 12 | ** $Id$ |
| 13 | **/ |
| 14 | |
| 15 | // fidian, you owe me a pack of Guinness! :) |
| 16 | global $color; |
| 17 | $words=sqspell_getWords(); |
| 18 | if (!$words){ |
| 19 | // Agt. Smith: "You're empty." |
| 20 | // Neo: "So are you." |
| 21 | sqspell_makePage(_("Personal Dictionary"), null, '<p>' . _("No words in your personal dictionary.") . '</p>'); |
| 22 | } else { |
| 23 | // We're loaded with booty. |
| 24 | $pre_msg = '<p>' . _("Please check any words you wish to delete from your dictionary.") . "</p>\n"; |
| 25 | $pre_msg .= "<table border=\"0\" width=\"95%\" align=\"center\">\n"; |
| 26 | $langs=sqspell_getSettings($words); |
| 27 | for ($i=0; $i<sizeof($langs); $i++){ |
| 28 | $lang_words = sqspell_getLang($words, $langs[$i]); |
| 29 | if ($lang_words){ |
| 30 | // No words in this dictionary. |
| 31 | if (!$msg) { |
| 32 | $msg = $pre_msg; |
| 33 | } |
| 34 | $msg .= "<tr bgcolor=\"$color[0]\" align=\"center\"><th>" . |
| 35 | sprintf( _("%s dictionary"), $langs[$i] ) . '</th></tr>'. |
| 36 | '<tr><td align="center">'. |
| 37 | '<form method="post">'. |
| 38 | '<input type="hidden" name="MOD" value="forget_me">'. |
| 39 | '<input type="hidden" name="sqspell_use_app" value="' . $langs[$i] . '">'. |
| 40 | '<table border="0" width="95%" align="center">'. |
| 41 | '<tr>'. |
| 42 | "<td valign=\"top\">\n"; |
| 43 | $words_ary=explode("\n", $lang_words); |
| 44 | array_pop($words_ary); |
| 45 | array_shift($words_ary); |
| 46 | // Do some fancy stuff to separate the words into three columns. |
| 47 | for ($j=0; $j<sizeof($words_ary); $j++){ |
| 48 | if ($j==intval(sizeof($words_ary)/3) || $j==intval(sizeof($words_ary)/3*2)) |
| 49 | $msg .= "</td><td valign=\"top\">\n"; |
| 50 | $msg .= "<input type=\"checkbox\" name=\"words_ary[]\" value=\"$words_ary[$j]\"> $words_ary[$j]<br>"; |
| 51 | } |
| 52 | $msg .= '</td></tr></table></td></tr>' . |
| 53 | "<tr bgcolor=\"$color[0]\" align=\"center\"><td>". |
| 54 | '<input type="submit" value="' . _("Delete checked words") . '"></form>'. |
| 55 | '</td></tr><tr><td><hr>'. |
| 56 | "</td></tr>\n"; |
| 57 | } |
| 58 | } |
| 59 | // Check if all dictionaries were empty. |
| 60 | if (!$msg) { |
| 61 | $msg = '<p>' . _("No words in your personal dictionary.") . '</p>'; |
| 62 | } else { |
| 63 | $msg .= '</table>'; |
| 64 | } |
| 65 | sqspell_makePage(_("Edit your Personal Dictionary"), null, $msg); |
| 66 | } |
| 67 | |
| 68 | ?> |