X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=src%2Faddrbook_search.php;h=7fd7ee8e44eec45c7ffa7b13e5f6be48404771d7;hb=77e6058f22e41b506fbc43697ce70aa76d831d00;hp=b9bedc0221d5c62de30a0302002ffd44db6cd6fe;hpb=b22c4e166f29bfd2e8b63f960682c3a47107c58f;p=squirrelmail.git diff --git a/src/addrbook_search.php b/src/addrbook_search.php index b9bedc02..7fd7ee8e 100644 --- a/src/addrbook_search.php +++ b/src/addrbook_search.php @@ -17,6 +17,7 @@ require_once('../src/validate.php'); require_once('../functions/strings.php'); +require_once('../functions/html.php'); /* Function to include JavaScript code */ function insert_javascript() { @@ -93,40 +94,45 @@ function display_result($res, $includesource = true) { insert_javascript(); $line = 0; - echo '' . - '\n"; + echo "\n"; while (list($undef, $row) = each($res)) { - echo '\n"; + echo "\n"; $line++; } - echo '
 ' . - ' ' . _("Name") . - ' ' . _("E-mail") . - ' ' . _("Info"); + echo html_tag( 'table', '', 'center', '', 'border="0" width="98%"' ) . + html_tag( 'tr', '', '', $color[9] ) . + html_tag( 'th', ' ', 'left' ) . + html_tag( 'th', ' ' . _("Name"), 'left' ) . + html_tag( 'th', ' ' . _("E-mail"), 'left' ) . + html_tag( 'th', ' ' . _("Info"), 'left' ); if ($includesource) { - echo ' ' . _("Source"); + echo html_tag( 'th', ' ' . _("Source"), 'left', 'width="10%"' ); } - echo "
' . + $tr_bgcolor = ''; + $email = htmlspecialchars(addcslashes(AddressBook::full_address($row), "'"), ENT_QUOTES); + if ($line % 2) { $tr_bgcolor = $color[0]; } + echo html_tag( 'tr', '', '', $tr_bgcolor, 'nowrap' ) . + html_tag( 'td', 'To | " . + "'" . $email . "');\">To | " . 'Cc | " . + "'" . $email . "');\">Cc | " . 'Bcc" . - ' ' . - $row['name'] . '' . + "'" . $email . "');\">Bcc", + 'center', '', 'valign="top" width="5%" nowrap' ) . + html_tag( 'td', ' ' . htmlspecialchars($row['name']), 'left', '', 'valign="top" nowrap' ) . + html_tag( 'td', ' ' . '" . $row['email'] . '' . - '' . $row['label']; + "'" . $email . "');\">" . htmlspecialchars($row['email']) . '' + , 'left', '', 'valign="top"' ) . + html_tag( 'td', htmlspecialchars($row['label']), 'left', '', 'valign="top" nowrap' ); if ($includesource) { - echo ' ' . $row['source']; + echo html_tag( 'td', ' ' . $row['source'], 'left', '', 'valign="top" nowrap' ); } - echo "
'; + echo ''; } /* ================= End of functions ================= */ @@ -140,6 +146,7 @@ displayHtmlHeader(); /* Initialize vars */ if (!isset($query)) { $query = ''; } if (!isset($show)) { $show = ''; } +if (!isset($backend)) { $backend = ''; } /* Choose correct colors for top and bottom frame */ if ($show == 'form' && !isset($listall)) { @@ -155,9 +162,10 @@ if ($show == 'form' && !isset($listall)) { /* Empty search */ if (empty($query) && empty($show) && empty($listall)) { - echo '


' . - _("No persons matching your search was found") . - "

\n\n", + echo html_tag( 'p', '
' . + _("No persons matching your search was found"), + 'center' ) . + "\n\n", exit; } @@ -166,13 +174,14 @@ $abook = addressbook_init(); /* Create search form */ if ($show == 'form' && empty($listall)) { - echo '
' . "\n" . - '' . - '
' . "\n" . - ' ' . _("Search for") . "\n" . - ' \n"; + html_tag( 'table', '', '', '', 'border="0" width="100%" height="100%"' ) . + html_tag( 'tr' ) . + html_tag( 'td', ' ' . _("Search for") . "\n", 'left', '', 'nowrap valign="middle" width="10%"' ) . + html_tag( 'td', '', 'left', '', '' ) . + '\n"; /* List all backends to allow the user to choose where to search */ if ($abook->numbackends > 1) { @@ -187,13 +196,18 @@ if ($show == 'form' && empty($listall)) { echo '' . "\n"; } - echo '
'. - '' . - ' | ' . "\n" . - ' | ' . "\n" . - '
' . "\n"; + echo '' . + html_tag( 'tr', + html_tag( 'td', '', 'left' ) . + html_tag( 'td', + '' . + ' | ' . "\n" . + ' | ' . "\n" , + 'left' ) + ) . + '' . "\n"; } else { /* Show personal addressbook */ @@ -209,10 +223,10 @@ if ($show == 'form' && empty($listall)) { usort($res,'alistcmp'); display_result($res, false); } else { - echo '

' . - sprintf(_("Unable to list addresses from %s"), - $abook->backends[$backend]->sname) . - '

' . "\n"; + echo html_tag( 'p', '' . + sprintf(_("Unable to list addresses from %s"), + $abook->backends[$backend]->sname) . '' , + 'center' ) . "\n"; } } else { $res = $abook->list_addr(); @@ -235,16 +249,19 @@ if ($show == 'form' && empty($listall)) { } if (!is_array($res)) { - echo '


' . - _("Your search failed with the following error(s)") . - ':
' . $abook->error . "

\n\n"; + echo html_tag( 'p', '
' . + _("Your search failed with the following error(s)") . + ':
' . $abook->error . "
\n" , + 'center' ) . + "\n\n"; exit; } if (sizeof($res) == 0) { - echo '


' . - _("No persons matching your search was found") . - ".

\n\n"; + echo html_tag( 'p', '
' . + _("No persons matching your search was found") . "\n" , + 'center' ) . + "\n\n"; exit; }