diff --git a/content/00-welcome/05-todos.txt b/content/00-welcome/05-todos.txt new file mode 100644 index 0000000..45377cf --- /dev/null +++ b/content/00-welcome/05-todos.txt @@ -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 |"] \ No newline at end of file diff --git a/data/navigation/navi-draft.txt b/data/navigation/navi-draft.txt index fa2b493..1ac3b01 100644 --- a/data/navigation/navi-draft.txt +++ b/data/navigation/navi-draft.txt @@ -1 +1 @@ -a:2:{i:0;O:8:"stdClass":22:{s:12:"originalName";s:10:"00-welcome";s:11:"elementType";s:6:"folder";s:8:"contains";s:5:"pages";s:6:"status";s:9:"published";s:8:"fileType";s:2:"md";s:5:"order";s:2:"00";s:4:"name";s:7:"welcome";s:4:"slug";s:7:"welcome";s:4:"path";s:11:"/00-welcome";s:15:"pathWithoutType";s:17:"/00-welcome/index";s:9:"urlRelWoF";s:8:"/welcome";s:6:"urlRel";s:17:"/typemill/welcome";s:6:"urlAbs";s:33:"http://localhost/typemill/welcome";s:3:"key";i:0;s:7:"keyPath";i:0;s:12:"keyPathArray";a:1:{i:0;s:1:"0";}s:7:"chapter";i:1;s:6:"active";b:0;s:12:"activeParent";b:0;s:4:"hide";b:0;s:13:"folderContent";a:6:{i:0;O:8:"stdClass":20:{s:12:"originalName";s:24:"00-setup-your-website.md";s:11:"elementType";s:4:"file";s:6:"status";s:9:"published";s:8:"fileType";s:2:"md";s:5:"order";s:2:"00";s:4:"name";s:18:"setup your website";s:4:"slug";s:18:"setup-your-website";s:4:"path";s:36:"/00-welcome/00-setup-your-website.md";s:15:"pathWithoutType";s:33:"/00-welcome/00-setup-your-website";s:3:"key";i:0;s:7:"keyPath";s:3:"0.0";s:12:"keyPathArray";a:2:{i:0;s:1:"0";i:1;s:1:"0";}s:7:"chapter";s:3:"1.1";s:9:"urlRelWoF";s:27:"/welcome/setup-your-website";s:6:"urlRel";s:36:"/typemill/welcome/setup-your-website";s:6:"urlAbs";s:52:"http://localhost/typemill/welcome/setup-your-website";s:6:"active";b:0;s:12:"activeParent";b:0;s:4:"hide";b:0;s:7:"noindex";b:0;}i:1;O:8:"stdClass":20:{s:12:"originalName";s:19:"01-manage-access.md";s:11:"elementType";s:4:"file";s:6:"status";s:9:"published";s:8:"fileType";s:2:"md";s:5:"order";s:2:"01";s:4:"name";s:13:"manage access";s:4:"slug";s:13:"manage-access";s:4:"path";s:31:"/00-welcome/01-manage-access.md";s:15:"pathWithoutType";s:28:"/00-welcome/01-manage-access";s:3:"key";i:1;s:7:"keyPath";s:3:"0.1";s:12:"keyPathArray";a:2:{i:0;s:1:"0";i:1;s:1:"1";}s:7:"chapter";s:3:"1.2";s:9:"urlRelWoF";s:22:"/welcome/manage-access";s:6:"urlRel";s:31:"/typemill/welcome/manage-access";s:6:"urlAbs";s:47:"http://localhost/typemill/welcome/manage-access";s:6:"active";b:0;s:12:"activeParent";b:0;s:4:"hide";b:0;s:7:"noindex";b:0;}i:2;O:8:"stdClass":20:{s:12:"originalName";s:19:"02-write-content.md";s:11:"elementType";s:4:"file";s:6:"status";s:9:"published";s:8:"fileType";s:2:"md";s:5:"order";s:2:"02";s:4:"name";s:13:"write content";s:4:"slug";s:13:"write-content";s:4:"path";s:31:"/00-welcome/02-write-content.md";s:15:"pathWithoutType";s:28:"/00-welcome/02-write-content";s:3:"key";i:2;s:7:"keyPath";s:3:"0.2";s:12:"keyPathArray";a:2:{i:0;s:1:"0";i:1;s:1:"2";}s:7:"chapter";s:3:"1.3";s:9:"urlRelWoF";s:22:"/welcome/write-content";s:6:"urlRel";s:31:"/typemill/welcome/write-content";s:6:"urlAbs";s:47:"http://localhost/typemill/welcome/write-content";s:6:"active";b:0;s:12:"activeParent";b:0;s:4:"hide";b:0;s:7:"noindex";b:0;}i:3;O:8:"stdClass":20:{s:12:"originalName";s:14:"03-get-help.md";s:11:"elementType";s:4:"file";s:6:"status";s:9:"published";s:8:"fileType";s:2:"md";s:5:"order";s:2:"03";s:4:"name";s:8:"get help";s:4:"slug";s:8:"get-help";s:4:"path";s:26:"/00-welcome/03-get-help.md";s:15:"pathWithoutType";s:23:"/00-welcome/03-get-help";s:3:"key";i:3;s:7:"keyPath";s:3:"0.3";s:12:"keyPathArray";a:2:{i:0;s:1:"0";i:1;s:1:"3";}s:7:"chapter";s:3:"1.4";s:9:"urlRelWoF";s:17:"/welcome/get-help";s:6:"urlRel";s:26:"/typemill/welcome/get-help";s:6:"urlAbs";s:42:"http://localhost/typemill/welcome/get-help";s:6:"active";b:0;s:12:"activeParent";b:0;s:4:"hide";b:0;s:7:"noindex";b:0;}i:4;O:8:"stdClass":20:{s:12:"originalName";s:19:"04-markdown-test.md";s:11:"elementType";s:4:"file";s:6:"status";s:9:"published";s:8:"fileType";s:2:"md";s:5:"order";s:2:"04";s:4:"name";s:13:"markdown test";s:4:"slug";s:13:"markdown-test";s:4:"path";s:31:"/00-welcome/04-markdown-test.md";s:15:"pathWithoutType";s:28:"/00-welcome/04-markdown-test";s:3:"key";i:4;s:7:"keyPath";s:3:"0.4";s:12:"keyPathArray";a:2:{i:0;s:1:"0";i:1;s:1:"4";}s:7:"chapter";s:3:"1.5";s:9:"urlRelWoF";s:22:"/welcome/markdown-test";s:6:"urlRel";s:31:"/typemill/welcome/markdown-test";s:6:"urlAbs";s:47:"http://localhost/typemill/welcome/markdown-test";s:6:"active";b:0;s:12:"activeParent";b:0;s:4:"hide";b:0;s:7:"noindex";b:0;}i:5;O:8:"stdClass":20:{s:12:"originalName";s:11:"05-todos.md";s:11:"elementType";s:4:"file";s:6:"status";s:9:"published";s:8:"fileType";s:2:"md";s:5:"order";s:2:"05";s:4:"name";s:6:"To Dos";s:4:"slug";s:5:"todos";s:4:"path";s:23:"/00-welcome/05-todos.md";s:15:"pathWithoutType";s:20:"/00-welcome/05-todos";s:3:"key";i:5;s:7:"keyPath";s:3:"0.5";s:12:"keyPathArray";a:2:{i:0;s:1:"0";i:1;s:1:"5";}s:7:"chapter";s:3:"1.6";s:9:"urlRelWoF";s:14:"/welcome/todos";s:6:"urlRel";s:23:"/typemill/welcome/todos";s:6:"urlAbs";s:39:"http://localhost/typemill/welcome/todos";s:6:"active";b:0;s:12:"activeParent";b:0;s:4:"hide";b:0;s:7:"noindex";b:0;}}s:7:"noindex";b:0;}i:1;O:8:"stdClass":22:{s:12:"originalName";s:16:"01-cyanine-theme";s:11:"elementType";s:6:"folder";s:8:"contains";s:5:"pages";s:6:"status";s:9:"published";s:8:"fileType";s:2:"md";s:5:"order";s:2:"01";s:4:"name";s:13:"cyanine theme";s:4:"slug";s:13:"cyanine-theme";s:4:"path";s:17:"/01-cyanine-theme";s:15:"pathWithoutType";s:23:"/01-cyanine-theme/index";s:9:"urlRelWoF";s:14:"/cyanine-theme";s:6:"urlRel";s:23:"/typemill/cyanine-theme";s:6:"urlAbs";s:39:"http://localhost/typemill/cyanine-theme";s:3:"key";i:1;s:7:"keyPath";i:1;s:12:"keyPathArray";a:1:{i:0;s:1:"1";}s:7:"chapter";i:2;s:6:"active";b:0;s:12:"activeParent";b:0;s:4:"hide";b:0;s:13:"folderContent";a:4:{i:0;O:8:"stdClass":20:{s:12:"originalName";s:17:"00-landingpage.md";s:11:"elementType";s:4:"file";s:6:"status";s:9:"published";s:8:"fileType";s:2:"md";s:5:"order";s:2:"00";s:4:"name";s:11:"landingpage";s:4:"slug";s:11:"landingpage";s:4:"path";s:35:"/01-cyanine-theme/00-landingpage.md";s:15:"pathWithoutType";s:32:"/01-cyanine-theme/00-landingpage";s:3:"key";i:0;s:7:"keyPath";s:3:"1.0";s:12:"keyPathArray";a:2:{i:0;s:1:"1";i:1;s:1:"0";}s:7:"chapter";s:3:"2.1";s:9:"urlRelWoF";s:26:"/cyanine-theme/landingpage";s:6:"urlRel";s:35:"/typemill/cyanine-theme/landingpage";s:6:"urlAbs";s:51:"http://localhost/typemill/cyanine-theme/landingpage";s:6:"active";b:0;s:12:"activeParent";b:0;s:4:"hide";b:0;s:7:"noindex";b:1;}i:1;O:8:"stdClass":20:{s:12:"originalName";s:22:"01-colors-and-fonts.md";s:11:"elementType";s:4:"file";s:6:"status";s:9:"published";s:8:"fileType";s:2:"md";s:5:"order";s:2:"01";s:4:"name";s:16:"colors and fonts";s:4:"slug";s:16:"colors-and-fonts";s:4:"path";s:40:"/01-cyanine-theme/01-colors-and-fonts.md";s:15:"pathWithoutType";s:37:"/01-cyanine-theme/01-colors-and-fonts";s:3:"key";i:1;s:7:"keyPath";s:3:"1.1";s:12:"keyPathArray";a:2:{i:0;s:1:"1";i:1;s:1:"1";}s:7:"chapter";s:3:"2.2";s:9:"urlRelWoF";s:31:"/cyanine-theme/colors-and-fonts";s:6:"urlRel";s:40:"/typemill/cyanine-theme/colors-and-fonts";s:6:"urlAbs";s:56:"http://localhost/typemill/cyanine-theme/colors-and-fonts";s:6:"active";b:0;s:12:"activeParent";b:0;s:4:"hide";b:0;s:7:"noindex";b:0;}i:2;O:8:"stdClass":20:{s:12:"originalName";s:12:"02-footer.md";s:11:"elementType";s:4:"file";s:6:"status";s:9:"published";s:8:"fileType";s:2:"md";s:5:"order";s:2:"02";s:4:"name";s:6:"footer";s:4:"slug";s:6:"footer";s:4:"path";s:30:"/01-cyanine-theme/02-footer.md";s:15:"pathWithoutType";s:27:"/01-cyanine-theme/02-footer";s:3:"key";i:2;s:7:"keyPath";s:3:"1.2";s:12:"keyPathArray";a:2:{i:0;s:1:"1";i:1;s:1:"2";}s:7:"chapter";s:3:"2.3";s:9:"urlRelWoF";s:21:"/cyanine-theme/footer";s:6:"urlRel";s:30:"/typemill/cyanine-theme/footer";s:6:"urlAbs";s:46:"http://localhost/typemill/cyanine-theme/footer";s:6:"active";b:0;s:12:"activeParent";b:0;s:4:"hide";b:0;s:7:"noindex";b:0;}i:3;O:8:"stdClass":20:{s:12:"originalName";s:22:"03-content-elements.md";s:11:"elementType";s:4:"file";s:6:"status";s:9:"published";s:8:"fileType";s:2:"md";s:5:"order";s:2:"03";s:4:"name";s:16:"content elements";s:4:"slug";s:16:"content-elements";s:4:"path";s:40:"/01-cyanine-theme/03-content-elements.md";s:15:"pathWithoutType";s:37:"/01-cyanine-theme/03-content-elements";s:3:"key";i:3;s:7:"keyPath";s:3:"1.3";s:12:"keyPathArray";a:2:{i:0;s:1:"1";i:1;s:1:"3";}s:7:"chapter";s:3:"2.4";s:9:"urlRelWoF";s:31:"/cyanine-theme/content-elements";s:6:"urlRel";s:40:"/typemill/cyanine-theme/content-elements";s:6:"urlAbs";s:56:"http://localhost/typemill/cyanine-theme/content-elements";s:6:"active";b:0;s:12:"activeParent";b:0;s:4:"hide";b:0;s:7:"noindex";b:0;}}s:7:"noindex";b:0;}} \ No newline at end of file +a:2:{i:0;O:8:"stdClass":22:{s:12:"originalName";s:10:"00-welcome";s:11:"elementType";s:6:"folder";s:8:"contains";s:5:"pages";s:6:"status";s:9:"published";s:8:"fileType";s:2:"md";s:5:"order";s:2:"00";s:4:"name";s:7:"welcome";s:4:"slug";s:7:"welcome";s:4:"path";s:11:"/00-welcome";s:15:"pathWithoutType";s:17:"/00-welcome/index";s:9:"urlRelWoF";s:8:"/welcome";s:6:"urlRel";s:17:"/typemill/welcome";s:6:"urlAbs";s:33:"http://localhost/typemill/welcome";s:3:"key";i:0;s:7:"keyPath";i:0;s:12:"keyPathArray";a:1:{i:0;s:1:"0";}s:7:"chapter";i:1;s:6:"active";b:0;s:12:"activeParent";b:0;s:4:"hide";b:0;s:13:"folderContent";a:6:{i:0;O:8:"stdClass":20:{s:12:"originalName";s:24:"00-setup-your-website.md";s:11:"elementType";s:4:"file";s:6:"status";s:9:"published";s:8:"fileType";s:2:"md";s:5:"order";s:2:"00";s:4:"name";s:18:"setup your website";s:4:"slug";s:18:"setup-your-website";s:4:"path";s:36:"/00-welcome/00-setup-your-website.md";s:15:"pathWithoutType";s:33:"/00-welcome/00-setup-your-website";s:3:"key";i:0;s:7:"keyPath";s:3:"0.0";s:12:"keyPathArray";a:2:{i:0;s:1:"0";i:1;s:1:"0";}s:7:"chapter";s:3:"1.1";s:9:"urlRelWoF";s:27:"/welcome/setup-your-website";s:6:"urlRel";s:36:"/typemill/welcome/setup-your-website";s:6:"urlAbs";s:52:"http://localhost/typemill/welcome/setup-your-website";s:6:"active";b:0;s:12:"activeParent";b:0;s:4:"hide";b:0;s:7:"noindex";b:0;}i:1;O:8:"stdClass":20:{s:12:"originalName";s:19:"01-manage-access.md";s:11:"elementType";s:4:"file";s:6:"status";s:9:"published";s:8:"fileType";s:2:"md";s:5:"order";s:2:"01";s:4:"name";s:13:"manage access";s:4:"slug";s:13:"manage-access";s:4:"path";s:31:"/00-welcome/01-manage-access.md";s:15:"pathWithoutType";s:28:"/00-welcome/01-manage-access";s:3:"key";i:1;s:7:"keyPath";s:3:"0.1";s:12:"keyPathArray";a:2:{i:0;s:1:"0";i:1;s:1:"1";}s:7:"chapter";s:3:"1.2";s:9:"urlRelWoF";s:22:"/welcome/manage-access";s:6:"urlRel";s:31:"/typemill/welcome/manage-access";s:6:"urlAbs";s:47:"http://localhost/typemill/welcome/manage-access";s:6:"active";b:0;s:12:"activeParent";b:0;s:4:"hide";b:0;s:7:"noindex";b:0;}i:2;O:8:"stdClass":20:{s:12:"originalName";s:19:"02-write-content.md";s:11:"elementType";s:4:"file";s:6:"status";s:9:"published";s:8:"fileType";s:2:"md";s:5:"order";s:2:"02";s:4:"name";s:13:"write content";s:4:"slug";s:13:"write-content";s:4:"path";s:31:"/00-welcome/02-write-content.md";s:15:"pathWithoutType";s:28:"/00-welcome/02-write-content";s:3:"key";i:2;s:7:"keyPath";s:3:"0.2";s:12:"keyPathArray";a:2:{i:0;s:1:"0";i:1;s:1:"2";}s:7:"chapter";s:3:"1.3";s:9:"urlRelWoF";s:22:"/welcome/write-content";s:6:"urlRel";s:31:"/typemill/welcome/write-content";s:6:"urlAbs";s:47:"http://localhost/typemill/welcome/write-content";s:6:"active";b:0;s:12:"activeParent";b:0;s:4:"hide";b:0;s:7:"noindex";b:0;}i:3;O:8:"stdClass":20:{s:12:"originalName";s:14:"03-get-help.md";s:11:"elementType";s:4:"file";s:6:"status";s:9:"published";s:8:"fileType";s:2:"md";s:5:"order";s:2:"03";s:4:"name";s:8:"get help";s:4:"slug";s:8:"get-help";s:4:"path";s:26:"/00-welcome/03-get-help.md";s:15:"pathWithoutType";s:23:"/00-welcome/03-get-help";s:3:"key";i:3;s:7:"keyPath";s:3:"0.3";s:12:"keyPathArray";a:2:{i:0;s:1:"0";i:1;s:1:"3";}s:7:"chapter";s:3:"1.4";s:9:"urlRelWoF";s:17:"/welcome/get-help";s:6:"urlRel";s:26:"/typemill/welcome/get-help";s:6:"urlAbs";s:42:"http://localhost/typemill/welcome/get-help";s:6:"active";b:0;s:12:"activeParent";b:0;s:4:"hide";b:0;s:7:"noindex";b:0;}i:4;O:8:"stdClass":20:{s:12:"originalName";s:19:"04-markdown-test.md";s:11:"elementType";s:4:"file";s:6:"status";s:9:"published";s:8:"fileType";s:2:"md";s:5:"order";s:2:"04";s:4:"name";s:13:"markdown test";s:4:"slug";s:13:"markdown-test";s:4:"path";s:31:"/00-welcome/04-markdown-test.md";s:15:"pathWithoutType";s:28:"/00-welcome/04-markdown-test";s:3:"key";i:4;s:7:"keyPath";s:3:"0.4";s:12:"keyPathArray";a:2:{i:0;s:1:"0";i:1;s:1:"4";}s:7:"chapter";s:3:"1.5";s:9:"urlRelWoF";s:22:"/welcome/markdown-test";s:6:"urlRel";s:31:"/typemill/welcome/markdown-test";s:6:"urlAbs";s:47:"http://localhost/typemill/welcome/markdown-test";s:6:"active";b:0;s:12:"activeParent";b:0;s:4:"hide";b:0;s:7:"noindex";b:0;}i:5;O:8:"stdClass":20:{s:12:"originalName";s:14:"05-todos.txtmd";s:11:"elementType";s:4:"file";s:6:"status";s:8:"modified";s:8:"fileType";s:3:"txt";s:5:"order";s:2:"05";s:4:"name";s:6:"To Dos";s:4:"slug";s:5:"todos";s:4:"path";s:26:"/00-welcome/05-todos.txtmd";s:15:"pathWithoutType";s:20:"/00-welcome/05-todos";s:3:"key";i:5;s:7:"keyPath";s:3:"0.5";s:12:"keyPathArray";a:2:{i:0;s:1:"0";i:1;s:1:"5";}s:7:"chapter";s:3:"1.6";s:9:"urlRelWoF";s:14:"/welcome/todos";s:6:"urlRel";s:23:"/typemill/welcome/todos";s:6:"urlAbs";s:39:"http://localhost/typemill/welcome/todos";s:6:"active";b:0;s:12:"activeParent";b:0;s:4:"hide";b:0;s:7:"noindex";b:0;}}s:7:"noindex";b:0;}i:1;O:8:"stdClass":22:{s:12:"originalName";s:16:"01-cyanine-theme";s:11:"elementType";s:6:"folder";s:8:"contains";s:5:"pages";s:6:"status";s:9:"published";s:8:"fileType";s:2:"md";s:5:"order";s:2:"01";s:4:"name";s:13:"cyanine theme";s:4:"slug";s:13:"cyanine-theme";s:4:"path";s:17:"/01-cyanine-theme";s:15:"pathWithoutType";s:23:"/01-cyanine-theme/index";s:9:"urlRelWoF";s:14:"/cyanine-theme";s:6:"urlRel";s:23:"/typemill/cyanine-theme";s:6:"urlAbs";s:39:"http://localhost/typemill/cyanine-theme";s:3:"key";i:1;s:7:"keyPath";i:1;s:12:"keyPathArray";a:1:{i:0;s:1:"1";}s:7:"chapter";i:2;s:6:"active";b:0;s:12:"activeParent";b:0;s:4:"hide";b:0;s:13:"folderContent";a:4:{i:0;O:8:"stdClass":20:{s:12:"originalName";s:17:"00-landingpage.md";s:11:"elementType";s:4:"file";s:6:"status";s:9:"published";s:8:"fileType";s:2:"md";s:5:"order";s:2:"00";s:4:"name";s:11:"landingpage";s:4:"slug";s:11:"landingpage";s:4:"path";s:35:"/01-cyanine-theme/00-landingpage.md";s:15:"pathWithoutType";s:32:"/01-cyanine-theme/00-landingpage";s:3:"key";i:0;s:7:"keyPath";s:3:"1.0";s:12:"keyPathArray";a:2:{i:0;s:1:"1";i:1;s:1:"0";}s:7:"chapter";s:3:"2.1";s:9:"urlRelWoF";s:26:"/cyanine-theme/landingpage";s:6:"urlRel";s:35:"/typemill/cyanine-theme/landingpage";s:6:"urlAbs";s:51:"http://localhost/typemill/cyanine-theme/landingpage";s:6:"active";b:0;s:12:"activeParent";b:0;s:4:"hide";b:0;s:7:"noindex";b:1;}i:1;O:8:"stdClass":20:{s:12:"originalName";s:22:"01-colors-and-fonts.md";s:11:"elementType";s:4:"file";s:6:"status";s:9:"published";s:8:"fileType";s:2:"md";s:5:"order";s:2:"01";s:4:"name";s:16:"colors and fonts";s:4:"slug";s:16:"colors-and-fonts";s:4:"path";s:40:"/01-cyanine-theme/01-colors-and-fonts.md";s:15:"pathWithoutType";s:37:"/01-cyanine-theme/01-colors-and-fonts";s:3:"key";i:1;s:7:"keyPath";s:3:"1.1";s:12:"keyPathArray";a:2:{i:0;s:1:"1";i:1;s:1:"1";}s:7:"chapter";s:3:"2.2";s:9:"urlRelWoF";s:31:"/cyanine-theme/colors-and-fonts";s:6:"urlRel";s:40:"/typemill/cyanine-theme/colors-and-fonts";s:6:"urlAbs";s:56:"http://localhost/typemill/cyanine-theme/colors-and-fonts";s:6:"active";b:0;s:12:"activeParent";b:0;s:4:"hide";b:0;s:7:"noindex";b:0;}i:2;O:8:"stdClass":20:{s:12:"originalName";s:12:"02-footer.md";s:11:"elementType";s:4:"file";s:6:"status";s:9:"published";s:8:"fileType";s:2:"md";s:5:"order";s:2:"02";s:4:"name";s:6:"footer";s:4:"slug";s:6:"footer";s:4:"path";s:30:"/01-cyanine-theme/02-footer.md";s:15:"pathWithoutType";s:27:"/01-cyanine-theme/02-footer";s:3:"key";i:2;s:7:"keyPath";s:3:"1.2";s:12:"keyPathArray";a:2:{i:0;s:1:"1";i:1;s:1:"2";}s:7:"chapter";s:3:"2.3";s:9:"urlRelWoF";s:21:"/cyanine-theme/footer";s:6:"urlRel";s:30:"/typemill/cyanine-theme/footer";s:6:"urlAbs";s:46:"http://localhost/typemill/cyanine-theme/footer";s:6:"active";b:0;s:12:"activeParent";b:0;s:4:"hide";b:0;s:7:"noindex";b:0;}i:3;O:8:"stdClass":20:{s:12:"originalName";s:22:"03-content-elements.md";s:11:"elementType";s:4:"file";s:6:"status";s:9:"published";s:8:"fileType";s:2:"md";s:5:"order";s:2:"03";s:4:"name";s:16:"content elements";s:4:"slug";s:16:"content-elements";s:4:"path";s:40:"/01-cyanine-theme/03-content-elements.md";s:15:"pathWithoutType";s:37:"/01-cyanine-theme/03-content-elements";s:3:"key";i:3;s:7:"keyPath";s:3:"1.3";s:12:"keyPathArray";a:2:{i:0;s:1:"1";i:1;s:1:"3";}s:7:"chapter";s:3:"2.4";s:9:"urlRelWoF";s:31:"/cyanine-theme/content-elements";s:6:"urlRel";s:40:"/typemill/cyanine-theme/content-elements";s:6:"urlAbs";s:56:"http://localhost/typemill/cyanine-theme/content-elements";s:6:"active";b:0;s:12:"activeParent";b:0;s:4:"hide";b:0;s:7:"noindex";b:0;}}s:7:"noindex";b:0;}} \ No newline at end of file diff --git a/data/navigation/navi-extended.txt b/data/navigation/navi-extended.txt index 7497497..51eb9f4 100644 --- a/data/navigation/navi-extended.txt +++ b/data/navigation/navi-extended.txt @@ -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' diff --git a/system/typemill/Controllers/Controller.php b/system/typemill/Controllers/Controller.php index 219ce46..593737e 100644 --- a/system/typemill/Controllers/Controller.php +++ b/system/typemill/Controllers/Controller.php @@ -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]) diff --git a/system/typemill/Controllers/ControllerApiAuthorArticle.php b/system/typemill/Controllers/ControllerApiAuthorArticle.php index 782a7f8..cd5fc11 100644 --- a/system/typemill/Controllers/ControllerApiAuthorArticle.php +++ b/system/typemill/Controllers/ControllerApiAuthorArticle.php @@ -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 diff --git a/system/typemill/Controllers/ControllerApiAuthorBlock.php b/system/typemill/Controllers/ControllerApiAuthorBlock.php index d81b497..c88910d 100644 --- a/system/typemill/Controllers/ControllerApiAuthorBlock.php +++ b/system/typemill/Controllers/ControllerApiAuthorBlock.php @@ -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); diff --git a/system/typemill/Controllers/ControllerApiAuthorMeta.php b/system/typemill/Controllers/ControllerApiAuthorMeta.php index 8d3c190..ae888b0 100644 --- a/system/typemill/Controllers/ControllerApiAuthorMeta.php +++ b/system/typemill/Controllers/ControllerApiAuthorMeta.php @@ -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); } diff --git a/system/typemill/Controllers/ControllerApiFile.php b/system/typemill/Controllers/ControllerApiFile.php index 0f30d7b..f2c1f34 100644 --- a/system/typemill/Controllers/ControllerApiFile.php +++ b/system/typemill/Controllers/ControllerApiFile.php @@ -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/ diff --git a/system/typemill/Controllers/ControllerApiImage.php b/system/typemill/Controllers/ControllerApiImage.php index 5001873..a9d2dd5 100644 --- a/system/typemill/Controllers/ControllerApiImage.php +++ b/system/typemill/Controllers/ControllerApiImage.php @@ -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); } } diff --git a/system/typemill/Controllers/ControllerApiSystemExtensions.php b/system/typemill/Controllers/ControllerApiSystemExtensions.php index bc51288..bfdd64b 100644 --- a/system/typemill/Controllers/ControllerApiSystemExtensions.php +++ b/system/typemill/Controllers/ControllerApiSystemExtensions.php @@ -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); diff --git a/system/typemill/Controllers/ControllerApiSystemLicense.php b/system/typemill/Controllers/ControllerApiSystemLicense.php index 7f9e864..b342272 100644 --- a/system/typemill/Controllers/ControllerApiSystemLicense.php +++ b/system/typemill/Controllers/ControllerApiSystemLicense.php @@ -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')) ])); diff --git a/system/typemill/Controllers/ControllerApiSystemPlugins.php b/system/typemill/Controllers/ControllerApiSystemPlugins.php index d35f6d0..45dffcb 100644 --- a/system/typemill/Controllers/ControllerApiSystemPlugins.php +++ b/system/typemill/Controllers/ControllerApiSystemPlugins.php @@ -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); diff --git a/system/typemill/Controllers/ControllerApiSystemSettings.php b/system/typemill/Controllers/ControllerApiSystemSettings.php index 7f2ade4..0c9c53c 100644 --- a/system/typemill/Controllers/ControllerApiSystemSettings.php +++ b/system/typemill/Controllers/ControllerApiSystemSettings.php @@ -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); diff --git a/system/typemill/Controllers/ControllerApiSystemThemes.php b/system/typemill/Controllers/ControllerApiSystemThemes.php index 3813339..c997d13 100644 --- a/system/typemill/Controllers/ControllerApiSystemThemes.php +++ b/system/typemill/Controllers/ControllerApiSystemThemes.php @@ -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); diff --git a/system/typemill/Controllers/ControllerApiSystemUsers.php b/system/typemill/Controllers/ControllerApiSystemUsers.php index 185ec78..a23ba10 100644 --- a/system/typemill/Controllers/ControllerApiSystemUsers.php +++ b/system/typemill/Controllers/ControllerApiSystemUsers.php @@ -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'); diff --git a/system/typemill/Controllers/ControllerApiSystemVersions.php b/system/typemill/Controllers/ControllerApiSystemVersions.php index 62ba950..59e2f2e 100644 --- a/system/typemill/Controllers/ControllerApiSystemVersions.php +++ b/system/typemill/Controllers/ControllerApiSystemVersions.php @@ -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); diff --git a/system/typemill/Controllers/ControllerWebAuth.php b/system/typemill/Controllers/ControllerWebAuth.php index 3091507..fccc7ec 100644 --- a/system/typemill/Controllers/ControllerWebAuth.php +++ b/system/typemill/Controllers/ControllerWebAuth.php @@ -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); } diff --git a/system/typemill/Controllers/ControllerWebAuthor.php b/system/typemill/Controllers/ControllerWebAuthor.php index 0ba16ca..d59b1b9 100644 --- a/system/typemill/Controllers/ControllerWebAuthor.php +++ b/system/typemill/Controllers/ControllerWebAuthor.php @@ -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.' ]); } diff --git a/system/typemill/Controllers/ControllerWebDownload.php b/system/typemill/Controllers/ControllerWebDownload.php index ee2a5a3..4ed8a84 100644 --- a/system/typemill/Controllers/ControllerWebDownload.php +++ b/system/typemill/Controllers/ControllerWebDownload.php @@ -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); } diff --git a/system/typemill/Controllers/ControllerWebFrontend.php b/system/typemill/Controllers/ControllerWebFrontend.php index 67c7add..797c4a9 100644 --- a/system/typemill/Controllers/ControllerWebFrontend.php +++ b/system/typemill/Controllers/ControllerWebFrontend.php @@ -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.' ]); } diff --git a/system/typemill/Controllers/ControllerWebRecover.php b/system/typemill/Controllers/ControllerWebRecover.php index 9417d8a..58e0d1b 100644 --- a/system/typemill/Controllers/ControllerWebRecover.php +++ b/system/typemill/Controllers/ControllerWebRecover.php @@ -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,

