-
Notifications
You must be signed in to change notification settings - Fork 7
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
Fixes for search warnings, errors and addressing issue 114 #116
Changes from 2 commits
df8a3bd
04626b4
ae89bf2
a42bb4d
04839f0
883c24d
6d7c494
2a86483
16383ee
e5ad5a6
46e437c
1a141c0
9d6b471
fdd0dbc
66102ce
0d156d4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -144,7 +144,8 @@ public function show() { | |
case "autocomplete": | ||
$afterJS .= $this->autocompleteJS($componentInfo['options']['list'], $componentInfo['options']['real_id'], $componentInfo['options']['fake_id']); | ||
$fakeComponentName = "fake".$componentName; | ||
$displayForm .= "<input type='text' name='".$fakeComponentName."' value='".filterText($_POST[$fakeComponentName])."' ".$dispAttributes." id='".$componentInfo['options']['fake_id']."'><input type='hidden' name='".$componentName."' value='".($componentInfo['value'] ?? '')."' id='".$componentInfo['options']['real_id']."'>"; | ||
$fakeComponentValue = $_POST[$fakeComponentName] ?? ''; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
$displayForm .= "<input type='text' name='".$fakeComponentName."' value='".filterText($fakeComponentValue)."' ".$dispAttributes." id='".$componentInfo['options']['fake_id']."'>"; | ||
break; | ||
case "textarea": | ||
$displayForm .= "<textarea name='".$componentName."' ".$dispAttributes.">".$componentInfo['value']."</textarea>"; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,7 +53,7 @@ | |
$breadcrumbObj->addCrumb("Search Forum"); | ||
|
||
if (count($_GET) > 0) { | ||
$_POST['fakesearchuser'] = $_GET['searchuser']; | ||
$_POST['fakesearchuser'] = $_GET['searchuser'] ?? ''; | ||
$_POST['checkCSRF'] = $_SESSION['csrfKey']; | ||
$_POST['submit'] = true; | ||
$_POST['filtertopics_replies'] = 0; | ||
|
@@ -63,7 +63,7 @@ | |
$_POST['sortresults'] = 0; | ||
$_POST['sortresults_ascdesc'] = 0; | ||
|
||
if (count($_GET['filterboards']) == 0) { | ||
if (count($_GET['filterboards'] ?? []) == 0) { | ||
$_POST['filterboards'][] = 0; | ||
} | ||
|
||
|
@@ -122,9 +122,11 @@ function check_filter_boards() { | |
global $boardObj, $formObj; | ||
|
||
$countErrors = 0; | ||
foreach ($_POST['filterboards'] as $value) { | ||
if (!$boardObj->select($value) && $value != 0) { | ||
$countErrors++; | ||
if (isset($_POST['filterboards']) && is_array($_POST['filterboards'])) { | ||
foreach ($_POST['filterboards'] as $value) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we can get rid of line 125 and for line 126 do |
||
if (!$boardObj->select($value) && $value != 0) { | ||
$countErrors++; | ||
} | ||
} | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -76,7 +76,7 @@ | |
if (trim($_POST['keyword']) != "") { | ||
$_POST['keyword'] = str_replace("%", "\%", $_POST['keyword']); | ||
|
||
if ($_POST['filterkeyword'] == 0) { | ||
if (($_POST['filterkeyword'] ?? 0) == 0) { | ||
$filterKeyword = array("message" => $_POST['keyword'], "title" => $_POST['keyword']); | ||
|
||
$filterResults[] = " (".$postTable.".message LIKE '%".$mysqli->real_escape_string($_POST['keyword'])."%' OR ".$postTable.".title LIKE '%".$mysqli->real_escape_string($_POST['keyword'])."%') "; | ||
|
@@ -88,18 +88,18 @@ | |
// Filter By Username | ||
$filterByUsername = ""; | ||
$memberIDList = array(); | ||
if (trim($_POST['fakesearchuser']) != "") { | ||
$_POST['fakesearchuser'] = str_replace("*", "%", $_POST['fakesearchuser']); | ||
if (trim($_POST['fakesearchuser'] ?? '') != "") { | ||
$_POST['fakesearchuser'] = str_replace("*", "%", $_POST['fakesearchuser']); | ||
|
||
$memberList = $member->get_entries(array("username" => $_POST['fakesearchuser']), "username", true, array("username" => "Like")); | ||
$memberIDList = array(); | ||
$memberList = $member->get_entries(array("username" => $_POST['fakesearchuser']), "username", true, array("username" => "Like")); | ||
$memberIDList = array(); | ||
|
||
foreach ($memberList as $searchMemberInfo) { | ||
$memberIDList[] = $searchMemberInfo['member_id']; | ||
} | ||
|
||
$memberListSQL = "('".implode("','", $memberIDList)."')"; | ||
$filterResults[] = " ".$postTable.".member_id IN ".$memberListSQL; | ||
$memberListSQL = "('".implode("','", $memberIDList)."')"; | ||
$filterResults[] = " ".$postTable.".member_id IN ".$memberListSQL; | ||
|
||
if ($_POST['filterusername'] == 1) { | ||
$topicList = array(); | ||
|
@@ -146,16 +146,18 @@ | |
|
||
// Filter Board | ||
$arrFilterBoards = array(); | ||
if (!in_array(0, $_POST['filterboards'])) { | ||
$arrFilterBoards = $_POST['filterboards']; | ||
$filterBoards = $_POST['filterboards'] ?? []; // Use null coalescing operator to provide a default empty array | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No comment needed here. Since it is just saying the same thing as the code. |
||
|
||
if (!in_array(0, $filterBoards)) { | ||
$arrFilterBoards = $filterBoards; | ||
|
||
if ($_POST['include_subforums'] == 1) { | ||
foreach ($_POST['filterboards'] as $value) { | ||
foreach ($filterBoards as $value) { | ||
$boardObj->select($value); | ||
$arrFilterBoards = array_merge($arrFilterBoards, $boardObj->getAllSubForums()); | ||
} | ||
|
||
$arrFilterBoards = array_unique($arrFilterBoards); | ||
$arrFilterBoards = array_unique($arrFilterBoards); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should delete 1 tab to fix indenting |
||
} | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was it intentional to delete the hidden
<input>
here?