Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ The ExpressionEngine Discussion Forum Module allows you to create and manage a f

## Changelog

### 5.1.3

- Fixed PHP deprecation issues.
- Fixed bug where Superadmin were not given full permissions in rare cases.
- Fixed Invalid reference to PATH_ADDONS ([#5](https://github.com/ExpressionEngine/Forum/issues/5))

### 5.1.2

- Fixed PHP deprecation issues.
Expand Down
9 changes: 7 additions & 2 deletions system/user/addons/forum/Model/Post.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,13 @@ public static function onBeforeBulkDelete($delete_ids)

public static function onAfterBulkDelete()
{
require_once PATH_ADDONS . 'forum/mod.forum.php';
require_once PATH_ADDONS . 'forum/mod.forum_core.php';
foreach(['forum/mod.forum.php', 'forum/mod.forum_core.php'] as $file) {
if (file_exists(PATH_THIRD . $file)) {
require_once PATH_THIRD . $file;
} else {
require_once PATH_ADDONS . $file;
}
}

$forum_core = new \Forum_Core();

Expand Down
9 changes: 7 additions & 2 deletions system/user/addons/forum/Model/Topic.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,13 @@ public static function onBeforeBulkDelete($delete_ids)

public static function onAfterBulkDelete($delete_ids)
{
require_once PATH_ADDONS . 'forum/mod.forum.php';
require_once PATH_ADDONS . 'forum/mod.forum_core.php';
foreach(['forum/mod.forum.php', 'forum/mod.forum_core.php'] as $file) {
if (file_exists(PATH_THIRD . $file)) {
require_once PATH_THIRD . $file;
} else {
require_once PATH_ADDONS . $file;
}
}

$forum_core = new \Forum_Core();

Expand Down
2 changes: 1 addition & 1 deletion system/user/addons/forum/addon.setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
'author_url' => 'https://expressionengine.com/',
'name' => 'Forum',
'description' => 'Add a full-featured forum to your site',
'version' => '5.1.2',
'version' => '5.1.3',
'namespace' => 'ExpressionEngine\Addons\Forum',
'settings_exist' => true,

Expand Down
12 changes: 7 additions & 5 deletions system/user/addons/forum/mod.forum.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
*/
class Forum
{
public $version = '5.1.2';
public $build = '20251119';
public $version = '5.1.3';
public $build = '20260305';
public $use_site_profile = false;
public $search_limit = 250; // Maximum number of search results (x2 since it can include this number of topics + this number of posts)
public $return_data = '';
Expand Down Expand Up @@ -43,6 +43,7 @@ class Forum
public $cur_thread_row = 0;
public $thread_post_total = 0; // Used for new entry submission to determine redirect page number
public $trigger_error_page = false;
public $trigger_login_page = false;
public $is_table_open = false;
public $preview_override = false;
public $mbr_class_loaded = false;
Expand All @@ -53,6 +54,7 @@ class Forum
public $spellcheck_enabled = false;
public $feeds_enabled = null;
public $feed_ids = '';
public $date_limit = '';
public $realm = "ExpressionEngine Forums";
public $auth_attempt = false;
public $use_sess_id = 0; // Used in calls to ee()->functions->fetch_site_index() in certain URLs, like attachments
Expand Down Expand Up @@ -271,12 +273,12 @@ public function display_forum($function = '')

// Parse Snippets
foreach (ee()->config->_global_vars as $key => $val) {
$this->return_data = str_replace(LD . $key . RD, $val, $this->return_data);
$this->return_data = str_replace(LD . $key . RD, ($val === null) ? '' : $val, $this->return_data);
}

// Parse Global Variables
foreach (ee()->TMPL->global_vars as $key => $val) {
$this->return_data = str_replace(LD . $key . RD, $val, $this->return_data);
$this->return_data = str_replace(LD . $key . RD, ($val === null) ? '' : $val, $this->return_data);
}

$this->return_data = $this->_final_prep($this->return_data);
Expand Down Expand Up @@ -938,7 +940,7 @@ public function var_swap($str, $data)
}

foreach ($data as $key => $val) {
$str = str_replace('{' . $key . '}', $val, $str);
$str = str_replace('{' . $key . '}', ($val === null) ? '' : $val, $str);
}

return $str;
Expand Down
12 changes: 7 additions & 5 deletions system/user/addons/forum/mod.forum_core.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,12 @@ public function display_forum($function = '')

// Parse Snippets
foreach (ee()->config->_global_vars as $key => $val) {
$this->return_data = str_replace(LD . $key . RD, $val, $this->return_data);
$this->return_data = str_replace(LD . $key . RD, ($val === null) ? '' : $val, $this->return_data);
}

// Parse Global Variables
foreach (ee()->TMPL->global_vars as $key => $val) {
$this->return_data = str_replace(LD . $key . RD, $val, $this->return_data);
$this->return_data = str_replace(LD . $key . RD, ($val === null) ? '' : $val, $this->return_data);
}

$this->return_data = $this->_final_prep($this->return_data);
Expand Down Expand Up @@ -6180,7 +6180,8 @@ public function move_reply()
}

if (false !== (strpos($new_topic_id, "/"))) {
$new_topic_id = end(explode("/", $new_topic_id));
$new_topic_id_parts = explode("/", $new_topic_id);
$new_topic_id = end($new_topic_id_parts);
}

if (! is_numeric($new_topic_id)) {
Expand Down Expand Up @@ -6491,7 +6492,8 @@ public function do_merge()
}

if (false !== (strpos($merge_id, "/"))) {
$merge_id = end(explode("/", $merge_id));
$merge_id_parts = explode("/", $merge_id);
$merge_id = end($merge_id_parts);
}

if (! is_numeric($merge_id)) {
Expand Down Expand Up @@ -9523,7 +9525,7 @@ public function http_authentication_check_digest($allowed_groups = array())
}

// make sure Super Admins are always allowed
if (! in_array($allowed_groups, 1)) {
if (! in_array(1, $allowed_groups)) {
$allowed_groups[] = 1;
}

Expand Down
9 changes: 7 additions & 2 deletions system/user/addons/forum/spam.forum.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,13 @@ class Forum_spam implements SpamModerationInterface
*/
public function __construct()
{
require_once PATH_ADDONS . 'forum/mod.forum.php';
require_once PATH_ADDONS . 'forum/mod.forum_core.php';
foreach(['forum/mod.forum.php', 'forum/mod.forum_core.php'] as $file) {
if (file_exists(PATH_THIRD . $file)) {
require_once PATH_THIRD . $file;
} else {
require_once PATH_ADDONS . $file;
}
}

$this->fc = new \Forum_Core();
}
Expand Down
9 changes: 7 additions & 2 deletions system/user/addons/forum/tab.forum.php
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,13 @@ public function save($entry, $values)

// Update the forum stats
if (! class_exists('Forum')) {
require PATH_ADDONS . 'forum/mod.forum.php';
require PATH_ADDONS . 'forum/mod.forum_core.php';
foreach(['forum/mod.forum.php', 'forum/mod.forum_core.php'] as $file) {
if (file_exists(PATH_THIRD . $file)) {
require_once PATH_THIRD . $file;
} else {
require_once PATH_ADDONS . $file;
}
}
}

$forum_core = new Forum_Core();
Expand Down