Project

General

Profile

« Previous | Next » 

Revision 55

Added by stefan over 18 years ago

Removed initialize.php, moved initialization code to class wb constructor. Changed attribute no_default_content to default_block_content and changed behavior.

View differences:

class.frontend.php
41 41
	var $default_link,$default_page_id;
42 42
	// when multiple blocks are used, show home page blocks on 
43 43
	// pages where no content is defined (search, login, ...)
44
	var $no_default_content=false;
44
	var $no_default_block_content=false;
45 45

  
46 46
	// page details
47 47
	// page database row
......
64 64
	
65 65
	function page_select() {
66 66
		global $page_id,$no_intro;
67
		global $database;
67
		$database=& $this->database;
68 68
		// We have no page id and are supposed to show the intro page
69 69
		if((INTRO_PAGE AND !isset($no_intro)) AND (!isset($page_id) OR !is_numeric($page_id))) {
70 70
			// Since we have no page id check if we should go to intro page or default page
......
121 121
	}
122 122

  
123 123
	function get_page_details() {
124
		global $database;
124
		$database = & $this->database;
125 125
	    if($this->page_id != 0) {
126 126
			// Query page details
127 127
			$query_page = "SELECT * FROM ".TABLE_PREFIX."pages WHERE page_id = '{$this->page_id}'";
......
249 249
	}
250 250

  
251 251
	function get_website_settings() {
252
		global $database;
252
		$database = & $this->database;
253 253
		// Get website settings (title, keywords, description, header, and footer)
254 254
		$query_settings = "SELECT name,value FROM ".TABLE_PREFIX."settings";
255 255
		$get_settings = $database->query($query_settings);
......
297 297
	}
298 298
	
299 299
	function preprocess(&$content) {
300
		global $database;
300
		$database = & $this->database;
301 301
		// Replace [wblink--PAGE_ID--] with real link
302 302
		$pattern = '/\[wblink(.+?)\]/s';
303 303
		preg_match_all($pattern,$content,$ids);
......
360 360
	}
361 361
	
362 362
	function show_menu() {
363
	   global $database;
363
	   $database = & $this->database;
364 364
	   if ($this->menu_recurse==0)
365 365
	       return;
366 366
	   // Check if we should add menu number check to query
......
412 412

  
413 413
	function page_content($block = 1) {
414 414
		// Get outside objects
415
		global $database,$admin,$TEXT,$MENU,$HEADING,$MESSAGE;
415
		global $TEXT,$MENU,$HEADING,$MESSAGE;
416 416
		global $globals;
417
		$database = & $this->database;
418
		$admin = & $this;
417 419
		if ($this->page_access_denied==true) {
418 420
            echo $MESSAGE['FRONTEND']['SORRY_NO_VIEWING_PERMISSIONS'];
419 421
			exit();
......
423 425
		if(!is_numeric($block)) { $block = 1; }
424 426
		// Include page content
425 427
		if(!defined('PAGE_CONTENT') OR $block!=1) {
426
			if ($this->page_id==0) {
427
				if ($block != 1 AND $this->no_default_content==true) {
428
			if ($this->page_id==0) {

429
				if ($this->default_block_content=='none') {
428 430
					return;
429 431
				}
430
				$page_id=$this->default_page_id;
432
				if (is_numeric($this->default_block_content)) {
433
					$page_id=$this->default_block_content;
434
				} else {
435
					$page_id=$this->default_page-id;
436
				}				
431 437
			} else {
432 438
				$page_id=$this->page_id;
433 439
			}
......
442 448
				}
443 449
			}
444 450
		} else {
445
			if($block == 1) {
446
				require(PAGE_CONTENT);
447
			}
451
			require(PAGE_CONTENT);
448 452
		}
449 453
	}
450 454

  

Also available in: Unified diff