Skip to content

Commit 9c2cb1d

Browse files
committed
Update for 3.3.2 and drop support for 3.2.x
1 parent 9c25b86 commit 9c2cb1d

File tree

3 files changed

+68
-40
lines changed

3 files changed

+68
-40
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[phpBBasic](https://www.davidiq.com/support/viewtopic.php?f=19&t=685)
22

3-
# phpBBasic Extension for phpBB 3.2.x & 3.3.x
3+
# phpBBasic Extension for phpBB 3.3.x
44
phpBB Extension to add single forum setup to a phpBB installation, with all topics visible on the forum's index page.
55

66
## Installation

composer.json

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
1-
{
2-
"name": "davidiq/phpbbasic",
3-
"type": "phpbb-extension",
4-
"description": "Simplifies phpBB to a single forum where all posts are shown on the main index page.",
5-
"homepage": "https://www.phpbb.com/customise/db/extension/phpbbasic/",
6-
"version": "2.1.0",
7-
"keywords": ["phpbb", "extension", "basic", "singleforum"],
8-
"license": "GPL-2.0-only",
9-
"authors": [
10-
{
11-
"name": "David Colón",
12-
"email": "[email protected]",
13-
"homepage": "http://www.davidiq.com",
14-
"role": "Developer"
15-
}
16-
],
17-
"require": {
18-
"php": ">=7.0",
19-
"composer/installers": "~1.0"
20-
},
21-
"require-dev": {
22-
"phpbb/epv": "dev-ascraeus"
23-
},
24-
"extra": {
25-
"display-name": "phpBBasic",
26-
"soft-require": {
27-
"phpbb/phpbb": ">=3.2.9,<4.0"
28-
},
29-
"version-check": {
30-
"host": "www.phpbb.com",
31-
"directory": "/customise/db/extension/phpbbasic",
32-
"filename": "version_check"
33-
}
34-
}
35-
}
1+
{
2+
"name": "davidiq/phpbbasic",
3+
"type": "phpbb-extension",
4+
"description": "Simplifies phpBB to a single forum where all posts are shown on the main index page.",
5+
"homepage": "https://www.phpbb.com/customise/db/extension/phpbbasic/",
6+
"version": "2.2.0",
7+
"keywords": ["phpbb", "extension", "basic", "singleforum", "phpbbasic"],
8+
"license": "GPL-2.0-only",
9+
"authors": [
10+
{
11+
"name": "David Colón",
12+
"email": "[email protected]",
13+
"homepage": "http://www.davidiq.com",
14+
"role": "Developer"
15+
}
16+
],
17+
"require": {
18+
"php": ">=7.0",
19+
"composer/installers": "~1.0"
20+
},
21+
"require-dev": {
22+
"phpbb/epv": "dev-ascraeus"
23+
},
24+
"extra": {
25+
"display-name": "phpBBasic",
26+
"soft-require": {
27+
"phpbb/phpbb": ">=3.3.0"
28+
},
29+
"version-check": {
30+
"host": "www.phpbb.com",
31+
"directory": "/customise/db/extension/phpbbasic",
32+
"filename": "version_check"
33+
}
34+
}
35+
}

event/listener.php

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ public function display_single_forum($event)
534534
'S_SELECT_SORT_DIR' => $s_sort_dir,
535535
'S_SELECT_SORT_KEY' => $s_sort_key,
536536
'S_SELECT_SORT_DAYS' => $s_limit_days,
537-
'S_TOPIC_ICONS' => ($s_display_active && sizeof($active_forum_ary)) ? max($active_forum_ary['enable_icons']) : (($forum_data['enable_icons']) ? true : false),
537+
'S_TOPIC_ICONS' => ($s_display_active && count($active_forum_ary)) ? max($active_forum_ary['enable_icons']) : (($forum_data['enable_icons']) ? true : false),
538538
'U_WATCH_FORUM_LINK' => $this->viewforum_swap($s_watching_forum['link']),
539539
'U_WATCH_FORUM_TOGGLE' => $this->viewforum_swap($s_watching_forum['link_toggle']),
540540
'S_WATCH_FORUM_TITLE' => $s_watching_forum['title'],
@@ -765,7 +765,7 @@ public function display_single_forum($event)
765765
else
766766
{
767767
$get_forum_ids = array_diff($active_forum_ary['forum_id'], $active_forum_ary['exclude_forum_id']);
768-
$sql_where = (sizeof($get_forum_ids)) ? $this->db->sql_in_set('t.forum_id', $get_forum_ids) : 't.forum_id = ' . $forum_id;
768+
$sql_where = (count($get_forum_ids)) ? $this->db->sql_in_set('t.forum_id', $get_forum_ids) : 't.forum_id = ' . $forum_id;
769769
}
770770

771771
// Grab just the sorted topic ids
@@ -835,6 +835,26 @@ public function display_single_forum($event)
835835
'WHERE' => $this->db->sql_in_set('t.topic_id', $topic_list),
836836
);
837837

