From 52758def3c657df86b03b0f39dfb8b492702b3ce Mon Sep 17 00:00:00 2001 From: trendschau Date: Sun, 20 Aug 2023 14:39:44 +0200 Subject: [PATCH] Add update checker and proxy detection --- cache/index.json | 1 - composer.json | 2 +- composer.lock | 27 ++- content/00-welcome/05-todos.md | 12 +- content/00-welcome/05-todos.txt | 1 + content/00-welcome/05-todos.yaml | 2 +- data/demo/demotest.yaml | 4 + data/navigation/navi-draft.txt | 2 +- data/navigation/navi-extended.txt | 2 +- system/typemill/Controllers/Controller.php | 75 +----- .../ControllerApiAuthorArticle.php | 97 ++++++-- .../Controllers/ControllerApiAuthorMeta.php | 11 +- .../ControllerApiSystemPlugins.php | 6 +- .../ControllerApiSystemSettings.php | 6 +- .../Controllers/ControllerApiSystemThemes.php | 6 +- .../Controllers/ControllerApiSystemUsers.php | 12 +- .../ControllerApiSystemVersions.php | 94 ++++++++ .../Controllers/ControllerWebAuthor.php | 88 +------ .../Controllers/ControllerWebFrontend.php | 1 - .../Controllers/ControllerWebSystem.php | 10 + system/typemill/Events/OnPageRenamed.php | 14 ++ system/typemill/Models/Sitemap.php | 82 ++----- system/typemill/Models/Validation.php | 227 +++++++++++------- system/typemill/Plugin.php | 139 +++++++++-- system/typemill/Static/Plugins.php | 2 +- system/typemill/author/js/vue-plugins.js | 32 +++ system/typemill/author/js/vue-shared.js | 3 +- system/typemill/author/js/vue-system.js | 28 ++- system/typemill/author/js/vue-themes.js | 31 +++ .../author/layouts/layoutSystemBlank.twig | 5 +- system/typemill/routes/api.php | 41 ++-- system/typemill/routes/web.php | 33 +-- system/typemill/system.php | 9 + 33 files changed, 686 insertions(+), 419 deletions(-) delete mode 100644 cache/index.json create mode 100644 content/00-welcome/05-todos.txt create mode 100644 data/demo/demotest.yaml create mode 100644 system/typemill/Controllers/ControllerApiSystemVersions.php create mode 100644 system/typemill/Events/OnPageRenamed.php diff --git a/cache/index.json b/cache/index.json deleted file mode 100644 index e7650ad..0000000 --- a/cache/index.json +++ /dev/null @@ -1 +0,0 @@ -{"http://localhost/typemill/welcome":{"title":"Welcome","content":" Great that you give Typemill a try!! Typemill is a simple Flat File Content Management System (CMS). We (the community) work hard to provide the best author experience with easy and intuitive authoring tools. But Typemill is still in early development and it is likely that not everything will work perfectly out of the box. If you miss something or if you have ideas for improvements, then post a new issue on GitHub.mb","url":"http://localhost/typemill/welcome"},"http://localhost/typemill/welcome/markdown-test":{"title":"Markdown Reference and Test Page","content":" Markdown is a simple and universal syntax for text formatting. More and more writers switch to markdown, because they can format their text during the writing process without using any format-buttons. Once they are familiar with the markdown syntax, they can write formatted text much easier and faster than with any standard HTML-editor. Developers love markdown, because it is much cleaner and saver than HTML. And they can easily convert markdown to a lot of other document formats like HTML and others. If you develop a theme for TYPEMILL, please take care that all elements on this page are designed properly. Table of Contents To create a table of contents, simply write ` in a separate line. It will be replaced with a table of contents like this automatically. Headlines Headlines are simply done with hash chars like this: First Level Headline Second Level Headline Third Level Headline Fourth Level Headline Fifth Level Headline Sixth Level Headline Third Level Headline A third headline is more decent and lower prioritized than a second level headline. Fourth Level Headline A fourth level headline is more decent and lower prioritized than a third level headline. Fifth Level Headline A fifth level headline is more decent and lower prioritized than a fourth level headline. Sixth Level Headline A sixth level headline is more decent and lower prioritized than a fifths level headline. Paragraph A paragraph is a simple text-block separated with a new line above and below. A paragraph is a simple text-block separated with a new line above and below. Soft Linebreak For a soft linebreak (eg. for dialoges in literature), add two spaces at the end of a line and use a simple return. She said: \"Hello\" He said: \"again\" For a soft linebreak (eg. for dialoges in literature), add two spaces at the end of a line and use a simple return. She said: \"Hello\" He said: \"again\" Emphasis For italic text use one asterix or one underscore. For bold text use two asterix or two underscores. For italic text use one asterix or one underscore. For bold text use two asterix or two underscores. Lists For an unordered list use a dash - like - this Or use one asterix * like * this For an ordered list use whatever number you want and add a dot: 1. like 1. this For an unordered list use a dash * like * this Or use one asterix * like * this For an ordered list use whatever number you want and add a dot: 1. like 2. this Horizontal Rule Easily created for example with three dashes like this: --- Easily created for example with three dashes like this: --- This is an ordinary Link. Links can also be relative. You can link to anchors like this anchor You can also add a title. You can even add ids or classes. Or you can use a shortcut like http://typemill.net. You can even use a download-link like This is an ordinary Link. Links can also be relative. You can link to anchors like this anchor You can also add a title. You can even add ids or classes. Or you can use a shortcut like http://typemill.net. highlight (ZIP, 2.71 MB) Images The same rules as with links, but with a ! With caption With caption that spans over several lines The same rules as with links, but with a ! With a caption that spans over two lines. Linked Images You can link an image with a nested syntax like this: You can link an image with a nested syntax like this: Image Position You can controll the image position with the classes .left, .right and .middle like this: With caption that spans over several lines With caption that spans over several lines With caption that spans over several lines The first image should float on the left side of this paragraph. This might not work with all themes. If you are a theme developer, please ensure that you support the image classes \"left\", \"right\" and \"center\". You can add these classes manually in the raw mode or you can assign them in the visual mode when you edit a picture (double click on it to open the dialog). Images in a separate line are rendered with the html5 elements figure and figcapture. With caption that spans over several lines The second image should float on the right side of this paragraph. This might not work with all themes. If you are a theme developer, please ensure that you support the image classes \"left\", \"right\" and \"center\". You can add these classes manually in the raw mode or you can assign them in the visual mode when you edit a picture (double click on it to open the dialog). Images in a separate line are rendered with the html5 elements figure and figcapture. With caption that spans over several lines The thirds image should be placed above this paragraph and centered to the middle of the content area. This might not work with all themes. If you are a theme developer, please ensure that you support the image classes \"left\", \"right\" and \"center\". You can add these classes manually in the raw mode or you can assign them in the visual mode when you edit a picture (double click on it to open the dialog). Images in a separate line are rendered with the html5 elements figure and figcapture. Blockquote There are always some women and men with wise wordsBut I usually don't read them, to be honest. There always some women and men with wise wordsBut I usually don't read them, to be honest. Footnotes ` You can write footnotes with markdown. Scroll down to the end of the page and look for the footnotes. Add the footnote text at the bottom of the page like this: ","url":"http://localhost/typemill/welcome/markdown-test"},"http://localhost/typemill/welcome/manage-access":{"title":"Manage Access","content":" Typemill has a build-in system to restrict access to pages or to the whole websites. You can activate both features in the system settings under the section \"access rights\". If you activate one of the features, then Typemill will use session cookies on all frontend pages. Learn all the details in the following video tutorial: Restrict Access for the Website This feature is perfect, if you want to lock down the whole website and only grant access for authenticated users. All non-authenticated users will be redirected to the login-page. There are two main use cases for this feature: * Launch the website later: You want to create your website first and launch it to the public later, for example if you have finished the website design or if you have polished your content. * Share website internally: You want to share your typemill website only with certain users, for example with the company stuff or only with the members of your it-unit. You can activate the feature with a simple checkbox under \"Website Restrictions\". Restrict Access for Pages If you need a more fine-tuned access and if you want to restrict access only for certain pages, then you can activate the feature \"Page Restrictions\". If you activate this checkbox, then you will find two new input fields in the meta-tab of each page: * Minimum role for access: Here you can select a miminum role that the user needs to view the page content. Be aware that the roles have a hierarchy, so if you choose the role \"author\", then the \"editor\" will also have access. * Usernames: Here you can add one or more usernames (separated with comma) that have access to this page. If you don't choose anything of it, then the page has no restrictions and everybody can see the content. You have some more features in the settings area: * Cut content: Per default only the title of a restricted page is visible to the public, the content is hidden. You can change this and cut the content wherever you want with a horizontal line. * Teaser: You can add a standard text with markdown that will be displayed instead of the content or after the content is cut. * Teaser-Box: You can optionally wrap the teaser in a box. You can also combine these features with the registration plugin and this way create a membership website with member-only content.","url":"http://localhost/typemill/welcome/manage-access"},"http://localhost/typemill/welcome/get-help":{"title":"Get Help","content":" If you need any help, then please read the documentation on typemill.net first. You can also check these video-tutorials about the basics to create a typemill website. If you found a bug or if you have a question, then please open a new issue on GitHub. Do you need professional help, an individual theme or a special plugin? You can hire us at Trendschau Digital. recording 2023 05 11 at 235818 (GIF, 1.30 MB) Contributions, donations and feedback for this open source project are always welcome. ","url":"http://localhost/typemill/welcome/get-help"},"http://localhost/typemill/welcome/setup-your-website":{"title":"Setup Your Website","content":" Typemill provides detailed settings, and you have access to nearly all settings in the author panel. Learn the basics in this short video: You will find all configurations and settings under the main navigation point settings with the following sub-navigation: * System settings * Theme settings * Plugin settings * User settings All settings are stored in the \\settings folder of Typemill. It is not recommended to edit the settings manually, because it might crash the system if done wrong. Developer Settings As of version 1.4.0 you will find some advanced developer settings in the author panel under settings. See the details below. ! Only for devs ! ! These options are for developers only. Make sure that you fully understand what happens. For example, you should never activate the error reporting on live systems because this is a security risk. * Error Reporting: You can switch the error reporting of the slim-framework on and off here. This can be helpful for bug-analysis, but you should NEVER switch it on (or keep it active) on a productive system. * Twig cache: You can activate the cache for the twig templates. This will speed up the page rendering a bit, but it can also produce a headace if you changed something in your theme. The best option is to clear the cache if something does not work. * Clear cache: This will clear the cache for Twig templates and delete all cache files of Typemill. If you clear the cache, then some details might not work or look strange, for example the navigation is set back to the original state. Everything will work again when the cache has been rebuild. This happens every 10 minutes. If you want to spead up the process, then refresh your browser cache with F12 on windows machines, because it will also trigger the recreation of the Typemill cache. * Image sizes: All images in the content area will be resized to 820px width. If you want to change it, then add another value in the width-field. If you additionally add a height for your images, then the images will be resized first and then cropped to the correct aspect ratio. * Proxy: If you run Typemill behind a proxy (which is a common usecase in companies), then you can activate the proxy detection. This will read the X-Forwarded-Proto, X-Forwarded-Host and X-Forwarded-Port Headers and return the html with the correct urls. Optionally you can also add a comma separated list of trusted IP-addresses.","url":"http://localhost/typemill/welcome/setup-your-website"},"http://localhost/typemill/welcome/write-content":{"title":"Write Content","content":" Typemill provides easy and intuitive authoring tools and we work hard to create a good author experience. With the interactive navigation you can create pages and structure your websites. The visual markdown editor will help you to create content in a wysiwyg mode. The publish bar gives you full control over the status of each page. Watch the following video tutorial to learn all the details. The Navigation You can create, structure and reorder all pages with the navigation on the left side. To structure your content, you can create new folders and files with the \"add item\" button. To reorder the pages, just drag an item and drop it wherever you want. Play around with it and you will notice, that it works pretty similar to the folder- and file-system of your laptop. And in fact, this is exactly what Typemill does in the background: It stores your content in files and folders on the server. However, there are some limitations when you try to reorder elements. For example, you cannot move a complete folder to another folder, because this would change all the urls of the pages inside that folder, which is a nightmare for readers and search engines. The Editor You can create and format your content with the Markdown syntax, that is similar to the markup syntax of Wikipedia. If you are not familiar with Markdown, then please read the short Markdown-tutorial in the documentation of Typemill. You can learn Markdown in less than 10 minutes and there is no easier and faster way to format your webpage. You will love it! Typemill provides two edit modes: The raw mode and the visual mode. You can switch between the modes in the publish-bar at the bottom of each page. The raw mode is the most robust way to create your content, because you write raw markdown into a simple textarea. The visual mode uses blocks and transforms each content block into a html-preview immediately. This means that you can directly see and check the formatted result. By default Typemill will use the visual mode. * You can change the default mode in the system settings. * You can also switch each format button on and off in the system settings. The Publish Bar The publish bar of Typemill is pretty intuitiv and sticks at the bottom of the screen so that you have always full control of the status of each page. Simply play around with it and you will quickly understand how it works. In short: * The green button \"online\" indicates, that your page is published and visible for your readers. * You can depublish a page by clicking the green \"online\" button. The button will turn gray with the label \"offline\" and the page is not visible for your readers anymore. * With the green button \"Publish\" you can either publish a page that is offline or you can publish some unpublished changes on your page. * The publish-button is gray and disabled, if the page is online and if there are no unpublished changes. * All buttons will change in real time, so you can always exactly see what is going on. * To provide an easy status-overview of the whole website, Typemill marks all pages in the navigation on the left side as published (green), changed (orange) and unpublished (red). Working with Drafts Ever tried to revise a published article in WordPress? Yes, it works, but if you click on \"save\", then all your changes are directly live. Typemill is much more flexible here and allows you to keep your original version live while you work on a drafted version in the background. This is how Typemill handles it: * In visual mode: Typemill stores your changes in a new draft automatically as soon as you save any content-block. * In raw mode: To store changes in a new draft, simply click on the \"save draft\"-button in the publish controller. * You can work on a draft as long as you want without changing the live version. Your changes go live if you click the button \"publish\". * In visual mode, you can also use the discard-button and go back to the published version.","url":"http://localhost/typemill/welcome/write-content"},"http://localhost/typemill/welcome/todos":{"title":"ToDos Version 2","content":" Visual Editor * FIXED: File is not published from tmp to media/files if you save the block. Raw Editor * DONE ready Medialib * DONE Posts * Setup Plugins * Asset Class Frontend * DONE * DONE: Test restrictions ToDos Biig blocks: * DONE: Media Library * DONE: Posts * DONE: Setup * DONE: Recover Password Small features: * DONE: Merge processAssets modell * DONE: Table of content duplicated for published pages * DONE: Session handling: csrf fail and session start error if restrictions are active * DONE: Image and files for meta * Backend fields * Proxy * Editor: Warn if open another block * Image generation on the fly * Assets * Bug: Navigation frontend if unpublished pages * Sitemap and ping * Captcha * Clear Cache * Security Log Cleanups: * Events * Error messages * Translations Select userroles * Userroles for file restriction: in vue-blox-components loaded via api * Userroles for userfields: in php model user getUserFields() * Userroles for meta: in php controller apiAuthorMeta getMeta() * Plugins and themes: in php model extension getThemeDefinitions() License Check * On activation in apiControllerExtension. It checks the license in yaml. * In plugin php code with setPremiumLicense * In static plugins, it checks manual premium list and method setPremiumLicense and more","url":"http://localhost/typemill/welcome/todos"},"http://localhost/typemill/cyanine-theme":{"title":"The Cyanine Theme","content":" Cyanine is the modern, lightweight and flexible standard theme for Typemill. You can activate a landingpage, setup different content sections for the landingpage and order them like you want. You can also change the colors, fonts and other details. To configure the theme, login to the system (/tm/login), go to the theme settings (/tm/themes) and choose the theme \"Cyanine\". If Cyanine does not fit to your needs, then you can also choose another theme in the theme store of Typemill.","url":"http://localhost/typemill/cyanine-theme"},"http://localhost/typemill/cyanine-theme/new":{"title":"ToDo","content":" Visual Editor Das ist ein Intro. Es gibt noch viel zu tun, aber das ist am Ende des Tages nicht so schlimm denn wir machen einfach weiter. * DONE: Fix toc component in new block * DONE: Fix hr component in new block * DONE: finish shortcode component * DONE: Fix inline formats * DONE: fix lenght of page * DONE: Fix design of new block at the end (background color) * DONE: Move Block * DONE: Fix headline design * DONE: Fix save on two enter * DONE: fix quote design * DONE: Fix toc preview * DONE: disable enable * DONE: Add load sign (from navigation) * SHIT!!! fiinish youtube component Navigation * DONE: fix status in navigation * fix error messages * DONE: refresh navigation after changes Publish Controller * DONE: Create * DONE: publish * DONE: unpublish * DONE: discard * DONE: delete * DONE: save draft * DONE: switch to raw Raw Editor * DONE: Meta Tabs * Setup Medialib * Setup","url":"http://localhost/typemill/cyanine-theme/new"},"http://localhost/typemill/cyanine-theme/landingpage":{"title":"The Landingpage","content":" Cyanine provides an optional landingpage with six segments: * Intro with the content of the home page and an additional link/button. * Info with individual markdown content. * Teaser with two elements. Each element has a headline, a text and a link/button. * Contrast with a headline, text-input and a link/button. The colors are inverted. * Navigation with the whole content of the website. You can change the depth of the navigation. * News with a link to a news-folder. It will display the three latest news in a card-design. Add a hero-image to each news-entry to show a teaser image. You can activate or deactivate the whole landingpage, order all elements and enable/disable each element individually.","url":"http://localhost/typemill/cyanine-theme/landingpage"},"http://localhost/typemill/cyanine-theme/content-elements":{"title":"Content Elements ","content":" Cyanine provides a lot of other settings for your content area. For example: * Add an edit-button for github, gitlab or other plattforms. * Show the author. * Show the publish date. * Show the chapter numbers in the navigation. The Cyanine theme supports all content elements like tables, images, notices or downloads. It also supports anchor-links next to headlines, so you can deep link to certain content sections of your page. You can activate the anchors in the system settings of Typemill.","url":"http://localhost/typemill/cyanine-theme/content-elements"},"http://localhost/typemill/cyanine-theme/colors-and-fonts":{"title":"Colors and Fonts","content":" First of all cyanine supports individual logos. If you want to use our logo, then please upload it in the system settings. Cyanine will automatically replace the title text with your logo. You can also upload your own favicon in the system settings. Cyanine allows you to change many colors. Please make sure that your color-combinations are readable and accessible. The following colors are editable: * Primary Theme Color: used for the body background and borders. * Secondary Theme Color: used for content background, font-colors on hover and more. * Primary Font Color: used for main text. * Secondary Font Color: used as contrast color for hovers in navigation and buttons. * Link Color: used for text-links. Keep accessibility in mind. * Thin Border Color: used for thin borders in navigations and tables. You can also change the font-family for * headlines * text * buttons and navigations Cyanine uses wide spread system fonts with fallbacks: * serif * sans-serif * courier * helvetica * avenir * athelas * georgia * times * bodoni * calisto * garamond * baskerville If the color- and font-settings are not enough for your purpose, then you can always overwrite the theme-css with your own styles in the theme settings.","url":"http://localhost/typemill/cyanine-theme/colors-and-fonts"},"http://localhost/typemill/cyanine-theme/footer":{"title":"3-Column Footer","content":" Cyanine provides a three column footer at the bottom of each page. You can use markdown for each column. Make sure that you use the correct headline-level (we suggest a headline level 3 or level 4 to keep the logical headline hierarchy in the document). You can, of course, also add link-lists or other elements. Check the website of Typemill for an example.","url":"http://localhost/typemill/cyanine-theme/footer"}} \ No newline at end of file diff --git a/composer.json b/composer.json index 2672ce8..44db4f4 100644 --- a/composer.json +++ b/composer.json @@ -24,7 +24,7 @@ "erusev/parsedown-extra": "dev-master", "jbroadway/urlify": "1.1.3", "laminas/laminas-permissions-acl": "^2.10", - "akrabat/proxy-detection-middleware": "^0.4.0", + "akrabat/proxy-detection-middleware": "^1.0.0", "gregwar/captcha": "1.*" }, "autoload": { diff --git a/composer.lock b/composer.lock index 7c5f87d..0918dfa 100644 --- a/composer.lock +++ b/composer.lock @@ -4,30 +4,31 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "78ca4826588a21b7b6d14444c454e6bd", + "content-hash": "0cc1a21b272d67b53b9e5f448c2960ac", "packages": [ { "name": "akrabat/proxy-detection-middleware", - "version": "0.4", + "version": "1.0", "source": { "type": "git", "url": "https://github.com/akrabat/proxy-detection-middleware.git", - "reference": "226be882e2cce69b7f4140d8fb2e73147317a8a2" + "reference": "90472f490e56ad23afc36b0d95c24cd48fa331d7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/akrabat/proxy-detection-middleware/zipball/226be882e2cce69b7f4140d8fb2e73147317a8a2", - "reference": "226be882e2cce69b7f4140d8fb2e73147317a8a2", + "url": "https://api.github.com/repos/akrabat/proxy-detection-middleware/zipball/90472f490e56ad23afc36b0d95c24cd48fa331d7", + "reference": "90472f490e56ad23afc36b0d95c24cd48fa331d7", "shasum": "" }, "require": { - "psr/http-message": "^1.0" + "psr/http-message": "^1.0", + "psr/http-server-middleware": "^1.0" }, "require-dev": { - "php": ">=7.0", - "phpunit/phpunit": "^6", - "squizlabs/php_codesniffer": "^2.3", - "zendframework/zend-diactoros": "^1.1" + "laminas/laminas-diactoros": "^2.24", + "php": "^8.0", + "phpunit/phpunit": "^9.6", + "squizlabs/php_codesniffer": "^3.7" }, "type": "library", "autoload": { @@ -46,7 +47,7 @@ "homepage": "http://akrabat.com" } ], - "description": "PSR-7 Middleware that determines the scheme, host and port from the 'X-Forwarded-Proto', 'X-Forwarded-Host' and 'X-Forwarded-Port' headers and updates the Request's Uri object.", + "description": "PSR-7/PSR-15 Middleware that determines the scheme, host and port from the 'X-Forwarded-Proto', 'X-Forwarded-Host' and 'X-Forwarded-Port' headers and updates the Request's Uri object.", "homepage": "http://github.com/akrabat/proxy-detection-middleware", "keywords": [ "IP", @@ -55,9 +56,9 @@ ], "support": { "issues": "https://github.com/akrabat/proxy-detection-middleware/issues", - "source": "https://github.com/akrabat/proxy-detection-middleware/tree/master" + "source": "https://github.com/akrabat/proxy-detection-middleware/tree/1.0" }, - "time": "2018-09-11T10:28:26+00:00" + "time": "2023-02-17T18:13:01+00:00" }, { "name": "erusev/parsedown", diff --git a/content/00-welcome/05-todos.md b/content/00-welcome/05-todos.md index 9e88093..e3abce2 100644 --- a/content/00-welcome/05-todos.md +++ b/content/00-welcome/05-todos.md @@ -7,7 +7,7 @@ * DONE: Migrate from backend to frontend with vue and api * DONE: Redesign * DONE: License feature -* ToDo: Enhance with plugins +* DONE: Enhance with plugins ---- @@ -92,25 +92,25 @@ ## Open tasks +* DONE: Sitemap and ping +* SVG checker +* Version check +* Markdown secure rendering * Responsive design * Backend form builder * Proxy support * Image generation on the fly -* Sitemap and ping * Captcha integration * Clear cache * Show security Log * Reference feature -* SVG checker -* Markdown secure rendering * Typemill Utilities -* Version check * User search only for +10 users * Fix error api systemnavi ## Cleanups: -* Events +* DONE: Events * Error messages * Translations diff --git a/content/00-welcome/05-todos.txt b/content/00-welcome/05-todos.txt new file mode 100644 index 0000000..971f52d --- /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.\n* ToDo: Customfields not styled yet.\n* ToDo: Warn if open another block\n* ToDo: finish youtube component","## 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\n* ToDo: fix error messages\n* ToDo: Wrong frontend navigation if unpublished pages","## 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* SVG checker: https:\/\/github.com\/TribalSystems\/SVG-Sanitizer\n* Markdown secure rendering\n* Responsive design\n* Backend form builder\n* Proxy support\n* Image generation on the fly\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","## Cleanups:","* DONE: Events\n* Error messages\n* Translations","## 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 "] \ No newline at end of file diff --git a/content/00-welcome/05-todos.yaml b/content/00-welcome/05-todos.yaml index 36bebfe..1a374d9 100644 --- a/content/00-welcome/05-todos.yaml +++ b/content/00-welcome/05-todos.yaml @@ -4,7 +4,7 @@ meta: description: ' Visual Editor with more stuff' heroimage: null heroimagealt: null - owner: Unknown + owner: Sebastian author: null allowedrole: contributor alloweduser: null diff --git a/data/demo/demotest.yaml b/data/demo/demotest.yaml new file mode 100644 index 0000000..47935e0 --- /dev/null +++ b/data/demo/demotest.yaml @@ -0,0 +1,4 @@ +title: thank +subtitle: 'another php book' +author: chiko +edition: new 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 1e2bd91..219ce46 100644 --- a/system/typemill/Controllers/Controller.php +++ b/system/typemill/Controllers/Controller.php @@ -127,6 +127,7 @@ abstract class Controller return $formDefinitions; } + # used to protect api access, can we do it with middleware? protected function validateRights($userrole, $resource, $action) { $acl = $this->c->get('acl'); @@ -136,7 +137,9 @@ abstract class Controller return true; } - # check ownership. + die("PLEASE UPDATE THE METHOD validateRights in controller.php"); + # check ownership. THIS WILL FAIL ANYWAY!!! + # MAYBE WE SHOUD ADD THIS CHECK INTO MIDDLEWARE, TOO ? $writeMeta = new writeMeta(); $pagemeta = $writeMeta->getPageMeta($this->settings, $this->item); @@ -159,74 +162,4 @@ abstract class Controller return false; } - - # move to another place?? - protected function recursiveValidation($validator, array $formdefinitions, $input, $output = []) - { - # loop through form-definitions, ignores everything that is not defined in yaml - foreach($formdefinitions as $fieldname => $fielddefinitions) - { - if(is_array($fielddefinitions) && $fielddefinitions['type'] == 'fieldset') - { - $output = $this->recursiveValidation($validator, $fielddefinitions['fields'], $input, $output); - } - - # do not store values for disabled fields - if(isset($fielddefinitions['disabled']) && $fielddefinitions['type']) - { - continue; - } - - if(isset($input[$fieldname])) - { - $fieldvalue = $input[$fieldname]; - - # fix false or null values for selectboxes - if($fielddefinitions['type'] == "select" && ($fieldvalue === 'NULL' OR $fieldvalue === false)) - { - $fieldvalue = NULL; - } - - $validationresult = $validator->field($fieldname, $fieldvalue, $fielddefinitions); - - if($validationresult === true) - { - # MOVE THIS TO A SEPARATE FUNCTION SO YOU CAN STORE IMAGES ONLY IF ALL FIELDS SUCCESSFULLY VALIDATED - # images have special treatment, check ProcessImage-Model and ImageApiController - if($fielddefinitions['type'] == 'image') - { - # then check if file is there already: check for name and maybe correct image extension (if quality has been changed) - $storage = new StorageWrapper('\Typemill\Models\Storage'); - $existingImagePath = $storage->checkImage($fieldvalue); - - if($existingImagePath) - { - $fieldvalue = $existingImagePath; - } - else - { - # there is no published image with that name, so check if there is an unpublished image in tmp folder and publish it - $newImagePath = $storage->publishImage($fieldvalue); - if($newImagePath) - { - $fieldvalue = $newImagePath; - } - else - { - $fieldvalue = ''; - } - } - } - - $output[$fieldname] = $fieldvalue; - } - else - { - $this->errors[$fieldname] = $validationresult[$fieldname][0]; - } - } - } - - return $output; - } } \ No newline at end of file diff --git a/system/typemill/Controllers/ControllerApiAuthorArticle.php b/system/typemill/Controllers/ControllerApiAuthorArticle.php index dbc2e70..64efa77 100644 --- a/system/typemill/Controllers/ControllerApiAuthorArticle.php +++ b/system/typemill/Controllers/ControllerApiAuthorArticle.php @@ -9,7 +9,14 @@ use Typemill\Models\StorageWrapper; use Typemill\Models\Validation; use Typemill\Models\Navigation; use Typemill\Models\Content; +use Typemill\Models\Meta; +use Typemill\Models\Sitemap; use Typemill\Static\Slug; +use Typemill\Events\OnPagePublished; +use Typemill\Events\OnPageUnpublished; +use Typemill\Events\OnPageDeleted; +use Typemill\Events\OnPageSorted; +use Typemill\Events\OnPageRenamed; class ControllerApiAuthorArticle extends Controller { @@ -70,25 +77,29 @@ class ControllerApiAuthorArticle extends Controller $draftNavigation = $navigation->setActiveNaviItems($draftNavigation, $item->keyPathArray); $item = $navigation->getItemWithKeyPath($draftNavigation, $item->keyPathArray); + $sitemap = new Sitemap(); + $sitemap->updateSitemap($draftNavigation, $urlinfo); + + # META is important e.g. for newsletter, so send it, too + $meta = new Meta(); + $metadata = $meta->getMetaData($item); + $metadata = $meta->addMetaDefaults($metadata, $item, $this->settings['author']); +# $metadata = $meta->addMetaTitleDescription($metadata, $item, $markdownArray); + + # dispatch event, e.g. send newsletter and more + $data = [ + 'markdown' => $draftMarkdown, + 'item' => $item, + 'meta' => $metadata + ]; + $this->c->get('dispatcher')->dispatch(new OnPagePublished($data), 'onPagePublished'); + $response->getBody()->write(json_encode([ 'navigation' => $draftNavigation, 'item' => $item ])); return $response->withHeader('Content-Type', 'application/json'); - -/* - # update the sitemap - $this->updateSitemap($ping = true); - - # complete the page meta if title or description not set - $writeMeta = new WriteMeta(); - $meta = $writeMeta->completePageMeta($this->content, $this->settings, $this->item); - - # dispatch event - $page = ['content' => $this->content, 'meta' => $meta, 'item' => $this->item]; - $page = $this->c->dispatcher->dispatch('onPagePublished', new OnPagePublished($page))->getData(); -*/ } public function unpublishArticle(Request $request, Response $response, $args) @@ -140,6 +151,9 @@ class ControllerApiAuthorArticle extends Controller $draftNavigation = $navigation->setActiveNaviItems($draftNavigation, $item->keyPathArray); $item = $navigation->getItemWithKeyPath($draftNavigation, $item->keyPathArray); + $sitemap = new Sitemap(); + $sitemap->updateSitemap($draftNavigation, $urlinfo); + # check if it is a folder and if the folder has published pages. $message = false; if($item->elementType == 'folder' && isset($item->folderContent)) @@ -153,6 +167,9 @@ class ControllerApiAuthorArticle extends Controller } } + # dispatch event + $this->c->get('dispatcher')->dispatch(new OnPageUnpublished($item), 'onPageUnpublished'); + $response->getBody()->write(json_encode([ 'message' => $message, 'navigation' => $draftNavigation, @@ -274,11 +291,28 @@ class ControllerApiAuthorArticle extends Controller $draftNavigation = $navigation->getDraftNavigation($urlinfo, $this->settings['langattr']); $draftNavigation = $navigation->setActiveNaviItems($draftNavigation, $item->keyPathArray); $item = $navigation->getItemWithKeyPath($draftNavigation, $item->keyPathArray); + + $sitemap = new Sitemap(); + $sitemap->updateSitemap($draftNavigation, $urlinfo); # refresh content $draftMarkdown = $content->getDraftMarkdown($item); $draftMarkdownHtml = $content->addDraftHtml($draftMarkdown); + # META is important e.g. for newsletter, so send it, too + $meta = new Meta(); + $metadata = $meta->getMetaData($item); + $metadata = $meta->addMetaDefaults($metadata, $item, $this->settings['author']); +# $metadata = $meta->addMetaTitleDescription($metadata, $item, $markdownArray); + + # dispatch event, e.g. send newsletter and more + $data = [ + 'markdown' => $draftMarkdown, + 'item' => $item, + 'meta' => $metadata + ]; + $this->c->get('dispatcher')->dispatch(new OnPagePublished($data), 'onPagePublished'); + $response->getBody()->write(json_encode([ 'item' => $item, 'navigation' => $draftNavigation, @@ -670,16 +704,24 @@ class ControllerApiAuthorArticle extends Controller } $navigation->renameItem($item, $params['slug']); - $navigation->clearNavigation(); -# $this->updateSitemap($ping = true); + $draftNavigation = $navigation->getDraftNavigation($urlinfo, $this->settings['langattr']); + + $sitemap = new Sitemap(); + $sitemap->updateSitemap($draftNavigation, $urlinfo); # create the new url for redirects $newUrlRel = str_replace($item->slug, $params['slug'], $item->urlRelWoF); $url = $urlinfo['baseurl'] . '/tm/content/' . $this->settings['editor'] . $newUrlRel; - + + $data = [ + 'item' => $item, + 'newUrl' => $newUrlRel + ]; + $this->c->get('dispatcher')->dispatch(new OnPageRenamed($data), 'onPageRenamed'); + $response->getBody()->write(json_encode([ - 'navigation' => $navigation->getDraftNavigation($urlinfo, $this->settings['langattr']), + 'navigation' => $draftNavigation, 'message' => '', 'url' => $url ])); @@ -687,7 +729,6 @@ class ControllerApiAuthorArticle extends Controller return $response->withHeader('Content-Type', 'application/json'); } - public function sortArticle(Request $request, Response $response, $args) { $validRights = $this->validateRights($request->getAttribute('c_userrole'), 'content', 'update'); @@ -757,9 +798,6 @@ class ControllerApiAuthorArticle extends Controller # if the item has been moved within the same folder if($params['parent_id_from'] == $params['parent_id_to']) { - # no need to ping search engines - $ping = false; - # get key of item $itemKey = end($itemKeyPath); reset($itemKeyPath); @@ -769,9 +807,6 @@ class ControllerApiAuthorArticle extends Controller } else { - # let us ping search engines - $ping = true; - # an active file has been moved to another folder, so send new url with response if($params['active'] == 'active') { @@ -807,9 +842,15 @@ class ControllerApiAuthorArticle extends Controller # refresh navigation and item $navigation->clearNavigation(); + $draftNavigation = $navigation->getDraftNavigation($urlinfo, $langattr); + + $sitemap = new Sitemap(); + $sitemap->updateSitemap($draftNavigation, $urlinfo); + + $this->c->get('dispatcher')->dispatch(new OnPageSorted($params), 'onPageSorted'); $response->getBody()->write(json_encode([ - 'navigation' => $navigation->getDraftNavigation($urlinfo, $langattr), + 'navigation' => $draftNavigation, 'message' => '', 'url' => false ])); @@ -880,6 +921,9 @@ class ControllerApiAuthorArticle extends Controller $navigation->clearNavigation(); $draftNavigation = $navigation->getDraftNavigation($urlinfo, $this->settings['langattr']); + $sitemap = new Sitemap(); + $sitemap->updateSitemap($draftNavigation, $urlinfo); + # check if it is a subfile or subfolder and set the redirect-url to the parent item $url = $urlinfo['baseurl'] . '/tm/content/' . $this->settings['editor']; if(count($item->keyPathArray) > 1) @@ -895,6 +939,9 @@ class ControllerApiAuthorArticle extends Controller } } + # dispatch event + $this->c->get('dispatcher')->dispatch(new OnPageDeleted($item), 'onPageDeleted'); + $response->getBody()->write(json_encode([ 'url' => $url ])); diff --git a/system/typemill/Controllers/ControllerApiAuthorMeta.php b/system/typemill/Controllers/ControllerApiAuthorMeta.php index 04dc75c..f514546 100644 --- a/system/typemill/Controllers/ControllerApiAuthorMeta.php +++ b/system/typemill/Controllers/ControllerApiAuthorMeta.php @@ -8,11 +8,15 @@ use Slim\Routing\RouteContext; use Typemill\Models\Validation; use Typemill\Models\Navigation; use Typemill\Models\Meta; +use Typemill\Events\OnMetaLoaded; + class ControllerApiAuthorMeta extends Controller { public function getMeta(Request $request, Response $response, $args) { + + # is it really needed? Check middleware if rights are validated there already $validRights = $this->validateRights($request->getAttribute('c_userrole'), 'content', 'update'); if(!$validRights) { @@ -87,6 +91,9 @@ class ControllerApiAuthorMeta extends Controller # store the metascheme in cache for frontend # $writeMeta->updateYaml('cache', 'metatabs.yaml', $metascheme); + $metacleared = $this->c->get('dispatcher')->dispatch(new OnMetaLoaded($metacleared),'onMetaLoaded')->getData(); + + $response->getBody()->write(json_encode([ 'metadata' => $metacleared, 'metadefinitions' => $metadefinitions, @@ -162,7 +169,7 @@ class ControllerApiAuthorMeta extends Controller $tabdefinitions = $this->flattenTabFields($tabdefinitions['fields'], []); # create validation object - $errors = false; + $errors = []; # take the user input data and iterate over all fields and values foreach($params['data'] as $fieldname => $fieldvalue) @@ -187,7 +194,7 @@ class ControllerApiAuthorMeta extends Controller } # return validation errors - if($errors) + if(!empty($errors)) { $response->getBody()->write(json_encode([ 'message' => 'Please correct the errors.', diff --git a/system/typemill/Controllers/ControllerApiSystemPlugins.php b/system/typemill/Controllers/ControllerApiSystemPlugins.php index 86b7662..d35f6d0 100644 --- a/system/typemill/Controllers/ControllerApiSystemPlugins.php +++ b/system/typemill/Controllers/ControllerApiSystemPlugins.php @@ -23,12 +23,12 @@ class ControllerApiSystemPlugins extends Controller # validate input $validator = new Validation(); - $validatedOutput = $this->recursiveValidation($validator, $formdefinitions, $plugininput); - if(!empty($this->errors)) + $validatedOutput = $validator->recursiveValidation($formdefinitions, $plugininput); + if(!empty($validator->errors)) { $response->getBody()->write(json_encode([ 'message' => 'Please correct tbe errors in form.', - 'errors' => $this->errors + 'errors' => $validator->errors ])); return $response->withHeader('Content-Type', 'application/json')->withStatus(400); diff --git a/system/typemill/Controllers/ControllerApiSystemSettings.php b/system/typemill/Controllers/ControllerApiSystemSettings.php index f1ef5c8..7f2ade4 100644 --- a/system/typemill/Controllers/ControllerApiSystemSettings.php +++ b/system/typemill/Controllers/ControllerApiSystemSettings.php @@ -34,13 +34,13 @@ class ControllerApiSystemSettings extends Controller # validate input $validator = new Validation(); - $validatedOutput = $this->recursiveValidation($validator, $formdefinitions, $settingsinput); + $validatedOutput = $validator->recursiveValidation($formdefinitions, $settingsinput); - if(!empty($this->errors)) + if(!empty($valiator->errors)) { $response->getBody()->write(json_encode([ 'message' => 'Please correct errors in form.', - 'errors' => $this->errors + 'errors' => $validator->errors ])); return $response->withHeader('Content-Type', 'application/json')->withStatus(400); diff --git a/system/typemill/Controllers/ControllerApiSystemThemes.php b/system/typemill/Controllers/ControllerApiSystemThemes.php index ea4e819..3813339 100644 --- a/system/typemill/Controllers/ControllerApiSystemThemes.php +++ b/system/typemill/Controllers/ControllerApiSystemThemes.php @@ -23,12 +23,12 @@ class ControllerApiSystemThemes extends Controller # validate input $validator = new Validation(); - $validatedOutput = $this->recursiveValidation($validator, $formdefinitions, $themeinput); - if(!empty($this->errors)) + $validatedOutput = $validator->recursiveValidation($formdefinitions, $themeinput); + if(!empty($validator->errors)) { $response->getBody()->write(json_encode([ 'message' => 'Please correct tbe errors in form.', - 'errors' => $this->errors + 'errors' => $validator->errors ])); return $response->withHeader('Content-Type', 'application/json')->withStatus(400); diff --git a/system/typemill/Controllers/ControllerApiSystemUsers.php b/system/typemill/Controllers/ControllerApiSystemUsers.php index 1374039..185ec78 100644 --- a/system/typemill/Controllers/ControllerApiSystemUsers.php +++ b/system/typemill/Controllers/ControllerApiSystemUsers.php @@ -158,12 +158,12 @@ class ControllerApiSystemUsers extends Controller $formdefinitions = $user->getUserFields($this->c->get('acl'), $request->getAttribute('c_userrole')); - $validatedOutput = $this->recursiveValidation($validate, $formdefinitions, $userdata); - if(!empty($this->errors)) + $validatedOutput = $validate->recursiveValidation($formdefinitions, $userdata); + if(!empty($validate->errors)) { $response->getBody()->write(json_encode([ 'message' => 'Please correct tbe errors in form.', - 'errors' => $this->errors + 'errors' => $validate->errors ])); return $response->withHeader('Content-Type', 'application/json')->withStatus(400); @@ -254,12 +254,12 @@ class ControllerApiSystemUsers extends Controller $user = new User(); $formdefinitions = $user->getUserFields($this->c->get('acl'), $userdata['userrole'],$inspectorrole = $request->getAttribute('c_userrole')); unset($formdefinitions['username']['readonly']); - $validatedOutput = $this->recursiveValidation($validate, $formdefinitions, $userdata); - if(!empty($this->errors)) + $validatedOutput = $validate->recursiveValidation($formdefinitions, $userdata); + if(!empty($validate->errors)) { $response->getBody()->write(json_encode([ 'message' => 'Please correct tbe errors in form.', - 'errors' => $this->errors + 'errors' => $validate->errors ])); return $response->withHeader('Content-Type', 'application/json')->withStatus(400); diff --git a/system/typemill/Controllers/ControllerApiSystemVersions.php b/system/typemill/Controllers/ControllerApiSystemVersions.php new file mode 100644 index 0000000..0edf0d6 --- /dev/null +++ b/system/typemill/Controllers/ControllerApiSystemVersions.php @@ -0,0 +1,94 @@ +getParsedBody(); + + # validate input + $validate = new Validation(); + $vresult = $validate->checkVersions($params); + if($vresult !== true) + { + $response->getBody()->write(json_encode([ + 'message' => 'The version check failed because of invalid parameters.' + ])); + + return $response->withHeader('Content-Type', 'application/json')->withStatus(400); + } + + $type = $params['type']; + $data = $params['data']; + $url = 'https://typemill.net/api/v1/checkversion'; + + if($type == 'plugins') + { + $pluginList = ''; + foreach($data as $name => $plugin) + { + $pluginList .= $name . ','; + } + + $url = 'https://plugins.typemill.net/api/v1/getplugins?plugins=' . urlencode($pluginList); + } + if($type == 'themes') + { + $themeList = ''; + foreach($data as $name => $theme) + { + $themeList .= $name . ','; + } + + $url = 'https://themes.typemill.net/api/v1/getthemes?themes=' . urlencode($themeList); + } + + $opts = array( + 'http'=>array( + 'method'=>"GET", + 'ignore_errors' => true, + 'timeout' => 5, + 'header'=>"Referer: http://typemill-version2.net" + ) + ); + + $context = stream_context_create($opts); + $versions = file_get_contents($url, false, $context); + $versions = json_decode($versions, true); + $updateVersions = []; + + if($type == 'system') + { + $latestVersion = $versions['system']['typemill'] ?? false; + $installedVersion = $data ?? false; + if($latestVersion && $installedVersion && version_compare($latestVersion, $installedVersion) <= 0) + { + $updateVersions['system'] = $latestVersion; + } + } + elseif(isset($versions[$type])) + { + foreach($versions[$type] as $name => $details) + { + $latestVersion = $details['version'] ?? false; + $installedVersion = $data[$name] ?? false; + if($latestVersion && $installedVersion && version_compare($latestVersion, $installedVersion) <= 0) + { + $updateVersions[$name] = $details; + } + } + } + + $response->getBody()->write(json_encode([ + $type => $updateVersions + ])); + + return $response->withHeader('Content-Type', 'application/json')->withStatus(200); + } +} \ No newline at end of file diff --git a/system/typemill/Controllers/ControllerWebAuthor.php b/system/typemill/Controllers/ControllerWebAuthor.php index 7ee0ee8..4199724 100644 --- a/system/typemill/Controllers/ControllerWebAuthor.php +++ b/system/typemill/Controllers/ControllerWebAuthor.php @@ -7,6 +7,11 @@ use Psr\Http\Message\ResponseInterface as Response; use Slim\Routing\RouteContext; use Typemill\Models\Navigation; use Typemill\Models\Content; +use Typemill\Events\OnPagetreeLoaded; +use Typemill\Events\OnItemLoaded; +use Typemill\Events\OnMarkdownLoaded; +use Typemill\Events\OnPageReady; + class ControllerWebAuthor extends Controller { @@ -46,8 +51,10 @@ class ControllerWebAuthor extends Controller # $draftNavigation = $navigation->getDraftNavigation($urlinfo, $langattr); $draftNavigation = $navigation->setActiveNaviItems($draftNavigation, $keyPathArray); + $draftNavigation = $this->c->get('dispatcher')->dispatch(new OnPagetreeLoaded($draftNavigation), 'onPagetreeLoaded')->getData(); $item = $navigation->getItemWithKeyPath($draftNavigation, $keyPathArray); + $item = $this->c->get('dispatcher')->dispatch(new OnItemLoaded($item), 'onItemLoaded')->getData(); } # $item->modified = ($item->published OR $item->drafted) ? filemtime($this->settings['contentFolder'] . $this->path) : false; @@ -57,9 +64,11 @@ class ControllerWebAuthor extends Controller $content = new Content($urlinfo['baseurl']); $draftMarkdown = $content->getDraftMarkdown($item); + $draftMarkdown = $this->c->get('dispatcher')->dispatch(new OnMarkdownLoaded($draftMarkdown), 'onMarkdownLoaded')->getData(); $draftMarkdownHtml = $content->addDraftHtml($draftMarkdown); + return $this->c->get('view')->render($response, 'content/blox-editor.twig', [ 'settings' => $this->settings, 'mainnavi' => $mainNavigation, @@ -110,10 +119,11 @@ class ControllerWebAuthor extends Controller # extend : $request->getAttribute('c_userrole') $draftNavigation = $navigation->getDraftNavigation($urlinfo, $langattr); - $draftNavigation = $navigation->setActiveNaviItems($draftNavigation, $keyPathArray); + $draftNavigation = $this->c->get('dispatcher')->dispatch(new OnPagetreeLoaded($draftNavigation), 'onPagetreeLoaded')->getData(); $item = $navigation->getItemWithKeyPath($draftNavigation, $keyPathArray); + $item = $this->c->get('dispatcher')->dispatch(new OnItemLoaded($item), 'onItemLoaded')->getData(); } # $item->modified = ($item->published OR $item->drafted) ? filemtime($this->settings['contentFolder'] . $this->path) : false; @@ -123,6 +133,7 @@ class ControllerWebAuthor extends Controller $content = new Content($urlinfo['baseurl']); $draftMarkdown = $content->getDraftMarkdown($item); + $draftMarkdown = $this->c->get('dispatcher')->dispatch(new OnMarkdownLoaded($draftMarkdown), 'onMarkdownLoaded')->getData(); $draftMarkdownHtml = $content->addDraftHtml($draftMarkdown); @@ -140,78 +151,5 @@ class ControllerWebAuthor extends Controller 'content' => $draftMarkdownHtml, ] ]); - - - - - - # get params from call -# $this->uri = $request->getUri()->withUserInfo(''); -# $this->params = isset($args['params']) ? ['url' => $this->uri->getBasePath() . '/' . $args['params']] : ['url' => $this->uri->getBasePath()]; - - # set structure - if(!$this->setStructureDraft()){ return $this->renderIntern404($response, array( 'navigation' => true, 'content' => $this->errors )); } - - # set information for homepage - $this->setHomepage($args); - - # set item - if(!$this->setItem()){ return $this->renderIntern404($response, array( 'navigation' => $this->structure, 'settings' => $this->settings, 'content' => $this->errors )); } - - # we have to check ownership here to use it for permission-check in tempates - $this->checkContentOwnership(); - - # get the breadcrumb (here we need it only to mark the actual item active in navigation) - $breadcrumb = isset($this->item->keyPathArray) ? Folder::getBreadcrumb($this->structureDraft, $this->item->keyPathArray) : false; - - # set the status for published and drafted - $this->setPublishStatus(); - - # set path - $this->setItemPath($this->item->fileType); - - # add the modified date for the file - $this->item->modified = ($this->item->published OR $this->item->drafted) ? filemtime($this->settings['contentFolder'] . $this->path) : false; - - # read content from file - if(!$this->setContent()){ return $this->renderIntern404($response, array( 'navigation' => $this->structure, 'settings' => $this->settings, 'content' => $this->errors )); } - - $content = $this->content; - $title = false; - - # if content is an array, then it is a draft - if(is_array($content)) - { - # transform array to markdown - $parsedown = new ParsedownExtension($this->uri->getBaseUrl()); - $content = $parsedown->arrayBlocksToMarkdown($content); - } - - # if there is content - if($content != '') - { - # normalize linebreaks - $content = str_replace(array("\r\n", "\r"), "\n", $content); - $content = trim($content, "\n"); - - # and strip out title - if($content[0] == '#') - { - $contentParts = explode("\n", $content, 2); - $title = trim($contentParts[0], "# \t\n\r\0\x0B"); - $content = trim($contentParts[1]); - } - } - - return $this->renderIntern($response, 'editor/editor-raw.twig', array( - 'acl' => $this->c->acl, - 'mycontent' => $this->mycontent, - 'navigation' => $this->structureDraft, - 'homepage' => $this->homepage, - 'title' => $title, - 'content' => $content, - 'item' => $this->item, - 'settings' => $this->settings - )); - } + } } \ No newline at end of file diff --git a/system/typemill/Controllers/ControllerWebFrontend.php b/system/typemill/Controllers/ControllerWebFrontend.php index c19a8ad..ebfef03 100644 --- a/system/typemill/Controllers/ControllerWebFrontend.php +++ b/system/typemill/Controllers/ControllerWebFrontend.php @@ -11,7 +11,6 @@ use Typemill\Models\Meta; use Typemill\Events\OnPagetreeLoaded; use Typemill\Events\OnBreadcrumbLoaded; use Typemill\Events\OnItemLoaded; -use Typemill\Events\OnOriginalLoaded; use Typemill\Events\OnMetaLoaded; use Typemill\Events\OnMarkdownLoaded; use Typemill\Events\OnContentArrayLoaded; diff --git a/system/typemill/Controllers/ControllerWebSystem.php b/system/typemill/Controllers/ControllerWebSystem.php index 200da08..757e23f 100644 --- a/system/typemill/Controllers/ControllerWebSystem.php +++ b/system/typemill/Controllers/ControllerWebSystem.php @@ -368,6 +368,14 @@ class ControllerWebSystem extends Controller $dispatcher = $this->c->get('dispatcher') ); + $pluginDefinitions = false; + $pluginname = strtolower(trim(str_replace('tm/', '', $urlinfo['route']), '/')); + if($pluginname && $pluginname != '' && isset($this->settings['plugins'][$pluginname])) + { + $extension = new Extension(); + $pluginDefinitions = $extension->getPluginDefinition($pluginname); + } + return $this->c->get('view')->render($response, 'layouts/layoutSystemBlank.twig', [ 'settings' => $this->settings, 'mainnavi' => $mainNavigation, @@ -377,6 +385,8 @@ class ControllerWebSystem extends Controller 'labels' => $this->c->get('translations'), 'urlinfo' => $this->c->get('urlinfo'), 'acl' => $this->c->get('acl'), + 'userroles' => $this->c->get('acl')->getRoles(), + 'plugin' => $pluginDefinitions ] ]); } diff --git a/system/typemill/Events/OnPageRenamed.php b/system/typemill/Events/OnPageRenamed.php new file mode 100644 index 0000000..40b1708 --- /dev/null +++ b/system/typemill/Events/OnPageRenamed.php @@ -0,0 +1,14 @@ +storage = new StorageWrapper('\Typemill\Models\Storage'); } - # controllerFrontendWebsite, but not in use, makes no sense to check on each page load - public function checkSitemap() - { - if(!$this->writeCache->getCache('cache', 'sitemap.xml')) - { - if(!$this->structureLive) - { - $this->setStructureLive(); - } - - $this->updateSitemap(); - } - - return true; - } - - public function updateSitemap($ping = false) + public function updateSitemap($navigation, $urlinfo) { $sitemap = '' . "\n"; $sitemap .= '' . "\n"; - $sitemap = $this->addUrlSet($sitemap, $this->uri->getBaseUrl()); - $sitemap .= $this->generateUrlSets($this->structureLive); + $sitemap = $this->addUrlSet($sitemap, $urlinfo['baseurl']); + $sitemap .= $this->generateUrlSets($navigation); $sitemap .= ''; - $this->writeCache->writeFile('cache', 'sitemap.xml', $sitemap); - - if($ping && isset($this->settings['pingsitemap']) && $this->settings['pingsitemap']) - { - $sitemapUrl = $this->uri->getBaseUrl() . '/cache/sitemap.xml'; - - $pingGoogleUrl = 'http://www.google.com/ping?sitemap=' . urlencode($sitemapUrl); - $pingBingUrl = 'http://www.bing.com/ping?sitemap=' . urlencode($sitemapUrl); - - $opts = array( - 'http'=>array( - 'method'=>"GET", - 'ignore_errors' => true, - 'timeout' => 5 - ) - ); - - $context = stream_context_create($opts); - - $responseBing = file_get_contents($pingBingUrl, false, $context); - $responseGoogle = file_get_contents($pingGoogleUrl, false, $context); - } - + $this->storage->writeFile('cacheFolder', '', 'sitemap.xml', $sitemap); } public function generateUrlSets($navigation) @@ -71,22 +30,25 @@ class Sitemap foreach($navigation as $item) { - if($item->elementType == 'folder' && isset($item->noindex) && $item->noindex === true) + if($item->status == "published" OR $item->status == "modified") { - $urlset .= $this->generateUrlSets($item->folderContent, $urlset); - } - elseif($item->elementType == 'folder') - { - $urlset = $this->addUrlSet($urlset, $item->urlAbs); - $urlset .= $this->generateUrlSets($item->folderContent, $urlset); - } - elseif(isset($item->noindex) && $item->noindex === true ) - { - continue; - } - else - { - $urlset = $this->addUrlSet($urlset, $item->urlAbs); + if($item->elementType == 'folder' && isset($item->noindex) && $item->noindex === true) + { + $urlset .= $this->generateUrlSets($item->folderContent, $urlset); + } + elseif($item->elementType == 'folder') + { + $urlset = $this->addUrlSet($urlset, $item->urlAbs); + $urlset .= $this->generateUrlSets($item->folderContent, $urlset); + } + elseif(isset($item->noindex) && $item->noindex === true ) + { + continue; + } + else + { + $urlset = $this->addUrlSet($urlset, $item->urlAbs); + } } } return $urlset; diff --git a/system/typemill/Models/Validation.php b/system/typemill/Models/Validation.php index 6369173..0cd4eb4 100644 --- a/system/typemill/Models/Validation.php +++ b/system/typemill/Models/Validation.php @@ -2,11 +2,16 @@ namespace Typemill\Models; -use Typemill\Models\User; use Valitron\Validator; +use Typemill\Models\User; +use Typemill\Models\StorageWrapper; class Validation { + + # only used for recursive validation + public $errors = []; + /** * Constructor with custom validation rules * @@ -186,6 +191,33 @@ class Validation return true; }, 'format is not valid.'); + + Validator::addRule('version', function($field, $value, array $params, array $fields) + { + if( version_compare( $value, '0.0.1', '>=' ) >= 0 ) + { + return true; + } + return false; + }, 'not a valid version format.'); + + Validator::addRule('version_array', function($field, $value, array $params, array $fields) + { + foreach($value as $name => $version) + { + if(!preg_match("/^[A-Za-z0-9_\- ]+$/", $name)) + { + return false; + } + + if( version_compare( $version, '0.0.1', '>=' ) <= 0 ) + { + return false; + } + } + + return true; + }, 'not a valid version format.'); } # return valitron standard object @@ -315,6 +347,34 @@ class Validation return $v->errors(); } + public function checkVersions(array $params) + { + $v = new Validator($params); + $v->rule('required', ['type', 'data']); + $v->rule('in', 'type', ['plugins', 'themes', 'system']); + + if(!$v->validate()) + { + return $v->errors(); + } + + if($params['type'] == 'plugins' OR $params['type'] == 'themes') + { + $v->rule('version_array', 'data'); + } + else + { + $v->rule('version', 'data'); + } + + if(!$v->validate()) + { + return $v->errors(); + } + + return true; + } + public function navigationSort(array $params) { $v = new Validator($params); @@ -498,60 +558,6 @@ class Validation } } - - - - - - public function usernameBREAK($username) - { - $v = new Validator($username); - $v->rule('alphaNum', 'username')->message("Only alpha-numeric characters allowed"); - $v->rule('lengthBetween', 'username', 3, 20)->message("Length between 3 - 20"); - - return $this->validationResult($v); - } - - /** - * validation for changing the password - * - * @param array $params with form data. - * @return obj $v the validation object passed to a result method. - */ - - public function newPasswordOldBREAK(array $params) - { - $v = new Validator($params); - $v->rule('required', ['password', 'newpassword']); - $v->rule('lengthBetween', 'newpassword', 5, 20); - $v->rule('checkPassword', 'password')->message("Password is wrong"); - - return $this->validationResult($v); - } - - - /** - * validation for changing the password api case - * - * @param array $params with form data. - * @return obj $v the validation object passed to a result method. - */ - - public function newPasswordBREAK(array $params) - { - $v = new Validator($params); - $v->rule('required', ['password', 'newpassword']); - $v->rule('lengthBetween', 'newpassword', 5, 20); - $v->rule('checkPassword', 'password')->message("Password is wrong"); - - if($v->validate()) - { - return true; - } - - return $v->errors(); - } - /** * validation for password recovery * @@ -569,41 +575,6 @@ class Validation return $this->validationResult($v); } - /** - * validation for system settings - * - * @param array $params with form data. - * @return obj $v the validation object passed to a result method. - */ - - public function settingsBREAK(array $params, array $copyright, array $formats, $name = false) - { - $v = new Validator($params); - - $v->rule('required', ['title', 'author', 'copyright', 'year', 'editor']); - $v->rule('lengthBetween', 'title', 2, 50); - $v->rule('lengthBetween', 'author', 2, 50); - $v->rule('noHTML', 'title'); - # $v->rule('regex', 'title', '/^[\pL0-9_ \-]*$/u'); - $v->rule('regex', 'author', '/^[\pL_ \-]*$/u'); - $v->rule('integer', 'year'); - $v->rule('length', 'year', 4); - $v->rule('length', 'langattr', 2); - $v->rule('in', 'editor', ['raw', 'visual']); - $v->rule('values_allowed', 'formats', $formats); - $v->rule('in', 'copyright', $copyright); - $v->rule('noHTML', 'restrictionnotice'); - $v->rule('lengthBetween', 'restrictionnotice', 2, 1000 ); - $v->rule('email', 'recoverfrom'); - $v->rule('noHTML', 'recoversubject'); - $v->rule('lengthBetween', 'recoversubject', 2, 80 ); - $v->rule('noHTML', 'recovermessage'); - $v->rule('lengthBetween', 'recovermessage', 2, 1000 ); - $v->rule('iplist', 'trustedproxies'); - - return $this->validationResult($v, $name); - } - /** * validation for content editor @@ -762,6 +733,78 @@ class Validation return true; } + + # validate a whole formdefinition with all values + public function recursiveValidation(array $formdefinitions, $input, $output = []) + { + # loop through form-definitions, ignores everything that is not defined in yaml + foreach($formdefinitions as $fieldname => $fielddefinitions) + { + if(is_array($fielddefinitions) && $fielddefinitions['type'] == 'fieldset') + { + $output = $this->recursiveValidation($fielddefinitions['fields'], $input, $output); + } + + # do not store values for disabled fields + if(isset($fielddefinitions['disabled']) && $fielddefinitions['type']) + { + continue; + } + + if(isset($input[$fieldname])) + { + $fieldvalue = $input[$fieldname]; + + # fix false or null values for selectboxes + if($fielddefinitions['type'] == "select" && ($fieldvalue === 'NULL' OR $fieldvalue === false)) + { + $fieldvalue = NULL; + } + + $validationresult = $this->field($fieldname, $fieldvalue, $fielddefinitions); + + if($validationresult === true) + { + # MOVE THIS TO A SEPARATE FUNCTION SO YOU CAN STORE IMAGES ONLY IF ALL FIELDS SUCCESSFULLY VALIDATED + # images have special treatment, check ProcessImage-Model and ImageApiController + if($fielddefinitions['type'] == 'image') + { + # then check if file is there already: check for name and maybe correct image extension (if quality has been changed) + $storage = new StorageWrapper('\Typemill\Models\Storage'); + $existingImagePath = $storage->checkImage($fieldvalue); + + if($existingImagePath) + { + $fieldvalue = $existingImagePath; + } + else + { + # there is no published image with that name, so check if there is an unpublished image in tmp folder and publish it + $newImagePath = $storage->publishImage($fieldvalue); + if($newImagePath) + { + $fieldvalue = $newImagePath; + } + else + { + $fieldvalue = ''; + } + } + } + + $output[$fieldname] = $fieldvalue; + } + else + { + $this->errors[$fieldname] = $validationresult[$fieldname][0]; + } + } + } + + return $output; + } + + /** * result for validation * @@ -771,6 +814,8 @@ class Validation public function checkArray($arrayvalues, $v) { + die('I think checkArray not in use anymore'); + foreach($arrayvalues as $key => $value) { if(is_array($value)) @@ -785,6 +830,8 @@ class Validation public function validationResult($v, $name = false) { + die("do not use validationResults in validation model anymore"); + if($v->validate()) { return true; diff --git a/system/typemill/Plugin.php b/system/typemill/Plugin.php index a627d2c..1e50191 100644 --- a/system/typemill/Plugin.php +++ b/system/typemill/Plugin.php @@ -3,8 +3,10 @@ namespace Typemill; use \Symfony\Component\EventDispatcher\EventSubscriberInterface; +use DI\Container; # use Typemill\Models\Fields; -# use Typemill\Models\WriteYaml; +use Typemill\Models\StorageWrapper; +use Typemill\Models\Extension; use Typemill\Models\Validation; use Typemill\Extensions\ParsedownExtension; @@ -18,9 +20,13 @@ abstract class Plugin implements EventSubscriberInterface protected $editorroute = false; - - public function __construct($container) + public function __construct(Container $container) { +/* + echo '
';
+		echo '

FIRST

'; + print_r($container); +*/ $this->container = $container; $this->urlinfo = $this->container->get('urlinfo'); $this->route = $this->urlinfo['route']; @@ -42,9 +48,110 @@ abstract class Plugin implements EventSubscriberInterface return $this->container->get('settings'); } - protected function getPluginSettings($plugin) + protected function getPluginSettings($pluginname = false) { - return $this->container->get('settings')['plugins'][$plugin]; +# $pluginClass = debug_backtrace(!DEBUG_BACKTRACE_PROVIDE_OBJECT|DEBUG_BACKTRACE_IGNORE_ARGS,2)[1]['class']; + + $pluginname = $this->getPluginName($pluginname); + + if($pluginname && isset($this->container->get('settings')['plugins'][$pluginname])) + { + return $this->container->get('settings')['plugins'][$pluginname]; + } + + return false; + } + + protected function getPluginData($filename, $pluginname = false) + { + $pluginname = $this->getPluginName($pluginname); + + $storageClass = $this->container->get('settings')['storage']; + $storage = new StorageWrapper($storageClass); + + $data = $storage->getFile('dataFolder', $pluginname, $filename); + + return $data; + } + + protected function getPluginYamlData($filename, $pluginname = false) + { + $pluginname = $this->getPluginName($pluginname); + + $storageClass = $this->container->get('settings')['storage']; + $storage = new StorageWrapper($storageClass); + + $data = $storage->getYaml('dataFolder', $pluginname, $filename); + + return $data; + } + + protected function storePluginData($filename, $pluginname = false) + { + $pluginname = $this->getPluginName($pluginname); + + $storageClass = $this->container->get('settings')['storage']; + $storage = new StorageWrapper($storageClass); + + $result = $storage->writeFile('dataFolder', $pluginname, $filename); + + if($result) + { + return true; + } + + return $storage->getError(); + } + + protected function storePluginYamlData(string $filename, array $data, $pluginname = false) + { + $pluginname = $this->getPluginName($pluginname); + + # validation + $extension = new Extension(); + $pluginDefinitions = $extension->getPluginDefinition($pluginname); + $formDefinitions = $pluginDefinitions['system']['fields'] ?? false; + + if($formDefinitions) + { +# where can we add this method so we can use it everywhere? +# $formdefinitions = $this->addDatasets($formdefinitions); + + $validate = new Validation(); + + $validatedOutput = $validate->recursiveValidation($formDefinitions, $data); + if(!empty($validate->errors)) + { + return $validate->errors; + } + } + + $storageClass = $this->container->get('settings')['storage']; + $storage = new StorageWrapper($storageClass); + + $result = $storage->updateYaml('dataFolder', $pluginname, $filename, $data); + + if($result) + { + return true; + } + + return $storage->getError(); + } + + private function getPluginName($pluginname) + { + if(!$pluginname) + { + $classname = get_called_class(); + + if ($pos = strrpos($classname, '\\')) + { + $pluginname = strtolower(substr($classname, $pos + 1)); + } + } + + return $pluginname; } protected function urlinfo() @@ -84,11 +191,23 @@ abstract class Plugin implements EventSubscriberInterface $this->container->get('assets')->addJS($JS); } +/* protected function addEditorJS($JS) { $this->container->get('assets')->addEditorJS($JS); } + protected function addEditorInlineJS($JS) + { + $this->container->get('assets')->addEditorInlineJS($JS); + } + + protected function addEditorCSS($CSS) + { + $this->container->get('assets')->addEditorCSS($CSS); + } +*/ + protected function addInlineJS($JS) { $this->container->get('assets')->addInlineJS($JS); @@ -98,11 +217,6 @@ abstract class Plugin implements EventSubscriberInterface { $this->container->get('assets')->addSvgSymbol($symbol); } - - protected function addEditorInlineJS($JS) - { - $this->container->get('assets')->addEditorInlineJS($JS); - } protected function addCSS($CSS) { @@ -114,11 +228,6 @@ abstract class Plugin implements EventSubscriberInterface $this->container->get('assets')->addInlineCSS($CSS); } - protected function addEditorCSS($CSS) - { - $this->container->get('assets')->addEditorCSS($CSS); - } - protected function getMeta() { return $this->container->get('assets')->meta; diff --git a/system/typemill/Static/Plugins.php b/system/typemill/Static/Plugins.php index 6273314..b873c99 100644 --- a/system/typemill/Static/Plugins.php +++ b/system/typemill/Static/Plugins.php @@ -54,7 +54,7 @@ class Plugins $pluginRoute['route'] = strtolower($pluginRoute['route']); $routes[$routeType][] = $pluginRoute; } - } + } } return $routes; diff --git a/system/typemill/author/js/vue-plugins.js b/system/typemill/author/js/vue-plugins.js index 0948c08..efee273 100644 --- a/system/typemill/author/js/vue-plugins.js +++ b/system/typemill/author/js/vue-plugins.js @@ -3,6 +3,7 @@ const app = Vue.createApp({
  • +

    Please update to version {{ versions[pluginname].version }}

    License: {{ plugin.license }}

    @@ -90,12 +91,43 @@ const app = Vue.createApp({ userroles: false, showModal: false, modalMessage: 'default', + versions: false, } }, mounted() { eventBus.$on('forminput', formdata => { this.formData[this.current][formdata.name] = formdata.value; }); + + var self = this; + + var plugins = {}; + for (var key in this.formDefinitions) + { + if (this.formDefinitions.hasOwnProperty(key)) + { + plugins[key] = this.formDefinitions[key].version; + } + } + + tmaxios.post('/api/v1/versioncheck',{ + 'url': data.urlinfo.route, + 'type': 'plugins', + 'data': plugins + }) + .then(function (response) + { + if(response.data.plugins) + { + self.versions = response.data.plugins; + } + }) + .catch(function (error) + { + self.messageClass = 'bg-rose-500'; + self.message = error.response.data.message; + }); + }, methods: { getActiveClass: function(pluginname) diff --git a/system/typemill/author/js/vue-shared.js b/system/typemill/author/js/vue-shared.js index f8dcf80..7839249 100644 --- a/system/typemill/author/js/vue-shared.js +++ b/system/typemill/author/js/vue-shared.js @@ -49,4 +49,5 @@ const translatefilter = { return data.labels[translation_key] } } -} \ No newline at end of file +} + diff --git a/system/typemill/author/js/vue-system.js b/system/typemill/author/js/vue-system.js index 6e410a6..f0b6492 100644 --- a/system/typemill/author/js/vue-system.js +++ b/system/typemill/author/js/vue-system.js @@ -1,6 +1,7 @@ const app = Vue.createApp({ template: `
    +

    Please update typemill to version {{ version.system }}

    • @@ -34,10 +35,15 @@ const app = Vue.createApp({ message: '', messageClass: '', errors: {}, + version: false, } }, mounted() { + eventBus.$on('forminput', formdata => { + this.formData[formdata.name] = formdata.value; + }); + for (var key in this.formDefinitions) { if (this.formDefinitions.hasOwnProperty(key)) @@ -47,10 +53,26 @@ const app = Vue.createApp({ } } - eventBus.$on('forminput', formdata => { - this.formData[formdata.name] = formdata.value; - }); + var self = this; + tmaxios.post('/api/v1/versioncheck',{ + 'url': data.urlinfo.route, + 'type': 'system', + 'data': this.formData.version + }) + .then(function (response) + { + if(response.data.system) + { + self.version = response.data.system; + console.info(self.version); + } + }) + .catch(function (error) + { + self.messageClass = 'bg-rose-500'; + self.message = error.response.data.message; + }); }, methods: { selectComponent: function(type) diff --git a/system/typemill/author/js/vue-themes.js b/system/typemill/author/js/vue-themes.js index 9db1f73..be8f3fc 100644 --- a/system/typemill/author/js/vue-themes.js +++ b/system/typemill/author/js/vue-themes.js @@ -3,6 +3,7 @@ const app = Vue.createApp({
      • +

        Please update to version {{ versions[themename].version }}

        License: {{ theme.license }}

        @@ -93,6 +94,7 @@ const app = Vue.createApp({ message: '', messageClass: '', errors: {}, + versions: false, userroles: false, showModal: false, modalMessage: 'default', @@ -104,6 +106,35 @@ const app = Vue.createApp({ }); this.deactivateThemes(); this.formData[this.theme].active = true; + + var self = this; + + var themes = {}; + for (var key in this.formDefinitions) + { + if (this.formDefinitions.hasOwnProperty(key)) + { + themes[key] = this.formDefinitions[key].version; + } + } + + tmaxios.post('/api/v1/versioncheck',{ + 'url': data.urlinfo.route, + 'type': 'themes', + 'data': themes + }) + .then(function (response) + { + if(response.data.themes) + { + self.versions = response.data.themes; + } + }) + .catch(function (error) + { + self.messageClass = 'bg-rose-500'; + self.message = error.response.data.message; + }); }, methods: { deactivateThemes: function() diff --git a/system/typemill/author/layouts/layoutSystemBlank.twig b/system/typemill/author/layouts/layoutSystemBlank.twig index 8ff0050..fd8e0c3 100644 --- a/system/typemill/author/layouts/layoutSystemBlank.twig +++ b/system/typemill/author/layouts/layoutSystemBlank.twig @@ -39,8 +39,6 @@
        - -

        {{ translate('System') }}

        @@ -64,12 +62,13 @@ - {% block javascript %}{% endblock %} {{ assets.renderJS() }} + +