Index: trunk/CHANGELOG
===================================================================
--- trunk/CHANGELOG	(revision 54)
+++ trunk/CHANGELOG	(revision 55)
@@ -11,9 +11,22 @@
 ! = Update/Change
 
 ------------------------------------- 2.6.0 -------------------------------------
+09-Sep-2005 Stefan Braunewell
+#	Fixed bug when changing a page's parent
+!	Changed the way blocks are treated. Added new frontend class attribute
+	default_block_content that controls what is shown on pages such as
+	search, login, etc. (Ticket #16)
++	Added support for WYSIWYG editor modules (wysiwygmod)
++	When trying to access a registered page, user is automatically redirected
+	there on successful login.
+#	Fixed various issues with system search (mainly related to stripslashes()
+#	Removed stripslashes() in many places in the code. Added check for
+	magic_quotes_gpc to new wb class method add_slashes(). Now database contest
+	is independent of magic_quotes setting..
 05-Sep-2005 Stefan Braunewell
 #	Fixed bug concerning direct access of preferences page.
-#	Reworked page visibility and menu item visibility code (frontend login problem).
+#	Reworked page visibility and menu item visibility code (frontend login
+	problem).
 #	Pages in link list in htmlarea popup are now correctly ordered.
 #	Fixed bug where group with existing name can be added.
 04-Sep-2005 Ryan Djurovich
Index: trunk/wb/framework/initialize.php
===================================================================
--- trunk/wb/framework/initialize.php	(revision 54)
+++ trunk/wb/framework/initialize.php	(nonexistent)
@@ -1,94 +0,0 @@
-<?php
-
-// $Id$
-
-/*
-
- Website Baker Project <http://www.websitebaker.org/>
- Copyright (C) 2004-2005, 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
-
-*/
-
-/*
-	Initializations common to frontend and backend
-*/
-if(!defined('WB_URL')) {
-	header('Location: ../index.php');
-}
-
-// Setup database object
-require_once(WB_PATH.'/framework/class.database.php');
-if (!defined('DATABASE_CLASS_LOADED')) {
-  	define('DATABASE_CLASS_LOADED',true);
-}
-if(!isset($database)) {
-	$database = new database();
-}
-
-// Start a session
-if(!defined('SESSION_STARTED')) {
-	session_name(APP_NAME.'_session_id');
-	session_start();
-	define('SESSION_STARTED', true);
-}
-
-// Get users language
-if(isset($_GET['lang']) AND $_GET['lang'] != '' AND !is_numeric($_GET['lang']) AND strlen($_GET['lang']) == 2) {
-  	define('LANGUAGE', strtoupper($_GET['lang']));
-	$_SESSION['LANGUAGE']=LANGUAGE;
-} else {
-	if(isset($_SESSION['LANGUAGE']) AND $_SESSION['LANGUAGE'] != '') {
-		define('LANGUAGE', $_SESSION['LANGUAGE']);
-	} else {
-		define('LANGUAGE', DEFAULT_LANGUAGE);
-	}
-}
-
-// Get users timezone
-if(!defined('TIMEZONE')) {
-	if(isset($_SESSION['TIMEZONE'])) {
-		define('TIMEZONE', $_SESSION['TIMEZONE']);
-	} else {
-		define('TIMEZONE', DEFAULT_TIMEZONE);
-	}
-}
-// Get users date format
-if(!defined('DATE_FORMAT')) {
-	if(isset($_SESSION['DATE_FORMAT'])) {
-		define('DATE_FORMAT', $_SESSION['DATE_FORMAT']);
-	} else {
-		define('DATE_FORMAT', DEFAULT_DATE_FORMAT);
-	}
-}
-// Get users time format
-if(!defined('TIME_FORMAT')) {
-	if(isset($_SESSION['TIME_FORMAT'])) {
-		define('TIME_FORMAT', $_SESSION['TIME_FORMAT']);
-	} else {
-		define('TIME_FORMAT', DEFAULT_TIME_FORMAT);
-	}
-}
-// Load Language file
-if(!defined('LANGUAGE_LOADED')) {
-	if(!file_exists(WB_PATH.'/languages/'.LANGUAGE.'.php')) {
-		exit('Error loading language file '.LANGUAGE.', please check configuration');
-	} else {
-		require_once(WB_PATH.'/languages/'.LANGUAGE.'.php');
-	}
-}
-
-?>

