diff options
author | redmatrix <git@macgirvin.com> | 2016-02-17 14:14:42 -0800 |
---|---|---|
committer | redmatrix <git@macgirvin.com> | 2016-02-17 14:14:42 -0800 |
commit | 62e141a89c1e2c5583718690ea83a13dd1d23dd1 (patch) | |
tree | 48b1263b52284303b291467cd596905d0ead85e5 | |
parent | 696c6e88ea6b1dbd06751cb5b87221b8377167a1 (diff) | |
download | volse-hubzilla-62e141a89c1e2c5583718690ea83a13dd1d23dd1.tar.gz volse-hubzilla-62e141a89c1e2c5583718690ea83a13dd1d23dd1.tar.bz2 volse-hubzilla-62e141a89c1e2c5583718690ea83a13dd1d23dd1.zip |
provide del_iconfig for completeness
-rwxr-xr-x | include/items.php | 34 |
1 files changed, 34 insertions, 0 deletions
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) + ); + +} + |