sort out notify x-domain

This commit is contained in:
Mike Macgirvin 2010-08-22 20:57:20 -07:00
commit b02e30f1cf
7 changed files with 67 additions and 34 deletions

View file

@ -67,10 +67,11 @@ function get_feed_for(&$a,$dfrn_id,$owner_id,$last_update) {
FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
WHERE `item`.`uid` = %d AND `item`.`visible` = 1
AND NOT `item`.`type` IN ( 'remote', 'net-comment' ) AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0
AND `item`.`edited` > '%s'
AND ( `item`.`edited` > '%s' OR `item`.`changed` > '%s' )
$sql_extra
ORDER BY `parent` ASC, `created` ASC LIMIT 0, 300",
intval($owner_id),
dbesc($check_date),
dbesc($check_date)
);
if(! count($r))
@ -209,6 +210,7 @@ function post_remote($a,$arr) {
$arr['owner-avatar'] = notags(trim($arr['owner-avatar']));
$arr['created'] = datetime_convert('UTC','UTC',$arr['created'],'Y-m-d H:i:s');
$arr['edited'] = datetime_convert('UTC','UTC',$arr['edited'],'Y-m-d H:i:s');
$arr['changed'] = datetime_convert();
$arr['title'] = notags(trim($arr['title']));
$arr['location'] = notags(trim($arr['location']));
$arr['body'] = escape_tags(trim($arr['body']));

View file

@ -17,7 +17,7 @@
if($argc < 3)
exit;
$a->set_baseurl(get_config('system',url'));
$a->set_baseurl(get_config('system','url'));
$baseurl = $argv[1];
$a->set_baseurl($argv[1]);
@ -34,6 +34,8 @@
break;
}
if($debugging)
dbg(3);
$recipients = array();

View file

@ -191,18 +191,20 @@ echo "Length:" . strlen($xml) . "\r\n";
);
if(count($r)) {
if($r[0]['uri'] == $r[0]['parent-uri']) {
$r = q("UPDATE `item` SET `deleted` = 1, `edited` = '%s',
$r = q("UPDATE `item` SET `deleted` = 1, `edited` = '%s', `changed` = '%s',
`body` = '', `title` = ''
WHERE `parent-uri` = '%s'",
dbesc($when),
dbesc(datetime_convert()),
dbesc($r[0]['uri'])
);
}
else {
$r = q("UPDATE `item` SET `deleted` = 1, `edited` = '%s',
$r = q("UPDATE `item` SET `deleted` = 1, `edited` = '%s', `changed` = '%s',
`body` = '', `title` = ''
WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
dbesc($when),
dbesc(datetime_convert()),
dbesc($uri),
intval($importer['uid'])
);
@ -233,13 +235,20 @@ echo "Length:" . strlen($xml) . "\r\n";
);
// FIXME update content if 'updated' changes
if(count($r)) {
$allow = $item->get_item_tags('http://purl.org/macgirvin/dfrn/1.0','comment-allow');
$allow = $item->get_item_tags( NAMESPACE_DFRN, 'comment-allow');
if($allow && $allow[0]['data'] != $r[0]['last-child']) {
$r = q("UPDATE `item` SET `last-child` = %d WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
$r = q("UPDATE `item` SET `last-child` = 0, `changed` = '%s' WHERE `parent-uri` = '%s'",
dbesc(datetime_convert()),
dbesc($parent_uri)
);
$r = q("UPDATE `item` SET `last-child` = %d , `changed` = '%s' WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
intval($allow[0]['data']),
dbesc(datetime_convert()),
dbesc($item_id),
intval($importer['uid'])
);
}
continue;
}
@ -260,10 +269,11 @@ echo "Length:" . strlen($xml) . "\r\n";
intval($importer['uid'])
);
if(count($r)) {
$allow = $item->get_item_tags('http://purl.org/macgirvin/dfrn/1.0','comment-allow');
$allow = $item->get_item_tags( NAMESPACE_DFRN, 'comment-allow');
if($allow && $allow[0]['data'] != $r[0]['last-child']) {
$r = q("UPDATE `item` SET `last-child` = %d WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
$r = q("UPDATE `item` SET `last-child` = %d , `changed` = '%s' WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
intval($allow[0]['data']),
dbesc(datetime_convert()),
dbesc($item_id),
intval($importer['uid'])
);