aboutsummaryrefslogtreecommitdiffstats
path: root/include/notifier.php
diff options
context:
space:
mode:
authorMike Macgirvin <mike@macgirvin.com>2010-07-08 00:18:23 -0700
committerMike Macgirvin <mike@macgirvin.com>2010-07-08 00:18:23 -0700
commite98aaa3cbd2c14ab2f1b8534c8c63708086fe0f1 (patch)
treec3c21db16962580289f5496c5c34a4d116b9dfdd /include/notifier.php
parent4b4d680dc4e40384e9cc71591609a1f788f31c66 (diff)
downloadvolse-hubzilla-e98aaa3cbd2c14ab2f1b8534c8c63708086fe0f1.tar.gz
volse-hubzilla-e98aaa3cbd2c14ab2f1b8534c8c63708086fe0f1.tar.bz2
volse-hubzilla-e98aaa3cbd2c14ab2f1b8534c8c63708086fe0f1.zip
getting deeper into notifications
Diffstat (limited to 'include/notifier.php')
-rw-r--r--include/notifier.php59
1 files changed, 54 insertions, 5 deletions
diff --git a/include/notifier.php b/include/notifier.php
index 391b711ba..d1f26cdc2 100644
--- a/include/notifier.php
+++ b/include/notifier.php
@@ -16,12 +16,61 @@ require_once("datetime.php");
if(($argc != 2) || (! intval($argv[1])))
exit;
+ $is_parent = false;
+ $item_id = $argv[1];
+
+ $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)
+ );
+ if(! count($r))
+ killme();
-
- // fetch item
-
- // if not parent, fetch it too
-
+ $item = $r[0];
+
+ if($item['parent'] == $item['id']) {
+ $is_parent = true;
+ }
+ else {
+ $r = q("SELECT * FROM `item` WHERE `id` = %d LIMIT 1",
+ intval($item['parent'])
+ );
+ if(count($r))
+ $parent = $r[0];
+ }
+
+ $commenters = array();
+
+ $r = q("SELECT `contact-id` FROM `item` WHERE `hash` = '%s' AND `id` != %d AND `id` != %d",
+ dbesc($item['hash']),
+ intval($item['id']),
+ intval($item['parent'])
+ );
+ if(count($r)) {
+ foreach($r as $rr) {
+ if($rr['contact-id'] != $item['contact-id'])
+ $commenters[] = $rr['contact-id'];
+ }
+ }
+
+ $tpl = file_get_contents('view/atomic.tpl');
+
+ $atom = replace_macros($tpl, array(
+ '$feed_id' => $a->get_baseurl(),
+ '$feed_title' => 'Wall Item',
+ '$feed_updated' => datetime_convert('UTC','UTC',$item['edited'] . '+00:00' ,'Y-m-d\Th:i:s\Z') ,
+ '$name' => $item['name'],
+ '$profile_page' => $item['url'],
+ '$thumb' => $item['thumb'],
+ '$item_id' => $item['hash'] . '-' . $item['id'],
+ '$title' => '',
+ '$link' => $a->get_baseurl() . '/item/' . $item['id'],
+ '$updated' => datetime_convert('UTC','UTC',$item['edited'] . '+00:00' ,'Y-m-d\Th:i:s\Z'),
+ '$summary' => '',
+ '$content' => $item['body']
+ ));
+
+print_r($atom);
// atomify
// expand list of recipients