1
0
Fork 0

add friends

master
Christopher 2020-08-06 03:15:07 +02:00
parent 9d0b185884
commit eaedf8d4c5
4 changed files with 85 additions and 1 deletions

View File

@ -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";
}

35
pages/friends.php Normal file
View File

@ -0,0 +1,35 @@
<?php
$HTML->setHTMLTitle("Online Anzeige");
$HTML->importSeitenInhalt("pages/HTML/online-anzeige.html");
$table = '<table class="table"><thead><tr><th scope="col">Name</th><th scope="col">Optionen</th></thead><tbody>%%ENTRY%%</tbody></table>';
$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 = '<tr><td>'.trim($RUNTIME['OPENSIM']->getUserName($Friend)).'</td><td>LÖSCHEN</td></tr>';
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 = '<tr><td>'.trim($RUNTIME['OPENSIM']->getUserName($Friend)).' @ '.strtolower($FriendData[1]).'</td><td>LÖSCHEN</td></tr>';
}
$table = str_replace("%%ENTRY%%", $entry."%%ENTRY%%", $table);
}
$table = str_replace("%%ENTRY%%", "", $table);
$HTML->ReplaceSeitenInhalt("%%ONLINE-LIST%%", $table);
$HTML->build();
echo $HTML->ausgabe();
?>

View File

@ -71,6 +71,12 @@
<i class="fas fa-users"></i>
<span>Deine Gruppen</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="index.php?page=friends">
<i class="fas fa-street-view"></i>
<span>Deine Freunde</span></a>
</li>
<div class="nav-link" style="padding: 1.75rem 1rem 0.75rem; font-size: 0.75rem; font-weight: bold; text-transform: uppercase; color: rgba(255, 255, 255, 0.25)">
Administration

View File

@ -70,7 +70,12 @@
<i class="fas fa-users"></i>
<span>Deine Gruppen</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="index.php?page=friends">
<i class="fas fa-users"></i>
<span>Deine Freunde</span></a>
</li>
</ul>
<div id="content-wrapper">