require_once('include/socgraph.php');
require_once('include/plaintext.php');
require_once('include/ostatus.php');
+require_once('include/feed.php');
require_once('mod/share.php');
require_once('library/defuse/php-encryption-1.2.1/Crypto.php');
item_add_language_opt($arr);
+ if ($notify)
+ $guid_prefix = "";
+ else
+ $guid_prefix = $arr['network'];
+
$arr['wall'] = ((x($arr,'wall')) ? intval($arr['wall']) : 0);
- $arr['guid'] = ((x($arr,'guid')) ? notags(trim($arr['guid'])) : get_guid(32, $arr['network']));
+ $arr['guid'] = ((x($arr,'guid')) ? notags(trim($arr['guid'])) : get_guid(32, $guid_prefix));
$arr['uri'] = ((x($arr,'uri')) ? notags(trim($arr['uri'])) : $arr['guid']);
$arr['extid'] = ((x($arr,'extid')) ? notags(trim($arr['extid'])) : '');
$arr['author-name'] = ((x($arr,'author-name')) ? notags(trim($arr['author-name'])) : '');
// Fill the cache field
put_item_in_cache($arr);
- call_hooks('post_remote',$arr);
+ if ($notify)
+ call_hooks('post_local',$arr);
+ else
+ call_hooks('post_remote',$arr);
if(x($arr,'cancel')) {
logger('item_store: post cancelled by plugin.');
$r = q('SELECT * FROM `item` WHERE id = %d', intval($current_post));
if (count($r) == 1) {
- call_hooks('post_remote_end', $r[0]);
+ if ($notify)
+ call_hooks('post_local_end', $r[0]);
+ else
+ call_hooks('post_remote_end', $r[0]);
} else
logger('item_store: new item not found in DB, id ' . $current_post);
}
$rino = get_config('system','rino_encrypt');
$rino = intval($rino);
+ // use RINO1 if mcrypt isn't installed and RINO2 was selected
+ if ($rino==2 and !function_exists('mcrypt_create_iv')) $rino=1;
logger("Local rino version: ". $rino, LOGGER_DEBUG);
function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0) {
if ($contact['network'] === NETWORK_OSTATUS) {
if ($pass < 2) {
- // Test - remove before flight
- //$tempfile = tempnam(get_temppath(), "ostatus");
- //file_put_contents($tempfile, $xml);
-
logger("Consume OStatus messages ", LOGGER_DEBUG);
ostatus_import($xml,$importer,$contact, $hub);
}
return;
}
+ if ($contact['network'] === NETWORK_FEED) {
+ if ($pass < 2) {
+ logger("Consume feeds", LOGGER_DEBUG);
+ feed_import($xml,$importer,$contact, $hub);
+ }
+ return;
+ }
+
require_once('library/simplepie/simplepie.inc');
require_once('include/contact_selectors.php');