Index: branches/2.8.x/CHANGELOG
===================================================================
--- branches/2.8.x/CHANGELOG	(revision 2103)
+++ branches/2.8.x/CHANGELOG	(revision 2104)
@@ -11,6 +11,17 @@
 ! = Update/Change
 ===============================================================================
 
+20 Nov-2014 Build 2104 Manuela v.d.Decken(DarkViper)
+! complete rebuild of wb/install/ - changed to use import-struct.sql
+! change class WbDatabase from mysql to msqli
+! rework of WbDatabase::importSql()
+! function db_update_key_value() optimized for speed
+! field `settings_id`removed from table `settings` and new primary key set to `name`
+! update-script extended to modify table `settings`
+23 Sep-2014 Build 2103 Dietmar Woellbrink (Luisehahne)
+! undo invalid commit
+22 Sep-2014 Build 2102 Dietmar Woellbrink (Luisehahne)
+! invalid commit
 14 Feb-2014 Build 2101 Manuela v.d.Decken(DarkViper)
 # typofix of class name in class.login and depending files
 11 Feb-2014 Build 2100 Manuela v.d.Decken(DarkViper)
Index: branches/2.8.x/wb/upgrade-script.php
===================================================================
--- branches/2.8.x/wb/upgrade-script.php	(revision 2103)
+++ branches/2.8.x/wb/upgrade-script.php	(revision 2104)
@@ -86,6 +86,9 @@
 $oDb  = WbDatabase::getInstance();
 $oReg = WbAdaptor::getInstance();
 UpgradeHelper::checkSetupFiles(str_replace('\\', '/', __DIR__).'/');
