Better email address matching. This should match more characters defined in RFC822
[squirrelmail.git] / plugins / squirrelspell / sqspell_functions.php
index a3acfeb0400f681f74845a22681d64f403ae4b77..4acf28d3395643bdca400e760859ab00222b4991 100644 (file)
@@ -4,13 +4,15 @@
  * ----------------------
  * All SquirrelSpell-wide functions are in this file.
  *
- * Copyright (c) 1999-2002 The SquirrelMail development team
+ * Copyright (c) 1999-2004 The SquirrelMail development team
  * Licensed under the GNU GPL. For full terms see the file COPYING.
  *
  * $Id$
  *
  * @author Konstantin Riabitsev <icon@duke.edu> ($Author$)
  * @version $Date$
+ * @package plugins
+ * @subpackage squirrelspell
  */
 
 /**
 function sqspell_makePage($title, $scriptsrc, $body){
   global $color, $SQSPELL_VERSION;
 
-  if ( (float)substr(PHP_VERSION,0,3) < 4.1 ) {
-      global $_GET;
-  }
-  if (isset($_GET['MOD'])) {
-      $MOD = $_GET['MOD'];
-  }
-  else {
+  if (! sqgetGlobalVar('MOD', $MOD, SQ_GET) ) {
       $MOD = 'options_main';
   }
 
   displayPageHeader($color, 'None');  
-  echo "&nbsp;<br>\n";
+  echo "&nbsp;<br />\n";
   /**
    * Check if we need to link in a script.
    */
@@ -79,7 +75,8 @@ function sqspell_makePage($title, $scriptsrc, $body){
           ) . "\n"
     . html_tag( 'tr',
           html_tag( 'td', 'SquirrelSpell ' . $SQSPELL_VERSION, 'center', $color[9] )
-      ) . "\n";
+      ) . "\n</table>\n";
+  echo '</body></html>';
 }
 
 /**
@@ -342,9 +339,10 @@ function sqspell_getWords(){
      * the user's old mailbox password. I admin, this is rather dirty,
      * but efficient. ;)
      */
-    $key = $_COOKIE['key'];
-    $onetimepad = $_SESSION['onetimepad'];
-    $old_key = $_POST['old_key'];
+    sqgetGlobalVar('key', $key, SQ_COOKIE);
+    sqgetGlobalVar('onetimepad', $onetimepad, SQ_SESSION);
+
+    sqgetGlobalVar('old_key', $old_key, SQ_POST);
 
     if ($old_key != '') {
         $clear_key=$old_key;
@@ -372,15 +370,15 @@ function sqspell_getWords(){
        * gettext will bork. ;(
        */
       $msg = html_tag( 'p', "\n" .
-                     '<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.") ,
+                     '<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. 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.") ,
                  'left' ) .  "\n"
         . '<blockquote>' . "\n"
         . '<form method="post" onsubmit="return AYS()">' . "\n"
         . '<input type="hidden" name="MOD" value="crypto_badkey">' . "\n"
         . html_tag( 'p',  "\n" .
               '<input type="checkbox" name="delete_words" value="ON">'
-              . _("Delete my dictionary and start a new one") . '<br>'
+              . _("Delete my dictionary and start a new one") . '<br />'
               . _("Decrypt my dictionary with my old password:")
               . '<input name="old_key" size=\"10\">' ,
           'left' ) . "\n"
@@ -457,8 +455,8 @@ function sqspell_writeWords($words){
      * User wants to encrypt the file. So be it.
      * Get the user's password to use as a key.
      */
-    $key = $_COOKIE['key'];
-    $onetimepad = $_SESSION['onetimepad'];
+    sqgetGlobalVar('key', $key, SQ_COOKIE);
+    sqgetGlobalVar('onetimepad', $onetimepad, SQ_SESSION);
 
     $clear_key=OneTimePadDecrypt($key, $onetimepad);
     /**