From 3ab0ef1902a9ff1f33cf5540a866745dc98a11a9 Mon Sep 17 00:00:00 2001 From: "M.Dent" Date: Sun, 28 Oct 2018 17:23:31 -0400 Subject: Add timestamp and associated logic to pconfig --- include/zot.php | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) (limited to 'include/zot.php') diff --git a/include/zot.php b/include/zot.php index 1a632cf87..a5202d01b 100644 --- a/include/zot.php +++ b/include/zot.php @@ -3507,8 +3507,41 @@ function process_channel_sync_delivery($sender, $arr, $deliveries) { if(array_key_exists('config',$arr) && is_array($arr['config']) && count($arr['config'])) { foreach($arr['config'] as $cat => $k) { - foreach($arr['config'][$cat] as $k => $v) - set_pconfig($channel['channel_id'],$cat,$k,$v); + + $pconfig_updated = []; + $pconfig_del = []; + + foreach($arr['config'][$cat] as $k => $v) { + + if (strpos($k,'pcfgud:')==0) { + + $realk = substr($k,7); + $pconfig_updated[$realk] = $v; + unset($arr['config'][$cat][$k]); + + } + + if (strpos($k,'pcfgdel:')==0) { + $realk = substr($k,8); + $pconfig_del[$realk] = $v; + unset($arr['config'][$cat][$k]); + } + } + + foreach($arr['config'][$cat] as $k => $v) { + + if (!isset($pconfig_updated[$k])) { + $pconfig_updated[$k] = NULL; + } + + set_pconfig($channel['channel_id'],$cat,$k,$v,$pconfig_updated[$k]); + + } + + foreach($pconfig_del as $k => $updated) { + del_pconfig($channel['channel_id'],$cat,$k,$updated); + } + } } -- cgit v1.2.3 From 346a4f593332009014fc8b3595bd56c6ca9ff9b5 Mon Sep 17 00:00:00 2001 From: "M.Dent" Date: Thu, 1 Nov 2018 20:23:22 -0400 Subject: strpos needs to test with ===0 not ==0 --- include/zot.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'include/zot.php') diff --git a/include/zot.php b/include/zot.php index a5202d01b..49fc89e33 100644 --- a/include/zot.php +++ b/include/zot.php @@ -3513,7 +3513,7 @@ function process_channel_sync_delivery($sender, $arr, $deliveries) { foreach($arr['config'][$cat] as $k => $v) { - if (strpos($k,'pcfgud:')==0) { + if (strpos($k,'pcfgud:')===0) { $realk = substr($k,7); $pconfig_updated[$realk] = $v; @@ -3521,9 +3521,9 @@ function process_channel_sync_delivery($sender, $arr, $deliveries) { } - if (strpos($k,'pcfgdel:')==0) { + if (strpos($k,'pcfgdel:')===0) { $realk = substr($k,8); - $pconfig_del[$realk] = $v; + $pconfig_del[$realk] = datetime_convert(); unset($arr['config'][$cat][$k]); } } -- cgit v1.2.3