From c8e8bee51b523aeed5d9a1eef43535428e854c12 Mon Sep 17 00:00:00 2001 From: danpros Date: Sat, 30 Mar 2024 11:49:22 +0700 Subject: [PATCH] Improve user role --- system/admin/admin.php | 42 +- system/admin/views/content-type.html.php | 7 +- system/admin/views/layout.html.php | 55 +- system/htmly.php | 2174 +++++++++++++--------- themes/blog/main.html.php | 2 +- themes/clean/main.html.php | 2 +- themes/doks/main.html.php | 2 +- themes/doks/post.html.php | 2 +- themes/doks/profile.html.php | 2 +- themes/doks/static.html.php | 2 +- themes/logs/main.html.php | 2 +- themes/logs/post.html.php | 2 +- themes/readable/main.html.php | 2 +- themes/twentyfifteen/main.html.php | 2 +- themes/twentysixteen/main.html.php | 2 +- 15 files changed, 1369 insertions(+), 931 deletions(-) diff --git a/system/admin/admin.php b/system/admin/admin.php index 9f1defd..c9c81e3 100644 --- a/system/admin/admin.php +++ b/system/admin/admin.php @@ -1358,25 +1358,27 @@ EOF; $toolbar .= '
'; return $tmp; } + +function authorized ($data = null) +{ + if (login()) { + if (is_null($data)) { + return false; + } + $user = $_SESSION[site_url()]['user']; + $role = user('role', $user); + if (isset($data->author)) { + if ($user === $data->author || $role === 'editor' || $role === 'admin') { + return true; + } else { + return false; + } + } else { + if ($role === 'editor' || $role === 'admin') { + return true; + } else { + return false; + } + } + } +} diff --git a/system/admin/views/content-type.html.php b/system/admin/views/content-type.html.php index 2ee9595..4e99532 100644 --- a/system/admin/views/content-type.html.php +++ b/system/admin/views/content-type.html.php @@ -1,6 +1,9 @@

- +


.

@@ -11,6 +14,8 @@


.


.

+


.

+
\ No newline at end of file diff --git a/system/admin/views/layout.html.php b/system/admin/views/layout.html.php index 8652db8..e3328d7 100644 --- a/system/admin/views/layout.html.php +++ b/system/admin/views/layout.html.php @@ -12,7 +12,10 @@ - +
@@ -75,12 +78,21 @@

+ + + + - - - + +
diff --git a/themes/clean/main.html.php b/themes/clean/main.html.php index 90ee561..2366c65 100644 --- a/themes/clean/main.html.php +++ b/themes/clean/main.html.php @@ -28,7 +28,7 @@ - url ?>> - Edit'; } ?> + Edit'; } ?>
image)) { ?> image)) { ?>
image)) { ?>