mail_fetch => rg=0
authorkink <kink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Wed, 25 Sep 2002 15:47:16 +0000 (15:47 +0000)
committerkink <kink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Wed, 25 Sep 2002 15:47:16 +0000 (15:47 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@3726 7612ce4b-ef26-0410-bec9-ea0150e637f0

plugins/mail_fetch/fetch.php
plugins/mail_fetch/options.php
plugins/mail_fetch/setup.php

index 8e23b67..22e1791 100644 (file)
@@ -22,6 +22,21 @@ require_once(SM_PATH . 'functions/i18n.php');
 require_once(SM_PATH . 'plugins/mail_fetch/functions.php' );
 require_once(SM_PATH . 'functions/html.php' );
 
+    /* globals */ 
+    $username = $_SESSION['username'];
+    $key = $_COOKIE['key'];
+    $onetimepad = $_SESSION['onetimepad'];
+    $delimter = $_SESSION['delimiter'];
+
+    /* This form, like the advanced identities form
+       uses dynamic post variable names so we need
+       to extract the whole $_POST array to make 
+       things work
+    */
+
+    extract($_POST);
+    /* end globals */
+
     function Mail_Fetch_Status($msg) {
         echo html_tag( 'table',
                    html_tag( 'tr',
index 7dd615d..2771528 100644 (file)
@@ -17,11 +17,55 @@ require_once(SM_PATH . 'include/validate.php');
 require_once(SM_PATH . 'functions/imap.php');
 require_once(SM_PATH . 'include/load_prefs.php');
 
+    /* globals */
+    $username = $_SESSION['username'];
+    $key = $_COOKIE['key'];
+    $onetimepad = $_SESSION['onetimepad'];
+    $delimiter = $_SESSION['delimiter'];
+    
+    if(isset($_POST['mf_cypher'])) {
+        $mf_cypher = $_POST['mf_cypher'];
+    }
+    if(isset($_POST['mf_sn'])) {
+        $mf_sn = $_POST['mf_sn'];
+    }
+    if(isset($_POST['mf_server'])) {
+        $mf_server = $_POST['mf_server'];
+    }
+    if(isset($_POST['mf_alias'])) {
+        $mf_alias = $_POST['mf_alias'];
+    }
+    if(isset($_POST['mf_user'])) {
+        $mf_user = $_POST['mf_user'];
+    }
+    if(isset($_POST['mf_pass'])) {
+        $mf_pass = $_POST['mf_pass'];
+    }
+    if(isset($_POST['mf_subfolder'])) {
+        $mf_subfolder = $_POST['mf_subfolder'];
+    }
+    if(isset($_POST['mf_login'])) {
+        $mf_login = $_POST['mf_login'];
+    }
+    if(isset($_POST['mf_fref'])) {
+        $mf_fref = $_POST['mf_fref'];
+    }
+    if(isset($_POST['submit_mailfetch'])) {
+        $submit_mailfetch = $_POST['submit_mailfetch'];
+    }
+    if(isset($_POST['mf_lmos'])) {
+        $mf_lmos = $_POST['mf_lmos'];
+    }
+    /* end globals */
+
     displayPageHeader( $color, 'None' );
 
     //if dosen't select any option
-    if (!isset($mf_action))
+    if (!isset($_POST['mf_action'])) {
         $mf_action = 'config';
+    } else {
+        $mf_action = $_POST['mf_action'];
+    }
 
     switch( $mf_action ) {
     case 'add':
@@ -31,7 +75,7 @@ require_once(SM_PATH . 'include/load_prefs.php');
         setPref($data_dir,$username,"mailfetch_alias_$mf_sn", (isset($mf_alias)?$mf_alias:""));
         setPref($data_dir,$username,"mailfetch_user_$mf_sn",(isset($mf_user)?$mf_user:""));
         setPref($data_dir,$username,"mailfetch_pass_$mf_sn",(isset($mf_pass)?encrypt( $mf_pass )    :""));
-        if( $mf_cypher <> 'on' ) SetPref($data_dir,$username,"mailfetch_cypher",    'on');
+        if( isset($mf_cypher) && $mf_cypher <> 'on' ) SetPref($data_dir,$username,'mailfetch_cypher',    'on');
         setPref($data_dir,$username,"mailfetch_lmos_$mf_sn",(isset($mf_lmos)?$mf_lmos:""));
         setPref($data_dir,$username,"mailfetch_login_$mf_sn",(isset($mf_login)?$mf_login:""));
         setPref($data_dir,$username,"mailfetch_fref_$mf_sn",(isset($mf_fref)?$mf_fref:""));
index 1c27171..ce41ff6 100644 (file)
@@ -16,7 +16,6 @@
 
     function squirrelmail_plugin_init_mail_fetch() {
         global $squirrelmail_plugin_hooks;
-        global $mailbox, $imap_stream, $imapConnection;
 
         $squirrelmail_plugin_hooks['menuline']['mail_fetch'] = 'mail_fetch_link';
         $squirrelmail_plugin_hooks['loading_prefs']['mail_fetch'] = 'mail_fetch_load_pref';
 
     function mail_fetch_load_pref() {
 
-        global $username,$data_dir;
+        global $data_dir;
         global $mailfetch_server_number;
         global $mailfetch_cypher;
         global $mailfetch_server_,$mailfetch_alias_,$mailfetch_user_,$mailfetch_pass_;
         global $mailfetch_lmos_, $mailfetch_uidl_, $mailfetch_login_, $mailfetch_fref_;
         global $PHP_SELF;
+        if ( (float)substr(PHP_VERSION,0,3) < 4.1 ) {
+            global $_SESSION;
+        }
+        $username = $_SESSION['username'];
 
         if( stristr( $PHP_SELF, 'mail_fetch' ) ) {
             $mailfetch_server_number = getPref($data_dir, $username, 'mailfetch_server_number', 0);
         require_once ('../plugins/mail_fetch/functions.php');
         require_once ('../functions/i18n.php');
 
-        global $username, $data_dir, $key,$imapServerAddress,$imapPort;
+        global $data_dir, $imapServerAddress, $imapPort;
+        if ( (float)substr(PHP_VERSION,0,3) < 4.1 ) {
+            global $_SESSION, $_COOKIE;
+        }
+        $username = $_SESSION['username'];
+        $key = $_COOKIE['key'];
 
         $mailfetch_newlog = getPref($data_dir, $username, 'mailfetch_newlog');
 
 
     function mail_fetch_setnew()    {
 
-        global $data_dir,$username;
+        global $data_dir;
         require_once(SM_PATH . 'functions/prefs.php');
 
+        if (isset($_SESSION['username'])) {
+            $username = $_SESSION['username'];
+        } else {
+           $username = '';
+        }
+
         if( $username <> '' ) {
             // Creates the pref file if it does not exist.
             setPref( $data_dir, $username, 'mailfetch_newlog', 'on' );