Index: branches/2.8.x/CHANGELOG
===================================================================
--- branches/2.8.x/CHANGELOG	(revision 1493)
+++ branches/2.8.x/CHANGELOG	(revision 1494)
@@ -12,6 +12,8 @@
 
 =============================== FEATURES FREEZE ================================
 ----------------------------------- Fixes 2.8.2 --------------------------------
+11 Aug-2011 Build 1494 Dietmar Woellbrink (Luisehahne)
+# Fixed save wrong template directory in database 
 11 Aug-2011 Build 1493 Dietmar Woellbrink (Luisehahne)
 # Ticket #1106 FatalError in groups module
 11 Aug-2011 Build 1492 Dietmar Woellbrink (Luisehahne)
Index: branches/2.8.x/wb/admin/templates/details.php
===================================================================
--- branches/2.8.x/wb/admin/templates/details.php	(revision 1493)
+++ branches/2.8.x/wb/admin/templates/details.php	(revision 1494)
@@ -33,7 +33,7 @@
 	header("Location: index.php");
 	exit(0);
 } else {
-	$file = preg_replace("/\W/", "", $_POST['file']);  // fix secunia 2010-92-2
+	$file = preg_replace('/[^a-z0-9_-]/i', "", $_POST['file']);  // fix secunia 2010-92-2
 }
 
 // Check if the template exists
Index: branches/2.8.x/wb/admin/pages/settings2.php
===================================================================
--- branches/2.8.x/wb/admin/pages/settings2.php	(revision 1493)
+++ branches/2.8.x/wb/admin/pages/settings2.php	(revision 1494)
@@ -62,7 +62,8 @@
 $parent = intval($admin->get_post('parent')); // fix secunia 2010-91-3
 $visibility = $admin->get_post_escaped('visibility');
 if (!in_array($visibility, array('public', 'private', 'registered', 'hidden', 'none'))) {$visibility = 'public';} // fix secunia 2010-93-3
-$template = preg_replace("/\W/", "", $admin->get_post('template')); // fix secunia 2010-93-3
+$template = preg_replace('/[^a-z0-9_-]/i', "", $admin->get_post('template')); // fix secunia 2010-93-3
+$template = (($template == DEFAULT_TEMPLATE ) ? '' : $template);
 $target = preg_replace("/\W/", "", $admin->get_post('target'));
 $admin_groups = $admin->get_post_escaped('admin_groups');
 $viewing_groups = $admin->get_post_escaped('viewing_groups');
Index: branches/2.8.x/wb/admin/pages/add.php
===================================================================
--- branches/2.8.x/wb/admin/pages/add.php	(revision 1493)
+++ branches/2.8.x/wb/admin/pages/add.php	(revision 1494)
@@ -33,7 +33,7 @@
 // Get values
 $title = $admin->get_post_escaped('title');
 $title = htmlspecialchars($title);
-$module = preg_replace("/\W/", "", $admin->get_post('type')); // fix secunia 2010-93-4
+$module = preg_replace('/[^a-z0-9_-]/i', "", $admin->get_post('type')); // fix secunia 2010-93-4
 $parent = intval($admin->get_post('parent')); // fix secunia 2010-91-2
 $visibility = $admin->get_post('visibility');
 if (!in_array($visibility, array('public', 'private', 'registered', 'hidden', 'none'))) {$visibility = 'public';} // fix secunia 2010-91-2
Index: branches/2.8.x/wb/admin/interface/version.php
===================================================================
--- branches/2.8.x/wb/admin/interface/version.php	(revision 1493)
+++ branches/2.8.x/wb/admin/interface/version.php	(revision 1494)
@@ -52,4 +52,4 @@
 
 // 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', '1493');
+if(!defined('REVISION')) define('REVISION', '1494');
Index: branches/2.8.x/wb/admin/modules/details.php
===================================================================
--- branches/2.8.x/wb/admin/modules/details.php	(revision 1493)
+++ branches/2.8.x/wb/admin/modules/details.php	(revision 1494)
@@ -38,7 +38,7 @@
 }
 else
 {
-	$file = preg_replace("/\W/", "", $_POST['file']);  // fix secunia 2010-92-1
+	$file = preg_replace('/[^a-z0-9_-]/i', "", $_POST['file']);  // fix secunia 2010-92-1
 }
 
 // Check if the module exists
Index: branches/2.8.x/wb/admin/admintools/tool.php
===================================================================
--- branches/2.8.x/wb/admin/admintools/tool.php	(revision 1493)
+++ branches/2.8.x/wb/admin/admintools/tool.php	(revision 1494)
@@ -39,7 +39,7 @@
 $admin = new admin('admintools', 'admintools', $admin_header );
 
 // Check if tool is installed
-$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'module' AND function = 'tool' AND directory = '".preg_replace("/\W/", "", $tool)."'");
+$result = $database->query("SELECT * FROM ".TABLE_PREFIX."addons WHERE type = 'module' AND function = 'tool' AND directory = '".preg_replace('/[^a-z0-9_-]/i', "", $tool)."'");
 if($result->numRows() == 0) {
 	header("Location: index.php");
 	exit(0);
