From 6ccffec90695becd92d1144f6cbd9ef72f0d9b51 Mon Sep 17 00:00:00 2001 From: PayBas Date: Sat, 17 May 2014 11:20:37 +0200 Subject: [ticket/12559] Add forum setting to limit subforum legend Squashed all commits, they were basically just typos and errors PHPBB3-12559 --- phpBB/adm/style/acp_forums.html | 5 +++ phpBB/includes/acp/acp_forums.php | 3 ++ phpBB/includes/functions_display.php | 4 +- phpBB/language/en/acp/forums.php | 2 + .../db/migration/data/v310/forums_legend_limit.php | 45 ++++++++++++++++++++++ 5 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 phpBB/phpbb/db/migration/data/v310/forums_legend_limit.php (limited to 'phpBB') diff --git a/phpBB/adm/style/acp_forums.html b/phpBB/adm/style/acp_forums.html index 20bcd2e9f9..f51ce98776 100644 --- a/phpBB/adm/style/acp_forums.html +++ b/phpBB/adm/style/acp_forums.html @@ -210,6 +210,11 @@
+
+

{L_LIMIT_SUBFORUMS_EXPLAIN}
+
+
+

{L_LIST_INDEX_EXPLAIN}
diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php index 572ae3692a..ba3901f67a 100644 --- a/phpBB/includes/acp/acp_forums.php +++ b/phpBB/includes/acp/acp_forums.php @@ -132,6 +132,7 @@ class acp_forums 'forum_image' => $request->variable('forum_image', ''), 'forum_style' => $request->variable('forum_style', 0), 'display_subforum_list' => $request->variable('display_subforum_list', true), + 'display_subforum_limit'=> $request->variable('display_subforum_limit', false), 'display_on_index' => $request->variable('display_on_index', true), 'forum_topics_per_page' => $request->variable('topics_per_page', 0), 'enable_indexing' => $request->variable('enable_indexing', true), @@ -454,6 +455,7 @@ class acp_forums 'forum_image' => '', 'forum_style' => 0, 'display_subforum_list' => true, + 'display_subforum_limit' => false, 'display_on_index' => true, 'forum_topics_per_page' => 0, 'enable_indexing' => true, @@ -676,6 +678,7 @@ class acp_forums 'S_ENABLE_INDEXING' => ($forum_data['enable_indexing']) ? true : false, 'S_TOPIC_ICONS' => ($forum_data['enable_icons']) ? true : false, 'S_DISPLAY_SUBFORUM_LIST' => ($forum_data['display_subforum_list']) ? true : false, + 'S_DISPLAY_SUBFORUM_LIMIT' => ($forum_data['display_subforum_limit']) ? true : false, 'S_DISPLAY_ON_INDEX' => ($forum_data['display_on_index']) ? true : false, 'S_PRUNE_ENABLE' => ($forum_data['enable_prune']) ? true : false, 'S_PRUNE_SHADOW_ENABLE' => ($forum_data['enable_shadow_prune']) ? true : false, diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 1ac18fd3f8..1311148e8d 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -30,6 +30,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod $forum_rows = $subforums = $forum_ids = $forum_ids_moderator = $forum_moderators = $active_forum_ary = array(); $parent_id = $visible_forums = 0; + $parent_subforum_limit = false; // Mark forums read? $mark_read = $request->variable('mark', ''); @@ -266,6 +267,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod // Direct child of current branch $parent_id = $forum_id; + $parent_subforum_limit = $row['display_subforum_limit']; $forum_rows[$forum_id] = $row; if ($row['forum_type'] == FORUM_CAT && $row['parent_id'] == $root_data['forum_id']) @@ -278,7 +280,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod } else if ($row['forum_type'] != FORUM_CAT) { - $subforums[$parent_id][$forum_id]['display'] = ($row['display_on_index']) ? true : false; + $subforums[$parent_id][$forum_id]['display'] = ($row['display_on_index'] && !($parent_subforum_limit && $parent_id !== $row['parent_id'])) ? true : false; $subforums[$parent_id][$forum_id]['name'] = $row['forum_name']; $subforums[$parent_id][$forum_id]['orig_forum_last_post_time'] = $row['forum_last_post_time']; $subforums[$parent_id][$forum_id]['children'] = array(); diff --git a/phpBB/language/en/acp/forums.php b/phpBB/language/en/acp/forums.php index d92d3f8c9e..3ab152345c 100644 --- a/phpBB/language/en/acp/forums.php +++ b/phpBB/language/en/acp/forums.php @@ -129,6 +129,8 @@ $lang = array_merge($lang, array( 'GENERAL_FORUM_SETTINGS' => 'General forum settings', 'LINK' => 'Link', + 'LIMIT_SUBFORUMS' => 'Limit legend to direct child-subforums', + 'LIMIT_SUBFORUMS_EXPLAIN' => 'Limits the subforums to be displayed to subforums that are direct descendants (children) of the current forum. Disabling this will display all subforums with the “List subforums in legend” option enabled, regardless of depth.', 'LIST_INDEX' => 'List subforum in parent-forum’s legend', 'LIST_INDEX_EXPLAIN' => 'Displays this forum on the index and elsewhere as a link within the legend of its parent-forum if the parent-forum’s “List subforums in legend” option is enabled.', 'LIST_SUBFORUMS' => 'List subforums in legend', diff --git a/phpBB/phpbb/db/migration/data/v310/forums_legend_limit.php b/phpBB/phpbb/db/migration/data/v310/forums_legend_limit.php new file mode 100644 index 0000000000..9bc8ad9044 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/forums_legend_limit.php @@ -0,0 +1,45 @@ +db_tools->sql_column_exists($this->table_prefix . 'forums', 'display_subforum_limit'); + } + + static public function depends_on() + { + return array('\phpbb\db\migration\data\v310\beta3'); + } + + public function update_schema() + { + return array( + 'add_columns' => array( + $this->table_prefix . 'forums' => array( + 'display_subforum_limit' => array('BOOL', 0, 'after' => 'display_subforum_list'), + ), + ), + ); + } + + public function revert_schema() + { + return array( + 'drop_columns' => array( + $this->table_prefix . 'forums' => array( + 'display_subforum_limit', + ), + ), + ); + } +} -- cgit v1.2.1 From c2997ada7aa4d8f63880ea68723266d7cedb4899 Mon Sep 17 00:00:00 2001 From: PayBas Date: Wed, 28 May 2014 23:16:38 +0200 Subject: [ticket/12559] Applied DeMorgan and removed unnecessary true:false PHPBB3-12559 --- phpBB/includes/functions_display.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 1311148e8d..73281b88a1 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -280,7 +280,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod } else if ($row['forum_type'] != FORUM_CAT) { - $subforums[$parent_id][$forum_id]['display'] = ($row['display_on_index'] && !($parent_subforum_limit && $parent_id !== $row['parent_id'])) ? true : false; + $subforums[$parent_id][$forum_id]['display'] = ($row['display_on_index'] && (!$parent_subforum_limit || $parent_id == $row['parent_id'])); $subforums[$parent_id][$forum_id]['name'] = $row['forum_name']; $subforums[$parent_id][$forum_id]['orig_forum_last_post_time'] = $row['forum_last_post_time']; $subforums[$parent_id][$forum_id]['children'] = array(); -- cgit v1.2.1 From b14c7c351104634990c80e64f58e3e28ea5826e0 Mon Sep 17 00:00:00 2001 From: PayBas Date: Fri, 30 May 2014 16:51:16 +0200 Subject: [ticket/12559] Updated copyright information PHPBB3-12559 --- phpBB/phpbb/db/migration/data/v310/forums_legend_limit.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'phpBB') diff --git a/phpBB/phpbb/db/migration/data/v310/forums_legend_limit.php b/phpBB/phpbb/db/migration/data/v310/forums_legend_limit.php index 9bc8ad9044..c37fc7d3df 100644 --- a/phpBB/phpbb/db/migration/data/v310/forums_legend_limit.php +++ b/phpBB/phpbb/db/migration/data/v310/forums_legend_limit.php @@ -1,9 +1,13 @@ +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. * */ -- cgit v1.2.1 From e2de342d3ac53909a5c78f08100152d03a58f3bf Mon Sep 17 00:00:00 2001 From: PayBas Date: Tue, 10 Feb 2015 15:02:36 +0100 Subject: [ticket/12559] Update migration dependencies PHPBB3-12559 --- .../db/migration/data/v310/forums_legend_limit.php | 49 ---------------------- .../db/migration/data/v31x/forums_legend_limit.php | 49 ++++++++++++++++++++++ 2 files changed, 49 insertions(+), 49 deletions(-) delete mode 100644 phpBB/phpbb/db/migration/data/v310/forums_legend_limit.php create mode 100644 phpBB/phpbb/db/migration/data/v31x/forums_legend_limit.php (limited to 'phpBB') diff --git a/phpBB/phpbb/db/migration/data/v310/forums_legend_limit.php b/phpBB/phpbb/db/migration/data/v310/forums_legend_limit.php deleted file mode 100644 index c37fc7d3df..0000000000 --- a/phpBB/phpbb/db/migration/data/v310/forums_legend_limit.php +++ /dev/null @@ -1,49 +0,0 @@ - -* @license GNU General Public License, version 2 (GPL-2.0) -* -* For full copyright and license information, please see -* the docs/CREDITS.txt file. -* -*/ - -namespace phpbb\db\migration\data\v310; - -class forums_legend_limit extends \phpbb\db\migration\migration -{ - public function effectively_installed() - { - return $this->db_tools->sql_column_exists($this->table_prefix . 'forums', 'display_subforum_limit'); - } - - static public function depends_on() - { - return array('\phpbb\db\migration\data\v310\beta3'); - } - - public function update_schema() - { - return array( - 'add_columns' => array( - $this->table_prefix . 'forums' => array( - 'display_subforum_limit' => array('BOOL', 0, 'after' => 'display_subforum_list'), - ), - ), - ); - } - - public function revert_schema() - { - return array( - 'drop_columns' => array( - $this->table_prefix . 'forums' => array( - 'display_subforum_limit', - ), - ), - ); - } -} diff --git a/phpBB/phpbb/db/migration/data/v31x/forums_legend_limit.php b/phpBB/phpbb/db/migration/data/v31x/forums_legend_limit.php new file mode 100644 index 0000000000..f2024bdaf9 --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v31x/forums_legend_limit.php @@ -0,0 +1,49 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v31x; + +class forums_legend_limit extends \phpbb\db\migration\migration +{ + public function effectively_installed() + { + return $this->db_tools->sql_column_exists($this->table_prefix . 'forums', 'display_subforum_limit'); + } + + static public function depends_on() + { + return array('\phpbb\db\migration\data\v31x\v313'); + } + + public function update_schema() + { + return array( + 'add_columns' => array( + $this->table_prefix . 'forums' => array( + 'display_subforum_limit' => array('BOOL', 0, 'after' => 'display_subforum_list'), + ), + ), + ); + } + + public function revert_schema() + { + return array( + 'drop_columns' => array( + $this->table_prefix . 'forums' => array( + 'display_subforum_limit', + ), + ), + ); + } +} -- cgit v1.2.1 From 729e2f5d0865d843e804d1a97205df1e5f273bbd Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Fri, 1 Nov 2019 16:52:02 +0100 Subject: [ticket/12559] Move migration to v330 folder PHPBB3-12559 --- .../db/migration/data/v31x/forums_legend_limit.php | 49 ---------------------- .../db/migration/data/v330/forums_legend_limit.php | 49 ++++++++++++++++++++++ 2 files changed, 49 insertions(+), 49 deletions(-) delete mode 100644 phpBB/phpbb/db/migration/data/v31x/forums_legend_limit.php create mode 100644 phpBB/phpbb/db/migration/data/v330/forums_legend_limit.php (limited to 'phpBB') diff --git a/phpBB/phpbb/db/migration/data/v31x/forums_legend_limit.php b/phpBB/phpbb/db/migration/data/v31x/forums_legend_limit.php deleted file mode 100644 index f2024bdaf9..0000000000 --- a/phpBB/phpbb/db/migration/data/v31x/forums_legend_limit.php +++ /dev/null @@ -1,49 +0,0 @@ - -* @license GNU General Public License, version 2 (GPL-2.0) -* -* For full copyright and license information, please see -* the docs/CREDITS.txt file. -* -*/ - -namespace phpbb\db\migration\data\v31x; - -class forums_legend_limit extends \phpbb\db\migration\migration -{ - public function effectively_installed() - { - return $this->db_tools->sql_column_exists($this->table_prefix . 'forums', 'display_subforum_limit'); - } - - static public function depends_on() - { - return array('\phpbb\db\migration\data\v31x\v313'); - } - - public function update_schema() - { - return array( - 'add_columns' => array( - $this->table_prefix . 'forums' => array( - 'display_subforum_limit' => array('BOOL', 0, 'after' => 'display_subforum_list'), - ), - ), - ); - } - - public function revert_schema() - { - return array( - 'drop_columns' => array( - $this->table_prefix . 'forums' => array( - 'display_subforum_limit', - ), - ), - ); - } -} diff --git a/phpBB/phpbb/db/migration/data/v330/forums_legend_limit.php b/phpBB/phpbb/db/migration/data/v330/forums_legend_limit.php new file mode 100644 index 0000000000..45b6547ede --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v330/forums_legend_limit.php @@ -0,0 +1,49 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v330; + +class forums_legend_limit extends \phpbb\db\migration\migration +{ + public function effectively_installed() + { + return $this->db_tools->sql_column_exists($this->table_prefix . 'forums', 'display_subforum_limit'); + } + + static public function depends_on() + { + return array('\phpbb\db\migration\data\v330\v330b1'); + } + + public function update_schema() + { + return array( + 'add_columns' => array( + $this->table_prefix . 'forums' => array( + 'display_subforum_limit' => array('BOOL', 0, 'after' => 'display_subforum_list'), + ), + ), + ); + } + + public function revert_schema() + { + return array( + 'drop_columns' => array( + $this->table_prefix . 'forums' => array( + 'display_subforum_limit', + ), + ), + ); + } +} -- cgit v1.2.1 From 85837d48b20c63f86050d0125942b25928deb1a5 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Mon, 4 Nov 2019 17:31:18 +0100 Subject: [ticket/12559] Use short array syntax PHPBB3-12559 --- .../db/migration/data/v330/forums_legend_limit.php | 28 +++++++++++----------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'phpBB') diff --git a/phpBB/phpbb/db/migration/data/v330/forums_legend_limit.php b/phpBB/phpbb/db/migration/data/v330/forums_legend_limit.php index 45b6547ede..c5a4beef38 100644 --- a/phpBB/phpbb/db/migration/data/v330/forums_legend_limit.php +++ b/phpBB/phpbb/db/migration/data/v330/forums_legend_limit.php @@ -22,28 +22,28 @@ class forums_legend_limit extends \phpbb\db\migration\migration static public function depends_on() { - return array('\phpbb\db\migration\data\v330\v330b1'); + return ['\phpbb\db\migration\data\v330\v330b1']; } public function update_schema() { - return array( - 'add_columns' => array( - $this->table_prefix . 'forums' => array( - 'display_subforum_limit' => array('BOOL', 0, 'after' => 'display_subforum_list'), - ), - ), - ); + return [ + 'add_columns' => [ + $this->table_prefix . 'forums' => [ + 'display_subforum_limit' => ['BOOL', 0, 'after' => 'display_subforum_list'], + ], + ], + ]; } public function revert_schema() { - return array( - 'drop_columns' => array( - $this->table_prefix . 'forums' => array( + return [ + 'drop_columns' => [ + $this->table_prefix . 'forums' => [ 'display_subforum_limit', - ), - ), - ); + ], + ], + ]; } } -- cgit v1.2.1