mirror of
https://github.com/typemill/typemill.git
synced 2025-08-04 21:27:41 +02:00
Translate error messages and error status codes
This commit is contained in:
1
content/00-welcome/05-todos.txt
Normal file
1
content/00-welcome/05-todos.txt
Normal file
@@ -0,0 +1 @@
|
||||
["# ToDos Version 2","[TOC]","## System settings","* DONE: Migrate from backend to frontend with vue and api\n* DONE: Redesign\n* DONE: License feature\n* DONE: Enhance with plugins","## Visual Editor","* DONE: Refactor and redesign\n* DONE: Fix toc component in new block\n* DONE: Fix hr component in new block\n* DONE: finish shortcode component\n* DONE: Fix inline formats\n* DONE: fix lenght of page\n* DONE: Fix design of new block at the end (background color)\n* DONE: Move Block\n* DONE: Fix headline design\n* DONE: Fix save on two enter\n* DONE: fix quote design\n* DONE: Fix toc preview\n* DONE: disable enable \n* DONE: Add load sign (from navigation)\n* DONE: File is not published from tmp to media\/files if you save the block.","## Raw Editor","* DONE: Refactor and redesign\n* DONE: Integrate highlighting","## Navigation","* DONE: Refactor and redesign\n* DONE: fix status in navigation\n* DONE: refresh navigation after changes","## Publish Controller","* DONE: Refactor and redesign\n* DONE: Create \n* DONE: publish\n* DONE: unpublish\n* DONE: discard\n* DONE: delete\n* DONE: save draft\n* DONE: switch to raw","## Meta Tabs","* DONE: Refactor and redesign\n* DONE: Enhance with plugins","## Medialib","* DONE: Refactor and redesign","## Posts","* DONE: Refactor and redesign","## Plugins","* Asset Class in progress","## Frontend","* DONE: Refactor\n* DONE: Test restrictions","## Other big tasks","* DONE: System setup\n* DONE: Recover Password","## Medium tasks","* DONE: Merge processAssets modell\n* DONE: Table of content duplicated for published pages\n* DONE: Session handling: csrf fail and session start error if restrictions are active\n* DONE: Image and files for meta","## Open tasks","* DONE: Sitemap and ping\n* DONE: Version check\n* DONE: Proxy support\n* DONE: SVG checker: https:\/\/github.com\/TribalSystems\/SVG-Sanitizer\n* DONE: Backend form builder\n* DONE: Image generation on the fly\n* DONE: Delete folder in base level\n* Make folder delete easier with glob or scandir\n* Handle formdata centrally ???\n* Markdown secure rendering\n* Responsive design\n* Captcha integration\n* Fix error api systemnavi\n* Reference feature\n* Typemill Utilities\n* Clear cache\n* Show security Log\n* User search only for +10 users\n* fix error messages\n* Wrong frontend navigation if unpublished pages\n* Customfields not styled yet.\n* Warn if open another block\n* finish youtube component\n* Solution for logo and favicon","## Cleanups:","* DONE: Events\n* Error messages\n* Translations\n* https:\/\/stackoverflow.com\/questions\/15041608\/searching-all-files-in-folder-for-strings\n* https:\/\/github.com\/skfaisal93\/AnyWhereInFiles\/blob\/master\/anywhereinfiles-1.4.php\n* https:\/\/github.com\/stephenhodgkiss\/extract-translation-text-from-php-js","## Info: Select userroles","* Userroles for file restriction: in vue-blox-components loaded via api\n* Userroles for userfields: in php model user getUserFields()\n* Userroles for meta: in php controller apiAuthorMeta getMeta()\n* Plugins and themes: in php model extension getThemeDefinitions()","## Info: License Check","* On activation in apiControllerExtension. It checks the license in yaml.\n* In plugin php code with setPremiumLicense\n* In static plugins, it checks manual premium list and method setPremiumLicense and more ","## Plugins","* MAKER: Rebuild search\n* MAKER: Rebuild contactform with shortcode","## Status codes","| Status code | Description | \n|---|---|\n| 200 ok | cell | \n| 400 bad request | The request was unacceptable due to missing or invalid parameter. | \n| 401 unauthorized | The request requires an authorization. | \n| (402 request failed) | The parameters where there but the request failed for other reasons. | \n| 403 forbidden | The user is authenticated but he has not enough rights. | \n| 404 not found | new | \n| 500 internal server error | new |"]
|
File diff suppressed because one or more lines are too long
@@ -38,7 +38,7 @@
|
||||
navtitle: 'To Dos'
|
||||
hide: false
|
||||
noindex: false
|
||||
path: /00-welcome/05-todos.md
|
||||
path: /00-welcome/05-todos.txtmd
|
||||
keyPath: '0.5'
|
||||
/cyanine-theme:
|
||||
navtitle: 'cyanine theme'
|
||||
|
@@ -28,6 +28,7 @@ abstract class Controller
|
||||
$this->c->get('dispatcher')->dispatch(new OnTwigLoaded(false), 'onTwigLoaded');
|
||||
}
|
||||
|
||||
/*
|
||||
public function getCsrfData($request)
|
||||
{
|
||||
$nameKey = $this->csrf->getTokenNameKey();
|
||||
@@ -38,7 +39,7 @@ abstract class Controller
|
||||
$valueKey => $request->getAttribute($valueKey)
|
||||
];
|
||||
}
|
||||
|
||||
*/
|
||||
protected function settingActive($setting)
|
||||
{
|
||||
if(isset($this->settings[$setting]) && $this->settings[$setting])
|
||||
|
@@ -12,6 +12,7 @@ use Typemill\Models\Content;
|
||||
use Typemill\Models\Meta;
|
||||
use Typemill\Models\Sitemap;
|
||||
use Typemill\Static\Slug;
|
||||
use Typemill\Static\Translations;
|
||||
use Typemill\Events\OnPagePublished;
|
||||
use Typemill\Events\OnPageUnpublished;
|
||||
use Typemill\Events\OnPageDeleted;
|
||||
@@ -26,10 +27,10 @@ class ControllerApiAuthorArticle extends Controller
|
||||
if(!$validRights)
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'You do not have enough rights.',
|
||||
'message' => Translations::translate('You do not have enough rights.'),
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(422);
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(403);
|
||||
}
|
||||
|
||||
$params = $request->getParsedBody();
|
||||
@@ -52,7 +53,7 @@ class ControllerApiAuthorArticle extends Controller
|
||||
if(!$item)
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'page not found',
|
||||
'message' => Translations::translate('page not found'),
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(404);
|
||||
@@ -68,7 +69,7 @@ class ControllerApiAuthorArticle extends Controller
|
||||
'message' => $publish,
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(404);
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(500);
|
||||
}
|
||||
|
||||
# refresh navigation and item
|
||||
@@ -108,10 +109,10 @@ class ControllerApiAuthorArticle extends Controller
|
||||
if(!$validRights)
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'You do not have enough rights.',
|
||||
'message' => Translations::translate('You do not have enough rights.'),
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(422);
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(403);
|
||||
}
|
||||
|
||||
$params = $request->getParsedBody();
|
||||
@@ -134,7 +135,7 @@ class ControllerApiAuthorArticle extends Controller
|
||||
if(!$item)
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'page not found',
|
||||
'message' => Translations::translate('page not found'),
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(404);
|
||||
@@ -162,7 +163,7 @@ class ControllerApiAuthorArticle extends Controller
|
||||
{
|
||||
if($folderContent->status == 'published' OR $folderContent->status == 'modified')
|
||||
{
|
||||
$message = 'There are published pages within this folder. The pages are not visible on your website anymore.';
|
||||
$message = Translations::translate('There are published pages within this folder. The pages are not visible on your website anymore.');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -185,10 +186,10 @@ class ControllerApiAuthorArticle extends Controller
|
||||
if(!$validRights)
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'You do not have enough rights.',
|
||||
'message' => Translations::translate('You do not have enough rights.'),
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(422);
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(401);
|
||||
}
|
||||
|
||||
$params = $request->getParsedBody();
|
||||
@@ -248,10 +249,10 @@ class ControllerApiAuthorArticle extends Controller
|
||||
if(!$validRights)
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'You do not have enough rights.',
|
||||
'message' => Translations::translate('You do not have enough rights.'),
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(422);
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(401);
|
||||
}
|
||||
|
||||
$params = $request->getParsedBody();
|
||||
@@ -274,7 +275,7 @@ class ControllerApiAuthorArticle extends Controller
|
||||
if(!$item)
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'page not found',
|
||||
'message' => Translations::translate('page not found'),
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(404);
|
||||
@@ -328,10 +329,10 @@ class ControllerApiAuthorArticle extends Controller
|
||||
if(!$validRights)
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'You do not have enough rights.',
|
||||
'message' => Translations::translate('You do not have enough rights.'),
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(422);
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(403);
|
||||
}
|
||||
|
||||
$params = $request->getParsedBody();
|
||||
@@ -354,7 +355,7 @@ class ControllerApiAuthorArticle extends Controller
|
||||
if(!$item)
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'page not found',
|
||||
'message' => Translations::translate('page not found'),
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(404);
|
||||
@@ -389,10 +390,10 @@ class ControllerApiAuthorArticle extends Controller
|
||||
if(!$validRights)
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'You do not have enough rights.',
|
||||
'message' => Translations::translate('You do not have enough rights.'),
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(422);
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(403);
|
||||
}
|
||||
|
||||
$params = $request->getParsedBody();
|
||||
@@ -431,10 +432,10 @@ class ControllerApiAuthorArticle extends Controller
|
||||
if(!$folder)
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'We could not find this page. Please refresh and try again.'
|
||||
'message' => Translations::translate('We could not find this page. Please refresh and try again.')
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(422);
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(404);
|
||||
}
|
||||
|
||||
$folderContent = $folder->folderContent;
|
||||
@@ -454,10 +455,10 @@ class ControllerApiAuthorArticle extends Controller
|
||||
if($folderItem->slug == $slug)
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'There is already a page with this name. Please choose another name.'
|
||||
'message' => Translations::translate('There is already a page with this name. Please choose another name.')
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(422);
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(402);
|
||||
}
|
||||
|
||||
# rename files just in case that index is not in line (because file has been moved before)
|
||||
@@ -471,10 +472,10 @@ class ControllerApiAuthorArticle extends Controller
|
||||
if($writeError)
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'Something went wrong. Please refresh the page and check, if all folders and files are writable.'
|
||||
'message' => Translations::translate('Something went wrong. Please refresh the page and check, if all folders and files are writable.')
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(422);
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(500);
|
||||
}
|
||||
|
||||
# add prefix number to the name
|
||||
@@ -488,10 +489,10 @@ class ControllerApiAuthorArticle extends Controller
|
||||
if(!$storage->writeFile('contentFolder', $folderPath, $namePath . '.txt', $content))
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'We could not create the file. Please refresh the page and check, if all folders and files are writable.'
|
||||
'message' => Translations::translate('We could not create the file. Please refresh the page and check, if all folders and files are writable.')
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(422);
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(500);
|
||||
}
|
||||
$storage->updateYaml('contentFolder', $folderPath, $namePath . '.yaml', ['meta' => ['navtitle' => $params['item_name']]]);
|
||||
}
|
||||
@@ -500,10 +501,10 @@ class ControllerApiAuthorArticle extends Controller
|
||||
if(!$storage->checkFolder('contentFolder', $folderPath, $namePath))
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'We could not create the folder. Please refresh the page and check, if all folders and files are writable.'
|
||||
'message' => Translations::translate('We could not create the folder. Please refresh the page and check, if all folders and files are writable.')
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(422);
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(500);
|
||||
}
|
||||
$storage->writeFile('contentFolder', $folderPath . DIRECTORY_SEPARATOR . $namePath, 'index.txt', $content);
|
||||
$storage->updateYaml('contentFolder', $folderPath . DIRECTORY_SEPARATOR . $namePath, 'index.yaml', ['meta' => ['navtitle' => $params['item_name']]]);
|
||||
@@ -529,10 +530,10 @@ class ControllerApiAuthorArticle extends Controller
|
||||
if(!$validRights)
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'You do not have enough rights.',
|
||||
'message' => Translations::translate('You do not have enough rights.'),
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(422);
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(403);
|
||||
}
|
||||
|
||||
$params = $request->getParsedBody();
|
||||
@@ -571,10 +572,10 @@ class ControllerApiAuthorArticle extends Controller
|
||||
if(!$folder)
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'We could not find this page. Please refresh and try again.'
|
||||
'message' => Translations::translate('We could not find this page. Please refresh and try again.')
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(422);
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(404);
|
||||
}
|
||||
|
||||
$folderContent = $folder->folderContent;
|
||||
@@ -594,10 +595,10 @@ class ControllerApiAuthorArticle extends Controller
|
||||
if($folderItem->slug == $slug)
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'There is already a page with this name. Please choose another name.'
|
||||
'message' => Translations::translate('There is already a page with this name. Please choose another name.')
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(422);
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(402);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -612,20 +613,20 @@ class ControllerApiAuthorArticle extends Controller
|
||||
if(!$storage->writeFile('contentFolder', $folderPath, $namePath . '.txt', $content))
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'We could not create the file. Please refresh the page and check, if all folders and files are writable.'
|
||||
'message' => Translations::translate('We could not create the file. Please refresh the page and check, if all folders and files are writable.')
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(422);
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(500);
|
||||
}
|
||||
$storage->updateYaml('contentFolder', $folderPath, $namePath . '.yaml', ['meta' => ['navtitle' => $params['item_name']]]);
|
||||
}
|
||||
elseif($params['type'] == 'folder')
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'We cannot create a folder, only files.'
|
||||
'message' => Translations::translate('We cannot create a folder, only files.')
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(422);
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(402);
|
||||
}
|
||||
|
||||
$navigation->clearNavigation();
|
||||
@@ -647,10 +648,10 @@ class ControllerApiAuthorArticle extends Controller
|
||||
if(!$validRights)
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'You do not have enough rights.',
|
||||
'message' => Translations::translate('You do not have enough rights.'),
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(422);
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(403);
|
||||
}
|
||||
|
||||
$params = $request->getParsedBody();
|
||||
@@ -673,7 +674,7 @@ class ControllerApiAuthorArticle extends Controller
|
||||
if(!$item)
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'page not found',
|
||||
'message' => Translations::translate('page not found'),
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(404);
|
||||
@@ -696,10 +697,10 @@ class ControllerApiAuthorArticle extends Controller
|
||||
if($sibling->slug == $params['slug'])
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'There is already a page with that slug',
|
||||
'message' => Translations::translate('There is already a page with that slug'),
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(404);
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(402);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -735,10 +736,10 @@ class ControllerApiAuthorArticle extends Controller
|
||||
if(!$validRights)
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'You do not have enough rights.',
|
||||
'message' => Translations::translate('You do not have enough rights.'),
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(422);
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(403);
|
||||
}
|
||||
|
||||
$params = $request->getParsedBody();
|
||||
@@ -832,12 +833,12 @@ class ControllerApiAuthorArticle extends Controller
|
||||
if($writeError)
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'Something went wrong. Please refresh the page and check, if all folders and files are writable.',
|
||||
'message' => Translations::translate('Something went wrong. Please refresh the page and check, if all folders and files are writable.'),
|
||||
'navigation' => $draftNavigation,
|
||||
'url' => false
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(404);
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(500);
|
||||
}
|
||||
|
||||
# refresh navigation and item
|
||||
@@ -864,10 +865,10 @@ class ControllerApiAuthorArticle extends Controller
|
||||
if(!$validRights)
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'You do not have enough rights.',
|
||||
'message' => Translations::translate('You do not have enough rights.'),
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(422);
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(403);
|
||||
}
|
||||
|
||||
$params = $request->getParsedBody();
|
||||
@@ -890,7 +891,7 @@ class ControllerApiAuthorArticle extends Controller
|
||||
if(!$item)
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'page not found',
|
||||
'message' => Translations::translate('page not found'),
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(404);
|
||||
@@ -914,7 +915,7 @@ class ControllerApiAuthorArticle extends Controller
|
||||
'message' => $result,
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(422);
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(500);
|
||||
}
|
||||
|
||||
# refresh navigation
|
||||
|
@@ -8,6 +8,7 @@ use Slim\Routing\RouteContext;
|
||||
use Typemill\Models\Navigation;
|
||||
use Typemill\Models\Validation;
|
||||
use Typemill\Models\Content;
|
||||
use Typemill\Static\Translations;
|
||||
|
||||
class ControllerApiAuthorBlock extends Controller
|
||||
{
|
||||
@@ -17,10 +18,10 @@ class ControllerApiAuthorBlock extends Controller
|
||||
if(!$validRights)
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'You do not have enough rights.',
|
||||
'message' => Translations::translate('You do not have enough rights.'),
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(422);
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(403);
|
||||
}
|
||||
|
||||
$params = $request->getParsedBody();
|
||||
@@ -44,7 +45,7 @@ class ControllerApiAuthorBlock extends Controller
|
||||
if(!$item)
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'page not found',
|
||||
'message' => Translations::translate('page not found'),
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(404);
|
||||
@@ -65,7 +66,7 @@ class ControllerApiAuthorBlock extends Controller
|
||||
elseif(($params['block_id'] == 0) OR !isset($draftMarkdown[$params['block_id']]))
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'Block-id not found.',
|
||||
'message' => Translations::translate('Block-id not found.'),
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(404);
|
||||
@@ -81,10 +82,10 @@ class ControllerApiAuthorBlock extends Controller
|
||||
if($store !== true)
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'We could not store the content: ' . $store,
|
||||
'message' => Translations::translate('We could not store the content: ') . $store,
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(404);
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(500);
|
||||
}
|
||||
|
||||
$draftMarkdownHtml = $content->addDraftHtml($draftMarkdown);
|
||||
@@ -122,10 +123,10 @@ class ControllerApiAuthorBlock extends Controller
|
||||
if(!$validRights)
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'You do not have enough rights.',
|
||||
'message' => Translations::translate('You do not have enough rights.'),
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(422);
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(403);
|
||||
}
|
||||
|
||||
$params = $request->getParsedBody();
|
||||
@@ -148,7 +149,7 @@ class ControllerApiAuthorBlock extends Controller
|
||||
if(!$item)
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'page not found',
|
||||
'message' => Translations::translate('page not found'),
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(404);
|
||||
@@ -161,7 +162,7 @@ class ControllerApiAuthorBlock extends Controller
|
||||
if(!isset($draftMarkdown[$params['index_old']]))
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'Block-id not found',
|
||||
'message' => Translations::translate('Block-id not found'),
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(404);
|
||||
@@ -174,10 +175,10 @@ class ControllerApiAuthorBlock extends Controller
|
||||
if($store !== true)
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'We could not store the content: ' . $store,
|
||||
'message' => Translations::translate('We could not store the content: ') . $store,
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(404);
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(500);
|
||||
}
|
||||
|
||||
$draftMarkdownHtml = $content->addDraftHtml($draftMarkdown);
|
||||
@@ -215,10 +216,10 @@ class ControllerApiAuthorBlock extends Controller
|
||||
if(!$validRights)
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'You do not have enough rights.',
|
||||
'message' => Translations::translate('You do not have enough rights.'),
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(422);
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(403);
|
||||
}
|
||||
|
||||
$params = $request->getParsedBody();
|
||||
@@ -241,7 +242,7 @@ class ControllerApiAuthorBlock extends Controller
|
||||
if(!$item)
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'page not found',
|
||||
'message' => Translations::translate('page not found'),
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(404);
|
||||
@@ -254,7 +255,7 @@ class ControllerApiAuthorBlock extends Controller
|
||||
if(!isset($draftMarkdown[$params['block_id']]))
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'Block-id not found.',
|
||||
'message' => Translations::translate('Block-id not found.'),
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(404);
|
||||
@@ -280,10 +281,10 @@ class ControllerApiAuthorBlock extends Controller
|
||||
if($store !== true)
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'We could not store the content: ' . $store,
|
||||
'message' => Translations::translate('We could not store the content: ') . $store,
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(404);
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(500);
|
||||
}
|
||||
|
||||
$draftMarkdownHtml = $content->addDraftHtml($draftMarkdown);
|
||||
@@ -321,10 +322,10 @@ class ControllerApiAuthorBlock extends Controller
|
||||
if(!$validRights)
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'You do not have enough rights.',
|
||||
'message' => Translations::translate('You do not have enough rights.'),
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(422);
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(403);
|
||||
}
|
||||
|
||||
$params = $request->getParsedBody();
|
||||
@@ -347,7 +348,7 @@ class ControllerApiAuthorBlock extends Controller
|
||||
if(!$item)
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'page not found',
|
||||
'message' => Translations::translate('page not found'),
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(404);
|
||||
@@ -361,7 +362,7 @@ class ControllerApiAuthorBlock extends Controller
|
||||
if(!isset($draftMarkdown[$params['block_id']]))
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'The ID of the content-block is wrong.',
|
||||
'message' => Translations::translate('The ID of the content-block is wrong.'),
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(404);
|
||||
@@ -377,10 +378,10 @@ class ControllerApiAuthorBlock extends Controller
|
||||
if($store !== true)
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'We could not store the content: ' . $store,
|
||||
'message' => Translations::translate('We could not store the content: ') . $store,
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(404);
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(500);
|
||||
}
|
||||
|
||||
$draftMarkdownHtml = $content->addDraftHtml($draftMarkdown);
|
||||
|
@@ -8,9 +8,9 @@ use Slim\Routing\RouteContext;
|
||||
use Typemill\Models\Validation;
|
||||
use Typemill\Models\Navigation;
|
||||
use Typemill\Models\Meta;
|
||||
use Typemill\Static\Translations;
|
||||
use Typemill\Events\OnMetaLoaded;
|
||||
|
||||
|
||||
class ControllerApiAuthorMeta extends Controller
|
||||
{
|
||||
public function getMeta(Request $request, Response $response, $args)
|
||||
@@ -21,10 +21,10 @@ class ControllerApiAuthorMeta extends Controller
|
||||
if(!$validRights)
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'You do not have enough rights.',
|
||||
'message' => Translations::translate('You do not have enough rights.'),
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(422);
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(403);
|
||||
}
|
||||
|
||||
$url = $request->getQueryParams()['url'] ?? false;
|
||||
@@ -35,7 +35,7 @@ class ControllerApiAuthorMeta extends Controller
|
||||
if(!$item)
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'page not found',
|
||||
'message' => Translations::translate('page not found'),
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(404);
|
||||
@@ -107,10 +107,10 @@ class ControllerApiAuthorMeta extends Controller
|
||||
if(!$validRights)
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'You do not have enough rights.',
|
||||
'message' => Translations::translate('You do not have enough rights.'),
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(422);
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(403);
|
||||
}
|
||||
|
||||
$params = $request->getParsedBody();
|
||||
@@ -133,7 +133,7 @@ class ControllerApiAuthorMeta extends Controller
|
||||
if(!$item)
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'page not found',
|
||||
'message' => Translations::translate('page not found'),
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(404);
|
||||
@@ -159,7 +159,7 @@ class ControllerApiAuthorMeta extends Controller
|
||||
if(!$tabdefinitions)
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'Tab not found',
|
||||
'message' => Translations::translate('Tab not found'),
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(404);
|
||||
@@ -178,7 +178,7 @@ class ControllerApiAuthorMeta extends Controller
|
||||
|
||||
if(!$fielddefinition)
|
||||
{
|
||||
$errors[$tab][$fieldname] = 'This field is not defined';
|
||||
$errors[$tab][$fieldname] = Translations::translate('This field is not defined');
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -196,11 +196,11 @@ class ControllerApiAuthorMeta extends Controller
|
||||
if(!empty($errors))
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'Please correct the errors.',
|
||||
'message' => Translations::translate('Please correct the errors.'),
|
||||
'errors' => $errors
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(422);
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(400);
|
||||
}
|
||||
|
||||
$pageMeta = $meta->getMetaData($item);
|
||||
@@ -247,28 +247,28 @@ class ControllerApiAuthorMeta extends Controller
|
||||
if($meta->folderContainsFolders($item))
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'The folder contains another folder so we cannot transform it. Please make sure there are only files in this folder.',
|
||||
'message' => Translations::translate('The folder contains another folder so we cannot transform it. Please make sure there are only files in this folder.'),
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(422);
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(500);
|
||||
}
|
||||
|
||||
if($params['data']['contains'] == "posts" && !$meta->transformPagesToPosts($item))
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'One or more files could not be transformed.',
|
||||
'message' => Translations::translate('One or more files could not be transformed.')
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(422);
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(500);
|
||||
}
|
||||
|
||||
if($params['data']['contains'] == "pages" && !$meta->transformPostsToPages($item))
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'One or more files could not be transformed.',
|
||||
'message' => Translations::translate('One or more files could not be transformed.')
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(422);
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(500);
|
||||
}
|
||||
|
||||
$navigation->clearNavigation();
|
||||
@@ -325,7 +325,7 @@ class ControllerApiAuthorMeta extends Controller
|
||||
'message' => $store,
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(422);
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(500);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -6,6 +6,7 @@ use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
use Psr\Http\Message\ResponseInterface as Response;
|
||||
use Typemill\Models\Media;
|
||||
use Typemill\Models\StorageWrapper;
|
||||
use Typemill\Static\Translations;
|
||||
|
||||
class ControllerApiFile extends Controller
|
||||
{
|
||||
@@ -34,7 +35,7 @@ class ControllerApiFile extends Controller
|
||||
if(!$name)
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'Filename is missing.',
|
||||
'message' => Translations::translate('Filename is missing.')
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(400);
|
||||
@@ -47,10 +48,10 @@ class ControllerApiFile extends Controller
|
||||
if(!$filedetails)
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'No File found.',
|
||||
'message' => Translations::translate('No file found.')
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(400);
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(404);
|
||||
}
|
||||
|
||||
$response->getBody()->write(json_encode([
|
||||
@@ -97,10 +98,10 @@ class ControllerApiFile extends Controller
|
||||
if(!$filename OR !$role)
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'Filename or userrole is missing.'
|
||||
'message' => Translations::translate('Filename or userrole is missing.')
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(422);
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(400);
|
||||
}
|
||||
|
||||
$userroles = $this->c->get("acl")->getRoles();
|
||||
@@ -108,10 +109,10 @@ class ControllerApiFile extends Controller
|
||||
if($role != 'all' AND !in_array($role, $userroles))
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'Userrole is unknown.'
|
||||
'message' => Translations::translate('Userrole is unknown.')
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(422);
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(400);
|
||||
}
|
||||
|
||||
$storage = new StorageWrapper('\Typemill\Models\Storage');
|
||||
@@ -149,10 +150,10 @@ class ControllerApiFile extends Controller
|
||||
if (!isset($params['file']))
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'No file found.'
|
||||
'message' => Translations::translate('File not found.')
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(404);
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(400);
|
||||
}
|
||||
|
||||
$size = (int) (strlen(rtrim($params['file'], '=')) * 3 / 4);
|
||||
@@ -164,30 +165,30 @@ class ControllerApiFile extends Controller
|
||||
if ($size === 0)
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'File is empty.'
|
||||
'message' => Translations::translate('File is empty.')
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(422);
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(400);
|
||||
}
|
||||
|
||||
# 20 MB (1 byte * 1024 * 1024 * 20 (for 20 MB))
|
||||
if ($size > 20971520)
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'File is bigger than 20MB.'
|
||||
'message' => Translations::translate('File is bigger than 20MB.')
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(422);
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(400);
|
||||
}
|
||||
|
||||
# check extension first
|
||||
if (!$this->checkAllowedExtensions($extension))
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'Filetype is not allowed.'
|
||||
'message' => Translations::translate('Filetype is not allowed.')
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(422);
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(400);
|
||||
}
|
||||
|
||||
# check mimetype and extension if there is a mimetype.
|
||||
@@ -197,10 +198,10 @@ class ControllerApiFile extends Controller
|
||||
if(!$this->checkAllowedMimeTypes($mtype, $extension))
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'The mime-type is missing, not allowed or does not fit to the file extension.'
|
||||
'message' => Translations::translate('The mime-type is missing, not allowed or does not fit to the file extension.')
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(422);
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(400);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -210,11 +211,11 @@ class ControllerApiFile extends Controller
|
||||
if(!$fileinfo OR !isset($fileinfo['url']))
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'We Could not store file to temporary folder.',
|
||||
'message' => Translations::translate('We Could not store file to temporary folder.'),
|
||||
'fullerrors' => $media->errors
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(422);
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(500);
|
||||
}
|
||||
|
||||
# if the previous check of the mtype with the base64 string failed, then do it now again with the temporary file
|
||||
@@ -230,17 +231,17 @@ class ControllerApiFile extends Controller
|
||||
$media->clearTempFolder();
|
||||
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'The mime-type is missing, not allowed or does not fit to the file extension.'
|
||||
'message' => Translations::translate('The mime-type is missing, not allowed or does not fit to the file extension.')
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(422);
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(400);
|
||||
}
|
||||
}
|
||||
|
||||
$filePath = str_replace('media/files', 'media/tmp', $fileinfo['url']);
|
||||
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'File has been stored',
|
||||
'message' => Translations::translate('File has been stored'),
|
||||
'fileinfo' => $fileinfo,
|
||||
'filepath' => $filePath
|
||||
]));
|
||||
@@ -255,7 +256,7 @@ class ControllerApiFile extends Controller
|
||||
if(!isset($params['file']) OR !$params['file'])
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'filename is missing.',
|
||||
'message' => Translations::translate('filename is missing.'),
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(400);
|
||||
@@ -271,11 +272,11 @@ class ControllerApiFile extends Controller
|
||||
'message' => $storage->getError()
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(400);
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(500);
|
||||
}
|
||||
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'File saved successfully',
|
||||
'message' => Translations::translate('File saved successfully'),
|
||||
'path' => $result,
|
||||
]));
|
||||
|
||||
@@ -289,10 +290,10 @@ class ControllerApiFile extends Controller
|
||||
if(!isset($params['name']))
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'Filename is missing.'
|
||||
'message' => Translations::translate('Filename is missing.')
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(422);
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(400);
|
||||
}
|
||||
|
||||
$storage = new StorageWrapper('\Typemill\Models\Storage');
|
||||
@@ -302,7 +303,7 @@ class ControllerApiFile extends Controller
|
||||
if($deleted)
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'File deleted successfully.'
|
||||
'message' => Translations::translate('File deleted successfully.')
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json');
|
||||
@@ -312,7 +313,7 @@ class ControllerApiFile extends Controller
|
||||
'message' => $storage->getError()
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(422);
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(500);
|
||||
}
|
||||
|
||||
# https://www.sitepoint.com/mime-types-complete-list/
|
||||
|
@@ -7,7 +7,7 @@ use Psr\Http\Message\ResponseInterface as Response;
|
||||
use Typemill\Models\Media;
|
||||
use Typemill\Models\StorageWrapper;
|
||||
use Typemill\Extensions\ParsedownExtension;
|
||||
|
||||
use Typemill\Static\Translations;
|
||||
|
||||
class ControllerApiImage extends Controller
|
||||
{
|
||||
@@ -27,7 +27,7 @@ class ControllerApiImage extends Controller
|
||||
if(!$path)
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'Path is missing.',
|
||||
'message' => Translations::translate('Path is missing.')
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(400);
|
||||
@@ -95,7 +95,7 @@ class ControllerApiImage extends Controller
|
||||
if(!$name)
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'Imagename is missing.',
|
||||
'message' => Translations::translate('Imagename is missing.')
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(400);
|
||||
@@ -108,10 +108,10 @@ class ControllerApiImage extends Controller
|
||||
if(!$imagedetails)
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'No image found.',
|
||||
'message' => Translations::translate('No image found.')
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(400);
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(404);
|
||||
}
|
||||
|
||||
$response->getBody()->write(json_encode([
|
||||
@@ -129,7 +129,7 @@ class ControllerApiImage extends Controller
|
||||
if(!isset($params['image']) OR !isset($params['name']))
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'Image or name is missing.',
|
||||
'message' => Translations::translate('Image or name is missing.')
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(400);
|
||||
@@ -150,7 +150,7 @@ class ControllerApiImage extends Controller
|
||||
'fullerrors' => $media->errors,
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(400);
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(500);
|
||||
}
|
||||
|
||||
# check if image name already exisits in live folder and create an unique name (do not overwrite existing files)
|
||||
@@ -166,7 +166,7 @@ class ControllerApiImage extends Controller
|
||||
'fullerrors' => $media->errors,
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(400);
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(500);
|
||||
}
|
||||
|
||||
# if image is not resizable (animated gif or svg)
|
||||
@@ -175,7 +175,7 @@ class ControllerApiImage extends Controller
|
||||
if($media->saveOriginalForAll())
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'Image saved successfully',
|
||||
'message' => Translations::translate('Image saved successfully'),
|
||||
'name' => 'media/live/' . $media->getFullName(),
|
||||
]));
|
||||
|
||||
@@ -187,7 +187,7 @@ class ControllerApiImage extends Controller
|
||||
'fullerrors' => $media->errors,
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(400);
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(500);
|
||||
}
|
||||
|
||||
# for all other image types, check if they should be transformed to webp
|
||||
@@ -208,7 +208,7 @@ class ControllerApiImage extends Controller
|
||||
|
||||
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'Image saved successfully',
|
||||
'message' => Translations::translate('Image saved successfully'),
|
||||
'name' => 'media/tmp/' . $media->getFullName(),
|
||||
]));
|
||||
|
||||
@@ -224,7 +224,7 @@ class ControllerApiImage extends Controller
|
||||
if(!isset($params['imgfile']) OR !$params['imgfile'])
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'Image or filename is missing.',
|
||||
'message' => Translations::translate('Image or filename is missing.'),
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(400);
|
||||
@@ -240,11 +240,11 @@ class ControllerApiImage extends Controller
|
||||
'message' => $storage->getError()
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(400);
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(500);
|
||||
}
|
||||
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'Image saved successfully',
|
||||
'message' => Translations::translate('Image saved successfully'),
|
||||
'path' => $result,
|
||||
]));
|
||||
|
||||
@@ -258,7 +258,7 @@ class ControllerApiImage extends Controller
|
||||
if(!isset($params['videourl']) OR !$params['videourl'])
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'Markdown is missing.',
|
||||
'message' => Translations::translate('Markdown is missing.'),
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(400);
|
||||
@@ -298,7 +298,11 @@ class ControllerApiImage extends Controller
|
||||
$imageData = @file_get_contents($videoURL0, 0, $ctx);
|
||||
if($imageData === false)
|
||||
{
|
||||
return $response->withJson(array('errors' => 'could not get the video image'));
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => Translations::translate('could not get the video image'),
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(500);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -314,7 +318,7 @@ class ControllerApiImage extends Controller
|
||||
'fullerrors' => $media->errors,
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(400);
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(500);
|
||||
}
|
||||
|
||||
# check if image name already exisits in live folder and create an unique name (do not overwrite existing files)
|
||||
@@ -330,7 +334,7 @@ class ControllerApiImage extends Controller
|
||||
'fullerrors' => $media->errors,
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(400);
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(500);
|
||||
}
|
||||
|
||||
# for all other image types, check if they should be transformed to webp
|
||||
@@ -359,7 +363,7 @@ class ControllerApiImage extends Controller
|
||||
if($livePath)
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'Image saved successfully',
|
||||
'message' => Translations::translate('Image saved successfully'),
|
||||
'path' => $livePath,
|
||||
]));
|
||||
|
||||
@@ -380,10 +384,10 @@ class ControllerApiImage extends Controller
|
||||
if(!isset($params['name']))
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'Imagename is missing.'
|
||||
'message' => Translations::translate('Imagename is missing.')
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(422);
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(400);
|
||||
}
|
||||
|
||||
$storage = new StorageWrapper('\Typemill\Models\Storage');
|
||||
@@ -393,7 +397,7 @@ class ControllerApiImage extends Controller
|
||||
if($deleted)
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'Image deleted successfully.'
|
||||
'message' => Translations::translate('Image deleted successfully.')
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json');
|
||||
@@ -403,6 +407,6 @@ class ControllerApiImage extends Controller
|
||||
'message' => $storage->getError()
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(422);
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(500);
|
||||
}
|
||||
}
|
||||
|
@@ -8,6 +8,7 @@ use Typemill\Models\Validation;
|
||||
use Typemill\Models\License;
|
||||
use Typemill\Models\Extension;
|
||||
use Typemill\Models\Settings;
|
||||
use Typemill\Static\Translations;
|
||||
|
||||
class ControllerApiSystemExtensions extends Controller
|
||||
{
|
||||
@@ -22,7 +23,7 @@ class ControllerApiSystemExtensions extends Controller
|
||||
if($vresult !== true)
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'Something went wrong, the input is not valid.',
|
||||
'message' => Translations::translate('Something went wrong, the input is not valid.'),
|
||||
'errors' => $vresult
|
||||
]));
|
||||
|
||||
@@ -32,10 +33,10 @@ class ControllerApiSystemExtensions extends Controller
|
||||
if(!isset($this->settings[$params['type']][$params['name']]))
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'The plugin or themes was not found.',
|
||||
'message' => Translations::translate('The plugin or themes was not found.'),
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(400);
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(404);
|
||||
}
|
||||
|
||||
if($params['checked'] == true)
|
||||
@@ -59,10 +60,10 @@ class ControllerApiSystemExtensions extends Controller
|
||||
if(!isset($licenseScope[$definitions['license']]))
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'Activation failed because you need a valid '. $definitions['license'] .'-license for this and your website must run under the domain of your license.',
|
||||
'message' => Translations::translate('Activation failed because you need a valid ') . $definitions['license'] . Translations::translate('-license for this and your website must run under the domain of your license.'),
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(400);
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(400);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -83,7 +84,7 @@ class ControllerApiSystemExtensions extends Controller
|
||||
$updatedSettings = $settings->updateSettings($objectdata);
|
||||
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'settings have been saved'
|
||||
'message' => Translations::translate('settings have been saved')
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(200);
|
||||
|
@@ -6,6 +6,7 @@ use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
use Psr\Http\Message\ResponseInterface as Response;
|
||||
use Typemill\Models\Validation;
|
||||
use Typemill\Models\License;
|
||||
use Typemill\Static\Translations;
|
||||
|
||||
class ControllerApiSystemLicense extends Controller
|
||||
{
|
||||
@@ -16,7 +17,7 @@ class ControllerApiSystemLicense extends Controller
|
||||
if(!isset($params['license']) OR !is_array($params['license']))
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'License data missing.',
|
||||
'message' => Translations::translate('License data missing.')
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(400);
|
||||
@@ -28,7 +29,7 @@ class ControllerApiSystemLicense extends Controller
|
||||
if($validationresult !== true)
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'Please correct errors in form.',
|
||||
'message' => Translations::translate('Please correct errors in form.'),
|
||||
'errors' => $validate->returnFirstValidationErrors($validationresult)
|
||||
]));
|
||||
|
||||
@@ -49,7 +50,7 @@ class ControllerApiSystemLicense extends Controller
|
||||
}
|
||||
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'Licence has been stored',
|
||||
'message' => Translations::translate('Licence has been stored'),
|
||||
'licensedata' => $license->getLicenseData($this->c->get('urlinfo'))
|
||||
]));
|
||||
|
||||
|
@@ -7,6 +7,7 @@ use Psr\Http\Message\ResponseInterface as Response;
|
||||
use Typemill\Models\Validation;
|
||||
use Typemill\Models\Extension;
|
||||
use Typemill\Models\Settings;
|
||||
use Typemill\Static\Translations;
|
||||
|
||||
class ControllerApiSystemPlugins extends Controller
|
||||
{
|
||||
@@ -27,7 +28,7 @@ class ControllerApiSystemPlugins extends Controller
|
||||
if(!empty($validator->errors))
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'Please correct tbe errors in form.',
|
||||
'message' => Translations::translate('Please correct tbe errors in form.'),
|
||||
'errors' => $validator->errors
|
||||
]));
|
||||
|
||||
@@ -48,7 +49,7 @@ class ControllerApiSystemPlugins extends Controller
|
||||
$updatedSettings = $settings->updateSettings($plugindata);
|
||||
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'settings have been saved'
|
||||
'message' => Translations::translate('settings have been saved')
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(200);
|
||||
|
@@ -8,10 +8,7 @@ use Typemill\Models\Validation;
|
||||
use Typemill\Models\Extension;
|
||||
use Typemill\Models\User;
|
||||
use Typemill\Models\Settings;
|
||||
|
||||
|
||||
# how to translate results in API call ???
|
||||
# we should translate in backend instead of twig or vue
|
||||
use Typemill\Static\Translations;
|
||||
|
||||
class ControllerApiSystemSettings extends Controller
|
||||
{
|
||||
@@ -39,7 +36,7 @@ class ControllerApiSystemSettings extends Controller
|
||||
if(!empty($valiator->errors))
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'Please correct errors in form.',
|
||||
'message' => Translations::translate('Please correct errors in form.'),
|
||||
'errors' => $validator->errors
|
||||
]));
|
||||
|
||||
@@ -50,7 +47,7 @@ class ControllerApiSystemSettings extends Controller
|
||||
$updatedSettings = $settingsModel->updateSettings($validatedOutput);
|
||||
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'settings have been saved',
|
||||
'message' => Translations::translate('settings have been saved'),
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(200);
|
||||
|
@@ -7,6 +7,7 @@ use Psr\Http\Message\ResponseInterface as Response;
|
||||
use Typemill\Models\Validation;
|
||||
use Typemill\Models\Extension;
|
||||
use Typemill\Models\Settings;
|
||||
use Typemill\Static\Translations;
|
||||
|
||||
class ControllerApiSystemThemes extends Controller
|
||||
{
|
||||
@@ -27,7 +28,7 @@ class ControllerApiSystemThemes extends Controller
|
||||
if(!empty($validator->errors))
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'Please correct tbe errors in form.',
|
||||
'message' => Translations::translate('Please correct tbe errors in form.'),
|
||||
'errors' => $validator->errors
|
||||
]));
|
||||
|
||||
@@ -41,7 +42,7 @@ class ControllerApiSystemThemes extends Controller
|
||||
$updatedSettings = $settings->updateSettings($themedata);
|
||||
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'settings have been saved',
|
||||
'message' => Translations::translate('settings have been saved')
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(200);
|
||||
|
@@ -6,6 +6,7 @@ use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
use Psr\Http\Message\ResponseInterface as Response;
|
||||
use Typemill\Models\Validation;
|
||||
use Typemill\Models\User;
|
||||
use Typemill\Static\Translations;
|
||||
|
||||
class ControllerApiSystemUsers extends Controller
|
||||
{
|
||||
@@ -103,7 +104,7 @@ class ControllerApiSystemUsers extends Controller
|
||||
if($valresult !== true)
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'Please correct the errors above.',
|
||||
'message' => Translations::translate('Please correct the errors in the form.'),
|
||||
'errors' => $validate->returnFirstValidationErrors($valresult)
|
||||
]));
|
||||
|
||||
@@ -114,7 +115,7 @@ class ControllerApiSystemUsers extends Controller
|
||||
if(!$isAdmin AND ($username !== $request->getAttribute('username')) )
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'You are not allowed to update another user.'
|
||||
'message' => Translations::translate('You are not allowed to update another user.')
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(403);
|
||||
@@ -162,7 +163,7 @@ class ControllerApiSystemUsers extends Controller
|
||||
if(!empty($validate->errors))
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'Please correct tbe errors in form.',
|
||||
'message' => Translations::translate('Please correct tbe errors in form.'),
|
||||
'errors' => $validate->errors
|
||||
]));
|
||||
|
||||
@@ -185,7 +186,7 @@ class ControllerApiSystemUsers extends Controller
|
||||
}
|
||||
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'User has been updated.'
|
||||
'message' => Translations::translate('User has been updated.')
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json');
|
||||
@@ -197,10 +198,10 @@ class ControllerApiSystemUsers extends Controller
|
||||
if(!$userrole)
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'Userrole is required.'
|
||||
'message' => Translations::translate('Userrole is required.')
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(422);
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(400);
|
||||
}
|
||||
|
||||
$user = new User();
|
||||
@@ -228,10 +229,10 @@ class ControllerApiSystemUsers extends Controller
|
||||
if(!$userdata)
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'Userdata are required.'
|
||||
'message' => Translations::translate('Userdata are required.')
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(422);
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(400);
|
||||
}
|
||||
|
||||
$validate = new Validation();
|
||||
@@ -242,7 +243,7 @@ class ControllerApiSystemUsers extends Controller
|
||||
if($valresult !== true)
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'Please correct the errors above.',
|
||||
'message' => Translations::translate('Please correct the errors in the form.'),
|
||||
'errors' => $validate->returnFirstValidationErrors($valresult)
|
||||
]));
|
||||
|
||||
@@ -258,7 +259,7 @@ class ControllerApiSystemUsers extends Controller
|
||||
if(!empty($validate->errors))
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'Please correct tbe errors in form.',
|
||||
'message' => Translations::translate('Please correct tbe errors in form.'),
|
||||
'errors' => $validate->errors
|
||||
]));
|
||||
|
||||
@@ -268,15 +269,15 @@ class ControllerApiSystemUsers extends Controller
|
||||
if(!$user->createUser($validatedOutput))
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'We could not store the new user',
|
||||
'message' => Translations::translate('We could not store the new user'),
|
||||
'error' => $user->error,
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(400);
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(500);
|
||||
}
|
||||
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'New user created.',
|
||||
'message' => Translations::translate('New user created.'),
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json');
|
||||
@@ -292,17 +293,17 @@ class ControllerApiSystemUsers extends Controller
|
||||
if(!$username)
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'Username is required.'
|
||||
'message' => Translations::translate('Username is required.')
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(422);
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(400);
|
||||
}
|
||||
|
||||
# if a non-admin-user tries to delete another account
|
||||
if(!$isAdmin AND ($username !== $request->getAttribute('c_username')) )
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'You are not allowed to delete another user.'
|
||||
'message' => Translations::translate('You are not allowed to delete another user.')
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(403);
|
||||
@@ -312,21 +313,21 @@ class ControllerApiSystemUsers extends Controller
|
||||
if(!$user->setUser($username))
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'We could not find the user',
|
||||
'message' => Translations::translate('We could not find the user'),
|
||||
'error' => $user->error
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(400);
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(404);
|
||||
}
|
||||
|
||||
if(!$user->deleteUser())
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'We could not delete the user',
|
||||
'message' => Translations::translate('We could not delete the user'),
|
||||
'error' => $user->error
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(400);
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(500);
|
||||
}
|
||||
/*
|
||||
# if user deleted his own account
|
||||
@@ -336,7 +337,7 @@ class ControllerApiSystemUsers extends Controller
|
||||
}
|
||||
*/
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'User deleted.',
|
||||
'message' => Translations::translate('User deleted.'),
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json');
|
||||
|
@@ -5,6 +5,7 @@ namespace Typemill\Controllers;
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
use Psr\Http\Message\ResponseInterface as Response;
|
||||
use Typemill\Models\Validation;
|
||||
use Typemill\Static\Translations;
|
||||
|
||||
class ControllerApiSystemVersions extends Controller
|
||||
{
|
||||
@@ -18,7 +19,7 @@ class ControllerApiSystemVersions extends Controller
|
||||
if($vresult !== true)
|
||||
{
|
||||
$response->getBody()->write(json_encode([
|
||||
'message' => 'The version check failed because of invalid parameters.'
|
||||
'message' => Translations::translate('The version check failed because of invalid parameters.')
|
||||
]));
|
||||
|
||||
return $response->withHeader('Content-Type', 'application/json')->withStatus(400);
|
||||
|
@@ -7,6 +7,7 @@ use Psr\Http\Message\ResponseInterface as Response;
|
||||
use Slim\Routing\RouteContext;
|
||||
use Typemill\Models\Validation;
|
||||
use Typemill\Models\User;
|
||||
use Typemill\Static\Translations;
|
||||
|
||||
class ControllerWebAuth extends Controller
|
||||
{
|
||||
@@ -20,12 +21,14 @@ class ControllerWebAuth extends Controller
|
||||
|
||||
public function login(Request $request, Response $response)
|
||||
{
|
||||
/*
|
||||
if( ( null !== $request->getattribute('csrf_result') ) OR ( $request->getattribute('csrf_result') === false ) )
|
||||
{
|
||||
$this->c->flash->addMessage('error', 'The form has a timeout, please try again.');
|
||||
|
||||
return $response->withHeader('Location', $this->routeParser->urlFor('auth.show'));
|
||||
}
|
||||
*/
|
||||
|
||||
$input = $request->getParsedBody();
|
||||
$validation = new Validation();
|
||||
@@ -37,7 +40,7 @@ class ControllerWebAuth extends Controller
|
||||
|
||||
if(!$user->setUserWithPassword($input['username']))
|
||||
{
|
||||
$this->c->get('flash')->addMessage('error', 'Ups, wrong password or username, please try again!!');
|
||||
$this->c->get('flash')->addMessage('error', Translations::translate('Wrong password or username, please try again.'));
|
||||
|
||||
return $response->withHeader('Location', $this->routeParser->urlFor('auth.show'))->withStatus(302);
|
||||
}
|
||||
@@ -49,7 +52,7 @@ class ControllerWebAuth extends Controller
|
||||
# check if user has confirmed the account
|
||||
if(isset($userdata['optintoken']) && $userdata['optintoken'])
|
||||
{
|
||||
$this->c->get('flash')->addMessage('error', 'Your registration is not confirmed yet. Please check your e-mails and use the confirmation link.');
|
||||
$this->c->get('flash')->addMessage('error', Translations::translate('Your registration is not confirmed yet. Please check your e-mails and use the confirmation link.'));
|
||||
return $response->withHeader('Location', $this->routeParser->urlFor('auth.show'))->withStatus(302);
|
||||
}
|
||||
|
||||
@@ -75,7 +78,7 @@ class ControllerWebAuth extends Controller
|
||||
\Typemill\Static\Helpers::addLogEntry('wrong login');
|
||||
}
|
||||
|
||||
$this->c->get('flash')->addMessage('error', 'Ups, wrong password or username, please try again.');
|
||||
$this->c->get('flash')->addMessage('error', Translations::translate('Wrong password or username, please try again.'));
|
||||
|
||||
return $response->withHeader('Location', $this->routeParser->urlFor('auth.show'))->withStatus(302);
|
||||
}
|
||||
|
@@ -40,8 +40,8 @@ class ControllerWebAuthor extends Controller
|
||||
if(!$pageinfo)
|
||||
{
|
||||
return $this->c->get('view')->render($response->withStatus(404), '404.twig', [
|
||||
'title' => 'Typemill Author Area',
|
||||
'description' => 'Typemill Version 2 wird noch besser als Version 1.'
|
||||
'title' => 'Blox editor',
|
||||
'description' => 'Edit your content with the visual blox editor'
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -110,8 +110,8 @@ class ControllerWebAuthor extends Controller
|
||||
if(!$pageinfo)
|
||||
{
|
||||
return $this->c->get('view')->render($response->withStatus(404), '404.twig', [
|
||||
'title' => 'Typemill Author Area',
|
||||
'description' => 'Typemill Version 2 wird noch besser als Version 1.'
|
||||
'title' => 'Raw editor',
|
||||
'description' => 'Edit your content with the raw editor in pure markdown syntax.'
|
||||
]);
|
||||
}
|
||||
|
||||
|
@@ -3,6 +3,7 @@
|
||||
namespace Typemill\Controllers;
|
||||
|
||||
use Typemill\Models\StorageWrapper;
|
||||
use Typemill\Static\Translations;
|
||||
|
||||
class ControllerWebDownload extends Controller
|
||||
{
|
||||
@@ -11,7 +12,8 @@ class ControllerWebDownload extends Controller
|
||||
$filename = isset($args['params']) ? $args['params'] : false;
|
||||
if(!$filename)
|
||||
{
|
||||
die('the requested file does not exist.');
|
||||
$response->getBody()->write(Translations::translate('the requested file does not exist.'))->withStatus(404);
|
||||
return $response;
|
||||
}
|
||||
|
||||
$storage = new StorageWrapper('\Typemill\Models\Storage');
|
||||
@@ -24,7 +26,8 @@ class ControllerWebDownload extends Controller
|
||||
$allowedFiletypes = [];
|
||||
if(!$this->validate($filepath, $filename, $allowedFiletypes))
|
||||
{
|
||||
die('the requested filetype is not allowed.');
|
||||
$response->getBody()->write(Translations::translate('the requested filetype does not exist.'))->withStatus(404);
|
||||
return $response;
|
||||
}
|
||||
|
||||
if($restrictions && isset($restrictions[$filefolder . $filename]))
|
||||
@@ -34,7 +37,7 @@ class ControllerWebDownload extends Controller
|
||||
|
||||
if(!$userrole)
|
||||
{
|
||||
$this->c->get('flash')->addMessage('error', "You have to be an authenticated $allowedrole to download this file.");
|
||||
$this->c->get('flash')->addMessage('error', Translations::translate('To download this file you need to be authenticated with the role') . ' ' . $allowedrole );
|
||||
|
||||
return $response->withHeader('Location', $this->routeParser->urlFor('auth.show'))->withStatus(302);
|
||||
}
|
||||
@@ -44,7 +47,7 @@ class ControllerWebDownload extends Controller
|
||||
AND !$this->c->get('acl')->inheritsRole($userrole, $allowedrole)
|
||||
)
|
||||
{
|
||||
$this->c->get('flash')->addMessage('error', "You have to be a $allowedrole to download this file.");
|
||||
$this->c->get('flash')->addMessage('error', Translations::translate('To download this file you need to be authenticated with the role') . ' ' . $allowedrole );
|
||||
|
||||
return $response->withHeader('Location', $this->routeParser->urlFor('auth.show'))->withStatus(302);
|
||||
}
|
||||
|
@@ -59,8 +59,8 @@ class ControllerWebFrontend extends Controller
|
||||
if(!$pageinfo)
|
||||
{
|
||||
return $this->c->get('view')->render($response->withStatus(404), '404.twig', [
|
||||
'title' => 'Typemill Author Area',
|
||||
'description' => 'Typemill Version 2 wird noch besser als Version 1.'
|
||||
'title' => 'Page not found',
|
||||
'description' => 'We did not find the page you where looking for.'
|
||||
]);
|
||||
}
|
||||
|
||||
|
@@ -7,6 +7,7 @@ use Psr\Http\Message\ResponseInterface as Response;
|
||||
use Slim\Routing\RouteContext;
|
||||
use Typemill\Models\User;
|
||||
use Typemill\Models\Validation;
|
||||
use Typemill\Static\Translations;
|
||||
use Typemill\Extensions\ParsedownExtension;
|
||||
|
||||
class ControllerWebRecover extends Controller
|
||||
@@ -26,13 +27,13 @@ class ControllerWebRecover extends Controller
|
||||
|
||||
if(!isset($params['email']) OR filter_var($params['email'], \FILTER_VALIDATE_EMAIL) === false )
|
||||
{
|
||||
$this->c->get('flash')->addMessage('error', 'Please enter a valid email.');
|
||||
$this->c->get('flash')->addMessage('error', Translations::translate('Please enter a valid email.'));
|
||||
|
||||
return $response->withHeader('Location', $this->routeParser->urlFor('auth.recoverform'))->withStatus(302);
|
||||
}
|
||||
|
||||
$title = 'Please check your inbox';
|
||||
$message = 'Dear user, please check the inbox of your email account for more instructions.';
|
||||
$title = Translations::translate('Check your inbox');
|
||||
$message = Translations::translate('Please check the inbox of your email account for more instructions.');
|
||||
|
||||
$user = new User();
|
||||
$requiredUser = $user->findUsersByEmail($params['email']);
|
||||
@@ -59,7 +60,9 @@ class ControllerWebRecover extends Controller
|
||||
$subjectline = (isset($settings['recoversubject']) && ($settings['recoversubject'] != '') ) ? $settings['recoversubject'] : 'Recover your password';
|
||||
$subject = '=?UTF-8?B?' . base64_encode($subjectline) . '?=';
|
||||
|
||||
$messagetext = "Dear user,<br/><br/>please use the following link to set a new password:";
|
||||
$messagetext = Translations::translate('Dear user');
|
||||
$messagetext .= ",<br/><br/>";
|
||||
$messagetext .= Translations::translate('please use the following link to set a new password') . ':';
|
||||
if(isset($settings['recovermessage']) && ($settings['recovermessage'] != ''))
|
||||
{
|
||||
$parsedown = new ParsedownExtension($urlinfo['baseurl']);
|
||||
@@ -77,8 +80,8 @@ class ControllerWebRecover extends Controller
|
||||
|
||||
if($send == 'delete')
|
||||
{
|
||||
$title = 'Error sending email';
|
||||
$message = 'Dear ' . $requiredUser['username'] . ', we could not send the email with the password instructions to your address. Please contact the website owner and ask for help.';
|
||||
$title = Translations::translate('Error sending email');
|
||||
$message = Translations::translate('Dear ') . $requiredUser['username'] . ', ' . Translations::translate('we could not send the email with the password instructions to your address. Please contact the website owner and ask for help.');
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -87,8 +90,8 @@ class ControllerWebRecover extends Controller
|
||||
$user->setValue('recovertoken', $recovertoken);
|
||||
$user->updateUser();
|
||||
|
||||
$title = 'Please check your inbox';
|
||||
$message = 'Dear ' . $requiredUser['username'] . ', please check the inbox of your email account for more instructions. Do not forget to check your spam-folder if your inbox is empty.';
|
||||
$title = Translations::translate('Check your inbox');
|
||||
$message = Translations::translate('Dear ') . $requiredUser['username'] . ', ' . Translations::translate('please check the inbox of your email account for more instructions. Do not forget to check your spam-folder if your inbox is empty.');
|
||||
}
|
||||
}
|
||||
elseif(isset($settings['securitylog']) && $settings['securitylog'])
|
||||
@@ -114,7 +117,7 @@ class ControllerWebRecover extends Controller
|
||||
\Typemill\Static\Helpers::addLogEntry('wrong password reset link');
|
||||
}
|
||||
|
||||
$this->c->get('flash')->addMessage('error', 'You tried to open the password reset page but the link was invalid.');
|
||||
$this->c->get('flash')->addMessage('error', Translations::translate('You tried to open the password reset page but the link was invalid.'));
|
||||
|
||||
return $response->withHeader('Location', $this->routeParser->urlFor('auth.login'))->withStatus(302);
|
||||
}
|
||||
@@ -129,7 +132,7 @@ class ControllerWebRecover extends Controller
|
||||
\Typemill\Static\Helpers::addLogEntry('password reset link user not found');
|
||||
}
|
||||
|
||||
$this->c->get('flash')->addMessage('error', 'You tried to open the password reset page but the link was invalid.');
|
||||
$this->c->get('flash')->addMessage('error', Translations::translate('You tried to open the password reset page but the link was invalid.'));
|
||||
|
||||
return $response->withHeader('Location', $this->routeParser->urlFor('auth.login'))->withStatus(302);
|
||||
}
|
||||
@@ -143,7 +146,7 @@ class ControllerWebRecover extends Controller
|
||||
\Typemill\Static\Helpers::addLogEntry('password reset link wrong token');
|
||||
}
|
||||
|
||||
$this->c->get('flash')->addMessage('error', 'You tried to open the password reset page but the link was invalid.');
|
||||
$this->c->get('flash')->addMessage('error', Translations::translate('You tried to open the password reset page but the link was invalid.'));
|
||||
|
||||
return $response->withHeader('Location', $this->routeParser->urlFor('auth.login'))->withStatus(302);
|
||||
}
|
||||
@@ -160,7 +163,7 @@ class ControllerWebRecover extends Controller
|
||||
\Typemill\Static\Helpers::addLogEntry('password reset link outdated');
|
||||
}
|
||||
|
||||
$this->c->get('flash')->addMessage('error', 'The link to recover the password was too old. Please create a new one.');
|
||||
$this->c->get('flash')->addMessage('error', Translations::translate('The link to recover the password was too old. Please create a new one.'));
|
||||
|
||||
return $response->withHeader('Location', $this->routeParser->urlFor('auth.login'))->withStatus(302);
|
||||
}
|
||||
@@ -179,7 +182,7 @@ class ControllerWebRecover extends Controller
|
||||
\Typemill\Static\Helpers::addLogEntry('password reset link wrong date format');
|
||||
}
|
||||
|
||||
$this->c->get('flash')->addMessage('error', 'The link to recover the password was too old. Please create a new one.');
|
||||
$this->c->get('flash')->addMessage('error', Translations::translate('The link to recover the password was too old. Please create a new one.'));
|
||||
|
||||
return $response->withHeader('Location', $this->routeParser->urlFor('auth.login'))->withStatus(302);
|
||||
}
|
||||
@@ -198,7 +201,7 @@ class ControllerWebRecover extends Controller
|
||||
\Typemill\Static\Helpers::addLogEntry('password reset link outdated');
|
||||
}
|
||||
|
||||
$this->c->get('flash')->addMessage('error', 'The link to recover the password was too old. Please create a new one.');
|
||||
$this->c->get('flash')->addMessage('error', Translations::translate('The link to recover the password was too old. Please create a new one.'));
|
||||
|
||||
return $response->withHeader('Location', $this->routeParser->urlFor('auth.login'))->withStatus(302);
|
||||
}
|
||||
@@ -222,7 +225,7 @@ class ControllerWebRecover extends Controller
|
||||
\Typemill\Static\Helpers::addLogEntry('create reset password username or token missing');
|
||||
}
|
||||
|
||||
$this->c->get('flash')->addMessage('error', 'You tried to set a new password but username or token was invalid.');
|
||||
$this->c->get('flash')->addMessage('error', Translations::translate('You tried to set a new password but username or token was invalid.'));
|
||||
|
||||
return $response->withHeader('Location', $this->routeParser->urlFor('auth.login'))->withStatus(302);
|
||||
}
|
||||
@@ -236,7 +239,7 @@ class ControllerWebRecover extends Controller
|
||||
\Typemill\Static\Helpers::addLogEntry('create reset password wrong input');
|
||||
}
|
||||
|
||||
$this->c->get('flash')->addMessage('error', 'Please correct your input.');
|
||||
$this->c->get('flash')->addMessage('error', Translations::translate('Please correct your input.'));
|
||||
|
||||
return $response->withHeader('Location', $this->routeParser->urlFor('auth.resetform', [], ['username' => $params['username'], 'recovertoken' => $params['recovertoken']]))->withStatus(302);
|
||||
}
|
||||
@@ -250,7 +253,7 @@ class ControllerWebRecover extends Controller
|
||||
\Typemill\Static\Helpers::addLogEntry('create reset password user not found');
|
||||
}
|
||||
|
||||
$this->c->get('flash')->addMessage('error', 'You tried to open the password reset page but the link was invalid.');
|
||||
$this->c->get('flash')->addMessage('error', Translations::translate('You tried to open the password reset page but the link was invalid.'));
|
||||
|
||||
return $response->withHeader('Location', $this->routeParser->urlFor('auth.login'))->withStatus(302);
|
||||
}
|
||||
@@ -264,7 +267,7 @@ class ControllerWebRecover extends Controller
|
||||
\Typemill\Static\Helpers::addLogEntry('create reset password wrong token');
|
||||
}
|
||||
|
||||
$this->c->get('flash')->addMessage('error', 'You tried to open the password reset page but the link was invalid.');
|
||||
$this->c->get('flash')->addMessage('error', Translations::translate('You tried to open the password reset page but the link was invalid.'));
|
||||
|
||||
return $response->withHeader('Location', $this->routeParser->urlFor('auth.login'))->withStatus(302);
|
||||
}
|
||||
@@ -281,7 +284,7 @@ class ControllerWebRecover extends Controller
|
||||
\Typemill\Static\Helpers::addLogEntry('create reset password date outdated');
|
||||
}
|
||||
|
||||
$this->c->get('flash')->addMessage('error', 'The link to recover the password was too old. Please create a new one.');
|
||||
$this->c->get('flash')->addMessage('error', Translations::translate('The link to recover the password was too old. Please create a new one.'));
|
||||
|
||||
return $response->withHeader('Location', $this->routeParser->urlFor('auth.login'))->withStatus(302);
|
||||
}
|
||||
@@ -300,7 +303,7 @@ class ControllerWebRecover extends Controller
|
||||
\Typemill\Static\Helpers::addLogEntry('create reset password wrong date format');
|
||||
}
|
||||
|
||||
$this->c->get('flash')->addMessage('error', 'The link to recover the password was too old. Please create a new one.');
|
||||
$this->c->get('flash')->addMessage('error', Translations::translate('The link to recover the password was too old. Please create a new one.'));
|
||||
|
||||
return $response->withHeader('Location', $this->routeParser->urlFor('auth.login'))->withStatus(302);
|
||||
}
|
||||
@@ -319,7 +322,7 @@ class ControllerWebRecover extends Controller
|
||||
\Typemill\Static\Helpers::addLogEntry('create reset password outdated');
|
||||
}
|
||||
|
||||
$this->c->get('flash')->addMessage('error', 'The link to recover the password was too old. Please create a new one.');
|
||||
$this->c->get('flash')->addMessage('error', Translations::translate('The link to recover the password was too old. Please create a new one.'));
|
||||
|
||||
return $response->withHeader('Location', $this->routeParser->urlFor('auth.login'))->withStatus(302);
|
||||
}
|
||||
@@ -332,7 +335,7 @@ class ControllerWebRecover extends Controller
|
||||
|
||||
unset($_SESSION['old']);
|
||||
|
||||
$this->c->get('flash')->addMessage('info', 'Please login with your new password.');
|
||||
$this->c->get('flash')->addMessage('info', Translations::translate('Please login with your new password.'));
|
||||
return $response->withHeader('Location', $this->routeParser->urlFor('auth.login'))->withStatus(302);
|
||||
}
|
||||
}
|
@@ -14,14 +14,14 @@ class TwigLanguageExtension extends AbstractExtension
|
||||
{
|
||||
$this->labels = $labels;
|
||||
}
|
||||
|
||||
/*
|
||||
public function getFilters()
|
||||
{
|
||||
return [
|
||||
new TwigFilter('translate', [$this, 'translate'] ),
|
||||
];
|
||||
}
|
||||
|
||||
*/
|
||||
public function getFunctions()
|
||||
{
|
||||
return [
|
||||
|
@@ -119,7 +119,7 @@ class ApiAuthentication
|
||||
|
||||
$response = new Response();
|
||||
|
||||
$response->getBody()->write('Zugriff nicht erlaubt.');
|
||||
$response->getBody()->write('Access not allowed.');
|
||||
|
||||
return $response->withStatus(401);
|
||||
}
|
||||
|
@@ -91,4 +91,10 @@ class Translations
|
||||
|
||||
return $lang;
|
||||
}
|
||||
|
||||
# this just returns the string so you can use translate-function in system files. Everything that is wrapped in translate function will be added to translation files
|
||||
public static function translate(string $string)
|
||||
{
|
||||
return $string;
|
||||
}
|
||||
}
|
@@ -16,7 +16,7 @@
|
||||
<fieldset class="">
|
||||
|
||||
<div class="my-2 {{ errors.username ? ' errors' : '' }}">
|
||||
<label for="username">{{ translate('Username') }} <abbr title="{{ 'required'|translate }}">*</abbr></label>
|
||||
<label for="username">{{ translate('Username') }} <abbr title="{{ translate('required') }}">*</abbr></label>
|
||||
<input
|
||||
type="text"
|
||||
name="username"
|
||||
@@ -29,7 +29,7 @@
|
||||
</div>
|
||||
|
||||
<div class="my-2 {{ errors.password ? ' errors' : '' }}">
|
||||
<label for="password">{{ translate('Password') }} <abbr title="{{ 'required'|translate }}">*</abbr></label>
|
||||
<label for="password">{{ translate('Password') }} <abbr title="{{ translate('required') }}">*</abbr></label>
|
||||
<input
|
||||
type="password"
|
||||
name="password"
|
||||
|
@@ -14,7 +14,7 @@
|
||||
<fieldset class="">
|
||||
|
||||
<div class="my-2 {{ errors.email ? ' errors' : '' }}">
|
||||
<label for="email">{{ 'Email'|translate }} <abbr title="{{ 'required'|translate }}">*</abbr></label>
|
||||
<label for="email">{{ translate('Email') }} <abbr title="{{ translate('required') }}">*</abbr></label>
|
||||
<input
|
||||
type="text"
|
||||
name="email"
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
<input
|
||||
type="submit"
|
||||
value="{{ 'Recover password'|translate }}"
|
||||
value="{{ translate('Recover password') }}"
|
||||
class="block w-full mt-6 px-3 py-3 border-0 font-medium text-xs leading-tight uppercase border-2 border-stone-50 text-stone-50 pointer hover:bg-stone-50 hover:text-stone-800 cursor-pointer focus:outline-none focus:ring-0 transition duration-100 ease-in-out"
|
||||
/>
|
||||
|
||||
@@ -49,8 +49,8 @@
|
||||
|
||||
<div class="lg:w-1/2 lg:bg-white lg:text-black p-5 bg-teal-600 text-white border-b border-white content-center flex justify-center items-center">
|
||||
<div class="max-w-md content-center">
|
||||
<h1 class="text-4xl py-5">Forgot your password?</h1>
|
||||
<p>Enter the email of your user-account, click the recover-button and check your mailbox for further instructions.</p>
|
||||
<h1 class="text-4xl py-5">{{ translate('Forgot your password') }}?</h1>
|
||||
<p>{{ translate('Enter the email of your user-account, click the recover-button and check your mailbox for further instructions.') }}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@@ -10,7 +10,7 @@
|
||||
<div class="max-w-md content-center">
|
||||
|
||||
<div class="my-2">
|
||||
<p> Done! </p>
|
||||
<p>{{ translate('Done') }}! </p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -23,7 +23,7 @@
|
||||
<p>{{ message }}</p>
|
||||
<p><a href="{{ url_for("auth.login") }}"
|
||||
class="block w-full mt-6 px-3 py-3 font-medium text-center text-xs leading-tight uppercase bg-teal-600 text-white pointer hover:bg-teal-700 cursor-pointer focus:outline-none focus:ring-0 transition duration-100 ease-in-out"
|
||||
>{{ 'go to login'|translate }}</a></p>
|
||||
>{{ translate('go to login') }}</a></p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
@@ -14,7 +14,7 @@
|
||||
<fieldset class="">
|
||||
|
||||
<div class="my-2 {{ errors.password ? ' errors' : '' }}">
|
||||
<label for="password">{{ translate('Password') }} <abbr title="{{ 'required'|translate }}">*</abbr></label>
|
||||
<label for="password">{{ translate('Password') }} <abbr title="{{ translate('required') }}">*</abbr></label>
|
||||
<input
|
||||
type="password"
|
||||
name="password"
|
||||
@@ -27,7 +27,7 @@
|
||||
</div>
|
||||
|
||||
<div class="my-2 {{ errors.passwordrepeat ? ' errors' : '' }}">
|
||||
<label for="passwordrepeat">{{ translate('Repeat password') }} <abbr title="{{ 'required'|translate }}">*</abbr></label>
|
||||
<label for="passwordrepeat">{{ translate('Repeat password') }} <abbr title="{{ translate('required') }}">*</abbr></label>
|
||||
<input
|
||||
type="password"
|
||||
name="passwordrepeat"
|
||||
@@ -61,12 +61,12 @@
|
||||
|
||||
<div class="lg:w-1/2 lg:bg-white lg:text-black p-5 bg-teal-600 text-white border-b border-white content-center flex justify-center items-center">
|
||||
<div class="max-w-md content-center">
|
||||
<h1 class="text-4xl py-5">Forgot your password?</h1>
|
||||
<p class="py-1">No problem, you can create a new one here. And you might find the following tips helpful:</p>
|
||||
<h1 class="text-4xl py-5">{{ translate('Forgot your password') }}?</h1>
|
||||
<p class="py-1">{{ translate('No problem, you can create a new one here.') }} {{ translate('And you might find the following tips helpful') }}:</p>
|
||||
<ul class="list-disc pl-4 py-1">
|
||||
<li>Use a strong and individual password for every account.</li>
|
||||
<li>Your browser can remember all of your passwords.</p>
|
||||
<li>The best option is a separate password manager like keepass and others.</li>
|
||||
<li>{{ translate('Use a strong and individual password for every account.') }}</li>
|
||||
<li>{{ translate('Your browser can remember all of your passwords.') }}</p>
|
||||
<li>{{ translate('The best option is a separate password manager like keepass and others.') }}</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
@@ -9,14 +9,14 @@
|
||||
<div class="lg:w-1/2 bg-teal-600 text-white min-h-screen flex justify-center items-center">
|
||||
<div class="max-w-md content-center">
|
||||
|
||||
<h1 class="text-4xl py-5">{{ 'Setup'|translate }}</h1>
|
||||
<h1 class="text-4xl py-5">{{ translate('Setup') }}</h1>
|
||||
|
||||
<form method="POST" action="{{ url_for("setup.create") }}" autocomplete="off">
|
||||
|
||||
<fieldset class="">
|
||||
|
||||
<div class="my-2 {{ errors.username ? ' errors' : '' }}">
|
||||
<label for="username">{{ 'Username'|translate }} <abbr title="{{ 'required'|translate }}">*</abbr></label>
|
||||
<label for="username">{{ translate('Username') }} <abbr title="{{ translate('required') }}">*</abbr></label>
|
||||
<input
|
||||
type="text"
|
||||
name="username"
|
||||
@@ -29,7 +29,7 @@
|
||||
</div>
|
||||
|
||||
<div class="my-2 {{ errors.email ? ' errors' : '' }}">
|
||||
<label for="email">{{ 'E-Mail'|translate }} <abbr title="{{ 'required'|translate }}">*</abbr></label>
|
||||
<label for="email">{{ translate('E-Mail') }} <abbr title="{{ translate('required') }}">*</abbr></label>
|
||||
<input
|
||||
type="text"
|
||||
name="email"
|
||||
@@ -42,7 +42,7 @@
|
||||
</div>
|
||||
|
||||
<div class="my-2 {{ errors.password ? ' errors' : '' }}">
|
||||
<label for="password">{{ 'Password'|translate }} <abbr title="{{ 'required'|translate }}">*</abbr></label>
|
||||
<label for="password">{{ translate('Password') }} <abbr title="{{ translate('required') }}">*</abbr></label>
|
||||
<input
|
||||
type="password"
|
||||
name="password"
|
||||
@@ -61,14 +61,12 @@
|
||||
|
||||
<input
|
||||
type="submit"
|
||||
value="{{ 'Setup'|translate }}"
|
||||
value="{{ translate('Setup') }}"
|
||||
class="block w-full mt-6 px-3 py-3 border-0 font-medium text-xs leading-tight uppercase border-2 border-stone-50 text-stone-50 pointer hover:bg-stone-50 hover:text-stone-800 cursor-pointer focus:outline-none focus:ring-0 transition duration-100 ease-in-out"
|
||||
/>
|
||||
|
||||
</fieldset>
|
||||
|
||||
<div id="loginarea" class="hidden"> csrf() | raw </div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
@@ -76,17 +74,17 @@
|
||||
<div class="lg:w-1/2 lg:bg-white lg:text-black p-5 bg-teal-600 text-white border-b border-white content-center flex justify-center items-center">
|
||||
<div class="max-w-md content-center">
|
||||
{% if systemerrors %}
|
||||
<h2 class="text-4xl py-5">Systemcheck</h2>
|
||||
<p>The following requirements for the installation are missing:</p>
|
||||
<h2 class="text-4xl py-5">{{ translate('Systemcheck') }}</h2>
|
||||
<p>{{ translate('The following requirements for the installation are missing') }}:</p>
|
||||
<ul style="color:red;padding: 0 14px">
|
||||
{% for systemerror in systemerrors %}
|
||||
<li style="margin: 5px 0">{{ systemerror }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% else %}
|
||||
<h2 class="text-4xl py-5">Welcome to Typemill</h2>
|
||||
<p>Hey writer, author, editor, content-guru, or website-manager. We hope you like Typemill, because we coded it just for you.</p>
|
||||
<p>Get inspired and enjoy your writing!</p>
|
||||
<h2 class="text-4xl py-5">{{ translate('Welcome to Typemill') }}</h2>
|
||||
<p>{{ translate('Hey writer, author, editor, content-guru, or website-manager.') }} {{ translate(' We hope you like Typemill, because we coded it just for you.'}}</p>
|
||||
<p>{{ translate('Get inspired and enjoy your writing') }}!</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
@@ -12,7 +12,7 @@
|
||||
{% if field.type == 'fieldset' %}
|
||||
|
||||
<fieldset class="subfield">
|
||||
<legend>{{ field.legend }}</legend>
|
||||
<legend>{{ translate(field.legend) }}</legend>
|
||||
{% for field in field.fields %}
|
||||
|
||||
{% include '/partials/fields.twig' with {'itemName' : itemName, 'object' : object } %}
|
||||
|
Reference in New Issue
Block a user