fix PHP 8 error requiring construct keyword

This commit is contained in:
Tim Krehan 2023-12-02 09:50:15 +01:00 committed by Tim Krehan
parent b4f7f2ff36
commit 25f72b85f4
2 changed files with 8 additions and 7 deletions

View file

@ -1,7 +1,7 @@
<?php <?php
class item { class item {
public $ID, $Anzahl, $Einheit, $Name, $Erledigt; public $ID, $Anzahl, $Einheit, $Name, $Erledigt;
function item($ID, $Anzahl, $Einheit, $Name, $Erledigt){ function __construct($ID, $Anzahl, $Einheit, $Name, $Erledigt){
$this->ID = $ID; $this->ID = $ID;
$this->Anzahl = $Anzahl; $this->Anzahl = $Anzahl;
$this->Einheit = $Einheit; $this->Einheit = $Einheit;
@ -16,7 +16,7 @@
array_push($this->list, $current); array_push($this->list, $current);
} }
function shopping(){ function __construct(){
include $_SESSION["docroot"].'/config/config.php'; include $_SESSION["docroot"].'/config/config.php';
include $_SESSION["docroot"].'/php/connect.php'; include $_SESSION["docroot"].'/php/connect.php';
$result = $mysqli->query("SELECT * FROM `ViewEinkauf` ORDER BY `ViewEinkauf`.`Name` ASC;"); $result = $mysqli->query("SELECT * FROM `ViewEinkauf` ORDER BY `ViewEinkauf`.`Name` ASC;");
@ -132,7 +132,7 @@
class unit { class unit {
public $ID, $Name, $Standard; public $ID, $Name, $Standard;
function unit($ID, $Name, $Standard){ function __construct($ID, $Name, $Standard){
$this->ID = $ID; $this->ID = $ID;
$this->Name = $Name; $this->Name = $Name;
$this->Standard = $Standard; $this->Standard = $Standard;
@ -145,7 +145,7 @@
array_push($this->list, $current); array_push($this->list, $current);
} }
function units(){ function __construct(){
include $_SESSION["docroot"].'/config/config.php'; include $_SESSION["docroot"].'/config/config.php';
include $_SESSION["docroot"].'/php/connect.php'; include $_SESSION["docroot"].'/php/connect.php';
$result = $mysqli->query("SELECT * FROM `Einheit`;"); $result = $mysqli->query("SELECT * FROM `Einheit`;");

View file

@ -1,6 +1,7 @@
<?php <?php
class unit { class unit {
public $ID, $Name, $Standard; public $ID, $Name, $Standard;
function __construct(){}
} }
class unitList { class unitList {
public $units = array(); public $units = array();
@ -12,7 +13,7 @@
$unit->Standard = $Standard; $unit->Standard = $Standard;
array_push($this->units, $unit); array_push($this->units, $unit);
} }
function unitList(){ function __construct(){
include $_SESSION["docroot"].'/php/connect.php'; include $_SESSION["docroot"].'/php/connect.php';
$result = $mysqli->query("SELECT * FROM `Einheit`;"); $result = $mysqli->query("SELECT * FROM `Einheit`;");
while($item = $result->fetch_assoc()){ while($item = $result->fetch_assoc()){
@ -33,7 +34,7 @@
class ingredient { class ingredient {
public $ID, $Menge, $Einheit, $Name; public $ID, $Menge, $Einheit, $Name;
function ingredient($ID, $Menge, $Einheit, $Name){ function __construct($ID, $Menge, $Einheit, $Name){
$this->ID = $ID; $this->ID = $ID;
$this->Menge = $Menge; $this->Menge = $Menge;
$this->Einheit = $Einheit; $this->Einheit = $Einheit;
@ -44,7 +45,7 @@
class recipe { class recipe {
public $ID, $Name, $Dauer, $Beschreibung; public $ID, $Name, $Dauer, $Beschreibung;
public $Zutaten = array(); public $Zutaten = array();
function recipe($ID, $Name, $Dauer, $Beschreibung){ function __construct($ID, $Name, $Dauer, $Beschreibung){
$this->ID = $ID; $this->ID = $ID;
$this->Name = $Name; $this->Name = $Name;
$this->Dauer = $Dauer; $this->Dauer = $Dauer;