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 CSS', '/settings/css', 'code', 'sidebar', 'admin'),
|
||||||
('Edit JS', '/settings/js', 'code', 'sidebar', 'admin'),
|
('Edit JS', '/settings/js', 'code', 'sidebar', 'admin'),
|
||||||
|
|
||||||
('Copyright © 2025 Your Company.', '/', 'building', 'footer', ''),
|
('Copyright © 2025', '/', 'building', 'footer', '')"
|
||||||
('Edit this page', '?edit=1', 'edit', 'footer', 'admin')"
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,12 +156,32 @@
|
|||||||
{
|
{
|
||||||
global $c;
|
global $c;
|
||||||
|
|
||||||
$varUser = UserAuth::getUser();
|
if (UserAuth::has("is_admin"))
|
||||||
$varRegex = [
|
return true;
|
||||||
|
|
||||||
|
$varUser = UserAuth::getUser();
|
||||||
|
$strUsername = $varUser["username"] ?? null;
|
||||||
|
$varRegex = [
|
||||||
["/user/i", ($varUser == null)],
|
["/user/i", ($varUser == null)],
|
||||||
["/admin/i", (!UserAuth::has("is_admin"))],
|
["/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;
|
$intExit = 0;
|
||||||
|
|
||||||
foreach ($varRegex as $re)
|
foreach ($varRegex as $re)
|
||||||
|
@ -31,9 +31,9 @@
|
|||||||
<div>by <?= $r["username"]; ?></div>
|
<div>by <?= $r["username"]; ?></div>
|
||||||
<div>on <?= $r["created"]; ?> UTC</div>
|
<div>on <?= $r["created"]; ?> UTC</div>
|
||||||
</div>
|
</div>
|
||||||
<?php if (Request::getParam("edit")): ?>
|
<?php if (UserAuth::has("is_admin")): ?>
|
||||||
<div>
|
<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>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
|
@ -15,16 +15,4 @@
|
|||||||
$strPath);
|
$strPath);
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<?php if (Request::getParam("edit")): ?>
|
<?php PostRender::rows($varPosts); ?>
|
||||||
<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);
|
|
||||||
?>
|
|
||||||
|
Loading…
Reference in New Issue
Block a user