]> git.mxchange.org Git - friendica.git/commitdiff
getting deeper into notifications
authorMike Macgirvin <mike@macgirvin.com>
Thu, 8 Jul 2010 07:18:23 +0000 (00:18 -0700)
committerMike Macgirvin <mike@macgirvin.com>
Thu, 8 Jul 2010 07:18:23 +0000 (00:18 -0700)
database.sql
include/notifier.php
view/atomic.tpl

index 5ebba33393a0374b237b78a654ffc9f464e6343e..267722747023f0e8644579995f576f3e23e4a36c 100644 (file)
@@ -24,7 +24,7 @@ CREATE TABLE IF NOT EXISTS `challenge` (
   `dfrn-id` char(255) NOT NULL,
   `expire` int(11) NOT NULL,
   PRIMARY KEY (`id`)
-) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=6 ;
+) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
 
 -- --------------------------------------------------------
 
@@ -61,7 +61,7 @@ CREATE TABLE IF NOT EXISTS `contact` (
   `reason` text NOT NULL COMMENT 'why a rating was given - will help friends decide to make friends or not',
   `profile-id` int(11) NOT NULL DEFAULT '0' COMMENT 'which profile to display - 0 is public default',
   PRIMARY KEY (`id`)
-) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=109 ;
+) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
 
 -- --------------------------------------------------------
 
@@ -107,7 +107,7 @@ CREATE TABLE IF NOT EXISTS `intro` (
   `blocked` tinyint(1) NOT NULL DEFAULT '1',
   `ignore` tinyint(1) NOT NULL DEFAULT '0',
   PRIMARY KEY (`id`)
-) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=64 ;
+) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
 
 -- --------------------------------------------------------
 
@@ -140,7 +140,7 @@ CREATE TABLE IF NOT EXISTS `item` (
   KEY `commented` (`commented`),
   FULLTEXT KEY `body` (`body`),
   FULLTEXT KEY `title` (`title`)
-) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=20 ;
+) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
 
 -- --------------------------------------------------------
 
@@ -166,7 +166,7 @@ CREATE TABLE IF NOT EXISTS `photo` (
   `deny_uid` mediumtext NOT NULL,
   `deny_gid` mediumtext NOT NULL,
   PRIMARY KEY (`id`)
-) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=95 ;
+) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
 
 -- --------------------------------------------------------
 
@@ -195,7 +195,7 @@ CREATE TABLE IF NOT EXISTS `profile` (
   `thumb` char(255) NOT NULL,
   `publish` tinyint(1) NOT NULL DEFAULT '0',
   PRIMARY KEY (`id`)
-) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=17 ;
+) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
 
 -- --------------------------------------------------------
 
@@ -209,7 +209,7 @@ CREATE TABLE IF NOT EXISTS `profile_check` (
   `dfrn_id` char(255) NOT NULL,
   `expire` int(11) NOT NULL,
   PRIMARY KEY (`id`)
-) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=20 ;
+) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
 
 -- --------------------------------------------------------
 
@@ -225,7 +225,7 @@ CREATE TABLE IF NOT EXISTS `session` (
   PRIMARY KEY (`id`),
   KEY `sid` (`sid`),
   KEY `expire` (`expire`)
-) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=31 ;
+) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
 
 -- --------------------------------------------------------
 
@@ -245,4 +245,4 @@ CREATE TABLE IF NOT EXISTS `user` (
   `verified` tinyint(1) unsigned NOT NULL DEFAULT '0',
   `blocked` tinyint(1) unsigned NOT NULL DEFAULT '0',
   PRIMARY KEY (`uid`)
-) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=11 ;
+) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
index 391b711ba84281c893cdb329c50c48743589b264..d1f26cdc2c1df17411d8a678263adcdd3baaccd4 100644 (file)
@@ -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
index 1339333038b5af299f212601c8507ad1d1a4b178..5d3eea060632bcdada02956e21c78a8ffbcda753 100644 (file)
@@ -17,6 +17,6 @@
      <link href="$link" />
      <updated>$updated</updated>
      <summary>$summary</summary>
-     <content type="text/plain" ></content>
+     <content type="text/plain" >$content</content>
   </entry>
 </feed>
\ No newline at end of file