From f6fae2ebd9b514e4c50057b487777e853a64d04d Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 2 Jul 2015 19:54:22 -0700 Subject: web version of util/pconfig --- mod/pconfig.php | 105 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ version.inc | 2 +- 2 files changed, 106 insertions(+), 1 deletion(-) create mode 100755 mod/pconfig.php diff --git a/mod/pconfig.php b/mod/pconfig.php new file mode 100755 index 000000000..d6719792b --- /dev/null +++ b/mod/pconfig.php @@ -0,0 +1,105 @@ +pconfig[' . local_channel() . ']' . EOL; + $content .= 'pconfig[' . local_channel() . '][' . escape_tags(argv(1)) . ']' . EOL . EOL; + $content .= 'pconfig[' . local_channel() . '][' . escape_tags(argv(1)) . '][' . escape_tags(argv(2)) . '] = ' . get_pconfig(local_channel(),escape_tags(argv(1)),escape_tags(argv(2))) . EOL; + $content .= pconfig_form(escape_tags(argv(1)),escape_tags(argv(2))); + } + + + if(argc() == 2) { + $content = 'pconfig[' . local_channel() . ']' . EOL; + load_pconfig(local_channel(),escape_tags(argv(1))); + foreach($a->config[local_channel()][escape_tags(argv(1))] as $k => $x) { + $content .= 'pconfig[' . local_channel() . '][' . escape_tags(argv(1)) . '][' . $k . '] = ' . escape_tags($x) . EOL; + } + } + + if(argc() == 1) { + + $content = ''; + + $r = q("select * from pconfig where uid = " . local_channel()); + if($r) { + foreach($r as $rr) { + $content .= 'pconfig[' . local_channel() . '][' . escape_tags($rr['cat']) . '][' . escape_tags($rr['k']) . '] = ' . escape_tags($rr['v']) . EOL; + } + } + } + return $content; + +} + + +function pconfig_form($cat,$k) { + + $o = '
'; + $o .= ''; + + $v = get_pconfig(local_channel(),$cat,$k); + if(strpos($k,'password') !== false) + $v = z_unobscure($v); + + $o .= ''; + $o .= ''; + + if(strpos($v,"\n")) + $o .= ''; + else + $o .= ''; + + $o .= EOL . EOL; + $o .= ''; + $o .= '
'; + + return $o; + +} 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 -- cgit v1.2.3 From 9369e521bbe45c5be3e5342d14b0670c85f78a31 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 2 Jul 2015 20:57:06 -0700 Subject: a bit of cleanup and explanatory text on mod/pconfig --- mod/pconfig.php | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/mod/pconfig.php b/mod/pconfig.php index d6719792b..e0ceb5d22 100755 --- a/mod/pconfig.php +++ b/mod/pconfig.php @@ -24,7 +24,7 @@ function pconfig_post(&$a) { $v = trim($_POST['v']); if(in_array(argv(2),disallowed_pconfig())) { - notice( t('This setting requires special processing and has been blocked.') . EOL); + notice( t('This setting requires special processing and editing has been blocked.') . EOL); return; } @@ -45,18 +45,27 @@ function pconfig_content(&$a) { return login(); } + $content = '

' . t('Configuration Editor') . '

'; + $content .= '
' . 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.') . '
' . EOL . EOL; + if(argc() == 3) { - $content = 'pconfig[' . local_channel() . ']' . EOL; + $content .= 'pconfig[' . local_channel() . ']' . EOL; $content .= 'pconfig[' . local_channel() . '][' . escape_tags(argv(1)) . ']' . EOL . EOL; $content .= 'pconfig[' . local_channel() . '][' . escape_tags(argv(1)) . '][' . escape_tags(argv(2)) . '] = ' . get_pconfig(local_channel(),escape_tags(argv(1)),escape_tags(argv(2))) . EOL; - $content .= pconfig_form(escape_tags(argv(1)),escape_tags(argv(2))); + + 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 = 'pconfig[' . local_channel() . ']' . EOL; + $content .= 'pconfig[' . local_channel() . ']' . EOL; load_pconfig(local_channel(),escape_tags(argv(1))); foreach($a->config[local_channel()][escape_tags(argv(1))] as $k => $x) { $content .= 'pconfig[' . local_channel() . '][' . escape_tags(argv(1)) . '][' . $k . '] = ' . escape_tags($x) . EOL; @@ -65,8 +74,6 @@ function pconfig_content(&$a) { if(argc() == 1) { - $content = ''; - $r = q("select * from pconfig where uid = " . local_channel()); if($r) { foreach($r as $rr) { -- cgit v1.2.3 From 065a50c920ebfe2274ab134bca7849051f3582e7 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 2 Jul 2015 21:55:36 -0700 Subject: a few clone sync fixes as well as some work on hubzilla clone sync back to redmatrix --- include/diaspora.php | 14 ++++++++++++++ include/zot.php | 22 ++++++++++++++++++++++ mod/follow.php | 13 +++++++++++++ mod/pconfig.php | 1 + util/pconfig | 2 ++ 5 files changed, 52 insertions(+) diff --git a/include/diaspora.php b/include/diaspora.php index 77a400604..cf8d89023 100755 --- a/include/diaspora.php +++ b/include/diaspora.php @@ -818,11 +818,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 66156b4e0..34e7f3e42 100644 --- a/include/zot.php +++ b/include/zot.php @@ -2922,6 +2922,28 @@ function process_channel_sync_delivery($sender, $arr, $deliveries) { foreach($arr['abook'] as $abook) { + if(array_key_exists('abook_blocked',$abook)) { + // convert from hubzilla + $abook['abook_flags'] = 0; + if(intval($abook['abook_blocked'])) + $abook['abook_flags'] |= ABOOK_FLAG_BLOCKED; + if(intval($abook['abook_ignored'])) + $abook['abook_flags'] |= ABOOK_FLAG_IGNORED; + if(intval($abook['abook_hidden'])) + $abook['abook_flags'] |= ABOOK_FLAG_HIDDEN; + if(intval($abook['abook_archived'])) + $abook['abook_flags'] |= ABOOK_FLAG_ARCHIVED; + if(intval($abook['abook_pending'])) + $abook['abook_flags'] |= ABOOK_FLAG_PENDING; + if(intval($abook['abook_unconnected'])) + $abook['abook_flags'] |= ABOOK_FLAG_UNCONNECTED; + if(intval($abook['abook_self'])) + $abook['abook_flags'] |= ABOOK_FLAG_SELF; + if(intval($abook['abook_feed'])) + $abook['abook_flags'] |= ABOOK_FLAG_FEED; + + } + $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 index e0ceb5d22..413dd2911 100755 --- a/mod/pconfig.php +++ b/mod/pconfig.php @@ -33,6 +33,7 @@ function pconfig_post(&$a) { } set_pconfig(local_channel(),$cat,$k,$v); + build_sync_packet(); goaway(z_root() . '/pconfig/' . $cat . '/' . $k); 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"; } -- cgit v1.2.3