From eaedf8d4c56fd3e99f185ce1d3b63e29b0e2c1c7 Mon Sep 17 00:00:00 2001 From: Christopher Date: Thu, 6 Aug 2020 03:15:07 +0200 Subject: [PATCH] add friends --- classen/OpenSim.php | 38 ++++++++++++++++++++++++++++++ pages/friends.php | 35 +++++++++++++++++++++++++++ style/default/dashboard-admin.html | 6 +++++ style/default/dashboard.html | 7 +++++- 4 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 pages/friends.php diff --git a/classen/OpenSim.php b/classen/OpenSim.php index 2c83424..8e6174d 100644 --- a/classen/OpenSim.php +++ b/classen/OpenSim.php @@ -41,6 +41,44 @@ return $rowUser['FirstName']." ".$rowUser['LastName']; } + $statementGridUser = $RUNTIME['PDO']->prepare("SELECT * FROM GridUser"); + $statementGridUser->execute(array($userID)); + + while($rowGridUser = $statementGridUser->fetch()) + { + $UserData = explode(";", $rowGridUser['UserID']); + + if(count($UserData) >= 3) + { + $DBUserID = $UserData[0]; + $DBUserName = $UserData[2]; + + $RUNTIME['CACHE']['USERNAME'][$userID] = $DBUserName; + + if($DBUserID == $userID) + return $DBUserName; + } + } + + $statementFriends = $RUNTIME['PDO']->prepare("SELECT * FROM Friends"); + $statementFriends->execute(array($userID)); + + while($rowFriends = $statementFriends->fetch()) + { + $UserData = explode(";", $rowFriends['PrincipalID']); + + if(count($UserData) == 4) + { + $DBUserID = $UserData[0]; + $DBUserName = $UserData[2]; + + $RUNTIME['CACHE']['USERNAME'][$userID] = $DBUserName; + + if($DBUserID == $userID) + return $DBUserName; + } + } + return "Unknown User"; } diff --git a/pages/friends.php b/pages/friends.php new file mode 100644 index 0000000..2ac746b --- /dev/null +++ b/pages/friends.php @@ -0,0 +1,35 @@ +setHTMLTitle("Online Anzeige"); + $HTML->importSeitenInhalt("pages/HTML/online-anzeige.html"); + + $table = '%%ENTRY%%
NameOptionen
'; + + $statement = $RUNTIME['PDO']->prepare("SELECT * FROM Friends WHERE PrincipalID = ? ORDER BY Friend ASC"); + $statement->execute([$_SESSION['UUID']]); + + while($row = $statement->fetch()) + { + $PrincipalID = explode(";", $row['PrincipalID'])[0]; + $FriendData = explode(";", $row['Friend']); + $Friend = $FriendData[0]; + + $entry = ''.trim($RUNTIME['OPENSIM']->getUserName($Friend)).'LÖSCHEN'; + + if(count($FriendData) > 1) + { + $FriendData[1] = str_replace("http://", "", $FriendData[1]); + $FriendData[1] = str_replace("https://", "", $FriendData[1]); + $FriendData[1] = str_replace("/", "", $FriendData[1]); + $entry = ''.trim($RUNTIME['OPENSIM']->getUserName($Friend)).' @ '.strtolower($FriendData[1]).'LÖSCHEN'; + + } + + $table = str_replace("%%ENTRY%%", $entry."%%ENTRY%%", $table); + } + + $table = str_replace("%%ENTRY%%", "", $table); + $HTML->ReplaceSeitenInhalt("%%ONLINE-LIST%%", $table); + + $HTML->build(); + echo $HTML->ausgabe(); +?> \ No newline at end of file diff --git a/style/default/dashboard-admin.html b/style/default/dashboard-admin.html index 808cb51..0d97f9b 100644 --- a/style/default/dashboard-admin.html +++ b/style/default/dashboard-admin.html @@ -71,6 +71,12 @@ Deine Gruppen + +