Project

General

Profile

1
<?php
2
/**
3
 *
4
 * @category        frontend
5
 * @package         search
6
 * @author          WebsiteBaker Project
7
 * @copyright       2009-2012, WebsiteBaker Org. e.V.
8
 * @link			http://www.websitebaker2.org/
9
 * @license         http://www.gnu.org/licenses/gpl.html
10
 * @platform        WebsiteBaker 2.8.3
11
 * @requirements    PHP 5.2.2 and higher
12
 * @version         $Id: search.php 2070 2014-01-03 01:21:42Z darkviper $
13
 * @filesource		$HeadURL: svn://isteam.dynxs.de/wb-archiv/branches/2.8.x/wb/modules/code/search.php $
14
 * @lastmodified    $Date: 2014-01-03 02:21:42 +0100 (Fri, 03 Jan 2014) $
15
 *
16
 */
17
/* -------------------------------------------------------- */
18
// Must include code to stop this file being accessed directly
19
if(!defined('WB_PATH')) {
20
	require_once(dirname(dirname(dirname(__FILE__))).'/framework/globalExceptionHandler.php');
21
	throw new IllegalFileException();
22
}
23
/* -------------------------------------------------------- */
24

    
25
function code_search($func_vars) {
26
	extract($func_vars, EXTR_PREFIX_ALL, 'func');
27
	static $search_sql = FALSE;
28
	if(function_exists('search_make_sql_part')) {
29
		if($search_sql===FALSE)
30
			$search_sql = search_make_sql_part($func_search_url_array, $func_search_match, array('`content`'));
31
	} else {
32
		$search_sql = '1=1';
33
	}
34
	
35
	// how many lines of excerpt we want to have at most
36
	$max_excerpt_num = $func_default_max_excerpt;
37
	$divider = ".";
38
	$result = false;
39
	
40
	// we have to get 'content' instead of 'text', because strip_tags() dosen't remove scripting well.
41
	// scripting will be removed later on automatically
42
	$table = TABLE_PREFIX."mod_code";
43
	$query = $func_database->query("
44
		SELECT content
45
		FROM $table
46
		WHERE section_id='$func_section_id'
47
	");
48

    
49
	if($query->numRows() > 0) {
50
		if($res = $query->fetchRow()) {
51
			$mod_vars = array(
52
				'page_link' => $func_page_link,
53
				'page_link_target' => "#wb_section_$func_section_id",
54
				'page_title' => $func_page_title,
55
				'page_description' => $func_page_description,
56
				'page_modified_when' => $func_page_modified_when,
57
				'page_modified_by' => $func_page_modified_by,
58
				'text' => $res['content'].$divider,
59
				'max_excerpt_num' => $max_excerpt_num
60
			);
61
			if(print_excerpt2($mod_vars, $func_vars)) {
62
				$result = true;
63
			}
64
		}
65
	}
66
	return $result;
67
}
(8-8/11)