Commit ed7a577b authored by Pablo Rauzy's avatar Pablo Rauzy
Browse files

fix relative path bug + force absolute url for rss feed contents

parent b12c8a2e
......@@ -174,7 +174,7 @@ function list_files ($ext) {
}
// Print TinyMCE setup JavaScript
function tinymce_setup ($mode, $file) {
function tinymce_setup ($mode, $file, $relroot) {
global $config, $settings, $pages, $groups;
?><script>
tinymce.init({
......@@ -244,7 +244,8 @@ function tinymce_setup ($mode, $file) {
] }
],
document_base_url: '<?php echo $settings['url'],(dirname($file) == '.' ? '' : dirname($file).'/'); ?>',
relative_urls: true,
relative_urls: false,
remove_script_host: false,
setup: function (tmce) {
tmce.on('change', function (e) {
document.getElementById('warning').innerHTML = 'You have unsaved modifications!';
......@@ -273,7 +274,7 @@ function render ($file, $mode='edit', $entry_dt='NEW') {
$group_file = @reset(array_filter($menu, function ($p) { return $p['status'] != 'lnk'; }))['file'];
$page_entries = array_filter($entries, function ($e) use ($file) { return $e['page'] == $file; });
$relroot = str_repeat('../', substr_count($file, '/'));
if (empty($relroot)) $relroot = '/';
$relroot = empty($relroot) ? '/' : $relroot;
$title_head = str_replace(array('%site%', '%group%', '%page%'),
array($settings['title'], $groups[$group]['name'], $page['title']),
$settings['title_hformat']);
......@@ -398,7 +399,7 @@ function render ($file, $mode='edit', $entry_dt='NEW') {
});
document.getElementById('entry_content').parentNode.style.display = 'none';
</script>
<?php tinymce_setup('entry', $file); ?>
<?php tinymce_setup('entry', $file, $relroot); ?>
</div>
<?php else: // page ?>
<div id="main">
......@@ -412,7 +413,7 @@ function render ($file, $mode='edit', $entry_dt='NEW') {
</form>
<script src="https://unpkg.com/tinymce@5.6.1/tinymce.min.js"></script>
<script>document.getElementById('page_form').style.display = 'none';</script>
<?php tinymce_setup('page', $file); ?>
<?php tinymce_setup('page', $file, $relroot); ?>
<article id="entries_menu">
<a href="<?php echo CIGALA_PHP,'?entry=',$file; ?>:NEW">new entry</a>
</article>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment