Index: branches/2.8.x/CHANGELOG
===================================================================
--- branches/2.8.x/CHANGELOG	(revision 1585)
+++ branches/2.8.x/CHANGELOG	(revision 1586)
@@ -11,6 +11,8 @@
 ! = Update/Change
 
 =========================== add small Features 2.8.2 ==========================
+24 Jan-2012 Build 1586 Werner v.d.Decken(DarkViper)
++ added new method SqlImport() to class database
 19 Jan-2012 Build 1585 Dietmar Woellbrink (Luisehahne)
 # fixed double table width in modify.php form module ((Tks to Ruebenwurzel)
 19 Jan-2012 Build 1584 Dietmar Woellbrink (Luisehahne)
Index: branches/2.8.x/wb/admin/interface/version.php
===================================================================
--- branches/2.8.x/wb/admin/interface/version.php	(revision 1585)
+++ branches/2.8.x/wb/admin/interface/version.php	(revision 1586)
@@ -52,5 +52,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.2');
-if(!defined('REVISION')) define('REVISION', '1585');
+if(!defined('REVISION')) define('REVISION', '1586');
 if(!defined('SP')) define('SP', 'SP2');
Index: branches/2.8.x/wb/framework/class.database.php
===================================================================
--- branches/2.8.x/wb/framework/class.database.php	(revision 1585)
+++ branches/2.8.x/wb/framework/class.database.php	(revision 1586)
@@ -282,12 +282,53 @@
 		}
 		return $retval;
 	}
+/**
+ * Import a standard *.sql dump file
+ * @param string $sSqlDump link to the sql-dumpfile
+ * @param string $sTablePrefix
+ * @param string $sTblEngine
+ * @param string $sTblCollation
+ * @param bool $bPreserve set to true will ignore all DROP TABLE statements
+ * @return boolean true if import successful
+ */
+	public function SqlImport($sSqlDump,
+	                          $sTablePrefix = '',
+	                          $sTblEngine = 'ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci',
+	                          $sTblCollation = ' collate utf8_unicode_ci',
+	                          $bPreserve = true)
+	{
+		$retval = true;
+		$this->error = '';
+		$aSearch  = array('{TABLE_PREFIX}','{TABLE_ENGINE}', '{TABLE_COLLATION}');
+		$aReplace = array($sTablePrefix, $sTblEngine, $sTblCollation);
+		$sql = '';
+		$aSql = file($sSqlDump);
+		while ( sizeof($aSql) > 0 ) {
+			$sSqlLine = trim(array_shift($aSql));
+			if (preg_match('/^[-\/].+/', $sSqlLine)) {
+				$sql = $sql.' '.$sql_line;
+				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->db_handle)) {
+							$retval = false;
+							$this->error = mysql_error($this->db_handle);
+							unset($aSql);
+							break;
+						}
+					}
+					$sql = '';
+				}
+			}
+		}
+		return $retval;
+	}
 
-	/**
-	* 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)
-	*/
+/**
+ * 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;
