@@ -334,48 +334,47 @@ internal void Install_Or_Upgrade_MoveTemplates_080000()
334
334
if ( ! System . IO . Directory . Exists ( themeFolder . FullName + "/templates" ) )
335
335
{
336
336
System . IO . Directory . CreateDirectory ( themeFolder . FullName + "/templates" ) ;
337
- }
338
- }
339
-
340
- TemplateController tc = new TemplateController ( ) ;
341
- foreach ( TemplateInfo templateInfo in tc . Template_List ( - 1 , - 1 ) )
342
- {
343
- /* during upgrade, explicitly (re-)load template text from database rather than Template_List API since API loads template using fallback/default logic and doesn't yet have the upgraded template text */
344
- /* if installing version 8.2 or greater, only convert these specific templates */
345
- if ( ( new Version ( DesktopModuleController . GetDesktopModuleByFriendlyName ( Globals . ModuleFriendlyName ) . Version ) < new Version ( 8 , 2 ) ) ||
346
- ( ( templateInfo . TemplateType == Templates . TemplateTypes . ForumView ) ||
347
- ( templateInfo . TemplateType == Templates . TemplateTypes . TopicView ) ||
348
- ( templateInfo . TemplateType == Templates . TemplateTypes . TopicsView ) ||
349
- ( templateInfo . TemplateType == Templates . TemplateTypes . TopicForm ) ||
350
- ( templateInfo . TemplateType == Templates . TemplateTypes . Profile ) ||
351
- ( templateInfo . TemplateType == Templates . TemplateTypes . PostInfo ) ||
352
- ( templateInfo . TemplateType == Templates . TemplateTypes . QuickReplyForm ) ) )
353
- {
354
- IDataReader dr = DataProvider . Instance ( ) . Templates_Get ( templateInfo . TemplateId , templateInfo . PortalId , templateInfo . ModuleId ) ;
355
- while ( dr . Read ( ) )
337
+ TemplateController tc = new TemplateController ( ) ;
338
+ foreach ( TemplateInfo templateInfo in tc . Template_List ( - 1 , - 1 ) )
356
339
{
357
- try
340
+ /* during upgrade, explicitly (re-)load template text from database rather than Template_List API since API loads template using fallback/default logic and doesn't yet have the upgraded template text */
341
+ /* if installing version 8.2 or greater, only convert these specific templates */
342
+ if ( ( Globals . ModuleVersion < new Version ( 8 , 2 ) ) ||
343
+ ( ( templateInfo . TemplateType == Templates . TemplateTypes . ForumView ) ||
344
+ ( templateInfo . TemplateType == Templates . TemplateTypes . TopicView ) ||
345
+ ( templateInfo . TemplateType == Templates . TemplateTypes . TopicsView ) ||
346
+ ( templateInfo . TemplateType == Templates . TemplateTypes . TopicForm ) ||
347
+ ( templateInfo . TemplateType == Templates . TemplateTypes . Profile ) ||
348
+ ( templateInfo . TemplateType == Templates . TemplateTypes . PostInfo ) ||
349
+ ( templateInfo . TemplateType == Templates . TemplateTypes . QuickReplyForm ) ) )
358
350
{
359
- /* convert only legacy html portion of the template and save without encoding */
360
- string template = Convert . ToString ( dr [ "Template" ] ) . Replace ( "[TRESX:" , "[RESX:" ) ;
361
- if ( template . Contains ( "<html>" ) )
351
+ IDataReader dr = DataProvider . Instance ( ) . Templates_Get ( templateInfo . TemplateId , templateInfo . PortalId , templateInfo . ModuleId ) ;
352
+ while ( dr . Read ( ) )
362
353
{
363
- string sHTML ;
364
- var xDoc = new System . Xml . XmlDocument ( ) ;
365
- xDoc . LoadXml ( template ) ;
366
- System . Xml . XmlNode xNode ;
367
- System . Xml . XmlNode xRoot = xDoc . DocumentElement ;
368
- xNode = xRoot . SelectSingleNode ( "/template/html" ) ;
369
- sHTML = xNode . InnerText ;
370
- template = sHTML ;
354
+ try
355
+ {
356
+ /* convert only legacy html portion of the template and save without encoding */
357
+ string template = Convert . ToString ( dr [ "Template" ] ) . Replace ( "[TRESX:" , "[RESX:" ) ;
358
+ if ( template . Contains ( "<html>" ) )
359
+ {
360
+ string sHTML ;
361
+ var xDoc = new System . Xml . XmlDocument ( ) ;
362
+ xDoc . LoadXml ( template ) ;
363
+ System . Xml . XmlNode xNode ;
364
+ System . Xml . XmlNode xRoot = xDoc . DocumentElement ;
365
+ xNode = xRoot . SelectSingleNode ( "/template/html" ) ;
366
+ sHTML = xNode . InnerText ;
367
+ template = sHTML ;
368
+ }
369
+
370
+ templateInfo . Template = System . Net . WebUtility . HtmlDecode ( template ) ;
371
+ tc . Template_Save ( templateInfo ) ;
372
+ }
373
+ catch ( Exception ex )
374
+ {
375
+ DotNetNuke . Services . Exceptions . Exceptions . LogException ( ex ) ;
376
+ }
371
377
}
372
-
373
- templateInfo . Template = System . Net . WebUtility . HtmlDecode ( template ) ;
374
- tc . Template_Save ( templateInfo ) ;
375
- }
376
- catch ( Exception ex )
377
- {
378
- DotNetNuke . Services . Exceptions . Exceptions . LogException ( ex ) ;
379
378
}
380
379
}
381
380
}
0 commit comments