diff --git a/bulk_moves.php b/bulk_moves.php index 3d18e46ef..346184695 100644 --- a/bulk_moves.php +++ b/bulk_moves.php @@ -334,7 +334,7 @@ if ( $idField == "DeviceID" ) { $dev->DeviceID = $row["DeviceID"]; if ( ! $dev->GetDevice() ) { - error_log( "DeviceID = ${DeviceID} not found." ); + error_log( "DeviceID = {$DeviceID} not found." ); $rowError = true; } } else { diff --git a/classes/Cabinet.class.php b/classes/Cabinet.class.php index 0a86ffe83..6ea5c65b9 100644 --- a/classes/Cabinet.class.php +++ b/classes/Cabinet.class.php @@ -23,6 +23,7 @@ For further details on the license, see http://www.gnu.org/licenses */ +#[AllowDynamicProperties] class Cabinet { /* Cabinet: The workhorse logical container for DCIM. This can be a 2-post rack, a 4-post open rack, or an enclosed cabinet. The height is variable. Devices are attached to cabinets, and @@ -65,7 +66,7 @@ function MakeSafe() { $this->Keylock=sanitize($this->Keylock); $this->MaxKW=float_sqlsafe(floatval($this->MaxKW)); $this->MaxWeight=intval($this->MaxWeight); - $this->InstallationDate=date("Y-m-d", strtotime($this->InstallationDate)); + $this->InstallationDate=($test=$this->InstallationDate)?date("Y-m-d", strtotime($test)):""; $this->MapX1=abs((is_numeric($this->MapX1)?$this->MapX1:0)); $this->MapY1=abs((is_numeric($this->MapY1)?$this->MapY1:0)); $this->MapX2=abs((is_numeric($this->MapX2)?$this->MapX2:0)); @@ -110,7 +111,7 @@ static function RowToObject($dbRow,$filterrights=true){ $cab->Notes=$dbRow["Notes"]; $cab->U1Position=$dbRow["U1Position"]; - switch($config->ParameterArray["AssignCabinetLabels"]){ + switch(($test=$config->ParameterArray["AssignCabinetLabels"])?$test:""){ case "OwnerName": $dept=new Department($cab->AssignedTo); $dept->GetDeptByID(); diff --git a/classes/DataCenter.class.php b/classes/DataCenter.class.php index a58cbdaa8..893aa9c5a 100644 --- a/classes/DataCenter.class.php +++ b/classes/DataCenter.class.php @@ -635,12 +635,12 @@ function GetDCStatistics(){ $sql="SELECT AVG(NULLIF(a.Temperature, 0)) as AvgTemp FROM fac_SensorReadings a, fac_Cabinet b, fac_Device c WHERE a.DeviceID=c.DeviceID and c.Cabinet=b.CabinetID AND c.BackSide=0 AND b.DataCenterID=$this->DataCenterID;"; - $dcStats["AvgTemp"]=($test=round($this->query($sql)->fetchColumn()))?$test:0; + $dcStats["AvgTemp"]=round($test=($this->query($sql)->fetchColumn())?$test:0); $sql="SELECT AVG(NULLIF(a.Humidity, 0)) as AvgHumidity FROM fac_SensorReadings a, fac_Cabinet b, fac_Device c WHERE a.DeviceID=c.DeviceID and c.BackSide=0 and c.Cabinet=b.CabinetID AND b.DataCenterID=$this->DataCenterID;"; - $dcStats["AvgHumidity"]=($test=round($this->query($sql)->fetchColumn()))?$test:0; + $dcStats["AvgHumidity"]=round($test=($this->query($sql)->fetchColumn())?$test:0); $pdu=new PowerDistribution(); $dcStats["MeasuredWatts"]=$pdu->GetWattageByDC($this->DataCenterID); diff --git a/classes/Device.class.php b/classes/Device.class.php index a1f76c262..0c1db997f 100644 --- a/classes/Device.class.php +++ b/classes/Device.class.php @@ -23,6 +23,7 @@ For further details on the license, see http://www.gnu.org/licenses */ +#[AllowDynamicProperties] class Device { /* Device: Assets within the data center, at the most granular level. There are three basic groupings of information kept about a device: asset tracking, virtualization diff --git a/classes/DeviceTemplate.class.php b/classes/DeviceTemplate.class.php index d4b62b29d..1a8df6be1 100644 --- a/classes/DeviceTemplate.class.php +++ b/classes/DeviceTemplate.class.php @@ -22,6 +22,8 @@ For further details on the license, see http://www.gnu.org/licenses */ + +#[AllowDynamicProperties] class DeviceTemplate { var $TemplateID; var $ManufacturerID; diff --git a/classes/LogActions.class.php b/classes/LogActions.class.php index 7e40cc8de..b95941316 100644 --- a/classes/LogActions.class.php +++ b/classes/LogActions.class.php @@ -210,7 +210,7 @@ function val_comp($v1, $v2) { $return=true; // If a retention period has been set, trim the logs for this ObjectID prior to making this entry - if ( $config->ParameterArray["logretention"] > 0 ) { + if ( isset($config->ParameterArray["logretention"]) && $config->ParameterArray["logretention"] > 0 ) { LogActions::Prune( $config->ParameterArray["logretention"], $log->ObjectID ); } @@ -378,14 +378,14 @@ function MakeSafe(){ // If we want to really sanitize this list uncomment the function below // $this->UserID=(ArraySearchRecursive($this->UserID,$p->GetUserList(),'UserID'))?$this->UserID:''; $this->UserID=sanitize($this->UserID); - $this->Class=(class_exists($this->Class,true))?$this->Class:''; + $this->Class=$this->Class===null?'':((class_exists($this->Class,true))?$this->Class:''); $this->ObjectID=sanitize($this->ObjectID); $this->ChildID=sanitize($this->ChildID); $this->Action=sanitize($this->Action); $this->Property=sanitize($this->Property); $this->OldVal=sanitize($this->OldVal); $this->NewVal=sanitize($this->NewVal); - $this->Time=date("Y-m-d", strtotime($this->Time)); + $this->Time=$this->Time===null?'':date("Y-m-d H:i:s", strtotime($this->Time)); } function ListUnique($sqlcolumn){ diff --git a/classes/Zone.class.php b/classes/Zone.class.php index d9022369e..281d3459c 100644 --- a/classes/Zone.class.php +++ b/classes/Zone.class.php @@ -279,13 +279,13 @@ function GetZoneStatistics(){ fac_Device b, fac_Cabinet c WHERE a.DeviceID=b.DeviceID AND b.BackSide=0 and b.Cabinet=c.CabinetID AND a.DeviceID IN (SELECT b.DeviceID FROM fac_Device WHERE ZoneID=$this->ZoneID);"; - $zoneStats["AvgTemp"]=($test=round($this->query($sql)->fetchColumn()))?$test:0; + $zoneStats["AvgTemp"]=round($test=($this->query($sql)->fetchColumn())?$test:0); $sql="SELECT AVG(NULLIF(Humidity, 0)) AS AvgHumdity FROM fac_SensorReadings a, fac_Device b, fac_Cabinet c WHERE a.DeviceID=b.DeviceID AND b.BackSide=0 and b.Cabinet=c.CabinetID AND a.DeviceID IN (SELECT b.DeviceID FROM fac_Device WHERE ZoneID=$this->ZoneID);"; - $zoneStats["AvgHumidity"]=($test=round($this->query($sql)->fetchColumn()))?$test:0; + $zoneStats["AvgHumidity"]=round($test=($this->query($sql)->fetchColumn())?$test:0); $sql = "select count(*) from fac_Cabinet where ZoneID=" . intval($this->ZoneID); $zoneStats["TotalCabinets"]=($test=$this->query($sql)->fetchColumn())?$test:0; diff --git a/configuration.php b/configuration.php index 029605263..9cd049178 100644 --- a/configuration.php +++ b/configuration.php @@ -403,7 +403,8 @@ function formatOffset($offset) { $tzmenu.="\t
| '.$config->ParameterArray["OrgName"].' | -'.__("Date").':'.strftime("%x").' | +'.__("Date").':'.date("Y-m-d H-i-s").' |