Project

General

Profile

1
<?php
2
/**
3
 *
4
 * @category        frontend
5
 * @package         search
6
 * @author          WebsiteBaker Project
7
 * @copyright       Ryan Djurovich
8
 * @copyright       WebsiteBaker Org. e.V.
9
 * @link            http://websitebaker.org/
10
 * @license         http://www.gnu.org/licenses/gpl.html
11
 * @platform        WebsiteBaker 2.8.x
12
 * @requirements    PHP 5.2.2 and higher
13
 * @version         $Id: search.php 2 2017-07-02 15:14:29Z Manuela $
14
 * @filesource      $HeadURL: svn://isteam.dynxs.de/wb/2.10.x/branches/main/modules/wysiwyg/search.php $
15
 * @lastmodified    $Date: 2017-07-02 17:14:29 +0200 (Sun, 02 Jul 2017) $
16
 *
17
 */
18
// Must include code to stop this file being access directly
19
if(defined('WB_PATH') == false) { die("Cannot access this file directly"); }
20

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

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

    
65
?>
(9-9/11)