$fn) { if (!isset($events[$name])) $events[$name] = array(); $events[$name][] = $fn; } } } } closedir($handle); } $db = mysql_connect($mysql_server, $mysql_username, $mysql_password); if (!$db) { die('Failed to connect to database server!
'.mysql_error()); } mysql_select_db($mysql_database, $db) or die('Failed to select database
'.mysql_error()); $id = isset($_REQUEST['page']) ? mysql_real_escape_string($_REQUEST['page']) : ''; $query = isset($_REQUEST['query']) ? $_REQUEST['query'] : ''; if (!empty($query)) { if (!get_magic_quotes_gpc()) { $query = addslashes($query); } $words = preg_split('/\s+/', $query); foreach ($words as $word) { $word = preg_replace('/\W/', '', $word); if (strlen($word) > 1) { $terms[] = $word; } } if ($terms) { if (count($terms) > 4) { array_splice($terms, 4); } $sql = "SELECT p.id, p.name, p.content FROM " . $mysql_table . "PAGES p, " . $mysql_table . "SEARCH_WORDS w, " . $mysql_table . "SEARCH_WORDMATCH m WHERE("; $where = "w.word LIKE '%" . array_shift($terms) . "%'"; while ($term = array_shift($terms)) { $where .= " OR w.word LIKE '%" . $term . "%'"; } $sql .= $where . ") AND m.word_id = w.id AND m.page_id = p.id GROUP BY p.id ORDER BY p.last_update_date DESC"; $result = mysql_query($sql) or die(mysql_error()); if ($aantal = mysql_num_rows($result)) { $cms_content .= "
    \n"; while ($data = mysql_fetch_array($result)) { $cms_content .= "
  1. " . $data['name'] . "
    "; $contents = substr(strip_tags($data['content']), 0, 200); if (strlen($contents) > 199) { $contents .= "..."; } $cms_content .= $contents; $cms_content .= "
  2. \n"; } $cms_content .= "
\n"; } else { $cms_content = $cms_no_results; } } else { $cms_content = $cms_no_results; } } else { if (!empty($id)) { if (is_numeric($id)) { $sql = "SELECT * FROM " . $mysql_table . "PAGES WHERE id = '$id'"; } else { $sql = "SELECT * FROM " . $mysql_table . "PAGES WHERE seo_friendly_url = '$id'"; } } else { $sql = "SELECT * FROM " . $mysql_table . "PAGES WHERE home = 1"; } $result = mysql_query($sql, $db); if ($result) { if ($data = mysql_fetch_array($result)) { $cms_content = ''; fireEvent('onBeforeContent', $data['id']); if (!empty($data['url'])) { $cms_content .= "\n"; } else { $cms_content .= $data['content']; } fireEvent('onAfterContent', $data['id']); fireEvent('onOverwriteContent', $data['id']); } if (empty($label)) { if (!empty($id)) { if (is_numeric($id)) { $sql = "UPDATE " . $mysql_table . "PAGES SET views=views+1 WHERE id = '$id'"; } else { $sql = "UPDATE " . $mysql_table . "PAGES SET views=views+1 WHERE seo_friendly_url = '$id'"; } } else { $sql = "UPDATE " . $mysql_table . "PAGES SET views=views+1 WHERE home = 1"; } mysql_query($sql, $db); } } } mysql_close($db); ?>
Untitled Page
         
S 17
D 18
L 19
M 20
X 21
J 22
V 23
S 24
D 25
L 26
M 27