Index: branches/2.8.x/CHANGELOG
===================================================================
--- branches/2.8.x/CHANGELOG	(revision 1790)
+++ branches/2.8.x/CHANGELOG	(revision 1791)
@@ -13,6 +13,8 @@
 
 
 
+24 Oct-2012 Build 1791 Dietmar Woellbrink (Luisehahne)
+# fixed save search settings
 14 Oct-2012 Build 1790 Dietmar Woellbrink (Luisehahne)
 ! update group permission, 
 14 Oct-2012 Build 1789 Dietmar Woellbrink (Luisehahne)
Index: branches/2.8.x/wb/upgrade-script.php
===================================================================
--- branches/2.8.x/wb/upgrade-script.php	(revision 1790)
+++ branches/2.8.x/wb/upgrade-script.php	(revision 1791)
@@ -66,7 +66,7 @@
 			'[ADMIN]/themes/',
 		 );
 
-if(version_compare(WB_REVISION, '1788', '<'))
+if(version_compare(WB_REVISION, '1791', '<'))
 {
     $filesRemove['0'] = array(
 
Index: branches/2.8.x/wb/admin/skel/themes/htt/settings.htt
===================================================================
--- branches/2.8.x/wb/admin/skel/themes/htt/settings.htt	(revision 1790)
+++ branches/2.8.x/wb/admin/skel/themes/htt/settings.htt	(revision 1791)
@@ -417,7 +417,7 @@
 		<div class="mbox sub-row">
 	 		<label class="setting_name">{TEXT_NO_RESULTS}:</label>
 			<div class="input" >
-		<input type="text" name="search_no_results" value="{SEARCH_NO_RESULTS}" />
+		<textarea class="vert" name="search_no_results" cols="50" rows="3">{SEARCH_NO_RESULTS}</textarea>
 			</div>
 		</div>
 		<div class="mbox sub-row">
Index: branches/2.8.x/wb/admin/pages/settings.php
===================================================================
--- branches/2.8.x/wb/admin/pages/settings.php	(revision 1790)
+++ branches/2.8.x/wb/admin/pages/settings.php	(revision 1791)
@@ -206,7 +206,7 @@
 	$oTpl->set_var('p_menu_icon0_dir', p($sHelp,$mLang->TEXT_MENU_ICON_0_DIR));
 	$oTpl->set_var('p_menu_icon1_dir', p($sHelp,$mLang->TEXT_MENU_ICON_1_DIR));
 	$oTpl->set_var('p_menu_page_code', p($mLang->HELP_PAGE_CODE,$mLang->TEXT_PAGE_CODE));
-	$oTpl->set_var('p_menu_filename', p($sFilename,$mLang->TEXT_SEO_TITLE));
+	$oTpl->set_var('p_menu_filename',  p($sFilename,$mLang->TEXT_SEO_TITLE));
 
 	if(is_readable(WB_PATH.$sIconDir)) {
 		$oIterator = new DirectoryIterator(WB_PATH.$sIconDir);
Index: branches/2.8.x/wb/admin/interface/version.php
===================================================================
--- branches/2.8.x/wb/admin/interface/version.php	(revision 1790)
+++ branches/2.8.x/wb/admin/interface/version.php	(revision 1791)
@@ -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.3');
-if(!defined('REVISION')) define('REVISION', '1790');
+if(!defined('REVISION')) define('REVISION', '1791');
 if(!defined('SP')) define('SP', '');
Index: branches/2.8.x/wb/admin/settings/save.php
===================================================================
--- branches/2.8.x/wb/admin/settings/save.php	(revision 1790)
+++ branches/2.8.x/wb/admin/settings/save.php	(revision 1791)
@@ -198,9 +198,6 @@
     'website_description',
     'website_keywords',
     'wysiwyg_style',
-    'search_module_order',
-    'search_max_excerpt',
-    'search_time_limit',
     'pages_directory',
     'page_icon_dir',
     'media_directory',
@@ -298,56 +295,101 @@
     }
 
 }
+/**
+ * now save search settings
+ */
 $StripCodeFromISearch = array(
     'search_header',
     'search_results_header',
     'search_results_loop',
     'search_results_footer',
-    'search_no_results',
     'search_footer',
     'search_module_order',
     'search_max_excerpt',
+    'search_no_results',
     'search_time_limit',
+    'search_max_excerpt',
     );
 $allow_empty_values = array(
-    'search_footer',
+    'header',
+    'results_header',
+    'results_loop',
+    'results_footer',
+    'footer',
+    'module_order',
+    'no_results',
     );
+$allow_tags_in_fields = array(
+    'header',
+    'results_header',
+    'results_loop',
+    'results_footer',
+    'no_results',
+    'footer',
+    );
 
 // Query current search settings in the db, then loop through them and update the db with the new value
 $sql  = 'SELECT `name`, `value` FROM `'.TABLE_PREFIX.'search` ';
-$sql .= 'WHERE `extra` = ""';
-$res_search = $database->query($sql);
-
-if($database->is_error()) {
-	$admin->print_error($database->is_error(), $js_back );
+$sql .= 'WHERE `extra` =  \'\' ';
+if( !($oSearch = $database->query($sql)) ) {
+    if($database->is_error()) {
+    	$admin->print_error(explode(';',$database->get_error()), $js_back );
+    }
 }
 
-while($search_setting = $res_search->fetchRow(MYSQL_ASSOC))
+while($aSearch = $oSearch->fetchRow(MYSQL_ASSOC))
 {
-	$old_value = $search_setting['value'];
-	$setting_name = $search_setting['name'];
-	$post_name = 'search_'.$setting_name;
+	$passed = false;
+	$old_value = $aSearch['value'];
+	$sSearchName = $aSearch['name'];
+	$sPostName = 'search_'.$sSearchName;
 
-    // hold old value if post is empty
-    // check search template
-    $value = ($admin->get_post($post_name));
-    if(in_array($post_name, $StripCodeFromISearch) ) {
+    $value = $admin->get_post($sPostName);
+    $value = isset($value) ?  $value : $old_value;
+    if(in_array($sPostName, $StripCodeFromISearch) ) {
         $value = $admin->StripCodeFromText($value);
     }
 
-    $passed = in_array($post_name, $allow_empty_values);
+/**
+ *  hold old value if post is empty
+ *  check search template
+ */
+	switch ($sSearchName) {
+		case 'template':
+ 			$passed = true;
+            $value =  ( !($admin->get_post($sPostName)) || ($value == DEFAULT_TEMPLATE ) ) ? '' : $admin->get_post($sPostName);
+			break;
+		case 'max_excerpt':
+ 			$passed = true;
+        	if(preg_match('/[^0-9]+/i', $value)) {
+                $value = $old_value;
+        	}
+			break;
+		case 'time_limit':
+            $passed = true;
+        	if(preg_match('/[^0-9]+/i', $value)) {
+                $value = $old_value;
+        	}
+			break;
+		default :
+        	$passed = ($admin->get_post($sPostName) || in_array($sSearchName, $allow_empty_values));
 
-    $value = ( (!in_array($post_name, $allow_empty_values)) && ($setting_name != 'template') ) ? $old_value : $value;
+            if (!in_array($sSearchName, $allow_tags_in_fields))
+            {
+                $value = strip_tags($value);
+            }
+			break;
+	}
 
-    // $value =  ( ($admin->get_post($post_name) == '') && ($setting_name == 'template') ) ? DEFAULT_TEMPLATE : $admin->get_post($post_name);
-    if(isset($value))
+    if ( ($passed == true) )
 	{
 		$value = $admin->add_slashes($value);
         $sql  = 'UPDATE `'.TABLE_PREFIX.'search` ';
         $sql .= 'SET `value` = \''.$value.'\' ';
-        $sql .= 'WHERE `name` = \''.$setting_name.'\' ';
+        $sql .= 'WHERE `name` = \''.$sSearchName.'\' ';
         $sql .= 'AND `extra` = \'\' ';
 		if($database->query($sql)) {
+
 		}
 		$sql_info = mysql_info($database->db_handle);
     }
Index: branches/2.8.x/wb/framework/class.wb.php
===================================================================
--- branches/2.8.x/wb/framework/class.wb.php	(revision 1790)
+++ branches/2.8.x/wb/framework/class.wb.php	(revision 1791)
@@ -37,63 +37,69 @@
 		parent::__construct($mode);
 	}
 
+/**
+ *
+ *
+ * @return array of first visible language pages with defined fields
+ *
+ */
+	public function GetLanguagesDetailsInUsed ( ) {
+        global $database;
+        $retVal = array();
+        $sql =
+            'SELECT DISTINCT `language`'.
+            ', `page_id`,`level`,`parent`,`root_parent`,`page_code`,`link`,`language`'.
+            ', `visibility`,`viewing_groups`,`viewing_users`,`position` '.
+            'FROM `'.TABLE_PREFIX.'pages` '.
+            'WHERE `level`= \'0\' '.
+              'AND `root_parent`=`page_id` '.
+              'AND `visibility`!=\'none\' '.
+              'AND `visibility`!=\'hidden\' '.
+            'GROUP BY `language` '.
+            'ORDER BY `position`';
 
-	/**
-	 *
-	 *
-	 * @param mixed $lang
-	 * @param mixed $level
-	 * @param mixed $parent
-	 * @return
-	 */
-	public function GetLanguagesPages ( $lang, $level, $parent ) {
-		global $database;
-        $page = array();
-        $sql =
-        'SELECT `language`,`visibility`,`viewing_groups`,`viewing_users`,`language`,`position`, '.
-        '`page_id`,`level`,`parent`,`root_parent`,`page_code`,`link` '.
-        'FROM `'.TABLE_PREFIX.'pages` '.
-        'WHERE `level`=\''.$level.'\' '.
-          'AND `language`=\''.$lang['language'].'\' '.
-          'AND `visibility`!=\'none\' '.
-          'AND `visibility`!=\'hidden\' '.
-          'AND `parent`=\''.$parent.'\' '.
-          'AND `root_parent`=`page_id` '.
-        'ORDER BY `position`';
-        if($oPage = $database->query($sql))
-        {
-            $page = $oPage->fetchRow(MYSQL_ASSOC);
-        }
-        return $page;
+            if($oRes = $database->query($sql))
+            {
+                while($page = $oRes->fetchRow(MYSQL_ASSOC))
+                {
+                    if(!$this->page_is_visible($page)) {continue;}
+                    $retVal[$page['language']] = $page;
+                }
+            }
+        return $retVal;
 	}
 
-	/**
-	 *
-	 *
-	 * @return
-	 */
-	public function GetLanguagesInUsed (  ) {
+/**
+ *
+ *
+ * @return comma separate list of first visible languages
+ *
+ */
+	public function GetLanguagesInUsed ( ) {
 		global $database;
         $retVal = '';
         $page = array();
         $sql =
-        'SELECT DISTINCT `language` '.
-        'FROM `'.TABLE_PREFIX.'pages` '.
-        'WHERE `level`= \'0\' '.
-          'AND `visibility`!=\'none\' '.
-          'AND `visibility`!=\'hidden\' '.
-       'ORDER BY `position`';
+            'SELECT DISTINCT `language`'.
+            ', `page_id`,`level`,`parent`,`root_parent`,`page_code`,`link`,`language`'.
+            ', `visibility`,`viewing_groups`,`viewing_users`,`position` '.
+            'FROM `'.TABLE_PREFIX.'pages` '.
+            'WHERE `level`= \'0\' '.
+              'AND `root_parent`=`page_id` '.
+              'AND `visibility`!=\'none\' '.
+              'AND `visibility`!=\'hidden\' '.
+            'GROUP BY `language` '.
+            'ORDER BY `position`';
 
-        if($oRes = $database->query($sql))
-        {
-            while($lang = $oRes->fetchRow(MYSQL_ASSOC))
+            if($oRes = $database->query($sql))
             {
-                $page = $this->GetLanguagesPages ( $lang, 0, 0 );
-                if(!$this->page_is_visible($page)) {continue;}
-                $retVal .= $page['language'].',';
+                while($page = $oRes->fetchRow(MYSQL_ASSOC))
+                {
+                    if(!$this->page_is_visible($page)) {continue;}
+                    $retVal .= $page['language'].',';
+                }
             }
-        }
-        return trim($retVal,',');
+            return trim($retVal,',');
 	}
 
 
@@ -135,12 +141,12 @@
 		return $this->is_group_match( $groups_list, $this->get_groups_id() );
 	}
 
-	// Check whether a page is visible or not.
-	// This will check page-visibility and user- and group-rights.
-	/* page_is_visible() returns
-		false: if page-visibility is 'none' or 'deleted', or page-vis. is 'registered' or 'private' and user isn't allowed to see the page.
-		true: if page-visibility is 'public' or 'hidden', or page-vis. is 'registered' or 'private' and user _is_ allowed to see the page.
-	*/
+// Check whether a page is visible or not.
+// This will check page-visibility and user- and group-rights.
+/* page_is_visible() returns
+	false: if page-visibility is 'none' or 'deleted', or page-vis. is 'registered' or 'private' and user isn't allowed to see the page.
+	true: if page-visibility is 'public' or 'hidden', or page-vis. is 'registered' or 'private' and user _is_ allowed to see the page.
+*/
 	public function page_is_visible($page)
     {
 		// First check if visibility is 'none', 'deleted'
Index: branches/2.8.x/wb/templates/wb_theme/css/screen.css
===================================================================
--- branches/2.8.x/wb/templates/wb_theme/css/screen.css	(revision 1790)
+++ branches/2.8.x/wb/templates/wb_theme/css/screen.css	(revision 1791)
@@ -141,7 +141,7 @@
    form.settings_table input[type="password"] { border :1px solid #666666; margin :0px auto; padding-left :5px; width :59%; }
    form.settings_table input.radio { border :1px none #666666; margin :0px auto; padding-left :0.5em; height :1em; }
    form.settings_table input[type="button"].button { border :1px solid #666666; color :#000000; text-align :left; font-weight :bold; background-color :#dddddd; margin :2px auto; padding :2px 0px 2px 6px; width :60%; }
-   form.settings_table textarea { border :1px solid #666666; margin :3px auto; padding-left :0.5em; min-height :1em; width :60%; }
+   form.settings_table textarea { border :1px solid #666666; margin :3px auto; padding-left :0.5em; min-height :1em; width :59%; }
    form.settings_table select { border :1px solid #666666; margin :3px auto; padding-left :0.5em; min-height :1em; width :60%; }
 /* */
 div.content_box form { }
Index: branches/2.8.x/wb/templates/wb_theme/icons/positive.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: branches/2.8.x/wb/templates/wb_theme/icons/positive.png
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: branches/2.8.x/wb/templates/wb_theme/icons/system.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: branches/2.8.x/wb/templates/wb_theme/icons/system.png
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
