aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorredmatrix <git@macgirvin.com>2016-02-17 14:14:42 -0800
committerredmatrix <git@macgirvin.com>2016-02-17 14:14:42 -0800
commit62e141a89c1e2c5583718690ea83a13dd1d23dd1 (patch)
tree48b1263b52284303b291467cd596905d0ead85e5
parent696c6e88ea6b1dbd06751cb5b87221b8377167a1 (diff)
downloadvolse-hubzilla-62e141a89c1e2c5583718690ea83a13dd1d23dd1.tar.gz
volse-hubzilla-62e141a89c1e2c5583718690ea83a13dd1d23dd1.tar.bz2
volse-hubzilla-62e141a89c1e2c5583718690ea83a13dd1d23dd1.zip
provide del_iconfig for completeness
-rwxr-xr-xinclude/items.php34
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)
+ );
+
+}
+