From b92f152b67b79f98e50865eb5848ff9c5c12a00f Mon Sep 17 00:00:00 2001 From: xiaomlove Date: Wed, 30 Dec 2020 02:37:43 +0800 Subject: [PATCH] fix warning --- attachment.php | 3 ++- cheaterbox.php | 4 ++-- friends.php | 4 ++-- index.php | 16 +++++++++------- log.php | 5 +++-- makepoll.php | 51 +++++++++++++++++++++++++------------------------- news.php | 12 ++++++------ shoutbox.php | 10 +++++----- staffbox.php | 4 ++-- 9 files changed, 57 insertions(+), 52 deletions(-) diff --git a/attachment.php b/attachment.php index 0d1e6b13..a1ee27ee 100644 --- a/attachment.php +++ b/attachment.php @@ -23,6 +23,7 @@ $altsize = $_POST['altsize'] ?? ''; enable_attachment()) { if ($_SERVER["REQUEST_METHOD"] == "POST") @@ -35,7 +36,7 @@ if ($Attach->enable_attachment()) $ext = strtolower(substr($origfilename, $ext_l+1, strlen($origfilename)-($ext_l+1))); $banned_ext = array('exe', 'com', 'bat', 'msi'); $img_ext = array('jpeg', 'jpg', 'png', 'gif'); - $warning = ""; + if (!$file || $filesize == 0 || $file["name"] == "") // nothing received { $warning = $lang_attachment['text_nothing_received']; diff --git a/cheaterbox.php b/cheaterbox.php index 9cfb360e..2d867238 100644 --- a/cheaterbox.php +++ b/cheaterbox.php @@ -9,13 +9,13 @@ if (get_user_class() < $staffmem_class) permissiondenied(); -if ($_POST['setdealt']){ +if (!empty($_POST['setdealt'])) { $res = sql_query ("SELECT id FROM cheaters WHERE dealtwith=0 AND id IN (" . implode(", ", $_POST[delcheater]) . ")"); while ($arr = mysql_fetch_assoc($res)) sql_query ("UPDATE cheaters SET dealtwith=1, dealtby = $CURUSER[id] WHERE id = $arr[id]") or sqlerr(); $Cache->delete_value('staff_new_cheater_count'); } -elseif ($_POST['delete']){ +elseif (!empty($_POST['delete'])) { $res = sql_query ("SELECT id FROM cheaters WHERE id IN (" . implode(", ", $_POST[delcheater]) . ")"); while ($arr = mysql_fetch_assoc($res)) sql_query ("DELETE from cheaters WHERE id = $arr[id]") or sqlerr(); diff --git a/friends.php b/friends.php index 85188774..05968c2d 100644 --- a/friends.php +++ b/friends.php @@ -18,7 +18,7 @@ function purge_neighbors_cache() //make_folder("cache/" , get_langfolder_cookie() . "/neighbors"); $userid = $CURUSER['id']; -$action = $_GET['action']; +$action = $_GET['action'] ?? ''; if (!is_valid_id($userid)) stderr($lang_friends['std_error'], $lang_friends['std_invalid_id']."$userid."); @@ -106,7 +106,7 @@ if ($action == 'delete') stdhead($lang_friends['head_personal_lists_for']. $user['username']); print("

". -"

" . $lang_friends['text_personallist'] . " ".get_username($user[id])."

\n"); +"

" . $lang_friends['text_personallist'] . " ".get_username($user['id'])."

\n"); //Start: Friends print("\n"); end_compose(); diff --git a/shoutbox.php b/shoutbox.php index 87dff378..68da91ba 100644 --- a/shoutbox.php +++ b/shoutbox.php @@ -12,7 +12,7 @@ if (isset($_GET['del'])) } } } -$where=$_GET["type"]; +$where=$_GET["type"] ?? ''; $refresh = ($CURUSER['sbrefresh'] ? $CURUSER['sbrefresh'] : 120) ?> @@ -57,7 +57,7 @@ countdown(time); } - onload="" onload="hbquota()" > + onload="" onload="hbquota()" > = $sbmanage_class) { - $del="[".$lang_shoutbox['text_del']."]"; + $del="[".$lang_shoutbox['text_del']."]"; } if ($arr["userid"]) { $username = get_username($arr["userid"],false,true,true,true,false,false,"",true); - if ($_GET["type"] != 'helpbox' && $arr["type"] == 'hb') + if (isset($arr["type"]) && isset($_GET['type']) && $_GET["type"] != 'helpbox' && $arr["type"] == 'hb') $username .= $lang_shoutbox['text_to_guest']; } else $username = $lang_shoutbox['text_guest']; diff --git a/staffbox.php b/staffbox.php index 468826d4..af1c32c5 100644 --- a/staffbox.php +++ b/staffbox.php @@ -6,7 +6,7 @@ loggedinorreturn(); if (get_user_class() < $staffmem_class) permissiondenied(); -$action = $_GET["action"]; +$action = $_GET["action"] ?? ''; /////////////////////////// // SHOW PM'S // @@ -14,7 +14,7 @@ $action = $_GET["action"]; if (!$action) { stdhead($lang_staffbox['head_staff_pm']); - $url = $_SERVER[PHP_SELF]."?"; + $url = $_SERVER['PHP_SELF']."?"; $count = get_row_count("staffmessages"); $perpage = 20; list($pagertop, $pagerbottom, $limit) = pager($perpage, $count, $url);
"); diff --git a/index.php b/index.php index 8bcf4b1e..8451c5c6 100644 --- a/index.php +++ b/index.php @@ -3,6 +3,7 @@ require "include/bittorrent.php"; dbconn(true); require_once(get_langfile_path()); loggedinorreturn(true); +$userid = $CURUSER["id"]; if ($showextinfo['imdb'] == 'yes') require_once ("imdb/imdb.class.php"); if ($_SERVER["REQUEST_METHOD"] == "POST") @@ -166,7 +167,7 @@ if ($showfunbox_main == "yes" && (!isset($CURUSER) || $CURUSER['showfb'] == "yes $Cache->cache_value('current_fun_vote_funny_count', $funvote, 756); } //check whether current user has voted - $funvoted = get_row_count("funvotes", "WHERE funid = ".sqlesc($row['id'])." AND userid=".sqlesc($CURUSER[id])); + $funvoted = get_row_count("funvotes", "WHERE funid = ".sqlesc($row['id'])." AND userid=".sqlesc($CURUSER['id'])); print ("