838+
/**
839+
* Event to modify the SQL query before obtaining topics/stickies
840+
*
841+
* @event core.viewforum_modify_topic_list_sql
842+
* @var int forum_id The forum ID
843+
* @var array forum_data Data about the forum
844+
* @var array topic_list Topic ids array
845+
* @var array sql_array SQL query array for obtaining topics/stickies
846+
*
847+
* @since 3.2.10-RC1
848+
* @since 3.3.1-RC1
849+
*/
850+
$vars = [
851+
'forum_id',
852+
'forum_data',
853+
'topic_list',
854+
'sql_array',
855+
];
856+
extract($this->phpbb_dispatcher->trigger_event('core.viewforum_modify_topic_list_sql', compact($vars)));
857+
838858
// If store_reverse, then first obtain topics, then stickies, else the other way around...
839859
// Funnily enough you typically save one query if going from the last page to the middle (store_reverse) because
840860
// the number of stickies are not known
@@ -894,7 +914,7 @@ public function display_single_forum($event)
894914
}
895915

896916
// Do not include those topics the user has no permission to access
897-
if (!$this->auth->acl_get('f_read', $row['forum_id']))
917+
if (!$this->auth->acl_gets('f_read', 'f_list_topics', $row['forum_id']))
898918
{
899919
// We need to remove any trace regarding this topic. :)
900920
unset($rowset[$orig_topic_id]);
@@ -1020,6 +1040,11 @@ public function display_single_forum($event)
10201040

10211041
// Replies
10221042
$replies = $this->phpbb_content_visibility->get_count('topic_posts', $row, $topic_forum_id) - 1;
1043+
// Correction for case of unapproved topic visible to poster
1044+
if ($replies < 0)
1045+
{
1046+
$replies = 0;
1047+
}
10231048

10241049
if ($row['topic_status'] == ITEM_MOVED)
10251050
{
@@ -1203,7 +1228,10 @@ public function generate_forum_nav($event)
12031228
if ($this->phpbbasic_enabled)
12041229
{
12051230
$navlinks = $event['navlinks'];
1206-
$navlinks['U_VIEW_FORUM'] = $this->viewforum_swap($navlinks['U_VIEW_FORUM']);
1231+
if (isset($navlinks['U_VIEW_FORUM']))
1232+
{
1233+
$navlinks['U_VIEW_FORUM'] = $this->viewforum_swap($navlinks['U_VIEW_FORUM']);
1234+
}
12071235
$navlinks['PHPBBASIC_FORUM_BREADCRUMB'] = $navlinks['FORUM_ID'] == $this->phpbbasic_forumid;
12081236
$event['navlinks'] = $navlinks;
12091237
$navlinks_parents = $event['navlinks_parents'];

0 commit comments

Comments
 (0)