Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix certain warnings with PHP8 #19

Merged
merged 4 commits into from Dec 21, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Expand Up @@ -19,11 +19,11 @@ on:
jobs:
# START Basic Checks Job (EPV, code sniffer, images check, etc.)
basic-checks:
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
strategy:
matrix:
include:
- php: '7.1'
- php: '7.2'
db: "none"
NOTESTS: 1

Expand Down
2 changes: 1 addition & 1 deletion controller/admin_controller.php
Expand Up @@ -483,7 +483,7 @@ public function delete_category($category_id)
}
else
{
confirm_box(false, $this->lang->lang('ACP_DELETE_CATEGORY_CONFIRM'));
confirm_box(false, $this->lang->lang('ACP_KNOWLEDGEBASE_DELETE_CATEGORY_CONFIRM'));
}
}
else
Expand Down
24 changes: 22 additions & 2 deletions controller/main_controller.php
Expand Up @@ -858,11 +858,31 @@ public function display($page)
// Log the action
if ($mode == 'post' || $mode == 'post_preview')
{
$this->log->add('user', $this->user->data['user_id'], $this->user->data['session_ip'], 'ACP_KNOWLEDGEBASE_ARTICLE_CREATED_LOG', time(), array($title));
$this->log->add(
'user',
$this->user->data['user_id'],
$this->user->data['session_ip'],
'ACP_KNOWLEDGEBASE_ARTICLE_CREATED_LOG',
time(),
[
$title,
'reportee_id' => $this->user->data['user_id'],
]
);
}
if ($mode == 'edit' || $mode == 'edit_preview')
{
$this->log->add('user', $this->user->data['user_id'], $this->user->data['session_ip'], 'ACP_KNOWLEDGEBASE_ARTICLE_EDITED_LOG', time(), array($title));
$this->log->add(
'user',
$this->user->data['user_id'],
$this->user->data['session_ip'],
'ACP_KNOWLEDGEBASE_ARTICLE_EDITED_LOG',
time(),
[
$title,
'reportee_id' => $this->user->data['user_id'],
]
);
}

// Set correct url, show message to users unable to post without approval
Expand Down
5 changes: 4 additions & 1 deletion entity/functions.php
Expand Up @@ -249,6 +249,7 @@ public function set_description($description)
*/
public function description_bbcode_enabled()
{
$this->data['bbcode_options'] = $this->data['bbcode_options'] ?? 0;
return ($this->data['bbcode_options'] & OPTION_FLAG_BBCODE);
}

Expand Down Expand Up @@ -286,6 +287,7 @@ public function description_disable_bbcode()
*/
public function description_magic_url_enabled()
{
$this->data['bbcode_options'] = $this->data['bbcode_options'] ?? 0;
return ($this->data['bbcode_options'] & OPTION_FLAG_LINKS);
}

Expand Down Expand Up @@ -323,6 +325,7 @@ public function description_disable_magic_url()
*/
public function description_smilies_enabled()
{
$this->data['bbcode_options'] = $this->data['bbcode_options'] ?? 0;
return ($this->data['bbcode_options'] & OPTION_FLAG_SMILIES);
}

Expand Down Expand Up @@ -361,7 +364,7 @@ public function description_disable_smilies()
protected function set_description_option($option_value, $negate = false, $reparse_description = true)
{
// Set bbcode_options to 0 if it does not yet exist
$this->data['bbcode_options'] = isset($this->data['bbcode_options']) ? $this->data['bbcode_options'] : 0;
$this->data['bbcode_options'] = $this->data['bbcode_options'] ?? 0;

// If we're setting the option and the option is not already set
if (!$negate && !($this->data['bbcode_options'] & $option_value))
Expand Down