From f887b1f0a9069aaf46a7e52420adc43df9f28dea Mon Sep 17 00:00:00 2001 From: themohooks <81331307+themohooks@users.noreply.github.com> Date: Sun, 21 Jul 2024 17:22:27 +0300 Subject: [PATCH] add site news --- app/Controllers/Api/Admin/CreateNews.php | 23 +++++++ app/Controllers/ApiController.php | 4 ++ app/Core/Routes.php | 1 + views/components/AdminSidebar.php | 4 ++ views/pages/Admin/News.php | 61 ++++++++++++++++++ views/pages/Main.php | 81 ++++++++++++++---------- 6 files changed, 141 insertions(+), 33 deletions(-) create mode 100644 app/Controllers/Api/Admin/CreateNews.php create mode 100644 views/pages/Admin/News.php diff --git a/app/Controllers/Api/Admin/CreateNews.php b/app/Controllers/Api/Admin/CreateNews.php new file mode 100644 index 0000000..b44e5d1 --- /dev/null +++ b/app/Controllers/Api/Admin/CreateNews.php @@ -0,0 +1,23 @@ + $_POST['body'], ':time' => time())); + echo json_encode( + array( + 'errorcode' => 0, + 'error' => 0 + ) + ); + } +} diff --git a/app/Controllers/ApiController.php b/app/Controllers/ApiController.php index 7da966f..2f74dec 100644 --- a/app/Controllers/ApiController.php +++ b/app/Controllers/ApiController.php @@ -16,6 +16,7 @@ use \App\Controllers\Api\Images\Comments\Load as PhotoCommentLoad; use \App\Controllers\Api\Images\Comments\Rate as PhotoCommentVote; use \App\Controllers\Api\Profile\Update as ProfileUpdate; use \App\Controllers\Api\Admin\Images\SetVisibility as AdminPhotoSetVisibility; +use \App\Controllers\Api\Admin\CreateNews as AdminCreateNews; class ApiController { @@ -59,6 +60,9 @@ class ApiController public static function photostats() { return new PhotoStats(); } + public static function admincreatenews() { + return new AdminCreateNews(); + } } \ No newline at end of file diff --git a/app/Core/Routes.php b/app/Core/Routes.php index b20d0ba..97cf220 100644 --- a/app/Core/Routes.php +++ b/app/Core/Routes.php @@ -55,6 +55,7 @@ class Routes if ($user->i('admin') > 0) { Router::any('/admin', 'AdminController@index'); Router::any('/api/admin/images/setvisibility', 'ApiController@adminsetvis'); + Router::any('/api/admin/createnews', 'ApiController@admincreatenews'); } Router::get('/logout', 'MainController@logout'); Router::get('/404', 'ExceptionRegister@notfound'); diff --git a/views/components/AdminSidebar.php b/views/components/AdminSidebar.php index 8201f38..2865f54 100644 --- a/views/components/AdminSidebar.php +++ b/views/components/AdminSidebar.php @@ -58,6 +58,10 @@ body { + + diff --git a/views/pages/Admin/News.php b/views/pages/Admin/News.php new file mode 100644 index 0000000..ebcfa81 --- /dev/null +++ b/views/pages/Admin/News.php @@ -0,0 +1,61 @@ + + + + +
+