/[health_html]/inc/search.php
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /inc/search.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.6 by ravilov, Tue Sep 25 15:38:04 2001 UTC revision 1.10 by ravilov, Mon Oct 29 14:43:21 2001 UTC
# Line 23  Line 23 
23                                  array_push($search, array(                                  array_push($search, array(
24                                          "field" => ${"field_".$i},                                          "field" => ${"field_".$i},
25                                          "not" => ${"not_".$i},                                          "not" => ${"not_".$i},
26                                          "query" => MyEscape(${"query_".$i}),                                          "query" => MyEscape(${"query_".$i}, true),
27                                          "logic" => ${"logic_".$i},                                          "logic" => ${"logic_".$i},
28                                          "concat" => ${"concat_".$i},                                          "concat" => ${"concat_".$i},
29                                          "case" => ${"case_".$i}                                          "case" => ${"case_".$i}
# Line 49  Line 49 
49                          $search[count($search) - 1]["logic"] = "";                          $search[count($search) - 1]["logic"] = "";
50                          $tp->assign("search", $search);                          $tp->assign("search", $search);
51                  } else {                  } else {
52                          global $field, $query;                          // Nothing.
                         $tp->assign("field", $field?$field:$def_field);  
                         $tp->assign("query", MyEscape($query));  
53                  }                  }
54                  if (!$stype) $stype = 0;                  if (!$stype) $stype = false;
55                  $tp->assign("stype", $stype);                  $tp->assign("stype", $stype);
56                    if (!$stype && !$go) {
57                            reset($fields);
58                            while (list($k, $v) = each($fields)) {
59                                    $var = "go_$k";
60                                    global $$var;
61                                    if ($$var) $go = true;
62                            }
63                    }
64                  if ($go) {                  if ($go) {
65                          if ($stype) {                          if ($stype) {
66                                  $qry = "";                                  $qry = "";
# Line 94  Line 100 
100                                          $i++;                                          $i++;
101                                  }                                  }
102                          } else {                          } else {
103                                  $q = preg_split('/\s+/', $query);                                  reset($fields);
104                                  $q2 = array();                                  while (list($k, $v) = each($fields)) {
105                                  $q3 = array();                                          $field = $k;
106                                  while (list($k, $v) = each($q)) {                                          $var = "query_".$field; global $$var;
107                                          if (!$q[$k]) continue;                                          $query = $$var;
108                                          $qq = "(UPPER(".$fields[$field]["dbname"].") LIKE '%".MyUpper($q[$k])."%')";                                          $tp->assign($var, $$var);
109                                          $is_q1 = false;                                          $go1 = "go_$field";
110                                          for ($i = 0; $i < count($q1_fields); $i++)                                          if (!$$var) continue;
111                                                  if ($q1_fields[$i] == $field) $is_q1 = true;                                          $q = preg_split('/\s+/', $query);
112                                          $is_q2 = false;                                          $q2 = array();
113                                          for ($i = 0; $i < count($q2_fields); $i++)                                          $q3 = array();
114                                                  if ($q2_fields[$i] == $field) $is_q2 = true;                                          while (list($k, $v) = each($q)) {
115                                          if ($is_q1) $q2[$k] = $qq;                                                  if (!$q[$k]) continue;
116                                          if ($is_q2) $q3[$k] = $qq;                                                  $qq = "(UPPER(".$fields[$field]["dbname"].") LIKE '%".MyUpper($q[$k])."%')";
117                                                    $is_q1 = false;
118                                                    for ($i = 0; $i < count($q1_fields); $i++)
119                                                            if ($q1_fields[$i] == $field) $is_q1 = true;
120                                                    $is_q2 = false;
121                                                    for ($i = 0; $i < count($q2_fields); $i++)
122                                                            if ($q2_fields[$i] == $field) $is_q2 = true;
123                                                    if ($is_q1) $q2[$k] = $qq;
124                                                    if ($is_q2) $q3[$k] = $qq;
125                                            }
126                                            global $basic_logic;
127                                            $qry_1 = implode(" ".$basic_logic." ", $q2);
128                                            $qry_2 = implode(" ".$basic_logic." ", $q3);
129                                  }                                  }
                                 global $basic_logic;  
                                 $qry_1 = implode(" ".$basic_logic." ", $q2);  
                                 $qry_2 = implode(" ".$basic_logic." ", $q3);  
130                          }                          }
131                  }                  }
132                  $flds = array();                  $flds = array();
133                    reset($fields);
134                  while (list($k, $v) = each($fields)) {                  while (list($k, $v) = each($fields)) {
135                            $var = "query_$k";
136                            global $$var;
137                          array_push($flds, array(                          array_push($flds, array(
138                                  "name" => MyEscape($k),                                  "name" => MyEscape($k, true),
139                                  "caption" => MyEscape($v["caption"])                                  "caption" => MyEscape($v["caption"]),
140                                    "query" => MyEscape($$var)
141                          ));                          ));
142                  }                  }
143                  $tp->assign("fields", $flds);                  $tp->assign("fields", $flds);
144                  global $PHP_SELF, $section, $section_menu;                  global $section, $section_menu;
145                  $tp->assign("section", $section);                  $tp->assign("section", $section);
146                  $tp->assign("section_menu", $section_menu);                  $tp->assign("section_menu", $section_menu);
147                  $tp->assign("FORM_ACTION", $PHP_SELF.HTMLSpecialChars("?section=$section&section_menu={$section_menu}&stype=$stype"));                  $tp->assign("FORM_ACTION", HTMLSpecialChars("?section=$section&section_menu={$section_menu}&stype=$stype"));
148                  $form = $tp->fetch("search.tpl");                  $form = $tp->fetch("search.tpl");
                 if ($form) {  
                         global $onload;  
                         $onload .= "document.forms[1].elements[".($stype?2:1)."].focus();";  
                 }  
149                  return array($form, $qry_1, $qry_2);                  return array($form, $qry_1, $qry_2);
150          }          }
151  ?>  ?>

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.10

  ViewVC Help
Powered by ViewVC 1.1.26