ensuring all non-deliveries get in the queue
This commit is contained in:
parent
ca706ccbed
commit
0a03a710b3
3 changed files with 39 additions and 22 deletions
4
boot.php
4
boot.php
|
@ -416,6 +416,8 @@ function fetch_url($url,$binary = false, &$redirects = 0) {
|
||||||
if($binary)
|
if($binary)
|
||||||
curl_setopt($ch, CURLOPT_BINARYTRANSFER,1);
|
curl_setopt($ch, CURLOPT_BINARYTRANSFER,1);
|
||||||
|
|
||||||
|
$a->set_curl_code(0);
|
||||||
|
|
||||||
$s = curl_exec($ch);
|
$s = curl_exec($ch);
|
||||||
|
|
||||||
$http_code = intval(curl_getinfo($ch, CURLINFO_HTTP_CODE));
|
$http_code = intval(curl_getinfo($ch, CURLINFO_HTTP_CODE));
|
||||||
|
@ -474,6 +476,8 @@ function post_url($url,$params, $headers = null, &$redirects = 0) {
|
||||||
curl_setopt($ch, CURLOPT_PROXYUSERPWD, $prxusr);
|
curl_setopt($ch, CURLOPT_PROXYUSERPWD, $prxusr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$a->set_curl_code(0);
|
||||||
|
|
||||||
$s = curl_exec($ch);
|
$s = curl_exec($ch);
|
||||||
|
|
||||||
$http_code = intval(curl_getinfo($ch, CURLINFO_HTTP_CODE));
|
$http_code = intval(curl_getinfo($ch, CURLINFO_HTTP_CODE));
|
||||||
|
|
|
@ -536,7 +536,6 @@ function item_store($arr) {
|
||||||
$arr['title'] = ((x($arr,'title')) ? notags(trim($arr['title'])) : '');
|
$arr['title'] = ((x($arr,'title')) ? notags(trim($arr['title'])) : '');
|
||||||
$arr['location'] = ((x($arr,'location')) ? notags(trim($arr['location'])) : '');
|
$arr['location'] = ((x($arr,'location')) ? notags(trim($arr['location'])) : '');
|
||||||
$arr['coord'] = ((x($arr,'coord')) ? notags(trim($arr['coord'])) : '');
|
$arr['coord'] = ((x($arr,'coord')) ? notags(trim($arr['coord'])) : '');
|
||||||
$arr['body'] = ((x($arr,'body')) ? escape_tags(trim($arr['body'])) : '');
|
|
||||||
$arr['last-child'] = ((x($arr,'last-child')) ? intval($arr['last-child']) : 0 );
|
$arr['last-child'] = ((x($arr,'last-child')) ? intval($arr['last-child']) : 0 );
|
||||||
$arr['visible'] = ((x($arr,'visible') !== false) ? intval($arr['visible']) : 1 );
|
$arr['visible'] = ((x($arr,'visible') !== false) ? intval($arr['visible']) : 1 );
|
||||||
$arr['deleted'] = 0;
|
$arr['deleted'] = 0;
|
||||||
|
@ -550,6 +549,13 @@ function item_store($arr) {
|
||||||
$arr['allow_gid'] = ((x($arr,'allow_gid')) ? trim($arr['allow_gid']) : '');
|
$arr['allow_gid'] = ((x($arr,'allow_gid')) ? trim($arr['allow_gid']) : '');
|
||||||
$arr['deny_cid'] = ((x($arr,'deny_cid')) ? trim($arr['deny_cid']) : '');
|
$arr['deny_cid'] = ((x($arr,'deny_cid')) ? trim($arr['deny_cid']) : '');
|
||||||
$arr['deny_gid'] = ((x($arr,'deny_gid')) ? trim($arr['deny_gid']) : '');
|
$arr['deny_gid'] = ((x($arr,'deny_gid')) ? trim($arr['deny_gid']) : '');
|
||||||
|
$arr['body'] = ((x($arr,'body')) ? escape_tags(trim($arr['body'])) : '');
|
||||||
|
|
||||||
|
// The content body has been through a lot of filtering and transport escaping by now.
|
||||||
|
// We don't want to skip any filters, however a side effect of all this filtering
|
||||||
|
// is that ampersands will have been double encoded.
|
||||||
|
|
||||||
|
$arr['body'] = str_replace('&','&',$arr['body']);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -640,6 +646,7 @@ function get_item_contact($item,$contacts) {
|
||||||
|
|
||||||
function dfrn_deliver($owner,$contact,$atom) {
|
function dfrn_deliver($owner,$contact,$atom) {
|
||||||
|
|
||||||
|
$a = get_app();
|
||||||
|
|
||||||
if((! strlen($contact['dfrn-id'])) && (! $contact['duplex']) && (! ($owner['page-flags'] == PAGE_COMMUNITY)))
|
if((! strlen($contact['dfrn-id'])) && (! $contact['duplex']) && (! ($owner['page-flags'] == PAGE_COMMUNITY)))
|
||||||
return 3;
|
return 3;
|
||||||
|
@ -657,6 +664,10 @@ function dfrn_deliver($owner,$contact,$atom) {
|
||||||
|
|
||||||
$xml = fetch_url($url);
|
$xml = fetch_url($url);
|
||||||
|
|
||||||
|
$curl_stat = $a->get_curl_code();
|
||||||
|
if(! $curl_stat)
|
||||||
|
return(-1); // timed out
|
||||||
|
|
||||||
logger('dfrn_deliver: ' . $xml);
|
logger('dfrn_deliver: ' . $xml);
|
||||||
|
|
||||||
if(! $xml)
|
if(! $xml)
|
||||||
|
@ -711,8 +722,9 @@ function dfrn_deliver($owner,$contact,$atom) {
|
||||||
|
|
||||||
logger('dfrn_deliver: ' . "SENDING: " . print_r($postvars,true) . "\n" . "RECEIVING: " . $xml, LOGGER_DATA);
|
logger('dfrn_deliver: ' . "SENDING: " . print_r($postvars,true) . "\n" . "RECEIVING: " . $xml, LOGGER_DATA);
|
||||||
|
|
||||||
if(! strlen($xml))
|
$curl_stat = $a->get_curl_code();
|
||||||
return(-1);
|
if((! $curl_stat) || (! strlen($xml)))
|
||||||
|
return(-1); // timed out
|
||||||
|
|
||||||
$res = simplexml_load_string($xml);
|
$res = simplexml_load_string($xml);
|
||||||
|
|
||||||
|
|
|
@ -150,6 +150,8 @@ function dfrn_notify_post(&$a) {
|
||||||
// NOTREACHED
|
// NOTREACHED
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logger('dfrn_notify: feed item count = ' . $feed->get_item_quantity());
|
||||||
|
|
||||||
foreach($feed->get_items() as $item) {
|
foreach($feed->get_items() as $item) {
|
||||||
|
|
||||||
$deleted = false;
|
$deleted = false;
|
||||||
|
@ -223,6 +225,7 @@ function dfrn_notify_post(&$a) {
|
||||||
|
|
||||||
if($is_reply) {
|
if($is_reply) {
|
||||||
if($feed->get_item_quantity() == 1) {
|
if($feed->get_item_quantity() == 1) {
|
||||||
|
logger('dfrn_notify: received remote comment');
|
||||||
// remote reply to our post. Import and then notify everybody else.
|
// remote reply to our post. Import and then notify everybody else.
|
||||||
$datarray = get_atom_elements($feed,$item);
|
$datarray = get_atom_elements($feed,$item);
|
||||||
$datarray['type'] = 'remote-comment';
|
$datarray['type'] = 'remote-comment';
|
||||||
|
@ -254,29 +257,27 @@ function dfrn_notify_post(&$a) {
|
||||||
intval($posted_id)
|
intval($posted_id)
|
||||||
);
|
);
|
||||||
|
|
||||||
if($datarray['type'] == 'remote-comment') {
|
$php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php');
|
||||||
$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\" &",
|
proc_close(proc_open("\"$php_path\" \"include/notifier.php\" \"comment-import\" \"$posted_id\" &",
|
||||||
array(),$foo));
|
array(),$foo));
|
||||||
|
|
||||||
if(($importer['notify-flags'] & NOTIFY_COMMENT) && (! $importer['self'])) {
|
if(($importer['notify-flags'] & NOTIFY_COMMENT) && (! $importer['self'])) {
|
||||||
require_once('bbcode.php');
|
require_once('bbcode.php');
|
||||||
$from = stripslashes($datarray['author-name']);
|
$from = stripslashes($datarray['author-name']);
|
||||||
$tpl = load_view_file('view/cmnt_received_eml.tpl');
|
$tpl = load_view_file('view/cmnt_received_eml.tpl');
|
||||||
$email_tpl = replace_macros($tpl, array(
|
$email_tpl = replace_macros($tpl, array(
|
||||||
'$sitename' => $a->config['sitename'],
|
'$sitename' => $a->config['sitename'],
|
||||||
'$siteurl' => $a->get_baseurl(),
|
'$siteurl' => $a->get_baseurl(),
|
||||||
'$username' => $importer['username'],
|
'$username' => $importer['username'],
|
||||||
'$email' => $importer['email'],
|
'$email' => $importer['email'],
|
||||||
'$display' => $a->get_baseurl() . '/display/' . $posted_id,
|
'$display' => $a->get_baseurl() . '/display/' . $posted_id,
|
||||||
'$from' => $from,
|
'$from' => $from,
|
||||||
'$body' => strip_tags(bbcode(stripslashes($datarray['body'])))
|
'$body' => strip_tags(bbcode(stripslashes($datarray['body'])))
|
||||||
));
|
));
|
||||||
|
|
||||||
$res = mail($importer['email'], $from . t(" commented on your item at ") . $a->config['sitename'],
|
$res = mail($importer['email'], $from . t(" commented on your item at ") . $a->config['sitename'],
|
||||||
$email_tpl,t("From: Administrator@") . $a->get_hostname() );
|
$email_tpl,t("From: Administrator@") . $a->get_hostname() );
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
xml_status(0);
|
xml_status(0);
|
||||||
|
|
Loading…
Reference in a new issue