Skip to content

Commit

Permalink
Update for 3.3.2 and drop support for 3.2.x
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidIQ committed Dec 12, 2020
1 parent 9c25b86 commit 9c2cb1d
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 40 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[phpBBasic](https://www.davidiq.com/support/viewtopic.php?f=19&t=685)

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

## Installation
Expand Down
70 changes: 35 additions & 35 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
{
"name": "davidiq/phpbbasic",
"type": "phpbb-extension",
"description": "Simplifies phpBB to a single forum where all posts are shown on the main index page.",
"homepage": "https://www.phpbb.com/customise/db/extension/phpbbasic/",
"version": "2.1.0",
"keywords": ["phpbb", "extension", "basic", "singleforum"],
"license": "GPL-2.0-only",
"authors": [
{
"name": "David Colón",
"email": "[email protected]",
"homepage": "http://www.davidiq.com",
"role": "Developer"
}
],
"require": {
"php": ">=7.0",
"composer/installers": "~1.0"
},
"require-dev": {
"phpbb/epv": "dev-ascraeus"
},
"extra": {
"display-name": "phpBBasic",
"soft-require": {
"phpbb/phpbb": ">=3.2.9,<4.0"
},
"version-check": {
"host": "www.phpbb.com",
"directory": "/customise/db/extension/phpbbasic",
"filename": "version_check"
}
}
}
{
"name": "davidiq/phpbbasic",
"type": "phpbb-extension",
"description": "Simplifies phpBB to a single forum where all posts are shown on the main index page.",
"homepage": "https://www.phpbb.com/customise/db/extension/phpbbasic/",
"version": "2.2.0",
"keywords": ["phpbb", "extension", "basic", "singleforum", "phpbbasic"],
"license": "GPL-2.0-only",
"authors": [
{
"name": "David Colón",
"email": "[email protected]",
"homepage": "http://www.davidiq.com",
"role": "Developer"
}
],
"require": {
"php": ">=7.0",
"composer/installers": "~1.0"
},
"require-dev": {
"phpbb/epv": "dev-ascraeus"
},
"extra": {
"display-name": "phpBBasic",
"soft-require": {
"phpbb/phpbb": ">=3.3.0"
},
"version-check": {
"host": "www.phpbb.com",
"directory": "/customise/db/extension/phpbbasic",
"filename": "version_check"
}
}
}
36 changes: 32 additions & 4 deletions event/listener.php
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ public function display_single_forum($event)
'S_SELECT_SORT_DIR' => $s_sort_dir,
'S_SELECT_SORT_KEY' => $s_sort_key,
'S_SELECT_SORT_DAYS' => $s_limit_days,
'S_TOPIC_ICONS' => ($s_display_active && sizeof($active_forum_ary)) ? max($active_forum_ary['enable_icons']) : (($forum_data['enable_icons']) ? true : false),
'S_TOPIC_ICONS' => ($s_display_active && count($active_forum_ary)) ? max($active_forum_ary['enable_icons']) : (($forum_data['enable_icons']) ? true : false),
'U_WATCH_FORUM_LINK' => $this->viewforum_swap($s_watching_forum['link']),
'U_WATCH_FORUM_TOGGLE' => $this->viewforum_swap($s_watching_forum['link_toggle']),
'S_WATCH_FORUM_TITLE' => $s_watching_forum['title'],
Expand Down Expand Up @@ -765,7 +765,7 @@ public function display_single_forum($event)
else
{
$get_forum_ids = array_diff($active_forum_ary['forum_id'], $active_forum_ary['exclude_forum_id']);
$sql_where = (sizeof($get_forum_ids)) ? $this->db->sql_in_set('t.forum_id', $get_forum_ids) : 't.forum_id = ' . $forum_id;
$sql_where = (count($get_forum_ids)) ? $this->db->sql_in_set('t.forum_id', $get_forum_ids) : 't.forum_id = ' . $forum_id;
}

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

/**
* Event to modify the SQL query before obtaining topics/stickies
*
* @event core.viewforum_modify_topic_list_sql
* @var int forum_id The forum ID
* @var array forum_data Data about the forum
* @var array topic_list Topic ids array
* @var array sql_array SQL query array for obtaining topics/stickies
*
* @since 3.2.10-RC1
* @since 3.3.1-RC1
*/
$vars = [
'forum_id',
'forum_data',
'topic_list',
'sql_array',
];
extract($this->phpbb_dispatcher->trigger_event('core.viewforum_modify_topic_list_sql', compact($vars)));

// If store_reverse, then first obtain topics, then stickies, else the other way around...
// Funnily enough you typically save one query if going from the last page to the middle (store_reverse) because
// the number of stickies are not known
Expand Down Expand Up @@ -894,7 +914,7 @@ public function display_single_forum($event)
}

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

// Replies
$replies = $this->phpbb_content_visibility->get_count('topic_posts', $row, $topic_forum_id) - 1;
// Correction for case of unapproved topic visible to poster
if ($replies < 0)
{
$replies = 0;
}

if ($row['topic_status'] == ITEM_MOVED)
{
Expand Down Expand Up @@ -1203,7 +1228,10 @@ public function generate_forum_nav($event)
if ($this->phpbbasic_enabled)
{
$navlinks = $event['navlinks'];
$navlinks['U_VIEW_FORUM'] = $this->viewforum_swap($navlinks['U_VIEW_FORUM']);
if (isset($navlinks['U_VIEW_FORUM']))
{
$navlinks['U_VIEW_FORUM'] = $this->viewforum_swap($navlinks['U_VIEW_FORUM']);
}
$navlinks['PHPBBASIC_FORUM_BREADCRUMB'] = $navlinks['FORUM_ID'] == $this->phpbbasic_forumid;
$event['navlinks'] = $navlinks;
$navlinks_parents = $event['navlinks_parents'];
Expand Down

0 comments on commit 9c2cb1d

Please sign in to comment.