start of squirrelspell internationalization
authorphilippe_mingo <philippe_mingo@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Thu, 8 Nov 2001 16:00:33 +0000 (16:00 +0000)
committerphilippe_mingo <philippe_mingo@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Thu, 8 Nov 2001 16:00:33 +0000 (16:00 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@1706 7612ce4b-ef26-0410-bec9-ea0150e637f0

plugins/squirrelspell/INSTALL
plugins/squirrelspell/modules/check_me.mod.php
plugins/squirrelspell/modules/crypto.mod.php
plugins/squirrelspell/modules/forget_me_not.mod.php
plugins/squirrelspell/setup.php
plugins/squirrelspell/sqspell_config.php
plugins/squirrelspell/sqspell_functions.php
plugins/squirrelspell/sqspell_interface.php
plugins/squirrelspell/sqspell_options.php

index 01c2c38488d9c35550f19c29d3afb25081822fe5..87750c7b0dab9393e03e6e77c21d208bdc2646a2 100644 (file)
@@ -17,3 +17,103 @@ Enable the plugin either by hand or by running the configure script from
 your squirrelmail install directory.
 
 Enjoy and report bugs. ;)
+
+This is a commented sqspell_config.php
+
+<?php
+
+   /**
+    **  sqspell_config.php -- SquirrelSpell Configuration file.
+    **
+    **  Copyright (c) 1999-2000 The SquirrelMail development team
+    **  Licensed under the GNU GPL. For full terms see the file COPYING.
+    **
+    **
+    **
+    **  $Id$
+    **/
+
+    /* Just for poor wretched souls with E_ALL. :) */
+    global $username, $data_dir;
+
+    /**
+       SPELL-CHECKING APPLICATIONS:
+       ----------------------------
+       This feature was added/changed in 0.3. Use this array to set up
+       which dictionaries are available to users. If you only have
+       English spellchecker on your system, then let this line be:
+
+       $SQSPELL_APP = array("English" => "ispell -a");
+
+       or
+
+       $SQSPELL_APP = array("English" => "/usr/local/bin/aspell -a");
+
+       Sometimes you have to specify full path for PHP to find it.
+       Aspell is a better spell-checker than Ispell, so you're encouraged
+       to use it.
+
+       If you want to have more than one dictionary available to users,
+       configure the array to look something like this:
+
+       $SQSPELL_APP = array(
+                       "English" => "aspell -a",
+                            "Russian" => "ispell -d russian -a",
+                       ...
+                       "Swahili" => "ispell -d swahili -a"
+                      );
+
+       Watch the commas, making sure there isn't one after your last
+       dictionary declaration. Also, make sure all these dictionaries
+       are available on your system before you specify them here.
+
+       Whatever your setting is, don't omit the "-a" flag.
+
+    **/
+    $SQSPELL_APP = array('English' => 'ispell -a');
+
+    /**
+       DEFAULT DICTIONARY
+       -------------------
+       Even if you're only running one dictionary, still specify which one
+       is the default. Watch the case -- it has to be exactly as in array
+       you declared in $SQSPELL_APP.
+    **/
+    $SQSPELL_APP_DEFAULT='English';
+
+    /**
+       USER DICTIONARY:
+       -----------------
+       $SQSPELL_WORDS_FILE is a location and mask of a user dictionary file.
+       The default setting should be OK for most everyone. Read PRIVACY and
+       CRYPTO in the "doc" directory.
+    **/
+    $SQSPELL_WORDS_FILE = "$data_dir/$username.words";
+
+    /**
+       CASE SENSITIVITY:
+       ------------------
+       Use $SQSPELL_EREG="ereg" for case-sensitive matching of user
+       dictionary, or $SQSPELL_EREG="eregi" for case-insensitive
+       matching. It is advised to use case-sensitive matching.
+    **/
+    $SQSPELL_EREG="ereg";
+
+    /**
+       SOUP NAZI (AVOIDING BAD BROWSERS)
+       -------------------------------------
+       Since some browsers choke on JavaScript, here is an option to disable the
+       browsers with known problems. All you do is add some part of an USER_AGENT
+       string of an offending browser which you want to disable and users will not
+       know about this plugin. E.g. browsers with "Mozilla/4.61 (Macintosh, I, PPC)"
+       USER_AGENT string will get weeded out if you provide "Macintosh" in the
+       config string.
+
+       Mozilla/2 -- You're kidding, right?
+       Mozilla/3 -- known not to work
+       Opera -- known not to work
+       Macintosh -- Netscape 4.x on Macintosh chokes for some reason.
+                    Adding until resolved.
+    **/
+    $SQSPELL_SOUP_NAZI = 'Mozilla/3, Mozilla/2, Opera 4, Opera/4, Macintosh';
+?>    
\ No newline at end of file
index 0a650944d22f8a99ea2c56520fd0a12c005f67b2..c700240fe8c4488b2e0868bbe91953cd23e1e27d 100644 (file)
@@ -1,12 +1,17 @@
 <?php
+   /**
+    **  check_me.mod.php -- Squirrelspell module
+    **
+    **  Copyright (c) 1999-2001 The SquirrelMail development team
+    **  Licensed under the GNU GPL. For full terms see the file COPYING.
+    **
+    **  This module is the main workhorse of SquirrelSpell. It submits
+    **  the message to the spell-checker, parses the output, and loads
+    **  the interface window.
+    **
+    **  $Id$
+    **/
 
- /**
-    CHECK_ME.MOD.PHP
-    -----------------
-    This module is the main workhorse of SquirrelSpell. It submits
-    the message to the spell-checker, parses the output, and loads
-    the interface window.
-                                                               **/
 // Declaring globals for E_ALL.
 global $sqspell_text, $SQSPELL_APP, $sqspell_use_app, $attachment_dir,
        $username, $SQSPELL_EREG, $color; 
