Getting ready for 1.2.0 release.
[squirrelmail.git] / src / addrbook_search_html.php
index 9ee5a53f6695fb854b6fe2dbfcec3001798e25f9..5a5c74811ffa245d2202f399766e3abfbc003389 100644 (file)
@@ -1,34 +1,50 @@
 <?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$
-    **/
-
-   include('../src/validate.php');
-   include('../functions/page_header.php');
-   include('../functions/date.php');
-   include('../functions/smtp.php');
-   include('../functions/display_messages.php');
-   include('../functions/addressbook.php');
-   include('../functions/plugin.php');
-   include('../src/load_prefs.php');
+
+/**
+ * addrbook_search_html.php
+ *
+ * Copyright (c) 1999-2002 The SquirrelMail Project 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$
+ */
+
+/*****************************************************************/
+/*** THIS FILE NEEDS TO HAVE ITS FORMATTING FIXED!!!           ***/
+/*** PLEASE DO SO AND REMOVE THIS COMMENT SECTION.             ***/
+/***    + Base level indent should begin at left margin, as    ***/
+/***      the require_once below looks.                        ***/
+/***    + All identation should consist of four space blocks   ***/
+/***    + Tab characters are evil.                             ***/
+/***    + all comments should use "slash-star ... star-slash"  ***/
+/***      style -- no pound characters, no slash-slash style   ***/
+/***    + FLOW CONTROL STATEMENTS (if, while, etc) SHOULD      ***/
+/***      ALWAYS USE { AND } CHARACTERS!!!                     ***/
+/***    + Please use ' instead of ", when possible. Note "     ***/
+/***      should always be used in _( ) function calls.        ***/
+/*** Thank you for your help making the SM code more readable. ***/
+/*****************************************************************/
+
+require_once('../src/validate.php');
+require_once('../functions/date.php');
+require_once('../functions/smtp.php');
+require_once('../functions/display_messages.php');
+require_once('../functions/addressbook.php');
+require_once('../functions/plugin.php');
 
    // Insert hidden data
    function addr_insert_hidden() {
 
    // Insert hidden data
    function addr_insert_hidden() {
-      global $body, $subject, $send_to, $send_to_cc, $send_to_bcc, $mailbox;
-      
+      global $body, $subject, $send_to, $send_to_cc, $send_to_bcc, $mailbox,
+         $identity;
+
       echo '<input type=hidden value="';
       if (substr($body, 0, 1) == "\r")
           echo "\n";
       echo '<input type=hidden value="';
       if (substr($body, 0, 1) == "\r")
           echo "\n";
@@ -41,6 +57,8 @@
           . '" name=send_to_cc>' . "\n";
       echo "<input type=hidden value=\"" . htmlspecialchars($send_to_bcc)
           . '" name=send_to_bcc>' . "\n";
           . '" name=send_to_cc>' . "\n";
       echo "<input type=hidden value=\"" . htmlspecialchars($send_to_bcc)
           . '" name=send_to_bcc>' . "\n";
+      echo "<input type=hidden value=\"" . htmlspecialchars($identity)
+          . '" name=identity>' . "\n";
       echo "<input type=hidden name=mailbox value=\"" .
           htmlspecialchars($mailbox) . "\">\n";
       echo "<input type=hidden value=\"true\" name=from_htmladdr_search>\n";
       echo "<input type=hidden name=mailbox value=\"" .
           htmlspecialchars($mailbox) . "\">\n";
       echo "<input type=hidden value=\"true\" name=from_htmladdr_search>\n";
@@ -69,7 +87,7 @@
          printf("<TH ALIGN=left WIDTH=\"10%%\">&nbsp;%s", _("Source"));
 
       print "</TR>\n";
          printf("<TH ALIGN=left WIDTH=\"10%%\">&nbsp;%s", _("Source"));
 
       print "</TR>\n";
-      
+
       foreach ($res as $row) {
          echo '<tr';
         if ($line % 2) echo ' bgcolor="' . $color[0] . '"';
       foreach ($res as $row) {
          echo '<tr';
         if ($line % 2) echo ' bgcolor="' . $color[0] . '"';
       }
       printf('<TR><TD ALIGN=center COLSPAN=%d><INPUT TYPE=submit '.
              'NAME="addr_search_done" VALUE="%s"></TD></TR>',
       }
       printf('<TR><TD ALIGN=center COLSPAN=%d><INPUT TYPE=submit '.
              'NAME="addr_search_done" VALUE="%s"></TD></TR>',
-             4 + ($includesource ? 1 : 0), 
+             4 + ($includesource ? 1 : 0),
              _("Use Addresses"));
       print '</TABLE>';
       print '<INPUT TYPE=hidden VALUE=1 NAME="html_addr_search_done">';
              _("Use Addresses"));
       print '</TABLE>';
       print '<INPUT TYPE=hidden VALUE=1 NAME="html_addr_search_done">';
 
    global $mailbox;
    displayPageHeader($color, $mailbox);
 
    global $mailbox;
    displayPageHeader($color, $mailbox);
-   
+
    // Initialize addressbook
    $abook = addressbook_init();
 
    // Initialize addressbook
    $abook = addressbook_init();
 
    // List all backends to allow the user to choose where to search
    if(!isset($backend)) $backend = "";
    if($abook->numbackends > 1) {
    // List all backends to allow the user to choose where to search
    if(!isset($backend)) $backend = "";
    if($abook->numbackends > 1) {
-      printf("<STRONG>%s</STRONG>&nbsp;<SELECT NAME=backend>\n", 
+      printf("<STRONG>%s</STRONG>&nbsp;<SELECT NAME=backend>\n",
              _("in"));
              _("in"));
-      printf("<OPTION VALUE=-1 %s>%s\n", 
+      printf("<OPTION VALUE=-1 %s>%s\n",
              ($backend == -1) ? "SELECTED" : "",
              _("All address books"));
       $ret = $abook->get_backend_list();
              ($backend == -1) ? "SELECTED" : "",
              _("All address books"));
       $ret = $abook->get_backend_list();
-      while(list($undef,$v) = each($ret)) 
-         printf("<OPTION VALUE=%d %s>%s\n", 
-                $v->bnum, 
+      while(list($undef,$v) = each($ret))
+         printf("<OPTION VALUE=%d %s>%s\n",
+                $v->bnum,
                 ($backend == $v->bnum) ? "SELECTED" : "",
                 $v->sname);
       print "</SELECT>\n";
                 ($backend == $v->bnum) ? "SELECTED" : "",
                 $v->sname);
       print "</SELECT>\n";
       }
    }
 
       }
    }
 
-   if ($addrquery == '' || sizeof($res) == 0) {  
+   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", _("Return"));
       print '</form>';
       print '</center></nobr>';
       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", _("Return"));
       print '</form>';
       print '</center></nobr>';
-   }   
+   }
 
 ?>
 </body></html>
 
 ?>
 </body></html>