From d81d13d712b2ef36d845ac291165adeab72b5139 Mon Sep 17 00:00:00 2001 From: nobody Date: Wed, 26 Jan 2022 10:20:02 +1100 Subject: [PATCH] features upgrade --- Zotlabs/Lib/Apps.php | 4 +- Zotlabs/Lib/Features.php | 571 +++++++++++++++++++++++++++ Zotlabs/Lib/Libprofile.php | 6 +- Zotlabs/Lib/Navbar.php | 2 +- Zotlabs/Lib/ThreadItem.php | 10 +- Zotlabs/Module/Cdav.php | 2 +- Zotlabs/Module/Connedit.php | 2 +- Zotlabs/Module/Embedphotos.php | 2 +- Zotlabs/Module/Events.php | 2 +- Zotlabs/Module/Photos.php | 2 +- Zotlabs/Module/Profiles.php | 16 +- Zotlabs/Module/Settings/Channel.php | 2 +- Zotlabs/Module/Settings/Display.php | 2 +- Zotlabs/Module/Settings/Featured.php | 2 +- Zotlabs/Module/Settings/Features.php | 10 +- Zotlabs/Module/Settings/Network.php | 8 +- Zotlabs/Module/Sources.php | 4 +- Zotlabs/Module/Thing.php | 4 +- Zotlabs/Widget/Activity_filter.php | 2 +- Zotlabs/Widget/Archive.php | 2 +- Zotlabs/Widget/Bookmarkedchats.php | 2 +- Zotlabs/Widget/Findpeople.php | 2 +- Zotlabs/Widget/Newmember.php | 2 +- Zotlabs/Widget/Savedsearch.php | 2 +- Zotlabs/Widget/Settings_menu.php | 6 +- Zotlabs/Widget/Suggestedchats.php | 2 +- boot.php | 1 - doc/develop/en/hooklist.mc | 4 +- include/conversation.php | 16 +- include/datetime.php | 2 +- include/features.php | 569 -------------------------- include/text.php | 4 +- install/schema_mysql.sql | 1 - view/theme/redbasic/php/config.php | 2 +- 34 files changed, 635 insertions(+), 635 deletions(-) create mode 100644 Zotlabs/Lib/Features.php delete mode 100644 include/features.php diff --git a/Zotlabs/Lib/Apps.php b/Zotlabs/Lib/Apps.php index 9154483e3..45218392e 100644 --- a/Zotlabs/Lib/Apps.php +++ b/Zotlabs/Lib/Apps.php @@ -315,7 +315,7 @@ class Apps if ($config) { $unset = ((get_config('system', $require[0]) == $require[1]) ? false : true); } else { - $unset = ((local_channel() && feature_enabled(local_channel(), $require)) ? false : true); + $unset = ((local_channel() && Features::enabled(local_channel(), $require)) ? false : true); } if ($unset) { unset($ret); @@ -557,7 +557,7 @@ class Apps if ($config) { $unset = ((get_config('system', $require[0]) === $require[1]) ? false : true); } else { - $unset = (($channel_id && feature_enabled($channnel_id, $require)) ? false : true); + $unset = (($channel_id && Features::enabled($channnel_id, $require)) ? false : true); } if ($unset) { return ''; diff --git a/Zotlabs/Lib/Features.php b/Zotlabs/Lib/Features.php new file mode 100644 index 000000000..ece5005d9 --- /dev/null +++ b/Zotlabs/Lib/Features.php @@ -0,0 +1,571 @@ + $uid, 'feature' => $feature, 'enabled' => $x); + call_hooks('feature_enabled', $arr); + return($arr['enabled']); + } + + public static function get_default($feature) + { + $f = Features::get(false); + foreach ($f as $cat) { + foreach ($cat as $feat) { + if (is_array($feat) && $feat[0] === $feature) { + return $feat[3]; + } + } + } + return false; + } + + + public static function level($feature, $def) + { + $x = get_config('feature_level', $feature); + if ($x !== false) { + return intval($x); + } + return $def; + } + + public static function get($filtered = true, $level = (-1)) + { + + $account = App::get_account(); + + $arr = [ + + // General + 'general' => [ + + t('General Features'), + + [ + 'start_menu', + t('New Member Links'), + t('Display new member quick links menu'), + (($account && $account['account_created'] > datetime_convert('', '', 'now - 30 days')) ? true : false), + get_config('feature_lock', 'start_menu'), + self::level('start_menu', 1), + ], + + [ + 'advanced_profiles', + t('Advanced Profiles'), + t('Additional profile sections and selections'), + false, + get_config('feature_lock', 'advanced_profiles'), + self::level('advanced_profiles', 1), + ], + + + // [ + // 'profile_export', + // t('Profile Import/Export'), + // t('Save and load profile details across sites/channels'), + // false, + // get_config('feature_lock','profile_export'), + // self::level('profile_export',3), + // ], + + // [ + // 'webpages', + // t('Web Pages'), + // t('Provide managed web pages on your channel'), + // false, + // get_config('feature_lock','webpages'), + // self::level('webpages',3), + // ], + + // [ + // 'wiki', + // t('Wiki'), + // t('Provide a wiki for your channel'), + // false, + // get_config('feature_lock','wiki'), + // self::level('wiki',2), + // ], + + /* + [ + 'hide_rating', + t('Hide Rating'), + t('Hide the rating buttons on your channel and profile pages. Note: People can still rate you somewhere else.'), + false, + get_config('feature_lock','hide_rating'), + self::level('hide_rating',3), + ], + */ + [ + 'private_notes', + t('Private Notes'), + t('Enables a tool to store notes and reminders (note: not encrypted)'), + false, + get_config('feature_lock', 'private_notes'), + self::level('private_notes', 1), + ], + + + // [ + // 'cards', + // t('Cards'), + // t('Create personal planning cards'), + // false, + // get_config('feature_lock','cards'), + // self::level('cards',1), + // ], + + + [ + 'articles', + t('Articles'), + t('Create interactive articles'), + false, + get_config('feature_lock', 'articles'), + self::level('articles', 1), + ], + + // [ + // 'nav_channel_select', + // t('Navigation Channel Select'), + // t('Change channels directly from within the navigation dropdown menu'), + // false, + // get_config('feature_lock','nav_channel_select'), + // self::level('nav_channel_select',3), + // ], + + [ + 'photo_location', + t('Photo Location'), + t('If location data is available on uploaded photos, link this to a map.'), + false, + get_config('feature_lock', 'photo_location'), + self::level('photo_location', 2), + ], + + + // [ + // 'ajaxchat', + // t('Access Controlled Chatrooms'), + // t('Provide chatrooms and chat services with access control.'), + // true, + // get_config('feature_lock','ajaxchat'), + // self::level('ajaxchat',1), + // ], + + + // [ + // 'smart_birthdays', + // t('Smart Birthdays'), + // t('Make birthday events timezone aware in case your friends are scattered across the planet.'), + // true, + // get_config('feature_lock','smart_birthdays'), + // self::level('smart_birthdays',2), + // ], + + [ + 'event_tz_select', + t('Event Timezone Selection'), + t('Allow event creation in timezones other than your own.'), + false, + get_config('feature_lock', 'event_tz_select'), + self::level('event_tz_select', 2), + ], + + + // [ + // 'premium_channel', + // t('Premium Channel'), + // t('Allows you to set restrictions and terms on those that connect with your channel'), + // false, + // get_config('feature_lock','premium_channel'), + // self::level('premium_channel',4), + // ], + + [ + 'advanced_dirsearch', + t('Advanced Directory Search'), + t('Allows creation of complex directory search queries'), + false, + get_config('feature_lock', 'advanced_dirsearch'), + self::level('advanced_dirsearch', 4), + ], + + [ + 'advanced_theming', + t('Advanced Theme and Layout Settings'), + t('Allows fine tuning of themes and page layouts'), + false, + get_config('feature_lock', 'advanced_theming'), + self::level('advanced_theming', 4), + ], + ], + + + 'access_control' => [ + t('Access Control and Permissions'), + + [ + 'groups', + t('Privacy Groups'), + t('Enable management and selection of privacy groups'), + false, + get_config('feature_lock', 'groups'), + self::level('groups', 0), + ], + + // [ + // 'multi_profiles', + // t('Multiple Profiles'), + // t('Ability to create multiple profiles'), + // false, + // get_config('feature_lock','multi_profiles'), + // self::level('multi_profiles',3), + // ], + + + [ + 'permcats', + t('Permission Categories'), + t('Create custom connection permission limits'), + true, + get_config('feature_lock','permcats'), + self::level('permcats',2), + ], + + // [ + // 'oauth_clients', + // t('OAuth1 Clients'), + // t('Manage OAuth1 authenticatication tokens for mobile and remote apps.'), + // false, + // get_config('feature_lock','oauth_clients'), + // self::level('oauth_clients',1), + // ], + + [ + 'oauth2_clients', + t('OAuth2 Clients'), + t('Manage OAuth2 authenticatication tokens for mobile and remote apps.'), + false, + get_config('feature_lock', 'oauth2_clients'), + self::level('oauth2_clients', 1), + ], + + // [ + // 'access_tokens', + // t('Access Tokens'), + // t('Create access tokens so that non-members can access private content.'), + // false, + // get_config('feature_lock','access_tokens'), + // self::level('access_tokens',2), + // ], + + ], + + // Post composition + 'composition' => [ + + t('Post Composition Features'), + + // [ + // 'large_photos', + // t('Large Photos'), + // t('Include large (1024px) photo thumbnails in posts. If not enabled, use small (640px) photo thumbnails'), + // false, + // get_config('feature_lock','large_photos'), + // self::level('large_photos',1), + // ], + + // [ + // 'channel_sources', + // t('Channel Sources'), + // t('Automatically import channel content from other channels or feeds'), + // false, + // get_config('feature_lock','channel_sources'), + // self::level('channel_sources',3), + // ], + + [ + 'content_encrypt', + t('Browser Encryption'), + t('Provide optional browser-to-browser encryption of content with a shared secret key'), + true, + get_config('feature_lock', 'content_encrypt'), + self::level('content_encrypt', 3), + ], + + // [ + // 'consensus_tools', + // t('Enable Voting Tools'), + // t('Provide a class of post which others can vote on'), + // false, + // get_config('feature_lock','consensus_tools'), + // self::level('consensus_tools',3), + // ], + + // [ + // 'disable_comments', + // t('Disable Comments'), + // t('Provide the option to disable comments for a post'), + // false, + // get_config('feature_lock','disable_comments'), + // self::level('disable_comments',2), + // ], + + // [ + // 'delayed_posting', + // t('Delayed Posting'), + // t('Allow posts to be published at a later date'), + // false, + // get_config('feature_lock','delayed_posting'), + // self::level('delayed_posting',2), + // ], + + // [ + // 'content_expire', + // t('Content Expiration'), + // t('Remove posts/comments and/or private messages at a future time'), + // false, + // get_config('feature_lock','content_expire'), + // self::level('content_expire',1), + // ], + + [ + 'suppress_duplicates', + t('Suppress Duplicate Posts/Comments'), + t('Prevent posts with identical content to be published with less than two minutes in between submissions.'), + true, + get_config('feature_lock', 'suppress_duplicates'), + self::level('suppress_duplicates', 1), + ], + + [ + 'auto_save_draft', + t('Auto-save drafts of posts and comments'), + t('Automatically saves post and comment drafts in local browser storage to help prevent accidental loss of compositions'), + true, + get_config('feature_lock', 'auto_save_draft'), + self::level('auto_save_draft', 1), + ], + + ], + + // Network Tools + 'net_module' => [ + + t('Network and Stream Filtering'), + + [ + 'archives', + t('Search by Date'), + t('Ability to select posts by date ranges'), + false, + get_config('feature_lock', 'archives'), + self::level('archives', 1), + ], + + + [ + 'savedsearch', + t('Saved Searches'), + t('Save search terms for re-use'), + false, + get_config('feature_lock', 'savedsearch'), + self::level('savedsearch', 2), + ], + + [ + 'order_tab', + t('Alternate Stream Order'), + t('Ability to order the stream by last post date, last comment date or unthreaded activities'), + false, + get_config('feature_lock', 'order_tab'), + self::level('order_tab', 2), + ], + + [ + 'name_tab', + t('Contact Filter'), + t('Ability to display only posts of a selected contact'), + false, + get_config('feature_lock', 'name_tab'), + self::level('name_tab', 1), + ], + + [ + 'forums_tab', + t('Forum Filter'), + t('Ability to display only posts of a specific forum'), + false, + get_config('feature_lock', 'forums_tab'), + self::level('forums_tab', 1), + ], + + [ + 'personal_tab', + t('Personal Posts Filter'), + t('Ability to display only posts that you\'ve interacted on'), + false, + get_config('feature_lock', 'personal_tab'), + self::level('personal_tab', 1), + ], + + [ + 'affinity', + t('Affinity Tool'), + t('Filter stream activity by depth of relationships'), + false, + get_config('feature_lock', 'affinity'), + self::level('affinity', 1), + ], + + [ + 'suggest', + t('Suggest Channels'), + t('Show friend and connection suggestions'), + false, + get_config('feature_lock', 'suggest'), + self::level('suggest', 1), + ], + + [ + 'connfilter', + t('Connection Filtering'), + t('Filter incoming posts from connections based on keywords/content'), + false, + get_config('feature_lock', 'connfilter'), + self::level('connfilter', 3), + ], + + + ], + + // Item tools + 'tools' => [ + + t('Post/Comment Tools'), + + [ + 'commtag', + t('Community Tagging'), + t('Ability to tag existing posts'), + false, + get_config('feature_lock', 'commtag'), + self::level('commtag', 1), + ], + + [ + 'categories', + t('Post Categories'), + t('Add categories to your posts'), + false, + get_config('feature_lock', 'categories'), + self::level('categories', 1), + ], + + [ + 'emojis', + t('Emoji Reactions'), + t('Add emoji reaction ability to posts'), + true, + get_config('feature_lock', 'emojis'), + self::level('emojis', 1), + ], + + [ + 'filing', + t('Saved Folders'), + t('Ability to file posts under folders'), + false, + get_config('feature_lock', 'filing'), + self::level('filing', 2), + ], + + [ + 'dislike', + t('Dislike Posts'), + t('Ability to dislike posts/comments'), + false, + get_config('feature_lock', 'dislike'), + self::level('dislike', 1), + ], + + // [ + // 'star_posts', + // t('Star Posts'), + // t('Ability to mark special posts with a star indicator'), + // false, + // get_config('feature_lock','star_posts'), + // self::level('star_posts',1), + // ], + // + [ + 'tagadelic', + t('Tag Cloud'), + t('Provide a personal tag cloud on your channel page'), + false, + get_config('feature_lock', 'tagadelic'), + self::level('tagadelic', 2), + ], + ], + ]; + + $x = [ 'features' => $arr, ]; + call_hooks('get_features', $x); + + $arr = $x['features']; + + // removed any locked features and remove the entire category if this makes it empty + + if ($filtered) { + $narr = []; + foreach ($arr as $k => $x) { + $narr[$k] = [ $arr[$k][0] ]; + $has_items = false; + for ($y = 0; $y < count($arr[$k]); $y++) { + $disabled = false; + if (is_array($arr[$k][$y])) { + if ($arr[$k][$y][4] !== false) { + $disabled = true; + } + if (! $disabled) { + $has_items = true; + $narr[$k][$y] = $arr[$k][$y]; + } + } + } + if (! $has_items) { + unset($narr[$k]); + } + } + } else { + $narr = $arr; + } + + return $narr; + } + + + + +} diff --git a/Zotlabs/Lib/Libprofile.php b/Zotlabs/Lib/Libprofile.php index 559bafc89..21b955a85 100644 --- a/Zotlabs/Lib/Libprofile.php +++ b/Zotlabs/Lib/Libprofile.php @@ -110,7 +110,7 @@ class Libprofile $profile_fields_basic = Channel::get_profile_fields_basic(); $profile_fields_advanced = Channel::get_profile_fields_advanced(); - $advanced = ((feature_enabled(local_channel(), 'advanced_profiles')) ? true : false); + $advanced = ((Features::enabled(local_channel(), 'advanced_profiles')) ? true : false); if ($advanced) { $fields = $profile_fields_advanced; } else { @@ -198,7 +198,7 @@ class Libprofile 'entries' => [], ); - $multi_profiles = feature_enabled(local_channel(), 'multi_profiles'); + $multi_profiles = Features::enabled(local_channel(), 'multi_profiles'); if ($multi_profiles) { $ret['multi'] = 1; $ret['edit'] = [z_root() . '/profiles', t('Edit Profiles'), '', t('Edit')]; @@ -484,7 +484,7 @@ class Libprofile $profile_fields_basic = Channel::get_profile_fields_basic(); $profile_fields_advanced = Channel::get_profile_fields_advanced(); - $advanced = ((feature_enabled(App::$profile['profile_uid'], 'advanced_profiles')) ? true : false); + $advanced = ((Features::enabled(App::$profile['profile_uid'], 'advanced_profiles')) ? true : false); if ($advanced) { $fields = $profile_fields_advanced; } else { diff --git a/Zotlabs/Lib/Navbar.php b/Zotlabs/Lib/Navbar.php index 129401313..2b5acb527 100644 --- a/Zotlabs/Lib/Navbar.php +++ b/Zotlabs/Lib/Navbar.php @@ -121,7 +121,7 @@ class Navbar { // user menu $nav['usermenu'][] = ['profile/' . $channel['channel_address'], t('View Profile'), ((App::$nav_sel['raw_name'] == 'Profile') ? 'active' : ''), t('Your profile page'),'profile_nav_btn']; - if (feature_enabled(local_channel(), 'multi_profiles')) { + if (Features::enabled(local_channel(), 'multi_profiles')) { $nav['usermenu'][] = ['profiles', t('Edit Profiles'), ((App::$nav_sel['raw_name'] == 'Profiles') ? 'active' : '') , t('Manage/Edit profiles'),'profiles_nav_btn']; } else { $nav['usermenu'][] = ['profiles/' . $prof[0]['id'], t('Edit Profile'), ((App::$nav_sel['raw_name'] == 'Profiles') ? 'active' : ''), t('Edit your profile'),'profiles_nav_btn']; diff --git a/Zotlabs/Lib/ThreadItem.php b/Zotlabs/Lib/ThreadItem.php index c44ac923c..07bf01df4 100644 --- a/Zotlabs/Lib/ThreadItem.php +++ b/Zotlabs/Lib/ThreadItem.php @@ -464,10 +464,10 @@ class ThreadItem 'embed' => $embed, 'rawmid' => $item['mid'], 'plink' => get_plink($item), - 'edpost' => $edpost, // ((feature_enabled($conv->get_profile_owner(),'edit_posts')) ? $edpost : ''), + 'edpost' => $edpost, // ((Features::enabled($conv->get_profile_owner(),'edit_posts')) ? $edpost : ''), 'star' => $star, - 'tagger' => ((feature_enabled($conv->get_profile_owner(), 'commtag')) ? $tagger : ''), - 'filer' => ((feature_enabled($conv->get_profile_owner(), 'filing')) ? $filer : ''), + 'tagger' => ((Features::enabled($conv->get_profile_owner(), 'commtag')) ? $tagger : ''), + 'filer' => ((Features::enabled($conv->get_profile_owner(), 'filing')) ? $filer : ''), 'pinned' => ($pinned ? t('Pinned post') : ''), 'pinnable' => (($this->is_toplevel() && local_channel() && $item['owner_xchan'] == $observer['xchan_hash'] && $allowed_type && $item['item_private'] == 0 && $item['item_delayed'] == 0) ? '1' : ''), 'pinme' => ($pinned ? t('Unpin this post') : t('Pin this post')), @@ -476,7 +476,7 @@ class ThreadItem 'bookmark' => (($conv->get_profile_owner() == local_channel() && local_channel() && $has_bookmarks) ? t('Save Bookmarks') : ''), 'addtocal' => (($has_event && ! $item['resource_id']) ? t('Add to Calendar') : ''), 'drop' => $drop, - 'multidrop' => ((feature_enabled($conv->get_profile_owner(), 'multi_delete')) ? $multidrop : ''), + 'multidrop' => ((Features::enabled($conv->get_profile_owner(), 'multi_delete')) ? $multidrop : ''), 'dropdown_extras' => $dropdown_extras, // end toolbar buttons @@ -929,7 +929,7 @@ class ThreadItem call_hooks('comment_buttons', $arr); $comment_buttons = $arr['comment_buttons']; - $feature_auto_save_draft = ((feature_enabled($conv->get_profile_owner(), 'auto_save_draft')) ? "true" : "false"); + $feature_auto_save_draft = ((Features::enabled($conv->get_profile_owner(), 'auto_save_draft')) ? "true" : "false"); $permanent_draft = ((intval($conv->get_profile_owner()) === intval(local_channel()) && Apps::system_app_installed($conv->get_profile_owner(), 'Drafts')) ? ('Save draft') : EMPTY_STR); diff --git a/Zotlabs/Module/Cdav.php b/Zotlabs/Module/Cdav.php index ce000ce49..da8b442a0 100644 --- a/Zotlabs/Module/Cdav.php +++ b/Zotlabs/Module/Cdav.php @@ -1011,7 +1011,7 @@ class Cdav extends Controller $sources = rtrim($sources, ', '); - $first_day = feature_enabled(local_channel(), 'cal_first_day'); + $first_day = Features::enabled(local_channel(), 'cal_first_day'); $first_day = (($first_day) ? $first_day : 0); $title = ['title', t('Event title')]; diff --git a/Zotlabs/Module/Connedit.php b/Zotlabs/Module/Connedit.php index 7fce1ff94..8350b12b4 100644 --- a/Zotlabs/Module/Connedit.php +++ b/Zotlabs/Module/Connedit.php @@ -731,7 +731,7 @@ class Connedit extends Controller $unapproved = array('pending', t('Approve this connection'), '', t('Accept connection to allow communication'), array(t('No'), t('Yes'))); - $multiprofs = ((feature_enabled(local_channel(), 'multi_profiles')) ? true : false); + $multiprofs = ((Features::enabled(local_channel(), 'multi_profiles')) ? true : false); if ($slide && !$multiprofs) { $affinity = t('Set Friend Zoom'); diff --git a/Zotlabs/Module/Embedphotos.php b/Zotlabs/Module/Embedphotos.php index fae7ae211..2be6a0a88 100644 --- a/Zotlabs/Module/Embedphotos.php +++ b/Zotlabs/Module/Embedphotos.php @@ -70,7 +70,7 @@ class Embedphotos extends Controller $output = EMPTY_STR; if ($channel) { - $resolution = ((feature_enabled($channel['channel_id'], 'large_photos')) ? 1 : 2); + $resolution = ((Features::enabled($channel['channel_id'], 'large_photos')) ? 1 : 2); $r = q( "select mimetype, height, width, title from photo where resource_id = '%s' and $resolution = %d and uid = %d limit 1", dbesc($resource), diff --git a/Zotlabs/Module/Events.php b/Zotlabs/Module/Events.php index 3be5d4e4e..4e803b4ff 100644 --- a/Zotlabs/Module/Events.php +++ b/Zotlabs/Module/Events.php @@ -533,7 +533,7 @@ class Events extends Controller '$allow_gid' => acl2json($permissions['allow_gid']), '$deny_cid' => acl2json($permissions['deny_cid']), '$deny_gid' => acl2json($permissions['deny_gid']), - '$tz_choose' => feature_enabled(local_channel(), 'event_tz_select'), + '$tz_choose' => Features::enabled(local_channel(), 'event_tz_select'), '$timezone' => array('timezone_select', t('Timezone:'), date_default_timezone_get(), '', get_timezones()), '$lockstate' => (($acl->is_private()) ? 'lock' : 'unlock'), diff --git a/Zotlabs/Module/Photos.php b/Zotlabs/Module/Photos.php index f57d9d30c..a5b961194 100644 --- a/Zotlabs/Module/Photos.php +++ b/Zotlabs/Module/Photos.php @@ -1130,7 +1130,7 @@ class Photos extends Controller 'lockstate' => $lockstate[0], 'help_tags' => t('Example: @bob, @Barbara_Jensen, @jim@example.com'), 'item_id' => ((count($linked_items)) ? $link_item['id'] : 0), - 'adult_enabled' => feature_enabled($owner_uid, 'adult_photo_flagging'), + 'adult_enabled' => Features::enabled($owner_uid, 'adult_photo_flagging'), 'adult' => array('adult', t('Flag as adult in album view'), intval($ph[0]['is_nsfw']), ''), 'submit' => t('Submit'), 'delete' => t('Delete Photo'), diff --git a/Zotlabs/Module/Profiles.php b/Zotlabs/Module/Profiles.php index 63dbd149c..80e87e5f7 100644 --- a/Zotlabs/Module/Profiles.php +++ b/Zotlabs/Module/Profiles.php @@ -179,8 +179,8 @@ class Profiles extends Controller killme(); } - if (((argc() > 1) && (intval(argv(1)))) || !feature_enabled(local_channel(), 'multi_profiles')) { - if (feature_enabled(local_channel(), 'multi_profiles')) { + if (((argc() > 1) && (intval(argv(1)))) || !Features::enabled(local_channel(), 'multi_profiles')) { + if (Features::enabled(local_channel(), 'multi_profiles')) { $id = argv(1); } else { $x = q( @@ -443,7 +443,7 @@ class Profiles extends Controller $profile_fields_basic = Channel::get_profile_fields_basic(); $profile_fields_advanced = Channel::get_profile_fields_advanced(); - $advanced = ((feature_enabled(local_channel(), 'advanced_profiles')) ? true : false); + $advanced = ((Features::enabled(local_channel(), 'advanced_profiles')) ? true : false); if ($advanced) { $fields = $profile_fields_advanced; } else { @@ -682,8 +682,8 @@ class Profiles extends Controller $profile_fields_basic = Channel::get_profile_fields_basic(); $profile_fields_advanced = Channel::get_profile_fields_advanced(); - if (((argc() > 1) && (intval(argv(1)))) || !feature_enabled(local_channel(), 'multi_profiles')) { - if (feature_enabled(local_channel(), 'multi_profiles')) { + if (((argc() > 1) && (intval(argv(1)))) || !Features::enabled(local_channel(), 'multi_profiles')) { + if (Features::enabled(local_channel(), 'multi_profiles')) { $id = argv(1); } else { $x = q( @@ -711,7 +711,7 @@ class Profiles extends Controller '$editselect' => $editselect, )); - $advanced = ((feature_enabled(local_channel(), 'advanced_profiles')) ? true : false); + $advanced = ((Features::enabled(local_channel(), 'advanced_profiles')) ? true : false); if ($advanced) { $fields = $profile_fields_advanced; } else { @@ -759,7 +759,7 @@ class Profiles extends Controller $tpl = get_markup_template("profile_edit.tpl"); $o .= replace_macros($tpl, array( - '$multi_profiles' => ((feature_enabled(local_channel(), 'multi_profiles')) ? true : false), + '$multi_profiles' => ((Features::enabled(local_channel(), 'multi_profiles')) ? true : false), '$form_security_token' => get_form_security_token("profile_edit"), '$profile_clone_link' => 'profiles/clone/' . $r[0]['id'] . '?t=' . get_form_security_token("profile_clone"), '$profile_drop_link' => 'profiles/drop/' . $r[0]['id'] . '?t=' . get_form_security_token("profile_drop"), @@ -781,7 +781,7 @@ class Profiles extends Controller '$location' => t('Location'), '$relation' => t('Relationship'), '$miscellaneous' => t('Miscellaneous'), - '$exportable' => feature_enabled(local_channel(), 'profile_export'), + '$exportable' => Features::enabled(local_channel(), 'profile_export'), '$lbl_import' => t('Import profile from file'), '$lbl_export' => t('Export profile to file'), '$lbl_gender' => t('Your gender'), diff --git a/Zotlabs/Module/Settings/Channel.php b/Zotlabs/Module/Settings/Channel.php index 81eeb3dc0..63e3b13ad 100644 --- a/Zotlabs/Module/Settings/Channel.php +++ b/Zotlabs/Module/Settings/Channel.php @@ -660,7 +660,7 @@ class Channel '$permdesc' => t("(click to open/close)"), '$aclselect' => Libacl::populate($perm_defaults, false, PermissionDescription::fromDescription(t('Use my default audience setting for the type of object published'))), '$profseltxt' => t('Profile to assign new connections'), - '$profselect' => ((feature_enabled(local_channel(), 'multi_profiles')) ? contact_profile_assign(get_pconfig(local_channel(), 'system', 'profile_assign', '')) : ''), + '$profselect' => ((Features::enabled(local_channel(), 'multi_profiles')) ? contact_profile_assign(get_pconfig(local_channel(), 'system', 'profile_assign', '')) : ''), '$allow_cid' => acl2json($perm_defaults['allow_cid']), '$allow_gid' => acl2json($perm_defaults['allow_gid']), diff --git a/Zotlabs/Module/Settings/Display.php b/Zotlabs/Module/Settings/Display.php index e11677564..a97aef185 100644 --- a/Zotlabs/Module/Settings/Display.php +++ b/Zotlabs/Module/Settings/Display.php @@ -216,7 +216,7 @@ class Display '$channel_menu' => ['channel_menu', t('Provide channel menu in navigation bar'), get_pconfig(local_channel(), 'system', 'channel_menu', get_config('system', 'channel_menu', 0)), t('Default: channel menu located in app menu'), $yes_no], '$layout_editor' => t('System Page Layout Editor - (advanced)'), '$theme_config' => $theme_config, - '$expert' => feature_enabled(local_channel(), 'advanced_theming'), + '$expert' => Features::enabled(local_channel(), 'advanced_theming'), '$channel_divmore_height' => array('channel_divmore_height', t('Channel page max height of content (in pixels)'), ((get_pconfig(local_channel(), 'system', 'channel_divmore_height')) ? get_pconfig(local_channel(), 'system', 'channel_divmore_height') : 400), t('click to expand content exceeding this height')), '$stream_divmore_height' => array('stream_divmore_height', t('Stream page max height of content (in pixels)'), ((get_pconfig(local_channel(), 'system', 'stream_divmore_height')) ? get_pconfig(local_channel(), 'system', 'stream_divmore_height') : 400), t('click to expand content exceeding this height')), '$indentpx' => ['indentpx', t('Indent threaded comments this many pixels from the parent'), intval(get_pconfig(local_channel(), 'system', 'thread_indent_px', get_config('system', 'thread_indent_px', 0))), t('0-20')], diff --git a/Zotlabs/Module/Settings/Featured.php b/Zotlabs/Module/Settings/Featured.php index 6405b0113..00ed425c6 100644 --- a/Zotlabs/Module/Settings/Featured.php +++ b/Zotlabs/Module/Settings/Featured.php @@ -43,7 +43,7 @@ class Featured $settings_addons = t('No feature settings configured'); } - if (feature_enabled(local_channel(), 'affinity')) { + if (Features::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( diff --git a/Zotlabs/Module/Settings/Features.php b/Zotlabs/Module/Settings/Features.php index a2d88e0ca..2b2a761af 100644 --- a/Zotlabs/Module/Settings/Features.php +++ b/Zotlabs/Module/Settings/Features.php @@ -11,7 +11,7 @@ class Features { check_form_security_token_redirectOnErr('/settings/features', 'settings_features'); - $features = get_features(false); + $features = Features::get(false); foreach ($features as $fname => $fdata) { foreach (array_slice($fdata, 1) as $f) { @@ -34,21 +34,21 @@ class Features $harr = []; - $all_features_raw = get_features(false); + $all_features_raw = Features::get(false); foreach ($all_features_raw as $fname => $fdata) { foreach (array_slice($fdata, 1) as $f) { - $harr[$f[0]] = ((intval(feature_enabled(local_channel(), $f[0]))) ? "1" : ''); + $harr[$f[0]] = ((intval(Features::enabled(local_channel(), $f[0]))) ? "1" : ''); } } - $features = get_features(true); + $features = Features::get(true); foreach ($features as $fname => $fdata) { $arr[$fname] = []; $arr[$fname][0] = $fdata[0]; foreach (array_slice($fdata, 1) as $f) { - $arr[$fname][1][] = array('feature_' . $f[0], $f[1], ((intval(feature_enabled(local_channel(), $f[0]))) ? "1" : ''), $f[2], array(t('Off'), t('On'))); + $arr[$fname][1][] = array('feature_' . $f[0], $f[1], ((intval(Features::enabled(local_channel(), $f[0]))) ? "1" : ''), $f[2], array(t('Off'), t('On'))); unset($harr[$f[0]]); } } diff --git a/Zotlabs/Module/Settings/Network.php b/Zotlabs/Module/Settings/Network.php index 8c902df9c..932fbacd8 100644 --- a/Zotlabs/Module/Settings/Network.php +++ b/Zotlabs/Module/Settings/Network.php @@ -9,7 +9,7 @@ class Network { check_form_security_token_redirectOnErr('/settings/network', 'settings_network'); - $features = self::get_features(); + $features = self::Features::get(); foreach ($features as $f) { $k = $f[0]; @@ -27,10 +27,10 @@ class Network public function get() { - $features = self::get_features(); + $features = self::Features::get(); foreach ($features as $f) { - $arr[] = array('feature_' . $f[0], $f[1], ((intval(feature_enabled(local_channel(), $f[0]))) ? "1" : ''), $f[2], array(t('Off'), t('On'))); + $arr[] = array('feature_' . $f[0], $f[1], ((intval(Features::enabled(local_channel(), $f[0]))) ? "1" : ''), $f[2], array(t('Off'), t('On'))); } $tpl = get_markup_template("settings_module.tpl"); @@ -47,7 +47,7 @@ class Network return $o; } - public function get_features() + public function Features::get() { $arr = [ diff --git a/Zotlabs/Module/Sources.php b/Zotlabs/Module/Sources.php index c82cad12c..dceda5553 100644 --- a/Zotlabs/Module/Sources.php +++ b/Zotlabs/Module/Sources.php @@ -15,7 +15,7 @@ class Sources extends Controller return; } - if (!feature_enabled(local_channel(), 'channel_sources')) { + if (!Features::enabled(local_channel(), 'channel_sources')) { return; } @@ -90,7 +90,7 @@ class Sources extends Controller return EMPTY_STR; } - if (!feature_enabled(local_channel(), 'channel_sources')) { + if (!Features::enabled(local_channel(), 'channel_sources')) { return EMPTY_STR; } diff --git a/Zotlabs/Module/Thing.php b/Zotlabs/Module/Thing.php index dbc261789..f3209af6b 100644 --- a/Zotlabs/Module/Thing.php +++ b/Zotlabs/Module/Thing.php @@ -338,7 +338,7 @@ class Thing extends Controller $o .= replace_macros(get_markup_template('thing_edit.tpl'), array( '$thing_hdr' => t('Edit Thing'), - '$multiprof' => feature_enabled(local_channel(), 'multi_profiles'), + '$multiprof' => Features::enabled(local_channel(), 'multi_profiles'), '$profile_lbl' => t('Select a profile'), '$profile_select' => contact_profile_assign($r[0]['obj_page']), '$verb_lbl' => $channel['channel_name'], @@ -397,7 +397,7 @@ class Thing extends Controller $o .= replace_macros(get_markup_template('thing_input.tpl'), array( '$thing_hdr' => t('Add Thing to your Profile'), - '$multiprof' => feature_enabled(local_channel(), 'multi_profiles'), + '$multiprof' => Features::enabled(local_channel(), 'multi_profiles'), '$profile_lbl' => t('Select a profile'), '$profile_select' => contact_profile_assign(''), '$verb_lbl' => $channel['channel_name'], diff --git a/Zotlabs/Widget/Activity_filter.php b/Zotlabs/Widget/Activity_filter.php index 7b3f06ea7..ede0d545b 100644 --- a/Zotlabs/Widget/Activity_filter.php +++ b/Zotlabs/Widget/Activity_filter.php @@ -211,7 +211,7 @@ class Activity_filter ]; } - if (feature_enabled(local_channel(), 'filing')) { + if (Features::enabled(local_channel(), 'filing')) { $terms = q( "select distinct term from term where uid = %d and ttype = %d order by term asc", intval(local_channel()), diff --git a/Zotlabs/Widget/Archive.php b/Zotlabs/Widget/Archive.php index a12cf1205..40f27579f 100644 --- a/Zotlabs/Widget/Archive.php +++ b/Zotlabs/Widget/Archive.php @@ -18,7 +18,7 @@ class Archive $uid = App::$profile_uid; - if (!feature_enabled($uid, 'archives')) { + if (!Features::enabled($uid, 'archives')) { return ''; } diff --git a/Zotlabs/Widget/Bookmarkedchats.php b/Zotlabs/Widget/Bookmarkedchats.php index 2584a5e2a..d1f0b3055 100644 --- a/Zotlabs/Widget/Bookmarkedchats.php +++ b/Zotlabs/Widget/Bookmarkedchats.php @@ -10,7 +10,7 @@ class Bookmarkedchats public function widget($arr) { - if (!feature_enabled(App::$profile['profile_uid'], 'ajaxchat')) { + if (!Features::enabled(App::$profile['profile_uid'], 'ajaxchat')) { return ''; } diff --git a/Zotlabs/Widget/Findpeople.php b/Zotlabs/Widget/Findpeople.php index 95ef5870a..e8dbe9e7b 100644 --- a/Zotlabs/Widget/Findpeople.php +++ b/Zotlabs/Widget/Findpeople.php @@ -23,7 +23,7 @@ class Findpeople } } - $advanced_search = ((local_channel() && feature_enabled(local_channel(), 'advanced_dirsearch')) ? t('Advanced') : false); + $advanced_search = ((local_channel() && Features::enabled(local_channel(), 'advanced_dirsearch')) ? t('Advanced') : false); return replace_macros(get_markup_template('peoplefind.tpl'), array( '$findpeople' => t('Find Channels'), diff --git a/Zotlabs/Widget/Newmember.php b/Zotlabs/Widget/Newmember.php index 1ea2653b3..188765766 100644 --- a/Zotlabs/Widget/Newmember.php +++ b/Zotlabs/Widget/Newmember.php @@ -24,7 +24,7 @@ class Newmember } // @fixme - if (!feature_enabled(local_channel(), 'start_menu')) { + if (!Features::enabled(local_channel(), 'start_menu')) { return EMPTY_STR; } diff --git a/Zotlabs/Widget/Savedsearch.php b/Zotlabs/Widget/Savedsearch.php index 3d433a9c7..24b995dcd 100644 --- a/Zotlabs/Widget/Savedsearch.php +++ b/Zotlabs/Widget/Savedsearch.php @@ -10,7 +10,7 @@ class Savedsearch public function widget($arr) { - if ((!local_channel()) || (!feature_enabled(local_channel(), 'savedsearch'))) { + if ((!local_channel()) || (!Features::enabled(local_channel(), 'savedsearch'))) { return ''; } diff --git a/Zotlabs/Widget/Settings_menu.php b/Zotlabs/Widget/Settings_menu.php index 2eb1b1451..1a1879d1c 100644 --- a/Zotlabs/Widget/Settings_menu.php +++ b/Zotlabs/Widget/Settings_menu.php @@ -81,7 +81,7 @@ class Settings_menu 'selected' => '' ); -// if(feature_enabled(local_channel(),'oauth_clients')) { +// if(Features::enabled(local_channel(),'oauth_clients')) { // $tabs[] = array( // 'label' => t('OAuth1 apps'), // 'url' => z_root() . '/settings/oauth', @@ -97,7 +97,7 @@ class Settings_menu ); } -// if(feature_enabled(local_channel(),'access_tokens')) { +// if(Features::enabled(local_channel(),'access_tokens')) { // $tabs[] = array( // 'label' => t('Guest Access Tokens'), // 'url' => z_root() . '/settings/tokens', @@ -122,7 +122,7 @@ class Settings_menu // ); // } -// if(feature_enabled(local_channel(),'channel_sources')) { +// if(Features::enabled(local_channel(),'channel_sources')) { // $tabs[] = array( // 'label' => t('Channel Sources'), // 'url' => z_root() . '/sources', diff --git a/Zotlabs/Widget/Suggestedchats.php b/Zotlabs/Widget/Suggestedchats.php index 6fa221f76..db58cad48 100644 --- a/Zotlabs/Widget/Suggestedchats.php +++ b/Zotlabs/Widget/Suggestedchats.php @@ -10,7 +10,7 @@ class Suggestedchats public function widget($arr) { - if (!feature_enabled(App::$profile['profile_uid'], 'ajaxchat')) { + if (!Features::enabled(App::$profile['profile_uid'], 'ajaxchat')) { return ''; } diff --git a/boot.php b/boot.php index 4232e68dd..b3d7f1f3c 100755 --- a/boot.php +++ b/boot.php @@ -55,7 +55,6 @@ require_once('include/text.php'); require_once('include/datetime.php'); require_once('include/language.php'); require_once('include/permissions.php'); -require_once('include/features.php'); require_once('include/taxonomy.php'); require_once('include/connections.php'); require_once('include/zid.php'); diff --git a/doc/develop/en/hooklist.mc b/doc/develop/en/hooklist.mc index 1abd5c215..abdc6488b 100644 --- a/doc/develop/en/hooklist.mc +++ b/doc/develop/en/hooklist.mc @@ -102,7 +102,7 @@ event_created event_store_event event_updated extend_cookie -feature_enabled +Features::enabled feature_settings feature_settings_post federated_transports @@ -118,7 +118,7 @@ get_all_perms get_base_apps get_best_language get_default_export_sections -get_features +Features::get get_profile_photo get_role_perms get_system_apps diff --git a/include/conversation.php b/include/conversation.php index f3f399ca7..99aeb162b 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -496,7 +496,7 @@ function conversation($items, $mode, $update, $page_mode = 'traditional', $prepa $page_dropping = ((local_channel() && local_channel() == $profile_owner) ? true : false); - if (! feature_enabled($profile_owner, 'multi_delete')) { + if (! Features::enabled($profile_owner, 'multi_delete')) { $page_dropping = false; } @@ -698,7 +698,7 @@ function conversation($items, $mode, $update, $page_mode = 'traditional', $prepa 'owner_photo' => $owner_photo, 'plink' => get_plink($item, false), 'edpost' => false, - 'star' => ((feature_enabled(local_channel(), 'star_posts')) ? $star : ''), + 'star' => ((Features::enabled(local_channel(), 'star_posts')) ? $star : ''), 'drop' => $drop, 'vote' => $likebuttons, 'like' => '', @@ -1266,7 +1266,7 @@ function z_status_editor($x, $popup = false) $reset = ((x($x, 'reset')) ? $x['reset'] : ''); - $feature_auto_save_draft = ((feature_enabled($x['profile_uid'], 'auto_save_draft')) ? "true" : "false"); + $feature_auto_save_draft = ((Features::enabled($x['profile_uid'], 'auto_save_draft')) ? "true" : "false"); $tpl = get_markup_template('jot-header.tpl'); @@ -2024,7 +2024,7 @@ function profile_tabs($a, $is_owner = false, $nickname = null) } - if ($p['chat'] && feature_enabled($uid, 'ajaxchat')) { + if ($p['chat'] && Features::enabled($uid, 'ajaxchat')) { $has_chats = Chatroom::list_count($uid); if ($has_chats) { $tabs[] = array( @@ -2052,7 +2052,7 @@ function profile_tabs($a, $is_owner = false, $nickname = null) ); } - if (feature_enabled($uid, 'cards')) { + if (Features::enabled($uid, 'cards')) { $tabs[] = array( 'label' => t('Cards'), 'url' => z_root() . '/cards/' . $nickname, @@ -2063,7 +2063,7 @@ function profile_tabs($a, $is_owner = false, $nickname = null) ); } - if (feature_enabled($uid, 'articles')) { + if (Features::enabled($uid, 'articles')) { $tabs[] = array( 'label' => t('articles'), 'url' => z_root() . '/articles/' . $nickname, @@ -2074,7 +2074,7 @@ function profile_tabs($a, $is_owner = false, $nickname = null) ); } - if ($has_webpages && feature_enabled($uid, 'webpages')) { + if ($has_webpages && Features::enabled($uid, 'webpages')) { $tabs[] = array( 'label' => t('Webpages'), 'url' => z_root() . '/page/' . $nickname . '/home', @@ -2087,7 +2087,7 @@ function profile_tabs($a, $is_owner = false, $nickname = null) if ($p['view_wiki']) { - if (feature_enabled($uid, 'wiki')) { + if (Features::enabled($uid, 'wiki')) { $tabs[] = array( 'label' => t('Wikis'), 'url' => z_root() . '/wiki/' . $nickname, diff --git a/include/datetime.php b/include/datetime.php index 91c9703dd..028e8b8f8 100644 --- a/include/datetime.php +++ b/include/datetime.php @@ -588,7 +588,7 @@ function update_birthdays() 'event_xchan' => $rr['xchan_hash'], 'dtstart' => datetime_convert('UTC', 'UTC', $rr['abook_dob']), 'dtend' => datetime_convert('UTC', 'UTC', $rr['abook_dob'] . ' + 1 day '), - 'adjust' => intval(feature_enabled($rr['abook_channel'], 'smart_birthdays')), + 'adjust' => intval(Features::enabled($rr['abook_channel'], 'smart_birthdays')), 'summary' => sprintf(t('%1$s\'s birthday'), $rr['xchan_name']), 'description' => sprintf(t('Happy Birthday %1$s'), '[zrl=' . $rr['xchan_url'] . ']' . $rr['xchan_name'] . '[/zrl]'), 'etype' => 'birthday', diff --git a/include/features.php b/include/features.php deleted file mode 100644 index 8380cec71..000000000 --- a/include/features.php +++ /dev/null @@ -1,569 +0,0 @@ - $uid, 'feature' => $feature, 'enabled' => $x); - call_hooks('feature_enabled', $arr); - return($arr['enabled']); -} - -function get_feature_default($feature) -{ - $f = get_features(false); - foreach ($f as $cat) { - foreach ($cat as $feat) { - if (is_array($feat) && $feat[0] === $feature) { - return $feat[3]; - } - } - } - return false; -} - - -function feature_level($feature, $def) -{ - $x = get_config('feature_level', $feature); - if ($x !== false) { - return intval($x); - } - return $def; -} - -function get_features($filtered = true, $level = (-1)) -{ - - $account = App::get_account(); - - $arr = [ - - // General - 'general' => [ - - t('General Features'), - - [ - 'start_menu', - t('New Member Links'), - t('Display new member quick links menu'), - (($account && $account['account_created'] > datetime_convert('', '', 'now - 30 days')) ? true : false), - get_config('feature_lock', 'start_menu'), - feature_level('start_menu', 1), - ], - - [ - 'advanced_profiles', - t('Advanced Profiles'), - t('Additional profile sections and selections'), - false, - get_config('feature_lock', 'advanced_profiles'), - feature_level('advanced_profiles', 1), - ], - - -// [ -// 'profile_export', -// t('Profile Import/Export'), -// t('Save and load profile details across sites/channels'), -// false, -// get_config('feature_lock','profile_export'), -// feature_level('profile_export',3), -// ], - -// [ -// 'webpages', -// t('Web Pages'), -// t('Provide managed web pages on your channel'), -// false, -// get_config('feature_lock','webpages'), -// feature_level('webpages',3), -// ], - -// [ -// 'wiki', -// t('Wiki'), -// t('Provide a wiki for your channel'), -// false, -// get_config('feature_lock','wiki'), -// feature_level('wiki',2), -// ], - -/* - [ - 'hide_rating', - t('Hide Rating'), - t('Hide the rating buttons on your channel and profile pages. Note: People can still rate you somewhere else.'), - false, - get_config('feature_lock','hide_rating'), - feature_level('hide_rating',3), - ], -*/ - [ - 'private_notes', - t('Private Notes'), - t('Enables a tool to store notes and reminders (note: not encrypted)'), - false, - get_config('feature_lock', 'private_notes'), - feature_level('private_notes', 1), - ], - - -// [ -// 'cards', -// t('Cards'), -// t('Create personal planning cards'), -// false, -// get_config('feature_lock','cards'), -// feature_level('cards',1), -// ], - - - [ - 'articles', - t('Articles'), - t('Create interactive articles'), - false, - get_config('feature_lock', 'articles'), - feature_level('articles', 1), - ], - -// [ -// 'nav_channel_select', -// t('Navigation Channel Select'), -// t('Change channels directly from within the navigation dropdown menu'), -// false, -// get_config('feature_lock','nav_channel_select'), -// feature_level('nav_channel_select',3), -// ], - - [ - 'photo_location', - t('Photo Location'), - t('If location data is available on uploaded photos, link this to a map.'), - false, - get_config('feature_lock', 'photo_location'), - feature_level('photo_location', 2), - ], - - -// [ -// 'ajaxchat', -// t('Access Controlled Chatrooms'), -// t('Provide chatrooms and chat services with access control.'), -// true, -// get_config('feature_lock','ajaxchat'), -// feature_level('ajaxchat',1), -// ], - - -// [ -// 'smart_birthdays', -// t('Smart Birthdays'), -// t('Make birthday events timezone aware in case your friends are scattered across the planet.'), -// true, -// get_config('feature_lock','smart_birthdays'), -// feature_level('smart_birthdays',2), -// ], - - [ - 'event_tz_select', - t('Event Timezone Selection'), - t('Allow event creation in timezones other than your own.'), - false, - get_config('feature_lock', 'event_tz_select'), - feature_level('event_tz_select', 2), - ], - - -// [ -// 'premium_channel', -// t('Premium Channel'), -// t('Allows you to set restrictions and terms on those that connect with your channel'), -// false, -// get_config('feature_lock','premium_channel'), -// feature_level('premium_channel',4), -// ], - - [ - 'advanced_dirsearch', - t('Advanced Directory Search'), - t('Allows creation of complex directory search queries'), - false, - get_config('feature_lock', 'advanced_dirsearch'), - feature_level('advanced_dirsearch', 4), - ], - - [ - 'advanced_theming', - t('Advanced Theme and Layout Settings'), - t('Allows fine tuning of themes and page layouts'), - false, - get_config('feature_lock', 'advanced_theming'), - feature_level('advanced_theming', 4), - ], - ], - - - 'access_control' => [ - t('Access Control and Permissions'), - - [ - 'groups', - t('Privacy Groups'), - t('Enable management and selection of privacy groups'), - false, - get_config('feature_lock', 'groups'), - feature_level('groups', 0), - ], - -// [ -// 'multi_profiles', -// t('Multiple Profiles'), -// t('Ability to create multiple profiles'), -// false, -// get_config('feature_lock','multi_profiles'), -// feature_level('multi_profiles',3), -// ], - - - [ - 'permcats', - t('Permission Categories'), - t('Create custom connection permission limits'), - true, - get_config('feature_lock','permcats'), - feature_level('permcats',2), - ], - -// [ -// 'oauth_clients', -// t('OAuth1 Clients'), -// t('Manage OAuth1 authenticatication tokens for mobile and remote apps.'), -// false, -// get_config('feature_lock','oauth_clients'), -// feature_level('oauth_clients',1), -// ], - - [ - 'oauth2_clients', - t('OAuth2 Clients'), - t('Manage OAuth2 authenticatication tokens for mobile and remote apps.'), - false, - get_config('feature_lock', 'oauth2_clients'), - feature_level('oauth2_clients', 1), - ], - -// [ -// 'access_tokens', -// t('Access Tokens'), -// t('Create access tokens so that non-members can access private content.'), -// false, -// get_config('feature_lock','access_tokens'), -// feature_level('access_tokens',2), -// ], - - ], - - // Post composition - 'composition' => [ - - t('Post Composition Features'), - -// [ -// 'large_photos', -// t('Large Photos'), -// t('Include large (1024px) photo thumbnails in posts. If not enabled, use small (640px) photo thumbnails'), -// false, -// get_config('feature_lock','large_photos'), -// feature_level('large_photos',1), -// ], - -// [ -// 'channel_sources', -// t('Channel Sources'), -// t('Automatically import channel content from other channels or feeds'), -// false, -// get_config('feature_lock','channel_sources'), -// feature_level('channel_sources',3), -// ], - - [ - 'content_encrypt', - t('Browser Encryption'), - t('Provide optional browser-to-browser encryption of content with a shared secret key'), - true, - get_config('feature_lock', 'content_encrypt'), - feature_level('content_encrypt', 3), - ], - -// [ -// 'consensus_tools', -// t('Enable Voting Tools'), -// t('Provide a class of post which others can vote on'), -// false, -// get_config('feature_lock','consensus_tools'), -// feature_level('consensus_tools',3), -// ], - -// [ -// 'disable_comments', -// t('Disable Comments'), -// t('Provide the option to disable comments for a post'), -// false, -// get_config('feature_lock','disable_comments'), -// feature_level('disable_comments',2), -// ], - -// [ -// 'delayed_posting', -// t('Delayed Posting'), -// t('Allow posts to be published at a later date'), -// false, -// get_config('feature_lock','delayed_posting'), -// feature_level('delayed_posting',2), -// ], - -// [ -// 'content_expire', -// t('Content Expiration'), -// t('Remove posts/comments and/or private messages at a future time'), -// false, -// get_config('feature_lock','content_expire'), -// feature_level('content_expire',1), -// ], - - [ - 'suppress_duplicates', - t('Suppress Duplicate Posts/Comments'), - t('Prevent posts with identical content to be published with less than two minutes in between submissions.'), - true, - get_config('feature_lock', 'suppress_duplicates'), - feature_level('suppress_duplicates', 1), - ], - - [ - 'auto_save_draft', - t('Auto-save drafts of posts and comments'), - t('Automatically saves post and comment drafts in local browser storage to help prevent accidental loss of compositions'), - true, - get_config('feature_lock', 'auto_save_draft'), - feature_level('auto_save_draft', 1), - ], - - ], - - // Network Tools - 'net_module' => [ - - t('Network and Stream Filtering'), - - [ - 'archives', - t('Search by Date'), - t('Ability to select posts by date ranges'), - false, - get_config('feature_lock', 'archives'), - feature_level('archives', 1), - ], - - - [ - 'savedsearch', - t('Saved Searches'), - t('Save search terms for re-use'), - false, - get_config('feature_lock', 'savedsearch'), - feature_level('savedsearch', 2), - ], - - [ - 'order_tab', - t('Alternate Stream Order'), - t('Ability to order the stream by last post date, last comment date or unthreaded activities'), - false, - get_config('feature_lock', 'order_tab'), - feature_level('order_tab', 2), - ], - - [ - 'name_tab', - t('Contact Filter'), - t('Ability to display only posts of a selected contact'), - false, - get_config('feature_lock', 'name_tab'), - feature_level('name_tab', 1), - ], - - [ - 'forums_tab', - t('Forum Filter'), - t('Ability to display only posts of a specific forum'), - false, - get_config('feature_lock', 'forums_tab'), - feature_level('forums_tab', 1), - ], - - [ - 'personal_tab', - t('Personal Posts Filter'), - t('Ability to display only posts that you\'ve interacted on'), - false, - get_config('feature_lock', 'personal_tab'), - feature_level('personal_tab', 1), - ], - - [ - 'affinity', - t('Affinity Tool'), - t('Filter stream activity by depth of relationships'), - false, - get_config('feature_lock', 'affinity'), - feature_level('affinity', 1), - ], - - [ - 'suggest', - t('Suggest Channels'), - t('Show friend and connection suggestions'), - false, - get_config('feature_lock', 'suggest'), - feature_level('suggest', 1), - ], - - [ - 'connfilter', - t('Connection Filtering'), - t('Filter incoming posts from connections based on keywords/content'), - false, - get_config('feature_lock', 'connfilter'), - feature_level('connfilter', 3), - ], - - - ], - - // Item tools - 'tools' => [ - - t('Post/Comment Tools'), - - [ - 'commtag', - t('Community Tagging'), - t('Ability to tag existing posts'), - false, - get_config('feature_lock', 'commtag'), - feature_level('commtag', 1), - ], - - [ - 'categories', - t('Post Categories'), - t('Add categories to your posts'), - false, - get_config('feature_lock', 'categories'), - feature_level('categories', 1), - ], - - [ - 'emojis', - t('Emoji Reactions'), - t('Add emoji reaction ability to posts'), - true, - get_config('feature_lock', 'emojis'), - feature_level('emojis', 1), - ], - - [ - 'filing', - t('Saved Folders'), - t('Ability to file posts under folders'), - false, - get_config('feature_lock', 'filing'), - feature_level('filing', 2), - ], - - [ - 'dislike', - t('Dislike Posts'), - t('Ability to dislike posts/comments'), - false, - get_config('feature_lock', 'dislike'), - feature_level('dislike', 1), - ], - -// [ -// 'star_posts', -// t('Star Posts'), -// t('Ability to mark special posts with a star indicator'), -// false, -// get_config('feature_lock','star_posts'), -// feature_level('star_posts',1), -// ], -// - [ - 'tagadelic', - t('Tag Cloud'), - t('Provide a personal tag cloud on your channel page'), - false, - get_config('feature_lock', 'tagadelic'), - feature_level('tagadelic', 2), - ], - ], - ]; - - $x = [ 'features' => $arr, ]; - call_hooks('get_features', $x); - - $arr = $x['features']; - - // removed any locked features and remove the entire category if this makes it empty - - if ($filtered) { - $narr = []; - foreach ($arr as $k => $x) { - $narr[$k] = [ $arr[$k][0] ]; - $has_items = false; - for ($y = 0; $y < count($arr[$k]); $y++) { - $disabled = false; - if (is_array($arr[$k][$y])) { - if ($arr[$k][$y][4] !== false) { - $disabled = true; - } - if (! $disabled) { - $has_items = true; - $narr[$k][$y] = $arr[$k][$y]; - } - } - } - if (! $has_items) { - unset($narr[$k]); - } - } - } else { - $narr = $arr; - } - - return $narr; -} diff --git a/include/text.php b/include/text.php index 297672b6a..eba02ed3e 100644 --- a/include/text.php +++ b/include/text.php @@ -1046,7 +1046,7 @@ function search($s, $id = 'search-box', $url = '/search', $save = false) '$action_url' => z_root() . $url, '$search_label' => t('Search'), '$save_label' => t('Save'), - '$savedsearch' => feature_enabled(local_channel(), 'savedsearch') + '$savedsearch' => Features::enabled(local_channel(), 'savedsearch') )); } @@ -1059,7 +1059,7 @@ function searchbox($s, $id = 'search-box', $url = '/search', $save = false) '$action_url' => z_root() . '/' . $url, '$search_label' => t('Search'), '$save_label' => t('Save'), - '$savedsearch' => ($save && feature_enabled(local_channel(), 'savedsearch')) + '$savedsearch' => ($save && Features::enabled(local_channel(), 'savedsearch')) )); } diff --git a/install/schema_mysql.sql b/install/schema_mysql.sql index f99bdd739..7aa27cfff 100644 --- a/install/schema_mysql.sql +++ b/install/schema_mysql.sql @@ -161,7 +161,6 @@ CREATE TABLE IF NOT EXISTS `atoken` ( KEY `atoken_guid` (`atoken_guid`), KEY `atoken_aid` (`atoken_aid`), KEY `atoken_uid` (`atoken_uid`), - KEY `atoken_uid_2` (`atoken_uid`), KEY `atoken_name` (`atoken_name`), KEY `atoken_token` (`atoken_token`), KEY `atoken_expires` (`atoken_expires`) diff --git a/view/theme/redbasic/php/config.php b/view/theme/redbasic/php/config.php index 15302f2f1..d23d7620a 100644 --- a/view/theme/redbasic/php/config.php +++ b/view/theme/redbasic/php/config.php @@ -85,7 +85,7 @@ class RedbasicConfig { function form($arr) { - if(feature_enabled(local_channel(),'advanced_theming')) + if(Features::enabled(local_channel(),'advanced_theming')) $expert = 1;