Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1 | daniel-mar | 1 | <?php |
2 | |||
3 | if (!defined('WBLEGAL')) die('Kann nicht ohne Personal WebBase ausgeführt werden.'); |
||
4 | |||
5 | function show_modul_search($modul, $seite) |
||
6 | { |
||
7 | global $suchbegriff; |
||
8 | |||
9 | if (!isset($suchbegriff)) $suchbegriff = ''; |
||
10 | |||
11 | echo '<form method="POST" name="mainform" action="'.$_SERVER['PHP_SELF'].'"> |
||
12 | <input type="hidden" name="seite" value="'.$seite.'"> |
||
13 | <input type="hidden" name="modul" value="'.$modul.'"> |
||
14 | |||
15 | <div align="center"><table cellspacing="0" cellpadding="2" border="0" width="90%"> |
||
16 | <tr> |
||
17 | <td align="left" width="50%" valign="bottom">'; |
||
18 | |||
19 | if ($suchbegriff != '') |
||
20 | echo 'Einträge mit Suchbegriff "'.$suchbegriff.'" sind <span class="red">hervorgehoben</span>.'; |
||
21 | else |
||
22 | echo ' '; |
||
23 | |||
24 | echo '</td> |
||
25 | <td align="right" valign="middle"> |
||
26 | |||
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"> |
||
29 | |||
30 | </td></tr></table></div> |
||
31 | |||
32 | </form>'; |
||
33 | } |
||
34 | |||
35 | function generate_search_query($table, $mode, $suchbegriff, $append = '') |
||
36 | { |
||
37 | global $tables_database; |
||
38 | global $WBConfig; |
||
39 | global $benutzer; |
||
40 | |||
41 | if (is_searchable($table)) |
||
42 | { |
||
43 | // Mode 0: a b c --> %a b c% |
||
44 | if ($mode == 0) |
||
45 | { |
||
46 | $que = "SELECT `id` FROM `".$WBConfig->getMySQLPrefix().db_escape($table)."` WHERE ("; |
||
47 | |||
48 | foreach ($tables_database[$WBConfig->getMySQLPrefix().$table] as $m1 => $m2) |
||
49 | { |
||
50 | if (($m1 != 'id') && ($m1 != 'user_cnid') && ($m1 != 'folder_cnid')) |
||
51 | { |
||
52 | $que .= "`$m1` LIKE '%".db_escape($suchbegriff)."%' OR "; |
||
53 | } |
||
54 | } |
||
55 | |||
56 | unset($m1); |
||
57 | unset($m2); |
||
58 | |||
59 | $que = substr($que, 0, strlen($que)-4).") AND `user_cnid` = '".$benutzer['id']."'"; |
||
60 | if ($append != '') $que .= ' '.$append; |
||
61 | return $que; |
||
62 | } |
||
63 | else |
||
64 | { |
||
65 | return false; |
||
66 | } |
||
67 | } |
||
68 | else |
||
69 | { |
||
70 | return false; |
||
71 | } |
||
72 | } |
||
73 | |||
74 | ?> |