Merge commit 'upstream/master'
This commit is contained in:
@@ -80,6 +80,7 @@ function set_config($family,$key,$value) {
|
||||
|
||||
// manage array value
|
||||
$dbvalue = (is_array($value)?serialize($value):$value);
|
||||
$dbvalue = (is_bool($value) ? intval($value) : $value);
|
||||
|
||||
if(get_config($family,$key,true) === false) {
|
||||
$a->config[$family][$key] = $value;
|
||||
|
||||
@@ -321,6 +321,14 @@ function delivery_run($argv, $argc){
|
||||
$x[0]['writable'] = 1;
|
||||
}
|
||||
|
||||
$ssl_policy = get_config('system','ssl_policy');
|
||||
fix_contact_ssl_policy($x[0],$ssl_policy);
|
||||
|
||||
// If we are setup as a soapbox we aren't accepting input from this person
|
||||
|
||||
if($x[0]['page-flags'] == PAGE_SOAPBOX)
|
||||
break;
|
||||
|
||||
require_once('library/simplepie/simplepie.inc');
|
||||
logger('mod-delivery: local delivery');
|
||||
local_delivery($x[0],$atom);
|
||||
|
||||
@@ -9,6 +9,12 @@ require_once('include/queue_fn.php');
|
||||
|
||||
function diaspora_dispatch_public($msg) {
|
||||
|
||||
$enabled = intval(get_config('system','diaspora_enabled'));
|
||||
if(! $enabled) {
|
||||
logger('mod-diaspora: disabled');
|
||||
return;
|
||||
}
|
||||
|
||||
$r = q("SELECT `user`.* FROM `user` WHERE `user`.`uid` IN ( SELECT `contact`.`uid` FROM `contact` WHERE `contact`.`network` = '%s' AND `contact`.`addr` = '%s' ) AND `account_expired` = 0 ",
|
||||
dbesc(NETWORK_DIASPORA),
|
||||
dbesc($msg['author'])
|
||||
@@ -29,6 +35,12 @@ function diaspora_dispatch($importer,$msg) {
|
||||
|
||||
$ret = 0;
|
||||
|
||||
$enabled = intval(get_config('system','diaspora_enabled'));
|
||||
if(! $enabled) {
|
||||
logger('mod-diaspora: disabled');
|
||||
return;
|
||||
}
|
||||
|
||||
// php doesn't like dashes in variable names
|
||||
|
||||
$msg['message'] = str_replace(
|
||||
@@ -2271,6 +2283,11 @@ function diaspora_send_mail($item,$owner,$contact) {
|
||||
|
||||
function diaspora_transmit($owner,$contact,$slap,$public_batch) {
|
||||
|
||||
$enabled = intval(get_config('system','diaspora_enabled'));
|
||||
if(! $enabled) {
|
||||
return 200;
|
||||
}
|
||||
|
||||
$a = get_app();
|
||||
$logid = random_string(4);
|
||||
$dest_url = (($public_batch) ? $contact['batch'] : $contact['notify']);
|
||||
|
||||
@@ -824,3 +824,48 @@ function scale_external_images($s,$include_link = true) {
|
||||
}
|
||||
return $s;
|
||||
}
|
||||
|
||||
|
||||
function fix_contact_ssl_policy(&$contact,$new_policy) {
|
||||
|
||||
$ssl_changed = false;
|
||||
if((intval($new_policy) == SSL_POLICY_SELFSIGN || $new_policy === 'self') && strstr($contact['url'],'https:')) {
|
||||
$ssl_changed = true;
|
||||
$contact['url'] = str_replace('https:','http:',$contact['url']);
|
||||
$contact['request'] = str_replace('https:','http:',$contact['request']);
|
||||
$contact['notify'] = str_replace('https:','http:',$contact['notify']);
|
||||
$contact['poll'] = str_replace('https:','http:',$contact['poll']);
|
||||
$contact['confirm'] = str_replace('https:','http:',$contact['confirm']);
|
||||
$contact['poco'] = str_replace('https:','http:',$contact['poco']);
|
||||
}
|
||||
|
||||
if((intval($new_policy) == SSL_POLICY_FULL || $new_policy === 'full') && strstr($contact['url'],'http:')) {
|
||||
$ssl_changed = true;
|
||||
$contact['url'] = str_replace('http:','https:',$contact['url']);
|
||||
$contact['request'] = str_replace('http:','https:',$contact['request']);
|
||||
$contact['notify'] = str_replace('http:','https:',$contact['notify']);
|
||||
$contact['poll'] = str_replace('http:','https:',$contact['poll']);
|
||||
$contact['confirm'] = str_replace('http:','https:',$contact['confirm']);
|
||||
$contact['poco'] = str_replace('http:','https:',$contact['poco']);
|
||||
}
|
||||
|
||||
if($ssl_changed) {
|
||||
q("update contact set
|
||||
url = '%s',
|
||||
request = '%s',
|
||||
notify = '%s',
|
||||
poll = '%s',
|
||||
confirm = '%s',
|
||||
poco = '%s'
|
||||
where id = %d limit 1",
|
||||
dbesc($contact['url']),
|
||||
dbesc($contact['request']),
|
||||
dbesc($contact['notify']),
|
||||
dbesc($contact['poll']),
|
||||
dbesc($contact['confirm']),
|
||||
dbesc($contact['poco']),
|
||||
intval($contact['id'])
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -537,6 +537,17 @@ function notifier_run($argv, $argc){
|
||||
$x[0]['writable'] = 1;
|
||||
}
|
||||
|
||||
// if contact's ssl policy changed, which we just determined
|
||||
// is on our own server, update our contact links
|
||||
|
||||
$ssl_policy = get_config('system','ssl_policy');
|
||||
fix_contact_ssl_policy($x[0],$ssl_policy);
|
||||
|
||||
// If we are setup as a soapbox we aren't accepting input from this person
|
||||
|
||||
if($x[0]['page-flags'] == PAGE_SOAPBOX)
|
||||
break;
|
||||
|
||||
require_once('library/simplepie/simplepie.inc');
|
||||
logger('mod-delivery: local delivery');
|
||||
local_delivery($x[0],$atom);
|
||||
|
||||
Reference in New Issue
Block a user