@@ -531,7 +531,7 @@ private void PrepareReply()
531
531
this . ctlForm . EditorMode = Modules . ActiveForums . Controls . SubmitForm . EditorModes . Reply ;
532
532
533
533
string template = TemplateCache . GetCachedTemplate ( this . ForumModuleId , "ReplyEditor" , this . ForumInfo . FeatureSettings . ReplyFormId ) ;
534
-
534
+
535
535
#region "Backward compatilbility -- remove in v10.00.00"
536
536
template = DotNetNuke . Modules . ActiveForums . Services . Tokens . TokenReplacer . MapLegacyAuthorTokenSynonyms ( new StringBuilder ( template ) , this . PortalSettings , this . MainSettings , this . ForumUser . UserInfo ? . Profile ? . PreferredLocale ) . ToString ( ) ;
537
537
template = DotNetNuke . Modules . ActiveForums . Services . Tokens . TokenReplacer . MapLegacyPostTokenSynonyms ( new StringBuilder ( template ) , this . PortalSettings , this . ForumUser . UserInfo ? . Profile ? . PreferredLocale ) . ToString ( ) ;
@@ -585,7 +585,6 @@ private void PrepareReply()
585
585
// Setup form for Quote or Reply with body display
586
586
var isQuote = false ;
587
587
var postId = 0 ;
588
- var sPostedBy = Utilities . GetSharedResource ( "[RESX:PostedBy]" ) + " {0} {1} {2}" ;
589
588
if ( this . Request . Params [ ParamKeys . QuoteId ] != null )
590
589
{
591
590
isQuote = true ;
@@ -611,71 +610,62 @@ private void PrepareReply()
611
610
612
611
if ( postId != 0 )
613
612
{
614
- var userDisplay = this . MainSettings . UserNameDisplay ;
615
- if ( this . editorType == EditorTypes . TEXTBOX )
616
- {
617
- userDisplay = "none" ;
618
- }
619
-
620
- DotNetNuke . Modules . ActiveForums . Entities . ContentInfo ci ;
621
- if ( postId == TopicId )
622
- {
623
- ci = ti . Content ;
624
- }
625
- else
626
- {
627
- var ri = new DotNetNuke . Modules . ActiveForums . Controllers . ReplyController ( this . ForumModuleId ) . GetById ( postId ) ;
628
- ci = ri . Content ;
629
- }
630
-
631
- if ( ci != null )
632
- {
633
- body = ci . Body ;
634
- }
635
-
636
613
var post = postId == this . TopicId ? ti : ( DotNetNuke . Modules . ActiveForums . Entities . IPostInfo ) new DotNetNuke . Modules . ActiveForums . Controllers . ReplyController ( this . ForumModuleId ) . GetById ( postId ) ;
637
- sPostedBy = string . Format ( sPostedBy , DotNetNuke . Modules . ActiveForums . Controllers . ForumUserController . GetDisplayName ( this . PortalSettings , this . MainSettings , false , false , post . Author . AuthorId , post . Author . Username , post . Author . FirstName , post . Author . LastName , post . Author . DisplayName ) , Utilities . GetSharedResource ( "On.Text" ) , Utilities . GetUserFormattedDateTime ( post . Content . DateCreated , this . PortalId , this . UserId ) ) ;
638
- }
639
-
640
- if ( this . allowHTML && this . editorType != EditorTypes . TEXTBOX )
641
- {
642
- if ( body . ToUpper ( ) . Contains ( "<CODE" ) | body . ToUpper ( ) . Contains ( "[CODE]" ) )
614
+ if ( post != null )
643
615
{
644
- var objCode = new CodeParser ( ) ;
645
- body = CodeParser . ParseCode ( System . Net . WebUtility . HtmlDecode ( body ) ) ;
646
- }
647
- }
648
- else
649
- {
650
- body = Utilities . PrepareForEdit ( this . PortalId , this . ForumModuleId , this . ImagePath , body , this . allowHTML , this . editorType ) ;
651
- }
652
-
653
- if ( isQuote )
654
- {
655
- this . ctlForm . EditorMode = SubmitForm . EditorModes . Quote ;
656
- if ( this . allowHTML && this . editorType != EditorTypes . TEXTBOX )
657
- {
658
- body = "<blockquote>" + System . Environment . NewLine + sPostedBy + System . Environment . NewLine + "<br />" + System . Environment . NewLine + body + System . Environment . NewLine + "</blockquote><br /><br />" ;
616
+ var sPostedBy = Utilities . GetSharedResource ( "[RESX:PostedBy]" ) + " {0} {1} {2}" ;
617
+ sPostedBy = string . Format ( sPostedBy , DotNetNuke . Modules . ActiveForums . Controllers . ForumUserController . GetDisplayName ( this . PortalSettings , this . MainSettings , false , false , post . Author . AuthorId , post . Author . Username , post . Author . FirstName , post . Author . LastName , post . Author . DisplayName ) , Utilities . GetSharedResource ( "On.Text" ) , Utilities . GetUserFormattedDateTime ( post . Content . DateCreated , this . PortalId , this . UserId ) ) ;
618
+ body = post . Content . Body ;
619
+ if ( this . allowHTML && this . editorType != EditorTypes . TEXTBOX )
620
+ {
621
+ if ( body . ToUpperInvariant ( ) . Contains ( "<CODE" ) || body . ToUpperInvariant ( ) . Contains ( "[CODE]" ) )
622
+ {
623
+ body = CodeParser . ParseCode ( System . Net . WebUtility . HtmlDecode ( body ) ) ;
624
+ }
625
+ }
626
+ else
627
+ {
628
+ body = Utilities . PrepareForEdit ( this . PortalId , this . ForumModuleId , this . ImagePath , body , this . allowHTML , this . editorType ) ;
629
+ }
630
+
631
+ if ( isQuote )
632
+ {
633
+ this . ctlForm . EditorMode = SubmitForm . EditorModes . Quote ;
634
+ if ( this . allowHTML && this . editorType != EditorTypes . TEXTBOX )
635
+ {
636
+ body = "<blockquote>" + System . Environment . NewLine + sPostedBy + System . Environment . NewLine + "<br />" + System . Environment . NewLine + body + System . Environment . NewLine + "</blockquote><br /><br />" ;
637
+ }
638
+ else
639
+ {
640
+ body = "[quote]" + System . Environment . NewLine + sPostedBy + System . Environment . NewLine + body + System . Environment . NewLine + "[/quote]" + System . Environment . NewLine ;
641
+ }
642
+ }
643
+ else
644
+ {
645
+ this . ctlForm . EditorMode = SubmitForm . EditorModes . ReplyWithBody ;
646
+ body = sPostedBy + "<br />" + body ;
647
+ }
648
+
649
+ this . ctlForm . Body = body ;
650
+
651
+ if ( this . ctlForm . EditorMode != SubmitForm . EditorModes . EditReply && this . canModApprove )
652
+ {
653
+ this . ctlForm . ShowModOptions = false ;
654
+ }
659
655
}
660
656
else
661
657
{
662
- body = "[quote]" + System . Environment . NewLine + sPostedBy + System . Environment . NewLine + body + System . Environment . NewLine + "[/quote]" + System . Environment . NewLine ;
658
+ var im = new InfoMessage { Message = this . GetSharedResource ( "[RESX:Message:LoadTopicFailed]" ) } ;
659
+ this . plhContent . Controls . Add ( im ) ;
663
660
}
664
661
}
665
662
else
666
663
{
667
- this . ctlForm . EditorMode = SubmitForm . EditorModes . ReplyWithBody ;
668
- body = sPostedBy + "<br />" + body ;
664
+ var im = new InfoMessage { Message = this . GetSharedResource ( "[RESX:Message:LoadTopicFailed]" ) } ;
665
+ this . plhContent . Controls . Add ( im ) ;
669
666
}
670
-
671
- this . ctlForm . Body = body ;
672
667
}
673
668
}
674
-
675
- if ( this . ctlForm . EditorMode != SubmitForm . EditorModes . EditReply && this . canModApprove )
676
- {
677
- this . ctlForm . ShowModOptions = false ;
678
- }
679
669
}
680
670
681
671
private void SaveTopic ( )
0 commit comments