Send the user to the options page if he clicks the Fetch link when
authorkink <kink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Sun, 27 Jul 2003 22:15:15 +0000 (22:15 +0000)
committerkink <kink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Sun, 27 Jul 2003 22:15:15 +0000 (22:15 +0000)
no servers are available.

git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@5460 7612ce4b-ef26-0410-bec9-ea0150e637f0

plugins/mail_fetch/fetch.php

index 4580758..03c9211 100644 (file)
@@ -38,6 +38,8 @@ sqgetGlobalVar('delimiter',  $delimiter,  SQ_SESSION);
     }
 
     function Mail_Fetch_Servers() {
+        global $data_dir, $username;
+
         $mailfetch['server_number'] = getPref($data_dir, $username, "mailfetch_server_number");
         if (!isset($mailfetch['server_number']) || ($mailfetch['server_number'] < 1)) {
             $mailfetch['server_number'] = 0;
@@ -67,6 +69,8 @@ sqgetGlobalVar('delimiter',  $delimiter,  SQ_SESSION);
     }
 
     function Mail_Fetch_Select_Server($mailfetch) {
+        global $PHP_SELF;
+
         echo '<font size=-5><br></font>' .
              "<form action=\"$PHP_SELF\" method=\"post\" target=\"_self\">" .
              html_tag( 'table', '', 'center', '', 'width="70%" cols="2"' ) .
@@ -114,6 +118,16 @@ sqgetGlobalVar('delimiter',  $delimiter,  SQ_SESSION);
                ) ,
            'center', '', 'width="95%" cols="1"' );
 
+
+    /* there are no servers defined yet... */
+    if($mailfetch['server_number'] == 0) {
+        echo '<p>' . _("No POP3 servers configured yet.") . '</p>';
+        displayInternalLink('plugins/mail_fetch/options.php',
+            _("Click here to go to the options page.") );
+        echo '</body></html>';
+        exit();
+    }
+
     // get $server_to_fetch from globals, if not set display a choice to the user
     if (! sqgetGlobalVar('server_to_fetch', $server_to_fetch, SQ_POST) ) {
         Mail_Fetch_Select_Server($mailfetch);