Revision 1740
Added by Dietmar about 12 years ago
frontend.functions.php | ||
---|---|---|
240 | 240 |
* @param boolean true to print $content, false return $content |
241 | 241 |
* @return void |
242 | 242 |
*/ |
243 |
function page_content($block = 1, $echo=true) {
|
|
243 |
function page_content($block = 1) { |
|
244 | 244 |
// Get outside objects |
245 | 245 |
global $TEXT,$MENU,$HEADING,$MESSAGE; |
246 | 246 |
global $globals; |
247 | 247 |
global $database; |
248 | 248 |
global $wb; |
249 | 249 |
$admin = $wb; |
250 |
$retVal = ''; |
|
250 | 251 |
if ($wb->page_access_denied==true) { |
251 | 252 |
echo $MESSAGE['FRONTEND_SORRY_NO_VIEWING_PERMISSIONS']; |
252 | 253 |
return; |
... | ... | |
266 | 267 |
if(!defined('PAGE_CONTENT') OR $block!=1) |
267 | 268 |
{ |
268 | 269 |
$page_id = intval($wb->page_id); |
269 |
/* move to class.frontend |
|
270 |
// set session variable to save page_id only if PAGE_CONTENT is empty |
|
271 |
$_SESSION['PAGE_ID'] = !isset($_SESSION['PAGE_ID']) ? $page_id : $_SESSION['PAGE_ID']; |
|
272 |
// set to new value if page_id changed and not 0 |
|
273 |
if(($page_id != 0) && ($_SESSION['PAGE_ID'] <> $page_id)) |
|
274 |
{ |
|
275 |
$_SESSION['PAGE_ID'] = $page_id; |
|
276 |
} |
|
277 |
*/ |
|
270 |
|
|
278 | 271 |
// First get all sections for this page |
279 | 272 |
$sql = 'SELECT `section_id`, `module`, `publ_start`, `publ_end` '; |
280 | 273 |
$sql .= 'FROM `'.TABLE_PREFIX.'sections` '; |
281 | 274 |
$sql .= 'WHERE `page_id`='.$page_id.' AND `block`='.$block.' '; |
282 | 275 |
$sql .= 'ORDER BY `position`'; |
283 |
if( !($query_sections = $database->query($sql)) ) { return; }
|
|
276 |
if( !($oSections = $database->query($sql)) ) { return; }
|
|
284 | 277 |
// If none were found, check if default content is supposed to be shown |
285 |
if($query_sections->numRows() == 0) {
|
|
278 |
if($oSections->numRows() == 0) {
|
|
286 | 279 |
if($wb->default_block_content == 'none') { return; } |
287 | 280 |
if (is_numeric($wb->default_block_content)) { |
288 | 281 |
$page_id = $wb->default_block_content; |
289 | 282 |
} else { |
290 | 283 |
$page_id = $wb->default_page_id; |
291 | 284 |
} |
285 |
|
|
292 | 286 |
$sql = 'SELECT `section_id`, `module`, `publ_start`, `publ_end` '; |
293 | 287 |
$sql .= 'FROM `'.TABLE_PREFIX.'sections` '; |
294 | 288 |
$sql .= 'WHERE `page_id`='.$page_id.' AND `block`='.$block.' '; |
295 | 289 |
$sql .= 'ORDER BY `position`'; |
296 |
if( !($query_sections = $database->query($sql)) ) { return; }
|
|
290 |
if( !($oSections = $database->query($sql)) ) { return; }
|
|
297 | 291 |
// Still no cotent found? Give it up, there's just nothing to show! |
298 |
if($query_sections->numRows() == 0) { return; }
|
|
292 |
if($oSections->numRows() == 0) { return; }
|
|
299 | 293 |
} |
294 |
|
|
300 | 295 |
// Loop through them and include their module file |
301 |
while($section = $query_sections->fetchRow()) {
|
|
296 |
while($section = $oSections->fetchRow()) {
|
|
302 | 297 |
// skip this section if it is out of publication-date |
303 | 298 |
$now = time(); |
304 | 299 |
if( !(($now<=$section['publ_end'] || $section['publ_end']==0) && ($now>=$section['publ_start'] || $section['publ_start']==0)) ) { |
... | ... | |
306 | 301 |
} |
307 | 302 |
$section_id = $section['section_id']; |
308 | 303 |
$module = $section['module']; |
309 |
// make a anchor for every section. |
|
310 |
if(defined('SEC_ANCHOR') && SEC_ANCHOR!='') { |
|
311 |
echo '<a class="section_anchor" id="'.SEC_ANCHOR.$section_id.'" name="'.SEC_ANCHOR.$section_id.'"></a>'; |
|
312 |
} |
|
313 | 304 |
// check if module exists - feature: write in errorlog |
314 | 305 |
if(file_exists(WB_PATH.'/modules/'.$module.'/view.php')) { |
315 | 306 |
// fetch content -- this is where to place possible output-filters (before highlighting) |
316 | 307 |
ob_start(); // fetch original content |
308 |
// make a anchor for every section |
|
309 |
if(defined('SEC_ANCHOR') && SEC_ANCHOR!='') { |
|
310 |
echo "\n".'<a class="section_anchor" id="'.SEC_ANCHOR.$section_id.'" name="'.SEC_ANCHOR.$section_id.'"></a>'."\n"; |
|
311 |
} |
|
317 | 312 |
require(WB_PATH.'/modules/'.$module.'/view.php'); |
318 | 313 |
$content = ob_get_clean(); |
319 | 314 |
} else { |
320 | 315 |
continue; |
321 | 316 |
} |
317 |
|
|
322 | 318 |
// highlights searchresults |
323 |
if(isset($_GET['searchresult']) && is_numeric($_GET['searchresult']) && !isset($_GET['nohighlight']) && isset($_GET['sstring']) && !empty($_GET['sstring'])) { |
|
319 |
if(isset($_GET['searchresult']) && is_numeric($_GET['searchresult']) && !isset($_GET['nohighlight']) && isset($_GET['sstring']) && !empty($_GET['sstring'])) |
|
320 |
{ |
|
324 | 321 |
$arr_string = explode(" ", $_GET['sstring']); |
325 |
if($_GET['searchresult']==2) { // exact match
|
|
322 |
if($_GET['searchresult']==2) { //exact match
|
|
326 | 323 |
$arr_string[0] = str_replace("_", " ", $arr_string[0]); |
327 | 324 |
} |
328 | 325 |
echo search_highlight($content, $arr_string); |
329 |
} elseif($echo==true) {
|
|
326 |
} else { |
|
330 | 327 |
echo $content; |
331 |
} else { |
|
332 |
return $content; |
|
333 | 328 |
} |
334 | 329 |
} |
335 | 330 |
} else { |
336 | 331 |
require(PAGE_CONTENT); |
337 | 332 |
} |
333 |
return $retVal; |
|
334 |
|
|
338 | 335 |
} |
339 | 336 |
} |
340 | 337 |
|
Also available in: Unified diff
incompatible with search logic
! /include/jquery forgot jquery version.txt