@@ -162,7 +167,7 @@ global $sqspell_text, $SQSPELL_APP, $sqspell_use_app, $attachment_dir,
    <table border="0" width="100%">
     <tr align="center">
      <td colspan="4">
-      <span style="background-color:<?php echo $color[9] ?>">Line with an error:</span><br>
+      <span style="background-color:<?php echo $color[9] . '">' . _("Line with an error:"); ?></span><br>
       <textarea name="sqspell_line_area" cols="50" rows="3" wrap="hard" onfocus="this.blur()"></textarea>
      </td>
     </tr>
index dce29801338bc9489e6a84a22a17b9aaec06078a..5ae0833df46c7e05900e064de7f7c7469b74e333 100644 (file)
@@ -1,36 +1,46 @@
 <?php
 
-/**
-   CRYPTO.MOD.PHP
-   --------------
-   This module handles the encryption/decryption of the user dictionary
-   if the user so chooses from the options page.
-                                                               **/
-// Declaring globals for E_ALL
-global $action, $SQSPELL_CRYPTO;
-switch ($action){
- case "encrypt":
-  // Let's encrypt the file.
-  $words=sqspell_getWords();
-  // flip the flag.
-  $SQSPELL_CRYPTO=true;
-  sqspell_writeWords($words);
-  $msg="<p>Your personal dictionary has been <strong>encrypted</strong> and is now stored in an <strong>encrypted format</strong>.</p>";
- break;
+   /**
+    **  crypto.mod.php -- Squirrelspell module
+    **
+    **  Copyright (c) 1999-2001 The SquirrelMail development team
+    **  Licensed under the GNU GPL. For full terms see the file COPYING.
+    **
+    **   This module handles the encryption/decryption of the user dictionary
+    **   if the user so chooses from the options page.
+    **
+    **  $Id$
+    **/
 
- case "decrypt":
-  // Decrypt the file and save plain text.
-  $words=sqspell_getWords();
-  // flip the flag.
-  $SQSPELL_CRYPTO=false;
-  sqspell_writeWords($words);
-  $msg="<p>Your personal dictionary has been <strong>decrypted</strong> and is now stored as <strong>clear text</strong>.</p>";
- break;
- case "":
-  // Wait, this shouldn't happen! :)
-  $msg = "<p>No action requested.</p>";
- break;
-}
- sqspell_makePage("Personal Dictionary Crypto Settings", null, $msg);
+    // Declaring globals for E_ALL
+    global $action, $SQSPELL_CRYPTO;
+    switch ($action){
+     case 'encrypt':
+      // Let's encrypt the file.
+      $words=sqspell_getWords();
+      // flip the flag.
+      $SQSPELL_CRYPTO=true;
+      sqspell_writeWords($words);
+      $msg='<p>' .
+           _("Your personal dictionary has been <strong>encrypted</strong> and is now stored in an <strong>encrypted format"=.
+           '</strong>.</p>';
+     break;
+    
+     case 'decrypt':
+      // Decrypt the file and save plain text.
+      $words=sqspell_getWords();
+      // flip the flag.
+      $SQSPELL_CRYPTO=false;
+      sqspell_writeWords($words);
+      $msg='<p>' . 
+           _("Your personal dictionary has been <strong>decrypted</strong> and is now stored as <strong>clear text") . 
+           '</strong>.</p>';
+     break;
+     
+     case "":
+      // Wait, this shouldn't happen! :)
+      $msg = "<p>No action requested.</p>";
+     break;
+    }
+     sqspell_makePage( _("Personal Dictionary Crypto Settings"), null, $msg);
 ?>
index 0770ba92abbe31b3110c57850bbf1b421b86a070..f52a867f928bec30b3d0b7324e64669613e2cf8e 100644 (file)
@@ -38,6 +38,6 @@
  // display the splash screen, then close it automatically after 2 sec.
  $onload="setTimeout('self.close()', 2000)";
  $msg="<form onsubmit=\"return false\"><div align=\"center\"><input type=\"submit\" value=\"  Close  \" onclick=\"self.close()\"></div></form>";
- sqspell_makeWindow($onload, "Personal Dictionary Updated", null, $msg);
+ sqspell_makeWindow($onload, _("Personal Dictionary Updated"), null, $msg);
 ?>
 
index 671b63adae09de60a37f12ed51a6a4311b0bde86..351bb266f78eabd6461b71bc1e8f73f71a6306d7 100644 (file)
@@ -1,73 +1,70 @@
 <?php
 
-/**
- * SETUP.PHP
- * ---------
- * This is a standard Squirrelmail-1.2 API for plugins.
- */
+   /**
+    **  setup.php -- Squirrelspell setup file
+    **
+    **  Copyright (c) 1999-2001 The SquirrelMail development team
+    **  Licensed under the GNU GPL. For full terms see the file COPYING.
+    **
+    **  This is a standard Squirrelmail-1.2 API for plugins.
+    **
+    **  $Id$
+    **/
 
-/**
- * This function checks whether the user's USER_AGENT is known to
- * be broken. If so, returns true and the plugin is invisible to the
- * offending browser.
- */
-function soupNazi(){
-    global $HTTP_USER_AGENT;
-    require ('../plugins/squirrelspell/sqspell_config.php');
-    $soup_nazi = false;
+    /**
+     * This function checks whether the user's USER_AGENT is known to
+     * be broken. If so, returns true and the plugin is invisible to the
+     * offending browser.
+     */
+    function soupNazi(){
 
-    $soup_menu = explode(',', $SQSPELL_SOUP_NAZI);
-    for ($i = 0; $i < sizeof($soup_menu); $i++) {
-        if (stristr($HTTP_USER_AGENT, trim($soup_menu[$i]))) {
-            $soup_nazi=true;
-        }
-    }
-    return $soup_nazi;
-}
+        global $HTTP_USER_AGENT;
+        
+        require_once('../plugins/squirrelspell/sqspell_config.php');
 
-function squirrelmail_plugin_init_squirrelspell() {
-    /* Standard initialization API. */
-    global $squirrelmail_plugin_hooks;
+        $soup_menu = explode( ',', $SQSPELL_SOUP_NAZI );
+        return( in_array( trim( $HTTP_USER_AGENT ), $soup_menu ) );
+    }
 
-    $squirrelmail_plugin_hooks["compose_button_row"]["squirrelspell"] = "squirrelspell_setup";
-    $squirrelmail_plugin_hooks["options_register"]["squirrelspell"] = "squirrelspell_options";
-    $squirrelmail_plugin_hooks["options_link_and_description"]["squirrelspell"] = "squirrelspell_options";
-}
+    function squirrelmail_plugin_init_squirrelspell() {
+        /* Standard initialization API. */
+        global $squirrelmail_plugin_hooks;
 
-function squirrelspell_options() {
-   // Gets added to the user's OPTIONS page.
-   global $optionpages;
+        $squirrelmail_plugin_hooks['compose_button_row']['squirrelspell'] = 'squirrelspell_setup';
+        $squirrelmail_plugin_hooks['options_register']['squirrelspell'] = 'squirrelspell_options';
+        $squirrelmail_plugin_hooks['options_link_and_description']['squirrelspell'] = 'squirrelspell_options';
+    }
 
-   if (soupNazi()) {
-       return;
-   }
+    function squirrelspell_options() {
+       // Gets added to the user's OPTIONS page.
+       global $optionpages;
 
-   /* Register Squirrelspell with the $optionpages array. */
-   $optionpages[] = array(
-       'name' => 'SpellChecker Options',
-       'url'  => '../plugins/squirrelspell/sqspell_options.php',
-       'desc' => 'Here you may set up how your personal dictionary is stored,
-                  edit it, or choose which languages should be available to
-                  you when spell-checking.',
-       'js'   => true
-    );
-}
+       if ( !soupNazi() ) {
 
-function squirrelspell_setup() {
-   /* Gets added to the COMPOSE buttons row. */
-   if (soupNazi()) {
-       return;
-   }
+           /* Register Squirrelspell with the $optionpages array. */
+           $optionpages[] = array(
+               'name' => _("SpellChecker Options"),
+               'url'  => '../plugins/squirrelspell/sqspell_options.php',
+               'desc' => _("Here you may set up how your personal dictionary is stored, edit it, or choose which languages should be available to you when spell-checking."),
+               'js'   => TRUE
+            );
+        }
+    }
 
-?>
-    <script type="text/javascript">
-    <!--
-        // using document.write to hide this functionality from people
-        // with JavaScript turned off.
-        document.write("<input type=\"button\" value=\"Check Spelling\" onclick=\"window.open('../plugins/squirrelspell/sqspell_interface.php', 'sqspell', 'status=yes,width=550,height=370,resizable=yes')\">");
-    //-->
-    </script>
-<?php
-}
+    function squirrelspell_setup() {
+        /* Gets added to the COMPOSE buttons row. */
+        if ( !soupNazi() ) {
+            /*
+            ** using document.write to hide this functionality from people
+            ** with JavaScript turned off.        
+            */
+            echo "<script type=\"text/javascript\">\n".
+                    "<!--\n".
+                    'document.write("<input type=\"button\" value=\"' .
+                        _("Check Spelling") . '\" onclick=\"window.open(\'../plugins/squirrelspell/sqspell_interface.php\', \'sqspell\', \'status=yes,width=550,height=370,resizable=yes\')\">");'. "\n" .
+                    "//-->\n".
+                    "</script>\n";
+        }
+    }
 
-?>
+?>
\ No newline at end of file
index e0405b4bfadb296aeebb6ca091a69dbeacb6f5bf..a34a856f4eaaffb6d787893aa023cae7ecc5b57a 100644 (file)
@@ -1,88 +1,24 @@
 <?php
-/** SquirrelSpell Configuration file. **/
 
-// Just for poor wretched souls with E_ALL. :)
-global $username, $data_dir;
+   /**
+    **  sqspell_config.php -- SquirrelSpell Configuration file.
+    **
+    **  Copyright (c) 1999-2001 The SquirrelMail development team
+    **  Licensed under the GNU GPL. For full terms see the file COPYING.
+    **
+    **
+    **
+    **  $Id$
+    **/
 
-/** 
-   SPELL-CHECKING APPLICATIONS:
-   ----------------------------
-   This feature was added/changed in 0.3. Use this array to set up
-   which dictionaries are available to users. If you only have 
-   English spellchecker on your system, then let this line be:
+    /* Just for poor wretched souls with E_ALL. :) */
+    global $username, $data_dir;
 
-   $SQSPELL_APP = array("English" => "ispell -a");
 
-   or
+    $SQSPELL_APP = array( 'English' => 'ispell -a' );
+    $SQSPELL_APP_DEFAULT = 'English';
+    $SQSPELL_WORDS_FILE = "$data_dir/$username.words";
+    $SQSPELL_EREG = 'ereg';
+    $SQSPELL_SOUP_NAZI = 'Mozilla/3, Mozilla/2, Opera 4, Opera/4, Macintosh';
 
-   $SQSPELL_APP = array("English" => "/usr/local/bin/aspell -a");
-
-   Sometimes you have to specify full path for PHP to find it.
-   Aspell is a better spell-checker than Ispell, so you're encouraged
-   to use it.
-
-   If you want to have more than one dictionary available to users,
-   configure the array to look something like this:
-
-   $SQSPELL_APP = array(
-                       "English" => "aspell -a",
-                        "Russian" => "ispell -d russian -a",
-                       ...
-                       "Swahili" => "ispell -d swahili -a"
-                      );
-   
-   Watch the commas, making sure there isn't one after your last
-   dictionary declaration. Also, make sure all these dictionaries
-   are available on your system before you specify them here.
-   
-   Whatever your setting is, don't omit the "-a" flag.
-
-                                                               **/
-$SQSPELL_APP = array("English" => "ispell -a");
-
-/**
-   DEFAULT DICTIONARY
-   -------------------
-   Even if you're only running one dictionary, still specify which one 
-   is the default. Watch the case -- it has to be exactly as in array
-   you declared in $SQSPELL_APP.       
-                                                               **/
-$SQSPELL_APP_DEFAULT="English";
-
-/**
-   USER DICTIONARY:
-   -----------------
-   $SQSPELL_WORDS_FILE is a location and mask of a user dictionary file. 
-   The default setting should be OK for most everyone. Read PRIVACY and
-   CRYPTO in the "doc" directory.
-                                                               **/
-$SQSPELL_WORDS_FILE = "$data_dir/$username.words";
-
-/**
-   CASE SENSITIVITY:
-   ------------------
-   Use $SQSPELL_EREG="ereg" for case-sensitive matching of user 
-   dictionary, or $SQSPELL_EREG="eregi" for case-insensitive 
-   matching. It is advised to use case-sensitive matching.
-                                                               **/
-$SQSPELL_EREG="ereg";
-
-/**
-   SOUP NAZI (AVOIDING BAD BROWSERS)
-   -------------------------------------
-   Since some browsers choke on JavaScript, here is an option to disable the
-   browsers with known problems. All you do is add some part of an USER_AGENT 
-   string of an offending browser which you want to disable and users will not
-   know about this plugin. E.g. browsers with "Mozilla/4.61 (Macintosh, I, PPC)"
-   USER_AGENT string will get weeded out if you provide "Macintosh" in the 
-   config string.
-  
-   Mozilla/2 -- You're kidding, right?
-   Mozilla/3 -- known not to work
-   Opera -- known not to work
-   Macintosh -- Netscape 4.x on Macintosh chokes for some reason. 
-                Adding until resolved.
-                                                               **/
-$SQSPELL_SOUP_NAZI = "Mozilla/3, Mozilla/2, Opera 4, Opera/4, Macintosh";
-
-?>
+?>
\ No newline at end of file
index 5eaa46155506d927fa68926302bbd98ec255c31b..c53018f253939a20a6261162683baa5c08fb89c8 100644 (file)
 <?php
-/**
-   SQSPELL_FUNCTIONS.PHP
-   --------------
-   All SquirrelSpell-wide functions are in this file.
-                                                               **/
-                                                               
-function sqspell_makePage($title, $scriptsrc, $body){
- //
- // GUI wrap-around for the OPTIONS page.
- //
- global $color, $SQSPELL_VERSION, $MOD;
- displayPageHeader($color, "None");
- ?>
- &nbsp;<br>
- <?php if($scriptsrc) { ?>
-  <script type="text/javascript" src="js/<?php echo $scriptsrc ?>"></script>
- <?php } ?>
- <table width="95%" align="center" border="0" cellpadding="2" cellspacing="0">
-  <tr>
-   <td bgcolor="<?php echo $color[9] ?>" align="center">
-      <strong><?php echo $title ?></strong>
-   </td>
-  </tr>
-  <tr><td><hr></td></tr>
-  <tr><td>
-   <?php echo $body ?>
-  </td></tr>
-  <?php if ($MOD!="options_main"){ 
-   // Generate a nice return-to-main link.
-   ?>
-   <tr><td><hr></td></tr>
-   <tr><td align="center"><a href="sqspell_options.php">Back to &quot;SpellChecker Options&quot; page</a></td></tr>
-  <?php } ?>
-  <tr><td><hr></td></tr>
-  <tr>
-   <td bgcolor="<?php echo $color[9] ?>" align="center">
-      SquirrelSpell <?php echo $SQSPELL_VERSION ?>
-   </td>
-  </tr>
- </table>
- <?php
-}
-
-function sqspell_makeWindow($onload, $title, $scriptsrc, $body){
- //
- // GUI wrap-around for the pop-up window interface.
- //
- global $color, $SQSPELL_VERSION;
- ?>
- <html>
-  <head>
-   <title><?php echo $title ?></title>
-   <?php if ($scriptsrc){ ?>
-    <script type="text/javascript" src="js/<?php echo $scriptsrc ?>"></script>
-   <?php } ?>
-  </head>
-  <body text="<?php echo $color[8] ?>" 
-        bgcolor="<?php echo $color[4] ?>" 
-       link="<?php echo $color[7] ?>" 
-       vlink="<?php echo $color[7] ?>" 
-       alink="<?php echo $color[7] ?>"<?php
-       if ($onload) echo " onload=\"$onload\""; ?>>
-   <table width="100%" border="0" cellpadding="2">
-    <tr>
-     <td bgcolor="<?php echo $color[9] ?>" align="center">
-      <strong><?php echo $title ?></strong>
-     </td>
-    </tr>
-    <tr>
-     <td><hr></td>
-    </tr>
-    <tr>
-     <td>
-      <?php echo $body ?>
-     </td>
-    </tr>
-    <tr>
-     <td><hr></td>
-    </tr>
-    <tr>
-     <td bgcolor="<?php echo $color[9] ?>" align="center">
-      SquirrelSpell <?php echo $SQSPELL_VERSION ?>
-     </td>
-    </tr>
-   </table>
-  </body>
- </html>
- <?php
-}
-
-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;
-}
-
-function sqspell_getLang($words, $lang){
- //
- // Returns words of a specific user dictionary.
- //
- $start=strpos($words, "# $lang\n");
- if (!$start) return "";
- $end=strpos($words, "#", $start+1);
- $lang_words = substr($words, $start, $end-$start);
- return $lang_words;
-}
-function sqspell_getWords(){
- //
- // This baby operates the user dictionary. If the format is clear-text,
- // then it just reads the file and returns it. However, if the file is
- // encrypted, then it decrypts it, checks whether the decryption was 
- // successful, troubleshoots if not, then returns the clear-text dictionary
- // to the app.
- //
- global $SQSPELL_WORDS_FILE, $SQSPELL_CRYPTO;
- $words="";
- if (file_exists($SQSPELL_WORDS_FILE)){
-  // Gobble it up.
-  $fp=fopen($SQSPELL_WORDS_FILE, "r");
-  $words=fread($fp, filesize($SQSPELL_WORDS_FILE));
-  fclose($fp);
- }
- // Check if this is an encrypted file by looking for
- // the string "# SquirrelSpell" in it.
- if ($words && !strstr($words, "# SquirrelSpell")){
-  // This file is encrypted or mangled. Try to decrypt it.
-  // If fails, raise hell.
-  global $key, $onetimepad, $old_key;
-  if ($old_key) {
-   // an override in case user is trying to decrypt a dictionary
-   // with his old password
-   $clear_key=$old_key;
-  } else {
-   // get user's password (the key).
-   $clear_key = OneTimePadDecrypt($key, $onetimepad);
-  }
-  // decrypt
-  $words=sqspell_crypto("decrypt", $clear_key, $words);
-  if ($words=="PANIC"){
-   // AAAAAAAAAAAH!!!!! OK, ok, breathe!
-   // Let's hope the decryption failed because the user changed his
-   // password. Bring up the option to key in the old password
-   // or wipe the file and start over if everything else fails.
-   $msg="<p>
-    <strong>ATTENTION:</strong><br>
-    SquirrelSpell was unable to decrypt your personal dictionary. This is most likely
-    due to the fact that you have changed your mailbox password. In order to proceed,
-    you will have to supply your old password so that SquirrelSpell can decrypt your
-    personal dictionary. It will be re-encrypted with your new password after this.<br>
-    If you haven't encrypted your dictionary, then it got mangled and is no longer
-    valid. You will have to delete it and start anew. This is also true if you don't
-    remember your old password -- without it, the encrypted data is no longer 
-    accessible.</p>
-    <blockquote>
-    <form method=\"post\" onsubmit=\"return AYS()\">
-     <input type=\"hidden\" name=\"MOD\" value=\"crypto_badkey\">
-     <p><input type=\"checkbox\" name=\"delete_words\" value=\"ON\"> Delete my dictionary and start a new one<br>
-     Decrypt my dictionary with my old password: <input name=\"old_key\" size=\"10\"></p>
-    </blockquote>
-     <p align=\"center\"><input type=\"submit\" value=\"Proceed &gt;&gt;\"></p>
-    </form>
-   ";
-   // See if this happened in the pop-up window or when accessing
-   // the SpellChecker options page. 
-   global $SCRIPT_NAME;
-   if (strstr($SCRIPT_NAME, "sqspell_options"))
-       sqspell_makePage("Error Decrypting Dictionary", "decrypt_error.js", $msg);
-   else sqspell_makeWindow(null, "Error Decrypting Dictionary", "decrypt_error.js", $msg); 
-   exit;
-  } else {
-   // OK! Phew. Set the encryption flag to true so we can later on 
-   // encrypt it again before saving to HDD.
-   $SQSPELL_CRYPTO=true;
-  }
- } else {
-  // No encryption is used. Set $SQSPELL_CRYPTO to false, in case we have to
-  // save the dictionary later.
-  $SQSPELL_CRYPTO=false;
- }
- // Check if we need to upgrade the dictionary from version 0.2.x
- if (strstr($words, "Dictionary v0.2")) $words=sqspell_upgradeWordsFile($words);
- return $words;
-}
 
