X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=blobdiff_plain;f=src%2Faddrbook_search.php;h=9557065cf1f74af43075cf0a90a5c0c613912141;hp=3205e4a4478b9d8afb14a6f4379eca774fe880cb;hb=0eed445e0a295a77a5893996cfcee3239b3b7a57;hpb=441f2d33bad826a0278aafe63e58d0b3c81b6e0c
diff --git a/src/addrbook_search.php b/src/addrbook_search.php
index 3205e4a4..9557065c 100644
--- a/src/addrbook_search.php
+++ b/src/addrbook_search.php
@@ -10,8 +10,12 @@
** NOTE: A lot of this code is similar to the code in
** addrbook_search_html.html -- If you change one,
** change the other one too!
+ **
+ ** $Id$
**/
+ require_once('../src/validate.php');
+
// Function to include JavaScript code
function insert_javascript() {
?>
@@ -31,9 +35,9 @@ function to_address($addr) {
if(pwintype != "undefined" ) {
if ( parent.opener.document.compose.send_to.value ) {
prefix = ", ";
- parent.opener.document.compose.send_to.value =
+ parent.opener.document.compose.send_to.value =
parent.opener.document.compose.send_to.value + ", " + $addr;
-
+
} else {
parent.opener.document.compose.send_to.value = $addr;
}
@@ -49,8 +53,8 @@ function cc_address($addr) {
if(pwintype != "undefined" ) {
if ( parent.opener.document.compose.send_to_cc.value ) {
prefix = ", ";
- parent.opener.document.compose.send_to_cc.value =
- parent.opener.document.compose.send_to_cc.value + ", " + $addr;
+ parent.opener.document.compose.send_to_cc.value =
+ parent.opener.document.compose.send_to_cc.value + ", " + $addr;
} else {
parent.opener.document.compose.send_to_cc.value = $addr;
}
@@ -60,14 +64,14 @@ function cc_address($addr) {
function bcc_address($addr) {
var prefix = "";
var pwintype = typeof parent.opener.document.compose;
-
+
$addr = $addr.replace(/ {1,35}$/, "");
if(pwintype != "undefined" ) {
if ( parent.opener.document.compose.send_to_bcc.value ) {
prefix = ", ";
- parent.opener.document.compose.send_to_bcc.value =
- parent.opener.document.compose.send_to_bcc.value + ", " + $addr;
+ parent.opener.document.compose.send_to_bcc.value =
+ parent.opener.document.compose.send_to_bcc.value + ", " + $addr;
} else {
parent.opener.document.compose.send_to_bcc.value = $addr;
}
@@ -76,191 +80,165 @@ function bcc_address($addr) {
// -->
-";
- printf("
".
- " | %s | %s".
- " | %s",
- _("Name"), _("E-mail"), _("Info"));
-
- if($includesource)
- printf(" | %s", _("Source"));
-
- print " |
\n";
-
- while(list($undef, $row) = each($res)) {
- printf("".
- "To | ".
- "Cc | ".
- "Bcc".
- " | %s | ".
- " %s ".
- " | %s ",
- ($line % 2) ? " bgcolor=\"$color[0]\"" : "",
- $row["email"], $row["email"], $row["email"],
- $row["name"], $row["email"], $row["email"],
- $row["label"]);
-
- if($includesource)
- printf(" | %s", $row["source"]);
-
- print " |
\n";
- $line++;
- }
- print "";
- }
-
- /* ================= End of functions ================= */
-
- session_start();
-
- if (!isset($i18n_php))
- include("../functions/i18n.php");
-
- if(!isset($logged_in)) {
- set_up_language($squirrelmail_language, true);
- echo _("You must login first.");
- exit;
- }
- if(!isset($username) || !isset($key)) {
- set_up_language($squirrelmail_language, true);
- echo _("You need a valid user and password to access this page!");
- exit;
- }
-
- if (!isset($config_php))
- include("../config/config.php");
- if (!isset($array_php))
- include("../functions/array.php");
- if (!isset($auth_php))
- include("../functions/auth.php");
- if (!isset($strings_php))
- include("../functions/strings.php");
- if (!isset($page_header_php))
- include("../functions/page_header.php");
- if (!isset($addressbook_php))
- include("../functions/addressbook.php");
-
- is_logged_in();
- include("../src/load_prefs.php");
-
- displayHtmlHeader();
+ // List search results
+ function display_result($res, $includesource = true) {
+ global $color;
+
+ if(sizeof($res) <= 0) return;
+
+ insert_javascript();
+
+ $line = 0;
+ echo '';
+ printf(" ".
+ " | %s | %s".
+ " | %s",
+ _("Name"), _("E-mail"), _("Info"));
+
+ if($includesource)
+ printf(" | %s", _("Source"));
+
+ echo " |
\n";
+
+ while(list($undef, $row) = each($res)) {
+ printf("".
+ "To | ".
+ "Cc | ".
+ "Bcc".
+ " | %s | ".
+ " %s ".
+ " | %s ",
+ ($line % 2) ? " bgcolor=\"$color[0]\"" : "",
+ $row["email"], $row["email"], $row["email"],
+ $row["name"], $row["email"], $row["email"],
+ $row["label"]);
+
+ if($includesource)
+ printf(" | %s", $row["source"]);
+
+ echo " |
\n";
+ $line++;
+ }
+ echo '
';
+ }
- // Choose correct colors for top and bottom frame
- if($show == "form") {
- echo "";
- } else {
- echo "\n";
- }
+ /* ================= End of functions ================= */
+
+ require_once('../functions/array.php');
+ require_once('../functions/strings.php');
+ require_once('../functions/addressbook.php');
+
+ displayHtmlHeader();
+
+ // Initialize vars
+ if(!isset($query)) $query = "";
+ if(!isset($show)) $show = "";
+
+ // Choose correct colors for top and bottom frame
+ if($show == 'form') {
+ echo "';
+ } else {
+ echo "\n";
+ }
- // Empty search
- if(empty($query) && empty($show) && empty($listall)) {
- printf("
%s
\n\n",
- _("No persons matching your search was found"));
+ // Empty search
+ if(empty($query) && empty($show) && empty($listall)) {
+ printf("
%s
\n\n",
+ _("No persons matching your search was found"));
exit;
- }
-
- // Initialize addressbook
- $abook = addressbook_init();
-
- // Create search form
- if($show == "form") {
- printf("