+ if(($datarray['verb'] == ACTIVITY_LIKE) || ($datarray['verb'] == ACTIVITY_DISLIKE)) {
+ $datarray['type'] = 'activity';
+ $datarray['gravity'] = GRAVITY_LIKE;
+ }
+
+ $r = item_store($datarray);
+
+ // find out if our user is involved in this conversation and wants to be notified.
+
+ if(($datarray['type'] != 'activity') && ($importer['notify-flags'] & NOTIFY_COMMENT)) {
+
+ $myconv = q("SELECT `author-link` FROM `item` WHERE `parent-uri` = '%s' AND `uid` = %d",
+ dbesc($parent_uri),
+ intval($importer['importer_uid'])
+ );
+ if(count($myconv)) {
+ foreach($myconv as $conv) {
+ if($conv['author-link'] != $importer['url'])
+ continue;
+ require_once('bbcode.php');
+ $from = stripslashes($datarray['author-name']);
+ $tpl = load_view_file('view/cmnt_received_eml.tpl');
+ $email_tpl = replace_macros($tpl, array(
+ '$sitename' => $a->config['sitename'],
+ '$siteurl' => $a->get_baseurl(),
+ '$username' => $importer['username'],
+ '$email' => $importer['email'],
+ '$from' => $from,
+ '$display' => $a->get_baseurl() . '/display/' . $r,
+ '$body' => strip_tags(bbcode(stripslashes($datarray['body'])))
+ ));
+
+ $res = mail($importer['email'], $from . t(" commented on an item at ")
+ . $a->config['sitename'],
+ $email_tpl,t("From: Administrator@") . $a->get_hostname() );
+ break;
+ }
+ }
+ }