diff options
author | friendica <info@friendica.com> | 2012-11-12 20:59:18 -0800 |
---|---|---|
committer | friendica <info@friendica.com> | 2012-11-12 20:59:18 -0800 |
commit | 5bf3ddfcf66ece4b50d5fccfd90c49005ce768ce (patch) | |
tree | 79bfeb6df83e881816aeb8bc7271dae4f7e14582 /include/notifier.php | |
parent | b4c603cdace281f79e1738d2e006851b00af511e (diff) | |
download | volse-hubzilla-5bf3ddfcf66ece4b50d5fccfd90c49005ce768ce.tar.gz volse-hubzilla-5bf3ddfcf66ece4b50d5fccfd90c49005ce768ce.tar.bz2 volse-hubzilla-5bf3ddfcf66ece4b50d5fccfd90c49005ce768ce.zip |
got zot
Diffstat (limited to 'include/notifier.php')
-rw-r--r-- | include/notifier.php | 67 |
1 files changed, 50 insertions, 17 deletions
diff --git a/include/notifier.php b/include/notifier.php index dd56750c8..1878c2a98 100644 --- a/include/notifier.php +++ b/include/notifier.php @@ -40,42 +40,75 @@ require_once('include/html2plain.php'); * wall-new (in photos.php, item.php) * * and ITEM_ID is the id of the item in the database that needs to be sent to others. + * + * ZOT + * permission_updated abook_id + * */ +require_once('include/cli_startup.php'); +require_once('include/zot.php'); + function notifier_run($argv, $argc){ - global $a, $db; - if(is_null($a)){ - $a = new App; - } - - if(is_null($db)) { - @include(".htconfig.php"); - require_once("dba.php"); - $db = new dba($db_host, $db_user, $db_pass, $db_data); - unset($db_host, $db_user, $db_pass, $db_data); - } + cli_startup(); + + $a = get_app(); require_once("session.php"); require_once("datetime.php"); require_once('include/items.php'); require_once('include/bbcode.php'); - load_config('config'); - load_config('system'); - - load_hooks(); - if($argc < 3) return; - $a->set_baseurl(get_config('system','url')); logger('notifier: invoked: ' . print_r($argv,true), LOGGER_DEBUG); $cmd = $argv[1]; + $item_id = $argv[2]; + + $extra = (($argc > 3) ? $argv[3] : null); + + if($cmd == 'permission_update') { + // Get the recipient + $r = q("select abook.*, hubloc.* from abook + left join hubloc on hubloc_hash = abook_xchan + where abook_id = %d limit 1", + intval($item_id) + ); + if($r) { + // Get the sender + $s = q("select * from channel where channel_id = %d limit 1", + intval($r[0]['abook_channel']) + ); + if($s) { + + // send a refresh message to each hub they have registered here + $h = q("select * from hubloc where hubloc_hash = '%s'", + dbesc($r[0]['hubloc_hash']) + ); + if($h) { + foreach($h as $hh) { + $result = zot_notify($s[0],$hh['hubloc_callback'],'refresh',array(array( + 'guid' => $hh['hubloc_guid'], + 'guid_sig' => $hh['hubloc_guid_sig'], + 'url' => $hh['hubloc_url']) + )); + // should probably queue these + } + } + } + } + } + +return; + + + switch($cmd) { case 'mail': default: |