setHTMLTitle("Deine Regionen"); $HTML->importSeitenInhalt("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 Prims,SimFPS,PhyFPS,ProcMem,RegionVersion 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'] = trim($row['RegionVersion']); return $return; } return array(); } if($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_REQUEST['remove'])) { include 'app/FormValidator.php'; $validator = new FormValidator(array( 'region' => array('required' => true, 'regex' => '/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/') )); if($validator->isValid($_POST)) { if(isset($_SESSION['LEVEL']) && $_SESSION['LEVEL'] >= 100) { $statementMembership = $RUNTIME['PDO']->prepare("DELETE FROM regions WHERE uuid = ?"); $statementMembership->execute(array($_POST['region'])); } else { $statementMembership = $RUNTIME['PDO']->prepare("DELETE FROM regions WHERE uuid = ? AND owner_uuid = ?"); $statementMembership->execute(array($_POST['region'], $_SESSION['UUID'])); } } header('Location: index.php?page=regions'); die(); } $table = '%%ENTRY%%
Region NameEigentümerPositionAktionen
'; $showAll = isset($_SESSION['LEVEL']) && $_SESSION['LEVEL'] >= 100 && isset($_REQUEST['SHOWALL']) && $_REQUEST['SHOWALL'] == "1"; $statement = $RUNTIME['PDO']->prepare("SELECT uuid,regionName,owner_uuid,locX,locY FROM regions ".($showAll ? "ORDER BY owner_uuid ASC" : "WHERE owner_uuid = ? ORDER BY uuid ASC")); $statement->execute(array($_SESSION['UUID'])); include 'app/OpenSim.php'; $opensim = new OpenSim(); while($row = $statement->fetch()) { $stats = getRegionStatsData($row['uuid']); $entry = ''.htmlspecialchars($row['regionName']).''.htmlspecialchars($opensim->getUserName($row['owner_uuid'])).''.fillString(($row['locX'] / 256), 4).' / '.fillString(($row['locY'] / 256), 4).'
%%CSRF%%
'; $table = str_replace("%%ENTRY%%", $entry."%%ENTRY%%", $table); } $table = str_replace("%%ENTRY%%", "", $table); $HTML->ReplaceSeitenInhalt("%%REGION-LIST%%", $table); $HTML->build(); echo $HTML->ausgabe(); ?>