Removed variables that were initialized, but never actually used
[squirrelmail.git] / plugins / squirrelspell / modules / edit_dic.mod
CommitLineData
849bdf42 1<?php
d112ed5a 2/**
3 * edit_dic.mod
4 * -------------
5 * Squirrelspell module
6 *
76911253 7 * Copyright (c) 1999-2003 The SquirrelMail development team
d112ed5a 8 * Licensed under the GNU GPL. For full terms see the file COPYING.
9 *
10 * This module lets the user edit his/her personal dictionary.
11 *
12 * $Id$
13 *
14 * @author Konstantin Riabitsev <icon@duke.edu> ($Author$)
15 * @version $Date
16 */
2b5a7157 17
d112ed5a 18global $color;
19/**
20 * Get the user dictionary and see if it's empty or not.
21 */
22$words=sqspell_getWords();
23if (!$words){
24 /**
25 * Agt. Smith: "You're empty."
26 * Neo: "So are you."
27 */
28 sqspell_makePage(_("Personal Dictionary"), null,
29 '<p>' . _("No words in your personal dictionary.")
30 . '</p>');
31} else {
32 /**
33 * We're loaded with booty.
34 */
35 $pre_msg = '<p>'
36 . _("Please check any words you wish to delete from your dictionary.")
37 . "</p>\n";
38 $pre_msg .= "<table border=\"0\" width=\"95%\" align=\"center\">\n";
39 /**
40 * Get how many dictionaries this user has defined.
41 */
42 $langs=sqspell_getSettings($words);
43 for ($i=0; $i<sizeof($langs); $i++){
44 /**
45 * Get all words from this language dictionary.
46 */
47 $lang_words = sqspell_getLang($words, $langs[$i]);
48 if ($lang_words){
49 /**
50 * There are words in this dictionary. If this is the first
51 * language we're processing, prepend the output with the
52 * "header" message.
53 */
48a1015b 54 if (!isset($msg) || !$msg) {
d112ed5a 55 $msg = $pre_msg;
56 }
57 $msg .= "<tr bgcolor=\"$color[0]\" align=\"center\"><th>"
58 . sprintf( _("%s dictionary"), $langs[$i] ) . '</th></tr>'
59 . '<tr><td align="center">'
60 . '<form method="post">'
04fa3c41 61 . '<input type="hidden" name="MOD" value="forget_me" />'
d112ed5a 62 . '<input type="hidden" name="sqspell_use_app" value="'
04fa3c41 63 . $langs[$i] . '" />'
d112ed5a 64 . '<table border="0" width="95%" align="center">'
65 . '<tr>'
66 . "<td valign=\"top\">\n";
67 $words_ary=explode("\n", $lang_words);
68 /**
69 * There are two lines we need to remove:
70 * 1st: # Language
71 * last: # End
72 */
73 array_pop($words_ary);
74 array_shift($words_ary);
75 /**
76 * Do some fancy stuff to separate the words into three
77 * columns.
78 */
79 for ($j=0; $j<sizeof($words_ary); $j++){
80 if ($j==intval(sizeof($words_ary)/3)
81 || $j==intval(sizeof($words_ary)/3*2)){
82 $msg .= "</td><td valign=\"top\">\n";
83 }
84 $msg .= "<input type=\"checkbox\" name=\"words_ary[]\" "
04fa3c41 85 . 'value="'.htmlspecialchars($words_ary[$j]). '" /> '
86 . htmlspecialchars($words_ary[$j]) . "<br />\n";
d112ed5a 87 }
88 $msg .= '</td></tr></table></td></tr>'
2a917bbc 89 . "<tr bgcolor=\"$color[0]\" align=\"center\"><td>"
d112ed5a 90 . '<input type="submit" value="' . _("Delete checked words")
04fa3c41 91 . '" /></form>'
92 . '</td></tr><tr><td><hr />'
d112ed5a 93 . "</td></tr>\n";
2b5a7157 94 }
d112ed5a 95 }
96 /**
97 * Check if all dictionaries were empty.
98 */
99 if (!$msg) {
100 $msg = '<p>' . _("No words in your personal dictionary.") . '</p>';
101 } else {
102 $msg .= '</table>';
103 }
104 sqspell_makePage(_("Edit your Personal Dictionary"), null, $msg);
105}
106
107/**
108 * For Emacs weenies:
109 * Local variables:
110 * mode: php
111 * End:
2b6b400e 112 * vim: syntax=php
d112ed5a 113 */
2b5a7157 114
04fa3c41 115?>