diff --git a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj
index b92e7c2e3e..fe9be6c73e 100644
--- a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj
+++ b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj
@@ -39,6 +39,7 @@
4.0
v4.0
+ true
bin\
@@ -1789,7 +1790,16 @@ xcopy "$(ProjectDir)"..\..\lib\SQLCE4\x86\*.* "$(TargetDir)x86\" /Y /F /E /D
- True
+ True
+ True
+ 61637
+ /
+ http://localhost:61637/
+ False
+ False
+
+
+ False
diff --git a/src/Umbraco.Web/umbraco.presentation/install/default.aspx.cs b/src/Umbraco.Web/umbraco.presentation/install/default.aspx.cs
index fc40dedc01..760c6a3400 100644
--- a/src/Umbraco.Web/umbraco.presentation/install/default.aspx.cs
+++ b/src/Umbraco.Web/umbraco.presentation/install/default.aspx.cs
@@ -15,57 +15,61 @@ using System.Collections.Generic;
namespace umbraco.presentation.install
{
- ///
- /// Summary description for _default.
- ///
- public partial class _default : BasePages.BasePage
- {
+ ///
+ /// Summary description for _default.
+ ///
+ public partial class _default : BasePages.BasePage
+ {
- private string _installStep = "";
+ private string _installStep = "";
public string currentStepClass = "";
- protected void Page_Load(object sender, System.EventArgs e)
- {
- // use buffer, so content isn't sent until it's ready (minimizing the blank screen experience)
- //Response.Buffer = true;
- rp_steps.DataSource = InstallerSteps().Values;
- rp_steps.DataBind();
- }
+ protected void Page_Load(object sender, System.EventArgs e)
+ {
+ // use buffer, so content isn't sent until it's ready (minimizing the blank screen experience)
+ //Response.Buffer = true;
+ rp_steps.DataSource = InstallerSteps().Values;
+ rp_steps.DataBind();
+ }
-
- private void loadContent(InstallerStep currentStep)
- {
- PlaceHolderStep.Controls.Clear();
- PlaceHolderStep.Controls.Add(new System.Web.UI.UserControl().LoadControl(IOHelper.ResolveUrl( currentStep.UserControl ) ));
- step.Value = currentStep.Alias;
+
+ private void loadContent(InstallerStep currentStep)
+ {
+ PlaceHolderStep.Controls.Clear();
+ PlaceHolderStep.Controls.Add(new System.Web.UI.UserControl().LoadControl(IOHelper.ResolveUrl(currentStep.UserControl)));
+ step.Value = currentStep.Alias;
currentStepClass = currentStep.Alias;
- }
+ }
- int stepCounter = 0;
- protected void bindStep(object sender, RepeaterItemEventArgs e) {
+ int stepCounter = 0;
+ protected void bindStep(object sender, RepeaterItemEventArgs e)
+ {
- if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item) {
- InstallerStep i = (InstallerStep)e.Item.DataItem;
+ if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
+ {
+ InstallerStep i = (InstallerStep)e.Item.DataItem;
- if (!i.HideFromNavigation) {
- Literal _class = (Literal)e.Item.FindControl("lt_class");
- Literal _name = (Literal)e.Item.FindControl("lt_name");
+ if (!i.HideFromNavigation)
+ {
+ Literal _class = (Literal)e.Item.FindControl("lt_class");
+ Literal _name = (Literal)e.Item.FindControl("lt_name");
- if (i.Alias == currentStepClass)
- _class.Text = "active";
+ if (i.Alias == currentStepClass)
+ _class.Text = "active";
+
+ stepCounter++;
+ _name.Text = (stepCounter).ToString() + " - " + i.Name;
+ }
+ else
+ e.Item.Visible = false;
+ }
+ }
- stepCounter++;
- _name.Text = (stepCounter).ToString() + " - " + i.Name;
- } else
- e.Item.Visible = false;
- }
- }
-
public void GotoNextStep(string currentStep)
{
- InstallerStep _s = InstallerSteps().GotoNextStep(currentStep);
- Response.Redirect("?installStep=" + _s.Alias);
+ InstallerStep _s = InstallerSteps().GotoNextStep(currentStep);
+ Response.Redirect("?installStep=" + _s.Alias);
}
public void GotoLastStep()
@@ -75,62 +79,70 @@ namespace umbraco.presentation.install
}
- #region Web Form Designer generated code
- override protected void OnInit(EventArgs e)
- {
- InitializeComponent();
- base.OnInit(e);
+ #region Web Form Designer generated code
+ override protected void OnInit(EventArgs e)
+ {
+ InitializeComponent();
+ base.OnInit(e);
_installStep = helper.Request("installStep");
InstallerStep _s;
//if this is not an upgrade we will log in with the default user.
- if (!String.IsNullOrEmpty(GlobalSettings.ConfigurationStatus.Trim())) {
- try {
- ensureContext();
- } catch {
- Response.Redirect(SystemDirectories.Umbraco + "/logout.aspx?redir=" + Server.UrlEncode(Request.RawUrl));
- }
+ if (!String.IsNullOrEmpty(GlobalSettings.ConfigurationStatus.Trim()))
+ {
+ try
+ {
+ ensureContext();
+ }
+ catch (InvalidOperationException ex)
+ {
- //set the first step to upgrade.
- // if (string.IsNullOrEmpty(_installStep))
- // _installStep = "upgrade";
- }
+ }
+ catch (Exception)
+ {
+ Response.Redirect(SystemDirectories.Umbraco + "/logout.aspx?redir=" + Server.UrlEncode(Request.RawUrl));
+ }
+
+ //set the first step to upgrade.
+ // if (string.IsNullOrEmpty(_installStep))
+ // _installStep = "upgrade";
+ }
if (string.IsNullOrEmpty(_installStep))
_s = InstallerSteps()["welcome"];
else
_s = InstallerSteps()[_installStep];
- loadContent(_s);
- }
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
+ loadContent(_s);
+ }
- }
- #endregion
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
-
+ }
+ #endregion
- private static InstallerStepCollection InstallerSteps()
- {
- InstallerStepCollection ics = new InstallerStepCollection();
- ics.Add(new install.steps.Definitions.Welcome());
+
+
+ private static InstallerStepCollection InstallerSteps()
+ {
+ InstallerStepCollection ics = new InstallerStepCollection();
+ ics.Add(new install.steps.Definitions.Welcome());
ics.Add(new install.steps.Definitions.License());
- ics.Add(new install.steps.Definitions.FilePermissions());
- ics.Add(new install.steps.Definitions.Database());
+ ics.Add(new install.steps.Definitions.FilePermissions());
+ ics.Add(new install.steps.Definitions.Database());
ics.Add(new install.steps.Definitions.DefaultUser());
- ics.Add( new install.steps.Definitions.Skinning() );
+ ics.Add(new install.steps.Definitions.Skinning());
ics.Add(new install.steps.Definitions.WebPi());
ics.Add(new install.steps.Definitions.TheEnd());
- return ics;
- }
+ return ics;
+ }
-
- }
+
+ }
}
diff --git a/src/umbraco.businesslogic/BasePages/BasePage.cs b/src/umbraco.businesslogic/BasePages/BasePage.cs
index c5eb2ce75d..a50c7a9aeb 100644
--- a/src/umbraco.businesslogic/BasePages/BasePage.cs
+++ b/src/umbraco.businesslogic/BasePages/BasePage.cs
@@ -7,21 +7,23 @@ using umbraco.DataLayer;
using umbraco.IO;
using System.Web.UI;
-namespace umbraco.BasePages {
+namespace umbraco.BasePages
+{
///
/// umbraco.BasePages.BasePage is the default page type for the umbraco backend.
/// The basepage keeps track of the current user and the page context. But does not
/// Restrict access to the page itself.
/// The keep the page secure, the umbracoEnsuredPage class should be used instead
///
- public class BasePage : System.Web.UI.Page {
+ public class BasePage : System.Web.UI.Page
+ {
private User _user;
private bool _userisValidated = false;
- private ClientTools m_clientTools;
+ private ClientTools _clientTools;
// ticks per minute 600,000,000
- private static long _ticksPrMinute = 600000000;
- private static int _umbracoTimeOutInMinutes = GlobalSettings.TimeOutInMinutes;
+ private const long TicksPrMinute = 600000000;
+ private static readonly int UmbracoTimeOutInMinutes = GlobalSettings.TimeOutInMinutes;
///
/// The path to the umbraco root folder
@@ -42,71 +44,82 @@ namespace umbraco.BasePages {
/// Gets the SQL helper.
///
/// The SQL helper.
- protected static ISqlHelper SqlHelper {
+ protected static ISqlHelper SqlHelper
+ {
get { return umbraco.BusinessLogic.Application.SqlHelper; }
}
///
/// Initializes a new instance of the class.
///
- public BasePage() {
+ public BasePage()
+ {
}
- ///
- /// Returns the current BasePage for the current request.
- /// This assumes that the current page is a BasePage, otherwise, returns null;
- ///
- public static BasePage Current
- {
- get
- {
- return HttpContext.Current.CurrentHandler as BasePage;
- }
- }
-
- ///
- /// Returns a refernce of an instance of ClientTools for access to the pages client API
- ///
- public ClientTools ClientTools
- {
- get
- {
- if (m_clientTools == null)
- m_clientTools = new ClientTools(this);
- return m_clientTools;
- }
- }
-
- [Obsolete("Use ClientTools instead")]
- public void RefreshPage(int Seconds)
- {
- ClientTools.RefreshAdmin(Seconds);
+ ///
+ /// Returns the current BasePage for the current request.
+ /// This assumes that the current page is a BasePage, otherwise, returns null;
+ ///
+ public static BasePage Current
+ {
+ get
+ {
+ return HttpContext.Current.CurrentHandler as BasePage;
+ }
}
- private void validateUser() {
- if ((umbracoUserContextID != "")) {
+ ///
+ /// Returns a refernce of an instance of ClientTools for access to the pages client API
+ ///
+ public ClientTools ClientTools
+ {
+ get
+ {
+ if (_clientTools == null)
+ _clientTools = new ClientTools(this);
+ return _clientTools;
+ }
+ }
+
+ [Obsolete("Use ClientTools instead")]
+ public void RefreshPage(int Seconds)
+ {
+ ClientTools.RefreshAdmin(Seconds);
+ }
+
+ private void ValidateUser()
+ {
+ if ((umbracoUserContextID != ""))
+ {
uid = GetUserId(umbracoUserContextID);
timeout = GetTimeout(umbracoUserContextID);
- if (timeout > DateTime.Now.Ticks) {
+ if (timeout > DateTime.Now.Ticks)
+ {
_user = BusinessLogic.User.GetUser(uid);
// Check for console access
if (_user.Disabled || (_user.NoConsole && GlobalSettings.RequestIsInUmbracoApplication(HttpContext.Current) && !GlobalSettings.RequestIsLiveEditRedirector(HttpContext.Current)))
{
throw new ArgumentException("You have no priviledges to the umbraco console. Please contact your administrator");
- }
+ }
else
{
_userisValidated = true;
- updateLogin();
+ UpdateLogin();
}
- } else {
+ }
+ else
+ {
throw new ArgumentException("User has timed out!!");
}
- } else
- throw new ArgumentException("The user has no umbraco contextid - try logging in");
+ }
+ else
+ {
+ throw new InvalidOperationException("The user has no umbraco contextid - try logging in");
+ }
+
}
///
@@ -114,24 +127,29 @@ namespace umbraco.BasePages {
///
/// The umbraco user context ID.
///
- public static int GetUserId(string umbracoUserContextID) {
- try {
- if (System.Web.HttpRuntime.Cache["UmbracoUserContext" + umbracoUserContextID] == null) {
+ public static int GetUserId(string umbracoUserContextID)
+ {
+ try
+ {
+ if (System.Web.HttpRuntime.Cache["UmbracoUserContext" + umbracoUserContextID] == null)
+ {
System.Web.HttpRuntime.Cache.Insert(
"UmbracoUserContext" + umbracoUserContextID,
SqlHelper.ExecuteScalar("select userID from umbracoUserLogins where contextID = @contextId",
- SqlHelper.CreateParameter("@contextId", new Guid(umbracoUserContextID))
- ),
+ SqlHelper.CreateParameter("@contextId", new Guid(umbracoUserContextID))
+ ),
null,
System.Web.Caching.Cache.NoAbsoluteExpiration,
- new TimeSpan(0, (int)(_umbracoTimeOutInMinutes / 10), 0));
+ new TimeSpan(0, (int) (UmbracoTimeOutInMinutes/10), 0));
}
return (int)System.Web.HttpRuntime.Cache["UmbracoUserContext" + umbracoUserContextID];
- } catch {
+ }
+ catch
+ {
return -1;
}
}
@@ -143,7 +161,8 @@ namespace umbraco.BasePages {
///
/// The umbraco user context ID.
///
- public static bool ValidateUserContextID(string currentUmbracoUserContextID) {
+ public static bool ValidateUserContextID(string currentUmbracoUserContextID)
+ {
if ((currentUmbracoUserContextID != ""))
{
int uid = GetUserId(currentUmbracoUserContextID);
@@ -153,26 +172,28 @@ namespace umbraco.BasePages {
{
return true;
}
-
+
BusinessLogic.Log.Add(BusinessLogic.LogTypes.Logout, BusinessLogic.User.GetUser(uid), -1, "");
}
return false;
}
- private static long GetTimeout(string umbracoUserContextID) {
- if (System.Web.HttpRuntime.Cache["UmbracoUserContextTimeout" + umbracoUserContextID] == null) {
+ private static long GetTimeout(string umbracoUserContextID)
+ {
+ if (System.Web.HttpRuntime.Cache["UmbracoUserContextTimeout" + umbracoUserContextID] == null)
+ {
System.Web.HttpRuntime.Cache.Insert(
"UmbracoUserContextTimeout" + umbracoUserContextID,
GetTimeout(true),
null,
- DateTime.Now.AddMinutes(_umbracoTimeOutInMinutes / 10), System.Web.Caching.Cache.NoSlidingExpiration);
+ DateTime.Now.AddMinutes(UmbracoTimeOutInMinutes / 10), System.Web.Caching.Cache.NoSlidingExpiration);
}
object timeout = HttpRuntime.Cache["UmbracoUserContextTimeout" + umbracoUserContextID];
- if(timeout != null)
- return (long) timeout;
+ if (timeout != null)
+ return (long)timeout;
return 0;
@@ -198,25 +219,27 @@ namespace umbraco.BasePages {
/// Gets or sets the umbraco user context ID.
///
/// The umbraco user context ID.
- public static string umbracoUserContextID {
+ public static string umbracoUserContextID
+ {
get
{
- // zb-00004 #29956 : refactor cookies names & handling
- if (StateHelper.Cookies.HasCookies && StateHelper.Cookies.UserContext.HasValue)
- return StateHelper.Cookies.UserContext.GetValue();
- else
- return "";
+ // zb-00004 #29956 : refactor cookies names & handling
+ if (StateHelper.Cookies.HasCookies && StateHelper.Cookies.UserContext.HasValue)
+ return StateHelper.Cookies.UserContext.GetValue();
+ else
+ return "";
}
- set {
- // zb-00004 #29956 : refactor cookies names & handling
+ set
+ {
+ // zb-00004 #29956 : refactor cookies names & handling
if (StateHelper.Cookies.HasCookies)
- {
- // Clearing all old cookies before setting a new one.
- if (StateHelper.Cookies.UserContext.HasValue)
- StateHelper.Cookies.ClearAll();
+ {
+ // Clearing all old cookies before setting a new one.
+ if (StateHelper.Cookies.UserContext.HasValue)
+ StateHelper.Cookies.ClearAll();
// Create new cookie.
- StateHelper.Cookies.UserContext.SetValue(value, 1);
+ StateHelper.Cookies.UserContext.SetValue(value, 1);
}
}
}
@@ -227,24 +250,24 @@ namespace umbraco.BasePages {
///
public void ClearLogin()
{
- deleteLogin();
+ DeleteLogin();
umbracoUserContextID = "";
}
- private void deleteLogin()
+ private void DeleteLogin()
{
SqlHelper.ExecuteNonQuery(
"DELETE FROM umbracoUserLogins WHERE contextId = @contextId",
SqlHelper.CreateParameter("@contextId", umbracoUserContextID));
}
- private void updateLogin()
+ private void UpdateLogin()
{
// only call update if more than 1/10 of the timeout has passed
- if (timeout - (((_ticksPrMinute * _umbracoTimeOutInMinutes) * 0.8)) < DateTime.Now.Ticks)
+ if (timeout - (((TicksPrMinute * UmbracoTimeOutInMinutes) * 0.8)) < DateTime.Now.Ticks)
SqlHelper.ExecuteNonQuery(
"UPDATE umbracoUserLogins SET timeout = @timeout WHERE contextId = @contextId",
- SqlHelper.CreateParameter("@timeout", DateTime.Now.Ticks + (_ticksPrMinute * _umbracoTimeOutInMinutes)),
+ SqlHelper.CreateParameter("@timeout", DateTime.Now.Ticks + (TicksPrMinute * UmbracoTimeOutInMinutes)),
SqlHelper.CreateParameter("@contextId", umbracoUserContextID));
}
@@ -253,7 +276,7 @@ namespace umbraco.BasePages {
// only call update if more than 1/10 of the timeout has passed
SqlHelper.ExecuteNonQuery(
"UPDATE umbracoUserLogins SET timeout = @timeout WHERE contextId = @contextId",
- SqlHelper.CreateParameter("@timeout", DateTime.Now.Ticks + (_ticksPrMinute * _umbracoTimeOutInMinutes)),
+ SqlHelper.CreateParameter("@timeout", DateTime.Now.Ticks + (TicksPrMinute * UmbracoTimeOutInMinutes)),
SqlHelper.CreateParameter("@contextId", umbracoUserContextID));
}
@@ -261,11 +284,12 @@ namespace umbraco.BasePages {
/// Logs a user in.
///
/// The user
- public static void doLogin(User u) {
+ public static void doLogin(User u)
+ {
Guid retVal = Guid.NewGuid();
SqlHelper.ExecuteNonQuery(
"insert into umbracoUserLogins (contextID, userID, timeout) values (@contextId,'" + u.Id + "','" +
- (DateTime.Now.Ticks + (_ticksPrMinute * _umbracoTimeOutInMinutes)).ToString() +
+ (DateTime.Now.Ticks + (TicksPrMinute * UmbracoTimeOutInMinutes)).ToString() +
"') ",
SqlHelper.CreateParameter("@contextId", retVal));
umbracoUserContextID = retVal.ToString();
@@ -277,34 +301,37 @@ namespace umbraco.BasePages {
/// Gets the user.
///
///
- public User getUser() {
- if (!_userisValidated) validateUser();
+ public User getUser()
+ {
+ if (!_userisValidated) ValidateUser();
return _user;
}
///
/// Ensures the page context.
///
- public void ensureContext() {
- validateUser();
- }
-
- [Obsolete("Use ClientTools instead")]
- public void speechBubble(speechBubbleIcon i, string header, string body)
- {
- ClientTools.ShowSpeechBubble(i, header, body);
+ public void ensureContext()
+ {
+ ValidateUser();
}
- //[Obsolete("Use ClientTools instead")]
- //public void reloadParentNode()
- //{
- // ClientTools.ReloadParentNode(true);
- //}
+ [Obsolete("Use ClientTools instead")]
+ public void speechBubble(speechBubbleIcon i, string header, string body)
+ {
+ ClientTools.ShowSpeechBubble(i, header, body);
+ }
+
+ //[Obsolete("Use ClientTools instead")]
+ //public void reloadParentNode()
+ //{
+ // ClientTools.ReloadParentNode(true);
+ //}
///
/// a collection of available speechbubble icons
///
- public enum speechBubbleIcon {
+ public enum speechBubbleIcon
+ {
///
/// Save icon
///
@@ -331,10 +358,12 @@ namespace umbraco.BasePages {
/// Raises the event.
///
/// The object that contains the event data.
- protected override void OnLoad(EventArgs e) {
+ protected override void OnLoad(EventArgs e)
+ {
base.OnLoad(e);
-
- if (!Request.IsSecureConnection && GlobalSettings.UseSSL) {
+
+ if (!Request.IsSecureConnection && GlobalSettings.UseSSL)
+ {
string serverName = HttpUtility.UrlEncode(Request.ServerVariables["SERVER_NAME"]);
Response.Redirect(string.Format("https://{0}{1}", serverName, Request.FilePath));
}