Project

General

Profile

1 552 thorn
<?php
2
3 554 Ruebenwurz
// $Id$
4 552 thorn
5
/*
6
7
 Website Baker Project <http://www.websitebaker.org/>
8 915 Ruebenwurz
 Copyright (C) 2004-2009, Ryan Djurovich
9 552 thorn
10
 Website Baker is free software; you can redistribute it and/or modify
11
 it under the terms of the GNU General Public License as published by
12
 the Free Software Foundation; either version 2 of the License, or
13
 (at your option) any later version.
14
15
 Website Baker is distributed in the hope that it will be useful,
16
 but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
 GNU General Public License for more details.
19
20
 You should have received a copy of the GNU General Public License
21
 along with Website Baker; if not, write to the Free Software
22
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
23
24
*/
25
26
function wysiwyg_search($func_vars) {
27
	extract($func_vars, EXTR_PREFIX_ALL, 'func');
28
29
	// how many lines of excerpt we want to have at most
30
	$max_excerpt_num = $func_default_max_excerpt;
31
	$divider = ".";
32
	$result = false;
33
34
	// we have to get 'content' instead of 'text', because strip_tags() dosen't remove scripting well.
35
	// scripting will be removed later on automatically
36
	$table = TABLE_PREFIX."mod_wysiwyg";
37
	$query = $func_database->query("
38
		SELECT content
39
		FROM $table
40
		WHERE section_id='$func_section_id'
41
	");
42
43
	if($query->numRows() > 0) {
44
		if($res = $query->fetchRow()) {
45
			$mod_vars = array(
46
				'page_link' => $func_page_link,
47
				'page_link_target' => "#wb_section_$func_section_id",
48
				'page_title' => $func_page_title,
49
				'page_description' => $func_page_description,
50
				'page_modified_when' => $func_page_modified_when,
51
				'page_modified_by' => $func_page_modified_by,
52
				'text' => $res['content'].$divider,
53
				'max_excerpt_num' => $max_excerpt_num
54
			);
55
			if(print_excerpt2($mod_vars, $func_vars)) {
56
				$result = true;
57
			}
58
		}
59
	}
60
	return $result;
61
}
62
63
?>