X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=src%2Faddrbook_search_html.php;h=81997272da00d67e403b94e26d6f1d7c3063f3fd;hb=3cd52f38c5e51e948d935cd9e9e1f480b685ac3d;hp=81cb0bc4ebf2c91ed53db422f61334ff5ca33802;hpb=9c3e6cd4518d9e0d072a146fd6d19acd4daac243;p=squirrelmail.git diff --git a/src/addrbook_search_html.php b/src/addrbook_search_html.php index 81cb0bc4..81997272 100644 --- a/src/addrbook_search_html.php +++ b/src/addrbook_search_html.php @@ -3,108 +3,166 @@ /** * addrbook_search_html.php * - * Copyright (c) 1999-2002 The SquirrelMail Project Team + * Copyright (c) 1999-2004 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$ + * @version $Id$ + * @package squirrelmail */ -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'); -require_once('../functions/strings.php'); +/** + * Path for SquirrelMail required files. + * @ignore + */ +if (! defined('SM_PATH') ) { + define('SM_PATH','../'); +} -/* Insert hidden data */ +/** SquirrelMail required files. */ +require_once(SM_PATH . 'include/validate.php'); +require_once(SM_PATH . 'functions/global.php'); +require_once(SM_PATH . 'functions/date.php'); +require_once(SM_PATH . 'functions/display_messages.php'); +require_once(SM_PATH . 'functions/addressbook.php'); +require_once(SM_PATH . 'functions/plugin.php'); +require_once(SM_PATH . 'functions/strings.php'); +require_once(SM_PATH . 'functions/html.php'); + +sqgetGlobalVar('session', $session, SQ_POST); +sqgetGlobalVar('mailbox', $mailbox, SQ_POST); +sqgetGlobalVar('addrquery', $addrquery, SQ_POST); +sqgetGlobalVar('listall', $listall, SQ_POST); +sqgetGlobalVar('backend', $backend, SQ_POST); + +/** + * Insert hidden data + */ function addr_insert_hidden() { global $body, $subject, $send_to, $send_to_cc, $send_to_bcc, $mailbox, - $identity; + $identity, $session; - echo '' . "\n" . - '' . "\n" . - '' . "\n" . - '' . "\n" . - '' . "\n" . - '' . "\n" . - '\n" . '' . - "\n"; + echo addHidden('body', "\n".$body); + } else { + echo addHidden('body', $body); } + echo addHidden('session', $session). + addHidden('subject', $subject). + addHidden('send_to', $send_to). + addHidden('send_to_bcc', $send_to_bcc). + addHidden('send_to_cc', $send_to_cc). + addHidden('identity', $identity). + addHidden('mailbox', $mailbox). + addHidden('from_htmladdr_search', 'true'); +} -/* List search results */ + +/** + * List search results + * @param array $res Array containing results of search + * @param bool $includesource UNDOCUMENTED [Default=true] + */ function addr_display_result($res, $includesource = true) { - global $color, $PHP_SELF; + global $color, $javascript_on, $PHP_SELF, $squirrelmail_language; if (sizeof($res) <= 0) return; - echo '
\n" . - '' . "\n"; + echo addForm($PHP_SELF, 'POST', 'addrbook'). + addHidden('html_addr_search_done', 'true'); addr_insert_hidden(); $line = 0; - echo '' . - '\n"; + echo "\n"; foreach ($res as $row) { - echo '' . - '' . - ''; + htmlspecialchars($email) . '"> ' . _("Bcc") . ' ' , + 'center', '', 'width="5%" nowrap' ) . + html_tag( 'td', ' ' . htmlspecialchars($row['lastname']) . ' ' . htmlspecialchars($row['firstname']) . ' ', 'left', '', 'nowrap' ) . + html_tag( 'td', ' ' . htmlspecialchars($row['email']) . ' ', 'left', '', 'nowrap' ) . + html_tag( 'td', ' ' . htmlspecialchars($row['label']) . ' ', 'left', '', 'nowrap' ); + } else { + echo html_tag( 'tr', '', '', $tr_bgcolor, 'nowrap' ) . + html_tag( 'td', + addCheckBox('send_to_search[T'.$line.']', FALSE, $email). + ' ' . _("To") . ' ' . + addCheckBox('send_to_search[C'.$line.']', FALSE, $email). + ' ' . _("Cc") . ' ' . + addCheckBox('send_to_search[B'.$line.']', FALSE, $email). + ' ' . _("Bcc") . ' ' , + 'center', '', 'width="5%" nowrap' ) . + html_tag( 'td', ' ' . htmlspecialchars($row['name']) . ' ', 'left', '', 'nowrap' ) . + html_tag( 'td', ' ' . htmlspecialchars($row['email']) . ' ', 'left', '', 'nowrap' ) . + html_tag( 'td', ' ' . htmlspecialchars($row['label']) . ' ', 'left', '', 'nowrap' ); + } + if ($includesource) { - echo ''; + echo html_tag( 'td', ' ' . $row['source'] . ' ', 'left', '', 'nowrap' ); } echo "\n"; $line ++; } - echo '' . + if ($includesource) { $td_colspan = '5'; } else { $td_colspan = '4'; } + echo html_tag( 'tr', + html_tag( 'td', + '' , + 'center', '', 'colspan="'. $td_colspan .'"' ) + ) . '
 ' . - ' ' . _("Name") . - ' ' . _("E-mail") . - ' ' . _("Info"); +if ($javascript_on) { + print + '\n"; + $chk_all = '' . _("All") . ' To'. + '  '. + '' . _("All") . ' Cc'. + '  '. + '' . _("All") . ''; + } + echo html_tag( 'table', '', 'center', '', 'border="0" width="98%"' ) . + html_tag( 'tr', '', '', $color[9] ) . + html_tag( 'th', ' ' . $chk_all, '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 = AddressBook::full_address($row); + if ($line % 2) { $tr_bgcolor = $color[0]; } + if ($squirrelmail_language == 'ja_JP') + { + echo html_tag( 'tr', '', '', $tr_bgcolor, 'nowrap' ) . + html_tag( 'td', ' ' . _("To") . ' ' . + htmlspecialchars($email) . '"> ' . _("To") . ' ' . ' ' . _("Cc") . ' ' . + htmlspecialchars($email) . '"> ' . _("Cc") . ' ' . ' ' . _("Bcc") . ' ' . - ' ' . $row['name'] . '  ' . $row['email'] . '  ' . $row['label'] . '  ' . $row['source'] . ' 
