X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=blobdiff_plain;f=src%2Faddrbook_search.php;h=4e914beef1ef4f28c5297d4665e19f6148e3510e;hp=8051122a078662e024720d27c9cc4c510559218e;hb=cb104e1dc329188c066b6d6b843fdbd22f9e16de;hpb=7e235a1a75c0544d1b41270f54568990b3af112a diff --git a/src/addrbook_search.php b/src/addrbook_search.php index 8051122a..4e914bee 100644 --- a/src/addrbook_search.php +++ b/src/addrbook_search.php @@ -3,7 +3,7 @@ /** * addrbook_search.php * - * Copyright (c) 1999-2002 The SquirrelMail Project Team + * Copyright (c) 1999-2003 The SquirrelMail Project Team * Licensed under the GNU GPL. For full terms see the file COPYING. * * Handle addressbook searching in the popup window. @@ -15,8 +15,25 @@ * $Id$ */ -require_once('../src/validate.php'); -require_once('../functions/strings.php'); +/* Path for SquirrelMail required files. */ +define('SM_PATH','../'); + +/* SquirrelMail required files. */ +require_once(SM_PATH . 'include/validate.php'); +require_once(SM_PATH . 'functions/strings.php'); +require_once(SM_PATH . 'functions/global.php'); +require_once(SM_PATH . 'functions/html.php'); + +/* lets get the global vars we may need */ +sqgetGlobalVar('key', $key, SQ_COOKIE); +sqgetGlobalVar('username', $username, SQ_SESSION); +sqgetGlobalVar('onetimepad',$onetimepad, SQ_SESSION); +sqgetGlobalVar('base_uri', $base_uri, SQ_SESSION); + +sqgetGlobalVar('show' , $show); +sqgetGlobalVar('query', $query, SQ_POST); +sqgetGlobalVar('listall', $listall, SQ_POST); +sqgetGlobalVar('backend', $backend, SQ_POST); /* Function to include JavaScript code */ function insert_javascript() { @@ -93,45 +110,49 @@ 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 ================= */ -require_once('../functions/array.php'); require_once('../functions/strings.php'); require_once('../functions/addressbook.php'); @@ -156,9 +177,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; } @@ -169,11 +191,12 @@ $abook = addressbook_init(); 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) { @@ -188,13 +211,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 */ @@ -210,10 +238,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(); @@ -236,16 +264,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; }