Skip to content

Commit 0453206

Browse files
fix PHP warnings
1 parent 65a2651 commit 0453206

File tree

8 files changed

+67
-73
lines changed

8 files changed

+67
-73
lines changed

src/classes/form.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ public function show() {
153153
$afterJS .= $this->richTextboxJS($componentInfo['attributes']['id'], $componentInfo['allowHTML'] ?? '');
154154
$displayForm .= "
155155
<div class='formInput' style='width: 100%'>
156-
<textarea name='".$componentName."' ".$dispAttributes.">".$componentInfo['value']."</textarea>
156+
<textarea name='".$componentName."' ".$dispAttributes.">".($componentInfo['value'] ?? '')."</textarea>
157157
</div>
158158
";
159159
$countRichTextbox++;
@@ -195,7 +195,7 @@ public function show() {
195195
break;
196196
case "checkbox": // Checkbox and radio are basically same thing, so checkbox falls through to radio section
197197
case "radio":
198-
if(is_array($componentInfo['options'])) {
198+
if(is_array(($componentInfo['options'] ?? ''))) {
199199
$componentCounter = 1;
200200
foreach($componentInfo['options'] as $optionValue => $displayValue) {
201201
$dispSelected = "";
@@ -224,7 +224,7 @@ public function show() {
224224
else {
225225

226226
$dispChecked = "";
227-
if($componentInfo['checked']) {
227+
if(($componentInfo['checked'] ?? '')) {
228228
$dispChecked = " checked";
229229
}
230230

@@ -344,7 +344,7 @@ public function show() {
344344
}
345345

346346
if(!$this->isContainer) {
347-
echo "<form ".$dispFormAttributes.">".$this->wrapper[0].$dispErrors.$this->description."<div class='formTable'>".$displayForm."</div>".$this->wrapper[1]."<input type='hidden' name='checkCSRF' value='".$_SESSION['csrfKey']."'></form>";
347+
echo "<form ".$dispFormAttributes.">".($this->wrapper[0] ?? '').$dispErrors.$this->description."<div class='formTable'>".$displayForm."</div>".($this->wrapper[1] ?? '')."<input type='hidden' name='checkCSRF' value='".$_SESSION['csrfKey']."'></form>";
348348
}
349349

350350

src/classes/forumboard.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ public function memberIsMod($memberID, $returnForumModeratorID=false) {
254254
}
255255

256256
}
257-
$this->memberID = $memberid;
257+
$this->memberID = $memberID;
258258
return $returnVal;
259259

260260
}
@@ -388,7 +388,7 @@ public function getAllBoards() {
388388
$arrReturn = array_unique(array_merge($arrReturn, $this->getAllSubForums()));
389389
}
390390

391-
$this->select($intTableKeyValue);
391+
$this->select(($intTableKeyValue ?? ''));
392392

393393

394394
return $arrReturn;

src/classes/member.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ function select($memberID, $numericIDOnly = true) {
7272

7373
function authorizeLogin($check_password, $encryptPW=0) {
7474

75-
$checkRealPassword = $this->arrObjInfo['password'];
76-
$checkRealPassword2 = $this->arrObjInfo['password2'];
75+
$checkRealPassword = ($this->arrObjInfo['password'] ?? '');
76+
$checkRealPassword2 = ($this->arrObjInfo['password2'] ?? '');
7777

7878
if($encryptPW == 1) {
7979

@@ -86,7 +86,7 @@ function authorizeLogin($check_password, $encryptPW=0) {
8686

8787
$returnVal = false;
8888

89-
if($checkRealPassword == $checkPass && $this->arrObjInfo['disabled'] == 0) {
89+
if($checkRealPassword == $checkPass && ($this->arrObjInfo['disabled'] ?? '') == 0) {
9090
$returnVal = true;
9191
}
9292

src/classes/news.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,13 +283,13 @@ public function getPosts($postType="") {
283283

284284
private function determinePrivateNewsStatus() {
285285
$member = new Member($this->MySQL);
286-
$member->select($_SESSION['btUsername']);
286+
$member->select(($_SESSION['btUsername'] ?? ''));
287287
$consoleObj = new ConsoleOption($this->MySQL);
288288

289289
$privateNewsCID = $consoleObj->findConsoleIDByName("View Private News");
290290
$consoleObj->select($privateNewsCID);
291291

292-
$this->blnViewPrivateNews = ($member->authorizeLogin($_SESSION['btPassword']) && $member->hasAccess($consoleObj));
292+
$this->blnViewPrivateNews = ($member->authorizeLogin(($_SESSION['btPassword'] ?? '')) && $member->hasAccess($consoleObj));
293293
}
294294

295295
public function getHTMLNewsConsole() {

src/forum/templates/post.php

Lines changed: 50 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -125,64 +125,59 @@
125125
<div class='forumPostPosterInfo'></div>
126126
<div class='forumPostMessageExtras'>
127127
";
128+
129+
$arrAttachments = $this->getPostAttachments();
130+
131+
if(count($arrAttachments) > 0 && $blnShowAttachments) {
132+
echo "
133+
<div class='forumAttachmentsContainer'>
134+
<b>Attachments:</b><br>
135+
";
136+
137+
foreach($arrAttachments as $downloadID) {
138+
$attachmentObj->select($downloadID);
139+
$attachmentInfo = $attachmentObj->get_info_filtered();
140+
$addS = ($attachmentInfo['downloadcount'] != 1) ? "s" : "";
141+
$dispFileSize = $attachmentInfo['filesize']/1024;
128142

129-
$arrAttachments = $this->getPostAttachments();
130-
131-
if(count($arrAttachments) > 0 && $blnShowAttachments) {
132-
echo "
133-
<div class='forumAttachmentsContainer'>
134-
<b>Attachments:</b><br>
135-
";
136-
137-
foreach($arrAttachments as $downloadID) {
138-
$attachmentObj->select($downloadID);
139-
$attachmentInfo = $attachmentObj->get_info_filtered();
140-
$addS = ($attachmentInfo['downloadcount'] != 1) ? "s" : "";
141-
$dispFileSize = $attachmentInfo['filesize']/1024;
142-
143-
if($dispFileSize < 1) {
144-
$dispFileSize = $attachmentInfo['filesize']."B";
145-
}
146-
elseif(($dispFileSize/1024) < 1) {
147-
$dispFileSize = round($dispFileSize, 2)."KB";
148-
}
149-
else {
150-
$dispFileSize = round(($dispFileSize/1024),2)."MB";
151-
}
152-
153-
echo "<a href='".$MAIN_ROOT."downloads/file.php?dID=".$downloadID."'>".$attachmentInfo['filename']."</a> - downloaded ".$attachmentInfo['downloadcount']." time".$addS." - ".$dispFileSize."<br>";
154-
143+
if($dispFileSize < 1) {
144+
$dispFileSize = $attachmentInfo['filesize']."B";
155145
}
156-
157-
echo "
158-
</div>
159-
";
160-
}
161-
162-
163-
if($postMemberInfo['forumsignature'] != "" && $websiteInfo['forum_hidesignatures'] == 0) {
146+
elseif(($dispFileSize/1024) < 1) {
147+
$dispFileSize = round($dispFileSize, 2)."KB";
148+
}
149+
else {
150+
$dispFileSize = round(($dispFileSize/1024),2)."MB";
151+
}
152+
153+
echo "<a href='".$MAIN_ROOT."downloads/file.php?dID=".$downloadID."'>".$attachmentInfo['filename']."</a> - downloaded ".$attachmentInfo['downloadcount']." time".$addS." - ".$dispFileSize."<br>";
154+
155+
}
156+
164157
echo "
165-
<div class='forumSignatureContainer'>".parseBBCode($posterMemberObj->get_info("forumsignature"))."</div>
166-
";
167-
}
168-
169-
echo "<div class='forumManageLinks'>";
170-
if($this->blnManageable || $postMemberInfo['member_id'] == $memberInfo['member_id']) {
171-
172-
echo "&raquo; <a href='".$MAIN_ROOT."members/console.php?cID=".$intManagePostsCID."&pID=".$postInfo['forumpost_id']."'>EDIT POST</a> &laquo;&nbsp&nbsp;&nbsp;";
173-
echo "&raquo; <a href='javascript:void(0)' onclick=\"deletePost('".$postInfo['forumpost_id']."')\">DELETE POST</a> &laquo;&nbsp&nbsp;&nbsp;";
174-
$countManagablePosts++;
175-
176-
}
177-
178-
if(LOGGED_IN && $topicInfo['lockstatus'] == 0) {
179-
echo "&raquo; <a href='".$MAIN_ROOT."members/console.php?cID=".$intPostTopicCID."&bID=".$topicInfo['forumboard_id']."&tID=".$topicInfo['forumtopic_id']."&quote=".$postInfo['forumpost_id']."'>QUOTE</a> &laquo;";
180-
}
181-
158+
</div>
159+
";
160+
}
182161

162+
163+
if($postMemberInfo['forumsignature'] != "" && $websiteInfo['forum_hidesignatures'] == 0) {
183164
echo "
184-
</div>
185-
</div>
186-
</div>";
165+
<div class='forumSignatureContainer'>".parseBBCode($posterMemberObj->get_info("forumsignature"))."</div>
166+
";
167+
}
168+
169+
echo "<div class='forumManageLinks'>";
170+
if($this->blnManageable || $postMemberInfo['member_id'] == $memberInfo['member_id']) {
171+
172+
echo "&raquo; <a href='".$MAIN_ROOT."members/console.php?cID=".$intManagePostsCID."&pID=".$postInfo['forumpost_id']."'>EDIT POST</a> &laquo;&nbsp&nbsp;&nbsp;";
173+
echo "&raquo; <a href='javascript:void(0)' onclick=\"deletePost('".$postInfo['forumpost_id']."')\">DELETE POST</a> &laquo;&nbsp&nbsp;&nbsp;";
174+
}
175+
176+
if(LOGGED_IN && ($topicInfo['lockstatus'] ?? '') == 0) {
177+
echo "&raquo; <a href='".$MAIN_ROOT."members/console.php?cID=".$intPostTopicCID."&bID=".$topicInfo['forumboard_id']."&tID=".$topicInfo['forumtopic_id']."&quote=".$postInfo['forumpost_id']."'>QUOTE</a> &laquo;";
178+
}
187179

188-
?>
180+
echo "
181+
</div>
182+
</div>
183+
</div>";

src/forum/viewtopic.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -417,5 +417,4 @@ function deletePost(intPostID) {
417417

418418
}
419419

420-
require_once($prevFolder."themes/".$THEME."/_footer.php");
421-
?>
420+
require_once($prevFolder."themes/".$THEME."/_footer.php");

src/members/include/forum/manageposts.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@
110110
";
111111
}
112112
}
113-
elseif(isset($_GET['pID']) && $boardObj->objPost->select($_GET['pID']) && $_GET['action'] == "delete") {
113+
elseif(isset($_GET['pID']) && $boardObj->objPost->select($_GET['pID']) && ($_GET['action'] ?? '') == "delete") {
114114
// DELETE POST
115115

116116
$postInfo = $boardObj->objPost->get_info_filtered();
@@ -163,7 +163,7 @@
163163
$member->logAction("Deleted post in topic: <a href='".$MAIN_ROOT."forum/viewtopic.php?tID=".$topicInfo['forumtopic_id']."'>".$boardObj->objPost->get_info_filtered("title")."</a>");
164164

165165
}
166-
elseif(isset($_GET['pID']) && $boardObj->objPost->select($_GET['pID']) && $_GET['action'] != "delete") {
166+
elseif(isset($_GET['pID']) && $boardObj->objPost->select($_GET['pID']) && ($_GET['action'] ?? '') != "delete") {
167167
// EDIT POST
168168

169169
$postInfo = $boardObj->objPost->get_info();
@@ -255,7 +255,7 @@
255255
<div class='formDiv'>
256256
";
257257

258-
if($dispError != "") {
258+
if(($dispError ?? '') != "") {
259259
echo "
260260
<div class='errorDiv'>
261261
<strong>Unable to edit post because the following errors occurred:</strong><br><br>

src/members/include/news/include/reloadshoutbox.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333

3434
$member = new Member($mysqli);
35-
$member->select($_SESSION['btUsername']);
35+
$member->select(($_SESSION['btUsername'] ?? ''));
3636

3737

3838
$newsObj = new News($mysqli);
@@ -46,7 +46,7 @@
4646
$shoutboxObj->intDispHeight = 300;
4747
$shoutboxObj->blnUpdateShoutbox = true;
4848

49-
if($member->authorizeLogin($_SESSION['btPassword'])) {
49+
if($member->authorizeLogin(($_SESSION['btPassword'] ?? ''))) {
5050

5151
$manageNewsCID = $consoleObj->findConsoleIDByName("Manage News");
5252

0 commit comments

Comments
 (0)