diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/contact_widgets.php | 11 | ||||
-rw-r--r-- | include/notifier.php | 5 | ||||
-rw-r--r-- | include/zot.php | 55 |
3 files changed, 40 insertions, 31 deletions
diff --git a/include/contact_widgets.php b/include/contact_widgets.php index cc7d92508..bc7faebc3 100644 --- a/include/contact_widgets.php +++ b/include/contact_widgets.php @@ -91,9 +91,16 @@ function categories_widget($baseurl,$selected = '') { return ''; $terms = array(); - $r = q("select distinct(term) from term where uid = %d and type = %d order by term asc", + $r = q("select distinct(term.term) + from term join item on term.oid = item.id + where item.uid = %d + and term.uid = item.uid + and term.type = %d + and item.author_xchan = '%s' + order by term.term asc", intval($a->profile['profile_uid']), - intval(TERM_CATEGORY) + intval(TERM_CATEGORY), + dbesc($a->profile['channel_hash']) ); if($r && count($r)) { foreach($r as $rr) diff --git a/include/notifier.php b/include/notifier.php index 5dcd7b58c..e813f7951 100644 --- a/include/notifier.php +++ b/include/notifier.php @@ -208,9 +208,8 @@ function notifier_run($argv, $argc){ $channel = $s[0]; $uid = $item_id; $recipients = array(); - $r = q("select * from abook where abook_channel = %d and not (abook_flags & %d)", - intval($item_id), - intval(ABOOK_FLAG_SELF) + $r = q("select abook_xchan from abook where abook_channel = %d", + intval($item_id) ); if($r) { foreach($r as $rr) { diff --git a/include/zot.php b/include/zot.php index 33522b485..e9084496c 100644 --- a/include/zot.php +++ b/include/zot.php @@ -493,7 +493,6 @@ function import_xchan($arr) { logger('import_xchan: existing: ' . print_r($r[0],true), LOGGER_DATA); logger('import_xchan: new: ' . print_r($arr,true), LOGGER_DATA); - update_modtime($xchan_hash); $changed = true; } } @@ -532,7 +531,7 @@ function import_xchan($arr) { dbesc($arr['name_updated']), intval($new_flags) ); - update_modtime($xchan_hash); + $changed = true; } @@ -553,7 +552,7 @@ function import_xchan($arr) { dbesc($xchan_hash) ); - update_modtime($xchan_hash); + $changed = true; } @@ -601,7 +600,7 @@ function import_xchan($arr) { dbesc(datetime_convert()), intval($r[0]['hubloc_id']) ); - update_modtime($xchan_hash); + $changed = true; } continue; @@ -641,7 +640,7 @@ function import_xchan($arr) { dbesc(datetime_convert()), dbesc(datetime_convert()) ); - update_modtime($xchan_hash); + $changed = true; } @@ -653,7 +652,7 @@ function import_xchan($arr) { $r = q("delete from hubloc where hubloc_id = %d limit 1", intval($x['hubloc_id']) ); - update_modtime($xchan_hash); + $changed = true; } } @@ -667,7 +666,7 @@ function import_xchan($arr) { if(array_key_exists('profile',$arr) && is_array($arr['profile'])) { $profile_changed = import_directory_profile($xchan_hash,$arr['profile']); if($profile_changed) { - update_modtime($xchan_hash); + $changed = true; } } @@ -686,7 +685,6 @@ function import_xchan($arr) { if(array_key_exists('site',$arr) && is_array($arr['site'])) { $profile_changed = import_site($arr['site'],$arr['key']); if($profile_changed) { - update_modtime($xchan_hash); $changed = true; } } @@ -694,9 +692,8 @@ function import_xchan($arr) { if($changed) { - // send out a directory mirror update packet if we're a directory server or some kind - - + $guid = random_string() . '@' . get_app()->get_hostname(); + update_modtime($xchan_hash,$guid); } if(! x($ret,'message')) { @@ -1431,7 +1428,7 @@ function import_directory_profile($hash,$profile) { call_hooks('import_directory_profile', $d); if($d['update']) - update_modtime($arr['xprof_hash']); + update_modtime($arr['xprof_hash'],random_string() . '@' . get_app()->get_hostname()); return $d['update']; } @@ -1470,20 +1467,12 @@ function import_directory_keywords($hash,$keywords) { } -function update_modtime($hash) { - $r = q("select * from updates where ud_hash = '%s' limit 1", - dbesc($hash) +function update_modtime($hash,$guid) { + q("insert into updates (ud_hash, ud_guid, ud_date) values ( '%s', '%s', '%s' )", + dbesc($hash), + dbesc($guid), + dbesc(datetime_convert()) ); - if($r) - q("update updates set ud_date = '%s' where ud_hash = '%s' limit 1", - dbesc(datetime_convert()), - dbesc($hash) - ); - else - q("insert into updates (ud_hash, ud_date) values ( '%s', '%s' )", - dbesc($hash), - dbesc(datetime_convert()) - ); } @@ -1549,7 +1538,7 @@ function import_site($arr,$pubkey) { } } else { - $r = q("insert into site ( site_url, site_acccess, site_flags, site_update, site_directory, site_register ) + $r = q("insert into site ( site_url, site_access, site_flags, site_update, site_directory, site_register ) values ( '%s', %d, %d, '%s', '%s', %d )", dbesc(htmlentities($arr['url'],ENT_COMPAT,'UTF-8',false)), intval($site_directory), @@ -1745,6 +1734,20 @@ function process_channel_sync_delivery($sender,$arr,$deliveries) { if(! array_key_exists('abook_xchan',$clean)) continue; + $r = q("select * from abook where abook_xchan = '%s' and abook_channel = %d limit 1", + dbesc($clean['abook_xchan']), + intval($channel['channel_id']) + ); + + // make sure we have an abook entry for this xchan on this system + + if(! $r) { + q("insert into abook ( abook_xchan, abook_channel ) values ('%s', %d ) ", + dbesc($clean['abook_xchan']), + intval($channel['channel_id']) + ); + } + if(count($clean)) { foreach($clean as $k => $v) { $r = dbq("UPDATE abook set " . dbesc($k) . " = '" . dbesc($v) |