String bug fix
[squirrelmail.git] / plugins / squirrelspell / modules / edit_dic.mod.php
CommitLineData
849bdf42 1<?php
2/**
3 EDIT_DIC.MOD.PHP
4 ----------------
5 This module displays the words in your dictionary for editing.
6 **/
7 // fidian, you owe me a pack of Guinness! :)
8 global $color;
9 $words=sqspell_getWords();
10 if (!$words){
11 // Agt. Smith: "You're empty."
12 // Neo: "So are you."
13 sqspell_makePage("Personal Dictionary", null, "<p>No words in your personal dictionary.</p>");
14 } else {
15 // We're loaded with booty.
16 $pre_msg = "<p>Please check any words you wish to delete from your dictionary.</p>\n";
17 $pre_msg .= "<table border=\"0\" width=\"95%\" align=\"center\">\n";
18 $langs=sqspell_getSettings($words);
19 for ($i=0; $i<sizeof($langs); $i++){
20 $lang_words = sqspell_getLang($words, $langs[$i]);
21 if ($lang_words){
22 // No words in this dictionary.
23 if (!$msg) $msg = $pre_msg;
24 $msg .= "<tr bgcolor=\"$color[0]\" align=\"center\"><th>$langs[$i] dictionary</th></tr>
25 <tr><td align=\"center\">
26 <form method=\"post\">
27 <input type=\"hidden\" name=\"MOD\" value=\"forget_me\">
28 <input type=\"hidden\" name=\"sqspell_use_app\" value=\"$langs[$i]\">
29 <table border=\"0\" width=\"95%\" align=\"center\">
30 <tr>
31 <td valign=\"top\">\n";
32 $words_ary=explode("\n", $lang_words);
33 array_pop($words_ary);
34 array_shift($words_ary);
35 // Do some fancy stuff to separate the words into three columns.
36 for ($j=0; $j<sizeof($words_ary); $j++){
37 if ($j==intval(sizeof($words_ary)/3) || $j==intval(sizeof($words_ary)/3*2))
38 $msg .= "</td><td valign=\"top\">\n";
39 $msg .= "<input type=\"checkbox\" name=\"words_ary[]\" value=\"$words_ary[$j]\"> $words_ary[$j]<br>";
40 }
41 $msg .= "</td>
42 </tr>
43 </table>
44 </td></tr>
45 <tr bgcolor=\"$color[0]\" align=\"center\"><td>
46 <input type=\"submit\" value=\"Delete checked words\"></form>
47 </td></tr><tr><td><hr>
48 </td></tr>\n";
49 }
50 }
51 // Check if all dictionaries were empty.
52 if (!$msg)
53 $msg = "<p>No words in your dictionary.</p>";
54 else $msg .= "</table>";
55 sqspell_makePage("Edit your Personal Dictionary", null, $msg);
56 }
57?>