-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsearch.php
89 lines (67 loc) · 2.96 KB
/
search.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<?php
/*
Website Baker Project <http://www.websitebaker.org/>
Copyright (C) 2004-2008, Ryan Djurovich
Website Baker is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Website Baker is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Website Baker; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
//require('functions.php');
function procalendar_search($func_vars) {
extract($func_vars, EXTR_PREFIX_ALL, 'func');
// how many lines of excerpt we want to have at most
$max_excerpt_num = $func_default_max_excerpt;
$divider = ".";
$result = false;
// Set start- and end date for query
$year = date('Y', time());
$month = date('n', time());
$datestart = "$year-$month-1";
$dateend = "$year-$month-".cal_days_in_month(CAL_GREGORIAN, $month,$year);
$table = TABLE_PREFIX."mod_procalendar_actions";
$query = $func_database->query("
SELECT *
FROM $table
WHERE section_id='$func_section_id'
AND date_start <='$dateend' AND date_end >='$datestart' AND public_stat = 0
");
$PageName = $func_page_title;
if($query->numRows() > 0)
{
while($res = $query->fetchRow())
{
$text = "";
$text .= $res['name'].$divider.$res['description'].$divider; // Default search: only the WYSIWYG-fields
//$text .= $res['name'].$divider.$res['description'].$divider.$res['custom1'].$divider.$res['custom2'].$divider.$res['custom3'].$divider;
// Use the line above to add 1, 2 or 3 Custom fields to the search
$func_page_title = $PageName.":<br/>".$res['name'];
$link = "&page_id=".$res['page_id']."&id=".$res['id']."&detail=1";
//$func_page_description = "func_page_description is not used";
$mod_vars = array
(
'page_link' => $func_page_link,
'page_link_target' => $link,
'page_title' => $func_page_title,
'page_description' => $func_page_description,
'page_modified_when' => $func_page_modified_when,
'page_modified_by' => $func_page_modified_by,
'text' => $text,
'max_excerpt_num' => $max_excerpt_num
);
if(print_excerpt2($mod_vars, $func_vars))
{
$result = true;
}
}
}
return $result;
}
?>