1
0
mirror of https://github.com/typemill/typemill.git synced 2025-10-24 11:06:10 +02:00

Merge branch 'develop' into master

This commit is contained in:
trendschau
2020-10-20 20:55:18 +02:00
43 changed files with 264 additions and 127 deletions

View File

@@ -10,16 +10,16 @@
},
"require": {
"slim/slim": "~3.7",
"twig/twig": "~1.18",
"slim/twig-view": "~2.3",
"slim/flash": "~0.4",
"twig/twig": "~1.18",
"slim/twig-view": "~2.3",
"slim/flash": "~0.4",
"slim/csrf": "~0.8",
"symfony/yaml": "~2.8",
"symfony/event-dispatcher": "~3.3",
"erusev/parsedown": "~1.4",
"erusev/parsedown-extra": "dev-master",
"jbroadway/urlify": "1.1.3",
"vlucas/valitron": "dev-master",
"symfony/event-dispatcher": "~3.3",
"erusev/parsedown": "~1.4",
"erusev/parsedown-extra": "dev-master",
"jbroadway/urlify": "1.1.3",
"vlucas/valitron": "dev-master",
"laminas/laminas-permissions-acl": "^2.7",
"akrabat/proxy-detection-middleware": "^0.4.0"
},

View File

@@ -2,8 +2,6 @@
Congratulations! If you see this page, then the setup of the system has worked successfully!! You can now login (/tm/login) and configure your system, your themes and your plugins. You will find all settings in the settings-area (/tm/settings).
## If it does not work
If you face any problems during the installation, then please make sure, that your system supports these features:
- PHP version 7+.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 887 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 188 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 188 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 222 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 454 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 119 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 282 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 411 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 117 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

View File

