From e2795e99b9f499a1ee2a828a7007350d4995dd29 Mon Sep 17 00:00:00 2001 From: Anonymous Contributor Date: Wed, 23 Aug 2023 18:16:35 +0200 Subject: [PATCH] Do not use PHP's error control operator --- app/HTML.php | 4 ++-- app/utils.php | 4 ++-- cron/assetChecker.php | 15 +++++++++++++-- cron/regionChecker.php | 2 +- pages/invite.php | 2 +- pages/password.php | 4 ++-- pages/profile.php | 2 +- plugins/default-html.php | 7 ++++--- 8 files changed, 26 insertions(+), 14 deletions(-) diff --git a/app/HTML.php b/app/HTML.php index 917358c..5d41c7e 100644 --- a/app/HTML.php +++ b/app/HTML.php @@ -224,10 +224,10 @@ $this->FertigesHTML = str_replace("%%datum%%", date("Y-m-dTH:i+2"), $this->FertigesHTML); //Der Counter wird in den HTML Quellcode eingef�gt. - $this->FertigesHTML = str_replace("%%GET_SITE%%", @$_GET['seite'], $this->FertigesHTML); + $this->FertigesHTML = str_replace("%%GET_SITE%%", isset($_GET['seite']) ? $_GET['seite'] : ' ', $this->FertigesHTML); //Die IP Adresse wird in den HTML Quellcode eingef�gt. - $this->FertigesHTML = str_replace("%%GET_IP%%", @$_SERVER["REMOTE_ADDR"], $this->FertigesHTML); + $this->FertigesHTML = str_replace("%%GET_IP%%", isset($_SERVER["REMOTE_ADDR"]) ? $_SERVER['REMOTE_ADDR'] : ' ', $this->FertigesHTML); // Add CSRF token $this->FertigesHTML = str_replace("%%CSRF%%", '', $this->FertigesHTML); diff --git a/app/utils.php b/app/utils.php index 3d2ac34..c3feb0c 100644 --- a/app/utils.php +++ b/app/utils.php @@ -25,9 +25,9 @@ function getDataFromHTTP($URL, $contend = "", $requestTyp = "application/text") { if($contend != "") { - return @file_get_contents($URL, true, stream_context_create(array('http' => array('header' => 'Content-type: '.$requestTyp, 'method' => 'POST', 'timeout' => 0.5, 'content' => $contend)))); + return file_get_contents($URL, true, stream_context_create(array('http' => array('header' => 'Content-type: '.$requestTyp, 'method' => 'POST', 'timeout' => 0.5, 'content' => $contend)))); }else{ - return @file_get_contents($URL); + return file_get_contents($URL); } } catch (Exception $e) { echo "(HTTP REQUEST) error while conntect to remote server. : ".$URL; diff --git a/cron/assetChecker.php b/cron/assetChecker.php index 727b3f2..68deaa5 100644 --- a/cron/assetChecker.php +++ b/cron/assetChecker.php @@ -16,10 +16,21 @@ while($row = $statement->fetch()) //$fileNameParts['Time'] = time(); $fileNameParts['UUID'] = $row['id']; $fileNameParts['FilePath'] = "/data/assets/base/".$fileNameParts[0]."/".$fileNameParts[1]."/".$fileNameParts[2]."/".$fileNameParts[3]."/".$fileNameParts[4]; - $fileNameParts['FileSize'] = @filesize($fileNameParts['FilePath']); + + if(file_exists($fileNameParts['FilePath'])) { + $filesize = filesize($fileNameParts['FilePath']); + if($filesize === false) { + continue; + } + } + else { + $filesize = 0; + } + + $fileNameParts['FileSize'] = $filesize; $fileNameParts['Count'] = $count++; - if($fileNameParts['FileSize'] == 0 || !file_exists($fileNameParts['FilePath'])) + if($fileNameParts['FileSize'] == 0) { $add = $RUNTIME['PDO']->prepare('DELETE FROM fsassets WHERE hash = :fileHash'); $add->execute(['fileHash' => $row['hash']]); diff --git a/cron/regionChecker.php b/cron/regionChecker.php index 4a92ab1..df2b284 100644 --- a/cron/regionChecker.php +++ b/cron/regionChecker.php @@ -15,7 +15,7 @@ while($row = $statement->fetch()) { - $result = @file_get_contents($row['serverURI']."jsonSimStats", false, $ctx); + $result = file_get_contents($row['serverURI']."jsonSimStats", false, $ctx); if($result == FALSE || $result == "") { diff --git a/pages/invite.php b/pages/invite.php index cdf8361..e1b3ec7 100644 --- a/pages/invite.php +++ b/pages/invite.php @@ -1,5 +1,5 @@ setHTMLTitle("Kein Zugriff"); $HTML->SetSeitenInhalt("Dazu hast du keine Rechte!"); diff --git a/pages/password.php b/pages/password.php index 71782b1..b357ac7 100644 --- a/pages/password.php +++ b/pages/password.php @@ -3,7 +3,7 @@ $HTML->setHTMLTitle("Passwort ändern"); $HTML->importSeitenInhalt("profile.html"); - if(isset($_REQUEST['oldPassword']) || @$_REQUEST['oldPassword'] != "") + if(isset($_REQUEST['oldPassword']) || $_REQUEST['oldPassword'] != "") { $OLDPassword = trim($_REQUEST['oldPassword']); @@ -17,7 +17,7 @@ if($NewPassword != "") { - if(isset($_REQUEST['newPasswordRepeate']) || @$_REQUEST['newPasswordRepeate'] != "") + if(isset($_REQUEST['newPasswordRepeate']) || $_REQUEST['newPasswordRepeate'] != "") { $NewPasswordRepeate = trim($_REQUEST['newPasswordRepeate']); diff --git a/pages/profile.php b/pages/profile.php index 30ace76..d900a4b 100644 --- a/pages/profile.php +++ b/pages/profile.php @@ -135,7 +135,7 @@ $allUsers = ""; while($row = $statementLocalUsers->fetch()) { - $name = '"'.@$row['FirstName']." ".@$row['LastName'].'"'; + $name = '"'.$row['FirstName']." ".$row['LastName'].'"'; if($allUsers != "") { diff --git a/plugins/default-html.php b/plugins/default-html.php index 1d51a49..8c2a33b 100644 --- a/plugins/default-html.php +++ b/plugins/default-html.php @@ -1,12 +1,13 @@ importHTML("dashboard.html"); - if(@$_SESSION['LEVEL'] > 100) + if(isset($_SESSION['LEVEL']) && $_SESSION['LEVEL'] > 100) { $HTML->importHTML("dashboard-admin.html"); + } - $HTML->ReplaceLayoutInhalt("%%USERNAME%%", htmlspecialchars(@$_SESSION['DISPLAYNAME'])); + $HTML->ReplaceLayoutInhalt("%%USERNAME%%", isset($_SESSION['DISPLAYNAME']) ? htmlspecialchars($_SESSION['DISPLAYNAME']) : ''); } ?> \ No newline at end of file