Source for file addrbook_search_html.php
Documentation is available at addrbook_search_html.php
* addrbook_search_html.php
* Handle addressbook searching with pure html.
* This file is included from compose.php
* @copyright 1999-2020 The SquirrelMail Project Team
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version $Id: addrbook_search_html.php 14840 2020-01-07 07:42:38Z pdontthink $
* @subpackage addressbook
/** This is the addrbook_search_html page */
define('PAGE_NAME', 'addrbook_search_html');
* Path for SquirrelMail required files.
/** 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');
global $body, $subject, $send_to, $send_to_cc, $send_to_bcc, $mailbox, $action,
$mailprio, $request_mdn, $request_dr, $identity, $session, $composeMessage;
// someone tell me why this is needed and if so, why it isn't something like replace \r\n with \n
// if (substr($body, 0, 1) == "\r") {
// echo addHidden('body', "\n".$body);
if (is_object($composeMessage) &&
$composeMessage->entities)
* @param array $res Array containing results of search
* @param bool $includesource If true, adds backend column to address listing
global $color, $javascript_on, $PHP_SELF, $squirrelmail_language;
if (sizeof($res) <=
0) return;
echo
addForm($PHP_SELF, 'POST', 'addrbook', '', '', '', TRUE).
'<script language="JavaScript" type="text/javascript">' .
"function CheckAll(ch) {\n" .
" for (var i = 0; i < document.addrbook.elements.length; i++) {\n" .
" if( document.addrbook.elements[i].type == 'checkbox' &&\n" .
" document.addrbook.elements[i].name.substr(0,16) == 'send_to_search['+ch ) {\n" .
" document.addrbook.elements[i].checked = !(document.addrbook.elements[i].checked);\n".
$chk_all =
'<a href="#" onClick="CheckAll(\'T\');">' .
_("All") .
'</a> <font color="'.
$color[6].
'">'.
_("To").
'</font>'.
'<a href="#" onClick="CheckAll(\'C\');">' .
_("All") .
'</a> <font color="'.
$color[6].
'">'.
_("Cc").
'</font>'.
'<a href="#" onClick="CheckAll(\'B\');">' .
_("All") .
'</a> <font color="'.
$color[6].
'">'.
_("Bcc").
'</font>';
// check_all links are implemented only in JavaScript. disable links in js=off environment.
echo
html_tag( 'table', '', 'center', '', 'border="0" width="98%"' ) .
html_tag( 'th', ' ' .
$chk_all, 'left', '', ' style="white-space: nowrap;" ' ) .
html_tag( 'th', ' ' .
_("Name"), 'left' ) .
html_tag( 'th', ' ' .
_("E-mail"), 'left' ) .
html_tag( 'th', ' ' .
_("Info"), 'left' );
echo
html_tag( 'th', ' ' .
_("Source"), 'left', '', 'width="10%"' );
$tr_bgcolor =
$color[12];
if ($squirrelmail_language ==
'ja_JP')
echo
html_tag( 'tr', '', '', $tr_bgcolor, 'nowrap' ) .
'<input type="checkbox" name="send_to_search[T' .
$line .
']" value = "' .
'<input type="checkbox" name="send_to_search[C' .
$line .
']" value = "' .
'<input type="checkbox" name="send_to_search[B' .
$line .
']" value = "' .
'center', '', 'width="5%" nowrap' ) .
echo
html_tag( 'tr', '', '', $tr_bgcolor, 'nowrap' ) .
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' ) .
echo
html_tag( 'td', ' ' .
$row['source'] .
' ', 'left', '', 'nowrap' );
if ($includesource) { $td_colspan =
'5'; } else { $td_colspan =
'4'; }
'<input type="submit" name="addr_search_done" value="' .
_("Use Addresses") .
'" /> ' .
'<input type="submit" name="addr_search_cancel" value="' .
'center', '', 'colspan="'.
$td_colspan .
'"' )
/* --- End functions --- */
if ($compose_new_win ==
'1') {
/* Initialize addressbook */
html_tag( 'td', '<b>' .
_("Address Book Search") .
'</b>', 'center', $color[0] )
'center', '', 'width="95%" cellpadding="2" cellspacing="2" border="0"' );
echo
addForm($PHP_SELF.
'?html_addr_search=true', 'post', 'f').
html_tag( 'table', '', 'center', '', 'border="0"' ) .
html_tag( 'td', '', 'left', '', 'nowrap valign="middle"' ) .
"\n" .
' <nobr><strong>' .
_("Search for") .
"</strong>\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
'<strong>' .
_("in") .
'</strong> ';
$selopts['-1'] =
_("All address books");
$ret =
$abook->get_backend_list();
while (list
($undef,$v) =
each($ret)) {
$selopts[$v->bnum] =
$v->sname;
echo
addSelect('backend', $selopts, $backend, TRUE);
echo
'<input type="submit" value="' .
_("Search") .
'" />' .
' | <input type="submit" value="' .
_("List all") .
'" name="listall" />' .
"\n" .
'</center></td></tr></table>' .
"\n";
do_hook('addrbook_html_search_below');
/* Show personal addressbook */
if ( !empty( $listall ) ){
if ($addrquery ==
'' &&
empty($listall)) {
if (! isset
($backend) ||
$backend != -
1 ||
$addrquery ==
'') {
$backend =
$abook->localbackend;
/* echo '<h3 align="center">' . $abook->backends[$backend]->sname) . "</h3>\n"; */
$res =
$abook->list_addr($backend);
sprintf(_("Unable to list addresses from %s"),
$abook->backends[$backend]->sname) .
"</strong>\n" ,
$res =
$abook->list_addr();
if (!empty($addrquery)) {
$res =
$abook->s_search($addrquery);
$res =
$abook->s_search($addrquery, $backend);
_("Your search failed with the following error(s)") .
':<br />' .
$abook->error .
"</b>\n" ,
_("No persons matching your search were found") .
"</b>\n" ,
if ($addrquery ==
'' ||
sizeof($res) ==
0) {
/* printf('<center><form method="post" name="k" action="compose.php">'."\n", $PHP_SELF); */
addForm('compose.php','POST','k', '', '', '', TRUE);
echo
'<input type="submit" value="' .
_("Return") .
'" name="return" />' .
"\n" .
'</form></center></nobr>';
Documentation generated on Mon, 13 Jan 2020 04:24:12 +0100 by phpDocumentor 1.4.3