Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Pablo Rauzy
cigala
Commits
ed7a577b
Commit
ed7a577b
authored
Apr 26, 2022
by
Pablo Rauzy
Browse files
fix relative path bug + force absolute url for rss feed contents
parent
b12c8a2e
Changes
1
Hide whitespace changes
Inline
Side-by-side
root/cigala.php
View file @
ed7a577b
...
...
@@ -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>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment