Removed url param style edit enabling
This commit is contained in:
parent
6ddb694a56
commit
e4a1ec2000
27
init.php
27
init.php
@ -36,8 +36,7 @@
|
||||
('Edit CSS', '/settings/css', 'code', 'sidebar', 'admin'),
|
||||
('Edit JS', '/settings/js', 'code', 'sidebar', 'admin'),
|
||||
|
||||
('Copyright © 2025 Your Company.', '/', 'building', 'footer', ''),
|
||||
('Edit this page', '?edit=1', 'edit', 'footer', 'admin')"
|
||||
('Copyright © 2025', '/', 'building', 'footer', '')"
|
||||
);
|
||||
}
|
||||
|
||||
@ -157,12 +156,32 @@
|
||||
{
|
||||
global $c;
|
||||
|
||||
$varUser = UserAuth::getUser();
|
||||
$varRegex = [
|
||||
if (UserAuth::has("is_admin"))
|
||||
return true;
|
||||
|
||||
$varUser = UserAuth::getUser();
|
||||
$strUsername = $varUser["username"] ?? null;
|
||||
$varRegex = [
|
||||
["/user/i", ($varUser == null)],
|
||||
["/admin/i", (!UserAuth::has("is_admin"))],
|
||||
];
|
||||
|
||||
// Support arrays with username and visibility keys:
|
||||
if (is_array($strVisibility))
|
||||
{
|
||||
if (array_key_exists("username", $strVisibility))
|
||||
if ($strVisibility["username"] == $strUsername)
|
||||
return true;
|
||||
|
||||
if (!array_key_exists("visibility", $strVisibility))
|
||||
return false;
|
||||
|
||||
$strVisibility = $strVisibility["visibility"];
|
||||
}
|
||||
|
||||
if (preg_match("/{$strUsername}/i", $strVisibility)) return true;
|
||||
if (preg_match("/(every|any|all)/i", $strVisibility)) return true;
|
||||
|
||||
$intExit = 0;
|
||||
|
||||
foreach ($varRegex as $re)
|
||||
|
@ -31,9 +31,9 @@
|
||||
<div>by <?= $r["username"]; ?></div>
|
||||
<div>on <?= $r["created"]; ?> UTC</div>
|
||||
</div>
|
||||
<?php if (Request::getParam("edit")): ?>
|
||||
<?php if (UserAuth::has("is_admin")): ?>
|
||||
<div>
|
||||
<a href="/post/<?= $r["id"]; ?>">edit</a>
|
||||
<a class="link-underline link-underline-opacity-0" href="/post/<?= $r["id"]; ?>"><i class="fa fa-fw fa-edit"></i> Edit</a>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
@ -15,16 +15,4 @@
|
||||
$strPath);
|
||||
?>
|
||||
|
||||
<?php if (Request::getParam("edit")): ?>
|
||||
<div class="container my-5">
|
||||
<div class="row">
|
||||
<div class="col-lg-8">
|
||||
<a class="link-underline link-underline-opacity-0" href="/post?to=<?= $strPath; ?>">Write a post here</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php
|
||||
PostRender::rows($varPosts);
|
||||
?>
|
||||
<?php PostRender::rows($varPosts); ?>
|
||||
|
Loading…
Reference in New Issue
Block a user