Index: branches/2.8.x/CHANGELOG
===================================================================
--- branches/2.8.x/CHANGELOG	(revision 2119)
+++ branches/2.8.x/CHANGELOG	(revision 2120)
@@ -11,6 +11,10 @@
 ! = Update/Change
 ===============================================================================
 
+10 Mar-2015 Build 2120 Manuela v.d.Decken(DarkViper)
+# framework/WbAdaptor some litte fixes
++ framework/WbDatabaseHelper contains now all maintenance methods from WbDatabase
+! framework/WbDatabase  all maintenance methods has been moved to framework/WbDatabaseHelper
 28 Dec-2014 Build 2119 Manuela v.d.Decken(DarkViper)
 # admin/login/ little fixes
 28 Dec-2014 Build 2118 Manuela v.d.Decken(DarkViper)
Index: branches/2.8.x/wb/admin/interface/version.php
===================================================================
--- branches/2.8.x/wb/admin/interface/version.php	(revision 2119)
+++ branches/2.8.x/wb/admin/interface/version.php	(revision 2120)
@@ -51,5 +51,5 @@
 
 // check if defined to avoid errors during installation (redirect to admin panel fails if PHP error/warnings are enabled)
 if(!defined('VERSION')) define('VERSION', '2.8.4');
-if(!defined('REVISION')) define('REVISION', '2119');
+if(!defined('REVISION')) define('REVISION', '2120');
 if(!defined('SP')) define('SP', '');
Index: branches/2.8.x/wb/framework/WbDatabase.php
===================================================================
--- branches/2.8.x/wb/framework/WbDatabase.php	(revision 2119)
+++ branches/2.8.x/wb/framework/WbDatabase.php	(revision 2120)
@@ -47,7 +47,7 @@
 		define('MYSQL_CLIENT_SSL',         2048);
 	}
 