Property changes on: trunk/wb/framework/initialize.php
___________________________________________________________________
Deleted: svn:keywords
## -1 +0,0 ##
-Id
\ No newline at end of property
Index: trunk/wb/framework/class.admin.php
===================================================================
--- trunk/wb/framework/class.admin.php	(revision 54)
+++ trunk/wb/framework/class.admin.php	(revision 55)
@@ -36,10 +36,9 @@
 	header('Location: ../index.php');
 }
 
-
 require_once(WB_PATH.'/framework/class.wb.php');
 
-require_once(WB_PATH.'/framework/initialize.php');
+//require_once(WB_PATH.'/framework/initialize.php');
 
 // Include PHPLIB template class
 require_once(WB_PATH."/include/phplib/template.inc");
@@ -52,9 +51,11 @@
 Begin user changeable settings
 */
 
+
 class admin extends wb {
 	// Authenticate user then auto print the header
 	function admin($section_name, $section_permission = 'start', $auto_header = true, $auto_auth = true) {
+		$this->wb();
 		global $MESSAGE;
 		// Specify the current applications name
 		$this->section_name = $section_name;
@@ -83,7 +84,7 @@
 		global $MESSAGE;
 		global $TEXT;
 		// Connect to database and get website title
-		$database = new database();
+		$database = & $this->database;
 		$get_title = $database->query("SELECT value FROM ".TABLE_PREFIX."settings WHERE name = 'title'");
 		$title = $get_title->fetchRow();
 		$header_template = new Template(ADMIN_PATH."/interface");
Index: trunk/wb/framework/class.wb.php
===================================================================
--- trunk/wb/framework/class.wb.php	(revision 54)
+++ trunk/wb/framework/class.wb.php	(revision 55)
@@ -32,8 +32,74 @@
 */
 
 class wb
-{
-	function wb() {
+{	
+	// General initialization function 
+	// performed when frontend or backend is loaded.
+	function wb() {
+		// set global database variable
+		global $database;
+		// Create database class
+		require_once(WB_PATH.'/framework/class.database.php');
+		$database = new database();
+		$this->database = $database;
+
+		// Start a session
+		if(!defined('SESSION_STARTED')) {
+			session_name(APP_NAME.'_session_id');
+			session_start();
+			define('SESSION_STARTED', true);
+		}
+		
+		// Get users language
+		if(isset($_GET['lang']) AND $_GET['lang'] != '' AND !is_numeric($_GET['lang']) AND strlen($_GET['lang']) == 2) {
+		  	define('LANGUAGE', strtoupper($_GET['lang']));
+			$_SESSION['LANGUAGE']=LANGUAGE;
+		} else {
+			if(isset($_SESSION['LANGUAGE']) AND $_SESSION['LANGUAGE'] != '') {
+				define('LANGUAGE', $_SESSION['LANGUAGE']);
+			} else {
+				define('LANGUAGE', DEFAULT_LANGUAGE);
+			}
+		}
+
+		// make language variables globally accessible
+		global $language_code, $language_name, $language_author, $language_version, $language_designed_for;
+		global $MENU, $OVERVIEW, $TEXT, $HEADING, $MESSAGE;
+		// Load Language file
+		if(!defined('LANGUAGE_LOADED')) {
+			if(!file_exists(WB_PATH.'/languages/'.LANGUAGE.'.php')) {
+				exit('Error loading language file '.LANGUAGE.', please check configuration');
+			} else {
+				require_once(WB_PATH.'/languages/'.LANGUAGE.'.php');
+			}
+		}
+		
+		// Get users timezone
+		if(!defined('TIMEZONE')) {
+			if(isset($_SESSION['TIMEZONE'])) {
+				define('TIMEZONE', $_SESSION['TIMEZONE']);
+			} else {
+				define('TIMEZONE', DEFAULT_TIMEZONE);
+			}
+		}
+		// Get users date format
+		if(!defined('DATE_FORMAT')) {
+			if(isset($_SESSION['DATE_FORMAT'])) {
+				define('DATE_FORMAT', $_SESSION['DATE_FORMAT']);
+			} else {
+				define('DATE_FORMAT', DEFAULT_DATE_FORMAT);
+			}
+		}
+		// Get users time format
+		if(!defined('TIME_FORMAT')) {
+			if(isset($_SESSION['TIME_FORMAT'])) {
+				define('TIME_FORMAT', $_SESSION['TIME_FORMAT']);
+			} else {
+				define('TIME_FORMAT', DEFAULT_TIME_FORMAT);
+			}
+		}
+		
+		set_magic_quotes_runtime(0);
 	}
 
 	// Check whether we should show a page or not (for front-end)
Index: trunk/wb/framework/class.frontend.php
===================================================================
--- trunk/wb/framework/class.frontend.php	(revision 54)
+++ trunk/wb/framework/class.frontend.php	(revision 55)
@@ -41,7 +41,7 @@
 	var $default_link,$default_page_id;
 	// when multiple blocks are used, show home page blocks on 
 	// pages where no content is defined (search, login, ...)
-	var $no_default_content=false;
+	var $no_default_block_content=false;
 
 	// page details
 	// page database row
@@ -64,7 +64,7 @@
 	
 	function page_select() {
 		global $page_id,$no_intro;
-		global $database;
+		$database=& $this->database;
 		// We have no page id and are supposed to show the intro page
 		if((INTRO_PAGE AND !isset($no_intro)) AND (!isset($page_id) OR !is_numeric($page_id))) {
 			// Since we have no page id check if we should go to intro page or default page
@@ -121,7 +121,7 @@
 	}
 
 	function get_page_details() {
-		global $database;
+		$database = & $this->database;
 	    if($this->page_id != 0) {
 			// Query page details
 			$query_page = "SELECT * FROM ".TABLE_PREFIX."pages WHERE page_id = '{$this->page_id}'";
@@ -249,7 +249,7 @@
 	}
 
 	function get_website_settings() {
-		global $database;
+		$database = & $this->database;
 		// Get website settings (title, keywords, description, header, and footer)
 		$query_settings = "SELECT name,value FROM ".TABLE_PREFIX."settings";
 		$get_settings = $database->query($query_settings);
@@ -297,7 +297,7 @@
 	}
 	
 	function preprocess(&$content) {
-		global $database;
+		$database = & $this->database;
 		// Replace [wblink--PAGE_ID--] with real link
 		$pattern = '/\[wblink(.+?)\]/s';
 		preg_match_all($pattern,$content,$ids);
@@ -360,7 +360,7 @@
 	}
 	
 	function show_menu() {
-	   global $database;
+	   $database = & $this->database;
 	   if ($this->menu_recurse==0)
 	       return;
 	   // Check if we should add menu number check to query
@@ -412,8 +412,10 @@
 
 	function page_content($block = 1) {
 		// Get outside objects
-		global $database,$admin,$TEXT,$MENU,$HEADING,$MESSAGE;
+		global $TEXT,$MENU,$HEADING,$MESSAGE;
 		global $globals;
+		$database = & $this->database;
+		$admin = & $this;
 		if ($this->page_access_denied==true) {
             echo $MESSAGE['FRONTEND']['SORRY_NO_VIEWING_PERMISSIONS'];
 			exit();
@@ -423,11 +425,15 @@
 		if(!is_numeric($block)) { $block = 1; }
 		// Include page content
 		if(!defined('PAGE_CONTENT') OR $block!=1) {
-			if ($this->page_id==0) {
-				if ($block != 1 AND $this->no_default_content==true) {
+			if ($this->page_id==0) {
+				if ($this->default_block_content=='none') {
 					return;
 				}
-				$page_id=$this->default_page_id;
+				if (is_numeric($this->default_block_content)) {
+					$page_id=$this->default_block_content;
+				} else {
+					$page_id=$this->default_page-id;
+				}				
 			} else {
 				$page_id=$this->page_id;
 			}
@@ -442,9 +448,7 @@
 				}
 			}
 		} else {
-			if($block == 1) {
-				require(PAGE_CONTENT);
-			}
+			require(PAGE_CONTENT);
 		}
 	}
 
Index: trunk/wb/index.php
===================================================================
--- trunk/wb/index.php	(revision 54)
+++ trunk/wb/index.php	(revision 55)
@@ -35,12 +35,9 @@
 
 require_once(WB_PATH.'/framework/class.frontend.php');
 // Create new frontend object
-$wb = new frontend();
+// Perform general initializations
+$wb = & new frontend();
 
-// Perform general initializations:
-// session start, language files loading, basic settings.
-require_once(WB_PATH.'/framework/initialize.php');
-
 // Figure out which page to display
 // Stop processing if intro page was shown
 $wb->page_select() or die();
