]> git.mxchange.org Git - friendica.git/commitdiff
more ssl policy fixes and prevent delivery to soapbox when using local delivery
authorfriendica <info@friendica.com>
Tue, 3 Apr 2012 04:01:19 +0000 (21:01 -0700)
committerfriendica <info@friendica.com>
Tue, 3 Apr 2012 04:01:19 +0000 (21:01 -0700)
include/delivery.php
include/notifier.php
mod/dfrn_notify.php

index 532dcd6991a551c5e84130e0ae2322c76873d6ec..2407f11c02eb71bcf6dd8a178da32c590152eb31 100755 (executable)
@@ -321,6 +321,56 @@ function delivery_run($argv, $argc){
                                                $x[0]['writable'] = 1;
                                        }
 
+
+                                       $ssl_policy = get_config('system','ssl_policy');
+                                       // if contact's ssl policy changed, update our links
+
+                                       $ssl_changed = false;
+
+                                       if($ssl_policy == SSL_POLICY_SELFSIGN && strstr($x[0]['url'],'https:')) {
+                                               $ssl_changed = true;
+                                               $x[0]['url']     =      str_replace('https:','http:',$x[0]['url']);
+                                               $x[0]['request'] =      str_replace('https:','http:',$x[0]['request']);
+                                               $x[0]['notify']  =      str_replace('https:','http:',$x[0]['notify']);
+                                               $x[0]['poll']    =      str_replace('https:','http:',$x[0]['poll']);
+                                               $x[0]['confirm'] =      str_replace('https:','http:',$x[0]['confirm']);
+                                               $x[0]['poco']    =      str_replace('https:','http:',$x[0]['poco']);
+                                       }
+
+                                       if($ssl_policy == SSL_POLICY_FULL && strstr($x[0]['url'],'http:')) {
+                                               $ssl_changed = true;
+                                               $x[0]['url']     =      str_replace('http:','https:',$x[0]['url']);
+                                               $x[0]['request'] =      str_replace('http:','https:',$x[0]['request']);
+                                               $x[0]['notify']  =      str_replace('http:','https:',$x[0]['notify']);
+                                               $x[0]['poll']    =      str_replace('http:','https:',$x[0]['poll']);
+                                               $x[0]['confirm'] =      str_replace('http:','https:',$x[0]['confirm']);
+                                               $x[0]['poco']    =      str_replace('http:','https:',$x[0]['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($x[0]['url']),
+                                                       dbesc($x[0]['request']),
+                                                       dbesc($x[0]['notify']),
+                                                       dbesc($x[0]['poll']),
+                                                       dbesc($x[0]['confirm']),
+                                                       dbesc($x[0]['poco']),
+                                                       intval($x[0]['id'])
+                                               );
+                                       }
+                       
+                                       // 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);
index d63ad7ae7cceba578572595d34ecad8d3a640107..e91185c514c166f64ee888b1e7577d074e0760db 100755 (executable)
@@ -537,6 +537,56 @@ function notifier_run($argv, $argc){
                                                                $x[0]['writable'] = 1;
                                                        }
 
+                                                       $ssl_policy = get_config('system','ssl_policy');
+                                                       // if contact's ssl policy changed, update our links
+
+                                                       $ssl_changed = false;
+
+                                                       if($ssl_policy == SSL_POLICY_SELFSIGN && strstr($x[0]['url'],'https:')) {
+                                                               $ssl_changed = true;
+                                                               $x[0]['url']     =      str_replace('https:','http:',$x[0]['url']);
+                                                               $x[0]['request'] =      str_replace('https:','http:',$x[0]['request']);
+                                                               $x[0]['notify']  =      str_replace('https:','http:',$x[0]['notify']);
+                                                               $x[0]['poll']    =      str_replace('https:','http:',$x[0]['poll']);
+                                                               $x[0]['confirm'] =      str_replace('https:','http:',$x[0]['confirm']);
+                                                               $x[0]['poco']    =      str_replace('https:','http:',$x[0]['poco']);
+                                                       }
+
+                                                       if($ssl_policy == SSL_POLICY_FULL && strstr($x[0]['url'],'http:')) {
+                                                               $ssl_changed = true;
+                                                               $x[0]['url']     =      str_replace('http:','https:',$x[0]['url']);
+                                                               $x[0]['request'] =      str_replace('http:','https:',$x[0]['request']);
+                                                               $x[0]['notify']  =      str_replace('http:','https:',$x[0]['notify']);
+                                                               $x[0]['poll']    =      str_replace('http:','https:',$x[0]['poll']);
+                                                               $x[0]['confirm'] =      str_replace('http:','https:',$x[0]['confirm']);
+                                                               $x[0]['poco']    =      str_replace('http:','https:',$x[0]['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($x[0]['url']),
+                                                                       dbesc($x[0]['request']),
+                                                                       dbesc($x[0]['notify']),
+                                                                       dbesc($x[0]['poll']),
+                                                                       dbesc($x[0]['confirm']),
+                                                                       dbesc($x[0]['poco']),
+                                                                       intval($x[0]['id'])
+                                                               );
+                                                       }
+                       
+                                                       // 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);
index 4ce32465203dc9fe6b27a3bbef43251e4a5856d6..5d44e8144dad70c77599dccb76024748118df2e3 100755 (executable)
@@ -106,7 +106,6 @@ function dfrn_notify_post(&$a) {
        if($ssl_policy == 'self' && strstr($importer['url'],'https:')) {
                $ssl_changed = true;
                $importer['url']     =  str_replace('https:','http:',$importer['url']);
-               $importer['nurl']    = normalise_link($importer['url']);
                $importer['request'] =  str_replace('https:','http:',$importer['request']);
                $importer['notify']  =  str_replace('https:','http:',$importer['notify']);
                $importer['poll']    =  str_replace('https:','http:',$importer['poll']);
@@ -117,7 +116,6 @@ function dfrn_notify_post(&$a) {
        if($ssl_policy == 'full' && strstr($importer['url'],'http:')) {
                $ssl_changed = true;
                $importer['url']     =  str_replace('http:','https:',$importer['url']);
-               $importer['nurl']    = normalise_link($importer['url']);
                $importer['request'] =  str_replace('http:','https:',$importer['request']);
                $importer['notify']  =  str_replace('http:','https:',$importer['notify']);
                $importer['poll']    =  str_replace('http:','https:',$importer['poll']);
@@ -129,9 +127,6 @@ function dfrn_notify_post(&$a) {
                q("update contact set 
                        url = '%s', 
                        nurl = '%s',
-                       photo = '%s',
-                       thumb = '%s',
-                       micro = '%s',
                        request = '%s',
                        notify = '%s',
                        poll = '%s',