please use the following link to set a new password:"; + $messagetext = Translations::translate('Dear user'); + $messagetext .= ",

"; + $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); } } \ No newline at end of file diff --git a/system/typemill/Extensions/TwigLanguageExtension.php b/system/typemill/Extensions/TwigLanguageExtension.php index c583a35..a569745 100644 --- a/system/typemill/Extensions/TwigLanguageExtension.php +++ b/system/typemill/Extensions/TwigLanguageExtension.php @@ -14,14 +14,14 @@ class TwigLanguageExtension extends AbstractExtension { $this->labels = $labels; } - +/* public function getFilters() { return [ new TwigFilter('translate', [$this, 'translate'] ), ]; } - +*/ public function getFunctions() { return [ diff --git a/system/typemill/Middleware/ApiAuthentication.php b/system/typemill/Middleware/ApiAuthentication.php index 5493ece..42964c4 100644 --- a/system/typemill/Middleware/ApiAuthentication.php +++ b/system/typemill/Middleware/ApiAuthentication.php @@ -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); } diff --git a/system/typemill/Static/Translations.php b/system/typemill/Static/Translations.php index e1956c7..f52f8ba 100644 --- a/system/typemill/Static/Translations.php +++ b/system/typemill/Static/Translations.php @@ -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; + } } \ No newline at end of file diff --git a/system/typemill/author/auth/login.twig b/system/typemill/author/auth/login.twig index 7f6b202..7d63616 100644 --- a/system/typemill/author/auth/login.twig +++ b/system/typemill/author/auth/login.twig @@ -16,7 +16,7 @@
- +
- +
- + @@ -49,8 +49,8 @@
-

