errorCode(404); $MyRank = Groups::GetUserRank(SESSION["user"]["id"], $GroupInfo->id); if(!$MyRank->Permissions->CanManageGroupAdmin) PageBuilder::instance()->errorCode(404); $Panel = "Members"; $ShowInfoAlert = false; $Errors = (object) [ "Name" => false, "Description" => false, "Emblem" => false ]; $Fields = (object) [ "Name" => $GroupInfo->name, "Description" => $GroupInfo->description ]; if($_SERVER["REQUEST_METHOD"] == "POST" && $MyRank->Level == 255) { $Panel = "Info"; $Fields->Name = $_POST["Name"] ?? ""; $Fields->Description = $_POST["Description"] ?? ""; $Emblem = $_FILES["Emblem"] ?? false; if(!strlen($Fields->Name)) $Errors->Name = "Group name cannot be empty"; else if(strlen($Fields->Name) < 3) $Errors->Name = "Group name must be at least 3 characters long"; else if(strlen($Fields->Name) > 48) $Errors->Name = "Group name cannot be longer than 48 characters"; else if(Polygon::IsExplicitlyFiltered($Fields->Name)) $Errors->Name = "Group name contains inappropriate text"; if(strlen($Fields->Description) > 1000) $Errors->Description = "Group description cannot be longer than 1,000 characters"; else if(Polygon::IsExplicitlyFiltered($Fields->Description)) $Errors->Description = "Group description contains inappropriate text"; $GroupExists = Database::singleton()->run("SELECT COUNT(*) FROM groups WHERE name = :Name", [":Name" => $Fields->Name])->fetchColumn(); if($GroupExists && $GroupInfo->name != $Fields->Name) $Errors->Name = "A group with that name already exists"; if(!$Errors->Name && !$Errors->Description) { if($Emblem && $Emblem["size"] !== 0) { // the group emblem is uploaded as an image on the creator's account $Image = new Upload($Emblem); if($Image->uploaded) { $Image->allowed = ['image/png', 'image/jpg', 'image/jpeg']; $Image->image_convert = 'png'; $Processed = Image::Process($Image, ["name" => $GroupInfo->emblem, "keepRatio" => true, "align" => "T", "x" => 128, "y" => 128, "dir" => "assets/"]); if ($Processed === true) { Thumbnails::UploadAsset($Image, $GroupInfo->emblem, 60, 62, ["keepRatio" => true, "align" => "C"]); Thumbnails::UploadAsset($Image, $GroupInfo->emblem, 420, 420, ["keepRatio" => true, "align" => "C"]); Database::singleton()->run("UPDATE assets SET approved = 0 WHERE id = :EmblemID", [":EmblemID" => $GroupInfo->emblem]); } else { $Errors->Emblem = "Image processing failed: $Processed"; } } else { $Errors->Emblem = "Failed to upload image"; } } if($GroupInfo->name != $Fields->Name) { Groups::LogAction( $GroupInfo->id, "Rename", sprintf( "%s renamed the group to: %s", SESSION["user"]["id"], SESSION["user"]["username"], htmlspecialchars($Fields->Name) ) ); } if($GroupInfo->description != $Fields->Description) { Groups::LogAction( $GroupInfo->id, "Change Description", sprintf( "%s changed the group description to: %s", SESSION["user"]["id"], SESSION["user"]["username"], htmlspecialchars($Fields->Description) ) ); } // create group Database::singleton()->run( "UPDATE groups SET name = :Name, description = :Description WHERE id = :GroupID", [":GroupID" => $GroupInfo->id, ":Name" => $Fields->Name, ":Description" => $Fields->Description] ); $GroupInfo->name = $Fields->Name; $GroupInfo->description = $Fields->Description; $ShowInfoAlert = true; } } $pageBuilder = new PageBuilder(); $pageBuilder->addAppAttribute("data-group-id", $GroupInfo->id); $pageBuilder->addResource("stylesheets", "https://cdn.jsdelivr.net/gh/gitbrent/bootstrap4-toggle@3.6.1/css/bootstrap4-toggle.min.css"); $pageBuilder->addResource("scripts", "https://cdn.jsdelivr.net/gh/gitbrent/bootstrap4-toggle@3.6.1/js/bootstrap4-toggle.min.js"); $pageBuilder->addResource("scripts", "http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/jquery-ui.min.js"); $pageBuilder->addResource("polygonScripts", "/js/polygon/groups.js"); $pageBuilder->buildHeader(); ?>

name)?>

Owned By: owner)?>

Back To My Groups
" id="members" role="tabpanel" aria-labelledby="members-tab">

Members

$UserName
$UserName Permissions->CanRoleLowerRankedMembers) { ?>
Level == 255) { ?>
" id="info" role="tabpanel" aria-labelledby="info-tab">

Group Information

Emblem

Emblem?>

Name

Name?>

Description

Description?>
" id="settings" role="tabpanel" aria-labelledby="settings-tab">

Settings

Permissions->CanManageRelationships) { ?>

Allies

Ally Requests

Enemies

Level == 255) { ?>

Roles

Name Description Rank Edit
buildFooter();