".$lang_index['text_funbox']); if ($CURUSER) @@ -260,9 +261,9 @@ if ($CURUSER && $showpolls_main == "yes") print(" - [".$lang_index['text_new']."]\n"); if ($pollexists) { - print(" - [".$lang_index['text_edit']."]\n"); - print(" - [".$lang_index['text_delete']."]"); - print(" - [".$lang_index['text_detail']."]"); + print(" - [".$lang_index['text_edit']."]\n"); + print(" - [".$lang_index['text_delete']."]"); + print(" - [".$lang_index['text_detail']."]"); } print(""); } @@ -270,7 +271,7 @@ if ($CURUSER && $showpolls_main == "yes") if ($pollexists) { $pollid = $arr["id"] ?? 0; - $userid = $CURUSER["id"]; + $question = $arr["question"]; $o = array($arr["option0"], $arr["option1"], $arr["option2"], $arr["option3"], $arr["option4"], $arr["option5"], $arr["option6"], $arr["option7"], $arr["option8"], $arr["option9"], @@ -299,7 +300,7 @@ if ($CURUSER && $showpolls_main == "yes") $os = array(); // Count votes - while ($arr2 = mysql_fetch_row($res)) + while (($arr2 = mysql_fetch_row($res) !== null) && isset($vs[$arr2[0]])) $vs[$arr2[0]] ++; reset($o); @@ -320,8 +321,9 @@ if ($CURUSER && $showpolls_main == "yes") print("\n"); $Cache->end_whole_row(); $i = 0; - while ($a = $os[$i]) + while (isset($os[$i])) { + $a = $os[$i]; if ($tvotes == 0) $p = 0; else diff --git a/log.php b/log.php index 8ecee352..4ba60f1d 100644 --- a/log.php +++ b/log.php @@ -399,13 +399,14 @@ else { reset($o); for ($i = 0; $i < count($o); ++$i) - if ($o[$i]) + if (isset($o[$i]) && isset($vs[$i])) $os[$i] = array($vs[$i], $o[$i]); print("
\n"); $i = 0; - while ($a = $os[$i]) + while (isset($os[$i])) { + $a = $os[$i]; if ($tvotes > 0) $p = round($a[0] / $tvotes * 100); else diff --git a/makepoll.php b/makepoll.php index 6a5a3389..a780a410 100644 --- a/makepoll.php +++ b/makepoll.php @@ -6,8 +6,9 @@ loggedinorreturn(); if (get_user_class() < $pollmanage_class) permissiondenied(); -$action = $_GET["action"]; -$pollid = $_GET["pollid"]; +$action = $_GET["action"] ?? ''; +$pollid = $_GET["pollid"] ?? 0; +$poll = []; if ($action == "edit") { @@ -20,7 +21,7 @@ if ($action == "edit") if ($_SERVER["REQUEST_METHOD"] == "POST") { - $pollid = (int)$_POST["pollid"]; + $pollid = $_POST["pollid"] ?? 0; $question = htmlspecialchars($_POST["question"]); $option0 = htmlspecialchars($_POST["option0"]); $option1 = htmlspecialchars($_POST["option1"]); @@ -141,27 +142,27 @@ input.mp width: 450px; } - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + +
*
1 *
2 *
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
*
1 *
2 *
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

*

@@ -169,7 +170,7 @@ input.mp if ($pollid) print(""); ?> -"> +"> "); - print(""); + print(""); begin_compose($title, "edit", $body, true, $subject); print("

".$lang_news['text_notify_users_of_this']."