@@ -6,7 +6,7 @@ use Typemill\Models\ProcessImage;
class Assets
{
protected $baseUrl;
public $baseUrl;
public function __construct($baseUrl)
{
@@ -22,6 +22,16 @@ class Assets
$this->imageFolder = 'original';
}
public function setUri($uri)
{
$this->uri = $uri;
}
public function setBaseUrl($baseUrl)
{
$this->baseUrl = $baseUrl;
}
public function image($url)
{
$this->imageUrl = $url;
@@ -151,6 +161,8 @@ class Assets
{
$this->JS[] = '<script src="' . $JSfile . '"></script>';
}
# print_r($this->JS);
}
public function addInlineJS($JS)

View File

@@ -39,6 +39,9 @@ class ArticleApiController extends ContentController
# set structure
if(!$this->setStructure($draft = true)){ return $response->withJson($this->errors, 404); }
# set information for homepage
$this->setHomepage($args = false);
# set item
if(!$this->setItem()){ return $response->withJson($this->errors, 404); }
@@ -72,7 +75,7 @@ class ArticleApiController extends ContentController
if(is_array($this->content))
{
# initialize parsedown extension
$parsedown = new ParsedownExtension();
$parsedown = new ParsedownExtension($this->uri->getBaseUrl());
# turn markdown into an array of markdown-blocks
$this->content = $parsedown->arrayBlocksToMarkdown($this->content);
@@ -125,6 +128,9 @@ class ArticleApiController extends ContentController
# set structure
if(!$this->setStructure($draft = true)){ return $response->withJson($this->errors, 404); }
# set information for homepage
$this->setHomepage($args = false);
# set item
if(!$this->setItem()){ return $response->withJson($this->errors, 404); }
@@ -151,7 +157,7 @@ class ArticleApiController extends ContentController
if(!$this->setContent()){ return $response->withJson($this->errors, 404); }
# initialize parsedown extension
$parsedown = new ParsedownExtension();
$parsedown = new ParsedownExtension($this->uri->getBaseUrl());
# turn markdown into an array of markdown-blocks
$contentArray = $parsedown->markdownToArrayBlocks($this->content);
@@ -219,6 +225,9 @@ class ArticleApiController extends ContentController
# set structure
if(!$this->setStructure($draft = true)){ return $response->withJson($this->errors, 404); }
# set information for homepage
$this->setHomepage($args = false);
# set item
if(!$this->setItem()){ return $response->withJson($this->errors, 404); }
@@ -237,7 +246,7 @@ class ArticleApiController extends ContentController
# set redirect url to edit page
$url = $this->uri->getBaseUrl() . '/tm/content/' . $this->settings['editor'];
if(isset($this->item->urlRelWoF))
if(isset($this->item->urlRelWoF) && $this->item->urlRelWoF != '/' )
{
$url = $url . $this->item->urlRelWoF;
}
@@ -276,6 +285,9 @@ class ArticleApiController extends ContentController
# set structure
if(!$this->setStructure($draft = true)){ return $response->withJson($this->errors, 404); }
# set information for homepage
$this->setHomepage($args = false);
# set item
if(!$this->setItem()){ return $response->withJson($this->errors, 404); }
@@ -351,6 +363,9 @@ class ArticleApiController extends ContentController
# set structure
if(!$this->setStructure($draft = true)){ return $response->withJson($this->errors, 404); }
# set information for homepage
$this->setHomepage($args = false);
# set item
if(!$this->setItem()){ return $response->withJson($this->errors, 404); }
@@ -371,7 +386,7 @@ class ArticleApiController extends ContentController
$updatedContent = '# ' . $this->params['title'] . "\r\n\r\n" . $this->params['content'];
# initialize parsedown extension
$parsedown = new ParsedownExtension();
$parsedown = new ParsedownExtension($this->uri->getBaseUrl());
# turn markdown into an array of markdown-blocks
$contentArray = $parsedown->markdownToArrayBlocks($updatedContent);
@@ -829,7 +844,7 @@ class ArticleApiController extends ContentController
if(!$this->setStructure($draft = true, $cache = false)){ return $response->withJson(array('data' => false, 'errors' => $this->errors, 'url' => $url), 404); }
# set information for homepage
$this->setHomepage();
$this->setHomepage($args = false);
# get item for url and set it active again
if(isset($this->params['url']))
@@ -854,6 +869,9 @@ class ArticleApiController extends ContentController
# set structure
if(!$this->setStructure($draft = true)){ return $response->withJson(array('data' => false, 'errors' => $this->errors), 404); }
# set information for homepage
$this->setHomepage($args = false);
/* set item */
if(!$this->setItem()){ return $response->withJson($this->errors, 404); }
@@ -888,7 +906,7 @@ class ArticleApiController extends ContentController
if(!is_array($content))
{
# initialize parsedown extension
$parsedown = new ParsedownExtension();
$parsedown = new ParsedownExtension($this->uri->getBaseUrl());
# turn markdown into an array of markdown-blocks
$content = $parsedown->markdownToArrayBlocks($content);
@@ -916,6 +934,9 @@ class ArticleApiController extends ContentController
# set structure
if(!$this->setStructure($draft = true)){ return $response->withJson(array('data' => false, 'errors' => $this->errors), 404); }
# set information for homepage
$this->setHomepage($args = false);
/* set item */
if(!$this->setItem()){ return $response->withJson($this->errors, 404); }
@@ -947,7 +968,7 @@ class ArticleApiController extends ContentController
}
# initialize parsedown extension
$parsedown = new ParsedownExtension();
$parsedown = new ParsedownExtension($this->uri->getBaseUrl());
# fix footnotes in parsedown, might break with complicated footnotes
$parsedown->setVisualMode();

View File

@@ -33,6 +33,8 @@ class BlockApiController extends ContentController
# set structure
if(!$this->setStructure($draft = true)){ return $response->withJson(array('data' => false, 'errors' => $this->errors), 404); }
$this->setHomepage($args = false);
/* set item */
if(!$this->setItem()){ return $response->withJson($this->errors, 404); }
@@ -72,7 +74,7 @@ class BlockApiController extends ContentController
}
# initialize parsedown extension
$parsedown = new ParsedownExtension();
$parsedown = new ParsedownExtension($this->uri->getBaseUrl());
# if content is not an array, then transform it
if(!is_array($pageMarkdown))
@@ -170,7 +172,7 @@ class BlockApiController extends ContentController
}
# initialize parsedown extension
$parsedown = new ParsedownExtension();
$parsedown = new ParsedownExtension($this->uri->getBaseUrl());
# if content is not an array, then transform it
if(!is_array($content))
@@ -229,6 +231,8 @@ class BlockApiController extends ContentController
# set structure
if(!$this->setStructure($draft = true)){ return $response->withJson(array('data' => false, 'errors' => $this->errors), 404); }
$this->setHomepage($args = false);
/* set item */
if(!$this->setItem()){ return $response->withJson($this->errors, 404); }
@@ -268,7 +272,7 @@ class BlockApiController extends ContentController
}
# initialize parsedown extension
$parsedown = new ParsedownExtension();
$parsedown = new ParsedownExtension($this->uri->getBaseUrl());
$parsedown->setVisualMode();
# if content is not an array, then transform it
@@ -384,6 +388,8 @@ class BlockApiController extends ContentController
# set structure
if(!$this->setStructure($draft = true)){ return $response->withJson(array('data' => false, 'errors' => $this->errors), 404); }
$this->setHomepage($args = false);
# set item
if(!$this->setItem()){ return $response->withJson($this->errors, 404); }
@@ -415,7 +421,7 @@ class BlockApiController extends ContentController
}
# initialize parsedown extension
$parsedown = new ParsedownExtension();
$parsedown = new ParsedownExtension($this->uri->getBaseUrl());
# if content is not an array, then transform it
if(!is_array($pageMarkdown))
@@ -490,6 +496,8 @@ class BlockApiController extends ContentController
# set structure
if(!$this->setStructure($draft = true)){ return $response->withJson(array('data' => false, 'errors' => $this->errors), 404); }
$this->setHomepage($args = false);
# set item
if(!$this->setItem()){ return $response->withJson($this->errors, 404); }
@@ -521,7 +529,7 @@ class BlockApiController extends ContentController
}
# initialize parsedown extension
$parsedown = new ParsedownExtension();
$parsedown = new ParsedownExtension($this->uri->getBaseUrl());
# if content is not an array, then transform it
if(!is_array($this->content))

View File

