Skip to content

Commit

Permalink
Admin 1.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Awilum committed Dec 20, 2020
1 parent 84c2441 commit 671c09a
Show file tree
Hide file tree
Showing 17 changed files with 97 additions and 80 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
<a name="1.5.0"></a>
# [1.5.0](https://github.com/flextype-plugins/admin) (2020-12-20)

### Features

* **core** update code base for new Flextype 0.9.13

<a name="1.4.0"></a>
# [1.4.0](https://github.com/flextype-plugins/admin) (2020-12-07)

Expand Down
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2018-2020 Sergey Romanenko
Copyright (c) 2021 Sergey Romanenko

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
![preview](https://github.com/flextype-plugins/admin/raw/dev/preview.png)

<p align="center">
<a href="https://github.com/flextype-plugins/admin/releases"><img alt="Version" src="https://img.shields.io/github/release/flextype-plugins/admin.svg?label=version&color=black"></a> <a href="https://github.com/flextype-plugins/admin"><img src="https://img.shields.io/badge/license-MIT-blue.svg?color=black" alt="License"></a> <a href="https://github.com/flextype-plugins/admin"><img src="https://img.shields.io/github/downloads/flextype-plugins/admin/total.svg?color=black" alt="Total downloads"></a> <a href="https://github.com/flextype/flextype"><img src="https://img.shields.io/badge/Flextype-0.9.11-green.svg?color=black" alt="Flextype"></a> <a href="https://crowdin.com/project/flextype-plugin-admin"><img src="https://d322cqt584bo4o.cloudfront.net/flextype-plugin-admin/localized.svg?color=black" alt="Crowdin"></a> <a href="https://scrutinizer-ci.com/g/flextype-plugins/admin?branch=dev&color=black"><img src="https://img.shields.io/scrutinizer/g/flextype-plugins/admin.svg?branch=dev&color=black" alt="Quality Score"></a> <a href=""><img src="https://img.shields.io/discord/423097982498635778.svg?logo=discord&colorB=728ADA&label=Discord%20Chat" alt="Discord"></a>
<a href="https://github.com/flextype-plugins/admin/releases"><img alt="Version" src="https://img.shields.io/github/release/flextype-plugins/admin.svg?label=version&color=black"></a> <a href="https://github.com/flextype-plugins/admin"><img src="https://img.shields.io/badge/license-MIT-blue.svg?color=black" alt="License"></a> <a href="https://github.com/flextype-plugins/admin"><img src="https://img.shields.io/github/downloads/flextype-plugins/admin/total.svg?color=black" alt="Total downloads"></a> <a href="https://github.com/flextype/flextype"><img src="https://img.shields.io/badge/Flextype-0.9.13-green.svg?color=black" alt="Flextype"></a> <a href="https://crowdin.com/project/flextype-plugin-admin"><img src="https://d322cqt584bo4o.cloudfront.net/flextype-plugin-admin/localized.svg?color=black" alt="Crowdin"></a> <a href="https://scrutinizer-ci.com/g/flextype-plugins/admin?branch=dev&color=black"><img src="https://img.shields.io/scrutinizer/g/flextype-plugins/admin.svg?branch=dev&color=black" alt="Quality Score"></a> <a href=""><img src="https://img.shields.io/discord/423097982498635778.svg?logo=discord&colorB=728ADA&label=Discord%20Chat" alt="Discord"></a>
</p>

Admin Panel plugin for Flextype.
Expand All @@ -14,7 +14,7 @@ The following dependencies need to be installed for Form Admin Plugin.

| Item | Version | Download |
|---|---|---|
| [flextype](https://github.com/flextype/flextype) | 0.9.11 | [download](https://github.com/flextype/flextype/releases) |
| [flextype](https://github.com/flextype/flextype) | 0.9.13 | [download](https://github.com/flextype/flextype/releases) |
| [twig](https://github.com/flextype-plugins/twig) | >=1.0.0 | [download](https://github.com/flextype-plugins/twig/releases) |
| [form](https://github.com/flextype-plugins/form) | >=1.0.0 | [download](https://github.com/flextype-plugins/form/releases) |
| [form-admin](https://github.com/flextype-plugins/form-admin) | >=1.0.0 | [download](https://github.com/flextype-plugins/form-admin/releases) |
Expand Down Expand Up @@ -55,4 +55,4 @@ entries:

## LICENSE
[The MIT License (MIT)](https://github.com/flextype-plugins/admin/blob/master/LICENSE.txt)
Copyright (c) 2018-2020 [Sergey Romanenko](https://github.com/Awilum)
Copyright (c) 2021 [Sergey Romanenko](https://github.com/Awilum)
6 changes: 3 additions & 3 deletions app/Controllers/ApiAccessController.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public function addProcess(Request $request, Response $response) : Response
// Create API Token account
if (Filesystem::write(
$api_token_file_path,
flextype('yaml')->encode([
flextype('serializers')->yaml()->encode([
'title' => $post_data['title'],
'icon' => $post_data['icon'],
'limit_calls' => (int) $post_data['limit_calls'],
Expand Down Expand Up @@ -172,7 +172,7 @@ public function addProcess(Request $request, Response $response) : Response
public function edit(Request $request, Response $response) : Response
{
$token = $request->getQueryParams()['token'];
$token_data = flextype('yaml')->decode(Filesystem::read(PATH['project'] . '/tokens' . '/access/' . $token . '/token.yaml'));
$token_data = flextype('serializers')->yaml()->decode(Filesystem::read(PATH['project'] . '/tokens' . '/access/' . $token . '/token.yaml'));

return flextype('twig')->render(
$response,
Expand Down Expand Up @@ -218,7 +218,7 @@ public function editProcess(Request $request, Response $response) : Response
if (Filesystem::has($api_token_file_path)) {
if (Filesystem::write(
$api_token_file_path,
flextype('yaml')->encode([
flextype('serializers')->yaml()->encode([
'title' => $post_data['title'],
'icon' => $post_data['icon'],
'limit_calls' => (int) $post_data['limit_calls'],
Expand Down
6 changes: 3 additions & 3 deletions app/Controllers/ApiEntriesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public function addProcess(Request $request, Response $response) : Response
// Create API Token account
if (Filesystem::write(
$api_token_file_path,
flextype('yaml')->encode([
flextype('serializers')->yaml()->encode([
'title' => $post_data['title'],
'icon' => $post_data['icon'],
'limit_calls' => (int) $post_data['limit_calls'],
Expand Down Expand Up @@ -172,7 +172,7 @@ public function addProcess(Request $request, Response $response) : Response
public function edit(Request $request, Response $response) : Response
{
$token = $request->getQueryParams()['token'];
$token_data = flextype('yaml')->decode(Filesystem::read(PATH['project'] . '/tokens/entries/' . $token . '/token.yaml'));
$token_data = flextype('serializers')->yaml()->decode(Filesystem::read(PATH['project'] . '/tokens/entries/' . $token . '/token.yaml'));

return flextype('twig')->render(
$response,
Expand Down Expand Up @@ -218,7 +218,7 @@ public function editProcess(Request $request, Response $response) : Response
if (Filesystem::has($api_token_file_path)) {
if (Filesystem::write(
$api_token_file_path,
flextype('yaml')->encode([
flextype('serializers')->yaml()->encode([
'title' => $post_data['title'],
'icon' => $post_data['icon'],
'limit_calls' => (int) $post_data['limit_calls'],
Expand Down
16 changes: 8 additions & 8 deletions app/Controllers/ApiFilesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ public function __construct()
public function index(Request $request, Response $response) : Response
{
$tokens = [];
$tokens_list = Filesystem::listContents(PATH['project'] . '/tokens/files/');
$tokens_list = Filesystem::listContents(PATH['project'] . '/tokens/media/files/');

if (count($tokens_list) > 0) {
foreach ($tokens_list as $token) {
if ($token['type'] == 'dir' && Filesystem::has(PATH['project'] . '/tokens/files/' . $token['dirname'] . '/token.yaml')) {
if ($token['type'] == 'dir' && Filesystem::has(PATH['project'] . '/tokens/media/files/' . $token['dirname'] . '/token.yaml')) {
$tokens[] = $token;
}
}
Expand Down Expand Up @@ -119,7 +119,7 @@ public function addProcess(Request $request, Response $response) : Response
// Generate API token
$api_token = bin2hex(random_bytes(16));

$api_token_dir_path = PATH['project'] . '/tokens/files/' . $api_token;
$api_token_dir_path = PATH['project'] . '/tokens/media/files/' . $api_token;
$api_token_file_path = $api_token_dir_path . '/token.yaml';

if (! Filesystem::has($api_token_file_path)) {
Expand All @@ -135,7 +135,7 @@ public function addProcess(Request $request, Response $response) : Response
// Create API Token account
if (Filesystem::write(
$api_token_file_path,
flextype('yaml')->encode([
flextype('serializers')->yaml()->encode([
'title' => $post_data['title'],
'icon' => $post_data['icon'],
'limit_calls' => (int) $post_data['limit_calls'],
Expand Down Expand Up @@ -172,7 +172,7 @@ public function addProcess(Request $request, Response $response) : Response
public function edit(Request $request, Response $response) : Response
{
$token = $request->getQueryParams()['token'];
$token_data = flextype('yaml')->decode(Filesystem::read(PATH['project'] . '/tokens/files/' . $token . '/token.yaml'));
$token_data = flextype('serializers')->yaml()->decode(Filesystem::read(PATH['project'] . '/tokens/media/files/' . $token . '/token.yaml'));

return flextype('twig')->render(
$response,
Expand Down Expand Up @@ -211,14 +211,14 @@ public function editProcess(Request $request, Response $response) : Response
// Get POST data
$post_data = $request->getParsedBody();

$api_token_dir_path = PATH['project'] . '/tokens/files/' . $post_data['token'];
$api_token_dir_path = PATH['project'] . '/tokens/media/files/' . $post_data['token'];
$api_token_file_path = $api_token_dir_path . '/' . 'token.yaml';

// Update API Token File
if (Filesystem::has($api_token_file_path)) {
if (Filesystem::write(
$api_token_file_path,
flextype('yaml')->encode([
flextype('serializers')->yaml()->encode([
'title' => $post_data['title'],
'icon' => $post_data['icon'],
'limit_calls' => (int) $post_data['limit_calls'],
Expand Down Expand Up @@ -251,7 +251,7 @@ public function deleteProcess(Request $request, Response $response) : Response
// Get POST data
$post_data = $request->getParsedBody();

$api_token_dir_path = PATH['project'] . '/tokens/files/' . $post_data['token'];
$api_token_dir_path = PATH['project'] . '/tokens/media/files/' . $post_data['token'];

if (Filesystem::deleteDir($api_token_dir_path)) {
flextype('flash')->addMessage('success', __('admin_message_files_api_token_deleted'));
Expand Down
16 changes: 8 additions & 8 deletions app/Controllers/ApiFoldersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ public function __construct()
public function index(Request $request, Response $response) : Response
{
$tokens = [];
$tokens_list = Filesystem::listContents(PATH['project'] . '/tokens/folders/');
$tokens_list = Filesystem::listContents(PATH['project'] . '/tokens/media/folders/');

if (count($tokens_list) > 0) {
foreach ($tokens_list as $token) {
if ($token['type'] == 'dir' && Filesystem::has(PATH['project'] . '/tokens/folders/' . $token['dirname'] . '/token.yaml')) {
if ($token['type'] == 'dir' && Filesystem::has(PATH['project'] . '/tokens/media/folders/' . $token['dirname'] . '/token.yaml')) {
$tokens[] = $token;
}
}
Expand Down Expand Up @@ -117,7 +117,7 @@ public function addProcess(Request $request, Response $response) : Response
// Generate API token
$api_token = bin2hex(random_bytes(16));

$api_token_dir_path = PATH['project'] . '/tokens/folders/' . $api_token;
$api_token_dir_path = PATH['project'] . '/tokens/media/folders/' . $api_token;
$api_token_file_path = $api_token_dir_path . '/token.yaml';

if (! Filesystem::has($api_token_file_path)) {
Expand All @@ -133,7 +133,7 @@ public function addProcess(Request $request, Response $response) : Response
// Create API Token account
if (Filesystem::write(
$api_token_file_path,
flextype('yaml')->encode([
flextype('serializers')->yaml()->encode([
'title' => $post_data['title'],
'icon' => $post_data['icon'],
'limit_calls' => (int) $post_data['limit_calls'],
Expand Down Expand Up @@ -170,7 +170,7 @@ public function addProcess(Request $request, Response $response) : Response
public function edit(Request $request, Response $response) : Response
{
$token = $request->getQueryParams()['token'];
$token_data = flextype('yaml')->decode(Filesystem::read(PATH['project'] . '/tokens/folders/' . $token . '/token.yaml'));
$token_data = flextype('serializers')->yaml()->decode(Filesystem::read(PATH['project'] . '/tokens/media/folders/' . $token . '/token.yaml'));

return flextype('twig')->render(
$response,
Expand Down Expand Up @@ -209,14 +209,14 @@ public function editProcess(Request $request, Response $response) : Response
// Get POST data
$post_data = $request->getParsedBody();

$api_token_dir_path = PATH['project'] . '/tokens/folders/' . $post_data['token'];
$api_token_dir_path = PATH['project'] . '/tokens/media/folders/' . $post_data['token'];
$api_token_file_path = $api_token_dir_path . '/' . 'token.yaml';

// Update API Token File
if (Filesystem::has($api_token_file_path)) {
if (Filesystem::write(
$api_token_file_path,
flextype('yaml')->encode([
flextype('serializers')->yaml()->encode([
'title' => $post_data['title'],
'icon' => $post_data['icon'],
'limit_calls' => (int) $post_data['limit_calls'],
Expand Down Expand Up @@ -249,7 +249,7 @@ public function deleteProcess(Request $request, Response $response) : Response
// Get POST data
$post_data = $request->getParsedBody();

$api_token_dir_path = PATH['project'] . '/tokens/folders/' . $post_data['token'];
$api_token_dir_path = PATH['project'] . '/tokens/media/folders/' . $post_data['token'];

if (Filesystem::deleteDir($api_token_dir_path)) {
flextype('flash')->addMessage('success', __('admin_message_folders_api_token_deleted'));
Expand Down
6 changes: 3 additions & 3 deletions app/Controllers/ApiImagesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public function addProcess(Request $request, Response $response) : Response
// Create API Token account
if (Filesystem::write(
$api_token_file_path,
flextype('yaml')->encode([
flextype('serializers')->yaml()->encode([
'title' => $post_data['title'],
'icon' => $post_data['icon'],
'limit_calls' => (int) $post_data['limit_calls'],
Expand Down Expand Up @@ -170,7 +170,7 @@ public function addProcess(Request $request, Response $response) : Response
public function edit(Request $request, Response $response) : Response
{
$token = $request->getQueryParams()['token'];
$token_data = flextype('yaml')->decode(Filesystem::read(PATH['project'] . '/tokens' . '/images/' . $token . '/token.yaml'));
$token_data = flextype('serializers')->yaml()->decode(Filesystem::read(PATH['project'] . '/tokens' . '/images/' . $token . '/token.yaml'));

return flextype('twig')->render(
$response,
Expand Down Expand Up @@ -216,7 +216,7 @@ public function editProcess(Request $request, Response $response) : Response
if (Filesystem::has($api_token_file_path)) {
if (Filesystem::write(
$api_token_file_path,
flextype('yaml')->encode([
flextype('serializers')->yaml()->encode([
'title' => $post_data['title'],
'icon' => $post_data['icon'],
'limit_calls' => (int) $post_data['limit_calls'],
Expand Down
6 changes: 3 additions & 3 deletions app/Controllers/ApiRegistryController.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public function addProcess(Request $request, Response $response) : Response
// Create API Token account
if (Filesystem::write(
$api_token_file_path,
flextype('yaml')->encode([
flextype('serializers')->yaml()->encode([
'title' => $post_data['title'],
'icon' => $post_data['icon'],
'limit_calls' => (int) $post_data['limit_calls'],
Expand Down Expand Up @@ -170,7 +170,7 @@ public function addProcess(Request $request, Response $response) : Response
public function edit(Request $request, Response $response) : Response
{
$token = $request->getQueryParams()['token'];
$token_data = flextype('yaml')->decode(Filesystem::read(PATH['project'] . '/tokens/registry/' . $token . '/token.yaml'));
$token_data = flextype('serializers')->yaml()->decode(Filesystem::read(PATH['project'] . '/tokens/registry/' . $token . '/token.yaml'));

return flextype('twig')->render(
$response,
Expand Down Expand Up @@ -216,7 +216,7 @@ public function editProcess(Request $request, Response $response) : Response
if (Filesystem::has($api_token_file_path)) {
if (Filesystem::write(
$api_token_file_path,
flextype('yaml')->encode([
flextype('serializers')->yaml()->encode([
'title' => $post_data['title'],
'icon' => $post_data['icon'],
'limit_calls' => (int) $post_data['limit_calls'],
Expand Down
Loading

0 comments on commit 671c09a

Please sign in to comment.