Rev 9 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 9 | Rev 14 | ||
---|---|---|---|
1 | <?php |
1 | <?php |
2 | 2 | ||
3 | if (!defined('IBLEGAL')) die('Kann nicht ohne Personal WebBase ausgeführt werden.'); |
3 | if (!defined('WBLEGAL')) die('Kann nicht ohne Personal WebBase ausgeführt werden.'); |
4 | 4 | ||
5 | function show_modul_search($modul, $seite) |
5 | function show_modul_search($modul, $seite) |
6 | { |
6 | { |
7 | global $suchbegriff; |
7 | global $suchbegriff; |
8 | 8 | ||
9 | if (!isset($suchbegriff)) $suchbegriff = ''; |
9 | if (!isset($suchbegriff)) $suchbegriff = ''; |
10 | 10 | ||
11 | echo '<form method="POST" name="mainform" action="'.$_SERVER['PHP_SELF'].'"> |
11 | echo '<form method="POST" name="mainform" action="'.$_SERVER['PHP_SELF'].'"> |
12 | <input type="hidden" name="seite" value="'.$seite.'"> |
12 | <input type="hidden" name="seite" value="'.$seite.'"> |
13 | <input type="hidden" name="modul" value="'.$modul.'"> |
13 | <input type="hidden" name="modul" value="'.$modul.'"> |
14 | 14 | ||
15 | <div align="center"><table cellspacing="0" cellpadding="2" border="0" width="90%"> |
15 | <div align="center"><table cellspacing="0" cellpadding="2" border="0" width="90%"> |
16 | <tr> |
16 | <tr> |
17 | <td align="left" width="50%" valign="bottom">'; |
17 | <td align="left" width="50%" valign="bottom">'; |
18 | 18 | ||
19 | if ($suchbegriff != '') |
19 | if ($suchbegriff != '') |
20 | echo 'Einträge mit Suchbegriff "'.$suchbegriff.'" sind <font color="#FF0000">rot</font> hervorgehoben.'; |
20 | echo 'Einträge mit Suchbegriff "'.$suchbegriff.'" sind <font color="#FF0000">rot</font> hervorgehoben.'; |
21 | else |
21 | else |
22 | echo ' '; |
22 | echo ' '; |
23 | 23 | ||
24 | echo '</td> |
24 | echo '</td> |
25 | <td align="right" valign="middle"> |
25 | <td align="right" valign="middle"> |
26 | 26 | ||
27 | Suchen: <input type="text" name="suchbegriff" value="'.$suchbegriff.'" class="normal" onmouseover="this.className=\'highlight\';" onmouseout="this.className=\'normal\';" size="30"> |
27 | Suchen: <input type="text" name="suchbegriff" value="'.$suchbegriff.'" class="normal" onmouseover="this.className=\'highlight\';" onmouseout="this.className=\'normal\';" size="30"> |
28 | <input type="submit" class="button" onmouseover="this.className=\'button_act\';" onmouseout="this.className=\'button\';" value="Suchen"> |
28 | <input type="submit" class="button" onmouseover="this.className=\'button_act\';" onmouseout="this.className=\'button\';" value="Suchen"> |
29 | 29 | ||
30 | </td></tr></table></div> |
30 | </td></tr></table></div> |
31 | 31 | ||
32 | </form>'; |
32 | </form>'; |
33 | } |
33 | } |
34 | 34 | ||
35 | function generate_search_query($table, $mode, $suchbegriff, $append = '') |
35 | function generate_search_query($table, $mode, $suchbegriff, $append = '') |
36 | { |
36 | { |
37 | global $datenbanktabellen; |
37 | global $datenbanktabellen; |
38 | global $mysql_zugangsdaten; |
38 | global $mysql_zugangsdaten; |
39 | global $benutzer; |
39 | global $benutzer; |
40 | 40 | ||
41 | if (is_searchable($table)) |
41 | if (is_searchable($table)) |
42 | { |
42 | { |
43 | // Mode 0: a b c --> %a b c% |
43 | // Mode 0: a b c --> %a b c% |
44 | if ($mode == 0) |
44 | if ($mode == 0) |
45 | { |
45 | { |
46 | $que = "SELECT `id` FROM `".$mysql_zugangsdaten['praefix'].db_escape($table)."` WHERE ("; |
46 | $que = "SELECT `id` FROM `".$mysql_zugangsdaten['praefix'].db_escape($table)."` WHERE ("; |
47 | 47 | ||
48 | foreach ($datenbanktabellen[$mysql_zugangsdaten['praefix'].$table] as $m1 => $m2) |
48 | foreach ($datenbanktabellen[$mysql_zugangsdaten['praefix'].$table] as $m1 => $m2) |
49 | { |
49 | { |
50 | if (($m1 != 'id') && ($m1 != 'user') && ($m1 != 'folder')) |
50 | if (($m1 != 'id') && ($m1 != 'user') && ($m1 != 'folder')) |
51 | { |
51 | { |
52 | $que .= "`$m1` LIKE '%".db_escape($suchbegriff)."%' OR "; |
52 | $que .= "`$m1` LIKE '%".db_escape($suchbegriff)."%' OR "; |
53 | } |
53 | } |
54 | } |
54 | } |
55 | 55 | ||
56 | unset($m1); |
56 | unset($m1); |
57 | unset($m2); |
57 | unset($m2); |
58 | 58 | ||
59 | $que = substr($que, 0, strlen($que)-4).") AND `user` = '".$benutzer['id']."'"; |
59 | $que = substr($que, 0, strlen($que)-4).") AND `user` = '".$benutzer['id']."'"; |
60 | if ($append != '') $que .= ' '.$append; |
60 | if ($append != '') $que .= ' '.$append; |
61 | return $que; |
61 | return $que; |
62 | } |
62 | } |
63 | else |
63 | else |
64 | { |
64 | { |
65 | return false; |
65 | return false; |
66 | } |
66 | } |
67 | } |
67 | } |
68 | else |
68 | else |
69 | { |
69 | { |
70 | return false; |
70 | return false; |
71 | } |
71 | } |
72 | } |
72 | } |
73 | 73 | ||
74 | ?> |
74 | ?> |
75 | 75 |