-class WbDatabase {
+class WbDatabase extends WbDatabaseHelper {
 
 	private static $_oInstances = array();
 
@@ -113,7 +113,7 @@
 		if ($url != '') {
 		// parse URL and extract connection data
 			$aIni = parse_url($url);
-			$scheme   = isset($aIni['scheme']) ? $aIni['scheme'] : 'mysql';
+			$scheme   = isset($aIni['scheme']) ? $aIni['scheme'] : 'mysqli';
 			$hostname = isset($aIni['host']) ? $aIni['host'] : '';
 			$username = isset($aIni['user']) ? $aIni['user'] : '';
 			$password = isset($aIni['pass']) ? $aIni['pass'] : '';
@@ -144,7 +144,8 @@
 			throw new WbDatabaseException('unable to connect \''.$scheme.'://'.$hostname.':'.$hostport.'\'');
 		} else {
             if ($this->sCharset) {
-                @mysqli_query($this->oDbHandle, 'SET NAMES \''.$this->sCharset.'\'');
+                @mysqli_query($this->oDbHandle, 'SET NAMES '.$this->sCharset);
+                mysqli_set_charset($this->oDbHandle, $this->sCharset);
             }
             $this->connected = true;
 		}
@@ -328,227 +329,7 @@
 	{
 		return mysqli_insert_id($this->oDbHandle);
 	}
-/**
- * Alias for isField()
- * @deprecated from WB-2.8.5 and higher
- */
-	public function field_exists($table_name, $field_name)
-	{
-		return $this->isField($table_name, $field_name);
-	}
-/*
- * @param string full name of the table (incl. TABLE_PREFIX)
- * @param string name of the field to seek for
- * @return bool true if field exists
- */
-	public function isField($table_name, $field_name)
-	{
-		$sql = 'DESCRIBE `'.$table_name.'` `'.$field_name.'` ';
-		$query = $this->doQuery($sql);
-		return ($query->numRows() != 0);
-	}
-/**
- * Alias for isIndex()
- * @deprecated from WB-2.8.5 and higher
- */
-	public function index_exists($table_name, $index_name, $number_fields = 0)
-	{
-		return $this->isIndex($table_name, $index_name, $number_fields = 0);
-	}
-/*
- * isIndex
- * @param string full name of the table (incl. TABLE_PREFIX)
- * @param string name of the index to seek for
- * @return bool true if field exists
- */
-	public function isIndex($table_name, $index_name, $number_fields = 0)
-	{
-		$number_fields = intval($number_fields);
-		$keys = 0;
-		$sql = 'SHOW INDEX FROM `'.$table_name.'`';
-		if (($res_keys = $this->doQuery($sql))) {
-			while (($rec_key = $res_keys->fetchRow(MYSQL_ASSOC))) {
-				if ( $rec_key['Key_name'] == $index_name ) {
-					$keys++;
-				}
-			}
 
-		}
-		if ( $number_fields == 0 ) {
-			return ($keys != $number_fields);
-		} else {
-			return ($keys == $number_fields);
-		}
-	}
-/**
- * Alias for addField()
- * @deprecated from WB-2.8.5 and higher
- */
-	public function field_add($table_name, $field_name, $description)
-	{
-		return $this->addField($table_name, $field_name, $description);
-	}
-/*
- * @param string full name of the table (incl. TABLE_PREFIX)
- * @param string name of the field to add
- * @param string describes the new field like ( INT NOT NULL DEFAULT '0')
- * @return bool true if successful, otherwise false and error will be set
- */
-	public function addField($table_name, $field_name, $description)
-	{
-		if (!$this->isField($table_name, $field_name)) {
-		// add new field into a table
-			$sql = 'ALTER TABLE `'.$table_name.'` ADD '.$field_name.' '.$description.' ';
-			$query = $this->doQuery($sql);
-			$this->set_error(mysqli_error($this->oDbHandle));
-			if (!$this->isError()) {
-				return ( $this->isField($table_name, $field_name) ) ? true : false;
-			}
-		} else {
-			$this->set_error('field \''.$field_name.'\' already exists');
-		}
-		return false;
-	}
-/**
- * Alias for modifyField()
- * @deprecated from WB-2.8.5 and higher
- */
-	public function field_modify($table_name, $field_name, $description)
-	{
-		return $this->modifyField($table_name, $field_name, $description);
-	}
-/*
- * @param string $table_name: full name of the table (incl. TABLE_PREFIX)
- * @param string $field_name: name of the field to add
- * @param string $description: describes the new field like ( INT NOT NULL DEFAULT '0')
- * @return bool: true if successful, otherwise false and error will be set
- */
-	public function modifyField($table_name, $field_name, $description)
-	{
-		$retval = false;
-		if ($this->isField($table_name, $field_name)) {
-		// modify a existing field in a table
-			$sql  = 'ALTER TABLE `'.$table_name.'` MODIFY `'.$field_name.'` '.$description;
-			$retval = ( $this->doQuery($sql) ? true : false);
-			$this->setError(mysqli_error($this->oDbHandle));
-		}
-		return $retval;
-	}
-/**
- * Alias for removeField()
- * @deprecated from WB-2.8.5 and higher
- */
-	public function field_remove($table_name, $field_name)
-	{
-		return $this->removeField($table_name, $field_name);
-	}
-/*
- * @param string $table_name: full name of the table (incl. TABLE_PREFIX)
- * @param string $field_name: name of the field to remove
- * @return bool: true if successful, otherwise false and error will be set
- */
-	public function removeField($table_name, $field_name)
-	{
-		$retval = false;
-		if ($this->isField($table_name, $field_name)) {
-		// modify a existing field in a table
-			$sql  = 'ALTER TABLE `'.$table_name.'` DROP `'.$field_name.'`';
-			$retval = ( $this->doQuery($sql, $this->oDbHandle) ? true : false );
-		}
-		return $retval;
-	}
-/**
- * Alias for addIndex()
- * @deprecated from WB-2.8.5 and higher
- */
-    public function index_add($table_name, $index_name, $field_list, $index_type = 'KEY')
-	{
-		return $this->addIndex($table_name, $index_name, $field_list, $index_type);
-	}
-/*
- * @param string $table_name: full name of the table (incl. TABLE_PREFIX)
- * @param string $index_name: name of the new index (empty string for PRIMARY)
- * @param string $field_list: comma seperated list of fields for this index
- * @param string $index_type: kind of index (PRIMARY, UNIQUE, KEY, FULLTEXT)
- * @return bool: true if successful, otherwise false and error will be set
- */
-     public function addIndex($table_name, $index_name, $field_list, $index_type = 'KEY')
-     {
-        $retval = false;
-        $field_list = explode(',', (str_replace(' ', '', $field_list)));
-        $number_fields = sizeof($field_list);
-        $field_list = '`'.implode('`,`', $field_list).'`';
-        $index_name = $index_type == 'PRIMARY' ? $index_type : $index_name;
-        if ( $this->isIndex($table_name, $index_name, $number_fields) ||
-             $this->isIndex($table_name, $index_name))
-        {
-            $sql  = 'ALTER TABLE `'.$table_name.'` ';
-            $sql .= 'DROP INDEX `'.$index_name.'`';
-            if (!$this->doQuery($sql)) { return false; }
-        }
-        $sql  = 'ALTER TABLE `'.$table_name.'` ';
-        $sql .= 'ADD '.$index_type.' ';
-        $sql .= $index_type == 'PRIMARY' ? 'KEY ' : '`'.$index_name.'` ';
-        $sql .= '( '.$field_list.' ); ';
-        if ($this->doQuery($sql)) { $retval = true; }
-        return $retval;
-    }
-/**
- * Alias for removeIndex()
- * @deprecated from WB-2.8.5 and higher
- */
-	public function index_remove($table_name, $index_name)
-	{
-		return $this->removeIndex($table_name, $index_name);
-	}
-/*
- * @param string $table_name: full name of the table (incl. TABLE_PREFIX)
- * @param string $field_name: name of the field to remove
- * @return bool: true if successful, otherwise false and error will be set
- */
-	public function removeIndex($table_name, $index_name)
-	{
-		$retval = false;
-		if ($this->isIndex($table_name, $index_name)) {
-		// modify a existing field in a table
-			$sql  = 'ALTER TABLE `'.$table_name.'` DROP INDEX `'.$index_name.'`';
-			$retval = ( $this->doQuery($sql) ? true : false );
-		}
-		return $retval;
-	}
-/**
- * Alias for importSql()
- * @deprecated from WB-2.8.5 and higher
- */
-	public function SqlImport($sSqlDump,
-	                          $sTablePrefix = '',
-	                          $sAction      = 'install',
-	                          $sEngine      = 'MyISAM',
-	                          $sCollation   = 'utf8_unicode_ci')
-	{
-		return $this->importSql($sSqlDump, $sTablePrefix, $sAction, $sEngine, $sCollation);
-	}
-
-/**
- * retuns the type of the engine used for requested table
- * @param string $table name of the table, including prefix
- * @return boolean/string false on error, or name of the engine (myIsam/InnoDb)
- */
-	public function getTableEngine($table)
-	{
-		$retVal = false;
-		$mysqlVersion = mysqli_get_server_info($this->oDbHandle);
-		$engineValue = (version_compare($mysqlVersion, '5.0') < 0) ? 'Type' : 'Engine';
-		$sql = 'SHOW TABLE STATUS FROM `' . $this->sDbName . '` LIKE \'' . $table . '\'';
-		if (($result = $this->doQuery($sql))) {
-			if (($row = $result->fetchRow(MYSQL_ASSOC))) {
-				$retVal = $row[$engineValue];
-			}
-		}
-		return $retVal;
-	}
-
-
 } /// end of class database
 // //////////////////////////////////////////////////////////////////////////////////// //
 /**
@@ -600,7 +381,7 @@
  * @return object
  * @throws WbDatabaseException
  */
-	function query($sStatement)
+	public function query($sStatement)
 	{
 		$this->result = @mysqli_query($this->oDbHandle, $sStatement);
 		if ($this->result === false) {
@@ -618,7 +399,7 @@
  * @return integer
  * @description number of returned records
  */
-	function numRows()
+	public function numRows()
 	{
 		return mysqli_num_rows($this->result);
 	}
@@ -628,7 +409,7 @@
  * @return array
  * @description get current record and increment pointer
  */
-	function fetchRow($typ = MYSQL_BOTH)
+	public function fetchRow($typ = MYSQLI_BOTH)
 	{
 		return mysqli_fetch_array($this->result, $typ);
 	}
@@ -639,7 +420,7 @@
  * @return object
  * @description get current record as an object and increment pointer
  */
-	function fetchObject($sClassName = null, array $aParams = null)
+	public function fetchObject($sClassName = null, array $aParams = null)
 	{
 		if ($sClassName === null || class_exists($sClassName)) {
 			return mysqli_fetch_object($this->result, $sClassName, $aParams);
@@ -648,11 +429,35 @@
 		}
 	}
 /**
+ * fetchArray
+ * @param  int $iType MYSQL_ASSOC(default) | MYSQL_BOTH | MYSQL_NUM
+ * @return array of current record
+ * @description get current record and increment pointer
+ */
+	public function fetchArray($iType = MYSQLI_ASSOC)
+	{
+        if ($iType < MYSQLI_ASSOC || $iType > MYSQLI_BOTH) {
+            $iType = MYSQLI_ASSOC;
+        }
+		return mysqli_fetch_array($this->result, $iType);
+	}
+/**
+ * fetchAll
+ * @param  int $iType MYSQL_ASSOC(default) | MYSQL_NUM
+ * @return array of rows
+ * @description get all records of the result set
+ */
+    public function fetchAll($iType = MYSQL_ASSOC)
+    {
+        $iType = $iType != MYSQL_NUM ? MYSQL_ASSOC : MYSQL_NUM;
+        return mysqli_fetch_all($this->result, $iType);
+    }
+/**
  * rewind
  * @return bool
  * @description set the recordpointer to the first record || false on error
  */
-	function rewind()
+	public function rewind()
 	{
 		return $this->seekRow(MYSQL_SEEK_FIRST);
 	}
@@ -662,7 +467,7 @@
  * @return bool
  * @description set the pointer to the given record || false on error
  */
-	function seekRow( $position = MYSQL_SEEK_FIRST )
+	public function seekRow( $position = MYSQL_SEEK_FIRST )
 	{
 		$pmax = $this->numRows() - 1;
 		$p = (($position < 0 || $position > $pmax) ? $pmax : $position);
@@ -673,7 +478,7 @@
  * @return bool
  * @description remove retult object from memeory
  */
-	function freeResult()
+	public function freeResult()
 	{
 		return mysqli_free_result($this->result);
 	}
@@ -681,7 +486,7 @@
  * Get error
  * @return string || null if no error
  */
-	function error()
+	public function error()
 	{
 		if (isset($this->error)) {
 			return $this->error;
@@ -704,6 +509,7 @@
 	function db_update_key_value($table, $key, $value = '')
 	{
 		$oDb = WbDatabase::getInstance();
+        $table = preg_replace('/^'.preg_quote($oDb->TablePrefix, '/').'/s', '', $table);
 		if (!is_array($key)) {
 			if (trim($key) != '') {
 				$key = array( trim($key) => trim($value) );
Index: branches/2.8.x/wb/framework/WbDatabaseHelper.php
===================================================================
--- branches/2.8.x/wb/framework/WbDatabaseHelper.php	(nonexistent)
+++ branches/2.8.x/wb/framework/WbDatabaseHelper.php	(revision 2120)
@@ -0,0 +1,259 @@
+<?php
+/**
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * This program 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 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+/**
+ * WbDatabaseHelper.php
+ *
+ * @category     Core
+ * @package      Core_database
+ * @author       Manuela v.d.Decken <manuela@isteam.de>
+ * @author       Dietmar W. <dietmar.woellbrink@websitebaker.org>
+ * @copyright    Manuela v.d.Decken <manuela@isteam.de>
+ * @license      http://www.gnu.org/licenses/gpl.html   GPL License
+ * @version      0.0.9
+ * @revision     $Revision: 2105 $
+ * @lastmodified $Date: 2014-11-24 18:41:13 +0100 (Mo, 24 Nov 2014) $
+ * @deprecated   from WB version number 2.9
+ * @description  Mysql database wrapper for use with websitebaker up to version 2.8.4
+ */
+
+abstract class WbDatabaseHelper {
+
+
+/**
+ * Alias for isField()
+ * @deprecated from WB-2.8.5 and higher
+ */
+	public function field_exists($table_name, $field_name)
+	{
+		return $this->isField($table_name, $field_name);
+	}
+/*
+ * @param string full name of the table (incl. TABLE_PREFIX)
+ * @param string name of the field to seek for
+ * @return bool true if field exists
+ */
+	public function isField($table_name, $field_name)
+	{
+		$sql = 'DESCRIBE `'.$table_name.'` `'.$field_name.'` ';
+		$query = $this->doQuery($sql);
+		return ($query->numRows() != 0);
+	}
+/**
+ * Alias for isIndex()
+ * @deprecated from WB-2.8.5 and higher
+ */
+	public function index_exists($table_name, $index_name, $number_fields = 0)
+	{
+		return $this->isIndex($table_name, $index_name, $number_fields = 0);
+	}
+/*
+ * isIndex
+ * @param string full name of the table (incl. TABLE_PREFIX)
+ * @param string name of the index to seek for
+ * @return bool true if field exists
+ */
+	public function isIndex($table_name, $index_name, $number_fields = 0)
+	{
+		$number_fields = intval($number_fields);
+		$keys = 0;
+		$sql = 'SHOW INDEX FROM `'.$table_name.'`';
+		if (($res_keys = $this->doQuery($sql))) {
+			while (($rec_key = $res_keys->fetchRow(MYSQL_ASSOC))) {
+				if ( $rec_key['Key_name'] == $index_name ) {
+					$keys++;
+				}
+			}
+
+		}
+		if ( $number_fields == 0 ) {
+			return ($keys != $number_fields);
+		} else {
+			return ($keys == $number_fields);
+		}
+	}
+/**
+ * Alias for addField()
+ * @deprecated from WB-2.8.5 and higher
+ */
+	public function field_add($table_name, $field_name, $description)
+	{
+		return $this->addField($table_name, $field_name, $description);
+	}
+/*
+ * @param string full name of the table (incl. TABLE_PREFIX)
+ * @param string name of the field to add
+ * @param string describes the new field like ( INT NOT NULL DEFAULT '0')
+ * @return bool true if successful, otherwise false and error will be set
+ */
+	public function addField($table_name, $field_name, $description)
+	{
+		if (!$this->isField($table_name, $field_name)) {
+		// add new field into a table
+			$sql = 'ALTER TABLE `'.$table_name.'` ADD '.$field_name.' '.$description.' ';
+			$query = $this->doQuery($sql);
+			$this->set_error(mysqli_error($this->oDbHandle));
+			if (!$this->isError()) {
+				return ( $this->isField($table_name, $field_name) ) ? true : false;
+			}
+		} else {
+			$this->set_error('field \''.$field_name.'\' already exists');
+		}
+		return false;
+	}
+/**
+ * Alias for modifyField()
+ * @deprecated from WB-2.8.5 and higher
+ */
+	public function field_modify($table_name, $field_name, $description)
+	{
+		return $this->modifyField($table_name, $field_name, $description);
+	}
+/*
+ * @param string $table_name: full name of the table (incl. TABLE_PREFIX)
+ * @param string $field_name: name of the field to add
+ * @param string $description: describes the new field like ( INT NOT NULL DEFAULT '0')
+ * @return bool: true if successful, otherwise false and error will be set
+ */
+	public function modifyField($table_name, $field_name, $description)
+	{
+		$retval = false;
+		if ($this->isField($table_name, $field_name)) {
+		// modify a existing field in a table
+			$sql  = 'ALTER TABLE `'.$table_name.'` MODIFY `'.$field_name.'` '.$description;
+			$retval = ( $this->doQuery($sql) ? true : false);
+			$this->setError(mysqli_error($this->oDbHandle));
+		}
+		return $retval;
+	}
+/**
+ * Alias for removeField()
+ * @deprecated from WB-2.8.5 and higher
+ */
+	public function field_remove($table_name, $field_name)
+	{
+		return $this->removeField($table_name, $field_name);
+	}
+/*
+ * @param string $table_name: full name of the table (incl. TABLE_PREFIX)
+ * @param string $field_name: name of the field to remove
+ * @return bool: true if successful, otherwise false and error will be set
+ */
+	public function removeField($table_name, $field_name)
+	{
+		$retval = false;
+		if ($this->isField($table_name, $field_name)) {
+		// modify a existing field in a table
+			$sql  = 'ALTER TABLE `'.$table_name.'` DROP `'.$field_name.'`';
+			$retval = ( $this->doQuery($sql, $this->oDbHandle) ? true : false );
+		}
+		return $retval;
+	}
+/**
+ * Alias for addIndex()
+ * @deprecated from WB-2.8.5 and higher
+ */
+    public function index_add($table_name, $index_name, $field_list, $index_type = 'KEY')
+	{
+		return $this->addIndex($table_name, $index_name, $field_list, $index_type);
+	}
+/*
+ * @param string $table_name: full name of the table (incl. TABLE_PREFIX)
+ * @param string $index_name: name of the new index (empty string for PRIMARY)
+ * @param string $field_list: comma seperated list of fields for this index
+ * @param string $index_type: kind of index (PRIMARY, UNIQUE, KEY, FULLTEXT)
+ * @return bool: true if successful, otherwise false and error will be set
+ */
+     public function addIndex($table_name, $index_name, $field_list, $index_type = 'KEY')
+     {
+        $retval = false;
+        $field_list = explode(',', (str_replace(' ', '', $field_list)));
+        $number_fields = sizeof($field_list);
+        $field_list = '`'.implode('`,`', $field_list).'`';
+        $index_name = $index_type == 'PRIMARY' ? $index_type : $index_name;
+        if ( $this->isIndex($table_name, $index_name, $number_fields) ||
+             $this->isIndex($table_name, $index_name))
+        {
+            $sql  = 'ALTER TABLE `'.$table_name.'` ';
+            $sql .= 'DROP INDEX `'.$index_name.'`';
+            if (!$this->doQuery($sql)) { return false; }
+        }
+        $sql  = 'ALTER TABLE `'.$table_name.'` ';
+        $sql .= 'ADD '.$index_type.' ';
+        $sql .= $index_type == 'PRIMARY' ? 'KEY ' : '`'.$index_name.'` ';
+        $sql .= '( '.$field_list.' ); ';
+        if ($this->doQuery($sql)) { $retval = true; }
+        return $retval;
+    }
+/**
+ * Alias for removeIndex()
+ * @deprecated from WB-2.8.5 and higher
+ */
+	public function index_remove($table_name, $index_name)
+	{
+		return $this->removeIndex($table_name, $index_name);
+	}
+/*
+ * @param string $table_name: full name of the table (incl. TABLE_PREFIX)
+ * @param string $field_name: name of the field to remove
+ * @return bool: true if successful, otherwise false and error will be set
+ */
+	public function removeIndex($table_name, $index_name)
+	{
+		$retval = false;
+		if ($this->isIndex($table_name, $index_name)) {
+		// modify a existing field in a table
+			$sql  = 'ALTER TABLE `'.$table_name.'` DROP INDEX `'.$index_name.'`';
+			$retval = ( $this->doQuery($sql) ? true : false );
+		}
+		return $retval;
+	}
+/**
+ * Alias for importSql()
+ * @deprecated from WB-2.8.5 and higher
+ */
+	public function SqlImport($sSqlDump,
+	                          $sTablePrefix = '',
+	                          $sAction      = 'install',
+	                          $sEngine      = 'MyISAM',
+	                          $sCollation   = 'utf8_unicode_ci')
+	{
+		return $this->importSql($sSqlDump, $sTablePrefix, $sAction, $sEngine, $sCollation);
+	}
+
+/**
+ * retuns the type of the engine used for requested table
+ * @param string $table name of the table, including prefix
+ * @return boolean/string false on error, or name of the engine (myIsam/InnoDb)
+ */
+	public function getTableEngine($table)
+	{
+		$retVal = false;
+		$mysqlVersion = mysqli_get_server_info($this->oDbHandle);
+		$engineValue = (version_compare($mysqlVersion, '5.0') < 0) ? 'Type' : 'Engine';
+		$sql = 'SHOW TABLE STATUS FROM `' . $this->sDbName . '` LIKE \'' . $table . '\'';
+		if (($result = $this->doQuery($sql))) {
+			if (($row = $result->fetchRow(MYSQL_ASSOC))) {
+				$retVal = $row[$engineValue];
+			}
+		}
+		return $retVal;
+	}
+
+}
+
+// end of class WbDatabaseHelper
Index: branches/2.8.x/wb/framework/WbAdaptor.php
===================================================================
--- branches/2.8.x/wb/framework/WbAdaptor.php	(revision 2119)
+++ branches/2.8.x/wb/framework/WbAdaptor.php	(revision 2120)
@@ -22,8 +22,8 @@
  *
  * @category     Core
  * @package      Core_package
- * @author       Werner v.d.Decken <wkl@isteam.de>
- * @copyright    Werner v.d.Decken <wkl@isteam.de>
+ * @author       Manuela v.d.Decken <manuela@isteam.de>
+ * @copyright    Manuela v.d.Decken <manuela@isteam.de>
  * @license      http://www.gnu.org/licenses/gpl.html   GPL License
  * @version      0.0.1
  * @revision     $Revision$
@@ -35,13 +35,17 @@
 class WbAdaptor {
 
 /** active instance */	
-	protected static $_oInstance = null;
+	protected static $oInstance = null;
 /** array hold settings */	
-	protected $_aSys = array();
+	protected $aProperties = array();
+/**  */
+    protected $aObjects = array('Db' => null, 'Trans' => null, 'App' => null);
+/** vars which             */
+    protected $aReservedVars = array('Db', 'Trans', 'App');
 /** constructor */
 	protected function __construct() 
 	{
-		$this->_aSys = array('System' => array(), 'Request' => array());
+		$this->aProperties = array('System' => array(), 'Request' => array());
 	}
 /**
  * Get active instance 
@@ -49,14 +53,40 @@
  */
 	public static function getInstance()
 	{
-		if(self::$_oInstance == null) {
+		if(self::$oInstance == null) {
 			$c = __CLASS__;
-			self::$_oInstance = new $c();
+			self::$oInstance = new $c();
 			
 		}
-		return self::$_oInstance;
+		return self::$oInstance;
 	}
 /**
+ * set the global database object
+ * @param WbDatabase $oDb
+ */
+    public function setDatabase(WbDatabase $oDb)
+    {
+        $this->aObjects['Db'] = $oDb;
+        return true;
+    }
+/**
+ * set the global translation object
+ * @param Translate $oTrans
+ */
+    public function setTranslate(Translate $oTrans)
+    {
+        $this->aObjects['Trans'] = $oTrans;
+        return true;
+    }
+/**
+ * set the global application object
+ * @param wb $oApp
+ */
+    public function setApplication(wb $oApp)
+    {
+        $this->aObjects['App'] = $oApp;
+    }
+/**
  * handle unknown properties
  * @param string name of the property
  * @param mixed value to set
@@ -64,7 +94,11 @@
  */	
 	public function __set($name, $value) 
 	{
-		throw new InvalidArgumentException('tried to set readonly or nonexisting property [ '.$name.' }!! ');
+        if (array_key_exists($name, $this->aProperties['System'])) {
+            throw new InvalidArgumentException('tried to set readonly or nonexisting property [ '.$name.' }!! ');
+        } else {
+            $this->aProperties['Request'][$name] = $value;
+        }
 	}
 /**
  * Get value of a variable
@@ -73,14 +107,15 @@
  */	
 	public function __get($sVarname)
 	{
-		if( isset($this->_aSys['Request'][$sVarname])) {
-			return $this->_aSys['Request'][$sVarname];
-		}elseif( isset($this->_aSys['System'][$sVarname])) {
-			return $this->_aSys['System'][$sVarname];
-		}elseif( isset($this->_aSys[$sVarname])) {
-			return $this->_aSys[$sVarname];
-		}else {
-			return null;
+        if (isset($this->aObjects[$sVarname]) && !is_null($this->aObjects[$sVarname])) {
+            return $this->aObjects[$sVarname];
+        }
+        if (isset($this->aProperties['System'][$sVarname])) {
+            return $this->aProperties['System'][$sVarname];
+        } elseif ( isset($this->aProperties['Request'][$sVarname])) {
+            return $this->aProperties['Request'][$sVarname];
+        } else {
+            return null;
 		}
 	}
 /**
@@ -90,9 +125,11 @@
  */	
 	public function __isset($sVarname)
 	{
-		$bRetval = (isset($this->_aSys['Request'][$sVarname]) ||
-		            isset($this->_aSys['System'][$sVarname]) ||
-		            isset($this->_aSys[$sVarname]));
+        if (isset($this->aObjects[$sVarname]) && !is_null($this->aObjects[$sVarname])) {
+            return true;
+        }
+		$bRetval = (isset($this->aProperties['System'][$sVarname]) ||
+		            isset($this->aProperties['Request'][$sVarname]));
 		return $bRetval;
 	}
 /**
@@ -100,143 +137,187 @@
  */	
 	public function getWbConstants()
 	{
-		$this->_aSys = array('System' => array(), 'Request' => array());
+    // first reinitialize arrays
+		$this->aProperties = array(
+            'System' => array(),
+            'Request' => array()
+        );
+    // get all defined constants
 		$aConsts = get_defined_constants(true);
-		foreach($aConsts['user'] as $sKey=>$sVal)
-		{
+    // iterate all user defined constants
+		foreach ($aConsts['user'] as $sKey=>$sVal) {
+            if (in_array($sKey, $this->aReservedVars)) { continue; }
 		// skip possible existing database constants
 			if (preg_match('/^db_|^TABLE_PREFIX$/i', $sKey)) { continue; }
-		// change all path items to trailing slash scheme
+		// change all path items to trailing slash scheme and assign the new naming syntax
 			switch($sKey):
+                case 'DEBUG':
+                    $this->aProperties['System']['Debug'] = intval($sVal);
+                    $this->aProperties['System']['DebugLevel'] = intval($sVal);
+                    break;
 				case 'WB_URL': 
 					$sVal = rtrim(str_replace('\\', '/', $sVal), '/').'/';
 					$sKey = 'AppUrl';
-					$this->_aSys['System'][$sKey] = $sVal; 
+					$this->aProperties['System'][$sKey] = $sVal;
 					break;
 				case 'WB_REL':
 					$sVal = rtrim(str_replace('\\', '/', $sVal), '/').'/';
 					$sKey = 'AppRel';
-					$this->_aSys['System'][$sKey] = $sVal; 
+					$this->aProperties['System'][$sKey] = $sVal;
 					break;
 				case 'WB_PATH':
 					$sVal = rtrim(str_replace('\\', '/', $sVal), '/').'/';
 					$sKey = 'AppPath';
-					$this->_aSys['System'][$sKey] = $sVal; 
+					$this->aProperties['System'][$sKey] = $sVal;
 					break;
 				case 'ADMIN_URL':
 					$sVal = rtrim(str_replace('\\', '/', $sVal), '/').'/';
 					$sKey = 'AcpUrl';
-					$this->_aSys['System'][$sKey] = $sVal; 
+					$this->aProperties['System'][$sKey] = $sVal;
 					break;
 				case 'ADMIN_REL':
 					$sVal = rtrim(str_replace('\\', '/', $sVal), '/').'/';
 					$sKey = 'AcpRel';
-					$this->_aSys['System'][$sKey] = $sVal; 
+					$this->aProperties['System'][$sKey] = $sVal;
 					break;
 				case 'ADMIN_PATH':
 					$sVal = rtrim(str_replace('\\', '/', $sVal), '/').'/';
 					$sKey = 'AcpPath';
-					$this->_aSys['System'][$sKey] = $sVal; 
+					$this->aProperties['System'][$sKey] = $sVal;
 					break;
 				case 'THEME_URL':
 					$sVal = rtrim(str_replace('\\', '/', $sVal), '/').'/';
 					$sKey = 'ThemeUrl';
-					$this->_aSys['Request'][$sKey] = $sVal; 
+					$this->aProperties['Request'][$sKey] = $sVal;
 					break;
 				case 'THEME_REL':
 					$sVal = rtrim(str_replace('\\', '/', $sVal), '/').'/';
 					$sKey = 'ThemeRel';
-					$this->_aSys['Request'][$sKey] = $sVal; 
+					$this->aProperties['Request'][$sKey] = $sVal;
 					break;
 				case 'THEME_PATH':
 					$sVal = rtrim(str_replace('\\', '/', $sVal), '/').'/';
 					$sKey = 'ThemePath';
-					$this->_aSys['Request'][$sKey] = $sVal; 
+					$this->aProperties['Request'][$sKey] = $sVal;
 					break;
 				case 'TMP_PATH':
 					$sVal = rtrim(str_replace('\\', '/', $sVal), '/').'/';
 					$sKey = 'TempPath';
-					$this->_aSys['System'][$sKey] = $sVal; 
+					$this->aProperties['System'][$sKey] = $sVal;
 					break;
 				case 'ADMIN_DIRECTORY':
 					$sVal = trim(str_replace('\\', '/', $sVal), '/').'/';
 					$sKey = 'AcpDir';
-					$this->_aSys['System'][$sKey] = $sVal; 
+					$this->aProperties['System'][$sKey] = $sVal;
 					break;
 				case 'DOCUMENT_ROOT':
 					$sVal = rtrim(str_replace('\\', '/', $sVal), '/').'/';
 					$sKey = 'DocumentRoot';
-					$this->_aSys['System'][$sKey] = $sVal; 
+					$this->aProperties['System'][$sKey] = $sVal;
 					break;
 				case 'PAGES_DIRECTORY':
 					$sVal = trim(str_replace('\\', '/', $sVal), '/').'/';
 					$sVal = $sVal=='/' ? '' : $sVal;
 					$sKey = 'PagesDir';
-					$this->_aSys['System'][$sKey] = $sVal; 
+					$this->aProperties['System'][$sKey] = $sVal;
 					break;
 				case 'MEDIA_DIRECTORY':
 					$sVal = trim(str_replace('\\', '/', $sVal), '/').'/';
 					$sKey = 'MediaDir';
-					$this->_aSys['System'][$sKey] = $sVal; 
+					$this->aProperties['System'][$sKey] = $sVal;
 					break;
 				case 'DEFAULT_TEMPLATE':
-					$sVal = trim(str_replace('\\', '/', $sVal), '/').'/';
+					$sVal = trim(str_replace('\\', '/', $sVal), '/');
 					$sKey = 'DefaultTemplate';
-					$this->_aSys['Request'][$sKey] = $sVal; 
+					$this->aProperties['System'][$sKey] = $sVal;
 					break;
 				case 'TEMPLATE':
-					$sVal = trim(str_replace('\\', '/', $sVal), '/').'/';
+					$sVal = trim(str_replace('\\', '/', $sVal), '/');
 					$sKey = 'Template';
-					$this->_aSys['Request'][$sKey] = $sVal;
+					$this->aProperties['Request'][$sKey] = $sVal;
 					break;
 				case 'DEFAULT_THEME':
-					$sVal = trim(str_replace('\\', '/', $sVal), '/').'/';
+					$sVal = trim(str_replace('\\', '/', $sVal), '/');
 					$sKey = 'DefaultTheme';
-					$this->_aSys['Request'][$sKey] = $sVal; 
+					$this->aProperties['System'][$sKey] = $sVal;
+					$this->aProperties['Request']['Theme'] = trim($sVal, '/');
 					break;
 				case 'OCTAL_FILE_MODE':
 					$sVal = ((intval($sVal) & ~0111)|0600); // o-x/g-x/u-x/o+rw
 					$sKey = 'OctalFileMode';
-					$this->_aSys['Request'][$sKey] = $sVal; 
+					$this->aProperties['System']['OctalFileMode'] = $sVal;
+					$this->aProperties['System']['FileModeOctal'] = $sVal;
 					break;
 				case 'OCTAL_DIR_MODE':
 					$sVal = (intval($sVal) |0711); // o+rwx/g+x/u+x
 					$sKey = 'OctalDirMode';
-					$this->_aSys['Request'][$sKey] = $sVal; 
+					$this->aProperties['System']['OctalDirMode'] = $sVal;
+					$this->aProperties['System']['DirModeOctal'] = $sVal;
 					break;
 				case 'WB_VERSION':
 					$sKey = 'AppVersion';
-					$this->_aSys['System'][$sKey] = $sVal; 
+					$this->aProperties['System'][$sKey] = $sVal;
 					break;
 				case 'WB_REVISION':
 					$sKey = 'AppRevision';
-					$this->_aSys['System'][$sKey] = $sVal; 
+					$this->aProperties['System'][$sKey] = $sVal;
 					break;
 				case 'WB_SP':
 					$sKey = 'AppServicePack';
-					$this->_aSys['System'][$sKey] = $sVal; 
+					$this->aProperties['System'][$sKey] = $sVal;
 					break;
                 case 'PAGE_ICON_DIR':
                     $sKey = 'PageIconDir';
 					$sVal = trim(str_replace('\\', '/', $sVal), '/').'/';
-                    if (!isset($this->_aSys['Request']['Template'])) {
-                        $this->_aSys['Request']['Template'] = $this->_aSys['Request']['DefaultTemplate'];
-                    }
-                    $sVal = str_replace('/*/', '/'.$this->_aSys['Request']['Template'], $sVal);
-					$this->_aSys['System'][$sKey] = $sVal;
+					$this->aProperties['Request'][$sKey] = $sVal;
                     break;
+                case 'TEMPLATE_DIR':
+                    break;
 				default:
+                    $aSysList = array(
+                    // list of values which should be placed in ['System']
+                        'DefaultCharset','DefaultDateFormat','DefaultLanguage','DefaultTimeFormat',
+                        'DefaultTimezone','DevInfos'
+                    );
+                    // convert 'true' or 'false' strings into boolean
 					$sVal = ($sVal == 'true' ? true : ($sVal == 'false' ? false : $sVal));
+                    // reformatting constant names
 					$sKey = str_replace(' ', '', ucwords(str_replace('_', ' ', strtolower($sKey))));
-					$this->_aSys['Request'][$sKey] = $sVal; 
+                    if (in_array($sKey, $aSysList)) {
+    					$this->aProperties['System'][$sKey] = $sVal;
+                    } else {
+                        $this->aProperties['Request'][$sKey] = $sVal;
+                    }
 					break;
 			endswitch;
-			$this->_aSys[$sKey] = $sVal;
 		}
-		$this->_aSys['AppName'] = 'WebsiteBaker';
-		$this->_aSys['System']['AppName'] = 'WebsiteBaker';
-		$this->_aSys['Request']['AppName'] = 'WebsiteBaker';
+/* now set values which needs dependencies */
+        if (!isset($this->aProperties['Request']['Template']) || $this->aProperties['Request']['Template'] == '') {
+            $this->aProperties['Request']['Template'] = $this->DefaultTemplate;
+        }
+		$this->aProperties['System']['AppName'] = 'WebsiteBaker';
+        if (isset($this->Template)) {
+            $this->aProperties['Request']['TemplateDir']  = 'templates/'.$this->Template.'/';
+            $this->aProperties['Request']['TemplateUrl']  = $this->AppUrl.'templates/'.$this->Template.'/';
+            $this->aProperties['Request']['TemplatePath'] = $this->AppPath.'templates/'.$this->Template.'/';
+        }
+/* correct PageIconDir if necessary */
+        $this->aProperties['Request']['PageIconDir'] = str_replace('/*/', '/'.$this->Template, $this->PageIconDir);
+
+/* cleanup arrays */
+        $this->aProperties['Request'] = array_diff_key(
+            $this->aProperties['Request'],
+            $this->aProperties['System']
+        );
+
 	}
+// temporary method for testing purposes only
+    public function showAll()
+    {
+        ksort($this->_aSys['System']);
+        ksort($this->_aSys['Request']);
+        return $this->_aSys;
+    }
 
 } // end of class WbAdaptor
 
