From 49882c13a4fb67da29862034ddcfd9a55757f2ee Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 29 Sep 2013 22:24:37 -0700 Subject: there's our directory sync packet (aka transaction log). Now we just have to pass them around and act on them. --- mod/dirsearch.php | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'mod') diff --git a/mod/dirsearch.php b/mod/dirsearch.php index 3fec691be..a7e785c1b 100644 --- a/mod/dirsearch.php +++ b/mod/dirsearch.php @@ -135,11 +135,21 @@ function dirsearch_content(&$a) { if($sync) { - - $r = q("select xchan.*, updates.* from xchan left join updates on ud_hash = xchan_hash where ud_date >= '%s' and ud_guid != '' order by ud_date desc", + $spkt = array('transactions' => array()); + $r = q("select * from updates where ud_date >= '%s' and ud_guid != '' order by ud_date desc", dbesc($sync) ); - + if($r) { + foreach($r as $rr) { + $spkt['transactions'][] = array( + 'hash' => $rr['ud_hash'], + 'address' => $rr['ud_addr'], + 'transaction_id' => $rr['ud_guid'], + 'timestamp' => $rr['ud_date'] + ); + } + } + json_return_and_die($spkt); } else { $r = q("SELECT xchan.*, xprof.* from xchan left join xprof on xchan_hash = xprof_hash where $logic $sql_extra and not ( xchan_flags & %d ) and not ( xchan_flags & %d ) $safesql $order $qlimit ", @@ -183,7 +193,7 @@ function dirsearch_content(&$a) { } $ret['results'] = $entries; - if(($kw) && (! $sync)) { + if($kw) { $k = dir_tagadelic($kw); if($k) { $ret['keywords'] = array(); -- cgit v1.2.3