Forgot your password?

-

Enter the email of your user-account, click the recover-button and check your mailbox for further instructions.

+

{{ translate('Forgot your password') }}?

+

{{ translate('Enter the email of your user-account, click the recover-button and check your mailbox for further instructions.') }}

diff --git a/system/typemill/author/auth/recoverconf.twig b/system/typemill/author/auth/recoverconf.twig index a0ff5c7..ee83b29 100644 --- a/system/typemill/author/auth/recoverconf.twig +++ b/system/typemill/author/auth/recoverconf.twig @@ -10,7 +10,7 @@
-

Done!

+

{{ translate('Done') }}!

@@ -23,7 +23,7 @@

{{ message }}

{{ 'go to login'|translate }}

+ >{{ translate('go to login') }}

diff --git a/system/typemill/author/auth/reset.twig b/system/typemill/author/auth/reset.twig index 76acc34..7f6a0f2 100644 --- a/system/typemill/author/auth/reset.twig +++ b/system/typemill/author/auth/reset.twig @@ -14,7 +14,7 @@
- +
- +
-

Forgot your password?

-

No problem, you can create a new one here. And you might find the following tips helpful:

+

{{ translate('Forgot your password') }}?

+

{{ translate('No problem, you can create a new one here.') }} {{ translate('And you might find the following tips helpful') }}:

    -
  • Use a strong and individual password for every account.
  • -
  • Your browser can remember all of your passwords.

    -
  • The best option is a separate password manager like keepass and others.
  • +
  • {{ translate('Use a strong and individual password for every account.') }}
  • +
  • {{ translate('Your browser can remember all of your passwords.') }}

    +
  • {{ translate('The best option is a separate password manager like keepass and others.') }}
