Skip to content

Commit

Permalink
Ticket #1430 - Mature-audience content filter (PG, PG13, R)
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonLV committed Jan 26, 2022
1 parent cf4ace2 commit a9ec821
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 3 deletions.
15 changes: 15 additions & 0 deletions install/sql/system.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1165,6 +1165,9 @@ CREATE TABLE IF NOT EXISTS `sys_profiles` (
`account_id` int(10) unsigned NOT NULL,
`type` varchar(32) NOT NULL,
`content_id` int(10) unsigned NOT NULL,
`cfw_value` int(10) unsigned NOT NULL DEFAULT '0',
`cfw_items` int(10) unsigned NOT NULL DEFAULT '0',
`cfu_items` int(10) unsigned NOT NULL DEFAULT '0',
`status` enum('active','pending','suspended') NOT NULL DEFAULT 'active',
PRIMARY KEY (`id`),
UNIQUE KEY `account_type_content` (`account_id`,`type`,`content_id`),
Expand Down Expand Up @@ -3805,6 +3808,7 @@ INSERT INTO `sys_form_pre_lists`(`key`, `title`, `module`, `use_for_sets`, `exte
('sys_report_types', '_sys_pre_lists_report_types', 'system', '0', '0'),
('sys_vote_reactions', '_sys_pre_lists_vote_reactions', 'system', '0', '0'),
('sys_relations', '_sys_pre_lists_relations', 'system', '0', '1'),
('sys_content_filter', '_sys_pre_lists_content_filter', 'system', '1', '0'),

('sys_studio_widget_types', '_sys_pre_lists_studio_widget_types', 'system', '0', '0');

Expand Down Expand Up @@ -4162,6 +4166,13 @@ INSERT INTO `sys_form_pre_values`(`Key`, `Value`, `Order`, `LKey`, `LKey2`, `Dat
('sys_relations', '7', 7, '_sys_pre_lists_relations_brother', '', 'a:2:{i:0;s:1:"7";i:1;s:1:"8";}'),
('sys_relations', '8', 8, '_sys_pre_lists_relations_sister', '', 'a:2:{i:0;s:1:"7";i:1;s:1:"8";}');

INSERT INTO `sys_form_pre_values`(`Key`, `Value`, `Order`, `LKey`, `LKey2`, `Data`) VALUES
('sys_content_filter', 1, 1, '_sys_pre_lists_content_filter_g', '', ''),
('sys_content_filter', 2, 2, '_sys_pre_lists_content_filter_pg', '', 'a:2:{s:16:"is_allowed_watch";a:4:{s:6:"module";s:6:"system";s:6:"method";s:25:"is_allowed_content_filter";s:6:"params";a:2:{i:0;s:5:"watch";i:1;s:7:"{value}";}s:5:"class";s:12:"BaseServices";}s:14:"is_allowed_use";a:4:{s:6:"module";s:6:"system";s:6:"method";s:25:"is_allowed_content_filter";s:6:"params";a:2:{i:0;s:3:"use";i:1;s:7:"{value}";}s:5:"class";s:12:"BaseServices";}}'),
('sys_content_filter', 3, 3, '_sys_pre_lists_content_filter_pg13', '', 'a:2:{s:16:"is_allowed_watch";a:4:{s:6:"module";s:6:"system";s:6:"method";s:25:"is_allowed_content_filter";s:6:"params";a:2:{i:0;s:5:"watch";i:1;s:7:"{value}";}s:5:"class";s:12:"BaseServices";}s:14:"is_allowed_use";a:4:{s:6:"module";s:6:"system";s:6:"method";s:25:"is_allowed_content_filter";s:6:"params";a:2:{i:0;s:3:"use";i:1;s:7:"{value}";}s:5:"class";s:12:"BaseServices";}}'),
('sys_content_filter', 4, 4, '_sys_pre_lists_content_filter_r', '', 'a:2:{s:16:"is_allowed_watch";a:4:{s:6:"module";s:6:"system";s:6:"method";s:25:"is_allowed_content_filter";s:6:"params";a:2:{i:0;s:5:"watch";i:1;s:7:"{value}";}s:5:"class";s:12:"BaseServices";}s:14:"is_allowed_use";a:4:{s:6:"module";s:6:"system";s:6:"method";s:25:"is_allowed_content_filter";s:6:"params";a:2:{i:0;s:3:"use";i:1;s:7:"{value}";}s:5:"class";s:12:"BaseServices";}}'),
('sys_content_filter', 5, 5, '_sys_pre_lists_content_filter_x', '', 'a:2:{s:16:"is_allowed_watch";a:4:{s:6:"module";s:6:"system";s:6:"method";s:25:"is_allowed_content_filter";s:6:"params";a:2:{i:0;s:5:"watch";i:1;s:7:"{value}";}s:5:"class";s:12:"BaseServices";}s:14:"is_allowed_use";a:4:{s:6:"module";s:6:"system";s:6:"method";s:25:"is_allowed_content_filter";s:6:"params";a:2:{i:0;s:3:"use";i:1;s:7:"{value}";}s:5:"class";s:12:"BaseServices";}}');

INSERT INTO `sys_form_pre_values`(`Key`, `Value`, `Order`, `LKey`, `LKey2`, `Data`) VALUES
('sys_studio_widget_types', '', 1, '_sys_pre_lists_studio_widget_types_library', '', 'a:1:{s:4:"icon";s:15:"lmi-library.svg";}'),
('sys_studio_widget_types', 'appearance', 2, '_sys_pre_lists_studio_widget_types_appearance', '', 'a:1:{s:4:"icon";s:18:"lmi-appearance.svg";}'),
Expand Down Expand Up @@ -4397,6 +4408,7 @@ INSERT INTO `sys_menu_items` (`set_name`, `module`, `name`, `title_system`, `tit
('sys_account_settings', 'system', 'account-settings-info', '_sys_menu_item_title_system_account_settings_info', '_sys_menu_item_title_account_settings_info', 'page.php?i=account-settings-info', '', '', 'info-circle', '', 2147483646, 1, 1, 2),
('sys_account_settings', 'system', 'account-settings-email', '_sys_menu_item_title_system_account_settings_email', '_sys_menu_item_title_account_settings_email', 'page.php?i=account-settings-email', '', '', 'envelope', '', 2147483646, 1, 1, 3),
('sys_account_settings', 'system', 'account-settings-password', '_sys_menu_item_title_system_account_settings_pwd', '_sys_menu_item_title_account_settings_pwd', 'page.php?i=account-settings-password', '', '', 'key', '', 2147483646, 1, 1, 4),
('sys_account_settings', 'system', 'profile-settings-cfilter', '_sys_menu_item_title_system_profile_settings_cfilter', '_sys_menu_item_title_profile_settings_cfilter', 'page.php?i=profile-settings-cfilter', '', '', 'filter', '', 2147483646, 1, 1, 5),
('sys_account_settings', 'system', 'account-settings-delete', '_sys_menu_item_title_system_account_settings_delete', '_sys_menu_item_title_account_settings_delete', 'page.php?i=account-settings-delete', '', '', 'remove', '', 2147483646, 1, 1, 9999);

-- account dashboard
Expand Down Expand Up @@ -5172,6 +5184,7 @@ INSERT INTO `sys_objects_page` (`object`, `uri`, `title_system`, `title`, `modul
('sys_account_settings_info', 'account-settings-info', '_sys_page_title_system_account_settings_info', '_sys_page_title_account_settings_info', 'system', 1, 5, '', 2147483647, 1, 'page.php?i=account-settings-info', '', '', '', 0, 1, 0, 'BxTemplPageAccount', '', 0),
('sys_account_settings_delete', 'account-settings-delete', '_sys_page_title_system_account_settings_delete', '_sys_page_title_account_settings_delete', 'system', 1, 5, '', 2147483647, 1, 'page.php?i=account-settings-delete', '', '', '', 0, 1, 0, 'BxTemplPageAccount', '', 0),
('sys_account_profile_switcher', 'account-profile-switcher', '_sys_page_title_system_account_profile_switcher', '_sys_page_title_account_profile_switcher', 'system', 1, 5, '', 2147483647, 1, 'page.php?i=account-profile-switcher', '', '', '', 0, 1, 0, 'BxTemplPageAccount', '', 0),
('sys_profile_settings_cfilter', 'profile-settings-cfilter', '_sys_page_title_system_profile_settings_cfilter', '_sys_page_title_profile_settings_cfilter', 'system', 1, 5, '', 2147483647, 1, 'page.php?i=profile-settings-cfilter', '', '', '', 0, 1, 0, '', '', 0),
('sys_unsubscribe_notifications', 'unsubscribe-notifications', '_sys_page_title_system_unsubscribe_notifications', '_sys_page_title_unsubscribe_notifications', 'system', 1, 5, '', 2147483647, 1, 'page.php?i=unsubscribe-notifications', '', '', '', 0, 1, 0, '', '', 0),
('sys_unsubscribe_news', 'unsubscribe-news', '_sys_page_title_system_unsubscribe_news', '_sys_page_title_unsubscribe_news', 'system', 1, 5, '', 2147483647, 1, 'page.php?i=unsubscribe-news', '', '', '', 0, 1, 0, '', '', 0),
('sys_std_dashboard', '', '_sys_page_title_system_studio_dashboard', '_sys_page_title_studio_dashboard', 'system', 1, 4, '', 2147483647, 1, '', '', '', '', 0, 1, 0, '', '', 0),
Expand Down Expand Up @@ -5389,6 +5402,8 @@ INSERT INTO `sys_pages_blocks` (`object`, `cell_id`, `module`, `title_system`, `

('sys_account_profile_switcher', 1, 'system', '', '_sys_page_block_title_account_profile_switcher', 11, 0, 0, 2147483647, 'service', 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:24:"account_profile_switcher";s:6:"params";a:0:{}s:5:"class";s:20:"TemplServiceProfiles";}', 0, 1, 1, 2),

('sys_profile_settings_cfilter', 1, 'system', '', '_sys_page_block_title_profile_settings_cfilter', 11, 0, 0, 2147483647, 'service', 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:24:"profile_settings_cfilter";s:6:"params";a:0:{}s:5:"class";s:20:"TemplServiceProfiles";}', 0, 1, 1, 2),

('sys_unsubscribe_notifications', 1, 'system', '', '_sys_page_block_title_unsubscribe_notifications', 11, 0, 0, 2147483647, 'service', 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:25:"unsubscribe_notifications";s:6:"params";a:0:{}s:5:"class";s:19:"TemplServiceAccount";}', 0, 1, 1, 1),

('sys_unsubscribe_news', 1, 'system', '', '_sys_page_block_title_unsubscribe_news', 11, 0, 0, 2147483647, 'service', 'a:4:{s:6:"module";s:6:"system";s:6:"method";s:16:"unsubscribe_news";s:6:"params";a:0:{}s:5:"class";s:19:"TemplServiceAccount";}', 0, 1, 1, 1),
Expand Down
11 changes: 11 additions & 0 deletions modules/boonex/english/data/langs/system/en.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2727,6 +2727,7 @@ If it is not enabled then please consider implement this optimization, since it
<string name="_sys_menu_item_title_account_settings_email"><![CDATA[Email]]></string>
<string name="_sys_menu_item_title_account_settings_info"><![CDATA[Account]]></string>
<string name="_sys_menu_item_title_account_settings_pwd"><![CDATA[Password]]></string>
<string name="_sys_menu_item_title_profile_settings_cfilter"><![CDATA[Content Filter]]></string>
<string name="_sys_menu_item_title_add_content"><![CDATA[Add...]]></string>
<string name="_sys_menu_item_title_cart"><![CDATA[Shopping Cart]]></string>
<string name="_sys_menu_item_title_cmts_administration"><![CDATA[Comments]]></string>
Expand Down Expand Up @@ -2816,6 +2817,7 @@ If it is not enabled then please consider implement this optimization, since it
<string name="_sys_menu_item_title_system_account_settings_email"><![CDATA[Email]]></string>
<string name="_sys_menu_item_title_system_account_settings_info"><![CDATA[Account]]></string>
<string name="_sys_menu_item_title_system_account_settings_pwd"><![CDATA[Password]]></string>
<string name="_sys_menu_item_title_system_profile_settings_cfilter"><![CDATA[Content Filter]]></string>
<string name="_sys_menu_item_title_system_add_content"><![CDATA[Add Content]]></string>
<string name="_sys_menu_item_title_system_apps"><![CDATA[Apps]]></string>
<string name="_sys_menu_item_title_system_cart"><![CDATA[Shopping Cart]]></string>
Expand Down Expand Up @@ -3062,6 +3064,7 @@ If it is not enabled then please consider implement this optimization, since it
<string name="_sys_page_block_title_account_settings_info"><![CDATA[Edit Account]]></string>
<string name="_sys_page_block_title_account_settings_menu"><![CDATA[Account Settings]]></string>
<string name="_sys_page_block_title_account_settings_pwd"><![CDATA[Change Password]]></string>
<string name="_sys_page_block_title_profile_settings_cfilter"><![CDATA[Content Filter]]></string>
<string name="_sys_page_block_title_add_content"><![CDATA[Add Content]]></string>
<string name="_sys_page_block_title_chart_growth"><![CDATA[Growth Charts]]></string>
<string name="_sys_page_block_title_chart_stats"><![CDATA[Content]]></string>
Expand Down Expand Up @@ -3124,6 +3127,7 @@ If it is not enabled then please consider implement this optimization, since it
<string name="_sys_page_title_account_settings_email"><![CDATA[Email Settings]]></string>
<string name="_sys_page_title_account_settings_info"><![CDATA[Edit Account]]></string>
<string name="_sys_page_title_account_settings_pwd"><![CDATA[Change Password]]></string>
<string name="_sys_page_title_profile_settings_cfilter"><![CDATA[Content Filter]]></string>
<string name="_sys_page_title_add_content"><![CDATA[Add Content]]></string>
<string name="_sys_page_title_cmts_administration"><![CDATA[Manage Comments]]></string>
<string name="_sys_page_title_audit_administration"><![CDATA[Audit]]></string>
Expand All @@ -3147,6 +3151,7 @@ If it is not enabled then please consider implement this optimization, since it
<string name="_sys_page_title_system_account_settings_email"><![CDATA[Email Settings]]></string>
<string name="_sys_page_title_system_account_settings_info"><![CDATA[Edit Account]]></string>
<string name="_sys_page_title_system_account_settings_pwd"><![CDATA[Change Password]]></string>
<string name="_sys_page_title_system_profile_settings_cfilter"><![CDATA[Content Filter]]></string>
<string name="_sys_page_title_system_add_content"><![CDATA[Add Content]]></string>
<string name="_sys_page_title_system_cmts_view"><![CDATA[View Comment]]></string>
<string name="_sys_page_title_system_cmts_administration"><![CDATA[Manage Comments]]></string>
Expand Down Expand Up @@ -3186,6 +3191,12 @@ If it is not enabled then please consider implement this optimization, since it
<string name="_sys_paginate_info"><![CDATA[{0}-{1}]]></string>
<string name="_sys_paginate_view_all"><![CDATA[View All]]></string>
<string name="_sys_please_select"><![CDATA[Please select...]]></string>
<string name="_sys_pre_lists_content_filter"><![CDATA[Content filter]]></string>
<string name="_sys_pre_lists_content_filter_g"><![CDATA[G]]></string>
<string name="_sys_pre_lists_content_filter_pg"><![CDATA[PG]]></string>
<string name="_sys_pre_lists_content_filter_pg13"><![CDATA[PG-13]]></string>
<string name="_sys_pre_lists_content_filter_r"><![CDATA[R]]></string>
<string name="_sys_pre_lists_content_filter_x"><![CDATA[X]]></string>
<string name="_sys_pre_lists_relations"><![CDATA[Relationships]]></string>
<string name="_sys_pre_lists_relations_husband"><![CDATA[husband]]></string>
<string name="_sys_pre_lists_relations_wife"><![CDATA[wife]]></string>
Expand Down
12 changes: 11 additions & 1 deletion modules/boonex/russian/data/langs/system/ru.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2713,6 +2713,7 @@
<string name="_sys_menu_item_title_account_settings_email"><![CDATA[Email]]></string>
<string name="_sys_menu_item_title_account_settings_info"><![CDATA[Аккаунт]]></string>
<string name="_sys_menu_item_title_account_settings_pwd"><![CDATA[Пароль]]></string>
<string name="_sys_menu_item_title_profile_settings_cfilter"><![CDATA[Фильтр контента]]></string>
<string name="_sys_menu_item_title_add_content"><![CDATA[Добавить...]]></string>
<string name="_sys_menu_item_title_cart"><![CDATA[Корзина]]></string>
<string name="_sys_menu_item_title_cmts_administration"><![CDATA[Комментарии]]></string>
Expand Down Expand Up @@ -2789,12 +2790,12 @@
<string name="_sys_menu_item_title_account_dashboard_reports"><![CDATA[Жалобы]]></string>
<string name="_sys_menu_item_title_system_account_dashboard_audit"><![CDATA[Аудит]]></string>
<string name="_sys_menu_item_title_account_dashboard_audit"><![CDATA[Аудит]]></string>

<string name="_sys_menu_item_title_system_account_settings"><![CDATA[Настройки]]></string>
<string name="_sys_menu_item_title_system_account_settings_delete"><![CDATA[Удалить]]></string>
<string name="_sys_menu_item_title_system_account_settings_email"><![CDATA[Email]]></string>
<string name="_sys_menu_item_title_system_account_settings_info"><![CDATA[Аккаунт]]></string>
<string name="_sys_menu_item_title_system_account_settings_pwd"><![CDATA[Пароль]]></string>
<string name="_sys_menu_item_title_system_profile_settings_cfilter"><![CDATA[Фильтр контента]]></string>
<string name="_sys_menu_item_title_system_add_content"><![CDATA[Добавить Содержимое]]></string>
<string name="_sys_menu_item_title_system_apps"><![CDATA[Приложения]]></string>
<string name="_sys_menu_item_title_system_cart"><![CDATA[Корзина]]></string>
Expand Down Expand Up @@ -3030,6 +3031,7 @@
<string name="_sys_page_block_title_account_settings_info"><![CDATA[Редактировать аккаунт]]></string>
<string name="_sys_page_block_title_account_settings_menu"><![CDATA[Аккаунт - Настройки]]></string>
<string name="_sys_page_block_title_account_settings_pwd"><![CDATA[Изменить пароль]]></string>
<string name="_sys_page_block_title_profile_settings_cfilter"><![CDATA[Фильтр контента]]></string>
<string name="_sys_page_block_title_add_content"><![CDATA[Добавить содержимое]]></string>
<string name="_sys_page_block_title_chart_growth"><![CDATA[Диаграммы развития]]></string>
<string name="_sys_page_block_title_chart_stats"><![CDATA[Содержимое]]></string>
Expand Down Expand Up @@ -3089,6 +3091,7 @@
<string name="_sys_page_title_account_settings_email"><![CDATA[Настройки email-а]]></string>
<string name="_sys_page_title_account_settings_info"><![CDATA[Редактировать аккаунт]]></string>
<string name="_sys_page_title_account_settings_pwd"><![CDATA[Изменить пароль]]></string>
<string name="_sys_page_title_profile_settings_cfilter"><![CDATA[Фильтр контента]]></string>
<string name="_sys_page_title_add_content"><![CDATA[Добавить содержимое]]></string>
<string name="_sys_page_title_cmts_administration"><![CDATA[Управление комментариями]]></string>
<string name="_sys_page_title_audit_administration"><![CDATA[Аудит]]></string>
Expand All @@ -3112,6 +3115,7 @@
<string name="_sys_page_title_system_account_settings_email"><![CDATA[Email настройки]]></string>
<string name="_sys_page_title_system_account_settings_info"><![CDATA[Редактировать аккаунт]]></string>
<string name="_sys_page_title_system_account_settings_pwd"><![CDATA[Изменить пароль]]></string>
<string name="_sys_page_title_system_profile_settings_cfilter"><![CDATA[Фильтр контента]]></string>
<string name="_sys_page_title_system_add_content"><![CDATA[Добавить содержимое]]></string>
<string name="_sys_page_title_system_cmts_view"><![CDATA[Просмотр комментария]]></string>
<string name="_sys_page_title_system_cmts_administration"><![CDATA[Управление комментариями]]></string>
Expand Down Expand Up @@ -3151,6 +3155,12 @@
<string name="_sys_paginate_info"><![CDATA[{0}-{1}]]></string>
<string name="_sys_paginate_view_all"><![CDATA[Просмотреть все]]></string>
<string name="_sys_please_select"><![CDATA[Пожалуйста, выберите...]]></string>
<string name="_sys_pre_lists_content_filter"><![CDATA[Фильтр контента]]></string>
<string name="_sys_pre_lists_content_filter_g"><![CDATA[G]]></string>
<string name="_sys_pre_lists_content_filter_pg"><![CDATA[PG]]></string>
<string name="_sys_pre_lists_content_filter_pg13"><![CDATA[PG-13]]></string>
<string name="_sys_pre_lists_content_filter_r"><![CDATA[R]]></string>
<string name="_sys_pre_lists_content_filter_x"><![CDATA[X]]></string>
<string name="_sys_pre_lists_relations"><![CDATA[Отношения]]></string>
<string name="_sys_pre_lists_relations_husband"><![CDATA[муж]]></string>
<string name="_sys_pre_lists_relations_wife"><![CDATA[жена]]></string>
Expand Down
17 changes: 16 additions & 1 deletion template/scripts/BxBaseServiceProfiles.php
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,22 @@ public function serviceAccountProfileSwitcher ($iAccountId = false, $iActiveProf
);
}

protected function _getIcon ($sIcon)
public function serviceProfileSettingsCfilter()
{
// set settings submenu
$oMenuSubmenu = BxDolMenu::getObjectInstance('sys_site_submenu');
if ($oMenuSubmenu) {
$oMenuSubmenu->setObjectSubmenu('sys_account_settings_submenu', array (
'title' => _t('_sys_menu_item_title_account_settings'),
'link' => BX_DOL_URL_ROOT . 'member.php',
'icon' => '',
));
}

return 'Filter would be here!';
}

protected function _getIcon ($sIcon)
{
return BxTemplFunctions::getInstance()->getIcon($sIcon);
}
Expand Down
7 changes: 6 additions & 1 deletion template/scripts/BxBaseServices.php
Original file line number Diff line number Diff line change
Expand Up @@ -1073,7 +1073,12 @@ public function serviceGetBadge($aBadge, $bIsCompact = false)
)
);
}


public function serviceIsAllowedContentFilter($sAction, $iValue)
{

}

private function _getSearchObject()
{
$sClass = 'BxTemplSearch';
Expand Down

0 comments on commit a9ec821

Please sign in to comment.