修改CommunityServer的头尾
修改CommunityServer的尾部信息,如下图片所示。
代码文件位置
CommunityServerControls/Utility/Footer.cs
下面列出了代码,原理很简单。
Footer.cs类从WebControl类继承,private bool IsLicensed()方法返回是否经过Licensed。
protected override void Render(HtmlTextWriter writer)方法对控件的呈观方法进行重写,已达到自定义输入信息的目的。
1
//------------------------------------------------------------------------------
2
// <copyright company="Telligent Systems">
3
// Copyright (c) Telligent Systems Corporation. All rights reserved.
4
// </copyright>
5
//------------------------------------------------------------------------------
6![](/Images/OutliningIndicators/None.gif)
7
using System;
8
using System.Web.Caching;
9
using System.Web.UI;
10
using System.Web.UI.WebControls;
11
using CommunityServer.Components;
12![](/Images/OutliningIndicators/None.gif)
13
namespace CommunityServer.Controls
14
{
15
public class Footer : WebControl
16
{
17
private bool IsLicensed()
18
{
19
object obj= CSCache.Get("LicenseValidator");
20![](/Images/OutliningIndicators/InBlock.gif)
21
if(obj == null)
22
{
23
bool isValid = false;
24
string path = CSContext.Current.MapPath(Globals.ApplicationPath + "/bin/license.xml");
25![](/Images/OutliningIndicators/InBlock.gif)
26
try
27
{
28
Type t = Type.GetType("Telligent.CommunityServer.Registration.LicenseValidator, Telligent.CommunityServer.Registration");
29![](/Images/OutliningIndicators/InBlock.gif)
30
if(t != null)
31
{
32
try
33
{
34
Activator.CreateInstance(t, new object[]{path});
35
isValid = true;
36
}
37
catch { } // nothing to do
38
}
39
}
40
catch { }
41![](/Images/OutliningIndicators/InBlock.gif)
42
CSCache.Max("LicenseValidator", isValid, new CacheDependency(path));
43
return isValid;
44
}
45
else
46
return (bool)obj;
47
}
48![](/Images/OutliningIndicators/InBlock.gif)
49
protected override void Render(HtmlTextWriter writer)
50
{
51
writer.WriteLine("<div class=\"copyright\">" + CSContext.Current.SiteSettings.Copyright + "</div>");
52![](/Images/OutliningIndicators/InBlock.gif)
53
if(!IsLicensed())
54
{
55
// Removal of copywrite is available also with support options at
56
// http://www.telligentsystems.com/Solutions/Forums/
57
//
58
writer.Write("<p align=\"center\" class=\"txt4\">");
59
writer.Write( "<a target=\"_blank\" href=\"http://www.communityserver.org/\"><img alt=\"" + string.Format(ResourceManager.GetString("Footer_PoweredBy"), "Community Server") + "\" border=\"0\" src=\"" + Globals.ApplicationPath + "/utility/CSEULA.GIF" + "\"></a>");
60
writer.Write( " <a target=\"_blank\" href=\"http://www.communityserver.cn/\"><img alt=\"" + string.Format(ResourceManager.GetString("Footer_PoweredBy"), "CnForums.Net") + "\" border=\"0\" src=\"" + Globals.ApplicationPath + "/utility/EULA.GIF" + "\"></a>");
61
writer.Write( "<a href=\"mailto:" + CSContext.Current.SiteSettings.AdminEmailAddress + "\">" + ResourceManager.GetString("Footer_QuestionsProblems") + "</a> | <a href=\"" + Globals.GetSiteUrls().TermsOfUse +"\">" + ResourceManager.GetString("Footer_TermsOfUse") + "</a>");
62
writer.Write("</p>");
63
}
64
}
65
}
66
}
![](/Images/OutliningIndicators/None.gif)
2
![](/Images/OutliningIndicators/None.gif)
3
![](/Images/OutliningIndicators/None.gif)
4
![](/Images/OutliningIndicators/None.gif)
5
![](/Images/OutliningIndicators/None.gif)
6
![](/Images/OutliningIndicators/None.gif)
7
![](/Images/OutliningIndicators/None.gif)
8
![](/Images/OutliningIndicators/None.gif)
9
![](/Images/OutliningIndicators/None.gif)
10
![](/Images/OutliningIndicators/None.gif)
11
![](/Images/OutliningIndicators/None.gif)
12
![](/Images/OutliningIndicators/None.gif)
13
![](/Images/OutliningIndicators/None.gif)
14
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
15
![](/Images/OutliningIndicators/InBlock.gif)
16
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
17
![](/Images/OutliningIndicators/InBlock.gif)
18
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
19
![](/Images/OutliningIndicators/InBlock.gif)
20
![](/Images/OutliningIndicators/InBlock.gif)
21
![](/Images/OutliningIndicators/InBlock.gif)
22
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
23
![](/Images/OutliningIndicators/InBlock.gif)
24
![](/Images/OutliningIndicators/InBlock.gif)
25
![](/Images/OutliningIndicators/InBlock.gif)
26
![](/Images/OutliningIndicators/InBlock.gif)
27
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
28
![](/Images/OutliningIndicators/InBlock.gif)
29
![](/Images/OutliningIndicators/InBlock.gif)
30
![](/Images/OutliningIndicators/InBlock.gif)
31
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
32
![](/Images/OutliningIndicators/InBlock.gif)
33
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
34
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
35
![](/Images/OutliningIndicators/InBlock.gif)
36
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
37
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
38
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
39
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
40
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
41
![](/Images/OutliningIndicators/InBlock.gif)
42
![](/Images/OutliningIndicators/InBlock.gif)
43
![](/Images/OutliningIndicators/InBlock.gif)
44
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
45
![](/Images/OutliningIndicators/InBlock.gif)
46
![](/Images/OutliningIndicators/InBlock.gif)
47
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
48
![](/Images/OutliningIndicators/InBlock.gif)
49
![](/Images/OutliningIndicators/InBlock.gif)
50
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
51
![](/Images/OutliningIndicators/InBlock.gif)
52
![](/Images/OutliningIndicators/InBlock.gif)
53
![](/Images/OutliningIndicators/InBlock.gif)
54
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
55
![](/Images/OutliningIndicators/InBlock.gif)
56
![](/Images/OutliningIndicators/InBlock.gif)
57
![](/Images/OutliningIndicators/InBlock.gif)
58
![](/Images/OutliningIndicators/InBlock.gif)
59
![](/Images/OutliningIndicators/InBlock.gif)
60
![](/Images/OutliningIndicators/InBlock.gif)
61
![](/Images/OutliningIndicators/InBlock.gif)
62
![](/Images/OutliningIndicators/InBlock.gif)
63
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
64
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
65
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
66
![](/Images/OutliningIndicators/ExpandedBlockEnd.gif)
在修改Footer.cs文件时,请尽量保留原软件的版权信息。