moved filter update on folder rename/delete to
[squirrelmail.git] / src / addrbook_search_html.php
index a1604e6de2da0a84338d10846d0b471601d7c65f..81cb0bc4ebf2c91ed53db422f61334ff5ca33802 100644 (file)
@@ -23,6 +23,7 @@ require_once('../functions/smtp.php');
 require_once('../functions/display_messages.php');
 require_once('../functions/addressbook.php');
 require_once('../functions/plugin.php');
+require_once('../functions/strings.php');
 
 /* Insert hidden data */
 function addr_insert_hidden() {
@@ -30,8 +31,9 @@ function addr_insert_hidden() {
            $identity;
 
    echo '<input type=hidden value="';
-   if (substr($body, 0, 1) == "\r")
+   if (substr($body, 0, 1) == "\r") {
        echo "\n";
+   }
    echo htmlspecialchars($body) . '" name=body>' . "\n" .
         '<input type=hidden value="' . htmlspecialchars($subject) .
         '" name=subject>' . "\n" .
@@ -77,11 +79,11 @@ function addr_display_result($res, $includesource = true) {
         if ($line % 2) { echo ' bgcolor="' . $color[0] . '"'; }
         echo ' nowrap><td nowrap align=center width="5%">' .
              '<input type=checkbox name="send_to_search[T' . $line . ']" value = "' .
-             htmlspecialchars($row['email']) . '">&nbsp;To&nbsp;' .
+             htmlspecialchars($row['email']) . '">&nbsp;' . _("To") . '&nbsp;' .
              '<input type=checkbox name="send_to_search[C' . $line . ']" value = "' .
-             htmlspecialchars($row['email']) . '">&nbsp;Cc&nbsp;' .
+             htmlspecialchars($row['email']) . '">&nbsp;' . _("Cc") . '&nbsp;' .
              '<input type=checkbox name="send_to_search[B' . $line . ']" value = "' .
-             htmlspecialchars($row['email']) . '">&nbsp;Bcc&nbsp;' . 
+             htmlspecialchars($row['email']) . '">&nbsp;' . _("Bcc") . '&nbsp;' . 
              '</td><td nowrap>&nbsp;' . $row['name'] . '&nbsp;</td>' .
              '<td nowrap>&nbsp;' . $row['email'] . '&nbsp;</td>' .
              '<td nowrap>&nbsp;' . $row['label'] . '&nbsp;</td>';
@@ -103,15 +105,19 @@ function addr_display_result($res, $includesource = true) {
 /* --- End functions --- */
 
 global $mailbox;
-displayPageHeader($color, $mailbox);
-
+if ($compose_new_win == '1') {
+    compose_Header($color, $mailbox);
+}
+else {
+    displayPageHeader($color, $mailbox);
+}
 /* Initialize addressbook */
 $abook = addressbook_init();
 
 ?>
 
 <br>
-<table width=95% align=center cellpadding=2 cellspacing=2 border=0>
+<table width="95%" align=center cellpadding=2 cellspacing=2 border=0>
 <tr><td bgcolor="<?php echo $color[0] ?>">
    <center><b><?php echo _("Address Book Search") ?></b></center>
 </td></tr></table>
@@ -156,7 +162,12 @@ do_hook('addrbook_html_search_below');
 /* End search form */
 
 /* Show personal addressbook */
-if ($addrquery == '' || !empty($listall)) {
+
+if ( !empty( $listall ) ){
+    $addrquery = '*';
+}
+
+if ($addrquery == '' && empty($listall)) {
 
     if (! isset($backend) || $backend != -1 || $addrquery == '') {
         if ($addrquery == '') {
@@ -168,6 +179,7 @@ if ($addrquery == '' || !empty($listall)) {
         $res = $abook->list_addr($backend);
 
         if (is_array($res)) {
+            usort($res,'alistcmp');
             addr_display_result($res, false);
         } else {
             echo '<P ALIGN=center><STRONG>' .
@@ -178,14 +190,15 @@ if ($addrquery == '' || !empty($listall)) {
 
     } else {
         $res = $abook->list_addr();
+        usort($res,'alistcmp');
         addr_display_result($res, true);
     }
     exit;
-
-else {
+}
+else {
 
     /* Do the search */
-    if (!empty($addrquery) && empty($listall)) {
+    if (!empty($addrquery)) {
 
         if ($backend == -1) {
             $res = $abook->s_search($addrquery);