From 3424c7dc878ecf5b1f1c021737e3d7eba2443299 Mon Sep 17 00:00:00 2001 From: Andrew Manning Date: Sun, 29 Jan 2017 19:53:29 -0500 Subject: Add affinity slider tool settings for min and max defaults in settings/featured --- Zotlabs/Module/Settings/Featured.php | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'Zotlabs/Module/Settings') diff --git a/Zotlabs/Module/Settings/Featured.php b/Zotlabs/Module/Settings/Featured.php index eec5f6c02..4885abd1d 100644 --- a/Zotlabs/Module/Settings/Featured.php +++ b/Zotlabs/Module/Settings/Featured.php @@ -10,6 +10,16 @@ class Featured { call_hooks('feature_settings_post', $_POST); + if(intval($_POST['affinity_cmax'])) { + set_pconfig(local_channel(),'affinity','cmax',intval($_POST['affinity_cmax'])); + } + if(intval($_POST['affinity_cmin'])) { + set_pconfig(local_channel(),'affinity','cmin',intval($_POST['affinity_cmin'])); + } + if(intval($_POST['affinity_cmax']) || intval($_POST['affinity_cmin'])) { + info( t('Affinity Slider settings updated.') . EOL); + } + build_sync_packet(); return; } @@ -23,6 +33,25 @@ class Featured { if(! $r) $settings_addons = t('No feature settings configured'); + if(feature_enabled(local_channel(),'affinity')) { + + $cmax = intval(get_pconfig(local_channel(),'affinity','cmax')); + $cmax = (($cmax) ? $cmax : 99); + $setting_fields .= replace_macros(get_markup_template('field_input.tpl'), array( + '$field' => array('affinity_cmax', t('Default maximum affinity level'), $cmax, '') + )); + $cmin = intval(get_pconfig(local_channel(),'affinity','cmin')); + $cmin = (($cmin) ? $cmin : 0); + $setting_fields .= replace_macros(get_markup_template('field_input.tpl'), array( + '$field' => array('affinity_cmin', t('Default minimum affinity level'), $cmin, '') + )); + + $settings_addons .= replace_macros(get_markup_template('generic_addon_settings.tpl'), array( + '$addon' => array('affinity_slider', '' . t('Affinity Slider Settings'), '', t('Submit')), + '$content' => $setting_fields + )); + } + call_hooks('feature_settings', $settings_addons); $tpl = get_markup_template("settings_addons.tpl"); -- cgit v1.2.3 From c62df39ce3a7797c5e49cdc6e498b42a27abbd97 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Thu, 2 Feb 2017 17:19:52 -0800 Subject: move firefox social api configuration to plugin --- Zotlabs/Module/Settings/Channel.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'Zotlabs/Module/Settings') diff --git a/Zotlabs/Module/Settings/Channel.php b/Zotlabs/Module/Settings/Channel.php index a73aa2e60..a89d83544 100644 --- a/Zotlabs/Module/Settings/Channel.php +++ b/Zotlabs/Module/Settings/Channel.php @@ -448,7 +448,10 @@ class Channel { $always_show_in_notices = get_pconfig(local_channel(),'system','always_show_in_notices'); if($vnotify === false) $vnotify = (-1); - + + $plugin = [ 'basic' => '', 'security' => '', 'notify' => '', 'misc' => '' ]; + call_hooks('channel_settings',$plugin); + $o .= replace_macros($stpl,array( '$ptitle' => t('Channel Settings'), @@ -537,6 +540,10 @@ class Channel { '$always_show_in_notices' => array('always_show_in_notices', t('Also show new wall posts, private messages and connections under Notices'), $always_show_in_notices, 1, '', $yes_no), '$evdays' => array('evdays', t('Notify me of events this many days in advance'), $evdays, t('Must be greater than 0')), + '$basic_addon' => $plugin['basic'], + '$sec_addon' => $plugin['security'], + '$notify_addon' => $plugin['notify'], + '$misc_addon' => $plugin['misc'], '$h_advn' => t('Advanced Account/Page Type Settings'), '$h_descadvn' => t('Change the behaviour of this account for special situations'), -- cgit v1.2.3 From 1bb56309a62697f6549f159a6ed0d35fbf8f668b Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Tue, 7 Feb 2017 20:45:13 +0100 Subject: default to manual conversation updates --- Zotlabs/Module/Settings/Display.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Module/Settings') diff --git a/Zotlabs/Module/Settings/Display.php b/Zotlabs/Module/Settings/Display.php index 25d1d21a0..67cecf1f5 100644 --- a/Zotlabs/Module/Settings/Display.php +++ b/Zotlabs/Module/Settings/Display.php @@ -206,7 +206,7 @@ class Display { '$ajaxint' => array('browser_update', t("Update browser every xx seconds"), $browser_update, t('Minimum of 10 seconds, no maximum')), '$itemspage' => array('itemspage', t("Maximum number of conversations to load at any time:"), $itemspage, t('Maximum of 100 items')), '$nosmile' => array('nosmile', t("Show emoticons (smilies) as images"), 1-intval($nosmile), '', $yes_no), - '$manual_update' => array('manual_update', t('Manual conversation updates'), channel_manual_conv_update(local_channel()), t('Default is automatic, which may increase screen jumping'), $yes_no), + '$manual_update' => array('manual_update', t('Manual conversation updates'), channel_manual_conv_update(local_channel()), t('Default is on, turning this off may increase screen jumping'), $yes_no), '$title_tosource' => array('title_tosource', t("Link post titles to source"), $title_tosource, '', $yes_no), '$layout_editor' => t('System Page Layout Editor - (advanced)'), '$theme_config' => $theme_config, -- cgit v1.2.3 From 46d0e23e7bcb3bb1d000bae8dea7e52d4a1d018f Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 7 Feb 2017 19:49:15 -0800 Subject: atokens - we only need one permission column --- Zotlabs/Module/Settings/Tokens.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Zotlabs/Module/Settings') diff --git a/Zotlabs/Module/Settings/Tokens.php b/Zotlabs/Module/Settings/Tokens.php index d32a00c95..bf22ec7aa 100644 --- a/Zotlabs/Module/Settings/Tokens.php +++ b/Zotlabs/Module/Settings/Tokens.php @@ -161,7 +161,8 @@ class Tokens { '$me' => t('My Settings'), '$perms' => $perms, '$inherited' => t('inherited'), - '$notself' => '1', + '$notself' => 0, + '$self' => 1, '$permlbl' => t('Individual Permissions'), '$permnote' => t('Some permissions may be inherited from your channel\'s privacy settings, which have higher priority than individual settings. You can not change those settings here.'), '$submit' => t('Submit') -- cgit v1.2.3 From 30659aef5062a5e6a4ef94f63f8bbb2f89fb3965 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 7 Feb 2017 20:29:03 -0800 Subject: initial permcat creation ability, in /settings/permcats; functional permcat creation for testing but still needs a lot of UX work before promoting the ability --- Zotlabs/Module/Settings/Permcats.php | 111 +++++++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 Zotlabs/Module/Settings/Permcats.php (limited to 'Zotlabs/Module/Settings') diff --git a/Zotlabs/Module/Settings/Permcats.php b/Zotlabs/Module/Settings/Permcats.php new file mode 100644 index 000000000..82ee45bf7 --- /dev/null +++ b/Zotlabs/Module/Settings/Permcats.php @@ -0,0 +1,111 @@ + $desc) { + if(array_key_exists('perms_' . $perm, $_POST)) { + $pcarr[] = $perm; + } + } + } + + \Zotlabs\Lib\Permcat::update(local_channel(),$name,$pcarr); + + build_sync_packet(); + + info( t('Permission category saved.') . EOL); + + return; + } + + + function get() { + + if(! local_channel()) + return; + + $channel = \App::get_channel(); + + + if(argc() > 2) + $name = argv(2); + + + $desc = t('Use this form to create permission rules for various classes of people or connections.'); + + $global_perms = \Zotlabs\Access\Permissions::Perms(); + + $their_perms = []; + + $existing = get_all_perms(local_channel(),(($atoken_xchan) ? $atoken_xchan : '')); + + if($atoken_xchan) { + $theirs = q("select * from abconfig where chan = %d and xchan = '%s' and cat = 'their_perms'", + intval(local_channel()), + dbesc($atoken_xchan) + ); + if($theirs) { + foreach($theirs as $t) { + $their_perms[$t['k']] = $t['v']; + } + } + } + foreach($global_perms as $k => $v) { + $thisperm = get_abconfig(local_channel(),$contact['abook_xchan'],'my_perms',$k); +//fixme + + $checkinherited = \Zotlabs\Access\PermissionLimits::Get(local_channel(),$k); + + if($existing[$k]) + $thisperm = "1"; + + $perms[] = array('perms_' . $k, $v, ((array_key_exists($k,$their_perms)) ? intval($their_perms[$k]) : ''),$thisperm, 1, (($checkinherited & PERMS_SPECIFIC) ? '' : '1'), '', $checkinherited); + } + + + + $tpl = get_markup_template("settings_permcats.tpl"); + $o .= replace_macros($tpl, array( + '$form_security_token' => get_form_security_token("settings_permcats"), + '$title' => t('Permission Categories'), + '$desc' => $desc, + '$desc2' => $desc2, + '$tokens' => $t, + '$atoken' => $atoken, + '$url1' => z_root() . '/channel/' . $channel['channel_address'], + '$url2' => z_root() . '/photos/' . $channel['channel_address'], + '$name' => array('name', t('Permission Name') . ' *', (($name) ? $name : ''), ''), + '$me' => t('My Settings'), + '$perms' => $perms, + '$inherited' => t('inherited'), + '$notself' => 0, + '$self' => 1, + '$permlbl' => t('Individual Permissions'), + '$permnote' => t('Some permissions may be inherited from your channel\'s privacy settings, which have higher priority than individual settings. You can not change those settings here.'), + '$submit' => t('Submit') + )); + return $o; + } + +} \ No newline at end of file -- cgit v1.2.3 From 91819bfc2d475e1b16d3f5e9ca685ca2531a9084 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Wed, 8 Feb 2017 17:21:32 -0800 Subject: bringer - all basic functionality is implemented --- Zotlabs/Module/Settings/Permcats.php | 42 ++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 18 deletions(-) (limited to 'Zotlabs/Module/Settings') diff --git a/Zotlabs/Module/Settings/Permcats.php b/Zotlabs/Module/Settings/Permcats.php index 82ee45bf7..35d533196 100644 --- a/Zotlabs/Module/Settings/Permcats.php +++ b/Zotlabs/Module/Settings/Permcats.php @@ -42,6 +42,8 @@ class Permcats { function get() { +logger('cmd: ' . \App::$cmd); + if(! local_channel()) return; @@ -51,30 +53,33 @@ class Permcats { if(argc() > 2) $name = argv(2); + if(argc() > 3 && argv(3) === 'drop') { + \Zotlabs\Lib\Permcat::delete(local_channel(),$name); + build_sync_packet(); + json_return_and_die([ 'success' => true ]); + } - $desc = t('Use this form to create permission rules for various classes of people or connections.'); - - $global_perms = \Zotlabs\Access\Permissions::Perms(); - - $their_perms = []; - $existing = get_all_perms(local_channel(),(($atoken_xchan) ? $atoken_xchan : '')); + $desc = t('Use this form to create permission rules for various classes of people or connections.'); - if($atoken_xchan) { - $theirs = q("select * from abconfig where chan = %d and xchan = '%s' and cat = 'their_perms'", - intval(local_channel()), - dbesc($atoken_xchan) - ); - if($theirs) { - foreach($theirs as $t) { - $their_perms[$t['k']] = $t['v']; - } + $existing = []; + + $pcat = new \Zotlabs\Lib\Permcat(local_channel()); + $pcatlist = $pcat->listing(); + $permcats = []; + if($pcatlist) { + foreach($pcatlist as $pc) { + if(($pc['name']) && ($name) && ($pc['name'] == $name)) + $existing = $pc['perms']; + if(! $pc['system']) + $permcats[$pc['name']] = $pc['localname']; } } - foreach($global_perms as $k => $v) { - $thisperm = get_abconfig(local_channel(),$contact['abook_xchan'],'my_perms',$k); -//fixme + $global_perms = \Zotlabs\Access\Permissions::Perms(); + + foreach($global_perms as $k => $v) { + $thisperm = \Zotlabs\Lib\Permcat::find_permcat($existing,$k); $checkinherited = \Zotlabs\Access\PermissionLimits::Get(local_channel(),$k); if($existing[$k]) @@ -92,6 +97,7 @@ class Permcats { '$desc' => $desc, '$desc2' => $desc2, '$tokens' => $t, + '$permcats' => $permcats, '$atoken' => $atoken, '$url1' => z_root() . '/channel/' . $channel['channel_address'], '$url2' => z_root() . '/photos/' . $channel['channel_address'], -- cgit v1.2.3 From 1fb37f93ccf4739a6f92f3f36c1ee4ec8ef66a07 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Thu, 9 Feb 2017 19:52:13 -0800 Subject: more permissions optimisations --- Zotlabs/Module/Settings/Channel.php | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'Zotlabs/Module/Settings') diff --git a/Zotlabs/Module/Settings/Channel.php b/Zotlabs/Module/Settings/Channel.php index a89d83544..9ea459dab 100644 --- a/Zotlabs/Module/Settings/Channel.php +++ b/Zotlabs/Module/Settings/Channel.php @@ -88,15 +88,17 @@ class Channel { intval(local_channel()) ); } - - $x = \Zotlabs\Access\Permissions::FilledPerms($role_permissions['perms_connect']); - foreach($x as $k => $v) { - set_abconfig(local_channel(),$channel['channel_hash'],'my_perms',$k, $v); - if($role_permissions['perms_auto']) { - set_pconfig(local_channel(),'autoperms',$k,$v); - } - else { - del_pconfig(local_channel(),'autoperms',$k); + + if($role_permissions['perms_connect']) { + $x = \Zotlabs\Access\Permissions::FilledPerms($role_permissions['perms_connect']); + foreach($x as $k => $v) { + set_abconfig(local_channel(),$channel['channel_hash'],'my_perms',$k, $v); + if($role_permissions['perms_auto']) { + set_pconfig(local_channel(),'autoperms',$k,$v); + } + else { + del_pconfig(local_channel(),'autoperms',$k); + } } } -- cgit v1.2.3 From 321241da02330bf7ad710ce75ae3887d9e0a631c Mon Sep 17 00:00:00 2001 From: zotlabs Date: Sun, 12 Feb 2017 18:40:26 -0800 Subject: add default permcat to channel settings form --- Zotlabs/Module/Settings/Channel.php | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'Zotlabs/Module/Settings') diff --git a/Zotlabs/Module/Settings/Channel.php b/Zotlabs/Module/Settings/Channel.php index 9ea459dab..5b9cfdaca 100644 --- a/Zotlabs/Module/Settings/Channel.php +++ b/Zotlabs/Module/Settings/Channel.php @@ -18,6 +18,7 @@ class Channel { $role = ((x($_POST,'permissions_role')) ? notags(trim($_POST['permissions_role'])) : ''); $oldrole = get_pconfig(local_channel(),'system','permissions_role'); + if(($role != $oldrole) || ($role === 'custom')) { @@ -144,6 +145,7 @@ class Channel { $post_joingroup = (($_POST['post_joingroup'] == 1) ? 1: 0); $post_profilechange = (($_POST['post_profilechange'] == 1) ? 1: 0); $adult = (($_POST['adult'] == 1) ? 1 : 0); + $defpermcat = ((x($_POST,'defpermcat')) ? notags(trim($_POST['defpermcat'])) : 'default'); $cal_first_day = (((x($_POST,'first_day')) && (intval($_POST['first_day']) == 1)) ? 1: 0); @@ -232,6 +234,7 @@ class Channel { set_pconfig(local_channel(),'system','photo_path',$photo_path); set_pconfig(local_channel(),'system','attach_path',$attach_path); set_pconfig(local_channel(),'system','cal_first_day',$cal_first_day); + set_pconfig(local_channel(),'system','default_permcat',$defpermcat); $r = q("update channel set channel_name = '%s', channel_pageflags = %d, channel_timezone = '%s', channel_location = '%s', channel_notifyflags = %d, channel_max_anon_mail = %d, channel_max_friend_req = %d, channel_expire_days = %d $set_perms where channel_id = %d", dbesc($username), @@ -411,6 +414,19 @@ class Channel { '$basepath' => \App::get_hostname() )); + + + $pcat = new \Zotlabs\Lib\Permcat(local_channel()); + $pcatlist = $pcat->listing(); + $permcats = []; + if($pcatlist) { + foreach($pcatlist as $pc) { + $permcats[$pc['name']] = $pc['localname']; + } + } + + $default_permcat = get_pconfig(local_channel(),'system','default_permcat','default'); + $stpl = get_markup_template('settings.tpl'); @@ -500,7 +516,8 @@ class Channel { '$suggestme' => $suggestme, '$group_select' => $group_select, '$role' => array('permissions_role' , t('Channel permissions category:'), $permissions_role, '', $perm_roles), - + '$defpermcat' => [ 'defpermcat', t('Default Permissions Group'), $default_permcat, '', $permcats ], + '$permcat_enable' => feature_enabled(local_channel(),'permcats'), '$profile_in_dir' => $profile_in_dir, '$hide_friends' => $hide_friends, '$hide_wall' => $hide_wall, -- cgit v1.2.3 From 8a69a5c3c7bd0188228d5c1c8580e5331a66e2da Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sun, 26 Feb 2017 21:01:20 +0100 Subject: add a minversion to the theme and fallback to default if requirement is not met. mark incompatible themes in the theme selector --- Zotlabs/Module/Settings/Display.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'Zotlabs/Module/Settings') diff --git a/Zotlabs/Module/Settings/Display.php b/Zotlabs/Module/Settings/Display.php index 67cecf1f5..d5be07a81 100644 --- a/Zotlabs/Module/Settings/Display.php +++ b/Zotlabs/Module/Settings/Display.php @@ -130,12 +130,19 @@ class Display { if($allowed_themes) { foreach($allowed_themes as $th) { $f = $th; + + $min_version = ((file_exists('view/theme/' . $th . '/.MINVERSION')) ? file_get_contents('view/theme/' . $th . '/.MINVERSION') : 0); + if((version_compare($min_version, STD_VERSION, '>=')) || ($min_version == 0)) { + $mobile_themes[$f] = $themes[$f] = sprintf(t('%s - (Incompatible)'), $f); + continue; + } + $is_experimental = file_exists('view/theme/' . $th . '/experimental'); $unsupported = file_exists('view/theme/' . $th . '/unsupported'); $is_mobile = file_exists('view/theme/' . $th . '/mobile'); $is_library = file_exists('view/theme/'. $th . '/library'); - $mobile_themes["---"] = t("No special theme for mobile devices"); - + $mobile_themes['---'] = t("No special theme for mobile devices"); + if (!$is_experimental or ($is_experimental && (get_config('experimentals','exp_themes')==1 or get_config('experimentals','exp_themes')===false))){ $theme_name = (($is_experimental) ? sprintf(t('%s - (Experimental)'), $f) : $f); if (! $is_library) { @@ -147,7 +154,6 @@ class Display { } } } - } } -- cgit v1.2.3 From 8e3e90ddd243011828b9dbb44e7c4abc00655b28 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Mon, 27 Feb 2017 10:13:08 +0100 Subject: set minversion and maxversion for themes in view/theme/themename/php/theme.php instead of separate file. --- Zotlabs/Module/Settings/Display.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Zotlabs/Module/Settings') diff --git a/Zotlabs/Module/Settings/Display.php b/Zotlabs/Module/Settings/Display.php index d5be07a81..ee404daba 100644 --- a/Zotlabs/Module/Settings/Display.php +++ b/Zotlabs/Module/Settings/Display.php @@ -131,8 +131,9 @@ class Display { foreach($allowed_themes as $th) { $f = $th; - $min_version = ((file_exists('view/theme/' . $th . '/.MINVERSION')) ? file_get_contents('view/theme/' . $th . '/.MINVERSION') : 0); - if((version_compare($min_version, STD_VERSION, '>=')) || ($min_version == 0)) { + $info = get_theme_info($th); + $compatible = check_plugin_versions($info); + if(!$compatible) { $mobile_themes[$f] = $themes[$f] = sprintf(t('%s - (Incompatible)'), $f); continue; } -- cgit v1.2.3 From 729d52f10a73398012c59299070bf6b291c5dc41 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 2 Mar 2017 11:36:35 +0100 Subject: reset schema value after we empty and repopulate it. second half of fix for #624 --- Zotlabs/Module/Settings/Display.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Module/Settings') diff --git a/Zotlabs/Module/Settings/Display.php b/Zotlabs/Module/Settings/Display.php index ee404daba..eae44e82c 100644 --- a/Zotlabs/Module/Settings/Display.php +++ b/Zotlabs/Module/Settings/Display.php @@ -65,7 +65,7 @@ class Display { set_pconfig(local_channel(),'system','manual_conversation_update', $manual_update); $newschema = ''; - if($theme == $existing_theme){ + if($theme){ // call theme_post only if theme has not been changed if( ($themeconfigfile = $this->get_theme_config_file($theme)) != null){ require_once($themeconfigfile); -- cgit v1.2.3