Index: branches/2.8.x/CHANGELOG
===================================================================
--- branches/2.8.x/CHANGELOG	(revision 1363)
+++ branches/2.8.x/CHANGELOG	(revision 1364)
@@ -11,6 +11,8 @@
 ! = Update/Change
 
 ------------------------------------- 2.8.2 -------------------------------------
+29 Dec-2010 Build 1364 Dietmar Woellbrink (Luisehahne)
+! added function 'db_update_key_value()'
 29 Dec-2010 Build 1363 Dietmar Woellbrink (Luisehahne)
 # Ticket #1053, Ticket #941 show_breadcrumb
 29 Dec-2010 Build 1362 Dietmar Woellbrink (Luisehahne)
Index: branches/2.8.x/wb/admin/interface/version.php
===================================================================
--- branches/2.8.x/wb/admin/interface/version.php	(revision 1363)
+++ branches/2.8.x/wb/admin/interface/version.php	(revision 1364)
@@ -52,6 +52,6 @@
 
 // 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.RC2');
-if(!defined('REVISION')) define('REVISION', '1363');
+if(!defined('REVISION')) define('REVISION', '1364');
 
 ?>
\ No newline at end of file
Index: branches/2.8.x/wb/framework/class.database.php
===================================================================
--- branches/2.8.x/wb/framework/class.database.php	(revision 1363)
+++ branches/2.8.x/wb/framework/class.database.php	(revision 1364)
@@ -315,5 +315,48 @@
 	}
 
 }
-
+/* this function is placed inside this file temporarely until a better place is found */
+/*  function to update a var/value-pair(s) in table ****************************
+ *  nonexisting keys are inserted
+ *  @param string $table: name of table to use (without prefix)
+ *  @param mixed $key:    a array of key->value pairs to update
+ *                        or a string with name of the key to update
+ *  @param string $value: a sting with needed value, if $key is a string too
+ *  @return bool:  true if any keys are updated, otherwise false
+ */
+	function db_update_key_value($table, $key, $value = '')
+	{
+		global $database;
+		if( !is_array($key))
+		{
+			if( trim($key) != '' )
+			{
+				$key = array( trim($key) => trim($value) );
+			} else {
+				$key = array();
+			}
+		}
+		$retval = true;
+		foreach( $key as $index=>$val)
+		{
+			$index = strtolower($index);
+			$sql = 'SELECT COUNT(`setting_id`) FROM `'.TABLE_PREFIX.$table.'` WHERE `name` = \''.$index.'\' ';
+			if($database->get_one($sql))
+			{
+				$sql = 'UPDATE ';
+				$sql_where = 'WHERE `name` = \''.$index.'\'';
+			}else {
+				$sql = 'INSERT INTO ';
+				$sql_where = '';
+			}
+			$sql .= '`'.TABLE_PREFIX.$table.'` ';
+			$sql .= 'SET `name` = \''.$index.'\', ';
+			$sql .= '`value` = \''.$val.'\' '.$sql_where;
+			if( !$database->query($sql) )
+			{
+				$retval = false;
+			}
+		}
+		return $retval;
+	}
 ?>
\ No newline at end of file
