X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=blobdiff_plain;f=src%2Fsearch.php;h=65e1695aebea571d689dad5d4fce74576fdfdd3a;hp=7eb98a183faa78e51be51356758c4bff51f4fb4d;hb=46d38f7894542146367a4b22c63f41564829abd2;hpb=6142318960928725ed3e2fe88ced7b5eb5397b0a diff --git a/src/search.php b/src/search.php index 7eb98a18..65e1695a 100644 --- a/src/search.php +++ b/src/search.php @@ -1,118 +1,149 @@ ', - $color[8], $color[4], $color[7], $color[7], $color[7]); - plain_error_message(_("You need a valid user and password to access this page!") - . "
" - . _("Click here to log back in.") . ".", $color); - echo ""; - exit; - } - - if (!isset($strings_php)) - include("../functions/strings.php"); - if (!isset($i18n_php)) - include("../functions/i18n.php"); - if (!isset($config_php)) - include("../config/config.php"); - if (!isset($page_header_php)) - include("../functions/page_header.php"); - if (!isset($imap_php)) - include("../functions/imap.php"); - if (!isset($imap_search_php)) - include("../functions/imap_search.php"); - if (!isset($array_php)) - include("../functions/array.php"); - - include("../src/load_prefs.php"); - - displayPageHeader($color, $mailbox); - $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0); - - do_hook("search_before_form"); - echo "
\n"; - echo " \n"; - echo " \n"; - echo "
\n"; - echo "
"._("Search")."
\n"; - echo "
"; - - echo "
\n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " "; - echo " \n"; - echo " \n"; - echo " \n"; - echo "
\n"; - echo " "; - echo " \n"; - if (!isset($what)) - $what = ""; - $what_disp = ereg_replace(",", " ", $what); - $what_disp = str_replace("\\\\", "\\", $what_disp); - $what_disp = str_replace("\\\"", "\"", $what_disp); - $what_disp = str_replace("\"", """, $what_disp); - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo "
\n"; - echo "
"; - echo "
"; - do_hook("search_after_form"); - if (isset($where) && $where && isset($what) && $what) { - sqimap_mailbox_select($imapConnection, $mailbox); - sqimap_search($imapConnection, $where, $what, $mailbox, $color); - } - do_hook("search_bottom"); - sqimap_logout ($imapConnection); +/** + * search.php + * + * Copyright (c) 1999-2002 The SquirrelMail Project Team + * Licensed under the GNU GPL. For full terms see the file COPYING. + * + * $Id$ + */ + +require_once('../src/validate.php'); +require_once('../functions/imap.php'); +require_once('../functions/imap_search.php'); +require_once('../functions/array.php'); +require_once('../functions/strings.php'); + +function s_opt( $val, $sel, $tit ) { + echo " \n"; +} + +/* ------------------------ main ------------------------ */ + +$imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0); +$boxes = sqimap_mailbox_list($imapConnection); + +if( $mailbox == 'None' ) { + $mailbox = $boxes[0]['unformatted']; +} + +displayPageHeader($color, $mailbox); + +if( !isset( $search_memory ) ) { + $search_memory = 0; +} + +do_hook('search_before_form'); +echo "
\n". + " \n". + " \n". + '
\n". + "
"._("Search")."
\n". + "
'; + +if( $search_memory > 0 ) { + + if( isset( $pos) ) { + setpref( $data_dir, $username, 'search_pos', $pos ); + } else { + $pos = getPref($data_dir, $username, 'search_pos', 0 ); + } + +} + +for ( $form = 0; $form <= $search_memory; $form++ ) { + + $frm = "$form"; + $what = "what$frm"; + $where = "where$frm"; + + if( $search_memory > 0 ) { + if ( $$what == '' ) { + $$what = getPref($data_dir, $username, "search_what$frm", '' ); + $$where = getPref($data_dir, $username, "search_where$frm", '' ); + } else { + setpref( $data_dir, $username, "search_what$frm", $$what ); + setpref( $data_dir, $username, "search_where$frm", $$where ); + } + } + echo " \n"; + if( !($form == 0 && $search_memory > 0) ) { + + if( $form == $pos ) { + $act = $color[5]; + } else { + $act = $color[4]; + } + + echo "\n". + "". + " \n". + ' \n". + " '. + "\n". + " \n". + " \n". + ''; + } + echo "
'. + " \n"; + if (!isset($$what)) { + $$what = ''; + } + $what_disp = str_replace(',', ' ', $$what); + $what_disp = str_replace('\\\\', '\\', $what_disp); + $what_disp = str_replace('\\"', '"', $what_disp); + $what_disp = str_replace('"', '"', $what_disp); + echo " \n". + '\n". + "\n" . + " \n". + " \n". + "
\n"; +} + +echo "
"; +do_hook("search_after_form"); +if( !isset( $pos ) ) { + $pos = $frm; +} +$what = "what$pos"; +$where = "where$pos"; + +if (isset($$where) && $$where && isset($$what) && $$what) { + sqimap_mailbox_select($imapConnection, $mailbox); + sqimap_search($imapConnection, $$where, $$what, $mailbox, $color, $pos); +} +do_hook("search_bottom"); +sqimap_logout ($imapConnection); + +echo ''; + ?> -