From 58aee2faa7ab32edcedaf68d346593de9ddb3cb6 Mon Sep 17 00:00:00 2001 From: artem Date: Wed, 19 Mar 2008 17:56:41 +0000 Subject: - [DEV-139] added transaction functionality to frontend (Artem) - many small fixes (Artem) git-svn-id: svn://svn.zabbix.com/trunk@5505 97f52cf1-0a1b-0410-bd0e-c28be96e8082 --- frontends/php/include/profiles.inc.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'frontends/php/include/profiles.inc.php') diff --git a/frontends/php/include/profiles.inc.php b/frontends/php/include/profiles.inc.php index dfd913a1..46685bf9 100644 --- a/frontends/php/include/profiles.inc.php +++ b/frontends/php/include/profiles.inc.php @@ -68,10 +68,12 @@ function update_profile($idx,$value,$type=PROFILE_TYPE_UNKNOWN){ if($type==PROFILE_TYPE_ARRAY && !is_array($value)) $value = array($value); if(PROFILE_TYPE_ARRAY == $type){ + DBstart(); $sql='DELETE FROM profiles WHERE userid='.$USER_DETAILS["userid"].' and idx='.zbx_dbstr($idx); DBExecute($sql); - - insert_profile($idx,$value,$type); + + $result = insert_profile($idx,$value,$type); + DBend($result); } else{ $row = DBfetch(DBselect('SELECT value FROM profiles WHERE userid='.$USER_DETAILS["userid"].' AND idx='.zbx_dbstr($idx))); @@ -94,18 +96,19 @@ return true; function insert_profile($idx,$value,$type=PROFILE_TYPE_UNKNOWN){ global $USER_DETAILS; + $result = true; if(is_array($value)){ foreach($value as $key => $val){ - insert_profile($idx,$val,$type); // recursion!!! + $result&=insert_profile($idx,$val,$type); // recursion!!! } } else{ $profileid = get_dbid('profiles', 'profileid'); $sql='INSERT INTO profiles (profileid,userid,idx,value,valuetype)'. ' VALUES ('.$profileid.','.$USER_DETAILS["userid"].','.zbx_dbstr($idx).','.zbx_dbstr($value).','.$type.')'; - DBexecute($sql); + $result = DBexecute($sql); } - +return $result; } /***********************************/ -- cgit