aboutsummaryrefslogtreecommitdiffstats
path: root/mod/dfrn_notify.php
diff options
context:
space:
mode:
authorMike Macgirvin <mike@macgirvin.com>2010-09-08 20:14:17 -0700
committerMike Macgirvin <mike@macgirvin.com>2010-09-08 20:14:17 -0700
commitffb1997902facb36b78a7cfa522f41f2b3d71cda (patch)
treee9fe47acf26c5fd2c742677f2610b60d3008eb26 /mod/dfrn_notify.php
parentb49858b038a0a05bbe7685929e88071d0e125538 (diff)
downloadvolse-hubzilla-ffb1997902facb36b78a7cfa522f41f2b3d71cda.tar.gz
volse-hubzilla-ffb1997902facb36b78a7cfa522f41f2b3d71cda.tar.bz2
volse-hubzilla-ffb1997902facb36b78a7cfa522f41f2b3d71cda.zip
mistpark 2.0 infrasturcture lands
Diffstat (limited to 'mod/dfrn_notify.php')
-rw-r--r--mod/dfrn_notify.php72
1 files changed, 37 insertions, 35 deletions
diff --git a/mod/dfrn_notify.php b/mod/dfrn_notify.php
index 7cab98eb8..433f69d11 100644
--- a/mod/dfrn_notify.php
+++ b/mod/dfrn_notify.php
@@ -185,43 +185,45 @@ function dfrn_notify_post(&$a) {
$datarray['contact-id'] = $importer['id'];
$posted_id = post_remote($a,$datarray);
- $r = q("SELECT `parent` FROM `item` WHERE `id` = %d AND `uid` = %d LIMIT 1",
- intval($posted_id),
- intval($importer['importer_uid'])
- );
- if(count($r)) {
- $r1 = q("UPDATE `item` SET `last-child` = 0, `changed` = '%s' WHERE `uid` = %d AND `parent` = %d",
- dbesc(datetime_convert()),
- intval($importer['importer_uid']),
- intval($r[0]['parent'])
+ if($posted_id) {
+ $r = q("SELECT `parent` FROM `item` WHERE `id` = %d AND `uid` = %d LIMIT 1",
+ intval($posted_id),
+ intval($importer['importer_uid'])
+ );
+ if(count($r)) {
+ $r1 = q("UPDATE `item` SET `last-child` = 0, `changed` = '%s' WHERE `uid` = %d AND `parent` = %d",
+ dbesc(datetime_convert()),
+ intval($importer['importer_uid']),
+ intval($r[0]['parent'])
+ );
+ }
+ $r2 = q("UPDATE `item` SET `last-child` = 1, `changed` = '%s' WHERE `uid` = %d AND `id` = %d LIMIT 1",
+ dbesc(datetime_convert()),
+ intval($importer['importer_uid']),
+ intval($posted_id)
);
- }
- $r2 = q("UPDATE `item` SET `last-child` = 1, `changed` = '%s' WHERE `uid` = %d AND `id` = %d LIMIT 1",
- dbesc(datetime_convert()),
- intval($importer['importer_uid']),
- intval($posted_id)
- );
- $php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
-
- proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"comment-import\" \"$posted_id\" &",
- array(),$foo));
-
- if(($importer['notify-flags'] & NOTIFY_COMMENT) && (! $importer['self'])) {
- require_once('bbcode.php');
- $from = stripslashes($datarray['author-name']);
- $tpl = file_get_contents('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,
+ $php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
+
+ proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"comment-import\" \"$posted_id\" &",
+ array(),$foo));
+
+ if(($importer['notify-flags'] & NOTIFY_COMMENT) && (! $importer['self'])) {
+ require_once('bbcode.php');
+ $from = stripslashes($datarray['author-name']);
+ $tpl = file_get_contents('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,
'$body' => strip_tags(bbcode(stripslashes($datarray['body'])))
- ));
+ ));
- $res = mail($importer['email'], $from . t(" commented on your item at ") . $a->config['sitename'],
- $email_tpl,t("From: Administrator@") . $a->get_hostname() );
+ $res = mail($importer['email'], $from . t(" commented on your item at ") . $a->config['sitename'],
+ $email_tpl,t("From: Administrator@") . $a->get_hostname() );
+ }
}
xml_status(0);
return;
@@ -356,7 +358,7 @@ function dfrn_notify_content(&$a) {
$encrypted_id = '';
$id_str = $_GET['dfrn_id'] . '.' . mt_rand(1000,9999);
- if($r[0]['duplex']) {
+ if(($r[0]['duplex']) && strlen($r[0]['pubkey'])) {
openssl_public_encrypt($hash,$challenge,$r[0]['pubkey']);
openssl_public_encrypt($id_str,$encrypted_id,$r[0]['pubkey']);
}
@@ -368,7 +370,7 @@ function dfrn_notify_content(&$a) {
$challenge = bin2hex($challenge);
$encrypted_id = bin2hex($encrypted_id);
- echo '<?xml version="1.0" encoding="UTF-8"?><dfrn_notify><status>' .$status . '</status><dfrn_id>' . $encrypted_id . '</dfrn_id>' . '<challenge>' . $challenge . '</challenge></dfrn_notify>' . "\r\n" ;
+ echo '<?xml version="1.0" encoding="UTF-8"?><dfrn_notify><status>' .$status . '</status><dfrn_version>2.0</dfrn_version><dfrn_id>' . $encrypted_id . '</dfrn_id>' . '<challenge>' . $challenge . '</challenge></dfrn_notify>' . "\r\n" ;
session_write_close();
exit;