Added default sort=0 option. Sorts all the messages by date in decending
[squirrelmail.git] / plugins / squirrelspell / sqspell_functions.php
index d73e0197394e5c1e91bd73da9bc5e7efbcb4a59a..15d5c3172b494034c4ce19b99cf3666d88d332cb 100644 (file)
@@ -4,7 +4,7 @@
  * ----------------------
  * All SquirrelSpell-wide functions are in this file.
  *
- * Copyright (c) 1999-2002 The SquirrelMail development team
+ * Copyright (c) 1999-2003 The SquirrelMail development team
  * Licensed under the GNU GPL. For full terms see the file COPYING.
  *
  * $Id$
  * @return            void
  */
 function sqspell_makePage($title, $scriptsrc, $body){
-  global $color, $SQSPELL_VERSION, $MOD;
+  global $color, $SQSPELL_VERSION;
+
+  if ( !check_php_version(4,1) ) {
+      global $_GET;
+  }
+  if (isset($_GET['MOD'])) {
+      $MOD = $_GET['MOD'];
+  }
+  else {
+      $MOD = 'options_main';
+  }
+
   displayPageHeader($color, 'None');  
   echo "&nbsp;<br>\n";
   /**
@@ -331,9 +342,12 @@ function sqspell_getWords(){
      * the user's old mailbox password. I admin, this is rather dirty,
      * but efficient. ;)
      */
-    global $key, $onetimepad, $old_key;
-    if ($old_key) {
-      $clear_key=$old_key;
+    $key = $_COOKIE['key'];
+    $onetimepad = $_SESSION['onetimepad'];
+    $old_key = $_POST['old_key'];
+
+    if ($old_key != '') {
+        $clear_key=$old_key;
     } else {
       /**
        * Get user's password (the key).
@@ -443,7 +457,9 @@ function sqspell_writeWords($words){
      * User wants to encrypt the file. So be it.
      * Get the user's password to use as a key.
      */
-    global $key, $onetimepad;
+    $key = $_COOKIE['key'];
+    $onetimepad = $_SESSION['onetimepad'];
+
     $clear_key=OneTimePadDecrypt($key, $onetimepad);
     /**
      * Try encrypting it. If fails, scream bloody hell.