Fixed #523: transclusion anti-loop is disabled for non-page-content formatting.
This commit is contained in:
parent
1810a46c46
commit
e2e0d334eb
2 changed files with 15 additions and 8 deletions
|
@ -2470,20 +2470,27 @@ namespace ScrewTurn.Wiki {
|
|||
pageName = NameTools.GetFullName(currentNamespace, pageName);
|
||||
}
|
||||
}
|
||||
PageInfo info = Pages.FindPage(pageName);
|
||||
PageInfo transcludedPage = Pages.FindPage(pageName);
|
||||
|
||||
if(info != null && (current != null && info.FullName != current.FullName)) { // Avoid circular transclusion!
|
||||
// Avoid circular transclusion
|
||||
bool transclusionAllowed =
|
||||
transcludedPage != null &&
|
||||
(current != null &&
|
||||
transcludedPage.FullName != current.FullName ||
|
||||
context != FormattingContext.PageContent && context != FormattingContext.TranscludedPageContent);
|
||||
|
||||
if(transclusionAllowed) {
|
||||
string currentUsername = SessionFacade.GetCurrentUsername();
|
||||
string[] currentGroups = SessionFacade.GetCurrentGroupNames();
|
||||
|
||||
bool canView = AuthChecker.CheckActionForPage(info, Actions.ForPages.ReadPage, currentUsername, currentGroups);
|
||||
bool canView = AuthChecker.CheckActionForPage(transcludedPage, Actions.ForPages.ReadPage, currentUsername, currentGroups);
|
||||
if(canView) {
|
||||
dummy = new StringBuilder();
|
||||
dummy.Append(@"<div class=""transcludedpage"">");
|
||||
dummy.Append(FormattingPipeline.FormatWithPhase3(
|
||||
FormattingPipeline.FormatWithPhase1And2(Content.GetPageContent(info, true).Content,
|
||||
false, FormattingContext.TranscludedPageContent, info),
|
||||
FormattingContext.TranscludedPageContent, info));
|
||||
FormattingPipeline.FormatWithPhase1And2(Content.GetPageContent(transcludedPage, true).Content,
|
||||
false, FormattingContext.TranscludedPageContent, transcludedPage),
|
||||
FormattingContext.TranscludedPageContent, transcludedPage));
|
||||
dummy.Append("</div>");
|
||||
sb.Insert(match.Index, dummy.ToString());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue