diff --git a/pages/regions.php b/pages/regions.php index c65a8cb..e1419f0 100644 --- a/pages/regions.php +++ b/pages/regions.php @@ -2,6 +2,44 @@ $HTML->setHTMLTitle("Deine Regionen"); $HTML->importSeitenInhalt("pages/HTML/deine-regionen.html"); + function cleanSize($bytes) + { + if ($bytes > 0) + { + $unit = intval(log($bytes, 1024)); + $units = array('B', 'KB', 'MB', 'GB'); + + if (array_key_exists($unit, $units) === true) + { + return sprintf('%d %s', $bytes / pow(1024, $unit), $units[$unit]); + } + } + + return $bytes; + } + + function getRegionStatsData($regionID) + { + global $RUNTIME; + + $statement = $RUNTIME['PDO']->prepare("SELECT * FROM regions_info WHERE regionID = ?"); + $statement->execute([$regionID]); + + if($row = $statement->fetch()) + { + $return = array(); + $return['Prims'] = $row['Prims']; + $return['SimFPS'] = $row['SimFPS']; + $return['PhyFPS'] = $row['PhyFPS']; + $return['ProcMem'] = cleanSize(str_replace(".", "", str_replace(",", ".", $row['ProcMem']))."000"); + $return['RegionVersion'] = $row['RegionVersion']; + + return $return; + } + + return array(); + } + if(@$_REQUEST['action'] == 'remove' && @$_REQUEST['region'] != '') { if(@$_SESSION['LEVEL'] >= 100) @@ -29,7 +67,9 @@ while($row = $statement->fetch()) { - $entry = ''.$row['regionName'].''.$RUNTIME['OPENSIM']->getUserName($row['owner_uuid']).''.fillString(($row['locX'] / 256), 4).' / '.fillString(($row['locY'] / 256), 4).'LÖSCHEN'; + $stats = getRegionStatsData($row['uuid']); + + $entry = ''.$row['regionName'].''.$RUNTIME['OPENSIM']->getUserName($row['owner_uuid']).''.fillString(($row['locX'] / 256), 4).' / '.fillString(($row['locY'] / 256), 4).'LÖSCHEN'; $table = str_replace("%%ENTRY%%", $entry."%%ENTRY%%", $table); }