-function sqspell_writeWords($words){
- //
- // Writes user dictionary into the $username.words file, then changes mask
- // to 0600. If encryption is needed -- does that, too.
- //
- global $SQSPELL_WORDS_FILE, $SQSPELL_CRYPTO;
- // if $words is empty, create a template entry.
- if (!$words) $words=sqspell_makeDummy();
- if ($SQSPELL_CRYPTO){
-  // User wants to encrypt the file. So be it.
-  // get his password to use as a key.
-  global $key, $onetimepad;
-  $clear_key=OneTimePadDecrypt($key, $onetimepad);
-  // Try encrypting it. If fails, scream bloody hell.
-  $save_words = sqspell_crypto("encrypt", $clear_key, $words);
-  if ($save_words=="PANIC"){
-   // AAAAAAAAH! I'm not handling this yet, since obviously
-   // the admin of the site forgot to compile the MCRYPT support in.
-   // I will add a handler for this case later, when I can come up
-   // with some work-around... Right now, do nothing. Let the Admin's
-   // head hurt.. ;)))
-  }
- } else {
-  $save_words = $words;
- }
- $fp=fopen($SQSPELL_WORDS_FILE, "w");
- fwrite($fp, $save_words);
- fclose($fp);
- chmod($SQSPELL_WORDS_FILE, 0600);
-}
-
-function sqspell_deleteWords(){
- //
- // so I open the door to my enemies,
- // and I ask can we wipe the slate clean,
- // but they tell me to please go...
- // uhm... Well, this just erases the user dictionary file.
- //
- global $SQSPELL_WORDS_FILE;
- if (file_exists($SQSPELL_WORDS_FILE)) unlink($SQSPELL_WORDS_FILE);
-}
-
-function sqspell_makeDummy(){
- //
- // Creates an empty user dictionary for the sake of saving prefs or
- // whatever.
- //
- global $SQSPELL_VERSION, $SQSPELL_APP_DEFAULT;
- $words="# SquirrelSpell User Dictionary $SQSPELL_VERSION\n# Last Revision: " . date("Y-m-d") . "\n# LANG: $SQSPELL_APP_DEFAULT\n# End\n"; 
- return $words;
-}
-
-/** 
-   VERSION:
-   ---------
-   SquirrelSpell version. Don't modify, since it identifies the format
-   of the user dictionary files and messing with this can do ugly 
-   stuff. :)
-                                                               **/
-$SQSPELL_VERSION="v0.3.5";
-
-
-?>
+   /**
+    **  sqspell_functions.php -- All SquirrelSpell-wide functions are in this file.
+    **
+    **  Copyright (c) 1999-2001 The SquirrelMail development team
+    **  Licensed under the GNU GPL. For full terms see the file COPYING.
+    **
+    **
+    **
+    **  $Id$
+    **/
+                                                               
+    function sqspell_makePage($title, $scriptsrc, $body){
+    /*
+    ** GUI wrap-around for the OPTIONS page.
+    */
+    global $color, $SQSPELL_VERSION, $MOD;
+    displayPageHeader($color, 'None');
+     
+    echo "&nbsp;<br>\n";
+    if($scriptsrc) { 
+        echo "<script type=\"text/javascript\" src=\"js/$scriptsrc\"></script>\n";
+    }
+    echo '<table width="95%" align="center" border="0" cellpadding="2" cellspacing="0">'.
+            '<tr>'.
+                "<td bgcolor=\"$color[9]\" align=center>".
+                "<strong>$title</strong>".
+                '</td>'.
+            '</tr>'.
+            '<tr><td><hr></td></tr>'.
+            "<tr><td>$body</td></tr>";
+    if ($MOD!="options_main"){ 
+        // Generate a nice return-to-main link.
+        echo '<tr><td><hr></td></tr>'.
+             '<tr><td align="center"><a href="sqspell_options.php">' .
+                _("Back to &quot;SpellChecker Options&quot; page") . '</a></td></tr>';
+    }
+    echo '<tr><td><hr></td></tr>'.
+         '<tr>'.
+            "<td bgcolor=\"$color[9]\" align=center>".
+                "SquirrelSpell $SQSPELL_VERSION".
+            '</td>'.
+         '</tr>'.
+        '</table>';
+    }
+    
+    function sqspell_makeWindow($onload, $title, $scriptsrc, $body){
+    
+        /*
+        ** GUI wrap-around for the pop-up window interface.
+        */
+        global $color, $SQSPELL_VERSION, $theme_css;
+        
+        echo "<html>\n".
+              "<head>\n".
+              "<title>$title</title>\n";
+        if ($theme_css != "") {
+            echo "<LINK REL=\"stylesheet\" TYPE=\"text/css\" HREF=\"$theme_css\">\n";
+        }          
+        if ($scriptsrc){
+            echo "<script type=\"text/javascript\" src=\"js/$scriptsrc\"></script>\n";
+        }
+        echo "</head>\n".
+             "<body text=\"$color[8]\" bgcolor=\"$color[4]\" link=\"$color[7]\" vlink=\"$color[7]\" alink=\"$color[7]\"";
+        if ($onload) {
+            echo " onload=\"$onload\"";
+        }
+        echo '>'.
+             '<table width="100%" border="0" cellpadding="2">'.
+                '<tr>'.
+                    "<td bgcolor=\"$color[9]\" align=center>".
+                        "<strong>$title</strong>".
+                    '</td>'.
+                '</tr>'.
+                '<tr><td><hr></td></tr>'.
+                '<tr>'.
+                    "<td>$body</td>".
+                '</tr>'.
+                '<tr><td><hr></td></tr>'.
+                '<tr>'.
+                    "<td bgcolor=\"$color[9]\" align=center>".
+                        "SquirrelSpell $SQSPELL_VERSION".
+                    '</td>'.
+                '</tr>'.
+            '</table>'.
+            "</body>\n</html>\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;
+    }
+    
+    function sqspell_getLang($words, $lang){
+        //
+        // Returns words of a specific user dictionary.
+        //
+        $start=strpos($words, "# $lang\n");
+        if (!$start) return '';
+        $end=strpos($words, "#", $start+1);
+        $lang_words = substr($words, $start, $end-$start);
+        return $lang_words;
+    }
+     
+    function sqspell_getWords(){
+        //
+        // This baby operates the user dictionary. If the format is clear-text,
+        // then it just reads the file and returns it. However, if the file is
+        // encrypted, then it decrypts it, checks whether the decryption was 
+        // successful, troubleshoots if not, then returns the clear-text dictionary
+        // to the app.
+        //
+        global $SQSPELL_WORDS_FILE, $SQSPELL_CRYPTO;
+        $words="";
+        if (file_exists($SQSPELL_WORDS_FILE)){
+            // Gobble it up.
+            $fp=fopen($SQSPELL_WORDS_FILE, 'r');
+            $words=fread($fp, filesize($SQSPELL_WORDS_FILE));
+            fclose($fp);
+        }
+        // Check if this is an encrypted file by looking for
+        // the string "# SquirrelSpell" in it.
+        if ($words && !strstr($words, "# SquirrelSpell")){
+            // This file is encrypted or mangled. Try to decrypt it.
+            // If fails, raise hell.
+            global $key, $onetimepad, $old_key;
+            if ($old_key) {
+                // an override in case user is trying to decrypt a dictionary
+                // with his old password
+                $clear_key=$old_key;
+            } else {
+                // get user's password (the key).
+                $clear_key = OneTimePadDecrypt($key, $onetimepad);
+            }
+            // decrypt
+            $words=sqspell_crypto("decrypt", $clear_key, $words);
+            if ($words=="PANIC"){
+                // AAAAAAAAAAAH!!!!! OK, ok, breathe!
+                // Let's hope the decryption failed because the user changed his
+                // password. Bring up the option to key in the old password
+                // or wipe the file and start over if everything else fails.
+                $msg='<p>'.
+                '<strong>' . _("ATTENTION:") . '</strong><br>' .
+                _("SquirrelSpell was unable to decrypt your personal dictionary. This is most likely due to the fact that you have changed your mailbox password. In order to proceed, you will have to supply your old password so that SquirrelSpell can decrypt your personal dictionary. It will be re-encrypted with your new password after this.<br>If you haven't encrypted your dictionary, then it got mangled and is no longer valid. You will have to delete it and start anew. This is also true if you don't remember your old password -- without it, the encrypted data is no longer accessible.").
+                "</p>
+                <blockquote>
+                <form method=\"post\" onsubmit=\"return AYS()\">
+                 <input type=\"hidden\" name=\"MOD\" value=\"crypto_badkey\">
+                 <p><input type=\"checkbox\" name=\"delete_words\" value=\"ON\">" . _("Delete my dictionary and start a new one") . '<br>'.
+                 _("Decrypt my dictionary with my old password:") . "<input name=\"old_key\" size=\"10\"></p>
+                </blockquote>
+                 <p align=\"center\"><input type=\"submit\" value=\"" . _("Proceed") . " &gt;&gt;\"></p>
+                </form>
+                ";
+                // See if this happened in the pop-up window or when accessing
+                // the SpellChecker options page. 
+                global $SCRIPT_NAME;
+                if (strstr($SCRIPT_NAME, "sqspell_options"))
+                    sqspell_makePage( _("Error Decrypting Dictionary"), "decrypt_error.js", $msg);
+                else 
+                    sqspell_makeWindow(null, _("Error Decrypting Dictionary"), "decrypt_error.js", $msg); 
+                exit;
+            } else {
+                // OK! Phew. Set the encryption flag to true so we can later on 
+                // encrypt it again before saving to HDD.
+                $SQSPELL_CRYPTO=true;
+            }
+        } else {
+            // No encryption is used. Set $SQSPELL_CRYPTO to false, in case we have to
+            // save the dictionary later.
+            $SQSPELL_CRYPTO=false;
+        }
+        // Check if we need to upgrade the dictionary from version 0.2.x
+        if (strstr($words, "Dictionary v0.2")) $words=sqspell_upgradeWordsFile($words);
+        return $words;
+    }
+    
+    function sqspell_writeWords($words){
+        //
+        // Writes user dictionary into the $username.words file, then changes mask
+        // to 0600. If encryption is needed -- does that, too.
+        //
+        global $SQSPELL_WORDS_FILE, $SQSPELL_CRYPTO;
+        // if $words is empty, create a template entry.
+        if (!$words) $words=sqspell_makeDummy();
+        if ($SQSPELL_CRYPTO){
+            // User wants to encrypt the file. So be it.
+            // get his password to use as a key.
+            global $key, $onetimepad;
+            $clear_key=OneTimePadDecrypt($key, $onetimepad);
+            // Try encrypting it. If fails, scream bloody hell.
+            $save_words = sqspell_crypto("encrypt", $clear_key, $words);
+            if ($save_words == 'PANIC'){
+                /*
+                ** AAAAAAAAH! I'm not handling this yet, since obviously
+                ** the admin of the site forgot to compile the MCRYPT support in.
+                ** I will add a handler for this case later, when I can come up
+                ** with some work-around... Right now, do nothing. Let the Admin's
+                ** head hurt.. ;)))
+                */
+            }
+        } else {
+            $save_words = $words;
+        }
+        $fp=fopen($SQSPELL_WORDS_FILE, "w");
+        fwrite($fp, $save_words);
+        fclose($fp);
+        chmod($SQSPELL_WORDS_FILE, 0600);
+    }
+    
+    function sqspell_deleteWords(){
+        /*
+        ** so I open the door to my enemies,
+        ** and I ask can we wipe the slate clean,
+        ** but they tell me to please go...
+        ** uhm... Well, this just erases the user dictionary file.
+        */
+        global $SQSPELL_WORDS_FILE;
+        if (file_exists($SQSPELL_WORDS_FILE)) unlink($SQSPELL_WORDS_FILE);
+    }
+    
+    function sqspell_makeDummy(){
+        //
+        // Creates an empty user dictionary for the sake of saving prefs or
+        // whatever.
+        //
+        global $SQSPELL_VERSION, $SQSPELL_APP_DEFAULT;
+        $words="# SquirrelSpell User Dictionary $SQSPELL_VERSION\n# Last Revision: " . date('Y-m-d') . "\n# LANG: $SQSPELL_APP_DEFAULT\n# End\n"; 
+        return $words;
+    }
+    
+    /** 
+       VERSION:
+       ---------
+       SquirrelSpell version. Don't modify, since it identifies the format
+       of the user dictionary files and messing with this can do ugly 
+       stuff. :)
+                                                                       **/
+    $SQSPELL_VERSION="v0.3.5";
+    
+?>
\ No newline at end of file
index fa81e4f64bed71d45411e925dd96b4a7a2edda41..9da06c75c90622c7694da839ea827cad9a431051 100644 (file)
@@ -1,36 +1,48 @@
 <?php
 
