diff --git a/Core/Settings.cs b/Core/Settings.cs
index b5383d6..42757b5 100644
--- a/Core/Settings.cs
+++ b/Core/Settings.cs
@@ -67,9 +67,9 @@ namespace ScrewTurn.Wiki {
}
}
- ///
- /// Gets direction of the application
- ///
+ ///
+ /// Gets direction of the application
+ ///
public static string Direction {
get {
if(Tools.IsRightToLeftCulture()) return "rtl";
@@ -605,6 +605,24 @@ namespace ScrewTurn.Wiki {
}
}
+ ///
+ /// Gets the main URL of the wiki, defaulting to the current request URL if none is configured manually.
+ ///
+ /// The URL of the wiki.
+ public static Uri GetMainUrl() {
+ Uri mainUrl = new Uri(MainUrl);
+ if(mainUrl.Host == "www.server.com") {
+ try {
+ // STW never uses internal URLs with slashes, so trimming to the last slash should work
+ // Example: http://server/wiki/namespace.page.ashx
+ string temp = HttpContext.Current.Request.Url.ToString();
+ mainUrl = new Uri(temp.Substring(0, temp.LastIndexOf("/") + 1));
+ }
+ catch { }
+ }
+ return mainUrl;
+ }
+
///
/// Gets the correct path to use with Cookies.
///
@@ -875,20 +893,17 @@ namespace ScrewTurn.Wiki {
}
}
- ///
- /// Gets or sets the IP/Host filter for page editing.
- ///
- public static string IpHostFilter
- {
- get{
-
- return Provider.GetSetting("IpHostFilter");
- }
- set
- {
- Provider.SetSetting("IpHostFilter", value);
- }
- }
+ ///
+ /// Gets or sets the IP/Host filter for page editing.
+ ///
+ public static string IpHostFilter {
+ get {
+ return GetString(Provider.GetSetting("IpHostFilter"), "");
+ }
+ set {
+ Provider.SetSetting("IpHostFilter", value);
+ }
+ }
///
/// Gets or sets the max number of recent changes to log.