mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-23 19:37:23 +08:00
fix compatibility with php8
This commit is contained in:
+24
-24
@@ -22,7 +22,7 @@ if (isset($_GET['category']) && $_GET["category"]){
|
||||
}
|
||||
|
||||
if (isset($_GET['id']) && $_GET["id"]){
|
||||
$id = 0 + htmlspecialchars($_GET["id"]);
|
||||
$id = htmlspecialchars($_GET["id"] ?? 0);
|
||||
if (preg_match('/^[0-9]+$/', !$id))
|
||||
stderr($lang_offers['std_error'], $lang_offers['std_smell_rat']);
|
||||
}
|
||||
@@ -31,7 +31,7 @@ if (isset($_GET['id']) && $_GET["id"]){
|
||||
if (isset($_GET['add_offer']) && $_GET["add_offer"]){
|
||||
if (get_user_class() < $addoffer_class)
|
||||
permissiondenied();
|
||||
$add_offer = 0 + $_GET["add_offer"];
|
||||
$add_offer = $_GET["add_offer"] ?? 0;
|
||||
if($add_offer != '1')
|
||||
stderr($lang_offers['std_error'], $lang_offers['std_smell_rat']);
|
||||
|
||||
@@ -63,11 +63,11 @@ if (isset($_GET['add_offer']) && $_GET["add_offer"]){
|
||||
if (isset($_GET['new_offer']) && $_GET["new_offer"]){
|
||||
if (get_user_class() < $addoffer_class)
|
||||
permissiondenied();
|
||||
$new_offer = 0 + $_GET["new_offer"];
|
||||
$new_offer = $_GET["new_offer"] ?? 0;
|
||||
if($new_offer != '1')
|
||||
stderr($lang_offers['std_error'], $lang_offers['std_smell_rat']);
|
||||
|
||||
$userid = 0 + $CURUSER["id"];
|
||||
$userid = $CURUSER["id"] ?? 0;
|
||||
if (preg_match("/^[0-9]+$/", !$userid))
|
||||
stderr($lang_offers['std_error'], $lang_offers['std_smell_rat']);
|
||||
|
||||
@@ -75,7 +75,7 @@ if (isset($_GET['new_offer']) && $_GET["new_offer"]){
|
||||
if ($name == "")
|
||||
bark($lang_offers['std_must_enter_name']);
|
||||
|
||||
$cat = (0 + $_POST["type"]);
|
||||
$cat = ($_POST["type"] ?? 0);
|
||||
if (!is_valid_id($cat))
|
||||
bark($lang_offers['std_must_select_category']);
|
||||
|
||||
@@ -101,7 +101,7 @@ if (isset($_GET['new_offer']) && $_GET["new_offer"]){
|
||||
//===end
|
||||
|
||||
$ret = sql_query("INSERT INTO offers (userid, name, descr, category, added) VALUES (" .
|
||||
implode(",", array_map("sqlesc", array($CURUSER["id"], $name, $descr, 0 + $_POST["type"]))) .
|
||||
implode(",", array_map("sqlesc", array($CURUSER["id"], $name, $descr, $_POST["type"] ?? 0))) .
|
||||
", '" . date("Y-m-d H:i:s") . "')");
|
||||
if (!$ret) {
|
||||
if (mysql_errno() == 1062)
|
||||
@@ -127,7 +127,7 @@ if (isset($_GET['new_offer']) && $_GET["new_offer"]){
|
||||
//=== offer details
|
||||
if (isset($_GET['off_details']) && $_GET["off_details"]){
|
||||
|
||||
$off_details = 0 + $_GET["off_details"];
|
||||
$off_details = $_GET["off_details"] ?? 0;
|
||||
if($off_details != '1')
|
||||
stderr($lang_offers['std_error'], $lang_offers['std_smell_rat']);
|
||||
|
||||
@@ -238,13 +238,13 @@ if (isset($_GET["allow_offer"]) && $_GET["allow_offer"]) {
|
||||
if (get_user_class() < $offermanage_class)
|
||||
stderr($lang_offers['std_access_denied'], $lang_offers['std_mans_job']);
|
||||
|
||||
$allow_offer = 0 + $_GET["allow_offer"];
|
||||
$allow_offer = $_GET["allow_offer"] ?? 0;
|
||||
if($allow_offer != '1')
|
||||
stderr($lang_offers['std_error'], $lang_offers['std_smell_rat']);
|
||||
|
||||
//=== to allow the offer credit to S4NE for this next bit :)
|
||||
//if ($_POST["offerid"]){
|
||||
$offid = 0 + $_POST["offerid"];
|
||||
$offid = $_POST["offerid"] ?? 0;
|
||||
if(!is_valid_id($offid))
|
||||
stderr($lang_offers['std_error'], $lang_offers['std_smell_rat']);
|
||||
|
||||
@@ -273,11 +273,11 @@ if (isset($_GET["finish_offer"]) && $_GET["finish_offer"]) {
|
||||
if (get_user_class() < $offermanage_class)
|
||||
stderr($lang_offers['std_access_denied'], $lang_offers['std_have_no_permission']);
|
||||
|
||||
$finish_offer = 0 + $_GET["finish_offer"];
|
||||
$finish_offer = $_GET["finish_offer"] ?? 0;
|
||||
if($finish_offer != '1')
|
||||
stderr($lang_offers['std_error'], $lang_offers['std_smell_rat']);
|
||||
|
||||
$offid = 0 + $_POST["finish"];
|
||||
$offid = $_POST["finish"] ?? 0;
|
||||
if(!is_valid_id($offid))
|
||||
stderr($lang_offers['std_error'], $lang_offers['std_smell_rat']);
|
||||
|
||||
@@ -323,11 +323,11 @@ if (isset($_GET["finish_offer"]) && $_GET["finish_offer"]) {
|
||||
|
||||
if (isset($_GET["edit_offer"]) && $_GET["edit_offer"]) {
|
||||
|
||||
$edit_offer = 0 + $_GET["edit_offer"];
|
||||
$edit_offer = $_GET["edit_offer"] ?? 0;
|
||||
if($edit_offer != '1')
|
||||
stderr($lang_offers['std_error'], $lang_offers['std_smell_rat']);
|
||||
|
||||
$id = 0 + $_GET["id"];
|
||||
$id = $_GET["id"] ?? 0;
|
||||
|
||||
$res = sql_query("SELECT * FROM offers WHERE id = $id") or sqlerr(__FILE__, __LINE__);
|
||||
$num = mysql_fetch_array($res);
|
||||
@@ -369,11 +369,11 @@ if (isset($_GET["edit_offer"]) && $_GET["edit_offer"]) {
|
||||
//==== take offer edit
|
||||
if (isset($_GET["take_off_edit"]) && $_GET["take_off_edit"]){
|
||||
|
||||
$take_off_edit = 0 + $_GET["take_off_edit"];
|
||||
$take_off_edit = $_GET["take_off_edit"] ?? 0;
|
||||
if($take_off_edit != '1')
|
||||
stderr($lang_offers['std_error'], $lang_offers['std_smell_rat']);
|
||||
|
||||
$id = 0 + $_GET["id"];
|
||||
$id = $_GET["id"] ?? 0;
|
||||
|
||||
$res = sql_query("SELECT userid FROM offers WHERE id = $id") or sqlerr(__FILE__, __LINE__);
|
||||
$num = mysql_fetch_array($res);
|
||||
@@ -395,7 +395,7 @@ if (isset($_GET["take_off_edit"]) && $_GET["take_off_edit"]){
|
||||
bark($lang_offers['std_must_enter_name']);
|
||||
if (!$descr)
|
||||
bark($lang_offers['std_must_enter_description']);
|
||||
$cat = (0 + $_POST["category"]);
|
||||
$cat = ($_POST["category"] ?? 0);
|
||||
if (!is_valid_id($cat))
|
||||
bark($lang_offers['std_must_select_category']);
|
||||
|
||||
@@ -412,11 +412,11 @@ if (isset($_GET["take_off_edit"]) && $_GET["take_off_edit"]){
|
||||
//=== offer votes list
|
||||
if (isset($_GET["offer_vote"]) && $_GET["offer_vote"]){
|
||||
|
||||
$offer_vote = 0 + $_GET["offer_vote"];
|
||||
$offer_vote = $_GET["offer_vote"] ?? 0;
|
||||
if($offer_vote != '1')
|
||||
stderr($lang_offers['std_error'], $lang_offers['std_smell_rat']);
|
||||
|
||||
$offerid = 0 + htmlspecialchars($_GET[id]);
|
||||
$offerid = htmlspecialchars($_GET['id'] ?? 0);
|
||||
|
||||
$res2 = sql_query("SELECT COUNT(*) FROM offervotes WHERE offerid = ".sqlesc($offerid)) or sqlerr(__FILE__, __LINE__);
|
||||
$row = mysql_fetch_array($res2);
|
||||
@@ -459,7 +459,7 @@ if (isset($_GET["offer_vote"]) && $_GET["offer_vote"]){
|
||||
|
||||
//=== offer votes
|
||||
if (isset($_GET["vote"]) && $_GET["vote"]){
|
||||
$offerid = 0 + htmlspecialchars($_GET["id"]);
|
||||
$offerid = htmlspecialchars($_GET["id"] ?? 0);
|
||||
$vote = htmlspecialchars($_GET["vote"]);
|
||||
if ($vote == 'against' && get_user_class() < $againstoffer_class)
|
||||
stderr($lang_offers['std_error'], $lang_offers['std_smell_rat']);
|
||||
@@ -532,13 +532,13 @@ if (isset($_GET["vote"]) && $_GET["vote"]){
|
||||
//=== delete offer
|
||||
if (isset($_GET["del_offer"]) && $_GET["del_offer"]){
|
||||
|
||||
$del_offer = 0 + $_GET["del_offer"];
|
||||
$del_offer = $_GET["del_offer"] ?? 0;
|
||||
if($del_offer != '1')
|
||||
stderr($lang_offers['std_error'], $lang_offers['std_smell_rat']);
|
||||
|
||||
$offer = 0 + $_GET["id"];
|
||||
$offer = $_GET["id"] ?? 0;
|
||||
|
||||
$userid = 0 + $CURUSER["id"];
|
||||
$userid = $CURUSER["id"] ?? 0;
|
||||
if (!is_valid_id($userid))
|
||||
stderr($lang_offers['std_error'], $lang_offers['std_smell_rat']);
|
||||
|
||||
@@ -554,7 +554,7 @@ if (isset($_GET["del_offer"]) && $_GET["del_offer"]){
|
||||
{
|
||||
$sure = $_GET["sure"];
|
||||
if($sure == '0' || $sure == '1')
|
||||
$sure = 0 + $_GET["sure"];
|
||||
$sure = $_GET["sure"] ?? 0;
|
||||
else
|
||||
stderr($lang_offers['std_error'], $lang_offers['std_smell_rat']);
|
||||
}
|
||||
@@ -604,7 +604,7 @@ if (isset($_GET["sort"]) && $_GET["sort"])
|
||||
$categ = $_GET["category"] ?? 0;
|
||||
$offerorid = 0;
|
||||
if (isset($_GET["offerorid"]) && $_GET["offerorid"]){
|
||||
$offerorid = 0 + htmlspecialchars($_GET["offerorid"]);
|
||||
$offerorid = htmlspecialchars($_GET["offerorid"] ?? 0);
|
||||
if (preg_match("/^[0-9]+$/", !$offerorid))
|
||||
stderr($lang_offers['std_error'], $lang_offers['std_smell_rat']);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user