-/**
-   SQSPELL_INTERFACE.PHP
-   ----------------------
-   This is a main wrapper for the pop-up window interface of
-   SquirrelSpell.
-                                                               **/
-       
-// Set up a couple of non-negotiable constants. Don't change these,
-// the setuppable stuff is in sqspell_config.php
-$SQSPELL_DIR="squirrelspell";
-$SQSPELL_CRYPTO=false;
+   /**
+    **  sqspell_interface.php -- Main wrapper for the pop-up.
+    **
+    **  Copyright (c) 1999-2001 The SquirrelMail development team
+    **  Licensed under the GNU GPL. For full terms see the file COPYING.
+    **
+    **   This is a main wrapper for the pop-up window interface of
+    **   SquirrelSpell.    
+    **
+    **  $Id$
+    **/
 
-// Load the necessary stuff.
-chdir("..");
-include("../src/validate.php");
-include("../src/load_prefs.php");
-include ("$SQSPELL_DIR/sqspell_config.php");
-require ("$SQSPELL_DIR/sqspell_functions.php");
-
-// Now load the necessary module from the modules dir.
-//
-if (!$MOD) $MOD="init";
-
-// see if someone is attempting to be nasty by trying to get out of the
-// modules directory, although it probably wouldn't do them any good,
-// since every module has to end with .mod.php. Still, they deserve
-// to be warned. ;)
-if (strstr($MOD, ".") || strstr($MOD, "/") || strstr($MOD, "%")){ 
-       echo "SECURITY BREACH ON DECK 5! CMDR TUVOK AND SECURITY TEAM REQUESTED.";
+    /*         
+    ** Set up a couple of non-negotiable constants. Don't change these,
+    ** the setuppable stuff is in sqspell_config.php
+    */
+    $SQSPELL_DIR='squirrelspell';
+    $SQSPELL_CRYPTO=FALSE;
+    
+    /* Load the necessary stuff. */
+    chdir('..');
+    require_once('../src/validate.php');
+    require_once('../src/load_prefs.php');
+    require_once("$SQSPELL_DIR/sqspell_config.php");
+    require_once("$SQSPELL_DIR/sqspell_functions.php");
+    
+    /*
+    ** Now load the necessary module from the modules dir.
+    **
+    */
+    if (!$MOD) 
+        $MOD='init';
+    
+    /*
+    ** see if someone is attempting to be nasty by trying to get out of the
+    ** modules directory, although it probably wouldn't do them any good,
+    ** since every module has to end with .mod.php. Still, they deserve
+    ** to be warned. ;)
+    */
+    if (strstr($MOD, '.') || strstr($MOD, '/') || strstr($MOD, '%')){ 
+       echo _("SECURITY BREACH ON DECK 5! CMDR TUVOK AND SECURITY TEAM REQUESTED.");
         exit;
-}
-// fetch the module now.
-include ("$SQSPELL_DIR/modules/$MOD.mod.php");
-?>
+    }
+    /* fetch the module now. */
+    require_once("$SQSPELL_DIR/modules/$MOD.mod.php");
+?>
\ No newline at end of file
index 86c75cd3fae596612bde87933c2585c268e6d215..348034b99a420670d0c13e43d2a37e650e3497de 100644 (file)
@@ -1,35 +1,46 @@
 <?php