@@ -28,7 +28,7 @@ class ContentBackendController extends ContentController
if(!$this->setStructure($draft = true)){ return $this->renderIntern404($response, array( 'navigation' => true, 'content' => $this->errors )); }
# set information for homepage
$this->setHomepage();
$this->setHomepage($args);
# set item
if(!$this->setItem()){ return $this->renderIntern404($response, array( 'navigation' => $this->structure, 'settings' => $this->settings, 'content' => $this->errors )); }
@@ -44,7 +44,7 @@ class ContentBackendController extends ContentController
# 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;
@@ -58,7 +58,7 @@ class ContentBackendController extends ContentController
if(is_array($content))
{
# transform array to markdown
$parsedown = new ParsedownExtension();
$parsedown = new ParsedownExtension($this->uri->getBaseUrl());
$content = $parsedown->arrayBlocksToMarkdown($content);
}
@@ -108,7 +108,7 @@ class ContentBackendController extends ContentController
if(!$this->setStructure($draft = true)){ return $this->renderIntern404($response, array( 'navigation' => true, 'content' => $this->errors )); }
# set information for homepage
$this->setHomepage();
$this->setHomepage($args);
# set item
if(!$this->setItem()){ return $this->renderIntern404($response, array( 'navigation' => $this->structure, 'settings' => $this->settings, 'content' => $this->errors )); }
@@ -136,7 +136,7 @@ class ContentBackendController extends ContentController
}
# initialize parsedown extension
$parsedown = new ParsedownExtension();
$parsedown = new ParsedownExtension($this->uri->getBaseUrl());
# to fix footnote-logic in parsedown, set visual mode to true
$parsedown->setVisualMode();

View File

