Project

General

Profile

1 552 thorn
<?php
2 1386 Luisehahne
/**
3
 *
4
 * @category        frontend
5
 * @package         search
6
 * @author          WebsiteBaker Project
7
 * @copyright       2004-2009, Ryan Djurovich
8
 * @copyright       2009-2011, Website Baker Org. e.V.
9
 * @link			http://www.websitebaker2.org/
10
 * @license         http://www.gnu.org/licenses/gpl.html
11 1652 Luisehahne
 * @platform        WebsiteBaker 2.8.3
12 1386 Luisehahne
 * @requirements    PHP 5.2.2 and higher
13
 * @version         $Id$
14 2070 darkviper
 * @filesource		$HeadURL$
15
 * @lastmodified    $Date$
16 1386 Luisehahne
 *
17
 */
18 1652 Luisehahne
/* -------------------------------------------------------- */
19
// Must include code to stop this file being accessed directly
20
if(!defined('WB_PATH')) {
21
	require_once(dirname(dirname(dirname(__FILE__))).'/framework/globalExceptionHandler.php');
22
	throw new IllegalFileException();
23
}
24
/* -------------------------------------------------------- */
25 552 thorn
26
function wysiwyg_search($func_vars) {
27
	extract($func_vars, EXTR_PREFIX_ALL, 'func');
28 1442 Luisehahne
	static $search_sql = FALSE;
29
	if(function_exists('search_make_sql_part')) {
30
		if($search_sql===FALSE)
31
			$search_sql = search_make_sql_part($func_search_url_array, $func_search_match, array('`content`'));
32
	} else {
33
		$search_sql = '1=1';
34
	}
35 552 thorn
36
	// how many lines of excerpt we want to have at most
37
	$max_excerpt_num = $func_default_max_excerpt;
38
	$divider = ".";
39
	$result = false;
40
41
	// we have to get 'content' instead of 'text', because strip_tags() dosen't remove scripting well.
42
	// scripting will be removed later on automatically
43
	$table = TABLE_PREFIX."mod_wysiwyg";
44
	$query = $func_database->query("
45
		SELECT content
46
		FROM $table
47
		WHERE section_id='$func_section_id'
48
	");
49
50
	if($query->numRows() > 0) {
51
		if($res = $query->fetchRow()) {
52
			$mod_vars = array(
53
				'page_link' => $func_page_link,
54
				'page_link_target' => "#wb_section_$func_section_id",
55
				'page_title' => $func_page_title,
56
				'page_description' => $func_page_description,
57
				'page_modified_when' => $func_page_modified_when,
58
				'page_modified_by' => $func_page_modified_by,
59
				'text' => $res['content'].$divider,
60
				'max_excerpt_num' => $max_excerpt_num
61
			);
62
			if(print_excerpt2($mod_vars, $func_vars)) {
63
				$result = true;
64
			}
65
		}
66
	}
67
	return $result;
68
}
69
70
?>