diff options
-rwxr-xr-x | include/diaspora.php | 14 | ||||
-rw-r--r-- | include/zot.php | 1 | ||||
-rw-r--r-- | mod/follow.php | 13 | ||||
-rwxr-xr-x | mod/pconfig.php | 113 | ||||
-rwxr-xr-x | util/pconfig | 2 | ||||
-rw-r--r-- | version.inc | 2 |
6 files changed, 143 insertions, 2 deletions
diff --git a/include/diaspora.php b/include/diaspora.php index 4766a75f6..d59da6fff 100755 --- a/include/diaspora.php +++ b/include/diaspora.php @@ -813,11 +813,25 @@ function diaspora_request($importer,$xml) { 'link' => z_root() . '/connedit/' . $new_connection[0]['abook_id'], )); + if($default_perms) { // Send back a sharing notification to them diaspora_share($importer,$new_connection[0]); } + + $clone = array(); + foreach($new_connection[0] as $k => $v) { + if(strpos($k,'abook_') === 0) { + $clone[$k] = $v; + } + } + unset($clone['abook_id']); + unset($clone['abook_account']); + unset($clone['abook_channel']); + + build_sync_packet($importer['channel_id'], array('abook' => array($clone))); + } } diff --git a/include/zot.php b/include/zot.php index 9497e4668..31a12b763 100644 --- a/include/zot.php +++ b/include/zot.php @@ -2907,7 +2907,6 @@ function process_channel_sync_delivery($sender, $arr, $deliveries) { $abook['abook_feed'] = 1; } - $clean = array(); if($abook['abook_xchan'] && $abook['entry_deleted']) { logger('process_channel_sync_delivery: removing abook entry for ' . $abook['abook_xchan']); diff --git a/mod/follow.php b/mod/follow.php index 79e2a4fa5..3ad2cb3bb 100644 --- a/mod/follow.php +++ b/mod/follow.php @@ -24,6 +24,19 @@ function follow_init(&$a) { info( t('Channel added.') . EOL); + $clone = array(); + foreach($result['abook'] as $k => $v) { + if(strpos($k,'abook_') === 0) { + $clone[$k] = $v; + } + } + unset($clone['abook_id']); + unset($clone['abook_account']); + unset($clone['abook_channel']); + + build_sync_packet(0 /* use the current local_channel */, array('abook' => array($clone))); + + // If we can view their stream, pull in some posts if(($result['abook']['abook_their_perms'] & PERMS_R_STREAM) || ($result['abook']['xchan_network'] === 'rss')) diff --git a/mod/pconfig.php b/mod/pconfig.php new file mode 100755 index 000000000..413dd2911 --- /dev/null +++ b/mod/pconfig.php @@ -0,0 +1,113 @@ +<?php + + +function disallowed_pconfig() { + return array( + 'permissions_role' + ); +} + + +function pconfig_post(&$a) { + + if(! local_channel()) + return; + + + if($_SESSION['delegate']) + return; + + check_form_security_token_redirectOnErr('/pconfig', 'pconfig'); + + $cat = trim(escape_tags($_POST['cat'])); + $k = trim(escape_tags($_POST['k'])); + $v = trim($_POST['v']); + + if(in_array(argv(2),disallowed_pconfig())) { + notice( t('This setting requires special processing and editing has been blocked.') . EOL); + return; + } + + if(strpos($k,'password') !== false) { + $v = z_obscure($v); + } + + set_pconfig(local_channel(),$cat,$k,$v); + build_sync_packet(); + + goaway(z_root() . '/pconfig/' . $cat . '/' . $k); + +} + + +function pconfig_content(&$a) { + + if(! local_channel()) { + return login(); + } + + $content = '<h3>' . t('Configuration Editor') . '</h3>'; + $content .= '<div class="descriptive-paragraph">' . t('Warning: Changing some settings could render your channel inoperable. Please leave this page unless you are comfortable with and knowledgeable about how to correctly use this feature.') . '</div>' . EOL . EOL; + + + + if(argc() == 3) { + $content .= '<a href="pconfig">pconfig[' . local_channel() . ']</a>' . EOL; + $content .= '<a href="pconfig/' . escape_tags(argv(1)) . '">pconfig[' . local_channel() . '][' . escape_tags(argv(1)) . ']</a>' . EOL . EOL; + $content .= '<a href="pconfig/' . escape_tags(argv(1)) . '/' . escape_tags(argv(2)) . '" >pconfig[' . local_channel() . '][' . escape_tags(argv(1)) . '][' . escape_tags(argv(2)) . ']</a> = ' . get_pconfig(local_channel(),escape_tags(argv(1)),escape_tags(argv(2))) . EOL; + + if(in_array(argv(2),disallowed_pconfig())) { + notice( t('This setting requires special processing and editing has been blocked.') . EOL); + return $content; + } + else + $content .= pconfig_form(escape_tags(argv(1)),escape_tags(argv(2))); + } + + + if(argc() == 2) { + $content .= '<a href="pconfig">pconfig[' . local_channel() . ']</a>' . EOL; + load_pconfig(local_channel(),escape_tags(argv(1))); + foreach($a->config[local_channel()][escape_tags(argv(1))] as $k => $x) { + $content .= '<a href="pconfig/' . escape_tags(argv(1)) . '/' . $k . '" >pconfig[' . local_channel() . '][' . escape_tags(argv(1)) . '][' . $k . ']</a> = ' . escape_tags($x) . EOL; + } + } + + if(argc() == 1) { + + $r = q("select * from pconfig where uid = " . local_channel()); + if($r) { + foreach($r as $rr) { + $content .= '<a href="' . 'pconfig/' . escape_tags($rr['cat']) . '/' . escape_tags($rr['k']) . '" >pconfig[' . local_channel() . '][' . escape_tags($rr['cat']) . '][' . escape_tags($rr['k']) . ']</a> = ' . escape_tags($rr['v']) . EOL; + } + } + } + return $content; + +} + + +function pconfig_form($cat,$k) { + + $o = '<form action="pconfig" method="post" >'; + $o .= '<input type="hidden" name="form_security_token" value="' . get_form_security_token('pconfig') . '" />'; + + $v = get_pconfig(local_channel(),$cat,$k); + if(strpos($k,'password') !== false) + $v = z_unobscure($v); + + $o .= '<input type="hidden" name="cat" value="' . $cat . '" />'; + $o .= '<input type="hidden" name="k" value="' . $k . '" />'; + + if(strpos($v,"\n")) + $o .= '<textarea name="v" >' . escape_tags($v) . '</textarea>'; + else + $o .= '<input type="text" name="v" value="' . escape_tags($v) . '" />'; + + $o .= EOL . EOL; + $o .= '<input type="submit" name="submit" value="' . t('Submit') . '" />'; + $o .= '</form>'; + + return $o; + +} diff --git a/util/pconfig b/util/pconfig index baa786a03..cefa6901c 100755 --- a/util/pconfig +++ b/util/pconfig @@ -4,11 +4,13 @@ // Red pconfig utility require_once('include/cli_startup.php'); +require_once('include/zot.php'); cli_startup(); if($argc > 4) { set_pconfig($argv[1],$argv[2],$argv[3],$argv[4]); + build_sync_packet($argv[1]); echo "pconfig[{$argv[1]}][{$argv[2]}][{$argv[3]}] = " . get_pconfig($argv[1],$argv[2],$argv[3]) . "\n"; } diff --git a/version.inc b/version.inc index e512ec77c..92d861e4c 100644 --- a/version.inc +++ b/version.inc @@ -1 +1 @@ -2015-07-01.1080 +2015-07-02.1081 |