summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorilotterytea <iltsu@alright.party>2025-05-09 18:00:11 +0500
committerilotterytea <iltsu@alright.party>2025-05-09 18:00:11 +0500
commit84458ca14672d25514970a7ab596cb2e4ff269d6 (patch)
treed3c768f5379c806e6655543a15b820819f4843f1
parent655a39a31859f7d414a0eb055ee0771f09f25bc5 (diff)
feat: options to hide public lists of emotesets and users
-rw-r--r--public/emotesets.php6
-rw-r--r--public/index.php11
-rw-r--r--public/users.php5
-rw-r--r--src/config.sample.php4
-rw-r--r--src/partials.php11
5 files changed, 33 insertions, 4 deletions
diff --git a/public/emotesets.php b/public/emotesets.php
index 6fdee82..69fbea8 100644
--- a/public/emotesets.php
+++ b/public/emotesets.php
@@ -3,6 +3,7 @@ include_once "../src/utils.php";
include_once "../src/config.php";
include_once "../src/accounts.php";
include_once "../src/partials.php";
+include_once "../src/alert.php";
authorize_user();
$id = $_GET["id"] ?? "";
@@ -50,6 +51,11 @@ if ($id == "global") {
}
}
} else if (intval($id) <= 0 && intval($alias_id) <= 0) {
+ if (!EMOTESET_PUBLIC_LIST) {
+ generate_alert("/404.php", "The public list of emotesets is disabled", 403);
+ exit;
+ }
+
$limit = 20;
$offset = ($page - 1) * $limit;
diff --git a/public/index.php b/public/index.php
index c86dd46..e0746c7 100644
--- a/public/index.php
+++ b/public/index.php
@@ -21,8 +21,15 @@ authorize_user();
<div class="items row" style="gap:32px;">
<a href="/emotes">Emotes</a>
- <a href="/emotesets.php">Emotesets</a>
- <a href="/users.php">Users</a>
+
+ <?php if (EMOTESET_PUBLIC_LIST): ?>
+ <a href="/emotesets.php">Emotesets</a>
+ <?php endif; ?>
+
+ <?php if (ACCOUNT_PUBLIC_LIST): ?>
+ <a href="/users.php">Users</a>
+ <?php endif; ?>
+
<?php if (EMOTE_UPLOAD && (ANONYMOUS_UPLOAD || (isset($_SESSION["user_role"]) && $_SESSION["user_role"]["permission_upload"]))) {
echo '<a href="/emotes/upload.php">Upload</a>';
} ?>
diff --git a/public/users.php b/public/users.php
index ccdb193..5d1f125 100644
--- a/public/users.php
+++ b/public/users.php
@@ -16,6 +16,11 @@ $alias_id = $_GET["alias_id"] ?? "";
$db = new PDO(DB_URL, DB_USER, DB_PASS);
if ($id == "" && $alias_id == "") {
+ if (!ACCOUNT_PUBLIC_LIST) {
+ generate_alert("/404.php", "The public list of accounts is disabled", 403);
+ exit;
+ }
+
$page = max(1, intval($_GET["p"] ?? "1"));
$limit = 25;
$offset = ($page - 1) * $limit;
diff --git a/src/config.sample.php b/src/config.sample.php
index 3181956..7478be6 100644
--- a/src/config.sample.php
+++ b/src/config.sample.php
@@ -29,6 +29,9 @@ define("EMOTE_VISIBILITY_DEFAULT", 2); // Default visibility for emotes. 0 - unl
define("EMOTE_MAX_SIZE", [128, 128]); // Max size of emote.
define("EMOTE_NAME_REGEX", "/^[A-Za-z0-9_]+$/"); // RegEx filter for emote names.
+// EMOTESETS
+define("EMOTESET_PUBLIC_LIST", true); // Show emotesets public.
+
// MODERATION
define("MOD_SYSTEM_DASHBOARD", true); // Enable system dashboard for moderators (/system).
define("MOD_EMOTES_APPROVE", true); // Enable manual emote approval (/system/emotes).
@@ -45,6 +48,7 @@ define("ACCOUNT_PASSWORD_MIN_LENGTH", 10); // Minimal length for passwords.
define("ACCOUNT_SECRET_KEY_LENGTH", 32); // The length for secret keys.
define("ACCOUNT_PFP_MAX_SIZE", [128, 128]); // Max dimensions for account pictures.
define("ACCOUNT_BANNER_MAX_SIZE", [1920, 1080]); // Max dimensions for account banners.
+define("ACCOUNT_PUBLIC_LIST", true); // The public list of accounts.
// TWITCH
define("TWITCH_REGISTRATION_ENABLE", false); // Enable account registration via Twitch.
diff --git a/src/partials.php b/src/partials.php
index 38e63bb..274e3ee 100644
--- a/src/partials.php
+++ b/src/partials.php
@@ -11,8 +11,15 @@ function html_navigation_bar()
</a>
<div class="links">
<a href="/emotes" class="button">Emotes</a>
- <a href="/emotesets.php" class="button">Emotesets</a>
- <a href="/users.php" class="button">Users</a>
+
+ <?php if (EMOTESET_PUBLIC_LIST): ?>
+ <a href="/emotesets.php">Emotesets</a>
+ <?php endif; ?>
+
+ <?php if (ACCOUNT_PUBLIC_LIST): ?>
+ <a href="/users.php">Users</a>
+ <?php endif; ?>
+
<?php if (EMOTE_UPLOAD && (ANONYMOUS_UPLOAD || (isset($_SESSION["user_role"]) && $_SESSION["user_role"]["permission_upload"]))) {
echo '<a href="/emotes/upload.php" class="button">Upload</a>';
} ?>