From 470915a55b9125d4dd361dcba3c5dbe013f3d4e0 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Wed, 2 Sep 2015 20:07:15 -0700 Subject: sync "things" (obj elements) --- mod/thing.php | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/mod/thing.php b/mod/thing.php index c6b70fbb4..842832d16 100644 --- a/mod/thing.php +++ b/mod/thing.php @@ -92,6 +92,20 @@ function thing_init(&$a) { ); info( t('Thing updated') . EOL); + + $datestamp = datetime_convert(); + + $r = q("select obj.*, term.term as obj_term, term.url as obj_url, term.imgurl as obj_imgurl, '%s' as obj_created, '%s' as obj_edited, '%s' as obj_baseurl from obj left join term on obj_obj = term.term_hash where obj_channel = %d and term.term_hash = '%s'", + dbesc($datestamp), + dbesc($datestamp), + dbesc(z_root()), + intval(local_channel()), + dbesc($term_hash) + ); + + if($r) + build_sync_packet(0,array('obj' => $r)); + return; } @@ -156,6 +170,20 @@ function thing_init(&$a) { info( t('Thing added')); + $datestamp = datetime_convert(); + + $r = q("select obj.*, term.term as obj_term, term.url as obj_url, term.imgurl as obj_imgurl, '%s' as obj_created, '%s' as obj_edited, '%s' as obj_baseurl from obj left join term on obj_obj = term.term_hash where obj_channel = %d and term.term_hash = '%s' ", + dbesc($datestamp), + dbesc($datestamp), + dbesc(z_root()), + intval(local_channel()), + dbesc($term['term_hash']) + ); + + if($r) + build_sync_packet(0,array('obj' => $r)); + + if($activity) { $arr = array(); $links = array(array('rel' => 'alternate','type' => 'text/html', 'href' => $term['url'])); -- cgit v1.2.3