mirror of
https://github.com/YGGverse/YGGtracker.git
synced 2025-01-11 15:37:57 +00:00
remove comments public status changing #1
This commit is contained in:
parent
26d2a06b9a
commit
7c054557f3
@ -165,84 +165,6 @@ switch (isset($_GET['target']) ? urldecode($_GET['target']) : false)
|
|||||||
|
|
||||||
break;
|
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':
|
case 'new':
|
||||||
|
|
||||||
// Yggdrasil connections only
|
// Yggdrasil connections only
|
||||||
|
@ -397,14 +397,6 @@ echo '<?xml version="1.0" encoding="UTF-8"?>' . PHP_EOL ?>
|
|||||||
</span>
|
</span>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<small>
|
<small>
|
||||||
<a class="float-right margin-l-12"
|
|
||||||
href="<?php echo WEBSITE_URL ?>/action.php?target=comment&toggle=public&magnetCommentId=<?php echo $magnetComment->magnetCommentId ?>&callback=<?php echo base64_encode(sprintf('%s/magnet.php?magnetId=%s#comment-%s', WEBSITE_URL, $magnetComment->magnetId, $magnetComment->magnetCommentId)) ?>">
|
|
||||||
<?php if ($magnetComment->public) { ?>
|
|
||||||
<?php echo _('hide') ?>
|
|
||||||
<?php } else { ?>
|
|
||||||
<?php echo _('show') ?>
|
|
||||||
<?php } ?>
|
|
||||||
</a>
|
|
||||||
<?php if (in_array($response->user->address, MODERATOR_IP_LIST)) { ?>
|
<?php if (in_array($response->user->address, MODERATOR_IP_LIST)) { ?>
|
||||||
<a class="float-right margin-l-12"
|
<a class="float-right margin-l-12"
|
||||||
href="<?php echo WEBSITE_URL ?>/action.php?target=comment&toggle=approved&magnetCommentId=<?php echo $magnetComment->magnetCommentId ?>&callback=<?php echo base64_encode(sprintf('%s/magnet.php?magnetId=%s#comment-%s', WEBSITE_URL, $magnetComment->magnetId, $magnetComment->magnetCommentId)) ?>">
|
href="<?php echo WEBSITE_URL ?>/action.php?target=comment&toggle=approved&magnetCommentId=<?php echo $magnetComment->magnetCommentId ?>&callback=<?php echo base64_encode(sprintf('%s/magnet.php?magnetId=%s#comment-%s', WEBSITE_URL, $magnetComment->magnetId, $magnetComment->magnetCommentId)) ?>">
|
||||||
|
Loading…
Reference in New Issue
Block a user