+// --- modify table `settings` -----------------------------------------------------------
+$oDb->removeField($oDb->TablePrefix.'settings', 'setting_id');
+$oDb->addIndex($oDb->TablePrefix.'settings', 'PRIMARY', 'name', 'PRIMARY');
 // --- set DEFAULT_THEME and restart if needed -------------------------------------------
 if (isset($oReg->DefaultTheme) && trim($oReg->DefaultTheme, '/') != 'WbTheme') {
     db_update_key_value('settings', 'default_theme', 'WbTheme');
@@ -128,8 +131,7 @@
 if(!defined('WB_REVISION')) { define('WB_REVISION',''); }
 // database tables including in WB package
 $aPackage = array (
-    'settings','groups','addons','pages','sections','search','users',
-    'mod_captcha_control','mod_jsadmin','mod_menu_link','mod_output_filter','mod_wrapper','mod_wysiwyg'
+    'settings','groups','addons','pages','sections','search','users'
 );
 
 $OK            = ' <span class="ok">OK</span> ';
@@ -768,6 +770,14 @@
 	$aDebugMessage[] = "<span>Modify field publ_end on sections table</span>";
 	$aDebugMessage[] = ($database->field_modify($table_name, 'publ_end', $description) ? " $OK<br />" : " $FAIL!<br />");
 
+    /**********************************************************
+	 *  - Add field "title" to table sections
+	 */
+	$table_name = TABLE_PREFIX.'sections';
+	$field_name = 'title';
+	$description = "VARCHAR( 255 ) NOT NULL DEFAULT 'Section-ID 0' ";
+	add_modify_field_in_database($table_name,$field_name,$description);
+
 	if($bDebugModus) {
 		echo implode(PHP_EOL,$aDebugMessage);
 	} else {
@@ -792,12 +802,12 @@
 	$sSystemPermissions .= 'modules,modules_advanced,modules_install,modules_uninstall,modules_view,pages,pages_add,pages_add_l0,pages_delete,pages_intro,pages_modify,pages_settings,pages_view,';
 	$sSystemPermissions .= 'preferences,preferences_view,settings,settings_advanced,settings_basic,settings_view,templates,templates_install,templates_uninstall,templates_view,users,users_add,users_delete,users_modify,users_view';
 
-	$sql  = 'UPDATE `'.TABLE_PREFIX.'groups` ';
-	$sql .= 'SET `name` = \'Administrators\', ';
-	$sql .= '`system_permissions` = \''.$sSystemPermissions.'\', ';
-	$sql .= '`module_permissions` = \''.$sModulePermissions.'\', ';
-	$sql .= '`template_permissions` = \''.$sTemplatePermissions.'\' ';
-	$sql .= 'WHERE `group_id` = \'1\' ';
+	$sql = 'UPDATE `'.TABLE_PREFIX.'groups` '
+         . 'SET `name` = \'Administrators\', '
+         .     '`system_permissions` = \''.$sSystemPermissions.'\', '
+         .     '`module_permissions` = \''.$sModulePermissions.'\', '
+         .     '`template_permissions` = \''.$sTemplatePermissions.'\' '
+         . 'WHERE `group_id` = \'1\' ';
 	$aDebugMessage[] = ($database->query($sql)) ? " $OK<br />" : " $FAIL!<br />";
 	if( ($admin->is_authenticated() == true) && ($admin->ami_group_member('1') ) ) {
 	    $_SESSION['SYSTEM_PERMISSIONS'] = array_merge($_SESSION['SYSTEM_PERMISSIONS'], explode(',', $sSystemPermissions));
Index: branches/2.8.x/wb/admin/interface/version.php
===================================================================
--- branches/2.8.x/wb/admin/interface/version.php	(revision 2103)
+++ branches/2.8.x/wb/admin/interface/version.php	(revision 2104)
@@ -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', '2101');
+if(!defined('REVISION')) define('REVISION', '2104');
 if(!defined('SP')) define('SP', '');
Index: branches/2.8.x/wb/framework/WbDatabase.php
===================================================================
--- branches/2.8.x/wb/framework/WbDatabase.php	(revision 2103)
+++ branches/2.8.x/wb/framework/WbDatabase.php	(revision 2104)
@@ -33,6 +33,19 @@
 
 /* -------------------------------------------------------- */
 @define('DATABASE_CLASS_LOADED', true);
+	/* define the old mysql consts for Backward compatibility */
+	if (!defined('MYSQL_ASSOC'))
+	{
+		define('MYSQL_SEEK_LAST',            -1);
+		define('MYSQL_SEEK_FIRST',            0);
+		define('MYSQL_ASSOC',                 1);
+		define('MYSQL_NUM',                   2);
+		define('MYSQL_BOTH',                  3);
+		define('MYSQL_CLIENT_COMPRESS',      32);
+		define('MYSQL_CLIENT_IGNORE_SPACE', 256);
+		define('MYSQL_CLIENT_INTERACTIVE', 1024);
+		define('MYSQL_CLIENT_SSL',         2048);
+	}
 
 class WbDatabase {
 
@@ -52,17 +65,17 @@
  * __constructor
  *  prevent from public instancing
  */
-	private function  __construct() {}
+	final private function  __construct() {}
 /**
  * prevent from cloning
  */
-	private function __clone() {}
+	final private function __clone() {}
 /**
  * get a valid instance of this class
  * @param string $sIdentifier selector for several different instances
  * @return WbDatabase object
  */
-	public static function getInstance($sIdentifier = 'core')
+	final public static function getInstance($sIdentifier = 'core')
 	{
 		if( !isset(self::$_oInstances[$sIdentifier])) {
             $c = __CLASS__;
@@ -76,7 +89,7 @@
  * disconnect and kills an existing instance
  * @param string $sIdentifier selector for instance to kill
  */
-	public static function killInstance($sIdentifier)
+	final public static function killInstance($sIdentifier)
 	{
 		if($sIdentifier != 'core') {
 			if( isset(self::$_oInstances[$sIdentifier])) {
@@ -105,7 +118,7 @@
 			$username = isset($aIni['user']) ? $aIni['user'] : '';
 			$password = isset($aIni['pass']) ? $aIni['pass'] : '';
 			$hostport = isset($aIni['port']) ? $aIni['port'] : '3306';
-			$hostport = $hostport == '3306' ? '' : ':'.$hostport;
+			$hostport = $hostport == '3306' ? null : $hostport;
 			$db_name  = ltrim(isset($aIni['path']) ? $aIni['path'] : '', '/\\');
 			$sTmp = isset($aIni['query']) ? $aIni['query'] : '';
 			$aQuery = explode('&', $sTmp);
@@ -126,21 +139,14 @@
 		} else {
 			throw new WbDatabaseException('Missing parameter: unable to connect database');
 		}
-		$this->oDbHandle = @mysql_connect($hostname.$hostport, $username, $password, true);
+		$this->oDbHandle = @mysqli_connect($hostname, $username, $password, $db_name, $hostport);
 		if (!$this->oDbHandle) {
-			throw new WbDatabaseException('unable to connect \''.$scheme.'://'.$hostname.$hostport.'\'');
+			throw new WbDatabaseException('unable to connect \''.$scheme.'://'.$hostname.':'.$hostport.'\'');
 		} else {
-			if (!@mysql_select_db($db_name, $this->oDbHandle)) {
-				throw new WbDatabaseException('unable to select database \''.$db_name.
-				                              '\' on \''.$scheme.'://'.
-				                              $hostname.$hostport.'\''
-				                             );
-			} else {
-				if ($this->sCharset) {
-					@mysql_query('SET NAMES \''.$this->sCharset.'\'', $this->oDbHandle);
-				}
-				$this->connected = true;
-			}
+            if ($this->sCharset) {
+                @mysqli_query($this->oDbHandle, 'SET NAMES \''.$this->sCharset.'\'');
+            }
+            $this->connected = true;
 		}
 		return $this->connected;
 	}
@@ -153,7 +159,7 @@
 	public function disconnect()
 	{
 		if ($this->connected == true && $oInstance->sInstanceIdentifier != 'core') {
-			mysql_close($this->oDbHandle);
+			mysqli_close($this->oDbHandle);
 			$this->connected = false;
 			return true;
 		}
@@ -161,6 +167,7 @@
 	}
 /**
  * Alias for doQuery()
+ * @deprecated from WB-2.8.5 and higher
  */
 	public function query($statement)
 	{
@@ -173,10 +180,10 @@
  */
 	public function doQuery($statement) {
 		$this->iQueryCount++;
-		$mysql = new mysql();
-		$mysql->query($statement, $this->oDbHandle);
+		$mysql = new mysql($this->oDbHandle);
+		$mysql->query($statement);
 		$this->set_error($mysql->error($this->oDbHandle));
-		if ($mysql->error($this->oDbHandle)) {
+		if ($mysql->error()) {
 			return null;
 		} else {
 			return $mysql;
@@ -184,6 +191,7 @@
 	}
 /**
  * Alias for getOne()
+ * @deprecated from WB-2.8.5 and higher
  */
 	public function get_one( $statement )
 	{
@@ -198,10 +206,11 @@
 	public function getOne( $statement )
 	{
 		$this->iQueryCount++;
-		$fetch_row = mysql_fetch_array(mysql_query($statement, $this->oDbHandle));
+		$fetch_row = mysqli_fetch_array(mysqli_query($this->oDbHandle, $statement));
 		$result = $fetch_row[0];
-		$this->set_error(mysql_error($this->oDbHandle));
-		if (mysql_error($this->oDbHandle)) {
+		$this->set_error(null);
+		if (mysqli_error($this->oDbHandle)) {
+    		$this->set_error(mysqli_error($this->oDbHandle));
 			return null;
 		} else {
 			return $result;
@@ -209,6 +218,7 @@
 	}
 /**
  * Alias for setError()
+ * @deprecated from WB-2.8.5 and higher
  */
 	public function set_error($message = null)
 	{
@@ -225,6 +235,7 @@
 	}
 /**
  * Alias for isError
+ * @deprecated from WB-2.8.5 and higher
  */
 	public function is_error()
 	{
@@ -240,6 +251,7 @@
 	}
 /**
  * Alias for getError
+ * @deprecated from WB-2.8.5 and higher
  */
 	public function get_error()
 	{
@@ -278,7 +290,7 @@
 				break;
 			case 'LastInsertId':
 			case 'getLastInsertId': // << set deprecated
-				$retval = mysql_insert_id($this->oDbHandle);
+				$retval = $this->getLastInsertId();
 				break;
 			case 'DbName':
 			case 'getDbName': // << set deprecated
@@ -306,7 +318,7 @@
  */
 	public function escapeString($unescaped_string)
 	{
-		return mysql_real_escape_string($unescaped_string, $this->oDbHandle);
+		return mysqli_real_escape_string($this->oDbHandle, $unescaped_string);
 	}
 /**
  * Last inserted Id
@@ -314,10 +326,11 @@
  */	
 	public function getLastInsertId()
 	{
-		return mysql_insert_id($this->oDbHandle);
+		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)
 	{
@@ -331,11 +344,12 @@
 	public function isField($table_name, $field_name)
 	{
 		$sql = 'DESCRIBE `'.$table_name.'` `'.$field_name.'` ';
-		$query = $this->query($sql, $this->oDbHandle);
+		$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)
 	{
@@ -352,7 +366,7 @@
 		$number_fields = intval($number_fields);
 		$keys = 0;
 		$sql = 'SHOW INDEX FROM `'.$table_name.'`';
-		if (($res_keys = $this->doQuery($sql, $this->oDbHandle))) {
+		if (($res_keys = $this->doQuery($sql))) {
 			while (($rec_key = $res_keys->fetchRow(MYSQL_ASSOC))) {
 				if ( $rec_key['Key_name'] == $index_name ) {
 					$keys++;
@@ -368,6 +382,7 @@
 	}
 /**
  * Alias for addField()
+ * @deprecated from WB-2.8.5 and higher
  */
 	public function field_add($table_name, $field_name, $description)
 	{
@@ -384,8 +399,8 @@
 		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->oDbHandle);
-			$this->set_error(mysql_error($this->oDbHandle));
+			$query = $this->doQuery($sql);
+			$this->set_error(mysqli_error($this->oDbHandle));
 			if (!$this->isError()) {
 				return ( $this->isField($table_name, $field_name) ) ? true : false;
 			}
@@ -396,6 +411,7 @@
 	}
 /**
  * Alias for modifyField()
+ * @deprecated from WB-2.8.5 and higher
  */
 	public function field_modify($table_name, $field_name, $description)
 	{
@@ -413,13 +429,14 @@
 		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, $this->oDbHandle) ? true : false);
-			$this->setError(mysql_error());
+			$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)
 	{
@@ -442,6 +459,7 @@
 	}
 /**
  * Alias for addIndex()
+ * @deprecated from WB-2.8.5 and higher
  */
     public function index_add($table_name, $index_name, $field_list, $index_type = 'KEY')
 	{
@@ -466,17 +484,18 @@
         {
             $sql  = 'ALTER TABLE `'.$table_name.'` ';
             $sql .= 'DROP INDEX `'.$index_name.'`';
-            if (!$this->doQuery($sql, $this->oDbHandle)) { return false; }
+            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, $this->oDbHandle)) { $retval = true; }
+        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)
 	{
@@ -493,16 +512,17 @@
 		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, $this->oDbHandle) ? true : false );
+			$retval = ( $this->doQuery($sql) ? true : false );
 		}
 		return $retval;
 	}
 /**
  * Alias for importSql()
+ * @deprecated from WB-2.8.5 and higher
  */
 	public function SqlImport($sSqlDump,
 	                          $sTablePrefix = '',
-	                          $bPreserve    = true,
+	                          $sAction      = 'install',
 	                          $sEngine      = 'MyISAM',
 	                          $sCollation   = 'utf8_unicode_ci')
 	{
@@ -509,33 +529,104 @@
 		return $this->importSql($sSqlDump, $sTablePrefix, $bPreserve, $sEngine, $sCollation);
 	}
 /**
- * Import a standard *.sql dump file
- * @param string $sSqlDump link to the sql-dumpfile
- * @param string $sTablePrefix
- * @param bool     $bPreserve   set to true will ignore all DROP TABLE statements
- * @param string   $sEngine     can be 'MyISAM' or 'InnoDB'
- * @param string   $sCollation  one of the list of available collations
- * @return boolean true if import successful
- * @description Import a standard *.sql dump file<br />
- *              The file can include placeholders TABLE_PREFIX, TABLE_COLLATION and TABLE_ENGINE
+ * Import an SQl-Dumpfile witch can include unlimited placeholders for values
+ * @param mixed  $mSqlDump      can be string with filename or array with additional vars
+ * @param string $sTablePrefix  can be used to override settings from WbDatabase object
+ * @param string $sAction       'install', 'uninstall', 'upgrade', 'repair
+ * @param string $sEngine       kind of table engine: MyIsam(default)
+ * @param string $sCollation    utf8_unicode_ci(default)
+ * @return bool  false on error
  */
-	public function importSql($sSqlDump,
-	                          $sTablePrefix = '', /* unused argument, for backward compatibility only! */
-	                          $bPreserve    = true,
-	                          $sEngine      = 'MyISAM',
-	                          $sCollation   = 'utf8_unicode_ci')
-	{
-		$sCollation = ($sCollation != '' ? $sCollation : 'utf8_unicode_ci');
-		$aCharset = preg_split('/_/', $sCollation, null, PREG_SPLIT_NO_EMPTY);
-		$sEngine = 'ENGINE='.$sEngine.' DEFAULT CHARSET='.$aCharset[0].' COLLATE='.$sCollation;
-		$sCollation = ' collate '.$sCollation;
+	public function importSql(
+        $mSqlDump,
+        $sTablePrefix = '',               // can override settings from WbDatabase object
+        $sAction      = 'install',        // skip 'DROP TABLE' statements
+        $sEngine      = 'MyISAM',         // the default table engine
+        $sCollation   = 'utf8_unicode_ci' // the default collation to use
+    )
+    {
 		$retval = true;
 		$this->error = '';
-		$aSearch  = array('{TABLE_PREFIX}','{TABLE_ENGINE}', '{TABLE_COLLATION}');
-		$aReplace = array($this->sTablePrefix, $sEngine, $sCollation);
+        // sanitize arguments
+        if (! is_string($sAction)) {
+            $sAction = $sAction ? 'repair' : 'install';
+        }
+        $aAllowedActions = array('install', 'uninstall', 'upgrade', 'repair');
+        $sAction = strtolower(preg_replace('/^.*?('.implode('|', $aAllowedActions).')(\.php)?$/iU', '$1', $sAction));
+        $sAction = (in_array($sAction, $aAllowedActions) ? $sAction : 'install');
+        $sTablePrefix = trim($sTablePrefix);
+        $aEngineTypes = array(
+            'csv'        => 'CSV',
+            'blackhole'  => 'BLACKHOLE',
+            'memory'     => 'MEMORY',
+            'myisam'     => 'MyISAM',
+            'innodb'     => 'InnoDB',
+            'archive'    => 'ARCHIVE',
+            'mrg_myisam' => 'MRG_MYISAM'
+        );
+        if (isset($aEngineTypes[strtolower($sEngine)])) {
+            $sEngine = $aEngineTypes[strtolower($sEngine)];
+        } else {
+            $sEngine = 'MyISAM';
+        }
+        // test if selected collation is available. Otherwise select 'utf8_unicode_ci'
+        $sql = 'SELECT COUNT(*) FROM `COLLATIONS` '
+             . 'WHERE `COLLATION_NAME`=\''.$sCollation.'\'';
+        $sCollation = ($this->get_one($sql) ? $sCollation : 'utf8_unicode_ci');
+        $aTmp = preg_split('/_/', $sCollation, null, PREG_SPLIT_NO_EMPTY);
+        $sCharset = $aTmp[0];
+        // define array of searches
+        $aSearch  = array(
+            '/\{TABLE_PREFIX\}/',
+            '/\{TABLE_COLLATION\}/', // deprecated from 2.8.4
+            '/\{FIELD_COLLATION\}/', // deprecated from 2.8.4
+            '/\{TABLE_ENGINE\}/',
+            '/\{TABLE_ENGINE=([a-zA-Z_0-9]*)\}/',
+            '/\{CHARSET\}/',
+            '/\{COLLATION\}/'
+        );
+        // define array of replacements
+        $aReplace = array(
+            $sTablePrefix,
+            ' COLLATE {COLLATION}', // deprecated from 2.8.4
+            ' COLLATE {COLLATION}', // deprecated from 2.8.4
+            ' {ENGINE='.$sEngine.'}',
+            ' ENGINE=$1 DEFAULT CHARSET={CHARSET} COLLATION={COLLATION}',
+            $sCharset,
+            $sCollation
+        );
+
+        if (is_array($mSqlDump)) {
+            // try to get dumpfile name
+            if (!isset($mSqlDump['sSqlDump'])) {
+                $this->error = 'missing index \'sSqlDump\' in $mSqlDump';
+                return false;
+            } else {
+            // get dumpfile name from array and then remove entry
+                $sDumpFile = (string)$mSqlDump['sSqlDump'];
+                unset($mSqlDump['sSqlDump']);
+                // import all vars and it's values from array
+                foreach ($mSqlDump as $sIndex => $sValue) {
+                    // transform varname into placeholder name ('sPageTitle' => 'PAGE_TITLE')
+                    $sIndex = strtoupper(preg_replace('/([a-z0-9])([A-Z])/', '\1_\2', ltrim($sIndex, 'a..z')));
+                    // fill search/replace arrays
+                    $aSearch[]  = '/\{'.$sIndex.'\}/';
+                    $aReplace[] = $sValue ;
+                }
+            }
+        } elseif (is_string($mSqlDump)) {
+            $sDumpFile = (string)$mSqlDump;
+        } else {
+            $this->error = 'invalid argument $mSqlDump';
+            return false;
+        }
+        if (!is_readable($sDumpFile)) {
+            $this->Error = 'unable to open \''.$sDumpFile.'\'';
+            return false;
+        }
 		$sql = '';
-		$aSql = file($sSqlDump);
-//		$aSql[0] = preg_replace('/^\xEF\xBB\xBF/', '', $aSql[0]);
+		$aSql = file($sDumpFile, FILE_SKIP_EMPTY_LINES);
+        //	remove possible ByteOrderMark
 		$aSql[0] = preg_replace('/^[\xAA-\xFF]{3}/', '', $aSql[0]);
 		while (sizeof($aSql) > 0) {
 			$sSqlLine = trim(array_shift($aSql));
@@ -542,21 +633,37 @@
 			if (!preg_match('/^[-\/]+.*/', $sSqlLine)) {
 				$sql = $sql.' '.$sSqlLine;
 				if ((substr($sql,-1,1) == ';')) {
-					$sql = trim(str_replace( $aSearch, $aReplace, $sql));
-					if (!($bPreserve && preg_match('/^\s*DROP TABLE IF EXISTS/siU', $sql))) {
-						if (!mysql_query($sql, $this->oDbHandle)) {
-							$retval = false;
-							$this->error = mysql_error($this->oDbHandle);
-							unset($aSql);
-							break;
-						}
-					}
+					$sql = trim(preg_replace($aSearch, $aReplace, $sql));
+                    $sAvailSqlObjects = 'TABLE|VIEW|INDEX|PROCEDURE|FUNCTION|TRIGGER|EVENT';
+                    switch ($sAction) {
+                        case 'uninstall': // skip CREATE; execute DROP
+                            if (preg_match('/^\s*CREATE ('.$sAvailSqlObjects.') /siU', $sql)) {
+                                $sql = '';
+                                continue; // read next statement
+                            }
+                            break;
+                        case 'upgrade': // skip DROP; execute CREATE
+                        case 'repair':  // skip DROP; execute CREATE
+                            if (preg_match('/^\s*DROP ('.$sAvailSqlObjects.') /siU', $sql)) {
+                                $sql = '';
+                                continue; // read next statement
+                            }
+                            break;
+                        default: // install:  execute DROP; execute CREATE
+                            break;
+                    }
+                    if (!$this->doQuery($sql)) {
+                        $retval = false;
+                        $this->error = $this->getError();
+                        unset($aSql);
+                        break;
+                    }
 					$sql = '';
 				}
 			}
 		}
 		return $retval;
-	}
+    } // end of function importSql()
 /**
  * retuns the type of the engine used for requested table
  * @param string $table name of the table, including prefix
@@ -565,10 +672,10 @@
 	public function getTableEngine($table)
 	{
 		$retVal = false;
-		$mysqlVersion = mysql_get_server_info($this->oDbHandle);
+		$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, $this->oDbHandle))) {
+		if (($result = $this->doQuery($sql))) {
 			if (($row = $result->fetchRow(MYSQL_ASSOC))) {
 				$retVal = $row[$engineValue];
 			}
@@ -614,28 +721,31 @@
  */
 class mysql {
 
-	private $result = null;
+	private $result    = null;
 	private $oDbHandle = null;
+    private $error     = '';
 
+    public function __construct($oHandle)
+    {
+        $this->oDbHandle = $oHandle;
+    }
 /**
  * query sql statement
  * @param  string $statement
- * @param  object $dbHandle
  * @return object
  * @throws WbDatabaseException
  */
-	function query($statement, $dbHandle)
+	function query($sStatement)
 	{
-		$this->oDbHandle = $dbHandle;
-		$this->result = @mysql_query($statement, $this->oDbHandle);
+		$this->result = @mysqli_query($this->oDbHandle, $sStatement);
 		if ($this->result === false) {
 			if (DEBUG) {
-				throw new WbDatabaseException(mysql_error($this->oDbHandle));
+				throw new WbDatabaseException(mysqli_error($this->oDbHandle));
 			} else {
 				throw new WbDatabaseException('Error in SQL-Statement');
 			}
 		}
-		$this->error = mysql_error($this->oDbHandle);
+		$this->error = mysqli_error($this->oDbHandle);
 		return $this->result;
 	}
 /**
@@ -645,7 +755,7 @@
  */
 	function numRows()
 	{
-		return mysql_num_rows($this->result);
+		return mysqli_num_rows($this->result);
 	}
 /**
  * fetchRow
@@ -655,7 +765,7 @@
  */
 	function fetchRow($typ = MYSQL_BOTH)
 	{
-		return mysql_fetch_array($this->result, $typ);
+		return mysqli_fetch_array($this->result, $typ);
 	}
 /**
  * fetchObject
@@ -667,7 +777,7 @@
 	function fetchObject($sClassName = null, array $aParams = null)
 	{
 		if ($sClassName === null || class_exists($sClassName)) {
-			return mysql_fetch_object($this->result, $sClassName, $aParams);
+			return mysqli_fetch_object($this->result, $sClassName, $aParams);
 		} else {
 			throw new WbDatabaseException('Class <'.$sClassName.'> not available on request of mysql_fetch_object()');
 		}
@@ -691,7 +801,7 @@
 	{
 		$pmax = $this->numRows() - 1;
 		$p = (($position < 0 || $position > $pmax) ? $pmax : $position);
-		return mysql_data_seek($this->result, $p);
+		return mysqli_data_seek($this->result, $p);
 	}
 /**
  * freeResult
@@ -700,7 +810,7 @@
  */
 	function freeResult()
 	{
-		return mysql_free_result($this->result);
+		return mysqli_free_result($this->result);
 	}
 /** 
  * Get error
@@ -737,25 +847,17 @@
 			}
 		}
 		$retval = true;
-		foreach( $key as $index=>$val)
-		{
-			$index = strtolower($index);
-			$sql = 'SELECT COUNT(`setting_id`) '
-			     . 'FROM `'.$oDb->TablePrefix.$table.'` '
-			     . 'WHERE `name` = \''.$index.'\' ';
-			if ($oDb->getOne($sql)) {
-				$sql = 'UPDATE ';
-				$sql_where = 'WHERE `name` = \''.$index.'\'';
-			} else {
-				$sql = 'INSERT INTO ';
-				$sql_where = '';
-			}
-			$sql .= '`'.$oDb->TablePrefix.$table.'` ';
-			$sql .= 'SET `name` = \''.$index.'\', ';
-			$sql .= '`value` = \''.$val.'\' '.$sql_where;
+        $sNameValPairs = '';
+		foreach ($key as $index => $val) {
+            $sNameValPairs .= ', (\''.$index.'\', \''.$val.'\')';
+        }
+        $sValues = ltrim($sNameValPairs, ', ');
+        if ($sValues != '') {
+            $sql = 'REPLACE INTO `'.$oDb->TablePrefix.$table.'` (`name`, `value`) '
+                 . 'VALUES '.$sValues;
 			if (!$oDb->doQuery($sql)) {
 				$retval = false;
 			}
-		}
+        }
 		return $retval;
 	}
Index: branches/2.8.x/wb/install/sql/wb_search_data.sql
===================================================================
--- branches/2.8.x/wb/install/sql/wb_search_data.sql	(revision 2103)
+++ branches/2.8.x/wb/install/sql/wb_search_data.sql	(nonexistent)
@@ -1,69 +0,0 @@
--- phpMyAdmin SQL Dump
--- Date of creation: 2012-11-17 12:37am
--- Server Version: 5.1.41
--- Revision     $Revision$
--- Link         $HeadURL$
--- Date of modified $Date$
--- initial data for table `{TABLE_PREFIX}search`
---
-INSERT INTO `{TABLE_PREFIX}search` SET
-	`name`='header',
-	`value`='<h1>[TEXT_SEARCH]</h1>\n<form name="searchpage" action="[WB_URL]/search/index.php" method="get">\n<table cellpadding="3" cellspacing="0" border="0" style="width:100%; max-width:500px">\n<tr>\n<td>\n<input type="hidden" name="search_path" value="[SEARCH_PATH]" />\n<input type="hidden" name="referrer" value="[REFERRER_ID]" />\n<input type="text" name="string" value="[SEARCH_STRING]" style="width: 100%;" />\n</td>\n<td width="100">\n<input type="submit" value="[TEXT_SEARCH]" style="width: 100%;" />\n</td>\n</tr>\n<tr>\n<td colspan="2">\n<input type="radio" name="match" id="match_all" value="all"[ALL_CHECKED] />\n<label for="match_all">[TEXT_ALL_WORDS]</label>\n<input type="radio" name="match" id="match_any" value="any"[ANY_CHECKED] />\n<label for="match_any">[TEXT_ANY_WORDS]</label>\n<input type="radio" name="match" id="match_exact" value="exact"[EXACT_CHECKED] />\n<label for="match_exact">[TEXT_EXACT_MATCH]</label>\n</td>\n</tr>\n</table>\n</form>\n<hr />',
-	`extra`='';
-INSERT INTO `{TABLE_PREFIX}search` SET
-	`name`='footer',
-	`value`='',
-	`extra`='';
-INSERT INTO `{TABLE_PREFIX}search` SET
-	`name`='results_header',
-	`value`='<p>[TEXT_RESULTS_FOR] <strong>[SEARCH_STRING]</strong>:</p>\n<div class="searchresults">',
-	`extra`='';
-INSERT INTO `{TABLE_PREFIX}search` SET
-	`name`='results_loop',
-	`value`='<h3 style="margin:10px 0 3px 0;"><a href="[LINK]">[TITLE]</a></h3>\n<div style="font-size:0.8em;">[TEXT_LAST_UPDATED_BY] [DISPLAY_NAME] [TEXT_ON] [DATE]</div>\n<p style="padding: 0 0 5px 0; margin: 2px 0 10px 0; border-bottom: 1px solid #777;">[DESCRIPTION].. [EXCERPT]</p>',
-	`extra`='';
-INSERT INTO `{TABLE_PREFIX}search` SET
-	`name`='results_footer',
-	`value`='</div>',
-	`extra`='';
-INSERT INTO `{TABLE_PREFIX}search` SET
-	`name`='no_results',
-	`value`='<p>[TEXT_NO_RESULTS]</p>',
-	`extra`='';
-INSERT INTO `{TABLE_PREFIX}search` SET
-	`name`='module_order',
-	`value`='wysiwyg',
-	`extra`='';
-INSERT INTO `{TABLE_PREFIX}search` SET
-	`name`='max_excerpt',
-	`value`='5',
-	`extra`='';
-INSERT INTO `{TABLE_PREFIX}search` SET
-	`name`='time_limit',
-	`value`='0',
-	`extra`='';
-INSERT INTO `{TABLE_PREFIX}search` SET
-	`name`='cfg_enable_old_search',
-	`value`='true',
-	`extra`='';
-INSERT INTO `{TABLE_PREFIX}search` SET
-	`name`='cfg_search_keywords',
-	`value`='true',
-	`extra`='';
-INSERT INTO `{TABLE_PREFIX}search` SET
-	`name`='cfg_search_description',
-	`value`='true',
-	`extra`='';
-INSERT INTO `{TABLE_PREFIX}search` SET
-	`name`='cfg_show_description',
-	`value`='true',
-	`extra`='';
-INSERT INTO `{TABLE_PREFIX}search` SET
-	`name`='cfg_enable_flush',
-	`value`='true',
-	`extra`='';
-INSERT INTO `{TABLE_PREFIX}search` SET
-	`name`='template',
-	`value`='',
-	`extra`='';
--- End of file
\ No newline at end of file

Property changes on: branches/2.8.x/wb/install/sql/wb_search_data.sql
___________________________________________________________________
Deleted: svn:keywords
## -1,4 +0,0 ##
-Id
-Revision
-HeadURL
-Date
\ No newline at end of property
Index: branches/2.8.x/wb/install/sql/websitebaker.sql
===================================================================
--- branches/2.8.x/wb/install/sql/websitebaker.sql	(revision 2103)
+++ branches/2.8.x/wb/install/sql/websitebaker.sql	(nonexistent)
@@ -1,138 +0,0 @@
--- phpMyAdmin SQL Dump
--- Date of creation: 2012-11-17 12:37am
--- Server Version: 5.1.41
-SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
--- --------------------------------------------------------
--- Database structure for WebsiteBaker core
---
--- Replacements: {TABLE_PREFIX}, {TABLE_ENGINE}, {TABLE_COLLATION}
---
--- --------------------------------------------------------
---
--- Structure of table  '{TABLE_PREFIX}addons'
---
-DROP TABLE IF EXISTS `{TABLE_PREFIX}addons`;
-CREATE TABLE IF NOT EXISTS `{TABLE_PREFIX}addons` (
-  `addon_id` int(11) NOT NULL AUTO_INCREMENT,
-  `type` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '',
-  `directory` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '',
-  `name` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '',
-  `description` text{TABLE_COLLATION} NOT NULL,
-  `function` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '',
-  `version` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '',
-  `platform` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '',
-  `author` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '',
-  `license` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '',
-  PRIMARY KEY (addon_id)
-){TABLE_ENGINE};
---
--- Structure of table  '{TABLE_PREFIX}groups'
---
-DROP TABLE IF EXISTS `{TABLE_PREFIX}groups`;
-CREATE TABLE IF NOT EXISTS `{TABLE_PREFIX}groups` (
-  `group_id` int(11) NOT NULL AUTO_INCREMENT,
-  `name` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '',
-  `system_permissions` text{TABLE_COLLATION} NOT NULL,
-  `module_permissions` text{TABLE_COLLATION} NOT NULL,
-  `template_permissions` text{TABLE_COLLATION} NOT NULL,
-  PRIMARY KEY (`group_id`)
-){TABLE_ENGINE};
---
--- Structure of table  '{TABLE_PREFIX}pages'
---
-DROP TABLE IF EXISTS `{TABLE_PREFIX}pages`;
-CREATE TABLE IF NOT EXISTS `{TABLE_PREFIX}pages` (
-  `page_id` int(11) NOT NULL AUTO_INCREMENT,
-  `parent` int(11) NOT NULL DEFAULT '0',
-  `root_parent` int(11) NOT NULL DEFAULT '0',
-  `level` int(11) NOT NULL DEFAULT '0',
-  `link` varchar(255){TABLE_COLLATION} NOT NULL,
-  `target` varchar(7){TABLE_COLLATION} NOT NULL DEFAULT '',
-  `page_title` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '',
-  `page_icon` varchar(512){TABLE_COLLATION} NOT NULL DEFAULT '',
-  `menu_title` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '',
-  `menu_icon_0` varchar(512){TABLE_COLLATION} NOT NULL DEFAULT '',
-  `menu_icon_1` varchar(512){TABLE_COLLATION} NOT NULL DEFAULT '',
-  `tooltip` varchar(512){TABLE_COLLATION} NOT NULL DEFAULT '',
-  `description` text{TABLE_COLLATION} NOT NULL,
-  `keywords` text{TABLE_COLLATION} NOT NULL,
-  `page_trail` varchar(255){TABLE_COLLATION} NOT NULL,
-  `template` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '',
-  `visibility` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '',
-  `position` int(11) NOT NULL DEFAULT '0',
-  `menu` int(11) NOT NULL DEFAULT '1',
-  `language` varchar(5){TABLE_COLLATION} NOT NULL DEFAULT '',
-  `page_code` int(11) NOT NULL DEFAULT '0',
-  `searching` int(11) NOT NULL DEFAULT '0',
-  `admin_groups` varchar(512){TABLE_COLLATION} NOT NULL DEFAULT '1',
-  `admin_users` varchar(512){TABLE_COLLATION} NOT NULL,
-  `viewing_groups` varchar(512){TABLE_COLLATION} NOT NULL DEFAULT '1',
-  `viewing_users` varchar(512){TABLE_COLLATION} NOT NULL,
-  `modified_when` int(11) NOT NULL DEFAULT '0',
-  `modified_by` int(11) NOT NULL DEFAULT '0',
-  `custom01` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '',
-  `custom02` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '',
-  PRIMARY KEY (`page_id`)
-) {TABLE_ENGINE};
---
--- Structure of table  '{TABLE_PREFIX}sections'
---
-DROP TABLE IF EXISTS `{TABLE_PREFIX}sections`;
-CREATE TABLE IF NOT EXISTS `{TABLE_PREFIX}sections` (
-  `section_id` int(11) NOT NULL AUTO_INCREMENT,
-  `page_id` int(11) NOT NULL DEFAULT '0',
-  `position` int(11) NOT NULL DEFAULT '0',
-  `module` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '',
-  `block` int(11) NOT NULL DEFAULT '1',
-  `publ_start` int(11) NOT NULL DEFAULT '0',
-  `publ_end` int(11) NOT NULL DEFAULT '0',
-  PRIMARY KEY (`section_id`)
-) {TABLE_ENGINE};
---
--- Structure of table  '{TABLE_PREFIX}users'
---
-DROP TABLE IF EXISTS `{TABLE_PREFIX}users`;
-CREATE TABLE IF NOT EXISTS `{TABLE_PREFIX}users` (
-  `user_id` int(11) NOT NULL AUTO_INCREMENT,
-  `group_id` int(11) NOT NULL DEFAULT '0' COMMENT 'this field is set deprecated and never used in WB',
-  `groups_id` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '0',
-  `active` int(11) NOT NULL DEFAULT '0',
-  `username` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '',
-  `password` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '',
-  `confirm_code` varchar(32){TABLE_COLLATION} NOT NULL DEFAULT '',
-  `confirm_timeout` int(11) NOT NULL DEFAULT '0',
-  `remember_key` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '',
-  `last_reset` int(11) NOT NULL DEFAULT '0',
-  `display_name` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '',
-  `email` text{TABLE_COLLATION} NOT NULL,
-  `timezone` int(11) NOT NULL DEFAULT '0',
-  `date_format` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '',
-  `time_format` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '',
-  `language` varchar(5){TABLE_COLLATION} NOT NULL DEFAULT 'EN',
-  `home_folder` text{TABLE_COLLATION} NOT NULL,
-  `login_when` int(11) NOT NULL DEFAULT '0',
-  `login_ip` varchar(15){TABLE_COLLATION} NOT NULL DEFAULT '',
-  PRIMARY KEY (`user_id`)
-){TABLE_ENGINE};
---
--- Structure of table  '{TABLE_PREFIX}settings'
---
-DROP TABLE IF EXISTS `{TABLE_PREFIX}settings`;
-CREATE TABLE IF NOT EXISTS `{TABLE_PREFIX}settings` (
-  `setting_id` int(11) NOT NULL AUTO_INCREMENT,
-  `name` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '',
-  `value` text{TABLE_COLLATION} NOT NULL,
-  PRIMARY KEY (`setting_id`)
-){TABLE_ENGINE};
---
--- Structure of table `{TABLE_PREFIX}search`
---
-DROP TABLE IF EXISTS `{TABLE_PREFIX}search`;
-CREATE TABLE IF NOT EXISTS `{TABLE_PREFIX}search` (
-  `search_id` int(11) NOT NULL AUTO_INCREMENT,
-  `name` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '',
-  `value` text{TABLE_COLLATION} NOT NULL,
-  `extra` text{TABLE_COLLATION} NOT NULL,
-  PRIMARY KEY (`search_id`)
-){TABLE_ENGINE};
--- EndOfFile
\ No newline at end of file

Property changes on: branches/2.8.x/wb/install/sql/websitebaker.sql
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Deleted: svn:keywords
## -1,4 +0,0 ##
-Id
-Revision
-HeadURL
-Date
\ No newline at end of property
Index: branches/2.8.x/wb/install/sql/install-struct.sql
===================================================================
--- branches/2.8.x/wb/install/sql/install-struct.sql	(nonexistent)
+++ branches/2.8.x/wb/install/sql/install-struct.sql	(revision 2104)
@@ -0,0 +1,138 @@
+-- phpMyAdmin SQL Dump
+-- Date of creation: 2012-11-17 12:37am
+-- Server Version: 5.1.41
+SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
+-- --------------------------------------------------------
+-- Database structure for WebsiteBaker core
+--
+-- Replacements: {TABLE_PREFIX}, {TABLE_ENGINE}, {TABLE_COLLATION}
+--
+-- --------------------------------------------------------
+--
+-- Structure of table  '{TABLE_PREFIX}addons'
+--
+DROP TABLE IF EXISTS `{TABLE_PREFIX}addons`;
+CREATE TABLE IF NOT EXISTS `{TABLE_PREFIX}addons` (
+  `addon_id` int(11) NOT NULL AUTO_INCREMENT,
+  `type` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '',
+  `directory` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '',
+  `name` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '',
+  `description` text{TABLE_COLLATION} NOT NULL,
+  `function` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '',
+  `version` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '',
+  `platform` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '',
+  `author` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '',
+  `license` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '',
+  PRIMARY KEY (addon_id)
+){TABLE_ENGINE};
+--
+-- Structure of table  '{TABLE_PREFIX}groups'
+--
+DROP TABLE IF EXISTS `{TABLE_PREFIX}groups`;
+CREATE TABLE IF NOT EXISTS `{TABLE_PREFIX}groups` (
+  `group_id` int(11) NOT NULL AUTO_INCREMENT,
+  `name` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '',
+  `system_permissions` text{TABLE_COLLATION} NOT NULL,
+  `module_permissions` text{TABLE_COLLATION} NOT NULL,
+  `template_permissions` text{TABLE_COLLATION} NOT NULL,
+  PRIMARY KEY (`group_id`)
+){TABLE_ENGINE};
+--
+-- Structure of table  '{TABLE_PREFIX}pages'
+--
+DROP TABLE IF EXISTS `{TABLE_PREFIX}pages`;
+CREATE TABLE IF NOT EXISTS `{TABLE_PREFIX}pages` (
+  `page_id` int(11) NOT NULL AUTO_INCREMENT,
+  `parent` int(11) NOT NULL DEFAULT '0',
+  `root_parent` int(11) NOT NULL DEFAULT '0',
+  `level` int(11) NOT NULL DEFAULT '0',
+  `link` varchar(255){TABLE_COLLATION} NOT NULL,
+  `target` varchar(7){TABLE_COLLATION} NOT NULL DEFAULT '',
+  `page_title` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '',
+  `page_icon` varchar(512){TABLE_COLLATION} NOT NULL DEFAULT '',
+  `menu_title` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '',
+  `menu_icon_0` varchar(512){TABLE_COLLATION} NOT NULL DEFAULT '',
+  `menu_icon_1` varchar(512){TABLE_COLLATION} NOT NULL DEFAULT '',
+  `tooltip` varchar(512){TABLE_COLLATION} NOT NULL DEFAULT '',
+  `description` text{TABLE_COLLATION} NOT NULL,
+  `keywords` text{TABLE_COLLATION} NOT NULL,
+  `page_trail` varchar(255){TABLE_COLLATION} NOT NULL,
+  `template` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '',
+  `visibility` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '',
+  `position` int(11) NOT NULL DEFAULT '0',
+  `menu` int(11) NOT NULL DEFAULT '1',
+  `language` varchar(5){TABLE_COLLATION} NOT NULL DEFAULT '',
+  `page_code` int(11) NOT NULL DEFAULT '0',
+  `searching` int(11) NOT NULL DEFAULT '0',
+  `admin_groups` varchar(512){TABLE_COLLATION} NOT NULL DEFAULT '1',
+  `admin_users` varchar(512){TABLE_COLLATION} NOT NULL,
+  `viewing_groups` varchar(512){TABLE_COLLATION} NOT NULL DEFAULT '1',
+  `viewing_users` varchar(512){TABLE_COLLATION} NOT NULL,
+  `modified_when` int(11) NOT NULL DEFAULT '0',
+  `modified_by` int(11) NOT NULL DEFAULT '0',
+  `custom01` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '',
+  `custom02` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '',
+  PRIMARY KEY (`page_id`)
+) {TABLE_ENGINE};
+--
+-- Structure of table  '{TABLE_PREFIX}sections'
+--
+DROP TABLE IF EXISTS `{TABLE_PREFIX}sections`;
+CREATE TABLE IF NOT EXISTS `{TABLE_PREFIX}sections` (
+  `section_id` int(11) NOT NULL AUTO_INCREMENT,
+  `page_id` int(11) NOT NULL DEFAULT '0',
+  `position` int(11) NOT NULL DEFAULT '0',
+  `title` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '',
+  `module` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '',
+  `block` int(11) NOT NULL DEFAULT '1',
+  `publ_start` int(11) NOT NULL DEFAULT '0',
+  `publ_end` int(11) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`section_id`)
+) {TABLE_ENGINE};
+--
+-- Structure of table  '{TABLE_PREFIX}users'
+--
+DROP TABLE IF EXISTS `{TABLE_PREFIX}users`;
+CREATE TABLE IF NOT EXISTS `{TABLE_PREFIX}users` (
+  `user_id` int(11) NOT NULL AUTO_INCREMENT,
+  `group_id` int(11) NOT NULL DEFAULT '0' COMMENT 'this field is set deprecated and never used in WB',
+  `groups_id` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '0',
+  `active` int(11) NOT NULL DEFAULT '0',
+  `username` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '',
+  `password` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '',
+  `confirm_code` varchar(32){TABLE_COLLATION} NOT NULL DEFAULT '',
+  `confirm_timeout` int(11) NOT NULL DEFAULT '0',
+  `remember_key` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '',
+  `last_reset` int(11) NOT NULL DEFAULT '0',
+  `display_name` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '',
+  `email` text{TABLE_COLLATION} NOT NULL,
+  `timezone` int(11) NOT NULL DEFAULT '0',
+  `date_format` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '',
+  `time_format` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '',
+  `language` varchar(5){TABLE_COLLATION} NOT NULL DEFAULT 'EN',
+  `home_folder` text{TABLE_COLLATION} NOT NULL,
+  `login_when` int(11) NOT NULL DEFAULT '0',
+  `login_ip` varchar(15){TABLE_COLLATION} NOT NULL DEFAULT '',
+  PRIMARY KEY (`user_id`)
+){TABLE_ENGINE};
+--
+-- Structure of table  '{TABLE_PREFIX}settings'
+--
+DROP TABLE IF EXISTS `{TABLE_PREFIX}settings`;
+CREATE TABLE IF NOT EXISTS `{TABLE_PREFIX}settings` (
+  `name` varchar(255){TABLE_COLLATION} NOT NULL,
+  `value` text{TABLE_COLLATION} NOT NULL,
+  PRIMARY KEY (`name`)
+){TABLE_ENGINE};
+--
+-- Structure of table `{TABLE_PREFIX}search`
+--
+DROP TABLE IF EXISTS `{TABLE_PREFIX}search`;
+CREATE TABLE IF NOT EXISTS `{TABLE_PREFIX}search` (
+  `search_id` int(11) NOT NULL AUTO_INCREMENT,
+  `name` varchar(255){TABLE_COLLATION} NOT NULL DEFAULT '',
+  `value` text{TABLE_COLLATION} NOT NULL,
+  `extra` text{TABLE_COLLATION} NOT NULL,
+  PRIMARY KEY (`search_id`)
+){TABLE_ENGINE};
+-- EndOfFile
\ No newline at end of file

Property changes on: branches/2.8.x/wb/install/sql/install-struct.sql
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1,4 ##
+Id
+Revision
+HeadURL
+Date
\ No newline at end of property
Index: branches/2.8.x/wb/install/sql/install-data.sql
===================================================================
--- branches/2.8.x/wb/install/sql/install-data.sql	(nonexistent)
+++ branches/2.8.x/wb/install/sql/install-data.sql	(revision 2104)
@@ -0,0 +1,91 @@
+-- phpMyAdmin SQL Dump
+-- version 4.0.4.1
+-- http://www.phpmyadmin.net
+--
+-- Host: 127.0.0.1
+-- Erstellungszeit: 17. Nov 2012 um 12:37
+-- Server Version: 5.5.32
+-- PHP-Version: 5.4.19
+--
+SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
+--
+-- Daten für Tabelle `groups`
+--
+INSERT INTO `{TABLE_PREFIX}groups` (`group_id`, `name`, `system_permissions`, `module_permissions`, `template_permissions`) VALUES
+(1, 'Administrators', 'pages,pages_view,pages_add,pages_add_l0,pages_settings,pages_modify,pages_intro,pages_delete,media,media_view,media_upload,media_rename,media_delete,media_create,addons,modules,modules_view,modules_install,modules_uninstall,templates,templates_view,templates_install,templates_uninstall,languages,languages_view,languages_install,languages_uninstall,settings,settings_basic,settings_advanced,access,users,users_view,users_add,users_modify,users_delete,groups,groups_view,groups_add,groups_modify,groups_delete,admintools', '', '');
+--
+-- Daten für Tabelle `search`
+--
+INSERT INTO `{TABLE_PREFIX}search` (`name`, `value`, `extra`) VALUES
+('header', '<h1>[TEXT_SEARCH]</h1>\n<form name="searchpage" action="[WB_URL]/search/index.php" method="get">\n<table cellpadding="3" cellspacing="0" border="0" style="width:100%; max-width:500px">\n<tr>\n<td>\n<input type="hidden" name="search_path" value="[SEARCH_PATH]" />\n<input type="hidden" name="referrer" value="[REFERRER_ID]" />\n<input type="text" name="string" value="[SEARCH_STRING]" style="width: 100%;" />\n</td>\n<td width="100">\n<input type="submit" value="[TEXT_SEARCH]" style="width: 100%;" />\n</td>\n</tr>\n<tr>\n<td colspan="2">\n<input type="radio" name="match" id="match_all" value="all"[ALL_CHECKED] />\n<label for="match_all">[TEXT_ALL_WORDS]</label>\n<input type="radio" name="match" id="match_any" value="any"[ANY_CHECKED] />\n<label for="match_any">[TEXT_ANY_WORDS]</label>\n<input type="radio" name="match" id="match_exact" value="exact"[EXACT_CHECKED] />\n<label for="match_exact">[TEXT_EXACT_MATCH]</label>\n</td>\n</tr>\n</table>\n</form>\n<hr />', ''),
+('footer', '', ''),
+('results_header', '<p>[TEXT_RESULTS_FOR] <strong>[SEARCH_STRING]</strong>:</p>\n<div class="searchresults">', ''),
+('results_loop', '<h3 style="margin:10px 0 3px 0;"><a href="[LINK]">[TITLE]</a></h3>\n<div style="font-size:0.8em;">[TEXT_LAST_UPDATED_BY] [DISPLAY_NAME] [TEXT_ON] [DATE]</div>\n<p style="padding: 0 0 5px 0; margin: 2px 0 10px 0; border-bottom: 1px solid #777;">[DESCRIPTION].. [EXCERPT]</p>', ''),
+('results_footer', '</div>', ''),
+('no_results', '<p>[TEXT_NO_RESULTS]</p>', ''),
+('module_order', 'wysiwyg', ''),
+('max_excerpt', '15', ''),
+('time_limit', '0', ''),
+('cfg_enable_old_search', 'true', ''),
+('cfg_search_keywords', 'true', ''),
+('cfg_search_description', 'true', ''),
+('cfg_show_description', 'true', ''),
+('cfg_enable_flush', 'false', ''),
+('template', '', '');
+--
+-- Daten für Tabelle `settings`
+--
+INSERT INTO `{TABLE_PREFIX}settings` (`name`, `value`) VALUES
+('website_description', ''),
+('website_keywords', ''),
+('website_header', ''),
+('website_footer', ''),
+('wysiwyg_style', 'font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px;'),
+('er_level', ''),
+('sec_anchor', 'wb_'),
+('default_date_format', 'M d Y'),
+('default_time_format', 'g:i A'),
+('redirect_timer', '1500'),
+('home_folders', 'true'),
+('warn_page_leave', '1'),
+('default_template', 'round'),
+('default_theme', 'wb_theme'),
+('default_charset', 'utf-8'),
+('multiple_menus', 'true'),
+('page_level_limit', '4'),
+('intro_page', 'false'),
+('page_trash', 'inline'),
+('homepage_redirection', 'false'),
+('page_languages', 'true'),
+('wysiwyg_editor', 'fckeditor'),
+('manage_sections', 'true'),
+('section_blocks', 'true'),
+('smart_login', 'true'),
+('frontend_login', 'false'),
+('frontend_signup', 'false'),
+('search', 'public'),
+('page_extension', '.php'),
+('page_spacer', '-'),
+('pages_directory', '/pages'),
+('rename_files_on_upload', 'ph.*?,cgi,pl,pm,exe,com,bat,pif,cmd,src,asp,aspx,js'),
+('media_directory', '/media'),
+('wbmailer_routine', 'phpmail'),
+('wbmailer_default_sendername', 'WB Mailer'),
+('wbmailer_smtp_host', ''),
+('wbmailer_smtp_auth', ''),
+('wbmailer_smtp_username', ''),
+('wbmailer_smtp_password', ''),
+('fingerprint_with_ip_octets', '2'),
+('secure_form_module', ''),
+('mediasettings', ''),
+('page_icon_dir', '/templates/*/title_images'),
+('dev_infos', 'false'),
+('wbmail_signature', ''),
+('confirmed_registration', '1'),
+('page_extendet', 'true'),
+('system_locked', '0'),
+('password_crypt_loops', '12'),
+('password_hash_type', 'false'),
+('password_length', '10'),
+('password_use_types', '65535');
+-- End of file
\ No newline at end of file

Property changes on: branches/2.8.x/wb/install/sql/install-data.sql
___________________________________________________________________
Added: svn:keywords
## -0,0 +1,4 ##
+Id
+Revision
+HeadURL
+Date
\ No newline at end of property
Index: branches/2.8.x/wb/install/save.php
===================================================================
--- branches/2.8.x/wb/install/save.php	(revision 2103)
+++ branches/2.8.x/wb/install/save.php	(revision 2104)
@@ -39,6 +39,7 @@
 include(dirname(__DIR__).'/framework/globalExceptionHandler.php');
 include(dirname(__DIR__).'/framework/WbAutoloader.php');
 WbAutoloader::doRegister(array('admin'=>'a', 'modules'=>'m', 'templates'=>'t', 'include'=>'i'));
+include(__DIR__.'/InstallHelper.php');
 // register PHPMailer autoloader ---
 if (!function_exists('PHPMailerAutoload')) {
     require(dirname(__DIR__).'/include/phpmailer/PHPMailerAutoload.php');
@@ -261,7 +262,8 @@
 // End path and timezone details code
 
 // Get the default language
-$allowed_languages = array('BG','CA', 'CS', 'DA', 'DE', 'EN', 'ES', 'ET', 'FI', 'FR', 'HR', 'HU', 'IT', 'LV', 'NL', 'NO', 'PL', 'PT', 'RU','SE','SK','TR');
+$sLanguageDirectory = dirname(__DIR__).'languages/';
+$allowed_languages = array_keys(InstallHelper::getAvailableLanguages($sLanguageDirectory));
 if(!isset($_POST['default_language']) OR !in_array($_POST['default_language'], $allowed_languages)) {
 	set_error('Please select a valid default backend language','default_language');
 } else {
@@ -400,6 +402,7 @@
 ."pass    = \"".$database_password."\"\n"
 ."host    = \"".$database_host."\"\n"
 ."port    = \"3306\"\n"
+."socket  = \"\"\n"
 ."name    = \"".$database_name."\"\n"
 ."charset = \"utf8\"\n"
 ."table_prefix = \"".$table_prefix."\"\n"
@@ -463,121 +466,70 @@
 $sSecMod = (defined('SECURE_FORM_MODULE') && SECURE_FORM_MODULE != '') ? '.'.SECURE_FORM_MODULE : '';
 $sSecMod = WB_PATH.'/framework/SecureForm'.$sSecMod.'.php';
 require_once($sSecMod);
+require(ADMIN_PATH.'/interface/version.php');
+
+/*****************************
+Begin Create Database Tables
+*****************************/
+if (is_readable(__DIR__.'/sql/install-struct.sql')) {
+    if (! $database->SqlImport(__DIR__.'/sql/install-struct.sql', TABLE_PREFIX, false)) {
+        set_error('unable to import install-struct.sql');
+    }
+}
+if (is_readable(__DIR__.'/sql/install-data.sql')) {
+    if (! $database->SqlImport(__DIR__.'/sql/install-data.sql', TABLE_PREFIX)) {
+        set_error('unable to import install-data.sql');
+    }
+}
+$sql = // additional settings from install input
+       'REPLACE INTO `'.TABLE_PREFIX.'settings` (`name`, `value`) VALUES '
+     .        '(\'wb_version\', \''.VERSION.'\'), '
+     .        '(\'website_title\', \''.$website_title.'\'), '
+     .        '(\'default_language\', \''.$default_language.'\'), '
+     .        '(\'app_name\', \'wb_'.$session_rand.'\'), '
+     .        '(\'default_timezone\', \''.$default_timezone.'\'), '
+     .        '(\'operating_system\', \''.$operating_system.'\'), '
+     .        '(\'string_file_mode\', \''.$file_mode.'\'), '
+     .        '(\'string_dir_mode\', \''.$dir_mode.'\'), '
+     .        '(\'server_email\', \''.$admin_email.'\'), '
+     .        '(\'wb_revision\', \''.REVISION.'\'), '
+     .        '(\'wb_sp\', \''.SP.'\'), '
+     .        '(\'groups_updated\', \''.time().'\')';
+if (! ($database->query($sql))) {
+    set_error('unable to write \'install presets\' into table \'settings\'');
+}
+$sql = // add the Admin user
+     'INSERT INTO `'.TABLE_PREFIX.'users` '
+    .'SET `user_id`=1, '
+    .    '`group_id`=1, '
+    .    '`groups_id`=\'1\', '
+    .    '`active`=\'1\', '
+    .    '`username`=\''.$admin_username.'\', '
+    .    '`password`=\''.md5($admin_password).'\', '
+    .    '`email`=\''.$admin_email.'\', '
+    .    '`timezone`=\''.$default_timezone.'\', '
+    .    '`language`=\''.$default_language.'\', '
+    .    '`display_name`=\'Administrator\'';
+if (! ($database->query($sql))) {
+    set_error('unable to write Administrator account into table \'users\'');
+}
+/**********************
+END OF TABLES IMPORT
+**********************/
+// initialize the system
+require_once(WB_PATH.'/framework/initialize.php');
 require_once(WB_PATH.'/framework/class.admin.php');
-
+/***********************
 // Dummy class to allow modules' install scripts to call $admin->print_error
-	class admin_dummy extends admin
-	{
-		var $error='';
-		function print_error($message, $link = 'index.php', $auto_footer = true)
-		{
-			$this->error=$message;
-		}
-	}
-
-//  core tables only structure
-	$sSqlFileName = dirname(__FILE__).'/sql/websitebaker.sql';
-	if(!$database->SqlImport($sSqlFileName,TABLE_PREFIX, false)) { set_error($database->get_error()); }
-
-	require(ADMIN_PATH.'/interface/version.php');
-
-	$sql = 'INSERT INTO `'.TABLE_PREFIX.'settings` (`name`, `value`) VALUES '
-	     . '(\'wb_version\', \''.VERSION.'\'), '
-	     . '(\'website_title\', \''.$website_title.'\'), '
-	     . '(\'website_description\', \'\'), '
-	     . '(\'website_keywords\', \'\'), '
-	     . '(\'website_header\', \'\'), '
-	     . '(\'website_footer\', \'\'), '
-	     . '(\'wysiwyg_style\', \'font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px;\'), '
-	     . '(\'er_level\', \'0\'), '
-	     . '(\'default_language\', \''.$default_language.'\'), '
-	     . '(\'app_name\', \'wb_'.$session_rand.'\'), '
-	     . '(\'sec_anchor\', \'Sec\'), '
-	     . '(\'server_timezone\', \'UTC\'), '
-	     . '(\'default_timezone\', \''.$default_timezone.'\'), '
-	     . '(\'default_date_format\', \'Y-m-d\'), '
-	     . '(\'default_time_format\', \'h:i A\'), '
-	     . '(\'redirect_timer\', \'1500\'), '
-	     . '(\'home_folders\', \'false\'), '
-	     . '(\'warn_page_leave\', \'1\'), '
-	     . '(\'default_template\', \'round\'), '
-	     . '(\'default_theme\', \'WbTheme\'), '
-	     . '(\'default_charset\', \'utf-8\'), '
-	     . '(\'multiple_menus\', \'true\'), '
-	     . '(\'page_level_limit\', \'6\'), '
-	     . '(\'intro_page\', \'false\'), '
-	     . '(\'page_trash\', \'inline\'), '
-	     . '(\'homepage_redirection\', \'false\'), '
-	     . '(\'page_languages\', \'false\'), '
-	     . '(\'wysiwyg_editor\', \'fckeditor\'), '
-	     . '(\'manage_sections\', \'true\'), '
-	     . '(\'section_blocks\', \'false\'), '
-	     . '(\'smart_login\', \'false\'), '
-	     . '(\'frontend_login\', \'false\'), '
-	     . '(\'frontend_signup\', \'false\'), '
-	     . '(\'search\', \'public\'), '
-	     . '(\'page_extension\', \'.php\'), '
-	     . '(\'page_spacer\', \'-\'), '
-	     . '(\'pages_directory\', \'/pages\'), '
-	     . '(\'rename_files_on_upload\', \'ph.*?,cgi,pl,pm,exe,com,bat,pif,cmd,src,asp,aspx,js,txt\'), '
-	     . '(\'media_directory\', \'/media\'), '
-	     . '(\'operating_system\', \''.$operating_system.'\'), '
-	     . '(\'string_file_mode\', \''.$file_mode.'\'), '
-	     . '(\'string_dir_mode\', \''.$dir_mode.'\'), '
-	     . '(\'wbmailer_routine\', \'phpmail\'), '
-	     . '(\'server_email\', \''.$admin_email.'\'), '
-	     . '(\'wbmailer_default_sendername\', \'WebsiteBaker Mailer\'), '
-	     . '(\'wbmailer_smtp_host\', \'\'), '
-	     . '(\'wbmailer_smtp_auth\', \'\'), '
-	     . '(\'wbmailer_smtp_username\', \'\'), '
-	     . '(\'wbmailer_smtp_password\', \'\'), '
-	     . '(\'fingerprint_with_ip_octets\', \'2\'), '
-	     . '(\'secure_form_module\', \'\'), '
-	     . '(\'mediasettings\', \'\'), '
-	     . '(\'wb_revision\', \''.REVISION.'\'), '
- 	     . '(\'wb_sp\', \''.SP.'\'), '
-	     . '(\'page_icon_dir\', \'/templates/*/title_images\'), '
-	     . '(\'dev_infos\', \'false\'), '
-	     . '(\'groups_updated\', \''.time().'\'), '
-	     . '(\'wbmail_signature\', \'\'), '
-	     . '(\'confirmed_registration\', \'1\'), '
-	     . '(\'page_extendet\', \'true\'), '
-	     . '(\'system_locked\', \'0\'), '
-	     . '(\'password_crypt_loops\', \'12\'), '
-	     . '(\'password_hash_type\', \'false\'), '
-	     . '(\'password_length\', \'10\'), '
-		 . '(\'password_use_types\', \''.(int)0xFFFF.'\') '
-	     . '';
-	if(!$database->query($sql)) { set_error($database->get_error()); }
-
-	// Admin group
-	$full_system_permissions  = 'access,addons,admintools,admintools_view,groups,groups_add,groups_delete,'
-	                          . 'groups_modify,groups_view,languages,languages_install,languages_uninstall,'
-	                          . 'languages_view,media,media_create,media_delete,media_rename,media_upload,'
-	                          . 'media_view,modules,modules_advanced,modules_install,modules_uninstall,'
-	                          . 'modules_view,pages,pages_add,pages_add_l0,pages_delete,pages_intro,'
-	                          . 'pages_modify,pages_settings,pages_view,preferences,preferences_view,'
-	                          . 'settings,settings_advanced,settings_basic,settings_view,templates,'
-	                          . 'templates_install,templates_uninstall,templates_view,users,users_add,'
-	                          . 'users_delete,users_modify,users_view';
-	$sql = 'INSERT INTO `'.TABLE_PREFIX.'groups` '
-	     . 'SET `group_id` =1,'
-	     .     '`name`=\'Administrators\','
-		 .     '`system_permissions`=\''.$full_system_permissions.'\','
-		 .     '`module_permissions`=\'\','
-		 .     '`template_permissions`=\'\'';
-	if(!$database->query($sql)) { set_error($database->get_error()); }
-
-// Admin user
-	$insert_admin_user = "INSERT INTO `".TABLE_PREFIX."users` VALUES (1, 1, '1', 1, '$admin_username', '".md5($admin_password)."', '', 0, '', 0, 'Administrator', '$admin_email', $default_timezone, '', '', '$default_language', '', 0, '');";
-	if(!$database->query($insert_admin_user)) { set_error($database->get_error()); }
-
-// Search layout default data
-	$sSqlFileName = dirname(__FILE__).'/sql/wb_search_data.sql';
-	if(!$database->SqlImport($sSqlFileName,TABLE_PREFIX, false)) { set_error($database->get_error()); }
-
-	require_once(WB_PATH.'/framework/initialize.php');
-// 
+***********************/
+class admin_dummy extends admin
+{
+    public $error='';
+    public function print_error($message, $link = 'index.php', $auto_footer = true)
+    {
+        $this->error=$message;
+    }
+}
 // Include WB functions file
 	require_once(WB_PATH.'/framework/functions.php');
 // Re-connect to the database, this time using in-build database class
@@ -585,45 +537,33 @@
 	// Include the PclZip class file (thanks to
 	require_once(WB_PATH.'/include/pclzip/pclzip.lib.php');
 	// Install add-ons
-	if(file_exists(WB_PATH.'/install/modules')) {
-		// Unpack pre-packaged modules
-	}
-	if(file_exists(WB_PATH.'/install/templates')) {
-		// Unpack pre-packaged templates
-	}
-	if(file_exists(WB_PATH.'/install/languages')) {
-		// Unpack pre-packaged languages
-	}
-
 	$admin=new admin_dummy('Start','',false,false);
-	// Load addons into DB
-	$dirs['modules'] = WB_PATH.'/modules/';
-	$dirs['templates'] = WB_PATH.'/templates/';
-	$dirs['languages'] = WB_PATH.'/languages/';
+// Load addons and templates into DB
+    $aScanDirs = array(
+        'module'   => dirname(__DIR__).'/modules/',
+        'template' => dirname(__DIR__).'/templates/',
+        'language' => dirname(__DIR__).'/languages/'
+    );
+    foreach ($aScanDirs as $sType => $sPath) {
+        $sCommand = 'load_'.$sType;
+        if ($sType != 'language') {
+            foreach (glob($sPath, GLOB_ONLYDIR) as $sMatchingPath) {
+                if ($sType == 'module') {
+                    $sCommand($sMatchingPath, true);
+                    if ($admin->error) { set_error($admin->error); }
+                } elseif ($sType == 'template') {
+                    $sCommand($sMatchingPath);
+                }
+            }
+        } else {
+            foreach (glob(dirname(__DIR__).'/languages/??.php') as $sMatchingPath) {
+                if (preg_match('/\/[A-Z]{2}\.php$/sU', $sMatchingPath)) {
+                    $sCommand($sMatchingPath);
+                }
+            }
+        }
+    }
 
-	foreach($dirs AS $type => $dir) {
-		if(($handle = opendir($dir))) {
-			while(false !== ($file = readdir($handle))) {
-				if($file != '' AND substr($file, 0, 1) != '.' AND $file != 'admin.php' AND $file != 'index.php') {
-					// Get addon type
-					if($type == 'modules') {
-						load_module($dir.'/'.$file, true);
-						// Pretty ugly hack to let modules run $admin->set_error
-						// See dummy class definition admin_dummy above
-						if ($admin->error!='') {
-							set_error($admin->error);
-						}
-					} elseif($type == 'templates') {
-						load_template($dir.'/'.$file);
-					} elseif($type == 'languages') {
-						load_language($dir.'/'.$file);
-					}
-				}
-			}
-			closedir($handle);
-		}
-	}
-
 // Check if there was a database error
 	if($database->is_error()) {
 		set_error($database->get_error());
Index: branches/2.8.x/wb/install/InstallHelper.php
===================================================================
--- branches/2.8.x/wb/install/InstallHelper.php	(nonexistent)
+++ branches/2.8.x/wb/install/InstallHelper.php	(revision 2104)
@@ -0,0 +1,51 @@
+<?php
+
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+/**
+ * InstallHelper.php
+ *
+ * @category     Core
+ * @package      Core_package
+ * @subpackage   Name of the subpackage if needed
+ * @copyright    Manuela v.d.Decken <manuela@isteam.de>
+ * @author       Manuela v.d.Decken <manuela@isteam.de>
+ * @license      http://www.gnu.org/licenses/gpl.html   GPL License
+ * @version      0.0.1
+ * @revision     $Revision: $
+ * @link         $HeadURL: $
+ * @lastmodified $Date: $
+ * @since        File available since 19.09.2014
+ * @deprecated   This class is deprecated since the ...
+ * @description  xyz
+ */
+class InstallHelper {
+
+
+/*
+ Find all available languages in /language/ folder and build option list from
+*/
+    public static function getAvailableLanguages($sLanguageDirectory)
+    {
+        $aRetval = array();
+        $sLangDir = rtrim(str_replace('\\', '/', $sLanguageDirectory), '/').'/';
+        $aAvailableLanguages = preg_replace('/^.*\/([A-Z]{2})\.php$/iU', '\1', glob($sLangDir.'??.php'));
+        sort($aAvailableLanguages, SORT_NATURAL);
+        foreach ($aAvailableLanguages as $sLangCode) {
+            if (is_readable($sLangDir.$sLangCode.'.php')) {
+                if (($sContent = file_get_contents($sLangDir.$sLangCode.'.php', false, null, -1, 2048)) !== false) {
+                    if (preg_match('/.*\s*\$language_name\s*=\s*([\'\"])([^\1]*)\1\s*;/siU', $sContent, $aMatches)) {
+                        $aRetval[$sLangCode] = $aMatches[2];
+                    }
+                }
+            }
+        }
+        return $aRetval;
+    }
+
+}
+
+// end of class Helper
Index: branches/2.8.x/wb/install/index.php
===================================================================
--- branches/2.8.x/wb/install/index.php	(revision 2103)
+++ branches/2.8.x/wb/install/index.php	(revision 2104)
@@ -32,14 +32,15 @@
  * @since        File available since 2012-04-01
  * @description  xyz
  */
-// PHP less then 5.3.2 is prohibited ---
-if (version_compare(PHP_VERSION, '5.3.2', '<')) {
-    $sMsg = '<p style="color: #ff0000;">WebsiteBaker 2.8.4 and above is not able to run with PHP-Version less then 5.3.2!!<br />'
-          . 'Please change your PHP-Version to any kind from 5.3.2 and up!<br />'
+// PHP less then 5.4.0 is prohibited ---
+if (version_compare(PHP_VERSION, '5.4.0', '<')) {
+    $sMsg = '<p style="color: #ff0000;">WebsiteBaker 2.8.4 and above is not able to run with PHP-Version less then 5.4.0!!<br />'
+          . 'Please change your PHP-Version to any kind from 5.4.0 and up!<br />'
           . 'If you have problems to solve that, ask your hosting provider for it.<br  />'
           . 'The very best solution is the use of PHP-5.4 and up</p>';
     die($sMsg);
 }
+include(__DIR__.'/InstallHelper.php');
 // Start a session
 if(!defined('SESSION_STARTED')) {
 	session_name('wb_session_id');
@@ -203,20 +204,17 @@
 		</tr>
 		<?php } ?>
 		<tr>
-			<td style="color: #666666;">PHP Version 5.3.2 and up</td>
+			<td style="color: #666666;">PHP Session Support</td>
 			<td>
-				<?php
-			   if (version_compare(PHP_VERSION, '5.3.2', '>='))
-			   {
-					?><font class="good">Yes</font><?php
-				} else {
-					$installFlag = false;
-					?><font class="bad">No</font><?php
-				}
-				?>
+				<?php echo $session_support; ?>
+                ?>
 			</td>
-			<td style="color: #666666;">PHP Session Support</td>
-			<td><?php echo $session_support; ?></td>
+			<td style="color: #666666;">
+                &nbsp;
+            </td>
+			<td>
+                $nbsp;
+            </td>
 		</tr>
 	<tr>
 		<td style="color: #666666;">PHP Interface</td>
@@ -226,19 +224,9 @@
 						<?php echo $sapi ?>
 						</font>
 			</td>
-		<td style="color: #666666;">magic_quotes_gpc</td>
+		<td style="color: #666666;">Server DefaultCharset</td>
 			<td >
 				<?php
-						?><font class="good">
-						<?php echo $getMagicQuotesGpc ?>
-						</font>
-			</td>
-
-		</tr>
-
-		<td style="color: #666666;">Server DefaultCharset</td>
-			<td>
-				<?php
 					$chrval = (($e_adc != '') && (strtolower($e_adc) != 'utf-8') ? true : false);
 					if($chrval == false) {
 						?><font class="good">
@@ -248,20 +236,8 @@
 					} else {
 						?><font class="bad"><?php echo $e_adc ?></font><?php
 					}
-
 				?>
 			</td>
-			<td style="color: #666666;">PHP Safe Mode</td>
-			<td>
-				<?php
-				if(ini_get('safe_mode')=='' || strpos(strtolower(ini_get('safe_mode')), 'off')!==FALSE || ini_get('safe_mode')==0) {
-					?><font class="good">Disabled</font><?php
-				} else {
-					$installFlag = false;
-					?><font class="bad">Enabled</font><?php
-				}
-				?>
-			</td>
 		</tr>
 		<?php if($chrval == true) {
 		?>
@@ -363,45 +339,26 @@
 			</td>
 			<td>
 				<select <?php echo field_error('default_timezone');?> tabindex="3" name="default_timezone" style="width: 100%;">
-					<?php
-					$TIMEZONES['-12'] = 'GMT - 12 Hours';
-					$TIMEZONES['-11'] = 'GMT -11 Hours';
-					$TIMEZONES['-10'] = 'GMT -10 Hours';
-					$TIMEZONES['-9'] = 'GMT -9 Hours';
-					$TIMEZONES['-8'] = 'GMT -8 Hours';
-					$TIMEZONES['-7'] = 'GMT -7 Hours';
-					$TIMEZONES['-6'] = 'GMT -6 Hours';
-					$TIMEZONES['-5'] = 'GMT -5 Hours';
-					$TIMEZONES['-4'] = 'GMT -4 Hours';
-					$TIMEZONES['-3.5'] = 'GMT -3.5 Hours';
-					$TIMEZONES['-3'] = 'GMT -3 Hours';
-					$TIMEZONES['-2'] = 'GMT -2 Hours';
-					$TIMEZONES['-1'] = 'GMT -1 Hour';
-					$TIMEZONES['0'] = 'GMT';
-					$TIMEZONES['1'] = 'GMT +1 Hour';
-					$TIMEZONES['2'] = 'GMT +2 Hours';
-					$TIMEZONES['3'] = 'GMT +3 Hours';
-					$TIMEZONES['3.5'] = 'GMT +3.5 Hours';
-					$TIMEZONES['4'] = 'GMT +4 Hours';
-					$TIMEZONES['4.5'] = 'GMT +4.5 Hours';
-					$TIMEZONES['5'] = 'GMT +5 Hours';
-					$TIMEZONES['5.5'] = 'GMT +5.5 Hours';
-					$TIMEZONES['6'] = 'GMT +6 Hours';
-					$TIMEZONES['6.5'] = 'GMT +6.5 Hours';
-					$TIMEZONES['7'] = 'GMT +7 Hours';
-					$TIMEZONES['8'] = 'GMT +8 Hours';
-					$TIMEZONES['9'] = 'GMT +9 Hours';
-					$TIMEZONES['9.5'] = 'GMT +9.5 Hours';
-					$TIMEZONES['10'] = 'GMT +10 Hours';
-					$TIMEZONES['11'] = 'GMT +11 Hours';
-					$TIMEZONES['12'] = 'GMT +12 Hours';
-					$TIMEZONES['13'] = 'GMT +13 Hours';
-					foreach($TIMEZONES AS $hour_offset => $title) {
-						?>
-							<option value="<?php echo $hour_offset; ?>"<?php if(isset($_SESSION['default_timezone']) AND $_SESSION['default_timezone'] == $hour_offset) { echo ' selected="selected"'; } elseif(!isset($_SESSION['default_timezone']) AND $hour_offset == 0) { echo ' selected="selected"'; } ?>><?php echo $title; ?></option>
-						<?php
-					}
-					?>
+<?php
+/*
+ build list of TimeZone options
+*/
+    $aZones = array(-12,-11,-10,-9,-8,-7,-6,-5,-4,-3.5,-3,-2,-1,0,1,2,3,3.5,4,4.5,5,5.5,6,6.5,7,8,9,9.5,10,11,12,13);
+    $sOutput = PHP_EOL;
+    foreach($aZones as $fOffset) {
+        $sItemTitle = 'GMT '.(($fOffset>0)?'+':'').(($fOffset==0)?'':(string)$fOffset.' Hours');
+        $sOutput .= '<option value="'.(string)$fOffset.'"';
+        if (
+            (isset($_SESSION['default_timezone']) AND $_SESSION['default_timezone'] == (string)$fOffset) ||
+            (!isset($_SESSION['default_timezone']) AND $fOffset == 0)
+        ) {
+            $sOutput .= ' selected="selected"';
+        }
+        $sOutput .= '>'.$sItemTitle.'</option>'.PHP_EOL;
+    }
+// output Timezone options
+    echo $sOutput;
+?>
 				</select>
 			</td>
 		</tr>
@@ -411,26 +368,26 @@
 			</td>
 			<td>
 				<select <?php echo field_error('default_language');?> tabindex="3" name="default_language" style="width: 100%;">
-					<?php
-                	$sAutoLanguage = 'EN'; // default, if no information from client available
-                	if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
-                		if(preg_match('/([a-z]{2})(?:-[a-z]{2})*/i', strtolower($_SERVER['HTTP_ACCEPT_LANGUAGE']), $matches)) {
-                			$sAutoLanguage = strtoupper($matches[1]);
-                		}
-                	}
-                	$sAutoLanguage = isset($_SESSION['default_language']) ? $_SESSION['default_language'] : $sAutoLanguage;
-					$DEFAULT_LANGUAGE = array(
-						'BG'=>'Bulgarian', 'CA'=>'Catalan', 'CS'=>'&#268;e&scaron;tina', 'DA'=>'Danish', 'DE'=>'Deutsch', 'EN'=>'English',
-						'ES'=>'Spanish', 'ET'=>'Eesti', 'FI'=>'Suomi', 'FR'=>'Fran&ccedil;ais',
-						'HR'=>'Hrvatski', 'HU'=>'Magyar','IT'=>'Italiano', 'LV'=>'Latviesu',
-						'NL'=>'Nederlands', 'NO'=>'Norsk', 'PL'=>'Polski', 'PT'=>'Portuguese (Brazil)', 'RU'=>'Russian', 'SE'=>'Svenska','SK'=>'Slovensky','TR'=>'Turkish'
-					);
-					foreach($DEFAULT_LANGUAGE as $lang_id => $lang_title) {
-						?>
-							<option value="<?php echo $lang_id; ?>"<?php if($sAutoLanguage == $lang_id) { echo ' selected="selected"'; }  ?> ><?php echo $lang_title; ?></option>
-						<?php
-					}
-					?>
+<?php
+/*
+ Find all available languages in /language/ folder and build option list from
+*/
+    $sLangDir = str_replace('\\', '/', dirname(__DIR__).'/languages/');
+    $aAvailableLanguages = InstallHelper::getAvailableLanguages($sLangDir);
+    $sOutput = PHP_EOL;
+    foreach ($aAvailableLanguages as $sLangCode => $sLangName) {
+        $sOutput .= '<option value="'.$sLangCode.'"';
+        if (
+            (isset($_SESSION['default_language']) AND $_SESSION['default_language'] == $sLangCode) ||
+            (!isset($_SESSION['default_language']) AND $sLangCode == 'EN')
+        ) {
+            $sOutput .= ' selected="selected"';
+        }
+        $sOutput .= '>'.$sLangName.'</option>'.PHP_EOL;
+    }
+// output Language options
+    echo $sOutput;
+?>
 				</select>
 			</td>
 		</tr>
