phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] old/squirrelmail/src webmail.php, 1.1 redirect.php, 1


From: skwashd
Subject: [Phpgroupware-cvs] old/squirrelmail/src webmail.php, 1.1 redirect.php, 1.1 move_messages.php, 1.1 load_prefs.php, 1.1 left_main.php, 1.1 options.php, 1.1 options_display.php, 1.1 options_order.php, 1.1 options_highlight.php, 1.1 options_folder.php, 1.1 help.php, 1.1 gettolang.pl, 1.1 addrbook_popup.php, 1.1 addrbook_search.php, 1.1 addrbook_search_html.php, 1.1 empty_trash.php, 1.1 delete_message.php, 1.1 addressbook.php, 1.1 options_personal.php, 1.1
Date: Thu, 5 May 2005 02:56:00 +0200

Update of old/squirrelmail/src

Added Files:
     Branch: MAIN
            webmail.php 
            redirect.php 
            move_messages.php 
            load_prefs.php 
            left_main.php 
            options.php 
            options_display.php 
            options_order.php 
            options_highlight.php 
            options_folder.php 
            help.php 
            gettolang.pl 
            addrbook_popup.php 
            addrbook_search.php 
            addrbook_search_html.php 
            empty_trash.php 
            delete_message.php 
            addressbook.php 
            options_personal.php 

Log Message:
cvs clean up

