5 This module tries to decrypt the user dictionary with a newly provided
6 old password, or erases the file if everything else fails. :(
9 global $delete_words, $SCRIPT_NAME, $old_key;
10 if ($delete_words=="ON"){
11 // All attemts to decrypt the file were futile. Erase the bastard and
12 // hope this never happens again.
13 sqspell_deleteWords();
14 // See where we were called from -- pop-up window or options page
15 // and call whichever wrapper is appropriate.
16 if (strstr($SCRIPT_NAME, "sqspell_options")){
17 $msg="<p>Your personal dictionary was erased.</p>";
18 sqspell_makePage("Dictionary Erased", null, $msg);
20 $msg = "<p>Your personal dictionary was erased. Please close this window and
21 click \"Check Spelling\" button again to start your spellcheck over.</p>
22 <p align=\"center\"><form>
23 <input type=\"button\" value=\" Close this Window \" onclick=\"self.close()\">
25 sqspell_makeWindow(null, "Dictionary Erased", null, $msg);
31 // User provided another key to try and decrypt the dictionary.
32 // call sqspell_getWords. If this key fails, the function will
34 $words=sqspell_getWords();
35 // It worked! Pinky, you're a genius!
36 // Write it back this time encrypted with a new key.
37 sqspell_writeWords($words);
38 // See where we are and call a necessary GUI-wrapper.
39 if (strstr($SCRIPT_NAME, "sqspell_options")){
40 $msg="<p>Your personal dictionary was re-encrypted successfully. Now
41 return to the "SpellChecker options" menu and make your selection
43 sqspell_makePage("Successful Re-encryption", null, $msg);
45 $msg = "<p>Your personal dictionary was re-encrypted successfully. Please
46 close this window and click \"Check Spelling\" button again to start your
48 <form><p align=\"center\"><input type=\"button\" value=\" Close this Window \"
49 onclick=\"self.close()\"></p></form>";
50 sqspell_makeWindow(null, "Dictionary re-encrypted", null, $msg);