]> git.mxchange.org Git - friendica.git/commitdiff
strict privacy mode (Friendika-Z) - refuse to talk to networks with privacy issues
authorFriendika <info@friendika.com>
Mon, 6 Jun 2011 23:26:11 +0000 (16:26 -0700)
committerFriendika <info@friendika.com>
Mon, 6 Jun 2011 23:26:11 +0000 (16:26 -0700)
boot.php
include/notifier.php
mod/dfrn_request.php
mod/follow.php
mod/salmon.php

index 1e51a4723923bae22144fe256e48c5ec2240ecd3..12689b4ab0c89d14e6a2cb9da508b2e66683a372 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -527,8 +527,20 @@ function check_config(&$a) {
        $plugins = get_config('system','addon');
        $plugins_arr = array();
 
-       if($plugins)
+       if($plugins) {
                $plugins_arr = explode(',',str_replace(' ', '',$plugins));
+               if(get_config('system','strict_privacy')) {
+                       unset($a->config['system']['huburl']);
+                       for($x = 0; $x < count($plugins_arr); $x ++) {
+                               if(    $plugins_arr[$x] === 'facebook' 
+                                       || $plugins_arr[$x] === 'twitter' 
+                                       || $plugins_arr[$x] === 'statusnet') {
+                                       unset($plugins_arr[$x]);
+                               }
+                       }
+               }
+       }
+
 
        $a->plugins = $plugins_arr;
 
index db2542849d1d1d721171609dd1b11e385b92480d..98e38fb115ea0ea24b4ef4af5471c4f8873022ae 100644 (file)
@@ -27,6 +27,8 @@ function notifier_run($argv, $argc){
 
        $a->set_baseurl(get_config('system','url'));
 
+       $prv = get_config('system','strict_privacy');
+
        logger('notifier: invoked: ' . print_r($argv,true));
 
        $cmd = $argv[1];
@@ -329,6 +331,10 @@ function notifier_run($argv, $argc){
                                        }
                                        break;
                                case 'stat':
+
+                                       if($prv)
+                                               break;
+
                                        if($followup && $contact['notify']) {
                                                logger('notifier: slapdelivery: ' . $contact['name']);
                                                $deliver_status = slapper($owner,$contact['notify'],$slap);
@@ -373,7 +379,7 @@ function notifier_run($argv, $argc){
                                        }
                                        break;
                                case 'mail':
-
+                                               
                                        // WARNING: does not currently convert to RFC2047 header encodings, etc.
 
                                        $addr = $contact['addr'];
@@ -459,7 +465,7 @@ function notifier_run($argv, $argc){
 
        if($slap && count($url_recipients) && $followup && $notify_hub && (! $expire)) {
                foreach($url_recipients as $url) {
-                       if($url) {
+                       if($url && (! $prv)) {
                                logger('notifier: urldelivery: ' . $url);
                                $deliver_status = slapper($owner,$url,$slap);
                                // TODO: redeliver/queue these items on failure, though there is no contact record
index 537a7a497a4970df3f2bc6255c285184fe7de9df..338dc9cf1d5e2c21222da5f97760ca59894d6a51 100644 (file)
@@ -626,19 +626,21 @@ function dfrn_request_content(&$a) {
                else
                        $tpl = get_markup_template('auto_request.tpl');
 
+               $prv = get_config('system','strict_privacy');
+
                $o .= replace_macros($tpl,array(
                        '$header' => t('Friend/Connection Request'),
-                       '$desc' => t('Examples: jojo@demo.friendika.com, http://demo.friendika.com/profile/jojo, testuser@identi.ca'),
+                       '$desc' => t('Examples: jojo@demo.friendika.com, http://demo.friendika.com/profile/jojo') . (($prv) ? ', testuser@identi.ca' : ''),
                        '$pls_answer' => t('Please answer the following:'),
-                       '$does_know' => t('Does $name know you?'),
+                       '$does_know' => sprintf( t('Does %s know you?'),$a->profile['name']),
                        '$yes' => t('Yes'),
                        '$no' => t('No'),
                        '$add_note' => t('Add a personal note:'),
                        '$page_desc' => t("Please enter your 'Identity Address' from one of the following supported social networks:"),
                        '$friendika' => t('Friendika'),
-                       '$statusnet' => t('StatusNet/Federated Social Web'),
+                       '$statusnet' => (($prv) ? t('StatusNet/Federated Social Web') : ''),
                        '$private_net' => t("Private \x28secure\x29 network"),
-                       '$public_net' => t("Public \x28insecure\x29 network"),
+                       '$public_net' => (($prv) ? t("Public \x28insecure\x29 network") : ''),
                        '$your_address' => t('Your Identity Address:'),
                        '$submit' => t('Submit Request'),
                        '$cancel' => t('Cancel'),
index 9a9f9da7d83d07b461be99ed9d9b4bcca3f553ad..31cfcfb64c1f20d4faec0b34dfcee986dc14db7e 100644 (file)
@@ -22,10 +22,8 @@ function follow_post(&$a) {
                // NOTREACHED
        }
 
-
        $ret = probe_url($url);
 
-
        if($ret['network'] === NETWORK_DFRN) {
                if(strlen($a->path))
                        $myaddr = bin2hex($a->get_baseurl() . '/profile/' . $a->user['nickname']);
@@ -36,6 +34,9 @@ function follow_post(&$a) {
                
                // NOTREACHED
        }
+       elseif(get_config('system','strict_privacy')) {
+               unset($ret['notify']);
+       }
 
        // do we have enough information?
        
index c2f76aa0a641889f583aa0b93e38b5c22f22b739..bf33033d810c84615b72aeae40ba14238c9bbd13 100644 (file)
@@ -192,6 +192,11 @@ function salmon_post(&$a) {
                // NOTREACHED
        }
 
+       // Check if we're allowed to talk to insecure networks
+
+       if(get_config('system','strict_privacy'))
+               salmon_return(400);
+
        require_once('include/items.php');
 
        // Placeholder for hub discovery. We shouldn't find any hubs