====================================================
Index: webmail.php
<?php

   /**
    **  webmail.php -- Displays the main frameset
    **
    **  Copyright (c) 1999-2000 The SquirrelMail development team
    **  Licensed under the GNU GPL. For full terms see the file COPYING.
    **
    **  This file generates the main frameset. The files that are
    **  shown can be given as parameters. If the user is not logged in
    **  this file will verify username and password.
    **
    **  $Id: webmail.php,v 1.1 2005/05/05 00:56:41 skwashd Exp $
    **/

   session_start();

   if (!isset($i18n_php))
      include ('../functions/i18n.php');

   if(!isset($username)) {
      set_up_language($squirrelmail_language);
          include ('../themes/default_theme.php');
          include ('../functions/display_messages.php');
          printf('<html><BODY TEXT="%s" BGCOLOR="%s" LINK="%s" VLINK="%s" 
ALINK="%s">',
                          $color[8], $color[4], $color[7], $color[7], 
$color[7]);
          plain_error_message(lang("You need a valid user and password to 
access this page!")
                              . "<br><a href=\"../src/login.php\">"
                                                  . lang("Click here to log 
back in.") . "</a>.", $color);
          echo '</body></html>';
      exit;
   }

   if (!isset($strings_php))
      include ('../functions/strings.php');
   include ('../config/config.php');
   include ('../functions/prefs.php');
   include ('../functions/imap.php');
   if (!isset($plugin_php))
      include ('../functions/plugin.php');
   if (!isset($auth_php))
      include ('../functions/auth.php');

   include ('../src/load_prefs.php');

   // We'll need this to later have a noframes version
   set_up_language(getPref($data_dir, $username, 'language'));

   echo "<html><head>\n";
   echo '<TITLE>';
   echo $org_title;
   echo '</TITLE>';

   $bar_size = $left_size;

   if ($location_of_bar == 'right')
   {
      echo "<FRAMESET COLS=\"*, $left_size\" NORESIZE=yes BORDER=0>";
   } else {
      echo "<FRAMESET COLS=\"$left_size, *\" NORESIZE BORDER=0>";
   }

/**
    There are three ways to call webmail.php
    1.  webmail.php
         - This just loads the default entry screen.
    2.  webmail.php?right_frame=index.php&sort=X&startMessage=X&mailbox=XXXX
         - This loads the frames starting at the given values.
    3.  webmail.php?right_frame=folders.php
         - Loads the frames with the Folder options in the right frame.

    This was done to create a pure HTML way of refreshing the folder list since
    we would like to use as little Javascript as possible.
**/
   if (!isset($right_frame)) $right_frame = "";

   if ($right_frame == 'index.php') {
      $urlMailbox = urlencode($mailbox);
      $right_frame_url = 
"index.php?mailbox=$urlMailbox&sort=$sort&startMessage=$startMessage";
   } else if ($right_frame == 'options.php') {
      $right_frame_url = 'options.php';
   } else if ($right_frame == 'folders.php') {
      $right_frame_url = 'folders.php';
   } else {
      if (!isset($just_logged_in)) $just_logged_in = 0;
      $right_frame_url = "index.php?just_logged_in=$just_logged_in";
   }

   if ($location_of_bar == 'right')
   {
      echo "<FRAME SRC=\"$right_frame_url\" NAME=\"right\">";
      echo '<FRAME SRC="left_main.php" NAME="left">';
   }
   else
   {
      echo '<FRAME SRC="left_main.php" NAME="left">';
      echo "<FRAME SRC=\"$right_frame_url\" NAME=\"right\">";
   }

?>
</FRAMESET>
</HEAD></HTML>

====================================================
Index: redirect.php
<?php

   /**
    **  redirect.php -- derived from webmail.php by Ralf Kraudelt
    **                                              address@hidden
    **
    **  Copyright (c) 1999-2000 ...
    **  Licensed under the GNU GPL. For full terms see the file COPYING.
    **
    **  prevents users from reposting their form data after a
    **  successful logout
    **
    **  $Id: redirect.php,v 1.1 2005/05/05 00:56:41 skwashd Exp $
    **/

   if (!isset($strings_php))
      include ("../functions/strings.php");
   include("../config/config.php");

   $base_uri = PHPGW_APP_ROOT;

   header("Pragma: no-cache");
   $location = get_location();

   session_set_cookie_params (0, $base_uri);
   session_start();

   session_register ("base_uri");

   if(!isset($login_username)) {
      exit;
   }

   // Refresh the language cookie.
   if (isset($squirrelmail_language)) {
      setcookie("squirrelmail_language", $squirrelmail_language, 
time()+2592000);
   }


   include ("../config/config.php");
   include ("../functions/prefs.php");
   include ("../functions/imap.php");
   if (!isset($plugin_php))
      include ("../functions/plugin.php");
   if (!isset($auth_php))
      include ("../functions/auth.php");
   if (!isset($strings_php))
      include ("../functions/strings.php");

   if (!session_is_registered("user_is_logged_in") || $logged_in != 1) {
      do_hook ("login_before");

      $onetimepad = OneTimePadCreate(strlen($secretkey));
      $key = OneTimePadEncrypt($secretkey, $onetimepad);
      session_register("onetimepad");
      // verify that username and password are correct
      if ($force_username_lowercase)
          $login_username = strtolower($login_username);
      $imapConnection = sqimap_login($login_username, $key, $imapServerAddress, 
$imapPort, 0);
          if (!$imapConnection) {
                exit;
          }
      sqimap_logout($imapConnection);

      setcookie("username", $login_username, 0, $base_uri);
      setcookie("key", $key, 0, $base_uri);
      setcookie("logged_in", 1, 0, $base_uri);
      do_hook ("login_verified");
   }

   session_register ("user_is_logged_in");
   $user_is_logged_in = true;

   header("Location: $location/webmail.php");
?>

====================================================
Index: move_messages.php
<?php
   /**
    **  move_messages.php
    **
    **  Copyright (c) 1999-2000 The SquirrelMail development team
    **  Licensed under the GNU GPL. For full terms see the file COPYING.
    **
    **  Enables message moving between folders on the IMAP server.
    **
    **  $Id: move_messages.php,v 1.1 2005/05/05 00:56:41 skwashd Exp $
    **/

   $enablePHPGW = 1;

        // store the value of $mailbox, because it will overwriten
        $MAILBOX = $mailbox;
        $phpgw_info["flags"] = array("currentapp" => "squirrelmail","noheader" 
=> True, "nonavbar" => True);
        include("../../header.inc.php");
        $mailbox = $MAILBOX;

   if (!isset($strings_php))
      include(PHPGW_APP_ROOT . "/inc/strings.php");
   if (!isset($config_php))
      include("../config/config.php");

        $key      = $phpgw_info['user']['preferences']['email']['passwd'];
        $username = $phpgw_info['user']['preferences']['email']['userid'];

   if (!isset($page_header_php))
      include(PHPGW_APP_ROOT . "/inc/page_header.php");
   if (!isset($display_messages_php))
      include(PHPGW_APP_ROOT . "/inc/display_messages.php");
   if (!isset($imap_php))
      include(PHPGW_APP_ROOT . "/inc/imap.php");

   include("../src/load_prefs.php");

   function putSelectedMessagesIntoString($msg) {
      $j = 0;
      $i = 0;
      $firstLoop = true;

      // If they have selected nothing msg is size one still, but will
      // be an infinite loop because we never increment j. so check to
      // see if msg[0] is set or not to fix this.
      while (($j < count($msg)) && ($msg[0])) {
         if ($msg[$i]) {
            if ($firstLoop != true)
               $selectedMessages .= "&";
            else
               $firstLoop = false;

            $selectedMessages .= "selMsg[$j]=$msg[$i]";

            $j++;
         }
         $i++;
      }
   }

        $imapConnection = sqimap_login($username, $key, $imapServerAddress, 
$imapPort, 0);
        sqimap_mailbox_select($imapConnection, $mailbox);

        if ($mark_read_x) $messageAction = "seen";
        if ($mark_unread_x) $messageAction = "recent";
        if ($mark_flagged_x) $messageAction = "flag";
        if ($mark_unflagged_x) $messageAction = "unflag";
        if ($mark_deleted_x) $messageAction = "delete";

        if(isset($messageAction) && $messageAction != "-1")
        {
                // lets check to see if they selected any messages
                if (is_array($msg) == 1)
                {
                        // Removes \Deleted flag from selected messages
                        $j = 0;
                        $i = 0;

                        // If they have selected nothing msg is size one still, 
but will be an infinite
                        //    loop because we never increment j.  so check to 
see if msg[0] is set or not to fix this.
                        while ($j < count($msg))
                        {
                                if ($msg[$i])
                                {
                                        switch($messageAction)
                                        {
                                                case "seen":
                                                        
sqimap_messages_remove_flag ($imapConnection, $msg[$i], $msg[$i], "Recent");
                                                        
sqimap_messages_flag($imapConnection, $msg[$i], $msg[$i], "Seen");
                                                        break;
                                                case "recent":
                                                        
sqimap_messages_remove_flag ($imapConnection, $msg[$i], $msg[$i], "Seen");
                                                        
sqimap_messages_flag($imapConnection, $msg[$i], $msg[$i], "Recent");
                                                        break;
                                                case "flag":
                                                        
sqimap_messages_flag($imapConnection, $msg[$i], $msg[$i], "Flagged");
                                                        break;
                                                case "unflag":
                                                        
sqimap_messages_remove_flag ($imapConnection, $msg[$i], $msg[$i], "Flagged");
                                                        break;
                                                case "delete":
                                                        
sqimap_messages_delete($imapConnection, $msg[$i], $msg[$i], $mailbox);
                                                        break;
                                        }
                                        $j++;
                                }
                                $i++;
                        }

                        if ($messageAction == "delete")
                        {
                                if ($auto_expunge)
                                {
                                        sqimap_mailbox_expunge($imapConnection, 
$mailbox, true);
                                }
                        }


//address@hidden: search.php lives in /squirrelmail, not in /squirrelmail/src,
                        $location = "/squirrelmail";

                        if ($where && $what)
                                header ("Location: " . $phpgw->link($location . 
"/search.php","mailbox=".urlencode($mailbox)."&what=".urlencode($what)."&where=".urlencode($where)));
                        else
                                header ("Location: " . 
$phpgw->link("/squirrelmail/index.php","sort=$sort&startMessage=$startMessage&mailbox=".
 urlencode($mailbox)));
                }
                else
                {
                        $phpgw->common->phpgw_header();
                        //displayPageHeader($color, $mailbox);
                        echo parse_navbar();
                        error_message(lang("No messages were selected."), 
$mailbox, $sort, $startMessage, $color);
                        $phpgw->common->phpgw_footer();
                        $phpgw->common->phpgw_exit();
                }
        }

        // expunge-on-demand if user isn't using move_to_trash or auto_expunge
        elseif(isset($expungeButton))
        {
                sqimap_mailbox_expunge($imapConnection, $mailbox, true);
//address@hidden: search.php lives in /squirrelmail, not in /squirrelmail/src,
                $location = "/squirrelmail";
                if ($where && $what)
                        header ("Location: " . $phpgw->link($location . 
"/search.php","mailbox=".urlencode($mailbox)."&what=".urlencode($what)."&where=".urlencode($where)));
                else
                        header ("Location: " . 
$phpgw->link("/squirrelmail/index.php","sort=$sort&startMessage=$startMessage&mailbox=".
 urlencode($mailbox)));
        }

        // undelete messages if user isn't using move_to_trash or auto_expunge
        elseif(isset($undeleteButton))
        {
                if (is_array($msg) == 1)
                {
                        // Removes \Deleted flag from selected messages
                        $j = 0;
                        $i = 0;

                        // If they have selected nothing msg is size one still, 
but will be an infinite
                        //    loop because we never increment j.  so check to 
see if msg[0] is set or not to fix this.
                        while ($j < count($msg))
                        {
                                if ($msg[$i])
                                {
                                        sqimap_messages_remove_flag 
($imapConnection, $msg[$i], $msg[$i], "Deleted");
                                        $j++;
                                }
                                $i++;
                        }

//address@hidden: search.php lives in /squirrelmail, not in /squirrelmail/src,
                        $location = "/squirrelmail";

                        if ($where && $what)
                                header ("Location: " . $phpgw->link($location . 
"/search.php","mailbox=".urlencode($mailbox)."&what=".urlencode($what)."&where=".urlencode($where)));
                        else
                                header ("Location: " . 
$phpgw->link("/squirrelmail/index.php","sort=$sort&startMessage=$startMessage&mailbox=".
 urlencode($mailbox)));
                }
                else
                {
                        displayPageHeader($color, $mailbox);
                        error_message(lang("No messages were selected."), 
$mailbox, $sort, $startMessage, $color);
                }
        }
        elseif (isset($moveButton) || $HTTP_POST_VARS["targetMailbox"] != "-1")
        {
                // Move messages
                // lets check to see if they selected any messages
                if (is_array($msg) == 1)
                {
                        $j = 0;
                        $i = 0;

                        // If they have selected nothing msg is size one still, 
but will be an infinite
                        //    loop because we never increment j.  so check to 
see if msg[0] is set or not to fix this.
                        while ($j < count($msg))
                        {
                                if (isset($msg[$i]))
                                {

                                        /** check if they would like to move it 
to the trash folder or not */
                                        sqimap_messages_copy($imapConnection, 
$msg[$i], $msg[$i], $HTTP_POST_VARS["targetMailbox"]);
                                        sqimap_messages_flag($imapConnection, 
$msg[$i], $msg[$i], "Deleted");
                                        $j++;
                                }
                                $i++;
                        }
                        if ($auto_expunge == true)
                                sqimap_mailbox_expunge($imapConnection, 
$mailbox, true);

//address@hidden: search.php lives in /squirrelmail, not in /squirrelmail/src,
                        $location = "/squirrelmail";
                        if (isset($where) && isset($what))
//address@hidden: search.php lives JUST in /squirrelmail,
                                header ("Location: " . $phpgw->link($location . 
"/search.php","mailbox=".urlencode($mailbox)."&what=".urlencode($what)."&where=".urlencode($where)));
                        elseif (isset($followCheckBox))
                                header ("Location: " . 
$phpgw->link("/squirrelmail/index.php","sort=$sort&startMessage=$startMessage&mailbox=".
 urlencode($HTTP_POST_VARS["targetMailbox"])));
                        else
                                header ("Location: " . 
$phpgw->link("/squirrelmail/index.php","sort=$sort&startMessage=$startMessage&mailbox=".
 urlencode($mailbox)));
                }
                else
                {
                        $phpgw->common->phpgw_header();
                        //displayPageHeader($color, $mailbox);
                        echo parse_navbar();
                        error_message(lang("No messages were selected."), 
$mailbox, $sort, $startMessage, $color);
                        $phpgw->common->phpgw_footer();
                        $phpgw->common->phpgw_exit();
                }
        }

        // Log out this session
        sqimap_logout($imapConnection);
?>

====================================================
Index: load_prefs.php
<?php
   /**
    **  load_prefs.php
    **
    **  Copyright (c) 1999-2000 The SquirrelMail development team
    **  Licensed under the GNU GPL. For full terms see the file COPYING.
    **
    **  Loads preferences from the $username.pref file used by almost
    **  every other script in the source directory and alswhere.
    **
    **  $Id: load_prefs.php,v 1.1 2005/05/05 00:56:41 skwashd Exp $
    **/

   if (!isset($config_php))
   {
      include(PHPGW_APP_ROOT . '/config/config.php');
   }

   if (!isset($prefs_php))
   {
      include(PHPGW_APP_ROOT . '/inc/prefs.php');
   }

   if (!isset($plugin_php))
   {
      include(PHPGW_APP_ROOT . '/inc/plugin.php');
   }

   $load_prefs_php = true;
   checkForPrefs($data_dir, $username);

        // Until its merged in with our theme support (jengo)
        $color[0]   = "#DCDCDC"; // (light gray)     TitleBar
        $color[1]   = "#800000"; // (red)
        $color[2]   = "#CC0000"; // (light red)      Warning/Error Messages
        $color[3]   = "#A0B8C8"; // (green-blue)     Left Bar Background
        $color[4]   = "#FFFFFF"; // (white)          Normal Background
        $color[5]   = "#FFFFCC"; // (light yellow)   Table Headers
        $color[6]   = "#000000"; // (black)          Text on left bar
        $color[7]   = "#0000CC"; // (blue)           Links
        $color[8]   = "#000000"; // (black)          Normal text
        $color[9]   = "#ABABAB"; // (mid-gray)       Darker version of #0
        $color[10]  = "#666666"; // (dark gray)      Darker version of #9
        $color[11]  = "#770000"; // (dark red)       Special Folders color


//   $use_javascript_addr_book = getPref($data_dir, $username, 
"use_javascript_addr_book");
   if ($use_javascript_addr_book == "")
      $use_javascript_addr_book = $default_use_javascript_addr_book;


   /** Load the user's sent folder preferences **/
   $move_to_sent = 
$phpgw_info["user"]["preferences"]["squirrelmail"]["move_to_sent"];
   if ($move_to_sent == "")
      $move_to_sent = $default_move_to_sent;

   /** Load the user's trash folder preferences **/
   $move_to_trash = 
$phpgw_info["user"]["preferences"]["squirrelmail"]["move_to_trash"];
   if ($move_to_trash == "")
      $move_to_trash = $default_move_to_trash;


   $unseen_type = 
$phpgw_info["user"]["preferences"]["squirrelmail"]["unseen_type"];
   if ($default_unseen_type == "")
      $default_unseen_type = 1;
   if ($unseen_type == "")
      $unseen_type = $default_unseen_type;

   $unseen_notify = 
$phpgw_info["user"]["preferences"]["squirrelmail"]["unseen_notify"];
   if ($default_unseen_notify == "")
      $default_unseen_notify = 2;
   if ($unseen_notify == "")
      $unseen_notify = $default_unseen_notify;


//   $folder_prefix = getPref($data_dir, $username, "folder_prefix");
   if ($folder_prefix == "")
      $folder_prefix = $default_folder_prefix;

        /** Load special folders **/
        $new_trash_folder = 
$phpgw_info["user"]["preferences"]["squirrelmail"]["trash_folder"];
        if (($new_trash_folder == "") && ($move_to_trash == true))
                $trash_folder = $folder_prefix . $trash_folder;
        else
                $trash_folder = $new_trash_folder;

        /** Load special folders **/
        $new_sent_folder = 
$phpgw_info["user"]["preferences"]["squirrelmail"]["sent_folder"];
        if (($new_sent_folder == "") && ($move_to_sent == true))
                $sent_folder = $folder_prefix . $sent_folder;
        else
                $sent_folder = $new_sent_folder;

   $show_num = $phpgw_info["user"]["preferences"]["common"]["maxmatchs"];
   if ($show_num == "")
      $show_num = 25;

   $wrap_at = $phpgw_info["user"]["preferences"]["squirrelmail"]["wrapat"];
   if ($wrap_at == "")
      $wrap_at = 86;
   if ($wrap_at < 15)
      $wrap_at = 15;

//   $left_size = getPref($data_dir, $username, "left_size");
   if ($left_size == "") {
      if (isset($default_left_size))
         $left_size = $default_left_size;
      else
         $left_size = 200;
   }

   $editor_size = 
$phpgw_info["user"]["preferences"]["squirrelmail"]["editorsize"];
   if ($editor_size == "")
      $editor_size = 76;

   $use_signature = 
$phpgw_info["user"]["preferences"]["squirrelmail"]["usesignature"];
   if ($use_signature == "")
      $use_signature = false;

//   $left_refresh = getPref($data_dir, $username, "left_refresh");
   if ($left_refresh == "")
      $left_refresh = false;

//   $sort = getPref($data_dir, $username, "sort");
   if ($sort == "")
      $sort = 6;

   /** Load up the Signature file **/
   if ($use_signature == true) {
      $signature_abs = $signature = 
$phpgw_info["user"]["preferences"]["squirrelmail"]["signature"];
   } else {
      $signature_abs = 
$phpgw_info["user"]["preferences"]["squirrelmail"]["signature"];
   }

   //  highlightX comes in with the form: name,color,header,value
#   for ($i=0; $hlt = getPref($data_dir, $username, "highlight$i"); $i++) {
   for ($i=0; $hlt = 
$phpgw_info["user"]["preferences"]["squirrelmail"]["highlight$i"]; $i++) {
      $ary = explode(",", $hlt);
      $message_highlight_list[$i]["name"] = $ary[0];
      $message_highlight_list[$i]["color"] = $ary[1];
      $message_highlight_list[$i]["value"] = $ary[2];
      $message_highlight_list[$i]["match_type"] = $ary[3];
   }

   #index order lets you change the order of the message index
   #$order = getPref($data_dir, $username, "order1");
   #for ($i=1; $order; $i++) {
   #   $index_order[$i] = $order;
   #   $order = getPref($data_dir, $username, "order".($i+1));
   #}

   $i=1;
   while ($phpgw_info["user"]["preferences"]["squirrelmail"]["order$i"])
   {
        $index_order[$i] = 
$phpgw_info["user"]["preferences"]["squirrelmail"]["order$i"];
        $i++;
   }
   if (!isset($index_order)) {
      $index_order[1] = 1;
      $index_order[2] = 2;
      $index_order[3] = 3;
      $index_order[4] = 5;
      $index_order[5] = 4;
   }

//      not needed with phpgw
//   $location_of_bar = getPref($data_dir, $username, 'location_of_bar');
   if ($location_of_bar == '')
       $location_of_bar = 'left';

   $location_of_buttons = 
$phpgw_info["user"]["preferences"]["squirrelmail"]["button_new_location"];
   if ($location_of_buttons == '')
       $location_of_buttons = 'between';

   do_hook("loading_prefs");

?>

====================================================
Index: left_main.php
<?php
   /**
    **  left_main.php
    **  Copyright (c) 1999-2000 The SquirrelMail development team
    **  Licensed under the GNU GPL. For full terms see the file COPYING.
    **
    **  This is the code for the left bar.  The left bar shows the folders
    **  available, and has cookie information.
    **
    **  $Id: left_main.php,v 1.1 2005/05/05 00:56:41 skwashd Exp $
    **/

   session_start();

   if (!isset($i18n_php))
      include ("../functions/i18n.php");

   if(!isset($username)) {
      set_up_language($squirrelmail_language, true);
          include ("../themes/default_theme.php");
          printf('<html><BODY TEXT="%s" BGCOLOR="%s" LINK="%s" VLINK="%s" 
ALINK="%s">',
                          $color[8], $color[4], $color[7], $color[7], 
$color[7]);
          echo "</body></html>";
      exit;
   }


   if (!isset($strings_php))
      include("../functions/strings.php");
   if (!isset($config_php))
      include("../config/config.php");
   if (!isset($array_php))
      include("../functions/array.php");
   if (!isset($imap_php))
      include("../functions/imap.php");
   if (!isset($page_header_php))
      include("../functions/page_header.php");
   if (!isset($i18n_php))
      include("../functions/i18n.php");
   if (!isset($plugin_php))
      include("../functions/plugin.php");

   // open a connection on the imap port (143)
   $imapConnection = sqimap_login($username, $key, $imapServerAddress, 
$imapPort, 10); // the 10 is to hide the output

   /** If it was a successful login, lets load their preferences **/
   include("../src/load_prefs.php");

   displayHtmlHeader();

   function formatMailboxName($imapConnection, $mailbox, $real_box, $delimeter, 
$unseen) {
      global $folder_prefix, $trash_folder, $sent_folder;
      global $color, $move_to_sent, $move_to_trash;
      global $unseen_notify, $unseen_type;

      $mailboxURL = urlencode($real_box);

      if ($unseen_notify == 2 && $real_box == "INBOX") {
         $unseen = sqimap_unseen_messages($imapConnection, $numUnseen, 
$real_box);
         if ($unseen_type == 1 && $unseen > 0) {
            $unseen_string = "($unseen)";
            $unseen_found = true;
         } else if ($unseen_type == 2) {
            $numMessages = sqimap_get_num_messages($imapConnection, $real_box);
            $unseen_string = "<font 
color=\"$color[11]\">($unseen/$numMessages)</font>";
            $unseen_found = true;
         }
      } else if ($unseen_notify == 3) {
         $unseen = sqimap_unseen_messages($imapConnection, $numUnseen, 
$real_box);
         if ($unseen_type == 1 && $unseen > 0) {
            $unseen_string = "($unseen)";
            $unseen_found = true;
         } else if ($unseen_type == 2) {
            $numMessages = sqimap_get_num_messages($imapConnection, $real_box);
            $unseen_string = "<font 
color=\"$color[11]\">($unseen/$numMessages)</font>";
            $unseen_found = true;
         }
      }

      $line = "<NOBR>";
      if ($unseen > 0)
         $line .= "<B>";

      $special_color = false;
      if ((strtolower($real_box) == "inbox") ||
          (($real_box == $trash_folder) && ($move_to_trash)) ||
          (($real_box == $sent_folder) && ($move_to_sent)))
         $special_color = true;

      if ($special_color == true) {
         $line .= "<a 
href=\"index.php?sort=0&startMessage=1&mailbox=$mailboxURL\" target=\"right\" 
style=\"text-decoration:none\"><FONT COLOR=\"$color[11]\">";
         $line .= replace_spaces($mailbox);
         $line .= "</font></a>";
      } else {
         $line .= "<a 
href=\"index.php?sort=0&startMessage=1&mailbox=$mailboxURL\" target=\"right\" 
style=\"text-decoration:none\">";
         $line .= replace_spaces($mailbox);
         $line .= "</a>";
      }

      if ($unseen > 0)
         $line .= "</B>";

      if (isset($unseen_found) && $unseen_found) {
         $line .= "&nbsp;<small>$unseen_string</small>";
      }

      if (($move_to_trash == true) && ($real_box == $trash_folder)) {
         $urlMailbox = urlencode($real_box);
         $line .= "\n<small>\n";
         $line .= "  &nbsp;&nbsp;(<B><A HREF=\"empty_trash.php\" 
style=\"text-decoration:none\">".lang("purge")."</A></B>)";
         $line .= "\n</small>\n";
      }
      $line .= "</NOBR>";
      return $line;
   }

   if (isset($left_refresh) && ($left_refresh != "None") && ($left_refresh != 
"")) {
      echo "<META HTTP-EQUIV=\"Expires\" CONTENT=\"Thu, 01 Dec 1994 16:00:00 
GMT\">\n";
      echo "<META HTTP-EQUIV=\"Pragma\" CONTENT=\"no-cache\">\n";
      echo "<META HTTP-EQUIV=\"REFRESH\" 
CONTENT=\"$left_refresh;URL=left_main.php\">\n";
   }

   echo "\n<BODY BGCOLOR=\"$color[3]\" TEXT=\"$color[6]\" LINK=\"$color[6]\" 
VLINK=\"$color[6]\" ALINK=\"$color[6]\">\n";

   do_hook("left_main_before");

   $boxes = sqimap_mailbox_list($imapConnection);

   echo "<CENTER><FONT SIZE=4><B>";
   echo lang("Folders") . "</B><BR></FONT>\n\n";

   echo "<small>(<A HREF=\"../src/left_main.php\" TARGET=\"left\">";
   echo lang("refresh folder list");
   echo "</A>)</small></CENTER><BR>";
   $delimeter = sqimap_get_delimiter($imapConnection);

   for ($i = 0;$i < count($boxes); $i++) {
      $line = "";
      $mailbox = $boxes[$i]["formatted"];

      if (isset($boxes[$i]["flags"])) {
         $noselect = false;
         for ($h = 0; $h < count($boxes[$i]["flags"]); $h++) {
            if (strtolower($boxes[$i]["flags"][$h]) == "noselect")
               $noselect = true;
         }
         if ($noselect == true) {
            $line .= "<FONT COLOR=\"$color[10]\">";
            $line .= replace_spaces($mailbox);
            $line .= "</FONT>";
         } else {
            if (! isset($boxes[$i]["unseen"]))
                $boxes[$i]["unseen"] = 0;
            $line .= formatMailboxName($imapConnection, $mailbox, 
$boxes[$i]["unformatted"], $delimeter, $boxes[$i]["unseen"]);
         }
      } else {
        if (!isset($boxes[$i]["unseen"]))
            $boxes[$i]["unseen"] = "";
         $line .= formatMailboxName($imapConnection, $mailbox, 
$boxes[$i]["unformatted"], $delimeter, $boxes[$i]["unseen"]);
      }
      echo "$line<BR>\n";
   }
   sqimap_logout($imapConnection);
   do_hook("left_main_after");
?>
</BODY></HTML>

====================================================
Index: options.php
<?php
   /**
    **  options.php
    **
    **  Copyright (c) 1999-2000 The SquirrelMail development team
    **  Licensed under the GNU GPL. For full terms see the file COPYING.
    **
    **  Displays the options page. Pulls from proper user preference files
    **  and config.php. Displays preferences as selected and other options.
    **
    **  $Id: options.php,v 1.1 2005/05/05 00:56:41 skwashd Exp $
    **/

        // store the value of $mailbox, because it will overwriten
        $MAILBOX = $mailbox;
        $phpgw_info["flags"] = array("currentapp" => "squirrelmail", 
"enable_network_class" => True, "enable_nextmatchs_class" => True);
        include("../../header.inc.php");
        $mailbox = $MAILBOX;

        $phpgw->session->restore();

   if (!isset($strings_php))
      include("../inc/strings.php");
   if (!isset($config_php))
      include("../config/config.php");

        $key      = $phpgw_info['user']['preferences']['email']['passwd'];
        $username = $phpgw_info['user']['preferences']['email']['userid'];

   if (!isset($page_header_php))
      include("../inc/page_header.php");
   if (!isset($display_messages_php))
      include("../inc/display_messages.php");
   if (!isset($imap_php))
      include("../inc/imap.php");
   if (!isset($array_php))
      include("../inc/array.php");
   if (!isset($i18n_php))
      include("../inc/i18n.php");
   if (!isset($auth_php))
      include ("../inc/auth.php");

   if (isset($language)) {
      setcookie("squirrelmail_language", $language, time()+2592000);
      $squirrelmail_language = $language;
   }

   include("../src/load_prefs.php");
   displayPageHeader($color, "None");
   #is_logged_in();
?>

<br>
<table width=95% align=center cellpadding=2 cellspacing=2 border=0>
<tr><td bgcolor="<?php echo $color[0] ?>">
   <center><b><?php echo lang("Options") ?></b></center>
</td></tr></table>

<?php
   if (isset($submit_personal)) {
      # Save personal information
      if (isset($full_name)) setPref($data_dir, $username, "full_name", 
sqStripSlashes($full_name));
      if (isset($email_address)) setPref($data_dir, $username, "email_address", 
sqStripSlashes($email_address));
      if (isset($reply_to)) setPref($data_dir, $username, "reply_to", 
sqStripSlashes($reply_to));
      setPref($data_dir, $username, "use_signature", 
sqStripSlashes($usesignature));
      if (isset($signature_edit)) setSig($data_dir, $username, 
sqStripSlashes($signature_edit));

      do_hook("options_personal_save");

      echo "<br><center><b>".lang("Successfully saved personal 
information!")."</b></center><br>";
   } else if (isset($submit_display)) {
      # Save display preferences
      setPref($data_dir, $username, "chosen_theme", $chosentheme);
      setPref($data_dir, $username, "show_num", $shownum);
      setPref($data_dir, $username, "wrap_at", $wrapat);
      setPref($data_dir, $username, "editor_size", $editorsize);
      setPref($data_dir, $username, "left_refresh", $leftrefresh);
      setPref($data_dir, $username, "language", $language);
      setPref($data_dir, $username, 'location_of_bar', $folder_new_location);
      setPref($data_dir, $username, 'location_of_buttons', 
$button_new_location);
      setPref($data_dir, $username, "left_size", $leftsize);
      setPref($data_dir, $username, "use_javascript_addr_book", 
$javascript_abook);

      do_hook("options_display_save");

      echo "<br><center><b>".lang("Successfully saved display 
preferences!")."</b><br>";
      echo "<a href=\"../src/webmail.php\" target=_top>" . lang("Refresh Page") 
. "</a></center><br>";
   } else if (isset($submit_folder)) {
      # Save folder preferences
      if ($trash != "none") {
         setPref($data_dir, $username, "move_to_trash", true);
         setPref($data_dir, $username, "trash_folder", $trash);
      } else {
         setPref($data_dir, $username, "move_to_trash", "0");
         setPref($data_dir, $username, "trash_folder", "none");
      }
      if ($sent != "none") {
         setPref($data_dir, $username, "move_to_sent", true);
         setPref($data_dir, $username, "sent_folder", $sent);
      } else {
         setPref($data_dir, $username, "move_to_sent", "0");
         setPref($data_dir, $username, "sent_folder", "none");
      }
      setPref($data_dir, $username, "folder_prefix", $folderprefix);
      setPref($data_dir, $username, "unseen_notify", $unseennotify);
      setPref($data_dir, $username, "unseen_type", $unseentype);
      do_hook("options_folders_save");
      echo "<br><center><b>".lang("Successfully saved folder 
preferences!")."</b><br>";
      echo "<a href=\"../src/left_main.php\" target=left>" . lang("Refresh 
Folder List") . "</a></center><br>";
   } else {
      do_hook("options_save");
   }

?>


<table width=90% cellpadding=0 cellspacing=10 border=0 align=center>
<tr>
   <td width=50% valign=top>
      <table width=100% cellpadding=3 cellspacing=0 border=0>
         <tr>
            <td bgcolor="<?php echo $color[9] ?>">
               <a href="<?php print 
$phpgw->link('/squirrelmail/preferences_personal.php')?>"><?php echo 
lang("Personal Information"); ?></a>
            </td>
         </tr>
         <tr>
            <td bgcolor="<?php echo $color[0] ?>">
               <?php echo lang("This contains personal information about 
yourself such as your name, your email address, etc.") ?>
            </td>
         </tr>
      </table><br>
      <table width=100% cellpadding=3 cellspacing=0 border=0>
         <tr>
            <td bgcolor="<?php echo $color[9] ?>">
               <a href="<?php print 
$phpgw->link('/squirrelmail/preferences_highlight.php')?>"><?php echo 
lang("Message Highlighting"); ?></a>
            </td>
         </tr>
         <tr>
            <td bgcolor="<?php echo $color[0] ?>">
               <?php echo lang("Based upon given criteria, incoming messages 
can have different background colors in the message list.  This helps to easily 
distinguish who the messages are from, especially for mailing lists.") ?>
            </td>
         </tr>
      </table><br>
      <table width=100% cellpadding=3 cellspacing=0 border=0>
         <tr>
            <td bgcolor="<?php echo $color[9] ?>">
               <a href="<?php print 
$phpgw->link('/squirrelmail/preferences_index_order.php')?>"><?php echo 
lang("Index Order"); ?></a>
            </td>
         </tr>
         <tr>
            <td bgcolor="<?php echo $color[0] ?>">
               <?php echo lang("The order of the message index can be rearanged 
and changed to contain the headers in any order you want.") ?>
            </td>
         </tr>
      </table><br>
   </td>
   <td valign=top width=50%>
      <table width=100% cellpadding=3 cellspacing=0 border=0>
         <tr>
            <td bgcolor="<?php echo $color[9] ?>">
               <a href="<?php print 
$phpgw->link('/squirrelmail/preferences_display.php')?>"><?php echo 
lang("Display Preferences"); ?></a>
            </td>
         </tr>
         <tr>
            <td bgcolor="<?php echo $color[0] ?>">
               <?php echo lang("You can change the way that SquirrelMail looks 
and displays information to you, such as the colors, the language, and other 
settings.") ?>
            </td>
         </tr>
      </table><br>
      <table width=100% cellpadding=3 cellspacing=0 border=0>
         <tr>
            <td bgcolor="<?php echo $color[9] ?>">
               <a href="<?php print 
$phpgw->link('/squirrelmail/preferences_folder.php')?>"><?php echo lang("Folder 
Preferences"); ?></a>
            </td>
         </tr>
         <tr>
            <td bgcolor="<?php echo $color[0] ?>">
               <?php echo lang("These settings change the way your folders are 
displayed and manipulated.") ?>
            </td>
         </tr>
      </table><br>
   </td>
</tr>
</table>
   <?php
      do_hook("options_link_and_description")
   ?>
</body></html>

====================================================
Index: options_display.php
<?php
   /**
    **  options_display.php
    **
    **  Copyright (c) 1999-2000 The SquirrelMail development team
    **  Licensed under the GNU GPL. For full terms see the file COPYING.
    **
    **  Displays all optinos about display preferences
    **
    **  $Id: options_display.php,v 1.1 2005/05/05 00:56:41 skwashd Exp $
    **/

   session_start();

   if (!isset($strings_php))
      include("../functions/strings.php");
   if (!isset($config_php))
      include("../config/config.php");
   if (!isset($page_header_php))
      include("../functions/page_header.php");
   if (!isset($display_messages_php))
      include("../functions/display_messages.php");
   if (!isset($imap_php))
      include("../functions/imap.php");
   if (!isset($array_php))
      include("../functions/array.php");
   if (!isset($i18n_php))
      include("../functions/i18n.php");
   if (!isset($plugin_php))
      include("../functins/plugin.php");

   include("../src/load_prefs.php");
   displayPageHeader($color, "None");
   $chosen_language = getPref($data_dir, $username, "language");
?>
   <br>
   <table width=95% align=center border=0 cellpadding=2 cellspacing=0><tr><td 
bgcolor="<?php echo $color[0] ?>">
      <center><b><?php echo lang("Options") . " - " . lang("Display 
Preferences"); ?></b></center>
   </td></tr></table>

   <form name=f action="options.php" method=post>
      <table width=100% cellpadding=0 cellspacing=2 border=0>
         <tr>
            <td align=right nowrap><?php echo lang("Theme"); ?>:
            </td><td>
<?php
   echo "         <tt><select name=chosentheme>\n";
   for ($i = 0; $i < count($theme); $i++) {
      if ($theme[$i]["PATH"] == $chosen_theme)
         echo "         <option selected 
value=\"".$theme[$i]["PATH"]."\">".$theme[$i]["NAME"]."\n";
      else
         echo "         <option 
value=\"".$theme[$i]["PATH"]."\">".$theme[$i]["NAME"]."\n";
   }
   echo "         </select></tt>";
?>
            </td>
         </tr>
         <tr>
            <td valign=top align=right nowrap><?php echo lang("Language"); ?>:
            </td><td>
<?php
   echo "         <tt><select name=language>\n";
   foreach ($languages as $code => $name) {
      if ($code==$chosen_language)
         echo "         <OPTION SELECTED 
VALUE=\"".$code."\">".$languages[$code]["NAME"]."\n";
      else
         echo "         <OPTION 
VALUE=\"".$code."\">".$languages[$code]["NAME"]."\n";
   }
   echo "         </select></tt>";
   if (! $use_gettext)
      echo "<br><small>This system doesn't support multiple languages</small>";

?>
            </td>
         <tr>
            <td align=right nowrap>&nbsp;
               <?php echo lang("Use Javascript or HTML addressbook?") . 
"</td><td>";
               if ($use_javascript_addr_book == true) {
                  echo "         <input type=radio name=javascript_abook 
value=1 checked> " . lang("JavaScript") . "&nbsp;&nbsp;&nbsp;&nbsp;";
                  echo "         <input type=radio name=javascript_abook 
value=0> " . lang("HTML");
               } else {
                  echo "         <input type=radio name=javascript_abook 
value=1> " . lang("JavaScript") . "&nbsp;&nbsp;&nbsp;&nbsp;";
                  echo "         <input type=radio name=javascript_abook 
value=0 checked> " . lang("HTML");
               }
               ?>
            </td>
         </tr>
         <tr>
            <td align=right nowrap><?php echo lang("Number of Messages to 
Index"); ?>:
            </td><td>
<?php
   if (isset($show_num))
      echo "         <tt><input type=text size=5 name=shownum 
value=\"$show_num\"></tt><br>";
   else
      echo "         <tt><input type=text size=5 name=shownum 
value=\"25\"></tt><br>";
?>
            </td>
         </tr>
         <tr>
            <td align=right nowrap><?php echo lang("Wrap incoming text at"); ?>:
            </td><td>
<?php
   if (isset($wrap_at))
      echo "         <tt><input type=text size=5 name=wrapat 
value=\"$wrap_at\"></tt><br>";
   else
      echo "         <tt><input type=text size=5 name=wrapat 
value=\"86\"></tt><br>";
?>
            </td>
         </tr>
         <tr>
            <td align=right nowrap><?php echo lang("Size of editor window"); ?>:
            </td><td>
<?php
   if ($editor_size >= 10 && $editor_size <= 255)
      echo "         <tt><input type=text size=5 name=editorsize 
value=\"$editor_size\"></tt><br>";
   else
      echo "         <tt><input type=text size=5 name=editorsize 
value=\"76\"></tt><br>";
?>
            </td>
         </tr>
         <tr>
            <td align=right nowrap><?php echo lang("Location of folder list") 
?>:</td>
            <td><select name="folder_new_location">
                <option value="left"<?php
                    if ($location_of_bar != 'right') echo ' SELECTED';
                    ?>><?php echo lang("Left"); ?></option>
                <option value="right"<?php
                    if ($location_of_bar == 'right') echo ' SELECTED';
                    ?>><?php echo lang("Right"); ?></option>
                </select>
            </td>
         </tr>
         <tr>
            <td align=right nowrap><?php echo lang("Location of buttons when 
composing") ?>:</td>
            <td><select name="button_new_location">
                <option value="top"<?php
                    if ($location_of_buttons == 'top') echo ' SELECTED';
                    ?>><?php echo lang("Before headers"); ?></option>
                <option value="between"<?php
                    if ($location_of_buttons == 'between') echo ' SELECTED';
                    ?>><?php echo lang("Between headers and message body"); 
?></option>
                <option value="bottom"<?php
                    if ($location_of_buttons == 'bottom') echo ' SELECTED';
                    ?>><?php echo lang("After message body"); ?></option>
                </select>
            </td>
         </tr>
         <tr>
            <td align=right nowrap><?php echo lang("Width of folder list"); ?>:
            </td><td>
<?php
   echo "         <select name=leftsize>\n";
   if ($left_size == 100)
      echo "<option value=100 selected>100 pixels\n";
   else
      echo "<option value=100>100 pixels\n";

   if ($left_size == 125)
      echo "<option value=125 selected>125 pixels\n";
   else
      echo "<option value=125>125 pixels\n";

   if ($left_size == 150)
      echo "<option value=150 selected>150 pixels\n";
   else
      echo "<option value=150>150 pixels\n";

   if ($left_size == 175)
      echo "<option value=175 selected>175 pixels\n";
   else
      echo "<option value=175>175 pixels\n";

   if (($left_size == 200) || ($left_size == ""))
      echo "<option value=200 selected>200 pixels\n";
   else
      echo "<option value=200>200 pixels\n";

   if (($left_size == 225))
      echo "<option value=225 selected>225 pixels\n";
   else
      echo "<option value=225>225 pixels\n";

   if (($left_size == 250))
      echo "<option value=250 selected>250 pixels\n";
   else
      echo "<option value=250>250 pixels\n";

   if ($left_size == 275)
      echo "<option value=275 selected>275 pixels\n";
   else
      echo "<option value=275>275 pixels\n";

   if (($left_size == 300))
      echo "<option value=300 selected>300 pixels\n";
   else
      echo "<option value=300>300 pixels\n";

   echo "         </select>";
?>
            </td>
         </tr>
         <tr>
            <td align=right nowrap><?php echo lang("Auto refresh folder list"); 
?>:
            </td><td>
<?php
   $seconds_str = lang("Seconds");
   $none_str = lang("None");
   $minute_str = lang("Minute");
   $minutes_str = lang("Minutes");

   echo "               <SELECT name=leftrefresh>";
   if (($left_refresh == "None") || ($left_refresh == ""))
      echo "                  <OPTION VALUE=None SELECTED>$none_str";
   else
      echo "                  <OPTION VALUE=None>$none_str";

   if (($left_refresh == "10"))
      echo "                  <OPTION VALUE=10 SELECTED>10 $seconds_str";
   else
      echo "                  <OPTION VALUE=10>10 $seconds_str";

   if (($left_refresh == "20"))
      echo "                  <OPTION VALUE=20 SELECTED>20 $seconds_str";
   else
      echo "                  <OPTION VALUE=20>20 $seconds_str";

   if (($left_refresh == "30"))
      echo "                  <OPTION VALUE=30 SELECTED>30 $seconds_str";
   else
      echo "                  <OPTION VALUE=30>30 $seconds_str";

   if (($left_refresh == "60"))
      echo "                  <OPTION VALUE=60 SELECTED>1 $minute_str";
   else
      echo "                  <OPTION VALUE=60>1 $minute_str";

   if (($left_refresh == "120"))
      echo "                  <OPTION VALUE=120 SELECTED>2 $minutes_str";
   else
      echo "                  <OPTION VALUE=120>2 $minutes_str";

   if (($left_refresh == "180"))
      echo "                  <OPTION VALUE=180 SELECTED>3 $minutes_str";
   else
      echo "                  <OPTION VALUE=180>3 $minutes_str";

   if (($left_refresh == "240"))
      echo "                  <OPTION VALUE=240 SELECTED>4 $minutes_str";
   else
      echo "                  <OPTION VALUE=240>4 $minutes_str";

   if (($left_refresh == "300"))
      echo "                  <OPTION VALUE=300 SELECTED>5 $minutes_str";
   else
      echo "                  <OPTION VALUE=300>5 $minutes_str";

   if (($left_refresh == "420"))
      echo "                  <OPTION VALUE=420 SELECTED>7 $minutes_str";
   else
      echo "                  <OPTION VALUE=420>7 $minutes_str";

   if (($left_refresh == "600"))
      echo "                  <OPTION VALUE=600 SELECTED>10 $minutes_str";
   else
      echo "                  <OPTION VALUE=600>10 $minutes_str";

   if (($left_refresh == "720"))
      echo "                  <OPTION VALUE=720 SELECTED>12 $minutes_str";
   else
      echo "                  <OPTION VALUE=720>12 $minutes_str";

   if (($left_refresh == "900"))
      echo "                  <OPTION VALUE=900 SELECTED>15 $minutes_str";
   else
      echo "                  <OPTION VALUE=900>15 $minutes_str";

   if (($left_refresh == "1200"))
      echo "                  <OPTION VALUE=1200 SELECTED>20 $minutes_str";
   else
      echo "                  <OPTION VALUE=1200>20 $minutes_str";

   if (($left_refresh == "1500"))
      echo "                  <OPTION VALUE=1500 SELECTED>25 $minutes_str";
   else
      echo "                  <OPTION VALUE=1500>25 $minutes_str";

   if (($left_refresh == "1800"))
      echo "                  <OPTION VALUE=1800 SELECTED>30 $minutes_str";
   else
      echo "                  <OPTION VALUE=1800>30 $minutes_str";

      echo "               </SELECT>";
?>
            </td>
         </tr>
         <?php do_hook("options_display_inside"); ?>
         <tr>
            <td>&nbsp;
            </td><td>
               <input type="submit" value="<?php echo lang("Submit"); 
?>"name="submit_display">
            </td>
         </tr>
      </table>
   </form>
   <?php do_hook("options_display_bottom"); ?>
</body></html>

====================================================
Index: options_order.php
<?php
   /**
    **  options_highlight.php
    **
    **  Copyright (c) 1999-2000 The SquirrelMail development team
    **  Licensed under the GNU GPL. For full terms see the file COPYING.
    **
    **  Displays message highlighting options
    **
    **  $Id: options_order.php,v 1.1 2005/05/05 00:56:41 skwashd Exp $
    **/

   session_start();

   if (!isset($strings_php))
      include("../functions/strings.php");
   if (!isset($config_php))
      include("../config/config.php");
   if (!isset($page_header_php))
      include("../functions/page_header.php");
   if (!isset($display_messages_php))
      include("../functions/display_messages.php");
   if (!isset($imap_php))
      include("../functions/imap.php");
   if (!isset($array_php))
      include("../functions/array.php");
   if (!isset($i18n_php))
      include("../functions/i18n.php");
   if (!isset($plugin_php))
      include("../functions/plugin.php");


   if (! isset($action)) { $action = ""; }
   if ($action == "delete" && isset($theid)) {
      removePref($data_dir, $username, "highlight$theid");
   } else if ($action == "save") {
   }
   include("../src/load_prefs.php");
   displayPageHeader($color, "None");
?>
   <br>
   <table width=95% align=center border=0 cellpadding=2 cellspacing=0><tr><td 
bgcolor="<?php echo $color[0] ?>">
      <center><b><?php echo lang("Options") . " - " . lang("Index Order"); 
?></b></center>
   </td></tr></table>

   <table width=95% align=center border=0><tr><td>
<?php

   $available[1] = lang("Checkbox");
   $available[2] = lang("From");
   $available[3] = lang("Date");
   $available[4] = lang("Subject");
   $available[5] = lang("Flags");
   $available[6] = lang("Size");

   if (! isset($method)) { $method = ""; }

   if ($method == "up" && $num > 1) {
      $prev = $num-1;
      $tmp = $index_order[$prev];
      $index_order[$prev] = $index_order[$num];
      $index_order[$num] = $tmp;
   } else if ($method == "down" && $num < count($index_order)) {
      $next = $num++;
      $tmp = $index_order[$next];
      $index_order[$next] = $index_order[$num];
      $index_order[$num] = $tmp;
   } else if ($method == "remove" && $num) {
      for ($i=1; $i < 8; $i++) {
         removePref($data_dir, $username, "order$i");
      }
      for ($j=1,$i=1; $i <= count($index_order); $i++) {
         if ($i != $num) {
            $new_ary[$j] = $index_order[$i];
            $j++;
         }
      }
      $index_order = array();
      $index_order = $new_ary;
      if (count($index_order) < 1) {
         include "../src/load_prefs.php";
      }
   } else if ($method == "add" && $add) {
      $index_order[count($index_order)+1] = $add;
   }

   if ($method) {
      for ($i=1; $i <= count($index_order); $i++) {
         setPref($data_dir, $username, "order$i", $index_order[$i]);
      }
   }
   echo "<center>";
   echo "<table cellspacing=0 cellpadding=0 border=0 width=65%><tr><td>\n";
   echo lang("The index order is the order that the columns are arranged in the 
message index.  You can add, remove, and move columns around to customize them 
to fit your needs.");
   echo "</td></tr></table></center><br>";

   if (count($index_order))
   {
      echo "<center>";
      echo "<table cellspacing=0 cellpadding=0 border=0>\n";
      for ($i=1; $i <= count($index_order); $i++) {
         $tmp = $index_order[$i];
         echo "<tr>";
         echo "<td><small><a href=\"options_order.php?method=up&num=$i\">". 
lang("up") ."</a></small></td>\n";
         echo "<td><small>&nbsp;|&nbsp;</small></td>\n";
         echo "<td><small><a href=\"options_order.php?method=down&num=$i\">". 
lang("down") . "</a></small></td>\n";
         echo "<td><small>&nbsp;|&nbsp;</small></td>\n";
         echo "<td>";
         // Always show the subject
         if ($tmp != 4)
            echo "<small><a href=\"options_order.php?method=remove&num=$i\">" . 
lang("remove") . "</a></small>";
         echo "</td>\n";
         echo "<td><small>&nbsp;-&nbsp;</small></td>\n";
         echo "<td>" . $available[$tmp] . "</td>\n";
         echo "</tr>\n";
      }
      echo "</table>\n";
      echo "</center>";
   }

   if (count($index_order) != count($available)) {
   echo "<center><form name=f method=post action=options_order.php>";
   echo "<select name=add>";
   for ($i=1; $i <= count($available); $i++) {
      $found = false;
      for ($j=1; $j <= count($index_order); $j++) {
         if ($index_order[$j] == $i) {
            $found = true;
         }
      }
      if (!$found) {
         echo "<option value=$i>$available[$i]</option>";
      }
   }
   echo "</select>";
   echo "<input type=hidden value=add name=method>";
   echo "<input type=submit value=\"".lang("Add")."\" name=submit>";
   echo "</form></center>";
   }

   echo "<br><center><a href=\"../src/options.php\">" . lang("Return to options 
page") . "</a></center>";

?>
   </td></tr></table>
</body></html>

====================================================
Index: options_highlight.php
<?php
   /**
    **  options_highlight.php
    **
    **  Copyright (c) 1999-2000 The SquirrelMail development team
    **  Licensed under the GNU GPL. For full terms see the file COPYING.
    **
    **  Displays message highlighting options
    **
    **  $Id: options_highlight.php,v 1.1 2005/05/05 00:56:41 skwashd Exp $
    **/

   session_start();

   if (!isset($strings_php))
      include("../functions/strings.php");
   if (!isset($config_php))
      include("../config/config.php");
   if (!isset($page_header_php))
      include("../functions/page_header.php");
   if (!isset($display_messages_php))
      include("../functions/display_messages.php");
   if (!isset($imap_php))
      include("../functions/imap.php");
   if (!isset($array_php))
      include("../functions/array.php");
   if (!isset($i18n_php))
      include("../functions/i18n.php");
   if (!isset($plugin_php))
      include("../functions/plugin.php");

   if (! isset($action))
       $action = '';
   if (! isset($message_highlight_list))
       $message_highlight_list = array();

   if ($action == "delete" && isset($theid)) {
      removePref($data_dir, $username, "highlight$theid");
   } else if ($action == "save") {
      if (!$theid) $theid = 0;
      $identname = ereg_replace(",", " ", $identname);
      $identname = str_replace("\\\\", "\\", $identname);
      $identname = str_replace("\\\"", "\"", $identname);
      $identname = str_replace("\"", "&quot;", $identname);
      if ($color_type == 1) $newcolor = $newcolor_choose;
      else $newcolor = $newcolor_input;

      $newcolor = ereg_replace(",", "", $newcolor);
      $newcolor = ereg_replace("#", "", $newcolor);
      $newcolor = "$newcolor";
      $value = ereg_replace(",", " ", $value);
      $value = str_replace("\\\\", "\\", $value);
      $value = str_replace("\\\"", "\"", $value);
      $value = str_replace("\"", "&quot;", $value);

      setPref($data_dir, $username, "highlight$theid", 
$identname.",".$newcolor.",".$value.",".$match_type);
      $message_highlight_list[$theid]["name"] = $identname;
      $message_highlight_list[$theid]["color"] = $newcolor;
      $message_highlight_list[$theid]["value"] = $value;
      $message_highlight_list[$theid]["match_type"] = $match_type;
   }
   include("../src/load_prefs.php");
   displayPageHeader($color, "None");
?>
   <br>
   <table width=95% align=center border=0 cellpadding=2 cellspacing=0><tr><td 
bgcolor="<?php echo $color[0] ?>">
      <center><b><?php echo lang("Options") . " - " . lang("Message 
Highlighting"); ?></b></center>
   </td></tr></table>

<?php
   echo "<br><center>[<a href=\"options_highlight.php?action=add\">" . 
lang("New") . "</a>]";
   echo " - [<a href=\"options.php\">".lang("Done")."</a>]</center><br>\n";
   if (count($message_highlight_list) >= 1) {
      echo "<table border=0 cellpadding=3 cellspacing=0 align=center 
width=80%>\n";
      for ($i=0; $i < count($message_highlight_list); $i++) {
         echo "<tr>\n";
         echo "   <td width=1% bgcolor=" . $color[4] . ">\n";
         echo "<nobr><small>[<a 
href=\"options_highlight.php?action=edit&theid=$i\">" . lang("Edit") . 
"</a>]&nbsp;[<a 
href=\"options_highlight.php?action=delete&theid=$i\">".lang("Delete")."</a>]</small></nobr>\n";
         echo "   </td>";
         echo "   <td bgcolor=" . $message_highlight_list[$i]["color"] . ">\n";
         echo "      " . $message_highlight_list[$i]["name"];
         echo "   </td>\n";
         echo "   <td bgcolor=" . $message_highlight_list[$i]["color"] . ">\n";
         echo "      ".$message_highlight_list[$i]["match_type"]." = " . 
$message_highlight_list[$i]["value"];
         echo "   </td>\n";
         echo "</tr>\n";
      }
      echo "</table>\n";
      echo "<br>\n";
   } else {
      echo "<center>" . lang("No highlighting is defined") . "</center><br>\n";
      echo "<br>\n";
   }
   if ($action == "edit" || $action == "add") {
      if (!isset($theid)) $theid = count($message_highlight_list);
          $message_highlight_list[$theid] = array();

      $color_list[0] = "4444aa";
      $color_list[1] = "44aa44";
      $color_list[2] = "aaaa44";
      $color_list[3] = "44aaaa";
      $color_list[4] = "aa44aa";
      $color_list[5] = "aaaaff";
      $color_list[6] = "aaffaa";
      $color_list[7] = "ffffaa";
      $color_list[8] = "aaffff";
      $color_list[9] = "ffaaff";
      $color_list[10] = "aaaaaa";
      $color_list[11] = "bfbfbf";
      $color_list[12] = "dfdfdf";
      $color_list[13] = "ffffff";

      $selected_input = "";

      for ($i=0; $i < 14; $i++) {
         ${"selected".$i} = "";
      }
      if (isset($message_highlight_list[$theid]["color"])) {
         for ($i=0; $i < 14; $i++) {
            if ($color_list[$i] == $message_highlight_list[$theid]["color"]) {
               $selected_choose = " checked";
               ${"selected".$i} = " selected";
               continue;
            }
             }
      }
      if (!isset($message_highlight_list[$theid]["color"]))
         $selected_choose = " checked";
      else if (!isset($selected_choose))
         $selected_input = " checked";

      echo "<form name=f action=\"options_highlight.php\">\n";
      echo "<input type=\"hidden\" value=\"save\" name=\"action\">\n";
      echo "<input type=\"hidden\" value=\"$theid\" name=\"theid\">\n";
      echo "<table width=80% align=center cellpadding=3 cellspacing=0 
border=0>\n";
      echo "   <tr bgcolor=\"$color[0]\">\n";
      echo "      <td align=right width=25%><b>\n";
      echo lang("Identifying name") . ":";
      echo "      </b></td>\n";
      echo "      <td width=75%>\n";
      if (isset($message_highlight_list[$theid]["name"]))
          $disp = $message_highlight_list[$theid]["name"];
      else
          $disp = "";
      $disp = str_replace("\\\\", "\\", $disp);
      $disp = str_replace("\\\"", "\"", $disp);
      $disp = str_replace("\"", "&quot;", $disp);
      echo "         <input type=\"text\" value=\"".$disp."\" 
name=\"identname\">";
      echo "      </td>\n";
      echo "   </tr>\n";
      echo "   <tr><td><small><small>&nbsp;</small></small></td></tr>\n";
      echo "   <tr bgcolor=\"$color[0]\">\n";
      echo "      <td align=right width=25%><b>\n";
      echo lang("Color") . ":";
      echo "      </b></td>\n";
      echo "      <td width=75%>\n";
      echo "         <input type=\"radio\" name=color_type 
value=1$selected_choose> &nbsp;<select name=newcolor_choose>\n";
      echo "            <option value=\"$color_list[0]\"$selected0>" . 
lang("Dark Blue") . "\n";
      echo "            <option value=\"$color_list[1]\"$selected1>" . 
lang("Dark Green") . "\n";
      echo "            <option value=\"$color_list[2]\"$selected2>" . 
lang("Dark Yellow") . "\n";
      echo "            <option value=\"$color_list[3]\"$selected3>" . 
lang("Dark Cyan") . "\n";
      echo "            <option value=\"$color_list[4]\"$selected4>" . 
lang("Dark Magenta") . "\n";
      echo "            <option value=\"$color_list[5]\"$selected5>" . 
lang("Light Blue") . "\n";
      echo "            <option value=\"$color_list[6]\"$selected6>" . 
lang("Light Green") . "\n";
      echo "            <option value=\"$color_list[7]\"$selected7>" . 
lang("Light Yellow") . "\n";
      echo "            <option value=\"$color_list[8]\"$selected8>" . 
lang("Light Cyan") . "\n";
      echo "            <option value=\"$color_list[9]\"$selected9>" . 
lang("Light Magenta") . "\n";
      echo "            <option value=\"$color_list[10]\"$selected10>" . 
lang("Dark Gray") . "\n";
      echo "            <option value=\"$color_list[11]\"$selected11>" . 
lang("Medium Gray") . "\n";
      echo "            <option value=\"$color_list[12]\"$selected12>" . 
lang("Light Gray") . "\n";
      echo "            <option value=\"$color_list[13]\"$selected13>" . 
lang("White") . "\n";
      echo "         </select><br>\n";
      echo "         <input type=\"radio\" name=color_type 
value=2$selected_input> &nbsp;". lang("Other:") ."<input type=\"text\" 
value=\"";
      if ($selected_input) echo $message_highlight_list[$theid]["color"];
      echo "\" name=\"newcolor_input\" size=7> ".lang("Ex: 63aa7f")."<br>\n";
      echo "      </td>\n";
      echo "   </tr>\n";
      echo "   <tr><td><small><small>&nbsp;</small></small></td></tr>\n";
      echo "   <tr bgcolor=\"$color[0]\">\n";
      echo "      <td align=right width=25%><b>\n";
      echo lang("Match") . ":";
      echo "      </b></td>\n";
      echo "      <td width=75%>\n";
      echo "         <select name=match_type>\n";
      if (isset($message_highlight_list[$theid]["match_type"]) && 
$message_highlight_list[$theid]["match_type"] == "from")    echo "            
<option value=\"from\" selected>From\n";
      else                                                         echo "       
     <option value=\"from\">From\n";
      if (isset($message_highlight_list[$theid]["match_type"]) && 
$message_highlight_list[$theid]["match_type"] == "to")      echo "            
<option value=\"to\" selected>To\n";
      else                                                         echo "       
     <option value=\"to\">To\n";
      if (isset($message_highlight_list[$theid]["match_type"]) && 
$message_highlight_list[$theid]["match_type"] == "cc")      echo "            
<option value=\"cc\" selected>Cc\n";
      else                                                         echo "       
     <option value=\"cc\">Cc\n";
      if (isset($message_highlight_list[$theid]["match_type"]) && 
$message_highlight_list[$theid]["match_type"] == "to_cc")   echo "            
<option value=\"to_cc\" selected>To or Cc\n";
      else                                                         echo "       
     <option value=\"to_cc\">To or Cc\n";
      if (isset($message_highlight_list[$theid]["match_type"]) && 
$message_highlight_list[$theid]["match_type"] == "subject") echo "            
<option value=\"subject\" selected>Subject\n";
      else                                                         echo "       
     <option value=\"subject\">Subject\n";
      echo "         </select>\n";
      if (isset($message_highlight_list[$theid]["value"]))
          $disp = $message_highlight_list[$theid]["value"];
      else
          $disp = '';
      $disp = str_replace("\\\\", "\\", $disp);
      $disp = str_replace("\\\"", "\"", $disp);
      $disp = str_replace("\"", "&quot;", $disp);
      echo "         <nobr><input type=\"text\" value=\"".$disp."\" 
name=\"value\">";
      echo "        <nobr></td>\n";
      echo "   </tr>\n";
      echo "</table>\n";
      echo "<center><input type=\"submit\" value=\"" . lang("Submit") . 
"\"></center>\n";
      echo "</form>\n";
      do_hook("options_highlight_bottom");
   }
?>
</body></html>

====================================================
Index: options_folder.php
<?php
   /**
    **  options_folder.php
    **
    **  Copyright (c) 1999-2000 The SquirrelMail development team
    **  Licensed under the GNU GPL. For full terms see the file COPYING.
    **
    **  Displays all options relating to folders
    **
    **  $Id: options_folder.php,v 1.1 2005/05/05 00:56:41 skwashd Exp $
    **/

   session_start();

   if (!isset($strings_php))
      include("../functions/strings.php");
   if (!isset($config_php))
      include("../config/config.php");
   if (!isset($page_header_php))
      include("../functions/page_header.php");
   if (!isset($display_messages_php))
      include("../functions/display_messages.php");
   if (!isset($imap_php))
      include("../functions/imap.php");
   if (!isset($array_php))
      include("../functions/array.php");
   if (!isset($i18n_php))
      include("../functions/i18n.php");
   if (!isset($plugin_php))
      include("../functions/plugin.php");

   include("../src/load_prefs.php");
   displayPageHeader($color, "None");

   $imapConnection = sqimap_login($username, $key, $imapServerAddress, 
$imapPort, 0);
   $boxes = sqimap_mailbox_list($imapConnection);
   sqimap_logout($imapConnection);
?>
   <br>
   <table width=95% align=center border=0 cellpadding=2 cellspacing=0><tr><td 
bgcolor="<?php echo $color[0] ?>">
      <center><b><?php echo lang("Options") . " - " . lang("Folder 
Preferences"); ?></b></center>
   </td></tr></table>

   <form name=f action="options.php" method=post>
      <table width=100% cellpadding=0 cellspacing=2 border=0>

<?php if ($show_prefix_option == true) {   ?>
         <tr>
            <td align=right nowrap><?php echo lang("Folder Path"); ?>:
            </td><td>
<?php if (isset ($folder_prefix))
      echo "         <input type=text name=folderprefix 
value=\"$folder_prefix\" size=35><br>";
   else
      echo "         <input type=text name=folderprefix 
value=\"$default_folder_prefix\" size=35><br>";
?>
            </td>
         </tr>
<?php }

   // TRASH FOLDER
   echo "<tr><td nowrap align=right>";
   echo lang("Trash Folder:");
   echo "</td><td>";
      echo "<TT><SELECT NAME=trash>\n";
      if ($move_to_trash == true)
         echo "<option value=none>" . lang("Don't use Trash");
      else
         echo "<option value=none selected>" . lang("Do not use Trash");

      for ($i = 0; $i < count($boxes); $i++) {
         $use_folder = true;
         if (strtolower($boxes[$i]["unformatted"]) == "inbox") {
            $use_folder = false;
         }
         if ($use_folder == true) {
            $box = $boxes[$i]["unformatted-dm"];
            $box2 = replace_spaces($boxes[$i]["formatted"]);
            if (($boxes[$i]["unformatted"] == $trash_folder) && ($move_to_trash 
== true))
               echo "         <OPTION SELECTED VALUE=\"$box\">$box2\n";
            else
               echo "         <OPTION VALUE=\"$box\">$box2\n";
         }
      }
      echo "</SELECT></TT>\n";
   echo "</td></tr>";


   // SENT FOLDER
   echo "<tr><td nowrap align=right>";
   echo lang("Sent Folder:");
   echo "</td><td>";
      echo "<TT><SELECT NAME=sent>\n";
      if ($move_to_sent == true)
         echo "<option value=none>" . lang("Don't use Sent");
      else
         echo "<option value=none selected>" . lang("Do not use Sent");

      for ($i = 0; $i < count($boxes); $i++) {
         $use_folder = true;
         if (strtolower($boxes[$i]["unformatted"]) == "inbox") {
            $use_folder = false;
         }
         if ($use_folder == true) {
            $box = $boxes[$i]["unformatted-dm"];
            $box2 = replace_spaces($boxes[$i]["formatted"]);
            if (($boxes[$i]["unformatted"] == $sent_folder) && ($move_to_sent 
== true))
               echo "         <OPTION SELECTED VALUE=\"$box\">$box2\n";
            else
               echo "         <OPTION VALUE=\"$box\">$box2\n";
         }
      }
      echo "</SELECT></TT>\n";
   echo "</td></tr>";
?>
         <tr>
            <td valign=top align=right>
               <br>
               <?php echo lang("Unseen message notification"); ?>:
            </td>
            <td>
               <input type=radio name=unseennotify value=1<?php if 
($unseen_notify == 1) echo " checked"; ?>> <?php echo lang("No notification") 
?><br>
               <input type=radio name=unseennotify value=2<?php if 
($unseen_notify != 1 && $unseen_notify != 3) echo " checked"; ?>> <?php echo 
lang("Only INBOX") ?><br>
               <input type=radio name=unseennotify value=3<?php if 
($unseen_notify == 3) echo " checked"; ?>> <?php echo lang("All Folders") ?><br>
               <br>
            </td>
         </tr>
         <tr>
            <td valign=top align=right>
               <br>
               <?php echo lang("Unseen message notification type"); ?>:
            </td>
            <td>
               <input type=radio name=unseentype value=1<?php if ($unseen_type 
< 2 || $unseen_type > 2) echo " checked"; ?>> <?php echo lang("Only unseen"); 
?> - (4)<br>
               <input type=radio name=unseentype value=2<?php if ($unseen_type 
== 2) echo " checked"; ?>> <?php echo lang("Unseen and Total"); ?> - (4/27)
            </td>
         </tr>
         <?php do_hook("options_folders_inside"); ?>
         <tr>
            <td>&nbsp;
            </td><td>
               <input type="submit" value="<?php echo lang("Submit"); ?>" 
name="submit_folder">
            </td>
         </tr>
      </table>
   </form>
   <?php do_hook("options_folders_bottom"); ?>
</body></html>

====================================================
Index: help.php
<?php
   /**
    **  help.php
    **
    **  Copyright (c) 1999-2000 The SquirrelMail development team
    **  Licensed under the GNU GPL. For full terms see the file COPYING.
    **
    **  Displays help for the user
    **
    **  $Id: help.php,v 1.1 2005/05/05 00:56:41 skwashd Exp $
    **/

   session_start();

   if (!isset($strings_php))
      include("../functions/strings.php");
   if (!isset($config_php))
      include("../config/config.php");
   if (!isset($page_header_php))
      include("../functions/page_header.php");
   if (!isset($display_messages_php))
      include("../functions/display_messages.php");
   if (!isset($imap_php))
      include("../functions/imap.php");
   if (!isset($array_php))
      include("../functions/array.php");
   if (!isset($i18n_php))
      include("../functions/i18n.php");
   if (!isset($auth_php))
      include ("../functions/auth.php");

   include("../src/load_prefs.php");
   displayPageHeader($color, "None");
   is_logged_in();

        $helpdir[0] = "basic.hlp";
        $helpdir[1] = "main_folder.hlp";
        $helpdir[2] = "read_mail.hlp";
        $helpdir[3] = "compose.hlp";
        $helpdir[4] = "addresses.hlp";
        $helpdir[5] = "folders.hlp";
        $helpdir[6] = "options.hlp";
        $helpdir[7] = "search.hlp";
        $helpdir[8] = "FAQ.hlp";

   /****************[ HELP FUNCTIONS ]********************/
   // parses through and gets the information from the different documents.
   // this returns one section at a time.  You must keep track of the position
   // so that it knows where to start to look for the next section.

   function get_info($doc, $pos) {
      for ($n=$pos; $n < count($doc); $n++) {
         if (trim(strtolower($doc[$n])) == "<chapter>" || 
trim(strtolower($doc[$n])) == "<section>") {
            for ($n++;$n < count($doc) && (trim(strtolower($doc[$n])) != 
"</section>") && (trim(strtolower($doc[$n])) != "</chapter>"); $n++) {
               if (trim(strtolower($doc[$n])) == "<title>") {
                  $n++;
                  $ary[0] = trim($doc[$n]);
               }
               if (trim(strtolower($doc[$n])) == "<description>") {
                  $ary[1] = "";
                  for ($n++;$n < count($doc) && (trim(strtolower($doc[$n])) != 
"</description>"); $n++) {
                     $ary[1] .= $doc[$n];
                  }
               }
               if (trim(strtolower($doc[$n])) == "<summary>") {
                  $ary[2] = "";
                  for ($n++;$n < count($doc) && (trim(strtolower($doc[$n])) != 
"</summary>"); $n++) {
                     $ary[2] .= $doc[$n];
                  }
               }
            }
            if (isset($ary)) {
               $ary[3] = $n;
               return $ary;
            } else {
               $ary[0] = "ERROR: Help files are not in the right format!";
               $ary[1] = "ERROR: Help files are not in the right format!";
               $ary[2] = "ERROR: Help files are not in the right format!";
               return $ary;
            }
         }
      }
      $ary[0] = "ERROR: Help files are not in the right format!";
      $ary[1] = "ERROR: Help files are not in the right format!";
      return $ary;
   }

   /**************[ END HELP FUNCTIONS ]******************/

?>

<br>
<table width=95% align=center cellpadding=2 cellspacing=2 border=0>
<tr><td bgcolor="<?php echo $color[0] ?>">
   <center><b><?php echo lang("Help") ?></b></center>
</td></tr></table>

<?php do_hook("help_top") ?>

<table width=90% cellpadding=0 cellspacing=10 border=0 align=center><tr><td>
<?php
   if ($HTTP_REFERER) {
      $ref = strtolower($HTTP_REFERER);
      if (strpos($ref, "src/compose"))
         $context = "compose";
      else if (strpos($ref, "src/addr"))
         $context = "address";
      else if (strpos($ref, "src/folders"))
         $context = "folders";
      else if (strpos($ref, "src/options"))
         $context = "options";
      else if (strpos($ref, "src/right_main"))
         $context = "index";
      else if (strpos($ref, "src/read_body"))
         $context = "read";
      else if (strpos($ref, "src/search"))
         $context = "search";
   }

   if (!$squirrelmail_language)
      $squirrelmail_language = "en";

   if (file_exists("../help/$squirrelmail_language")) {
      $help_exists = true;
      $user_language = $squirrelmail_language;
   } else if (file_exists("../help/en")) {
      $help_exists = true;
      echo "<center><font color=\"$color[2]\">";
      printf (lang("The help has not been translated to %1.  It will be 
displayed in English instead."), $languages[$squirrelmail_language]["NAME"]);
      echo "</font></center><br>";
      $user_language = "en";
   } else {
      $help_exists = false;
      echo "<br><center><font color=\"$color[2]\">";
      echo lang("Some or all of the help documents are not present!");
      echo "</font></center>";
      echo "</td></tr></table>";
      exit;
   }

   if ($help_exists) {
      if (! isset($context))
          $context = '';
      if ($context == "compose")
         $chapter = 4;
      else if ($context == "address")
         $chapter = 5;
      else if ($context == "folders")
         $chapter = 6;
      else if ($context == "options")
         $chapter = 7;
      else if ($context == "index")
         $chapter = 2;
      else if ($context == "read")
         $chapter = 3;
      else if ($context == "search")
         $chapter = 8;

      if (!isset($chapter)) {
         echo "<table cellpadding=0 cellspacing=0 border=0 
align=center><tr><td>\n";
         echo "<b><center>" . lang("Table of Contents") . "</center></b><br>";
         do_hook("help_chapter");
         echo "<ol>\n";
         for ($i=0; $i < count($helpdir); $i++) {
            $doc = file("../help/$user_language/$helpdir[$i]");
            $help_info = get_info($doc, 0);
            echo "<li><a href=\"../src/help.php?chapter=". ($i+1) 
."\">$help_info[0]</a>\n";
            echo "<ul>$help_info[2]</ul>";
         }
         echo "</ol>\n";
         echo "</td></tr></table>\n";
      } else {
         $doc = file("../help/$user_language/".$helpdir[$chapter-1]);
         $help_info = get_info($doc, 0);

         echo "<small><center>";

         if ($chapter <= 1) echo "<font 
color=\"$color[9]\">".lang("Previous")."</font> | ";
         else echo "<a 
href=\"../src/help.php?chapter=".($chapter-1)."\">".lang("Previous")."</a> | ";
         echo "<a href=\"../src/help.php\">".lang("Table of Contents")."</a>";
         if ($chapter >= count($helpdir)) echo " | <font 
color=\"$color[9]\">".lang("Next")."</font>";
         else echo " | <a 
href=\"../src/help.php?chapter=".($chapter+1)."\">".lang("Next")."</a>\n";
         echo "</center></small><br>\n";

         echo "<font size=5><b>$chapter - $help_info[0]</b></font><br><br>\n";
         if (isset($help_info[1]))
            echo "$help_info[1]\n";
         else
            echo "<p>$help_info[2]</p>\n";

         $section = 0;
         for ($n = $help_info[3]; $n < count($doc); $n++) {
            $section++;
            $help_info = get_info($doc, $n);
            echo "<b>$chapter.$section - $help_info[0]</b>";
            echo "<ul>";
            echo "$help_info[1]";
            echo "</ul>";
            $n = $help_info[3];
         }

         echo "<br><center><a href=\"#pagetop\">" . lang("Top") . 
"</a></center>\n";
      }
   }
   do_hook("help_bottom");
?>
<tr><td bgcolor="<?php echo $color[0] ?>">&nbsp;</td></tr></table>
<td></tr></table>
</body></html>

====================================================
Index: gettolang.pl
#!/usr/bin/perl

        open(IN,$ARGV[0]);
        #open(IN,'squirrelmail.po');

        $i=0;
        while (<IN>)
        {
                chomp $_;
                if (/\Amsgid(.*)/)
                {
                        my $str = $1; $str =~ s/\"//g;
                        $str =~ s/%s/x/;
                        $msgid[$i] = $str;
                        #print "MSGID: $str\n";
                }
                elsif (/\Amsgstr(.*)/)
                {
                        my $str = $1; $str =~ s/\"//g;
                        $str =~ s/%s/%1/;
                        $mgsstr[$i] = $str;
                        $i++;
                        next;
                        #print "MSGSTR: $str\n";
                }
        }
        close IN;

        for ($i=0;$i<$#msgid;$i++)
        {
                print $msgid[$i]."\tsquirrelmail\t" . $ARGV[1] . 
"\t".$mgsstr[$i]."\n";
        }

====================================================
Index: addrbook_popup.php
<?php
   /**
    **  addrbook_popup.php
    **
    **  Copyright (c) 1999-2000 The SquirrelMail development team
    **  Licensed under the GNU GPL. For full terms see the file COPYING.
    **
    **  Frameset for the JavaScript version of the address book.
    **
    **  $Id: addrbook_popup.php,v 1.1 2005/05/05 00:56:41 skwashd Exp $
    **/

   session_start();

   if (!isset($i18n_php))
      include('../functions/i18n.php');
   if (!isset($config_php))
      include('../config/config.php');
   if (!isset($page_header_php))
      include('../functions/page_header.php');
   if (!isset($auth_php))
      include('../functions/auth.php');
   if (!isset($addressbook_php))
      include('../functions/addressbook.php');

   is_logged_in();

   include('../src/load_prefs.php');

   set_up_language(getPref($data_dir, $username, 'language'));

?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN">

<HTML>
<HEAD>
<TITLE><?php
   printf("%s: %s", $org_title, lang("Address Book"));
?></TITLE>
</HEAD>

<FRAMESET ROWS="60,*" BORDER=0>
 <FRAME NAME="abookmain" MARGINWIDTH=0 SCROLLING=NO
        SRC="addrbook_search.php?show=form" BORDER=0>
 <FRAME NAME="abookres" MARGINWIDTH=0 SRC="addrbook_search.php?show=blank"
        BORDER=0>
</FRAMESET>

</HTML>

====================================================
Index: addrbook_search.php
<?php
   /**
    **  addrbook_search.php
    **
    **  Copyright (c) 1999-2000 The SquirrelMail development team
    **  Licensed under the GNU GPL. For full terms see the file COPYING.
    **
    **  Handle addressbook searching in the popup window.
    **
    **  NOTE: A lot of this code is similar to the code in
    **        addrbook_search_html.html -- If you change one,
    **        change the other one too!
    **
    **  $Id: addrbook_search.php,v 1.1 2005/05/05 00:56:41 skwashd Exp $
    **/

   // Function to include JavaScript code
   function insert_javascript() {
?>
<SCRIPT LANGUAGE="Javascript"><!--

function to_and_close($addr) {
  to_address($addr);
  parent.close();
}

function to_address($addr) {
  var prefix    = "";
  var pwintype = typeof parent.opener.document.compose;

  $addr = $addr.replace(/ {1,35}$/, "");

  if(pwintype != "undefined" ) {
    if ( parent.opener.document.compose.send_to.value ) {
      prefix = ", ";
      parent.opener.document.compose.send_to.value =
        parent.opener.document.compose.send_to.value + ", " + $addr;

    } else {
      parent.opener.document.compose.send_to.value = $addr;
    }
  }
}

function cc_address($addr) {
  var prefix    = "";
  var pwintype = typeof parent.opener.document.compose;

  $addr = $addr.replace(/ {1,35}$/, "");

  if(pwintype != "undefined" ) {
    if ( parent.opener.document.compose.send_to_cc.value ) {
      prefix = ", ";
      parent.opener.document.compose.send_to_cc.value =
        parent.opener.document.compose.send_to_cc.value + ", " + $addr;
    } else {
      parent.opener.document.compose.send_to_cc.value = $addr;
    }
  }
}

function bcc_address($addr) {
  var prefix    = "";
  var pwintype = typeof parent.opener.document.compose;

  $addr = $addr.replace(/ {1,35}$/, "");

  if(pwintype != "undefined" ) {
    if ( parent.opener.document.compose.send_to_bcc.value ) {
      prefix = ", ";
      parent.opener.document.compose.send_to_bcc.value =
        parent.opener.document.compose.send_to_bcc.value + ", " + $addr;
    } else {
      parent.opener.document.compose.send_to_bcc.value = $addr;
    }
  }
}

// --></SCRIPT>

<?php
   } // End of included JavaScript


   // List search results
   function display_result($res, $includesource = true) {
      global $color;

      if(sizeof($res) <= 0) return;

      insert_javascript();

      $line = 0;
      print '<TABLE BORDER="0" WIDTH="98%" ALIGN=center>';
      printf("<TR BGCOLOR=\"$color[9]\"><TH ALIGN=left>&nbsp;".
             "<TH ALIGN=left>&nbsp;%s<TH ALIGN=left>&nbsp;%s".
             "<TH ALIGN=left>&nbsp;%s",
             lang("Name"), lang("E-mail"), lang("Info"));

      if($includesource)
         printf("<TH ALIGN=left WIDTH=\"10%%\">&nbsp;%s", lang("Source"));

      print "</TR>\n";

      while(list($undef, $row) = each($res)) {
         printf("<tr%s nowrap><td valign=top nowrap align=center 
width=\"5%%\">".
                "<small><a href=\"javascript:to_address('%s');\">To</A> | ".
                "<a href=\"javascript:cc_address('%s');\">Cc</A> | ".
                "<a href=\"javascript:bcc_address('%s');\">Bcc</A></small>".
                "<td nowrap valign=top>&nbsp;%s&nbsp;<td nowrap valign=top>".
                "&nbsp;<a href=\"javascript:to_and_close('%s');\">%s</A>&nbsp;".
                "<td valign=top>&nbsp;%s&nbsp;",
                ($line % 2) ? " bgcolor=\"$color[0]\"" : "",
                $row["email"], $row["email"], $row["email"],
                $row["name"],  $row["email"], $row["email"],
                $row["label"]);

         if($includesource)
            printf("<td nowrap valign=top>&nbsp;%s", $row["source"]);

         print "</TR>\n";
         $line++;
      }
      print '</TABLE>';
   }

   /* ================= End of functions ================= */

   session_start();

   if (!isset($i18n_php))
      include('../functions/i18n.php');

   if(!isset($logged_in) || !isset($username) || !isset($key)) {
      include ('../themes/default_theme.php');
      include ('../functions/display_messages.php');
      printf('<html><BODY TEXT="%s" BGCOLOR="%s" LINK="%s" VLINK="%s" 
ALINK="%s">',
              $color[8], $color[4], $color[7], $color[7], $color[7]);
      plain_error_message(lang("You need a valid user and password to access 
this page!")
                          . '<br><a href="../src/login.php">'
                          . lang("Click here to log back in.") . "</a>.", 
$color);
      echo '</body></html>';
      exit;
   }
   if (!isset($config_php))
      include('../config/config.php');
   if (!isset($array_php))
      include('../functions/array.php');
   if (!isset($auth_php))
      include('../functions/auth.php');
   if (!isset($strings_php))
      include('../functions/strings.php');
   if (!isset($page_header_php))
      include('../functions/page_header.php');
   if (!isset($addressbook_php))
      include('../functions/addressbook.php');

   is_logged_in();
   include('../src/load_prefs.php');

   displayHtmlHeader();

   // Choose correct colors for top and bottom frame
   if($show == 'form') {
      echo "<BODY BGCOLOR=\"$color[3]\" TEXT=\"$color[6]\" ";
      echo "LINK=\"$color[6]\" VLINK=\"$color[6]\" ALINK=\"$color[6]\" ";
      echo 'OnLoad="document.sform.query.focus();">';
   } else {
      echo "<BODY TEXT=\"$color[8]\" BGCOLOR=\"$color[4]\" ";
      echo "LINK=\"$color[7]\" VLINK=\"$color[7]\" ALINK=\"$color[7]\">\n";
   }

   // Empty search
   if(empty($query) && empty($show) && empty($listall))  {
      printf("<P ALIGN=center><BR>%s</P>\n</BODY></HTML>\n",
             lang("No persons matching your search was found"));
      exit;
   }

   // Initialize addressbook
   $abook = addressbook_init();

   // Create search form
   if($show == 'form') {
      printf("<FORM NAME=sform TARGET=abookres ACTION=\"%s\" 
METHOD=\"POST\">\n",
             $PHP_SELF);
      print('<TABLE BORDER="0" WIDTH="100%" HEIGHT="100%">');
      print("<TR><TD NOWRAP VALIGN=middle>\n");
      printf("  <STRONG>%s</STRONG>\n", lang("Search for"));
      printf("  <INPUT TYPE=text NAME=query VALUE=\"%s\" SIZE=26>\n",
             htmlspecialchars($query));

      // List all backends to allow the user to choose where to search
      if($abook->numbackends > 1) {
         printf("<STRONG>%s</STRONG>&nbsp;<SELECT NAME=backend>\n",
                lang("in"));
         printf("<OPTION VALUE=-1 SELECTED>%s\n",
                lang("All address books"));
         $ret = $abook->get_backend_list();
         while(list($undef,$v) = each($ret))
            printf("<OPTION VALUE=%d>%s\n", $v->bnum, $v->sname);
         print "</SELECT>\n";
      } else {
         print "<INPUT TYPE=hidden NAME=backend VALUE=-1>\n";
      }

      printf("<INPUT TYPE=submit VALUE=\"%s\">",
             lang("Search"));
      printf("&nbsp;|&nbsp;<INPUT TYPE=submit VALUE=\"%s\" NAME=listall>\n",
             lang("List all"));
      print "</TD><TD ALIGN=right>\n";
      printf("<INPUT TYPE=button VALUE=\"%s\" onclick=\"parent.close();\">\n",
             lang("Close window"));
      print "</TD></TR></TABLE></FORM>\n";
   } else

   // Show personal addressbook
   if($show == 'blank' || !empty($listall)) {

      if($backend != -1 || $show == 'blank') {
         if($show == 'blank')
            $backend = $abook->localbackend;

         //printf("<H3 ALIGN=center>%s</H3>\n", 
$abook->backends[$backend]->sname);

         $res = $abook->list_addr($backend);

         if(is_array($res)) {
            display_result($res, false);
         } else {
            printf("<P ALIGN=center><STRONG>".lang("Unable to list addresses 
from %1").
                   "</STRONG></P>\n", $abook->backends[$backend]->sname);
         }

      } else {
         $res = $abook->list_addr();
         display_result($res, true);
      }

   } else

   // Do the search
   if(!empty($query) && empty($listall)) {

      if($backend == -1) {
         $res = $abook->s_search($query);
      } else {
         $res = $abook->s_search($query, $backend);
      }

      if(!is_array($res)) {
         printf("<P ALIGN=center><B><BR>%s:<br>%s</B></P>\n</BODY></HTML>\n",
                lang("Your search failed with the following error(s)"),
                $abook->error);
         exit;
      }

      if(sizeof($res) == 0) {
         printf("<P ALIGN=center><BR><B>%s.</B></P>\n</BODY></HTML>\n",
                lang("No persons matching your search was found"));
         exit;
      }

      display_result($res);
   }
?>

</BODY></HTML>

====================================================
Index: addrbook_search_html.php
<?php
   /**
    **  addrbook_search.php
    **
    **  Copyright (c) 1999-2000 The SquirrelMail development team
    **  Licensed under the GNU GPL. For full terms see the file COPYING.
    **
    **  Handle addressbook searching with pure html.
    **
    **  This file is included from compose.php
    **
    **  NOTE: A lot of this code is similar to the code in
    **        addrbook_search.html -- If you change one, change
    **        the other one too!
    **
    **  $Id: addrbook_search_html.php,v 1.1 2005/05/05 00:56:41 skwashd Exp $
    **/

   if (!$enablePHPGW)
   {
        session_start();
   }

   if (!isset($config_php))
      include('../config/config.php');
   if (!isset($strings_php))
      include('../functions/strings.php');
   if (!isset($auth_php))
      include('../functions/auth.php');
   if (!isset($page_header_php))
      include('../functions/page_header.php');
   if (!isset($date_php))
      include('../functions/date.php');
   if (!isset($smtp_php))
      include('../functions/smtp.php');
   if (!isset($display_messages_php))
      include('../functions/display_messages.php');
   if (!isset($addressbook_php))
      include('../functions/addressbook.php');
   if (!isset($plugin_php))
      include('../functions/plugin.php');

   include('../src/load_prefs.php');

   // Insert hidden data
   function addr_insert_hidden() {
      global $body, $subject, $send_to, $send_to_cc, $send_to_bcc;

      echo '<input type=hidden value="';
      if (substr($body, 0, 1) == "\r")
          echo "\n";
      echo htmlspecialchars($body) . '" name=body>' . "\n";
      echo '<input type=hidden value="' . htmlspecialchars($subject)
          . '" name=subject>' . "\n";
      echo '<input type=hidden value="' . htmlspecialchars($send_to)
          . '" name=send_to>' . "\n";
      echo "<input type=hidden value=\"" . htmlspecialchars($send_to_cc)
          . '" name=send_to_cc>' . "\n";
      echo "<input type=hidden value=\"" . htmlspecialchars($send_to_bcc)
          . '" name=send_to_bcc>' . "\n";
      echo "<input type=hidden value=\"true\" name=from_htmladdr_search>\n";
   }


   // List search results
   function addr_display_result($res, $includesource = true) {
      global $color, $PHP_SELF;

      if(sizeof($res) <= 0) return;

      printf('<FORM METHOD=post ACTION="%s?html_addr_search_done=true">'."\n",
             $PHP_SELF);
      addr_insert_hidden();
      $line = 0;

      print "<TABLE BORDER=0 WIDTH=\"98%\" ALIGN=center>";
      printf("<TR BGCOLOR=\"$color[9]\"><TH ALIGN=left>&nbsp;".
             "<TH ALIGN=left>&nbsp;%s<TH ALIGN=left>&nbsp;%s".
             "<TH ALIGN=left>&nbsp;%s",
             lang("Name"), lang("E-mail"), lang("Info"));

      if($includesource)
         printf("<TH ALIGN=left WIDTH=\"10%%\">&nbsp;%s", lang("Source"));

      print "</TR>\n";

      while(list($undef, $row) = each($res)) {
         printf("<tr%s nowrap><td nowrap align=center width=\"5%%\">".
                "<input type=checkbox name=\"send_to_search[]\" 
value=\"%s\">&nbsp;To".
                "<input type=checkbox name=\"send_to_cc_search[]\" 
value=\"%s\">&nbsp;Cc&nbsp;".
                "<td nowrap>&nbsp;%s&nbsp;<td nowrap>&nbsp;".
                "%s".
                "<td nowrap>&nbsp;%s&nbsp;",
                ($line % 2) ? " bgcolor=\"$color[0]\"" : "",
                htmlspecialchars($row["email"]), 
htmlspecialchars($row["email"]),
                $row["name"], $row["email"], $row["label"]);
         if($includesource)
            printf("<td nowrap>&nbsp;%s", $row["source"]);

         print "</TR>\n";
         $line++;
      }
      printf('<TR><TD ALIGN=center COLSPAN=%d><INPUT TYPE=submit '.
             'NAME="addr_search_done" VALUE="%s"></TD></TR>',
             4 + ($includesource ? 1 : 0),
             lang("Use Addresses"));
      print '</TABLE>';
      print '<INPUT TYPE=hidden VALUE=1 NAME="html_addr_search_done">';
      print '</FORM>';
   }

   // --- End functions ---

   displayPageHeader($color, 'None');

   // Initialize addressbook
   $abook = addressbook_init();

   $body = sqStripSlashes($body);
   $send_to = sqStripSlashes($send_to);
   $send_to_cc = sqStripSlashes($send_to_cc);
   $send_to_bcc = sqStripSlashes($send_to_bcc);
   $subject = sqStripSlashes($subject);

?>

<br>
<table width=95% align=center cellpadding=2 cellspacing=2 border=0>
<tr><td bgcolor="<?php echo $color[0] ?>">
   <center><b><?php echo lang("Address Book Search") ?></b></center>
</td></tr></table>

<?php
   // Search form
   print "<CENTER>\n";
   print "<TABLE BORDER=0>\n";
   print "<TR><TD NOWRAP VALIGN=middle>\n";
   printf('<FORM METHOD=post NAME=f ACTION="%s?html_addr_search=true">'."\n", 
$PHP_SELF);
   print "<CENTER>\n";
   printf("  <nobr><STRONG>%s</STRONG>\n", lang("Search for"));
   addr_insert_hidden();
   if (! isset($addrquery))
       $addrquery = "";
   printf("  <INPUT TYPE=text NAME=addrquery VALUE=\"%s\" SIZE=26>\n",
          htmlspecialchars($addrquery));

   // List all backends to allow the user to choose where to search
   if($abook->numbackends > 1) {
      printf("<STRONG>%s</STRONG>&nbsp;<SELECT NAME=backend>\n",
             lang("in"));
      printf("<OPTION VALUE=-1 %s>%s\n",
             ($backend == -1) ? "SELECTED" : "",
             lang("All address books"));
      $ret = $abook->get_backend_list();
      while(list($undef,$v) = each($ret))
         printf("<OPTION VALUE=%d %s>%s\n",
                $v->bnum,
                ($backend == $v->bnum) ? "SELECTED" : "",
                $v->sname);
      print "</SELECT>\n";
   } else {
      print "<INPUT TYPE=hidden NAME=backend VALUE=-1>\n";
   }
   printf("<INPUT TYPE=submit VALUE=\"%s\">",
          lang("Search"));
   printf("&nbsp;|&nbsp;<INPUT TYPE=submit VALUE=\"%s\" NAME=listall>\n",
          lang("List all"));
   print '</FORM></center>';

   print "</TD></TR></TABLE>\n";
   addr_insert_hidden();
   print "</CENTER>";
   do_hook('addrbook_html_search_below');
   // End search form

   // Show personal addressbook
   if(!isset($addrquery) || !empty($listall)) {

      if(! isset($backend) || $backend != -1 || !isset($addrquery)) {
         if(!isset($addrquery))
            $backend = $abook->localbackend;

         //printf("<H3 ALIGN=center>%s</H3>\n", 
$abook->backends[$backend]->sname);

         $res = $abook->list_addr($backend);

         if(is_array($res)) {
            addr_display_result($res, false);
         } else {
            printf("<P ALIGN=center><STRONG>".lang("Unable to list addresses 
from %1").
                   "</STRONG></P>\n", $abook->backends[$backend]->sname);
         }

      } else {
         $res = $abook->list_addr();
         addr_display_result($res, true);
      }
      exit;

   } else

   // Do the search
   if(!empty($addrquery) && empty($listall)) {

      if($backend == -1) {
         $res = $abook->s_search($addrquery);
      } else {
         $res = $abook->s_search($addrquery, $backend);
      }

      if(!is_array($res)) {
         printf("<P ALIGN=center><B><BR>%s:<br>%s</B></P>\n</BODY></HTML>\n",
                lang("Your search failed with the following error(s)"),
                $abook->error);
      } else if(sizeof($res) == 0) {
         printf("<P ALIGN=center><BR><B>%s.</B></P>\n</BODY></HTML>\n",
                lang("No persons matching your search was found"));
      } else {
         addr_display_result($res);
      }
   }

   if (!$addrquery || sizeof($res) == 0) {
      printf('<center><FORM METHOD=post NAME=k ACTION="compose.php">'."\n", 
$PHP_SELF);
      addr_insert_hidden();
      printf("<INPUT TYPE=submit VALUE=\"%s\" NAME=return>\n", lang("Return"));
      print '</form>';
      print '</center></nobr>';
   }

   if (!$enablePHPGW)
   {
        print "<body></html>";
   }
   else
   {
#       $phpgw->common->phpgw_footer();
   }
?>


====================================================
Index: empty_trash.php
<?php
   /**
    **  empty_trash.php
    **
    **  Copyright (c) 1999-2000 The SquirrelMail development team
    **  Licensed under the GNU GPL. For full terms see the file COPYING.
    **
    **  Handles deleting messages from the trash folder without
    **  deleting subfolders.
    **
    **  $Id: empty_trash.php,v 1.1 2005/05/05 00:56:41 skwashd Exp $
    **/

   session_start();

   include("../functions/strings.php");
   include("../config/config.php");
   include("../functions/page_header.php");
   include("../functions/display_messages.php");
   include("../functions/imap.php");
   if (!function_exists("ary_sort"))
      include("../functions/array.php");

   if (!isset($tree_php))
      include("../functions/tree.php");

   include("../src/load_prefs.php");

   $imap_stream = sqimap_login($username, $key, $imapServerAddress, $imapPort, 
0);

   sqimap_mailbox_list($imap_stream);

   $mailbox = $trash_folder;
   $boxes = sqimap_mailbox_list($imap_stream);
   $dm = sqimap_get_delimiter($imap_stream);

   // According to RFC2060, a DELETE command should NOT remove inferiors (sub 
folders)
   //    so lets go through the list of subfolders and remove them before 
removing the
   //    parent.

   /** First create the top node in the tree **/
   for ($i = 0;$i < count($boxes);$i++) {
      if (($boxes[$i]["unformatted"] == $mailbox) && 
(strlen($boxes[$i]["unformatted"]) == strlen($mailbox))) {
         $foldersTree[0]["value"] = $mailbox;
         $foldersTree[0]["doIHaveChildren"] = false;
         continue;
      }
   }
   // Now create the nodes for subfolders of the parent folder
   // You can tell that it is a subfolder by tacking the mailbox delimiter
   //    on the end of the $mailbox string, and compare to that.
   $j = 0;
   for ($i = 0;$i < count($boxes);$i++) {
      if (substr($boxes[$i]["unformatted"], 0, strlen($mailbox . $dm)) == 
($mailbox . $dm)) {
         addChildNodeToTree($boxes[$i]["unformatted"], 
$boxes[$i]["unformatted-dm"], $foldersTree);
      }
   }

   // now lets go through the tree and delete the folders
   walkTreeInPreOrderEmptyTrash(0, $imap_stream, $foldersTree);

   $location = get_location();
   header ("Location: $location/left_main.php");

   sqimap_logout($imap_stream);
?>

====================================================
Index: delete_message.php
<?php
   /**
    **  delete_message.php
    **
    **  Copyright (c) 1999-2000 The SquirrelMail development team
    **  Licensed under the GNU GPL. For full terms see the file COPYING.
    **
    **  Deletes a meesage from the IMAP server
    **
    **  $Id: delete_message.php,v 1.1 2005/05/05 00:56:41 skwashd Exp $
    **/

   $enablePHPGW = 1;

        // store the value of $mailbox, because it will overwriten
        $MAILBOX = $mailbox;
        $phpgw_info["flags"] = array("currentapp" => "squirrelmail","noheader" 
=> True, "nonavbar" => True);
        include("../../header.inc.php");
        $mailbox = $MAILBOX;


   if (!isset($strings_php))
      include(PHPGW_APP_ROOT . "/inc/strings.php");
   if (!isset($config_php))
      include(PHPGW_APP_ROOT . "/config/config.php");

        $key      = $phpgw_info['user']['preferences']['email']['passwd'];
        $username = $phpgw_info['user']['preferences']['email']['userid'];

   if (!isset($page_header_php))
      include(PHPGW_APP_ROOT . "/inc/page_header.php");
   if (!isset($display_message_php))
      include(PHPGW_APP_ROOT . "/inc/display_messages.php");
   if (!isset($imap_php))
      include(PHPGW_APP_ROOT . "/inc/imap.php");

   include(PHPGW_APP_ROOT . "/src/load_prefs.php");

   $imapConnection = sqimap_login($username, $key, $imapServerAddress, 
$imapPort, 0);
   sqimap_mailbox_select($imapConnection, $mailbox);

   sqimap_messages_delete($imapConnection, $message, $message, $mailbox);
   if ($auto_expunge)
      sqimap_mailbox_expunge($imapConnection, $mailbox, true);

        $location = $phpgw_info["server"]["webserver_url"] . 
"/squirrelmail/src";
        if ($where && $what)
        {
                header ("Location: " . $phpgw->link($location . "/search.php",
                        
"where=".urlencode($where)."&what=".urlencode($what)."&mailbox=".urlencode($mailbox)));
        }
        else
        {
                header ("Location: " . $phpgw->link("/squirrelmail/index.php",
                        
"sort=$sort&startMessage=$startMessage&mailbox=".urlencode($mailbox)));
        }

   sqimap_logout($imapConnection);
   if ($enablePHPGW)
   {
        $sessionData->save();
        $phpgw->common->phpgw_footer();
   }
?>

====================================================
Index: addressbook.php
<?php
   /**
    **  addressbook.php
    **
    **  Copyright (c) 1999-2000 The SquirrelMail development team
    **  Licensed under the GNU GPL. For full terms see the file COPYING.
    **
    **  Manage personal address book.
    **
    **  $Id: addressbook.php,v 1.1 2005/05/05 00:56:41 skwashd Exp $
    **/

   $enablePHPGW = 1;

   if ($enablePHPGW)
   {
        // store the value of $mailbox, because it will overwriten
        $MAILBOX = $mailbox;
        $phpgw_info["flags"] = array("currentapp" => "squirrelmail", 
"enable_network_class" => True,
                        "enable_nextmatchs_class" => True);
        include("../../header.inc.php");
        $mailbox = $MAILBOX;

        $key      = 
$phpgw->common->decrypt($phpgw_info['user']['preferences']['email']['passwd']);
        $username = $phpgw_info['user']['preferences']['email']['userid'];

        $phpgw->session->restore();
   }
   else
   {
        session_start();
   }

   if (!isset($strings_php))
      include('../inc/strings.php');
   if (!isset($config_php))
      include('../config/config.php');
   if (!isset($array_php))
      include('../inc/array.php');
   if (!isset($auth_php))
      include('../inc/auth.php');
   if (!isset($page_header_php))
      include('../inc/page_header.php');
   if (!isset($display_messages_php))
      include('../inc/display_messages.php');
   if (!isset($addressbook_php))
      include('../functions/addressbook.php');

   if (!$enablePHPGW)
   {
        is_logged_in();
   }

   // Sort array by the key "name"
   function alistcmp($a,$b) {
      if($a['backend'] > $b['backend'])
         return 1;
      else if($a['backend'] < $b['backend'])
         return -1;

      return (strtolower($a['name']) > strtolower($b['name'])) ? 1 : -1;
   }

   // Output form to add and modify address data
   function address_form($name, $submittext, $values = array()) {
      global $color;
      print "<TABLE BORDER=0 CELLPADDING=1 COLS=2 WIDTH=\"90%\" 
ALIGN=center>\n";
      printf("<TR><TD WIDTH=50 BGCOLOR=\"$color[4]\" ALIGN=RIGHT>%s:</TD>",
             lang("Nickname"));
      printf("<TD BGCOLOR=\"%s\" ALIGN=left>".
             "<INPUT NAME=\"%s[nickname]\" SIZE=15 VALUE=\"%s\">".
             "&nbsp;<SMALL>%s</SMALL></TD></TR>\n",
             $color[4], $name,
             (isset($values['nickname']))?
                 htmlspecialchars($values['nickname']):"",
             lang("Must be unique"));
      printf("<TR><TD WIDTH=50 BGCOLOR=\"$color[4]\" ALIGN=RIGHT>%s:</TD>",
             lang("E-mail address"));
      printf("<TD BGCOLOR=\"%s\" ALIGN=left>".
             "<INPUT NAME=\"%s[email]\" SIZE=45 VALUE=\"%s\"></TD></TR>\n",
             $color[4], $name,
             (isset($values["email"]))?
                 htmlspecialchars($values["email"]):"");
      printf("<TR><TD WIDTH=50 BGCOLOR=\"$color[4]\" ALIGN=RIGHT>%s:</TD>",
             lang("First name"));
      printf("<TD BGCOLOR=\"%s\" ALIGN=left>".
             "<INPUT NAME=\"%s[firstname]\" SIZE=45 VALUE=\"%s\"></TD></TR>\n",
             $color[4], $name,
             (isset($values["firstname"]))?
                 htmlspecialchars($values["firstname"]):"");
      printf("<TR><TD WIDTH=50 BGCOLOR=\"$color[4]\" ALIGN=RIGHT>%s:</TD>",
             lang("Last name"));
      printf("<TD BGCOLOR=\"%s\" ALIGN=left>".
             "<INPUT NAME=\"%s[lastname]\" SIZE=45 VALUE=\"%s\"></TD></TR>\n",
             $color[4], $name,
             (isset($values["lastname"]))?
                 htmlspecialchars($values["lastname"]):"");
      printf("<TR><TD WIDTH=50 BGCOLOR=\"$color[4]\" ALIGN=RIGHT>%s:</TD>",
             lang("Additional info"));
      printf("<TD BGCOLOR=\"%s\" ALIGN=left>".
             "<INPUT NAME=\"%s[label]\" SIZE=45 VALUE=\"%s\"></TD></TR>\n",
             $color[4], $name,
             (isset($values["label"]))?
                 htmlspecialchars($values["label"]):"");

      printf("<TR><TD COLSPAN=2 BGCOLOR=\"%s\" ALIGN=center>\n".
             "<INPUT TYPE=submit NAME=\"%s[SUBMIT]\" VALUE=\"%s\"></TD></TR>\n",
             $color[4], $name, $submittext);

      print "</TABLE>\n";
   }


   include('../src/load_prefs.php');

   // Open addressbook, with error messages on but without LDAP (the
   // second "true"). Don't need LDAP here anyway
   $abook = addressbook_init(true, true);
   if($abook->localbackend == 0) {
      plain_error_message(lang("No personal address book is defined. Contact 
administrator."), $color);
      exit();
   }

   displayPageHeader($color, 'None');


   $defdata   = array();
   $formerror = '';
   $abortform = false;
   $showaddrlist = true;
   $defselected  = array();


   // Handle user's actions
   if($REQUEST_METHOD == 'POST') {

      // ***********************************************
      // Add new address
      // ***********************************************
      if(!empty($addaddr['nickname'])) {

         $r = $abook->add($addaddr, $abook->localbackend);

         // Handle error messages
         if(!$r) {
            // Remove backend name from error string
            $errstr = $abook->error;
            $errstr = ereg_replace('^\[.*\] *', '', $errstr);

            $formerror = $errstr;
            $showaddrlist = false;
            $defdata = $addaddr;
         }

      }


      // ***********************************************
      // Delete address(es)
      // ***********************************************
      else if((!empty($deladdr)) &&
         sizeof($sel) > 0) {
         $orig_sel = $sel;
         sort($sel);

         // The selected addresses are identidied by "backend:nickname".
         // Sort the list and process one backend at the time
         $prevback  = -1;
         $subsel    = array();
         $delfailed = false;

         for($i = 0 ; (($i < sizeof($sel)) && !$delfailed) ; $i++) {
            list($sbackend, $snick) = split(':', $sel[$i]);

            // When we get to a new backend, process addresses in
            // previous one.
            if($prevback != $sbackend && $prevback != -1) {

               $r = $abook->remove($subsel, $prevback);
               if(!$r) {
                  $formerror = $abook->error;
                  $i = sizeof($sel);
                  $delfailed = true;
                  break;
               }
               $subsel   = array();
            }

            // Queue for processing
            array_push($subsel, $snick);
            $prevback = $sbackend;
         }

         if(!$delfailed) {
            $r = $abook->remove($subsel, $prevback);
            if(!$r) { // Handle errors
               $formerror = $abook->error;
               $delfailed = true;
            }
         }

         if($delfailed) {
            $showaddrlist = true;
            $defselected  = $orig_sel;
         }
      }


      // ***********************************************
      // Update/modify address
      // ***********************************************
      else if(!empty($editaddr)) {

         // Stage one: Copy data into form
         if(sizeof($sel) > 0) {
            if(sizeof($sel) > 1) {
               $formerror = lang("You can only edit one address at the time");
               $showaddrlist = true;
               $defselected = $sel;
            } else {
               $abortform = true;
               list($ebackend, $enick) = split(":", $sel[0]);
               $olddata = $abook->lookup($enick, $ebackend);

               // Display the "new address" form
               print "<FORM ACTION=\"$PHP_SELF\" METHOD=\"POST\">\n";
               print "<TABLE WIDTH=100% COLS=1 ALIGN=CENTER>\n";
               print "<TR><TD BGCOLOR=\"$color[0]\" ALIGN=CENTER>\n<STRONG>";
               print lang("Update address");
               print "<STRONG>\n</TD></TR>\n";
               print "</TABLE>\n";
               address_form("editaddr", lang("Update address"), $olddata);
               printf("<INPUT TYPE=hidden NAME=oldnick VALUE=\"%s\">\n",
                      htmlspecialchars($olddata["nickname"]));
               printf("<INPUT TYPE=hidden NAME=backend VALUE=\"%s\">\n",
                      htmlspecialchars($olddata["backend"]));
               print "<INPUT TYPE=hidden NAME=doedit VALUE=1>\n";
               print '</FORM>';
            }
         }

         // Stage two: Write new data
         else if($doedit = 1) {
            $newdata = $editaddr;
            $r = $abook->modify($oldnick, $newdata, $backend);

            // Handle error messages
            if(!$r) {
               // Display error
               print "<TABLE WIDTH=100% COLS=1 ALIGN=CENTER>\n";
               print "<TR><TD ALIGN=CENTER>\n<br><STRONG>";
               print "<FONT COLOR=\"$color[2]\">".lang("ERROR").": ".
                      $abook->error."</FONT>";
               print "<STRONG>\n</TD></TR>\n";
               print "</TABLE>\n";

               // Display the "new address" form again
               printf("<FORM ACTION=\"%s\" METHOD=\"POST\">\n", $PHP_SELF);
               print "<TABLE WIDTH=100% COLS=1 ALIGN=CENTER>\n";
               print "<TR><TD BGCOLOR=\"$color[0]\" ALIGN=CENTER>\n<STRONG>";
               print lang("Update address");
               print "<STRONG>\n</TD></TR>\n";
               print "</TABLE>\n";
               address_form("editaddr", lang("Update address"), $newdata);
               printf("<INPUT TYPE=hidden NAME=oldnick VALUE=\"%s\">\n",
                      htmlspecialchars($oldnick));
               printf("<INPUT TYPE=hidden NAME=backend VALUE=\"%s\">\n",
                      htmlspecialchars($backend));
               print "<INPUT TYPE=hidden NAME=doedit VALUE=1>\n";
               print '</FORM>';

               $abortform = true;
            }
         }

         // Should not get here...
         else {
            plain_error_message(lang("Unknown error"), $color);
            $abortform = true;
         }
      } // End of edit address



      // Some times we end output before forms are printed
      if($abortform) {
         print "</BODY></HTML>\n";
         exit();
      }
   }


   // ===================================================================
   // The following is only executed on a GET request, or on a POST when
   // a user is added, or when "delete" or "modify" was successful.
   // ===================================================================

   // Display error messages
   if(!empty($formerror)) {
      print "<TABLE WIDTH=100% COLS=1 ALIGN=CENTER>\n";
      print "<TR><TD ALIGN=CENTER>\n<br><STRONG>";
      print "<FONT COLOR=\"$color[2]\">".lang("ERROR").": $formerror</FONT>";
      print "<STRONG>\n</TD></TR>\n";
      print "</TABLE>\n";
   }


   // Display the address management part
   if($showaddrlist) {
      // Get and sort address list
      $alist = $abook->list_addr();
      if(!is_array($alist)) {
        plain_error_message($abook->error, $color);
        exit;
      }

      usort($alist,'alistcmp');
      $prevbackend = -1;
      $headerprinted = false;

      // List addresses
      printf("<FORM ACTION=\"%s\" METHOD=\"POST\">\n", $PHP_SELF);
      while(list($undef,$row) = each($alist)) {

         // New table header for each backend
         if($prevbackend != $row["backend"]) {
            if($prevbackend >= 0) {
               print '<TR><TD COLSPAN="5" ALIGN=center>';
               print "&nbsp;<BR></TD></TR></TABLE>\n";
            }

            print "<TABLE WIDTH=\"95%\" COLS=1 ALIGN=CENTER>\n";
            print "<TR><TD BGCOLOR=\"$color[0]\" ALIGN=CENTER>\n<STRONG>";
            print $row["source"];
            print "<STRONG>\n</TD></TR>\n";
            print "</TABLE>\n";

            print '<TABLE COLS="5" BORDER="0" CELLPADDING="1" CELLSPACING="0" 
WIDTH="90%" ALIGN="center">';
            printf('<TR BGCOLOR="%s"><TH ALIGN=left WIDTH="%s">&nbsp;'.
                   '<TH ALIGN=left WIDTH="%s">%s<TH ALIGN=left WIDTH="%s">%s'.
                   '<TH ALIGN=left WIDTH="%s">%s<TH ALIGN=left WIDTH="%s">%s'.
                   "</TR>\n", $color[9], "1%",
                   "1%", lang("Nickname"),
                   "1%", lang("Name"),
                   "1%", lang("E-mail"),
                   "%",  lang("Info"));
            $line = 0;
            $headerprinted = true;
         } // End of header

         $prevbackend = $row['backend'];

         // Check if this user is selected
         if(in_array($row['backend'].':'.$row['nickname'], $defselected))
            $selected = 'CHECKED';
         else
            $selected = '';

         // Print one row
         printf("<TR%s>",
                (($line % 2) ? " bgcolor=\"$color[0]\"" : ""));
         print  '<TD VALIGN=top ALIGN=center WIDTH="1%"><SMALL>';
         printf('<INPUT TYPE=checkbox %s NAME="sel[]" 
VALUE="%s:%s"></SMALL></TD>',
                $selected, $row["backend"], $row["nickname"]);
         printf('<TD VALIGN=top NOWRAP WIDTH="%s">&nbsp;%s&nbsp;</TD>'.
                '<TD VALIGN=top NOWRAP WIDTH="%s">&nbsp;%s&nbsp;</TD>',
                "1%", $row["nickname"],
                "1%", $row["name"]);
         printf('<TD VALIGN=top NOWRAP WIDTH="%s">&nbsp;<A 
HREF="compose.php?send_to=%s">%s</A>&nbsp;</TD>'."\n",
                "1%", rawurlencode($row["email"]), $row["email"]);
         printf('<TD VALIGN=top WIDTH="%s">&nbsp;%s&nbsp;</TD>',
                "%", $row["label"]);
         print "</TR>\n";
         $line++;
      }

      // End of list. Close table.
      if($headerprinted) {
        print "<TR><TD COLSPAN=5 ALIGN=center>\n";
        printf("<INPUT TYPE=submit NAME=editaddr VALUE=\"%s\">\n",
               lang("Edit selected"));
        printf("<INPUT TYPE=submit NAME=deladdr VALUE=\"%s\">\n",
               lang("Delete selected"));
        print "</TR></TABLE></FORM>";
      }
   } // end of addresslist


   // Display the "new address" form
   printf("<FORM ACTION=\"%s\" NAME=f_add METHOD=\"POST\">\n", $PHP_SELF);
   print "<TABLE WIDTH=100% COLS=1 ALIGN=CENTER>\n";
   print "<TR><TD BGCOLOR=\"$color[0]\" ALIGN=CENTER>\n<STRONG>";
   printf(lang("Add to %1"), $abook->localbackendname);
   print "<STRONG>\n</TD></TR>\n";
   print "</TABLE>\n";
   address_form('addaddr', lang("Add address"), $defdata);
   print '</FORM>';

   // Add hook for anything that wants on the bottom
   do_hook("addressbook_bottom");
   if ($enablePHPGW)
   {
        $phpgw->session->save();
        $phpgw->common->phpgw_footer();
   }
   else
   {
        print "</BODY></HTML>";
   }

?>

====================================================
Index: options_personal.php
<?php
   /**
    **  options_personal.php
    **
    **  Copyright (c) 1999-2000 The SquirrelMail development team
    **  Licensed under the GNU GPL. For full terms see the file COPYING.
    **
    **  Displays all options relating to personal information
    **
    **  $Id: options_personal.php,v 1.1 2005/05/05 00:56:41 skwashd Exp $
    **/

        // store the value of $mailbox, because it will overwriten
        $MAILBOX = $mailbox;
        $phpgw_info["flags"] = array("currentapp" => "squirrelmail", 
"enable_network_class" => True, "enable_nextmatchs_class" => True);
        include("../../header.inc.php");
        $mailbox = $MAILBOX;

        $phpgw->session->restore();

   if (!isset($strings_php))
      include("../inc/strings.php");
   if (!isset($config_php))
      include("../config/config.php");

        $key      = $phpgw_info['user']['preferences']['email']['passwd'];
        $username = $phpgw_info['user']['preferences']['email']['userid'];

   if (!isset($page_header_php))
      include("../inc/page_header.php");
   if (!isset($display_messages_php))
      include("../inc/display_messages.php");
   if (!isset($imap_php))
      include("../inc/imap.php");
   if (!isset($array_php))
      include("../inc/array.php");
   if (!isset($i18n_php))
      include("../inc/i18n.php");
   if (!isset($plugin_php))
      include("../inc/plugin.php");

   include("../src/load_prefs.php");
   displayPageHeader($color, "None");

   $fullname = getPref($data_dir, $username, "full_name");
   $replyto = getPref($data_dir, $username, "reply_to");
   $email_address  = getPref($data_dir, $username, "email_address");

?>
   <br>
   <table width=95% align=center border=0 cellpadding=2 cellspacing=0><tr><td 
bgcolor="<?php echo $color[0] ?>">
      <center><b><?php echo lang("Options") . " - " . lang("Personal 
Information"); ?></b></center>
   </td></tr></table>

   <form name=f action="options.php" method=post>
      <table width=100% cellpadding=0 cellspacing=2 border=0>
         <tr>
            <td align=right nowrap><?php echo lang("Full Name"); ?>:
            </td><td>
               <input size=50 type=text value="<?php echo $fullname ?>" 
name=full_name>
            </td>
         </tr>
         <tr>
            <td align=right nowrap><?php echo lang("E-Mail Address"); ?>:
            </td><td>
               <input size=50 type=text value="<?php echo $email_address ?>" 
name=email_address>
            </td>
         </tr>
         <tr>
            <td align=right nowrap><?php echo lang("Reply To"); ?>:
            </td><td>
               <input size=50 type=text value="<?php echo $replyto ?>" 
name=reply_to>
            </td>
         </tr>
         <tr>
            <td align=right nowrap valign=top><br><?php echo lang("Signature"); 
?>:
            </td><td>
<?php
   if ($use_signature == true)
      echo "<input type=checkbox value=\"1\" name=usesignature 
checked>&nbsp;&nbsp;" . lang("Use a signature") . "?<BR>";
   else {
      echo "<input type=checkbox value=\"1\" name=usesignature>&nbsp;&nbsp;";
      echo lang("Use a signature?");
      echo "<BR>";
   }
   echo "\n<textarea name=signature_edit rows=5 
cols=50>$signature_abs</textarea><br>";
?>
            </td>
         </tr>
         <?php do_hook("options_personal_inside"); ?>
         <tr>
            <td>&nbsp;
            </td><td>
               <input type="submit" value="<?php echo lang("Submit"); ?>" 
name="submit_personal">
            </td>
         </tr>
      </table>
   </form>
   <?php do_hook("options_personal_bottom"); ?>
</body></html>






reply via email to

[Prev in Thread] Current Thread [Next in Thread]