if($val >= 200 && $val < 300)
$err = 'OK';
- logger('mod-salmon returns ' . $val);
+ logger('mod-salmon returns ' . $val);
header($_SERVER["SERVER_PROTOCOL"] . ' ' . $val . ' ' . $err);
killme();
$xml = file_get_contents('php://input');
- logger('mod-salmon: new salmon ' . $xml);
+ logger('mod-salmon: new salmon ' . $xml, LOGGER_DATA);
$nick = (($a->argc > 1) ? notags(trim($a->argv[1])) : '');
$mentions = (($a->argc > 2 && $a->argv[2] === 'mention') ? true : false);
- $r = q("SELECT * FROM `user` WHERE `nickname` = '%s' LIMIT 1",
+ $r = q("SELECT * FROM `user` WHERE `nickname` = '%s' AND `account_expired` = 0 AND `account_removed` = 0 LIMIT 1",
dbesc($nick)
);
if(! count($r))
$base = $dom->env;
elseif($dom->data)
$base = $dom;
-
+
if(! $base) {
logger('mod-salmon: unable to locate salmon data in xml ');
http_status_exit(400);
// Create a fake feed wrapper so simplepie doesn't choke
$tpl = get_markup_template('fake_feed.tpl');
-
+
$base = substr($data,strpos($data,'<entry'));
$feedxml = $tpl . $base . '</feed>';
logger('mod-salmon: Processed feed: ' . $feedxml);
// Now parse it like a normal atom feed to scrape out the author URI
-
+
$feed = new SimplePie();
$feed->set_raw_data($feedxml);
$feed->enable_order_by_date(false);
*
*/
- $r = q("SELECT * FROM `contact` WHERE `network` = 'stat' AND ( `url` = '%s' OR `alias` = '%s')
+ $r = q("SELECT * FROM `contact` WHERE `network` = '%s' AND ( `url` = '%s' OR `alias` = '%s' )
AND `uid` = %d LIMIT 1",
+ dbesc(NETWORK_OSTATUS),
dbesc($author_link),
dbesc($author_link),
intval($importer['uid'])
);
if(! count($r)) {
logger('mod-salmon: Author unknown to us.');
- }
+ if(get_pconfig($importer['uid'],'system','ostatus_autofriend')) {
+ require_once('include/follow.php');
+ $result = new_contact($importer['uid'],$author_link);
+ if($result['success']) {
+ $r = q("SELECT * FROM `contact` WHERE `network` = '%s' AND ( `url` = '%s' OR `alias` = '%s' )
+ AND `uid` = %d LIMIT 1",
+ dbesc(NETWORK_OSTATUS),
+ dbesc($author_link),
+ dbesc($author_link),
+ intval($importer['uid'])
+ );
+ }
+ }
+ }
// is this a follower? Or have we ignored the person?
// If so we can not accept this post.
http_status_exit(200);
}
-
-
-
-