' . - '' . + addHidden('html_addr_search_done', '1'). '
'; } /* --- End functions --- */ -global $mailbox; if ($compose_new_win == '1') { compose_Header($color, $mailbox); } @@ -114,50 +172,53 @@ else { /* Initialize addressbook */ $abook = addressbook_init(); -?> -
- -
-
-
+echo '
' . +html_tag( 'table', + html_tag( 'tr', + html_tag( 'td', '' . _("Address Book Search") . '', 'center', $color[0] ) + ) , +'center', '', 'width="95%" cellpadding="2" cellspacing="2" border="0"' ); -\n
\n" . - '
' . "\n
\n" . - ' ' . _("Search for") . "\n"; +echo '
' . + html_tag( 'table', '', 'center', '', 'border="0"' ) . + html_tag( 'tr' ) . + html_tag( 'td', '', 'left', '', 'nowrap valign="middle"' ) . "\n" . + addForm($PHP_SELF.'?html_addr_search=true', 'POST', 'f'). + "\n
\n" . + ' ' . _("Search for") . "\n"; addr_insert_hidden(); if (! isset($addrquery)) $addrquery = ''; -echo ' \n"; +echo addInput('addrquery', $addrquery, 26); /* List all backends to allow the user to choose where to search */ if (!isset($backend)) { $backend = ''; } if ($abook->numbackends > 1) { - echo '' . _("in") . ' \n"; + echo addSelect('backend', $selopts, $backend, TRUE); } else { - echo '' . "\n"; + echo addHidden('backend', '-1'); } +if (isset($session)) { + echo addHidden('session', $session); +} + echo '' . ' | ' . "\n" . '
' . "\n"; addr_insert_hidden(); -echo ''; +echo ''; do_hook('addrbook_html_search_below'); /* End search form */ @@ -182,10 +243,10 @@ if ($addrquery == '' && empty($listall)) { usort($res,'alistcmp'); addr_display_result($res, false); } else { - echo '

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

\n"; + $abook->backends[$backend]->sname) . "\n" , + 'center' ); } } else { @@ -207,14 +268,17 @@ else { } 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"; } else { if (sizeof($res) == 0) { - echo '


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

\n\n"; + echo html_tag( 'p', '
' . + _("No persons matching your search were found") . "\n" , + 'center' ) . + "\n\n"; } else { addr_display_result($res); } @@ -224,7 +288,8 @@ else { if ($addrquery == '' || sizeof($res) == 0) { /* printf('
'."\n", $PHP_SELF); */ - echo '
' . "\n"; + echo '
'. + addForm('compose.php','POST','k'); addr_insert_hidden(); echo '' . "\n" . '
';