'.
- "\n\n";
- }
-
- function sqspell_crypto($mode, $ckey, $input){
- //
- // This function does the encryption and decryption of the user
- // dictionary. It is only available when PHP is compiled
- // --with-mcrypt. See doc/CRYPTO for more information.
- //
- if (!function_exists(mcrypt_generic)) {
- return 'PANIC';
- }
- $td = mcrypt_module_open(MCRYPT_Blowfish, "", MCRYPT_MODE_ECB, "");
- $iv = mcrypt_create_iv(mcrypt_enc_get_iv_size ($td), MCRYPT_RAND);
- mcrypt_generic_init($td, $ckey, $iv);
- switch ($mode){
- case 'encrypt':
- $crypto = mcrypt_generic($td, $input);
- break;
- case 'decrypt':
- $crypto = mdecrypt_generic($td, $input);
- // See if it decrypted successfully. If so, it should contain
- // the string "# SquirrelSpell".
- if (!strstr($crypto, "# SquirrelSpell"))
- $crypto='PANIC';
- break;
- }
- mcrypt_generic_end ($td);
- return $crypto;
- }
-
- function sqspell_upgradeWordsFile($words_string){
- /*
- ** This function transparently upgrades the 0.2 dictionary format to
- ** 0.3, since user-defined languages have been added in 0.3 and
- ** the new format keeps user dictionaries selection in the file.
- */
- global $SQSPELL_APP_DEFAULT, $SQSPELL_VERSION;
-
- /* Define just one dictionary for this user -- the default.
- ** If the user wants more, s/he can set them up in personal
- ** preferences. See doc/UPGRADING for more info.
- */
- $new_words_string=substr_replace($words_string, "# SquirrelSpell User Dictionary $SQSPELL_VERSION\n# Last Revision: " . date("Y-m-d") . "\n# LANG: $SQSPELL_APP_DEFAULT\n# $SQSPELL_APP_DEFAULT", 0, strpos($words_string, "\n")) . "# End\n";
- sqspell_writeWords($new_words_string);
- return $new_words_string;
- }
-
- function sqspell_getSettings($words){
- /*
- ** Right now it just returns an array with the dictionaries
- ** available to the user for spell-checking. It will probably
- ** do more in the future, as features are added.
- */
- global $SQSPELL_APP, $SQSPELL_APP_DEFAULT;
- if (sizeof($SQSPELL_APP) > 1){
- // OK, so there are more than one dictionary option.
- // Now load the user prefs.
- if(!$words)
- $words=sqspell_getWords();
- if ($words){
- // find which dictionaries user wants to use
- preg_match("/# LANG: (.*)/i", $words, $matches);
- $langs=explode(", ", $matches[1]);
- } else {
- // User doesn't have a personal dictionary. Set him up with
- // a default setting.
- $langs[0]=$SQSPELL_APP_DEFAULT;
- }
- } else {
- // There is only one dictionary defined system-wide.
- $langs[0]=$SQSPELL_APP_DEFAULT;
- }
- return $langs;
+
+/**
+ * This function is the GUI wrapper for the options page. SquirrelSpell
+ * uses it for creating all Options pages.
+ *
+ * @param $title The title of the page to display
+ * @param $scriptsrc This is used to link a file.js into the
+ * format. This
+ * allows to separate javascript from the rest of the
+ * plugin and place it into the js/ directory.
+ * @param $body The body of the message to display.
+ * @return void
+ */
+function sqspell_makePage($title, $scriptsrc, $body){
+ global $color, $SQSPELL_VERSION;
+
+ if (! sqgetGlobalVar('MOD', $MOD, SQ_GET) ) {
+ $MOD = 'options_main';
+ }
+
+ displayPageHeader($color, 'None');
+ echo " \n";
+ /**
+ * Check if we need to link in a script.
+ */
+ if($scriptsrc) {
+ echo "\n";
+ }
+ echo html_tag( 'table', '', 'center', '', 'width="95%" border="0" cellpadding="2" cellspacing="0"' ) . "\n"
+ . html_tag( 'tr', "\n" .
+ html_tag( 'td', '' . $title .'', 'center', $color[9] )
+ ) . "\n"
+ . html_tag( 'tr', "\n" .
+ html_tag( 'td', '', 'left' )
+ ) . "\n"
+ . html_tag( 'tr', "\n" .
+ html_tag( 'td', $body, 'left' )
+ ) . "\n";
+ /**
+ * Generate a nice "Return to Options" link, unless this is the
+ * starting page.
+ */
+ if ($MOD != "options_main"){
+ echo html_tag( 'tr', "\n" .
+ html_tag( 'td', '', 'left' )
+ ) . "\n"
+ . html_tag( 'tr', "\n" .
+ html_tag( 'td', ''
+ . _("Back to "SpellChecker Options" page")
+ . '',
+ 'center' )
+ ) . "\n";
+ }
+ /**
+ * Close the table and display the version.
+ */
+ echo html_tag( 'tr', "\n" .
+ html_tag( 'td', '', 'left' )
+ ) . "\n"
+ . html_tag( 'tr',
+ html_tag( 'td', 'SquirrelSpell ' . $SQSPELL_VERSION, 'center', $color[9] )
+ ) . "\n\n";
+ echo '