@@ -62,6 +62,8 @@ abstract class ContentController
$this->settings = $this->c->get('settings');
$this->structureLiveName = 'structure.txt';
$this->structureDraftName = 'structure-draft.txt';
$this->c->dispatcher->dispatch('onTwigLoaded');
}
# admin ui rendering
@@ -275,7 +277,8 @@ abstract class ContentController
}
}
protected function setHomepage()
# this is only set by content backend controller
protected function setHomepage($args)
{
$contentFolder = Folder::scanFolderFlat($this->settings['rootPath'] . $this->settings['contentFolder']);
@@ -295,7 +298,7 @@ abstract class ContentController
}
$active = false;
if($this->params['url'] == '/' || $this->params['url'] == $this->uri->getBasePath() )
if($this->params['url'] == '/' || (is_array($args) && empty($args)))
{
$active = 'active';
}
@@ -305,8 +308,11 @@ abstract class ContentController
protected function setItem()
{
# home is only set by backend controller, not by api calls
$home = isset($this->homepage['active']) ? $this->homepage['active'] : false;
# search for the url in the structure
$item = Folder::getItemForUrl($this->structure, $this->params['url'], $this->uri->getBasePath());
$item = Folder::getItemForUrl($this->structure, $this->params['url'], $this->uri->getBaseUrl(), NULL, $home);
if($item)
{

View File

@@ -15,7 +15,8 @@ abstract class Controller
public function __construct(ContainerInterface $c)
{
$this->c = $c;
$this->c = $c;
$this->c->dispatcher->dispatch('onTwigLoaded');
}
# frontend rendering
@@ -23,7 +24,7 @@ abstract class Controller
{
# why commented this out??
$data = $this->c->dispatcher->dispatch('onPageReady', new OnPageReady($data))->getData();
if(isset($_SESSION['old']))
{
unset($_SESSION['old']);

View File

@@ -72,6 +72,9 @@ class MetaApiController extends ContentController
# set structure
if(!$this->setStructure($draft = true)){ return $response->withJson($this->errors, 404); }
# set information for homepage
$this->setHomepage($args = false);
# set item
if(!$this->setItem()){ return $response->withJson($this->errors, 404); }
@@ -153,6 +156,9 @@ class MetaApiController extends ContentController
# set structure
if(!$this->setStructure($draft = true)){ return $response->withJson($this->errors, 404); }
# set information for homepage
$this->setHomepage($args);
# set item
if(!$this->setItem()){ return $response->withJson($this->errors, 404); }

View File

@@ -106,10 +106,11 @@ class PageController extends Controller
}
# if the user is on startpage
$home = false;
if(empty($args))
{
$home = true;
$item = Folder::getItemForUrl($navigation, $uri->getBasePath(), $uri->getBasePath());
$item = Folder::getItemForUrl($navigation, $uri->getBasePath(), $uri->getBaseUrl(), NULL, $home);
$urlRel = $uri->getBasePath();
}
else
@@ -178,7 +179,7 @@ class PageController extends Controller
if(isset($item->hide) && !$item->hide)
{
# use the navigation instead of the structure so that hidden elements are erased
$item = Folder::getItemForUrl($navigation, $urlRel, $uri->getBasePath());
$item = Folder::getItemForUrl($navigation, $urlRel, $uri->getBaseUrl(), NULL, $home);
}
}
@@ -200,7 +201,7 @@ class PageController extends Controller
$itemUrl = isset($item->urlRel) ? $item->urlRel : false;
/* initialize parsedown */
$parsedown = new ParsedownExtension($settings['headlineanchors']);
$parsedown = new ParsedownExtension($base_url, $settings['headlineanchors']);
/* set safe mode to escape javascript and html in markdown */
$parsedown->setSafeMode(true);

View File

@@ -6,7 +6,7 @@ use \URLify;
class ParsedownExtension extends \ParsedownExtra
{
function __construct($showAnchor = NULL, $skipAbsoluteUrls = NULL)
function __construct($baseUrl = '', $showAnchor = NULL)
{
parent::__construct();
@@ -14,7 +14,7 @@ class ParsedownExtension extends \ParsedownExtra
$this->showAnchor = $showAnchor;
# base url is needed for media/images and relative links (e.g. if www.mydomain.com/mywebsite)
$this->baseUrl = $skipAbsoluteUrls ? '' : TM_BASE_URL;
$this->baseUrl = $baseUrl;
# math support
$this->BlockTypes['\\'][] = 'Math';

View File

@@ -0,0 +1,40 @@
<?php
namespace Typemill\Middleware;
use Slim\Views\Twig;
use Slim\Http\Request;
use Slim\Http\Response;
class assetMiddleware
{
protected $view;
protected $c;
public function __construct($container)
{
# $this->view = $view;
$this->container = $container;
}
public function __invoke(Request $request, Response $response, $next)
{
# get the uri after proxy detection
$uri = $request->getUri()->withUserInfo('');
# update the asset object in the container (for plugins) with the new url
$this->container->assets->setBaseUrl($uri->getBaseUrl());
# add the asset object to twig-frontend for themes
$this->container['view']->getEnvironment()->addGlobal('assets', $this->container['assets']);
# use {{ base_url() }} in twig templates
$this->container['view']['base_url'] = $uri->getBaseUrl();
$this->container['view']['current_url'] = $uri->getPath();
$response = $next($request, $response);
return $response;
}
}

View File

@@ -267,11 +267,11 @@ class Folder
}
}
public static function getItemForUrl($folderContentDetails, $url, $baseUrl, $result = NULL)
public static function getItemForUrl($folderContentDetails, $url, $baseUrl, $result = NULL, $home = NULL )
{
# if we are on the homepage
if($url == '/' OR $url == $baseUrl)
if($home)
{
# return a standard item-object
$item = new \stdClass;

View File

@@ -49,7 +49,7 @@ abstract class Plugin implements EventSubscriberInterface
->withHeader("Content-Type", "application/json")
->withStatus(400)
->write(json_encode($data, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT));
}
}
protected function getSettings()
{

View File

@@ -82,7 +82,7 @@ class Settings
'editor' => 'visual',
'formats' => ['markdown', 'headline', 'ulist', 'olist', 'table', 'quote', 'notice', 'image', 'video', 'file', 'toc', 'hr', 'definition', 'code'],
'contentFolder' => 'content',
'version' => '1.3.8',
'version' => '1.4.0',
'setup' => true,
'welcome' => true,
'images' => ['live' => ['width' => 820], 'thumbs' => ['width' => 250, 'height' => 150]],

View File

@@ -227,3 +227,19 @@ CONFIGURE_YOUR_WEBSITE: Configure your website
GIVE_YOUR_NEW_WEBSITE_A_NAME__ADD_THE_AUTHOR_AND_CHOOSE_A_COPYRIGHT_: Give your new website a name, add the author and choose a copyright.
CHOOSE_A_THEME_FOR_YOUR_WEBSITE_AND_CONFIGURE_THE_THEME_DETAILS_: Choose a theme for your website and configure the theme details.
ADD_NEW_FEATURES_TO_YOUR_WEBSITE_WITH_PLUGINS_AND_CONFIGURE_THEM_: Add new features to your website with plugins and configure them.
DEVELOPER: Developer
THE_FOLLOWING_OPTIONS_ARE_ONLY_FOR_DEVELOPERS: The following options are only for developers and experienced administrators. Only change the options if you really understand them. For example: Never activate the error reporting for a live website, use this option only for bug-fixing.
ERROR_REPORTING: Error Reporting
DISPLAY_APPLICATION_ERRORS: Display Application Errors
TWIG_CACHE: Twig Cache
ACTIVATE_CACHE_FOR_TWIG_TEMPLATES: Activate Cache for Twig Templates
DELETE_ALL_CACHE_FILES: Delete all cache files
CLEAR_CACHE: Clear Cache
STANDARD_WIDTH_FOR_IMAGES: Standard width for images
THIS_APPLIES_ONLY_FOR_FUTURE_IMAGES_IN_THE_CONTENT_AREA_: This applies only for future images in the content area.
STANDARD_HEIGHT_FOR_IMAGES: Standard height for images
IF_YOU_ADD_A_VALUE_FOR_THE_HEIGHT__THEN_THE_IMAGE_WILL_BE_CROPPED_: If you add a value for the height, then the image will be cropped.
PROXY: Proxy
USE_X_FORWARDED_HEADERS: Use X-Forwarded Headers
TRUSTED_IPS_FOR_PROXY_(COMMA_SEPARATED): Trusted IPs for proxy (comma separated)

View File

@@ -227,3 +227,19 @@ CONFIGURE_YOUR_WEBSITE: Configura il tuo sito
GIVE_YOUR_NEW_WEBSITE_A_NAME__ADD_THE_AUTHOR_AND_CHOOSE_A_COPYRIGHT_: Dai un nome al tuo nuovo sito, aggiungi l'autore e scegli un diritto d'autore.
CHOOSE_A_THEME_FOR_YOUR_WEBSITE_AND_CONFIGURE_THE_THEME_DETAILS_: Scegli un tema per il tuo sito e configura i dettagli del tema.
ADD_NEW_FEATURES_TO_YOUR_WEBSITE_WITH_PLUGINS_AND_CONFIGURE_THEM_: Aggiungi nuove funzionalità al tuo sito mediante plugin e configurali.
DEVELOPER: Sviluppatore
THE_FOLLOWING_OPTIONS_ARE_ONLY_FOR_DEVELOPERS: Le seguenti opzioni sono solo per sviluppatori e amministratori esperti. Cambia le opzioni solo se le capisci davvero. Ad esempio: non attivare mai la segnalazione degli errori per un sito Web live, utilizzare questa opzione solo per la correzione dei bug.
ERROR_REPORTING: Segnalazione errori
DISPLAY_APPLICATION_ERRORS: Visualizza errori dell'applicazione
TWIG_CACHE: Twig Cache
ACTIVATE_CACHE_FOR_TWIG_TEMPLATES: Attiva la cache per i modelli Twig
DELETE_ALL_CACHE_FILES: Elimina tutti i file della cache
CLEAR_CACHE: Cancella cache
STANDARD_WIDTH_FOR_IMAGES: Larghezza standard per le immagini
THIS_APPLIES_ONLY_FOR_FUTURE_IMAGES_IN_THE_CONTENT_AREA_: Questo vale solo per le immagini future nell'area del contenuto.
STANDARD_HEIGHT_FOR_IMAGES: Altezza standard per le immagini
IF_YOU_ADD_A_VALUE_FOR_THE_HEIGHT__THEN_THE_IMAGE_WILL_BE_CROPPED_: Se aggiungi un valore per l'altezza, l'immagine verrà ritagliata.
PROXY: Proxy
USE_X_FORWARDED_HEADERS: Usa intestazioni con X-Forwarded
TRUSTED_IPS_FOR_PROXY_(COMMA_SEPARATED): IP affidabili per proxy (separati da virgole)

View File

@@ -17,8 +17,8 @@
<link rel="apple-touch-icon" sizes="180x180" href="{{ base_url }}/system/author/img/favicon-180.png" />
<link rel="stylesheet" href="{{ base_url }}/system/author/css/normalize.css" />
<link rel="stylesheet" href="{{ base_url }}/system/author/css/tachyons.min.css?20200716" />
<link rel="stylesheet" href="{{ base_url }}/system/author/css/style.css?20200716" />
<link rel="stylesheet" href="{{ base_url }}/system/author/css/tachyons.min.css?20201012" />
<link rel="stylesheet" href="{{ base_url }}/system/author/css/style.css?20201012" />
{{ assets.renderCSS() }}
@@ -41,16 +41,16 @@
<footer></footer>
</div>
<!-- <script src="{{ base_url }}/system/author/js/color-picker.min.js?20200505"></script> -->
<script src="{{ base_url }}/system/author/js/axios.min.js?20200716"></script>
<script src="{{ base_url }}/system/author/js/axios.min.js?20201012"></script>
<script>
const myaxios = axios.create();
myaxios.defaults.baseURL = "{{ base_url }}";
</script>
<script src="{{ base_url }}/system/author/js/autosize.min.js?20200716"></script>
<script src="{{ base_url }}/system/author/js/vue.min.js?20200716"></script>
<script src="{{ base_url }}/system/author/js/vue-shared.js?20200716"></script>
<script src="{{ base_url }}/system/author/js/author.js?20200716"></script>
<script src="{{ base_url }}/system/author/js/typemillutils.js?20200716"></script>
<script src="{{ base_url }}/system/author/js/autosize.min.js?20201012"></script>
<script src="{{ base_url }}/system/author/js/vue.min.js?20201012"></script>
<script src="{{ base_url }}/system/author/js/vue-shared.js?20201012"></script>
<script src="{{ base_url }}/system/author/js/author.js?20201012"></script>
<script src="{{ base_url }}/system/author/js/typemillutils.js?20201012"></script>
<script>
typemillUtilities.start()
</script>

View File

@@ -18,7 +18,7 @@
<link rel="apple-touch-icon" sizes="180x180" href="{{ base_url }}/system/author/img/favicon-180.png" />
<link rel="stylesheet" href="{{ base_url }}/system/author/css/normalize.css" />
<link rel="stylesheet" href="{{ base_url }}/system/author/css/style.css?20200716" />
<link rel="stylesheet" href="{{ base_url }}/system/author/css/style.css?20201012" />
{{ assets.renderCSS() }}
@@ -32,6 +32,6 @@
{% block content %}{% endblock %}
</div>
<script src="{{ base_url }}/system/author/js/auth.js?20200716"></script>
<script src="{{ base_url }}/system/author/js/auth.js?20201012"></script>
</body>
</html>

View File

@@ -17,7 +17,7 @@
<link rel="apple-touch-icon" sizes="180x180" href="{{ base_url }}/system/author/img/favicon-180.png" />
<link rel="stylesheet" href="{{ base_url }}/system/author/css/normalize.css" />
<link rel="stylesheet" href="{{ base_url }}/system/author/css/style.css?20200716" />
<link rel="stylesheet" href="{{ base_url }}/system/author/css/style.css?20201012" />
</head>
<body>

View File

@@ -18,7 +18,7 @@
<link rel="stylesheet" href="{{ base_url }}/system/author/css/normalize.css" />
<link rel="stylesheet" href="{{ base_url }}/system/author/css/tachyons.min.css" />
<link rel="stylesheet" href="{{ base_url }}/system/author/css/style.css?20200716" />
<link rel="stylesheet" href="{{ base_url }}/system/author/css/style.css?20201012" />
<link rel="stylesheet" href="{{ base_url }}/system/author/css/color-picker.min.css" />
{{ assets.renderCSS() }}
@@ -46,28 +46,28 @@
const myaxios = axios.create();
myaxios.defaults.baseURL = "{{ base_url }}";
</script>
<script src="{{ base_url }}/system/author/js/typemillutils.js?20200716"></script>
<script src="{{ base_url }}/system/author/js/vue.min.js?20200716"></script>
<script src="{{ base_url }}/system/author/js/autosize.min.js?20200716"></script>
<script src="{{ base_url }}/system/author/js/author.js?20200716"></script>
<script src="{{ base_url }}/system/author/js/vue-publishcontroller.js?20200716"></script>
<script src="{{ base_url }}/system/author/js/vue-blox-config.js?20200716"></script>
<script src="{{ base_url }}/system/author/js/typemillutils.js?20201012"></script>
<script src="{{ base_url }}/system/author/js/vue.min.js?20201012"></script>
<script src="{{ base_url }}/system/author/js/autosize.min.js?20201012"></script>
<script src="{{ base_url }}/system/author/js/author.js?20201012"></script>
<script src="{{ base_url }}/system/author/js/vue-publishcontroller.js?20201012"></script>
<script src="{{ base_url }}/system/author/js/vue-blox-config.js?20201012"></script>
<script>
let formatConfig = {{ settings.formats|json_encode() }};
let language = {{ settings.language|json_encode() }};
let labels = {{ translations|json_encode() }};
let labels = {{ translations|json_encode() }};
let navigation = {{ navigation|json_encode() }};
</script>
{{ assets.renderEditorJS() }}
<script src="{{ base_url }}/system/author/js/vue-blox.js?20200716"></script>
<script src="{{ base_url }}/system/author/js/vue-posts.js?20200716"></script>
<script src="{{ base_url }}/system/author/js/sortable.min.js?20200716"></script>
<script src="{{ base_url }}/system/author/js/vuedraggable.umd.min.js?20200716"></script>
<script src="{{ base_url }}/system/author/js/vue-navi.js?20200716"></script>
<script src="{{ base_url }}/system/author/js/vue-shared.js?20200716"></script>
<script src="{{ base_url }}/system/author/js/vue-meta.js?20200716"></script>
<script src="{{ base_url }}/system/author/js/vue-blox.js?20201012"></script>
<script src="{{ base_url }}/system/author/js/vue-posts.js?20201012"></script>
<script src="{{ base_url }}/system/author/js/sortable.min.js?20201012"></script>
<script src="{{ base_url }}/system/author/js/vuedraggable.umd.min.js?20201012"></script>
<script src="{{ base_url }}/system/author/js/vue-navi.js?20201012"></script>
<script src="{{ base_url }}/system/author/js/vue-shared.js?20201012"></script>
<script src="{{ base_url }}/system/author/js/vue-meta.js?20201012"></script>
{{ assets.renderJS() }}

View File

@@ -17,7 +17,7 @@
<link rel="apple-touch-icon" sizes="180x180" href="{{ base_url }}/system/author/img/favicon-180.png" />
<link rel="stylesheet" href="{{ base_url }}/system/author/css/normalize.css" />
<link rel="stylesheet" href="{{ base_url }}/system/author/css/style.css?20200716" />
<link rel="stylesheet" href="{{ base_url }}/system/author/css/style.css?20201012" />
{{ assets.renderCSS() }}
@@ -39,16 +39,16 @@
</article>
<footer></footer>
</div>
<script src="{{ base_url }}/system/author/js/axios.min.js?20200716"></script>
<script src="{{ base_url }}/system/author/js/axios.min.js?20201012"></script>
<script>
const myaxios = axios.create();
myaxios.defaults.baseURL = "{{ base_url }}";
</script>
<script src="{{ base_url }}/system/author/js/vue.min.js?20200716"></script>
<script src="{{ base_url }}/system/author/js/autosize.min.js?20200716"></script>
<script src="{{ base_url }}/system/author/js/sortable.min.js?20200716"></script>
<script src="{{ base_url }}/system/author/js/vuedraggable.umd.min.js?20200716"></script>
<script src="{{ base_url }}/system/author/js/author.js?20200716"></script>
<script src="{{ base_url }}/system/author/js/vue.min.js?20201012"></script>
<script src="{{ base_url }}/system/author/js/autosize.min.js?20201012"></script>
<script src="{{ base_url }}/system/author/js/sortable.min.js?20201012"></script>
<script src="{{ base_url }}/system/author/js/vuedraggable.umd.min.js?20201012"></script>
<script src="{{ base_url }}/system/author/js/author.js?20201012"></script>
<script>
let language = {{ settings.language|json_encode() }};
@@ -58,10 +58,10 @@
{{ assets.renderEditorJS() }}
<script src="{{ base_url }}/system/author/js/vue-publishcontroller.js?20200716"></script>
<script src="{{ base_url }}/system/author/js/vue-editor.js?20200716"></script>
<script src="{{ base_url }}/system/author/js/vue-meta.js?20200716"></script>
<script src="{{ base_url }}/system/author/js/vue-navi.js?20200716"></script>
<script src="{{ base_url }}/system/author/js/vue-publishcontroller.js?20201012"></script>
<script src="{{ base_url }}/system/author/js/vue-editor.js?20201012"></script>
<script src="{{ base_url }}/system/author/js/vue-meta.js?20201012"></script>
<script src="{{ base_url }}/system/author/js/vue-navi.js?20201012"></script>
{{ assets.renderJS() }}

View File

@@ -151,7 +151,7 @@
<hr>
<header class="headline">
<h2>{{ __('Developer') }}</h2>
<p>The following options are only for developers and experienced administrators. Only change the options if you really understand them. For example: Never activate the error reporting for a live website, use this option only for bug-fixing.</p>
<p>{{ __('The following options are only for developers') }}</p>
</header>
<div class="large{{ errors.settings.displayErrorDetails ? ' error' : '' }}">
<label for="settings[displayErrorDetails]">{{ __('Error Reporting') }}</label>
@@ -169,12 +169,12 @@
</div>
<div class="medium">
<div class="label">{{ __('Delete all cache files') }}</div>
<button id="clearcache" class="link bg-tm-green white dim bn br1 ph3 pv2 f6">Clear Cache</button><div id="cacheresult" class="dib ph3 pv2"></div>
<button id="clearcache" class="link bg-tm-green white dim bn br1 ph3 pv2 f6">{{ __('Clear Cache') }}</button><div id="cacheresult" class="dib ph3 pv2"></div>
</div>
<div class="medium{{ errors.settings.images.live.width ? ' error' : '' }}">
<label for="imagewidth">{{ __('Standard width for images') }}</label>
<input type="text" name="settings[images][live][width]" id="imagewidth" value="{{ old.settings.images.live.width ? old.settings.images.live.width : settings.images.live.width }}" title="{{ __('Use a valid number') }}" />
<div class="description">This applies only for future images in the content area.</div>
<div class="description">{{ __('This applies only for future images in the content area.') }}</div>
{% if errors.settings.images.live.width %}
<span class="error">{{ errors.settings.images.live.width | first }}</span>
{% endif %}
@@ -182,7 +182,7 @@
<div class="medium{{ errors.settings.images.live.height ? ' error' : '' }}">
<label for="imageheight">{{ __('Standard height for images') }}</label>
<input type="text" name="settings[images][live][height]" id="imageheight" value="{{ old.settings.images.live.height ? old.settings.images.live.height : settings.images.live.height }}" title="{{ __('Use a valid number') }}" />
<div class="description">If you add a value for the height, then the image will be cropped.</div>
<div class="description">{{ __('If you add a value for the height, then the image will be cropped.') }}</div>
{% if errors.settings.images.live.height %}
<span class="error">{{ errors.settings.images.live.height | first }}</span>
{% endif %}

View File

@@ -48,11 +48,12 @@ $app = new \Slim\App($settings);
$container = $app->getContainer();
if(isset($settings['settings']['proxy']) && $settings['settings']['proxy'])
{
$trustedProxies = isset($settings['settings']['trustedproxies']) ? explode(",", $settings['settings']['trustedproxies']) : [];
$app->add(new RKA\Middleware\ProxyDetection($trustedProxies));
}
/************************
* Create URI *
************************/
# get uri and delete username and password from uri
$uri = \Slim\Http\Uri::createFromEnvironment(new \Slim\Http\Environment($_SERVER))->withUserInfo('');
/************************
* LOAD & UPDATE PLUGINS *
@@ -152,20 +153,6 @@ $container['dispatcher'] = function($container) use ($dispatcher)
return $dispatcher;
};
# delete username and password from uri
$uri = $container['request']->getUri()->withUserInfo('');
define("TM_BASE_URL", $uri->getBaseUrl());
/********************************
* ADD ASSET-FUNCTION FOR TWIG *
********************************/
$container['assets'] = function($c) use ($uri)
{
return new \Typemill\Assets($uri->getBaseUrl());
};
/************************
* DECIDE FOR SESSION *
************************/
@@ -176,20 +163,32 @@ $session_segments = array('setup', 'tm/', 'api/', '/setup', '/tm/', '/api/');
$client_segments = $dispatcher->dispatch('onSessionSegmentsLoaded', new OnSessionSegmentsLoaded([]))->getData();
$session_segments = array_merge($session_segments, $client_segments);
$path = $uri->getPath();
$container['flash'] = false;
$container['csrf'] = false;
/************************************
* ADD ASSET-FUNCTION FOR PLUGINS *
************************************/
$container['assets'] = function($c) use ($uri)
{
return new \Typemill\Assets($uri->getBaseUrl());
};
/********************************
* MOVE TO MIDDLEWARE NEXT TIME *
********************************/
# if website is restricted to registered user
if(isset($settings['settings']['access']) && $settings['settings']['access'] == 'registered')
{
# activate session for all routes
$session_segments = [$path];
$session_segments = [$uri->getPath()];
}
foreach($session_segments as $segment)
{
if(substr( $path, 0, strlen($segment) ) === $segment)
if(substr( $uri->getPath(), 0, strlen($segment) ) === $segment)
{
// configure session
ini_set('session.cookie_httponly', 1 );
@@ -240,9 +239,13 @@ $container['view'] = function ($container) use ($uri)
'debug' => true
]);
// Instantiate and add Slim specific extension
$basePath = rtrim(str_ireplace('index.php', '', $uri->getBasePath()), '/');
$view->addExtension(new Slim\Views\TwigExtension($container['router'], $basePath));
# Instantiate and add Slim specific extension
$router = $container->get('router');
# $basePath = rtrim(str_ireplace('index.php', '', $uri->getBasePath()), '/');
# $view->addExtension(new Slim\Views\TwigExtension($container['router'], $basePath));
$view->addExtension(new Slim\Views\TwigExtension($router, $uri));
$view->addExtension(new Twig_Extension_Debug());
$view->addExtension(new Typemill\Extensions\TwigUserExtension());
$view->addExtension(new Typemill\Extensions\TwigMarkdownExtension());
@@ -250,34 +253,27 @@ $container['view'] = function ($container) use ($uri)
$view->addExtension(new Typemill\Extensions\TwigPagelistExtension());
# use {{ base_url() }} in twig templates
$view['base_url'] = $uri->getBaseUrl();
$view['current_url'] = $uri->getPath();
# $view['base_url'] = $uri->getBaseUrl();
# $view['current_url'] = $uri->getPath();
/* if session route, add flash messages and csrf-protection */
# if session route, add flash messages and csrf-protection
if($container['flash'])
{
$view->getEnvironment()->addGlobal('flash', $container->flash);
$view->addExtension(new Typemill\Extensions\TwigCsrfExtension($container['csrf']));
}
/* add asset-function to all views */
$view->getEnvironment()->addGlobal('assets', $container->assets);
/******************************
* LOAD TRANSLATIONS *
******************************/
$uri = $_SERVER['REQUEST_URI'];
$base_path = $container['request']->getUri()->getBasePath();
$uri = str_replace($base_path,'',$uri);
$pieces = explode('/',$uri);
if(isset($uri) && ($pieces[1] === 'tm' OR $pieces[1] === 'setup') )
$pieces = explode('/',$uri->getPath());
if( ($pieces[0] === 'tm' OR $pieces[0] === 'setup') )
{
// Admin environment labels
# Admin environment labels
$labels = Typemill\Translations::loadTranslations('admin');
} else {
// User environment labels
// For now it is useless, but it will prove useful in the future
# User environment labels
# For now it is useless, but it will prove useful in the future
$labels = Typemill\Translations::loadTranslations('user');
}
$view['translations'] = $labels;
@@ -286,7 +282,7 @@ $container['view'] = function ($container) use ($uri)
return $view;
};
$container->dispatcher->dispatch('onTwigLoaded');
# $container->dispatcher->dispatch('onTwigLoaded');
/***************************
* ADD NOT FOUND HANDLER *
@@ -318,6 +314,22 @@ if($container['flash'])
$app->add($container->get('csrf'));
}
/********************************
* ASSET MIDDLEWARE FOR TWIG *
********************************/
$app->add(new \Typemill\Middleware\assetMiddleware($container));
/********************************
* PROXY DETECTION FOR REQUEST *
********************************/
if(isset($settings['settings']['proxy']) && $settings['settings']['proxy'])
{
$trustedProxies = ( isset($settings['settings']['trustedproxies']) && !empty($settings['settings']['trustedproxies']) ) ? explode(",", $settings['settings']['trustedproxies']) : [];
$app->add(new RKA\Middleware\ProxyDetection($trustedProxies));
}
/************************
* ADD ROUTES *
************************/

View File

@@ -17,7 +17,7 @@
<li class="db list tl pa0 w-100 mh0 mv2 mh2-l shadow-2-hover">
<a class="link mv4 dim" href="{{ element.urlAbs }}">
<div class="db h4-5 overflow-hidden">
<img class="db w-100" src="{{ page.meta.heroimage }}" alt="{{ page.meta.heroimagealt }}">
<img class="db w-100" src="{{base_url}}/{{ page.meta.heroimage }}" alt="{{ page.meta.heroimagealt }}">
</div>
<div class="pa2 ph3-ns pb3-ns">
<h3>{{ page.meta.title }}</h3>
@@ -43,7 +43,7 @@
<a class="link mv4 dim" href="{{ element.urlAbs }}">
<div class="db h4-5 overflow-hidden">
<img class="db w-100" src="{{ post.meta.heroimage }}" alt="{{ post.meta.heroimagealt }}">
<img class="db w-100" src="{{base_url}}/{{ post.meta.heroimage }}" alt="{{ post.meta.heroimagealt }}">
</div>
<div class="pa2 ph3-ns pb3-ns">
<h3>{{ post.meta.title }}</h3>