diff --git a/system/typemill/author/auth/setup.twig b/system/typemill/author/auth/setup.twig index 12bd383..a7949d8 100644 --- a/system/typemill/author/auth/setup.twig +++ b/system/typemill/author/auth/setup.twig @@ -9,14 +9,14 @@
-

{{ 'Setup'|translate }}

+

{{ translate('Setup') }}

- +
- +
- +
- -
@@ -76,17 +74,17 @@
{% if systemerrors %} -

Systemcheck

-

The following requirements for the installation are missing:

+

{{ translate('Systemcheck') }}

+

{{ translate('The following requirements for the installation are missing') }}:

    {% for systemerror in systemerrors %}
  • {{ systemerror }}
  • {% endfor %}
{% else %} -

Welcome to Typemill

-

Hey writer, author, editor, content-guru, or website-manager. We hope you like Typemill, because we coded it just for you.

-

Get inspired and enjoy your writing!

+

{{ translate('Welcome to Typemill') }}

+

{{ translate('Hey writer, author, editor, content-guru, or website-manager.') }} {{ translate(' We hope you like Typemill, because we coded it just for you.'}}

+

{{ translate('Get inspired and enjoy your writing') }}!

{% endif %}
diff --git a/system/typemill/author/partials/form.twig b/system/typemill/author/partials/form.twig index d0bfca1..61556a9 100644 --- a/system/typemill/author/partials/form.twig +++ b/system/typemill/author/partials/form.twig @@ -12,7 +12,7 @@ {% if field.type == 'fieldset' %}
- {{ field.legend }} + {{ translate(field.legend) }} {% for field in field.fields %} {% include '/partials/fields.twig' with {'itemName' : itemName, 'object' : object } %}