From 62e141a89c1e2c5583718690ea83a13dd1d23dd1 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Wed, 17 Feb 2016 14:14:42 -0800 Subject: provide del_iconfig for completeness --- include/items.php | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'include') diff --git a/include/items.php b/include/items.php index a2b736eea..5a1dadcb8 100755 --- a/include/items.php +++ b/include/items.php @@ -5548,3 +5548,37 @@ function set_iconfig(&$item, $family, $key, $value) { return $value; } + + +function del_iconfig(&$item, $family, $key) { + + + $is_item = false; + $idx = null; + + if(is_array($item)) { + $is_item = true; + if(is_array($item['iconfig'])) { + for($x = 0; $x < count($item['iconfig']); $x ++) { + if($item['iconfig'][$x]['cat'] == $family && $item['iconfig'][$x]['k'] == $key) { + unset($item['iconfig'][$x]); + } + } + } + return true; + } + + if(intval($item)) + $iid = intval($item); + + if(! $iid) + return false; + + return q("delete from iconfig where iid = %d and cat = '%s' and k = '%s' ", + intval($iid), + dbesc($family), + dbesc($key) + ); + +} + -- cgit v1.2.3