From 7c054557f316bb0c34ad8bdbcaba6b5cdcf3bf44 Mon Sep 17 00:00:00 2001 From: ghost Date: Thu, 14 Sep 2023 20:42:03 +0300 Subject: [PATCH] remove comments public status changing #1 --- src/public/action.php | 78 ------------------------------------------- src/public/magnet.php | 8 ----- 2 files changed, 86 deletions(-) diff --git a/src/public/action.php b/src/public/action.php index 599b047..51b77dc 100644 --- a/src/public/action.php +++ b/src/public/action.php @@ -165,84 +165,6 @@ switch (isset($_GET['target']) ? urldecode($_GET['target']) : false) break; - case 'public': - - // Yggdrasil connections only - if (!preg_match(YGGDRASIL_HOST_REGEX, $_SERVER['REMOTE_ADDR'])) - { - $response->success = false; - $response->message = _('Yggdrasil connection required for this action'); - } - - // Init session - else if (!$userId = $db->initUserId($_SERVER['REMOTE_ADDR'], USER_DEFAULT_APPROVED, time())) - { - $response->success = false; - $response->message = _('Could not init user session'); - } - - // Get user - else if (!$user = $db->getUser($userId)) - { - $response->success = false; - $response->message = _('Could not init user info'); - } - - // On first visit, redirect user to the welcome page with access level question - else if (is_null($user->public)) - { - header( - sprintf('Location: %s/welcome.php', WEBSITE_URL) - ); - } - - // Magnet comment exists - else if (!$magnetComment = $db->getMagnetComment(isset($_GET['magnetCommentId']) && $_GET['magnetCommentId'] > 0 ? (int) $_GET['magnetCommentId'] : 0)) - { - $response->success = false; - $response->message = _('Requested magnet comment not found'); - } - - // Access allowed - else if (!($user->address == $db->getUser($magnetComment->userId)->address || in_array($user->address, MODERATOR_IP_LIST))) { - - $response->success = false; - $response->message = _('Access denied'); - } - - // Validate callback - else if (empty($_GET['callback'])) - { - $response->success = false; - $response->message = _('Callback required'); - } - - // Validate base64 - else if (!$callback = (string) @base64_decode($_GET['callback'])) - { - $response->success = false; - $response->message = _('Invalid callback encoding'); - } - - // Request valid - else - { - if ($magnetComment->public) - { - $db->updateMagnetCommentPublic($magnetComment->magnetCommentId, false); - } - else{ - $db->updateMagnetCommentPublic($magnetComment->magnetCommentId, true); - } - - // Redirect to edit page - header( - sprintf('Location: %s', $callback) - ); - } - - break; - case 'new': // Yggdrasil connections only diff --git a/src/public/magnet.php b/src/public/magnet.php index 4e9f627..665f7fc 100644 --- a/src/public/magnet.php +++ b/src/public/magnet.php @@ -397,14 +397,6 @@ echo '' . PHP_EOL ?> - - public) { ?> - - - - - user->address, MODERATOR_IP_LIST)) { ?>