From bec3d15c525ff12ba0de53c0b21e03cc9a3a7f39 Mon Sep 17 00:00:00 2001 From: Mike Macgirvin Date: Thu, 8 Jul 2010 17:49:41 -0700 Subject: [PATCH] more work --- include/notifier.php | 18 +++++++++++++++--- mod/item.php | 8 +++++--- mod/login.php | 2 +- view/atomic.tpl | 5 ++++- 4 files changed, 25 insertions(+), 8 deletions(-) diff --git a/include/notifier.php b/include/notifier.php index e67ef06e31..89b0964b49 100644 --- a/include/notifier.php +++ b/include/notifier.php @@ -15,17 +15,29 @@ require_once("datetime.php"); // FIXME - generalise for other content, probably create a notify queue in // the db with type and recipient list -if(($argc != 3) || (! intval($argv[2]))) +if($argc < 3) exit; - $baseurl = trim(pack("H*" , $argv[1])); + $baseurl = trim(hex2bin($argv[1])); + + $cmd = $argv[2]; + + switch($cmd) { + + default: + $item_id = intval($argv[3]); + if(! $item_id) + killme(); + break; + } - $item_id = $argv[2]; $is_parent = false; $recipients = array(); + // fetch requested item + $r = q("SELECT `item`.*, `contact`.*,`item`.`id` AS `item_id` FROM `item` LEFT JOIN `contact` ON `item`.`contact-id` = `contact`.`id` WHERE `item`.`id` = %d LIMIT 1", intval($item_id) diff --git a/mod/item.php b/mod/item.php index 4314719fb5..40d03a1986 100644 --- a/mod/item.php +++ b/mod/item.php @@ -24,6 +24,9 @@ function item_post(&$a) { if(count($r)) $contact_id = $r[0]['id']; } + + $notify_type = (($parent) ? 'comment-new' : 'wall-new' ); + if($_POST['type'] == 'jot') { do { @@ -59,10 +62,9 @@ function item_post(&$a) { } $url = bin2hex($a->get_baseurl()); - proc_close(proc_open("php include/notifier.php $url $post_id > notify.log &", - array(),$foo)); -// notifier($a,$post_id,$parent); + proc_close(proc_open("php include/notifier.php $url $notify_type $post_id > notify.log &", + array(),$foo)); } goaway($a->get_baseurl() . "/profile/$profile_uid"); diff --git a/mod/login.php b/mod/login.php index 296890a5b2..4ee4e1fa06 100644 --- a/mod/login.php +++ b/mod/login.php @@ -4,5 +4,5 @@ function login_content(&$a) { // return login($a->config['register_enabled']); - return login(1); + return login(($a->config['register_policy'] == REGISTER_CLOSED) ? 0 : 1); } \ No newline at end of file diff --git a/view/atomic.tpl b/view/atomic.tpl index 5d3eea0606..9a72a7489f 100644 --- a/view/atomic.tpl +++ b/view/atomic.tpl @@ -1,5 +1,8 @@ + xmlns:foaf="http://xmlns.com/foaf/0.1" + xmlns:thr="http://purl.org/syndication/thread/1.0" + xmlns:at="http://purl.org/atompub/tombstones/1.0" +> $feed_id $feed_title $feed_updated