Location: PHPKode > scripts > ZBase > zbase/html/search_result.php
<?
/*****************************************************************************
 * search_result.php : Processes search.php form
 *****************************************************************************
 * $Id: search_result.php,v 1.5 2000/08/11 15:16:43 massiot Exp $
 *****************************************************************************
 *  ZBase - a gateway between the database and the WWW
 *  Copyright (c) 1999 The ZBase team
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *****************************************************************************/

require("srv_html.inc");
require("srv_search.inc");
srv_init();
srv_header(srv_str("html", "search_result_title"));

ignore_user_abort(FALSE);

if ($SESSION_OBJ)
  srv_register("search_page", substr($REQUEST_URI, 1)."&"
                              .srv_urlhash($HTTP_POST_VARS));

/* Use a form object to retrieve the properties of the tables we work on. */
$form = new form;

/* Build a table to get mathematical operators. */
$real_op = array(1 => "truc", "#", "=", "<", ">", "<=", ">=", "!=");

$nb = $form->form_getnb();

/* Build the dictionary. */
for ($i = 0; $i < $nb; $i++) {
  $attr = $form->form_getobj();
  $form->form_getinput("table", &$temp);
  if ($temp) {
    srv_include($temp);
    $obj = new $temp;
  }
  $form->form_getinput("operator", &$temp);
  if (!$attr["raw"]) {
    $operator = $real_op[$temp];
    if (!$operator)
      $operator = $temp;
  } else
    $operator = $temp;

  if ($operator == "truc")
      $operator = "";

  if ($operator) {
    $form->form_getinput("field", &$field);
    $form->form_getinput("value", &$value);
    if (!$attr["raw"])
      $value = $obj->types_retrieve($field, $value);
    $dict[$field] = array($value, $operator);
    $form->form_getinput("orderby", &$temp);
    if ($temp) $orderby = $temp;
  }
}

if (!$obj) {
  $THEME_OBJ->th_error(srv_str("html", "search_result_nodict")
                       ." [search_result.php]");

} else {
  /* Do the search. */
  srv_search($dict, $obj, TRUE, $orderby);
}

srv_close();
?>
Return current item: ZBase