updates
authorlkehresman <lkehresman@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Mon, 22 Nov 1999 16:45:09 +0000 (16:45 +0000)
committerlkehresman <lkehresman@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Mon, 22 Nov 1999 16:45:09 +0000 (16:45 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@14 7612ce4b-ef26-0410-bec9-ea0150e637f0

images/down_pointer.gif [new file with mode: 0644]
images/om_webmail.gif [new file with mode: 0644]
images/up_pointer.gif [new file with mode: 0644]
src/left_main.php3 [new file with mode: 0644]
src/login.php3 [new file with mode: 0644]
src/right_main.php3 [new file with mode: 0644]
src/signout.php3 [new file with mode: 0644]
src/webmail.php3 [new file with mode: 0644]

diff --git a/images/down_pointer.gif b/images/down_pointer.gif
new file mode 100644 (file)
index 0000000..bc2d251
Binary files /dev/null and b/images/down_pointer.gif differ
diff --git a/images/om_webmail.gif b/images/om_webmail.gif
new file mode 100644 (file)
index 0000000..be940c7
Binary files /dev/null and b/images/om_webmail.gif differ
diff --git a/images/up_pointer.gif b/images/up_pointer.gif
new file mode 100644 (file)
index 0000000..a7eb5a5
Binary files /dev/null and b/images/up_pointer.gif differ
diff --git a/src/left_main.php3 b/src/left_main.php3
new file mode 100644 (file)
index 0000000..169cffb
--- /dev/null
@@ -0,0 +1,97 @@
+<?
+   /**
+    **  left_main.php3
+    **
+    **  This is the code for the left bar.  The left bar shows the folders
+    **  available, and has cookie information.
+    **
+    **/
+
+   if(!isset($username)) {
+      echo "You need a valid user and password to access this page!";
+      exit;
+   }
+?>
+<HTML>
+<HEAD>
+   <SCRIPT LANGUAGE="JavaScript">
+      function DeleteCookie (name) {
+         var exp = new Date();  
+         exp.setTime (exp.getTime() - 1);  
+         // This cookie is history  
+         var cval = GetCookie (name);  
+         document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
+      }
+
+      function unSetCookies() {
+         DeleteCookie('username');
+         DeleteCookie('key');
+         DeleteCookie('logged_in');
+         alert(document.cookie);
+      }
+   </SCRIPT>
+</HEAD>
+<BODY BGCOLOR=A0B8C8 TEXT="#000000" LINK="#0000EE" VLINK="#0000EE" ALINK="#0000EE" onUnLoad="unSetCookies()">
+<FONT FACE="Arial,Helvetica">
+<?
+   include("../config/config.php3");
+   include("functions/strings.php3");
+   include("functions/imap.php3");
+
+   // *****************************************
+   //    Parse the incoming mailbox name and return a string that is the FOLDER.MAILBOX
+   // *****************************************
+   function findMailboxName($mailbox) {
+      // start at -2 so that we skip the initial quote at the end of the mailbox name
+      $i = -2;
+      $char = substr($mailbox, $i, 1);
+      while ($char != "\"") {
+         $i--;
+         $temp .= $char;
+         $char = substr($mailbox, $i, 1);
+      }
+      return strrev($temp);
+   }
+
+   // open a connection on the imap port (143)
+   $imapConnection = fsockopen($imapServerAddress, 143, &$errorNumber, &$errorString);
+   if (!$imapConnection) {
+      echo "Error connecting to IMAP Server.<br>";
+      echo "$errorNumber : $errorString<br>";
+      exit;
+   }
+   $serverInfo = fgets($imapConnection, 256);
+
+   fputs($imapConnection, "1 login $username $key\n");
+   $read = fgets($imapConnection, 1024);
+
+   fputs($imapConnection, "1 list \"\" *\n");
+   $str = imapReadData($imapConnection);
+
+   echo "<FONT FACE=\"Arial,Helvetica\"><B>";
+   echo "<CENTER>$org_name</B><BR>";
+   echo "Folders</CENTER>";
+   echo "</B><BR></FONT>";
+   echo "<code><FONT FACE=\"Arial,Helvetica\">\n";
+   for ($i = 0;$i < count($str); $i++) {
+      $mailbox = Chop($str[$i]);
+      // find the quote at the begining of the mailbox name.
+      //    i subtract 1 from the strlen so it doesn't find the quote at the end of the mailbox name.
+      $mailbox = findMailboxName($mailbox);
+      $periodCount = countCharInString($mailbox, ".");
+      
+      // indent the correct number of spaces.
+      for ($j = 0;$j < $periodCount;$j++)
+         echo "&nbsp;&nbsp;";
+      
+      $mailboxURL = urlencode($mailbox);
+      echo "<a href=\"right_main.php3?sort=0&startMessage=0&mailbox=$mailboxURL\" target=\"right\" style=\"text-decoration:none\"><FONT FACE=\"Arial,Helvetica\">";
+      echo readShortMailboxName($mailbox, ".");
+      echo "</FONT></a><br>\n";
+   }
+   echo "</code></FONT>";
+
+   fclose($imapConnection);
+                                  
+?>
+</FONT></BODY></HTML>
diff --git a/src/login.php3 b/src/login.php3
new file mode 100644 (file)
index 0000000..a9bb279
--- /dev/null
@@ -0,0 +1,58 @@
+<?
+   /**
+    **  login.php3
+    **
+    **  Very simple login screen that clears the cookie every time it's loaded
+    **
+    **/
+
+   setcookie("username", "", time(), "/");
+   setcookie("key", "", time(), "/");
+   setcookie("logged_in", 0, time(), "/");
+?>
+<HTML>
+<BODY BGCOLOR=FFFFFF>
+<?
+   include("../config/config.php3");
+
+   echo "<FORM ACTION=webmail.php3 METHOD=POST NAME=f>\n";
+   echo "<CENTER><IMG SRC=\"$org_logo\"</CENTER>\n";
+   echo "<CENTER><FONT FACE=\"Arial,Helvetica\" SIZE=-2>SquirrelMail version $version<BR>By Nathan and Luke Ehresman<BR></FONT><CENTER>\n";
+   echo "<TABLE COLS=1 WIDTH=350>\n";
+   echo "   <TR>\n";
+   echo "      <TD BGCOLOR=CCCCCC>\n";
+   echo "         <B><CENTER><FONT FACE=\"Arial,Helvetica\">$org_name Login</FONT></CENTER></B>\n";
+   echo "      </TD>\n";
+   echo "   </TR><TR>\n";
+   echo "      <TD BGCOLOR=FFFFFF>\n";
+   echo "         <TABLE COLS=2 WIDTH=100%>\n";
+   echo "            <TR>\n";
+   echo "               <TD WIDTH=30% ALIGN=right>\n";
+   echo "                  <FONT FACE=\"Arial,Helvetica\">Name:</FONT>\n";
+   echo "               </TD><TD WIDTH=* ALIGN=left>\n";
+   echo "                  <CENTER><INPUT TYPE=TEXT NAME=username></CENTER>\n";
+   echo "               </TD>\n";
+   echo "            </TR><TR>\n";
+   echo "               <TD WIDTH=30% ALIGN=right>\n";
+   echo "                  <FONT FACE=\"Arial,Helvetica\">Password:</FONT>\n";
+   echo "               </TD><TD WIDTH=* ALIGN=left>\n";
+   echo "                  <CENTER><INPUT TYPE=PASSWORD NAME=key></CENTER>\n";
+   echo "               </TD>\n"; 
+   echo "         </TABLE>\n";
+   echo "      </TD>\n";
+   echo "   </TR><TR>\n";
+   echo "      <TD>\n";
+   echo "         <CENTER><INPUT TYPE=SUBMIT VALUE=Login></CENTER>\n";
+   echo "      </TD>\n";
+   echo "   </TR>\n";
+   echo "</TABLE>\n";
+   echo "</FORM>\n";
+?>
+
+<SCRIPT LANGUAGE="JavaScript">
+   document.f.username.focus(); 
+</SCRIPT>
+
+</BODY>
+</HTML>
+
diff --git a/src/right_main.php3 b/src/right_main.php3
new file mode 100644 (file)
index 0000000..916f91a
--- /dev/null
@@ -0,0 +1,133 @@
+<?
+   /**
+    **  right_main.php3
+    **
+    **  This is where the mailboxes are listed.  This controls most of what
+    **  goes on in SquirrelMail.
+    **
+    **/
+
+   if(!isset($logged_in)) {
+      echo "You must <a href=\"login.php3\">login</a> first.";
+      exit;
+   }
+   if(!isset($username) || !isset($key)) {
+      echo "You need a valid user and password to access this page!";
+      exit;
+   }
+?>
+<HTML>
+<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#0000EE" VLINK="#0000EE" ALINK="#0000EE">
+<FONT FACE="Arial,Helvetica">
+<?
+   include("../config/config.php3");
+   include("functions/imap.php3");
+   include("functions/strings.php3");
+   include("functions/date.php3");
+   include("functions/page_header.php3");
+   include("functions/array.php3");
+   include("functions/mailbox.php3");
+   include("functions/mailbox_display.php3");
+   include("functions/display_messages.php3");
+
+   /////////////////////////////////////////////////////////////////////////////////
+   //
+   // incoming variables from URL:
+   //    $sort             Direction to sort by date
+   //                         values:  0  -  descending order
+   //                         values:  1  -  ascending order
+   //    $startMessage     Message to start at
+   //    $mailbox          Full Mailbox name
+   //
+   // incoming from cookie:
+   //    $username         duh
+   //    $key              pass
+   //
+   /////////////////////////////////////////////////////////////////////////////////
+
+
+   // open a connection on the imap port (143)
+   $imapConnection = fsockopen($imapServerAddress, 143, &$errorNumber, &$errorString);
+   if (!$imapConnection) {
+      echo "Error connecting to IMAP Server.<br>";
+      echo "$errorNumber : $errorString<br>";
+      exit;
+   }
+   $serverInfo = fgets($imapConnection, 256);
+
+   // login
+   fputs($imapConnection, "1 login $username $key\n");
+   $read = fgets($imapConnection, 1024);
+   if (strpos($read, "NO")) {
+      error_username_password_incorrect();
+      exit;
+   }
+
+   // If the page has been loaded without a specific mailbox,
+   //    just show a page of general info.
+   if (!isset($mailbox)) {
+      displayPageHeader("None");
+      general_info($motd, $org_logo, $version, $org_name);
+      exit;
+   }
+
+
+   // switch to the mailbox, and get the number of messages in it.
+   selectMailbox($imapConnection, $mailbox, $numMessages);
+
+   // make a URL safe $mailbox for use in the links
+   $urlMailbox = urlencode($mailbox);
+  
+   displayPageHeader($mailbox);
+   $i = 1;
+   while ($i <= $numMessages) {
+      getMessageHeaders($imapConnection, $i, $from, $subject, $date);
+
+      $messages[$i]["DATE"] = getTimeStamp(explode(" ", trim($date)));
+      $messages[$i]["ID"] = $i;
+      $messages[$i]["FROM"] = $from;
+      $messages[$i]["SUBJECT"] = $subject;
+      $i++;
+   }
+
+   if ($sort == 0)
+      $msgs = ary_sort($messages, "DATE", -1);
+   else
+      $msgs = ary_sort($messages, "DATE", 1);
+
+   if ($endMessage > 24) {
+      echo "<A HREF=\"right_main.php3?sort=1&startMessage=$nextGroup&mailbox=$urlMailbox\" TARGET=\"right\"><FONT FACE=\"Arial,Helvetica\">Next</FONT></A>&nbsp&nbsp&nbsp";
+      $endMessage = 24;
+   }
+
+   /** Display "Next, Previous" on top */
+
+   /** This is the beginning of the message list table.  It wraps around all messages */
+   echo "<TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=1>";
+   echo "<TR><TD BGCOLOR=DCDCDC>";
+   echo "<TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=1 BGCOLOR=FFFFFF>";
+   echo "<TR BGCOLOR=FFFFCC ALIGN=\"center\">";
+   echo "   <TD WIDTH=5%><FONT FACE=\"Arial,Helvetica\"><B>Num</B></FONT></TD>";
+   echo "   <TD WIDTH=25%><FONT FACE=\"Arial,Helvetica\"><B>From</B></FONT></TD>";
+   echo "   <TD WIDTH=15%><FONT FACE=\"Arial,Helvetica\"><B>Date</B></FONT>";
+   if ($sort == 0)
+      echo "   <A HREF=\"right_main.php3?sort=1&startMessage=1&mailbox=$urlMailbox\" TARGET=\"right\"><IMG SRC=\"../images/up_pointer.gif\" BORDER=0></A></TD>\n";
+   else
+      echo "   <A HREF=\"right_main.php3?sort=0&startMessage=0&mailbox=$urlMailbox\" TARGET=\"right\"><IMG SRC=\"../images/down_pointer.gif\" BORDER=0></A></TD>\n";
+   echo "   <TD WIDTH=*><FONT FACE=\"Arial,Helvetica\"><B>Subject</B></FONT></TD>\n";
+   echo "</TR>";
+
+   // loop through and display the info for each message.
+   for ($i = $startMessage;$i <= $endMessage; $i++) {
+      printMessageInfo($imapConnection, $msgs[$i]["ID"], $msgs[$i]["FROM"], $msgs[$i]["SUBJECT"], $msgs[$i]["DATE"]);
+   }
+
+   echo "</TABLE>\n";
+   echo "</TD></TR></TABLE>"; /** End of message-list table */
+
+   /** Display "Next, Previous" on bottom */
+   fclose($imapConnection);
+?>
+</FONT>
+</BODY>
+</HTML>
diff --git a/src/signout.php3 b/src/signout.php3
new file mode 100644 (file)
index 0000000..888b960
--- /dev/null
@@ -0,0 +1,41 @@
+<?
+       /**
+        **  signout.php3
+        **
+        **  Clears the cookie, and logs them out.
+        **
+        **/
+       
+       $username = "";
+       $key = "";
+       $logged_in = 0;
+       
+       setcookie("username", "", time(), "/");
+       setcookie("key", "", time(), "/");
+       setcookie("logged_in", 0, time(), "/");
+?>
+<HTML>
+<BODY BGCOLOR=FFFFFF>
+<?
+   echo "<BR><BR><TABLE BGCOLOR=FFFFFF BORDER=0 COLS=1 WIDTH=50% CELLSPACING=0 CELLPADDING=2 ALIGN=CENTER>";
+   echo "   <TR BGCOLOR=A0B8C8 WIDTH=100%>";
+   echo "      <TD ALIGN=CENTER>";
+   echo "         <FONT FACE=\"Arial,Helvetica\"><B>Sign Out</B></FONT>";
+   echo "      </TD>";
+   echo "   </TR>";
+   echo "   <TR BGCOLOR=FFFFFF WIDTH=100%>";
+   echo "      <TD ALIGN=CENTER>";
+   echo "         <FONT FACE=\"Arial,Helvetica\"><BR>You have been successfully signed out.<BR></FONT>";
+   echo "         <FONT FACE=\"Arial,Helvetica\">Click here to <A HREF=\"login.php3\" TARGET=_top>log back in.</A></FONT><BR><BR>";
+   echo "      </TD>";
+   echo "   </TR>";
+   echo "   <TR BGCOLOR=DCDCDC WIDTH=100%>";
+   echo "      <TD ALIGN=CENTER>";
+   echo "         <FONT FACE=\"Arial,Helvetica\"><BR></FONT>";
+   echo "      </TD>";
+   echo "   </TR>";
+   echo "</TABLE>";
+?>
+</BODY>
+</HTML>
+
diff --git a/src/webmail.php3 b/src/webmail.php3
new file mode 100644 (file)
index 0000000..4b434e2
--- /dev/null
@@ -0,0 +1,26 @@
+<?
+   /**
+    **  webmail.php3
+    **
+    **  This simply creates the frames.
+    **
+    **/
+
+   if(!isset($username)) {
+      echo "You need a valid user and password to access this page!";
+      exit;
+   }
+
+   setcookie("username", $username, 0, "/");
+   setcookie("key", $key, 0, "/");
+   setcookie("logged_in", 1, 0, "/");
+?>
+<HTML><HEAD>
+<TITLE>
+OM-USA WebMail
+</TITLE>
+<FRAMESET COLS="200, *" NORESIZE BORDER=0>
+   <FRAME SRC="left_main.php3" NAME="left">
+   <FRAME SRC="right_main.php3" NAME="right">
+</FRAMESET>
+</HEAD></HTML>