-/**
-   SQSPELL_OPTIONS.PHP
-   --------------------
-   Main wrapper for the options interface.
-                                                               **/
-// Set a couple of constants. Don't change these, the setuppable stuff is
-// in sqspell_config.php
-$SQSPELL_DIR="squirrelspell";
-$SQSPELL_CRYPTO=false;
 
-// Load some necessary stuff.
-chdir("..");
-include("../src/validate.php");
-include("../src/load_prefs.php");
-include("../functions/strings.php");
-include("../functions/page_header.php");
-include ("$SQSPELL_DIR/sqspell_config.php");
-require ("$SQSPELL_DIR/sqspell_functions.php");
+   /**
+    **  sqspell_options.php -- Main wrapper for the options interface.
+    **
+    **  Copyright (c) 1999-2001 The SquirrelMail development team
+    **  Licensed under the GNU GPL. For full terms see the file COPYING.
+    **
+    **
+    **
+    **  $Id$
+    **/
 
-// Access the module needed
-//
-if (!$MOD) $MOD="options_main";
-
-// see if someone is attempting to be nasty by trying to get out of the
-// modules directory, although it probably wouldn't do them any good,
-// since every module has to end with .mod.php. Still, they deserve
-// to be warned. ;)
-if (strstr($MOD, ".") || strstr($MOD, "/") || strstr($MOD, "%")){
-       echo "SECURITY BREACH ON DECK 5! CMDR TUVOK AND SECURITY TEAM REQUESTED.";
+    /*
+    ** Set a couple of constants. Don't change these, the setuppable stuff is
+    ** in sqspell_config.php
+    */
+    $SQSPELL_DIR='squirrelspell';
+    $SQSPELL_CRYPTO=FALSE;
+    
+    /* Load some necessary stuff. */
+    chdir('..');
+    require_once('../src/validate.php');
+    require_once('../src/load_prefs.php');
+    require_once('../functions/strings.php');
+    require_once('../functions/page_header.php');
+    require_once("$SQSPELL_DIR/sqspell_config.php");
+    require_once("$SQSPELL_DIR/sqspell_functions.php");
+    
+    /* Access the module needed */
+    if (!$MOD) 
+        $MOD = 'options_main';
+    
+    /*
+    ** see if someone is attempting to be nasty by trying to get out of the
+    ** modules directory, although it probably wouldn't do them any good,
+    ** since every module has to end with .mod.php. Still, they deserve
+    ** to be warned. ;)
+    */
+    if (strstr($MOD, ".") || strstr($MOD, "/") || strstr($MOD, "%")){
+       echo _("SECURITY BREACH ON DECK 5! CMDR TUVOK AND SECURITY TEAM REQUESTED.");
         exit;
-}
-// load the stuff already.
-include ("$SQSPELL_DIR/modules/$MOD.mod.php");
-?>
+    }
+    /* load the stuff already. */
+    require_once("$SQSPELL_DIR/modules/$MOD.mod.php");
+?>
\ No newline at end of file