argh! (forgot to remove debug code, done now)
[squirrelmail.git] / src / search.php
index 79da86acd8aa95417a0f5303185b7f571041dd99..e090e887a925d5d2dd3248ee02908a72f89309b8 100644 (file)
@@ -2,41 +2,10 @@
 
    /* $Id$ */
 
-   session_start();
-
-   if(!isset($logged_in)) {
-      set_up_language($squirrelmail_language, true);
-      echo _("You must login first.");
-      exit;
-   }
-   if(!isset($username) || !isset($key)) {
-      include ('../themes/default_theme.php');
-      include ('../functions/display_messages.php');
-      printf('<html><BODY TEXT="%s" BGCOLOR="%s" LINK="%s" VLINK="%s" ALINK="%s">',
-              $color[8], $color[4], $color[7], $color[7], $color[7]);
-      plain_error_message(_("You need a valid user and password to access this page!")
-                          . '<br><a href="../src/login.php">'
-                          . _("Click here to log back in.") . '</a>.', $color);
-      echo '</body></html>';
-      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');
+   require_once('../src/validate.php');
+   require_once('../functions/imap.php');
+   require_once('../functions/imap_search.php');
+   require_once('../functions/array.php');
 
    displayPageHeader($color, $mailbox);
    $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
@@ -59,7 +28,7 @@
    for ($i = 0; $i < count($boxes); $i++) {
          if (!in_array('noselect', $boxes[$i]['flags'])) {
          $box = $boxes[$i]['unformatted'];
-         $box2 = replace_spaces($boxes[$i]['unformatted-disp']);
+        $box2 = str_replace(' ', '&nbsp;', $boxes[$i]['unformatted-disp']);
          if ($mailbox == $box)
             echo "         <OPTION VALUE=\"$box\" SELECTED>$box2\n";
          else
@@ -72,8 +41,8 @@
    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);
+   $what_disp = str_replace('\\"', '"', $what_disp);
    $what_disp = str_replace('"', '&quot;', $what_disp);
    echo "          <INPUT TYPE=\"TEXT\" SIZE=\"20\" NAME=\"what\" VALUE=\"$what_disp\">\n";
    echo '        </TD>';
    do_hook("search_bottom");
    sqimap_logout ($imapConnection);
 ?>
-</body></html>
+</body></html>
\ No newline at end of file