1
|
<?php
|
2
|
|
3
|
// $Id: frontend.functions.php 1166 2009-10-12 16:54:26Z Luisehahne $
|
4
|
|
5
|
/*
|
6
|
|
7
|
Website Baker Project <http://www.websitebaker.org/>
|
8
|
Copyright (C) 2004-2009, Ryan Djurovich
|
9
|
|
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
|
/*
|
27
|
This file is purely for ensuring compatibility with 3rd party
|
28
|
contributions made for WB version 2.5.2 or below
|
29
|
*/
|
30
|
if(!defined('WB_URL')) {
|
31
|
header('Location: ../index.php');
|
32
|
exit(0);
|
33
|
}
|
34
|
|
35
|
// references to objects and variables that changed their names
|
36
|
|
37
|
$admin = &$wb;
|
38
|
|
39
|
$default_link=&$wb->default_link;
|
40
|
|
41
|
$page_trail=&$wb->page_trail;
|
42
|
$page_description=&$wb->page_description;
|
43
|
$page_keywords=&$wb->page_keywords;
|
44
|
$page_link=&$wb->link;
|
45
|
|
46
|
// extra_sql is not used anymore - this is basically a register_globals exploit prevention...
|
47
|
$extra_sql=&$wb->extra_sql;
|
48
|
$extra_where_sql=&$wb->extra_where_sql;
|
49
|
|
50
|
$include_head_link_css = '';
|
51
|
$include_body_links = '';
|
52
|
$include_head_links = '';
|
53
|
|
54
|
$query="SELECT directory FROM ".TABLE_PREFIX."addons WHERE type = 'module' AND function = 'snippet'";
|
55
|
$query_result=$database->query($query);
|
56
|
if ($query_result->numRows()>0) {
|
57
|
while ($row = $query_result->fetchRow()) {
|
58
|
$module_dir = $row['directory'];
|
59
|
if (file_exists(WB_PATH.'/modules/'.$module_dir.'/include.php')) {
|
60
|
include(WB_PATH.'/modules/'.$module_dir.'/include.php');
|
61
|
/* check if frontend.css file needs to be included into the <head></head> of index.php
|
62
|
*/
|
63
|
if( file_exists(WB_PATH .'/modules/'.$module_dir.'/frontend.css')) {
|
64
|
$include_head_link_css .= '<link href="'.WB_URL.'/modules/'.$module_dir.'/frontend.css"';
|
65
|
$include_head_link_css .= ' rel="stylesheet" type="text/css" media="screen" />'."\n";
|
66
|
$include_head_file = 'frontend.css';
|
67
|
}
|
68
|
// check if frontend.js file needs to be included into the <body></body> of index.php
|
69
|
if(file_exists(WB_PATH .'/modules/'.$module_dir.'/frontend.js')) {
|
70
|
$include_head_links .= '<script src="'.WB_URL.'/modules/'.$module_dir.'/frontend.js" type="text/javascript"></script>'."\n";
|
71
|
$include_head_file = 'frontend.js';
|
72
|
}
|
73
|
// check if frontend_body.js file needs to be included into the <body></body> of index.php
|
74
|
if(file_exists(WB_PATH .'/modules/'.$module_dir.'/frontend_body.js')) {
|
75
|
$include_body_links .= '<script src="'.WB_URL.'/modules/'.$module_dir.'/frontend_body.js" type="text/javascript"></script>'."\n";
|
76
|
$include_body_file = 'frontend_body.js';
|
77
|
}
|
78
|
}
|
79
|
}
|
80
|
}
|
81
|
|
82
|
// Frontend functions
|
83
|
if (!function_exists('page_link')) {
|
84
|
function page_link($link) {
|
85
|
global $wb;
|
86
|
return $wb->page_link($link);
|
87
|
}
|
88
|
}
|
89
|
|
90
|
//function to highlight search results
|
91
|
if(!function_exists('search_highlight')) {
|
92
|
function search_highlight($foo='', $arr_string=array()) {
|
93
|
require_once(WB_PATH.'/framework/functions.php');
|
94
|
static $string_ul_umlaut = FALSE;
|
95
|
static $string_ul_regex = FALSE;
|
96
|
if($string_ul_umlaut===FALSE || $string_ul_regex===FALSE)
|
97
|
require(WB_PATH.'/search/search_convert.php');
|
98
|
$foo = entities_to_umlauts($foo, 'UTF-8');
|
99
|
array_walk($arr_string, create_function('&$v,$k','$v = preg_quote($v, \'~\');'));
|
100
|
$search_string = implode("|", $arr_string);
|
101
|
$string = str_replace($string_ul_umlaut, $string_ul_regex, $search_string);
|
102
|
// the highlighting
|
103
|
// match $string, but not inside <style>...</style>, <script>...</script>, <!--...--> or HTML-Tags
|
104
|
// split $string into pieces - "cut away" styles, scripts, comments, HTML-tags and eMail-addresses
|
105
|
// we have to cut <pre> and <code> as well.
|
106
|
// for HTML-Tags use <(?:[^<]|<.*>)*> which will match strings like <input ... value="<b>value</b>" >
|
107
|
$matches = preg_split("~(<style.*</style>|<script.*</script>|<pre.*</pre>|<code.*</code>|<!--.*-->|<(?:[^<]|<.*>)*>|\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,8}\b)~iUs",$foo,-1,(PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY));
|
108
|
if(is_array($matches) && $matches != array()) {
|
109
|
$foo = "";
|
110
|
foreach($matches as $match) {
|
111
|
if($match{0}!="<" && !preg_match('/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,8}$/i', $match)) {
|
112
|
$match = str_replace(array('<', '>', '&', '"', ''', ' '), array('<', '>', '&', '"', '\'', "\xC2\xA0"), $match);
|
113
|
$match = preg_replace('~('.$string.')~ui', '_span class=_highlight__$1_/span_',$match);
|
114
|
$match = str_replace(array('&', '<', '>', '"', '\'', "\xC2\xA0"), array('&', '<', '>', '"', ''', ' '), $match);
|
115
|
$match = str_replace(array('_span class=_highlight__', '_/span_'), array('<span class="highlight">', '</span>'), $match);
|
116
|
}
|
117
|
$foo .= $match;
|
118
|
}
|
119
|
}
|
120
|
|
121
|
if(DEFAULT_CHARSET != 'utf-8') {
|
122
|
$foo = umlauts_to_entities($foo, 'UTF-8');
|
123
|
}
|
124
|
return $foo;
|
125
|
}
|
126
|
}
|
127
|
|
128
|
// Old menu call invokes new menu function
|
129
|
if (!function_exists('page_menu')) {
|
130
|
function page_menu($parent = 0, $menu_number = 1, $item_template = '<li[class]>[a] [menu_title] [/a]</li>', $menu_header = '<ul>', $menu_footer = '</ul>', $default_class = ' class="menu_default"', $current_class = ' class="menu_current"', $recurse = LEVEL) {
|
131
|
global $wb;
|
132
|
$wb->menu_number=$menu_number;
|
133
|
$wb->menu_item_template=$item_template;
|
134
|
$wb->menu_item_footer='';
|
135
|
$wb->menu_parent = $parent;
|
136
|
$wb->menu_header = $menu_header;
|
137
|
$wb->menu_footer = $menu_footer;
|
138
|
$wb->menu_default_class = $default_class;
|
139
|
$wb->menu_current_class = $current_class;
|
140
|
$wb->menu_recurse = $recurse+2;
|
141
|
$wb->menu();
|
142
|
unset($wb->menu_parent);
|
143
|
unset($wb->menu_number);
|
144
|
unset($wb->menu_item_template);
|
145
|
unset($wb->menu_item_footer);
|
146
|
unset($wb->menu_header);
|
147
|
unset($wb->menu_footer);
|
148
|
unset($wb->menu_default_class);
|
149
|
unset($wb->menu_current_class);
|
150
|
unset($wb->menu_start_level);
|
151
|
unset($wb->menu_collapse);
|
152
|
unset($wb->menu_recurse);
|
153
|
}
|
154
|
}
|
155
|
|
156
|
if (!function_exists('show_menu')) {
|
157
|
function show_menu($menu_number = NULL, $start_level=NULL, $recurse = NULL, $collapse = NULL, $item_template = NULL, $item_footer = NULL, $menu_header = NULL, $menu_footer = NULL, $default_class = NULL, $current_class = NULL, $parent = NULL) {
|
158
|
global $wb;
|
159
|
if (isset($menu_number))
|
160
|
$wb->menu_number=$menu_number;
|
161
|
if (isset($start_level))
|
162
|
$wb->menu_start_level=$start_level;
|
163
|
if (isset($recurse))
|
164
|
$wb->menu_recurse=$recurse;
|
165
|
if (isset($collapse))
|
166
|
$wb->menu_collapse=$collapse;
|
167
|
if (isset($item_template))
|
168
|
$wb->menu_item_template=$item_template;
|
169
|
if (isset($item_footer))
|
170
|
$wb->menu_item_footer=$item_footer;
|
171
|
if (isset($menu_header))
|
172
|
$wb->menu_header=$menu_header;
|
173
|
if (isset($menu_footer))
|
174
|
$wb->menu_footer=$menu_footer;
|
175
|
if (isset($default_class))
|
176
|
$wb->menu_default_class=$default_class;
|
177
|
if (isset($current_class))
|
178
|
$wb->menu_current_class=$current_class;
|
179
|
if (isset($parent))
|
180
|
$wb->menu_parent=$parent;
|
181
|
$wb->menu();
|
182
|
unset($wb->menu_recurse);
|
183
|
unset($wb->menu_parent);
|
184
|
unset($wb->menu_start_level);
|
185
|
}
|
186
|
}
|
187
|
|
188
|
if (!function_exists('page_content')) {
|
189
|
function page_content($block = 1) {
|
190
|
// Get outside objects
|
191
|
global $TEXT,$MENU,$HEADING,$MESSAGE;
|
192
|
global $globals;
|
193
|
global $database;
|
194
|
global $wb;
|
195
|
$admin = & $wb;
|
196
|
if ($wb->page_access_denied==true) {
|
197
|
echo $MESSAGE['FRONTEND']['SORRY_NO_VIEWING_PERMISSIONS'];
|
198
|
exit();
|
199
|
}
|
200
|
if ($wb->page_no_active_sections==true) {
|
201
|
echo $MESSAGE['FRONTEND']['SORRY_NO_ACTIVE_SECTIONS'];
|
202
|
exit();
|
203
|
}
|
204
|
if(isset($globals) AND is_array($globals)) { foreach($globals AS $global_name) { global $$global_name; } }
|
205
|
// Make sure block is numeric
|
206
|
if(!is_numeric($block)) { $block = 1; }
|
207
|
// Include page content
|
208
|
if(!defined('PAGE_CONTENT') OR $block!=1) {
|
209
|
$page_id=$wb->page_id;
|
210
|
// First get all sections for this page
|
211
|
$query_sections = $database->query("SELECT section_id,module,publ_start,publ_end FROM ".TABLE_PREFIX."sections WHERE page_id = '".$page_id."' AND block = '$block' ORDER BY position");
|
212
|
// If none were found, check if default content is supposed to be shown
|
213
|
if($query_sections->numRows() == 0) {
|
214
|
if ($wb->default_block_content=='none') {
|
215
|
return;
|
216
|
}
|
217
|
if (is_numeric($wb->default_block_content)) {
|
218
|
$page_id=$wb->default_block_content;
|
219
|
} else {
|
220
|
$page_id=$wb->default_page_id;
|
221
|
}
|
222
|
$query_sections = $database->query("SELECT section_id,module,publ_start,publ_end FROM ".TABLE_PREFIX."sections WHERE page_id = '".$page_id."' AND block = '$block' ORDER BY position");
|
223
|
// Still no cotent found? Give it up, there's just nothing to show!
|
224
|
if($query_sections->numRows() == 0) {
|
225
|
return;
|
226
|
}
|
227
|
}
|
228
|
// Loop through them and include their module file
|
229
|
while($section = $query_sections->fetchRow()) {
|
230
|
// skip this section if it is out of publication-date
|
231
|
$now = time();
|
232
|
if( !(($now<=$section['publ_end'] || $section['publ_end']==0) && ($now>=$section['publ_start'] || $section['publ_start']==0)) ) {
|
233
|
continue;
|
234
|
}
|
235
|
$section_id = $section['section_id'];
|
236
|
$module = $section['module'];
|
237
|
// make a anchor for every section.
|
238
|
if(defined('SEC_ANCHOR') && SEC_ANCHOR!='') {
|
239
|
echo '<a class="section_anchor" id="'.SEC_ANCHOR.$section_id.'" name="'.SEC_ANCHOR.$section_id.'"></a>';
|
240
|
}
|
241
|
|
242
|
// fetch content -- this is where to place possible output-filters (before highlighting)
|
243
|
ob_start(); // fetch original content
|
244
|
require(WB_PATH.'/modules/'.$module.'/view.php');
|
245
|
$content = ob_get_contents();
|
246
|
ob_end_clean();
|
247
|
|
248
|
// highlights searchresults
|
249
|
if(isset($_GET['searchresult']) && is_numeric($_GET['searchresult']) && !isset($_GET['nohighlight']) && isset($_GET['sstring']) && !empty($_GET['sstring'])) {
|
250
|
$arr_string = explode(" ", $_GET['sstring']);
|
251
|
if($_GET['searchresult']==2) { // exact match
|
252
|
$arr_string[0] = str_replace("_", " ", $arr_string[0]);
|
253
|
}
|
254
|
echo search_highlight($content, $arr_string);
|
255
|
} else {
|
256
|
echo $content;
|
257
|
}
|
258
|
}
|
259
|
} else {
|
260
|
require(PAGE_CONTENT);
|
261
|
}
|
262
|
}
|
263
|
}
|
264
|
|
265
|
if (!function_exists('show_content')) {
|
266
|
function show_content($block=1) {
|
267
|
page_content($block);
|
268
|
}
|
269
|
}
|
270
|
|
271
|
if (!function_exists('show_breadcrumbs'))
|
272
|
{
|
273
|
function show_breadcrumbs($sep=' » ',$tier=1,$links=true,$depth=-1, $title='You are here: ')
|
274
|
{
|
275
|
global $wb;
|
276
|
$page_id=$wb->page_id;
|
277
|
if ($page_id!=0)
|
278
|
{
|
279
|
global $database;
|
280
|
$bca=$wb->page_trail;
|
281
|
$counter=0;
|
282
|
print '<div class="breadcrumb">'.$title;
|
283
|
|
284
|
foreach ($bca as $temp)
|
285
|
{
|
286
|
if ($counter>=($tier-1) AND ($depth<0 OR $tier+$depth>$counter))
|
287
|
{
|
288
|
if ($counter>=$tier) print '<span class="separator">'.$sep.'</span>';
|
289
|
$query_menu=$database->query("SELECT menu_title,link FROM ".TABLE_PREFIX."pages WHERE page_id=$temp");
|
290
|
$page=$query_menu->fetchRow();
|
291
|
if ($links==true AND $temp!=$page_id)
|
292
|
{
|
293
|
print '<a href="'.page_link($page['link']).'">'.$page['menu_title'].'</a>';
|
294
|
}
|
295
|
else
|
296
|
{
|
297
|
print '<span>'.$page['menu_title'].'</span>';
|
298
|
}
|
299
|
}
|
300
|
$counter++;
|
301
|
}
|
302
|
print "</div>\n";
|
303
|
}
|
304
|
}
|
305
|
}
|
306
|
|
307
|
// Function for page title
|
308
|
if (!function_exists('page_title')) {
|
309
|
function page_title($spacer = ' - ', $template = '[WEBSITE_TITLE][SPACER][PAGE_TITLE]') {
|
310
|
$vars = array('[WEBSITE_TITLE]', '[PAGE_TITLE]', '[MENU_TITLE]', '[SPACER]');
|
311
|
$values = array(WEBSITE_TITLE, PAGE_TITLE, MENU_TITLE, $spacer);
|
312
|
echo str_replace($vars, $values, $template);
|
313
|
}
|
314
|
}
|
315
|
|
316
|
// Function for page description
|
317
|
if (!function_exists('page_description')) {
|
318
|
function page_description() {
|
319
|
global $wb;
|
320
|
if ($wb->page_description!='') {
|
321
|
echo $wb->page_description;
|
322
|
} else {
|
323
|
echo WEBSITE_DESCRIPTION;
|
324
|
}
|
325
|
}
|
326
|
}
|
327
|
|
328
|
// Function for page keywords
|
329
|
if (!function_exists('page_keywords')) {
|
330
|
function page_keywords() {
|
331
|
global $wb;
|
332
|
if ($wb->page_keywords!='') {
|
333
|
echo $wb->page_keywords;
|
334
|
} else {
|
335
|
echo WEBSITE_KEYWORDS;
|
336
|
}
|
337
|
}
|
338
|
}
|
339
|
|
340
|
// Function for page header
|
341
|
if (!function_exists('page_header')) {
|
342
|
function page_header($date_format = 'Y') {
|
343
|
echo WEBSITE_HEADER;
|
344
|
}
|
345
|
}
|
346
|
|
347
|
// Function for page footer
|
348
|
if (!function_exists('page_footer')) {
|
349
|
function page_footer($date_format = 'Y') {
|
350
|
global $starttime;
|
351
|
$vars = array('[YEAR]', '[PROCESS_TIME]');
|
352
|
$processtime=array_sum(explode(" ",microtime()))-$starttime;
|
353
|
$values = array(gmdate($date_format),$processtime);
|
354
|
echo str_replace($vars, $values, WEBSITE_FOOTER);
|
355
|
}
|
356
|
}
|
357
|
|
358
|
// Function to add optional module Javascript into the <body> section of the frontend
|
359
|
if(!function_exists('register_frontend_modfiles_body')) {
|
360
|
function register_frontend_modfiles_body($file_id="js") {
|
361
|
// sanity check of parameter passed to the function
|
362
|
$file_id = strtolower($file_id);
|
363
|
if($file_id !== "css" && $file_id !== "javascript" && $file_id !== "js") {
|
364
|
return;
|
365
|
}
|
366
|
|
367
|
global $wb, $database, $include_body_links;
|
368
|
// define default baselink and filename for optional module javascript files
|
369
|
$body_links = "";
|
370
|
$base_link = '<script src="'.WB_URL.'/modules/{MODULE_DIRECTORY}/frontend_body.js" type="text/javascript"></script>';
|
371
|
$base_file = "frontend_body.js";
|
372
|
|
373
|
if(!empty($include_body_links)) {
|
374
|
if(strpos($body_links, $include_body_links) === false) {
|
375
|
$body_links .= $include_body_links;
|
376
|
}
|
377
|
$include_body_links = '';
|
378
|
}
|
379
|
|
380
|
// gather information for all models embedded on actual page
|
381
|
$page_id = $wb->page_id;
|
382
|
$query_modules = $database->query("SELECT module FROM " .TABLE_PREFIX ."sections
|
383
|
WHERE page_id=$page_id AND module<>'wysiwyg'");
|
384
|
|
385
|
while($row = $query_modules->fetchRow()) {
|
386
|
// check if page module directory contains a frontend_body.js file
|
387
|
if(file_exists(WB_PATH ."/modules/" .$row['module'] ."/$base_file")) {
|
388
|
// create link with frontend_body.js source for the current module
|
389
|
$tmp_link = str_replace("{MODULE_DIRECTORY}", $row['module'], $base_link);
|
390
|
|
391
|
// define constant indicating that the register_frontent_files was invoked
|
392
|
if(!defined('MOD_FRONTEND_BODY_JAVASCRIPT_REGISTERED')) define('MOD_FRONTEND_BODY_JAVASCRIPT_REGISTERED', true);
|
393
|
|
394
|
// ensure that frontend_body.js is only added once per module type
|
395
|
if(strpos($body_links, $tmp_link) === false) {
|
396
|
$body_links .= $tmp_link ."\n";
|
397
|
}
|
398
|
};
|
399
|
}
|
400
|
|
401
|
/* include the Javascript email protection function
|
402
|
if( $file_id != 'css' && file_exists(WB_PATH .'/modules/droplets/js/mdcr.js')) {
|
403
|
$body_links .= '<script type="text/javascript" src="'.WB_URL.'/modules/droplets/js/mdcr.js"></script>'."\n";
|
404
|
} elseif( $file_id != 'css' && file_exists(WB_PATH .'/modules/output_filter/js/mdcr.js')) {
|
405
|
$body_links .= '<script type="text/javascript" src="'.WB_URL.'/modules/output_filter/js/mdcr.js"></script>'."\n";
|
406
|
} */
|
407
|
echo $body_links;
|
408
|
}
|
409
|
}
|
410
|
|
411
|
|
412
|
// Function to add optional module Javascript or CSS stylesheets into the <head> section of the frontend
|
413
|
if(!function_exists('register_frontend_modfiles')) {
|
414
|
function register_frontend_modfiles($file_id="css") {
|
415
|
// sanity check of parameter passed to the function
|
416
|
$file_id = strtolower($file_id);
|
417
|
if($file_id !== "css" && $file_id !== "javascript" && $file_id !== "js") {
|
418
|
return;
|
419
|
}
|
420
|
|
421
|
global $wb, $database, $include_head_link_css, $include_head_links;
|
422
|
// define default baselink and filename for optional module javascript and stylesheet files
|
423
|
$head_links = "";
|
424
|
|
425
|
if($file_id == "css") {
|
426
|
$base_link = '<link href="'.WB_URL.'/modules/{MODULE_DIRECTORY}/frontend.css"';
|
427
|
$base_link.= ' rel="stylesheet" type="text/css" media="screen" />';
|
428
|
$base_file = "frontend.css";
|
429
|
} else {
|
430
|
$base_link = '<script src="'.WB_URL.'/modules/{MODULE_DIRECTORY}/frontend.js" type="text/javascript"></script>';
|
431
|
$base_file = "frontend.js";
|
432
|
}
|
433
|
|
434
|
if(!empty($include_head_link_css)) {
|
435
|
if(strpos($head_links, $include_head_link_css) === false) {
|
436
|
$head_links .= $include_head_link_css;
|
437
|
}
|
438
|
$include_head_link_css = '';
|
439
|
} else {
|
440
|
if(!empty($include_head_links)) {
|
441
|
if(strpos($head_links, $include_head_links) === false) {
|
442
|
$head_links .= $include_head_links;
|
443
|
}
|
444
|
$include_head_links = '';
|
445
|
}
|
446
|
}
|
447
|
|
448
|
// gather information for all models embedded on actual page
|
449
|
$page_id = $wb->page_id;
|
450
|
$query_modules = $database->query("SELECT module FROM " .TABLE_PREFIX ."sections
|
451
|
WHERE page_id=$page_id AND module<>'wysiwyg'");
|
452
|
|
453
|
while($row = $query_modules->fetchRow()) {
|
454
|
// check if page module directory contains a frontend.js or frontend.css file
|
455
|
if(file_exists(WB_PATH ."/modules/" .$row['module'] ."/$base_file")) {
|
456
|
// create link with frontend.js or frontend.css source for the current module
|
457
|
$tmp_link = str_replace("{MODULE_DIRECTORY}", $row['module'], $base_link);
|
458
|
|
459
|
// define constant indicating that the register_frontent_files was invoked
|
460
|
if($file_id == 'css') {
|
461
|
if(!defined('MOD_FRONTEND_CSS_REGISTERED')) define('MOD_FRONTEND_CSS_REGISTERED', true);
|
462
|
} else {
|
463
|
if(!defined('MOD_FRONTEND_JAVASCRIPT_REGISTERED')) define('MOD_FRONTEND_JAVASCRIPT_REGISTERED', true);
|
464
|
}
|
465
|
// ensure that frontend.js or frontend.css is only added once per module type
|
466
|
if(strpos($head_links, $tmp_link) === false) {
|
467
|
$head_links .= $tmp_link ."\n";
|
468
|
}
|
469
|
};
|
470
|
}
|
471
|
|
472
|
// include the Javascript email protection function
|
473
|
if( $file_id != 'css' && file_exists(WB_PATH .'/modules/droplets/js/mdcr.js')) {
|
474
|
$head_links .= '<script type="text/javascript" src="'.WB_URL.'/modules/droplets/js/mdcr.js"></script>'."\n";
|
475
|
} elseif( $file_id != 'css' && file_exists(WB_PATH .'/modules/output_filter/js/mdcr.js')) {
|
476
|
$head_links .= '<script type="text/javascript" src="'.WB_URL.'/modules/output_filter/js/mdcr.js"></script>'."\n";
|
477
|
}
|
478
|
echo $head_links;
|
479
|
}
|
480
|
}
|
481
|
|
482
|
// Begin WB < 2.4.x template compatibility code
|
483
|
// Make extra_sql accessable through private_sql
|
484
|
$private_sql = $extra_sql;
|
485
|
$private_where_sql = $extra_where_sql;
|
486
|
// Query pages for menu
|
487
|
$menu1 = $database->query("SELECT page_id,menu_title,page_title,link,target,visibility$extra_sql FROM ".TABLE_PREFIX."pages WHERE parent = '0' AND $extra_where_sql ORDER BY position ASC");
|
488
|
// Check if current pages is a parent page and if we need its submenu
|
489
|
if(PARENT == 0) {
|
490
|
// Get the pages submenu
|
491
|
$menu2 = $database->query("SELECT page_id,menu_title,page_title,link,target,visibility$extra_sql FROM ".TABLE_PREFIX."pages WHERE parent = '".PAGE_ID."' AND $extra_where_sql ORDER BY position ASC");
|
492
|
} else {
|
493
|
// Get the pages submenu
|
494
|
$menu2 = $database->query("SELECT page_id,menu_title,page_title,link,target,visibility$extra_sql FROM ".TABLE_PREFIX."pages WHERE parent = '".PARENT."' AND $extra_where_sql ORDER BY position ASC");
|
495
|
}
|
496
|
// End WB < 2.4.x template compatibility code
|
497
|
// Include template file
|
498
|
|
499
|
|
500
|
?>
|