+// main code
+if (! $old_setup && $delete_words=='ON') {
+ if (sqgetGlobalVar('dict_lang',$dict_lang,SQ_POST)) {
+ sqspell_deleteWords($dict_lang);
+ sqspell_dict_deleted();
+ }
+} elseif ($delete_words=='ON'){
+ /**
+ * $delete_words is passed via the query_string. If it's set, then
+ * the user asked to delete the file. Erase the bastard and hope
+ * this never happens again.
+ */
+ sqspell_deleteWords_old();
+ sqspell_dict_deleted();
+}
+
+if (! $old_setup && $old_key) {
+ if (sqgetGlobalVar('dict_lang',$dict_lang,SQ_POST)) {
+ $words=sqspell_getLang($dict_lang);
+ sqspell_writeWords($words,$dict_lang);
+ sqspell_dict_reencrypted();
+ }
+} elseif ($old_key){
+ /**
+ * User provided another key to try and decrypt the dictionary.
+ * Call sqspell_getWords. If this key fails, the function will
+ * handle it.
+ */
+ $words=sqspell_getWords_old();
+ /**
+ * It worked! Pinky, you're a genius!
+ * Write it back this time encrypted with a new key.
+ */
+ sqspell_writeWords_old($words);
+ sqspell_dict_reencrypted();
+}
+
+// TODO: handle broken calls
+