Merge: dev to default
This commit is contained in:
commit
19d6bae05e
1884 changed files with 65140 additions and 30708 deletions
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2011, Outercurve Foundation.
|
||||
// Copyright (c) 2012, Outercurve Foundation.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2011, Outercurve Foundation.
|
||||
// Copyright (c) 2012, Outercurve Foundation.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2011, Outercurve Foundation.
|
||||
// Copyright (c) 2012, Outercurve Foundation.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2011, Outercurve Foundation.
|
||||
// Copyright (c) 2012, Outercurve Foundation.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
|
|
|
@ -31,125 +31,125 @@ using System.Diagnostics;
|
|||
|
||||
namespace WebsitePanel.Server.Utils
|
||||
{
|
||||
/// <summary>
|
||||
/// Application log.
|
||||
/// </summary>
|
||||
public sealed class Log
|
||||
{
|
||||
/// <summary>
|
||||
/// Application log.
|
||||
/// </summary>
|
||||
public sealed class Log
|
||||
{
|
||||
private static TraceSwitch logSeverity = new TraceSwitch("Log", "General trace switch");
|
||||
|
||||
private Log()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write error to the log.
|
||||
/// </summary>
|
||||
/// <param name="message">Error message.</param>
|
||||
/// <param name="ex">Exception.</param>
|
||||
public static void WriteError(string message, Exception ex)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (logSeverity.TraceError)
|
||||
{
|
||||
string line = string.Format("[{0:G}] ERROR: {1}\n{2}\n", DateTime.Now, message, ex);
|
||||
Trace.TraceError(line);
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
private Log()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write error to the log.
|
||||
/// </summary>
|
||||
/// <param name="ex">Exception.</param>
|
||||
public static void WriteError(Exception ex)
|
||||
{
|
||||
/// <summary>
|
||||
/// Write error to the log.
|
||||
/// </summary>
|
||||
/// <param name="message">Error message.</param>
|
||||
/// <param name="ex">Exception.</param>
|
||||
public static void WriteError(string message, Exception ex)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (logSeverity.TraceError)
|
||||
{
|
||||
string line = string.Format("[{0:G}] ERROR: {1}\n{2}\n", DateTime.Now, message, ex);
|
||||
Trace.TraceError(line);
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if (ex != null)
|
||||
{
|
||||
WriteError(ex.Message, ex);
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
/// <summary>
|
||||
/// Write error to the log.
|
||||
/// </summary>
|
||||
/// <param name="ex">Exception.</param>
|
||||
public static void WriteError(Exception ex)
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Write info message to log
|
||||
/// </summary>
|
||||
/// <param name="message"></param>
|
||||
public static void WriteInfo(string message, params object[] args)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (logSeverity.TraceInfo)
|
||||
{
|
||||
Trace.TraceInformation(FormatIncomingMessage(message, args));
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
try
|
||||
{
|
||||
if (ex != null)
|
||||
{
|
||||
WriteError(ex.Message, ex);
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write info message to log
|
||||
/// </summary>
|
||||
/// <param name="message"></param>
|
||||
public static void WriteWarning(string message, params object[] args)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (logSeverity.TraceWarning)
|
||||
{
|
||||
Trace.TraceWarning(FormatIncomingMessage(message, args));
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
/// <summary>
|
||||
/// Write info message to log
|
||||
/// </summary>
|
||||
/// <param name="message"></param>
|
||||
public static void WriteInfo(string message, params object[] args)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (logSeverity.TraceInfo)
|
||||
{
|
||||
Trace.TraceInformation(FormatIncomingMessage(message, "INFO", args));
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write start message to log
|
||||
/// </summary>
|
||||
/// <param name="message"></param>
|
||||
/// <summary>
|
||||
/// Write info message to log
|
||||
/// </summary>
|
||||
/// <param name="message"></param>
|
||||
public static void WriteWarning(string message, params object[] args)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (logSeverity.TraceWarning)
|
||||
{
|
||||
Trace.TraceWarning(FormatIncomingMessage(message, "WARNING", args));
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write start message to log
|
||||
/// </summary>
|
||||
/// <param name="message"></param>
|
||||
public static void WriteStart(string message, params object[] args)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (logSeverity.TraceInfo)
|
||||
{
|
||||
Trace.TraceInformation(FormatIncomingMessage(message, args));
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write end message to log
|
||||
/// </summary>
|
||||
/// <param name="message"></param>
|
||||
public static void WriteEnd(string message, params object[] args)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (logSeverity.TraceInfo)
|
||||
{
|
||||
Trace.TraceInformation(FormatIncomingMessage(message, args));
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
{
|
||||
try
|
||||
{
|
||||
if (logSeverity.TraceInfo)
|
||||
{
|
||||
Trace.TraceInformation(FormatIncomingMessage(message, "START", args));
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
private static string FormatIncomingMessage(string message, params object[] args)
|
||||
{
|
||||
//
|
||||
if (args.Length > 0)
|
||||
{
|
||||
message = String.Format(message, args);
|
||||
}
|
||||
//
|
||||
return String.Concat(String.Format("[{0:G}] END: ", DateTime.Now), message);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Write end message to log
|
||||
/// </summary>
|
||||
/// <param name="message"></param>
|
||||
public static void WriteEnd(string message, params object[] args)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (logSeverity.TraceInfo)
|
||||
{
|
||||
Trace.TraceInformation(FormatIncomingMessage(message, "END", args));
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
private static string FormatIncomingMessage(string message, string tag, params object[] args)
|
||||
{
|
||||
//
|
||||
if (args.Length > 0)
|
||||
{
|
||||
message = String.Format(message, args);
|
||||
}
|
||||
//
|
||||
return String.Concat(String.Format("[{0:G}] {1}: ", DateTime.Now, tag), message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2011, Outercurve Foundation.
|
||||
// Copyright (c) 2012, Outercurve Foundation.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2011, Outercurve Foundation.
|
||||
// Copyright (c) 2012, Outercurve Foundation.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2011, Outercurve Foundation.
|
||||
// Copyright (c) 2012, Outercurve Foundation.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2011, Outercurve Foundation.
|
||||
// Copyright (c) 2012, Outercurve Foundation.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2011, Outercurve Foundation.
|
||||
// Copyright (c) 2012, Outercurve Foundation.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2011, Outercurve Foundation.
|
||||
// Copyright (c) 2012, Outercurve Foundation.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2011, Outercurve Foundation.
|
||||
// Copyright (c) 2012, Outercurve Foundation.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2011, Outercurve Foundation.
|
||||
// Copyright (c) 2012, Outercurve Foundation.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
|
@ -507,6 +507,11 @@ namespace WebsitePanel.Providers.Utils
|
|||
{
|
||||
if (serverSettings.ADEnabled)
|
||||
{
|
||||
if (user.Name.IndexOf("\\") != -1)
|
||||
{
|
||||
string[] tmpStr = user.Name.Split('\\');
|
||||
user.Name = tmpStr[1];
|
||||
}
|
||||
|
||||
//check is user name less than 20 symbols
|
||||
if (user.Name.Length > 20)
|
||||
|
@ -538,6 +543,13 @@ namespace WebsitePanel.Providers.Utils
|
|||
SetObjectProperty(objUser, "UserPrincipalName", user.Name);
|
||||
SetObjectProperty(objUser, "sAMAccountName", user.Name);
|
||||
SetObjectProperty(objUser, "UserPassword", user.Password);
|
||||
|
||||
if (user.MsIIS_FTPDir != string.Empty)
|
||||
{
|
||||
SetObjectProperty(objUser, "msIIS-FTPDir", user.MsIIS_FTPDir);
|
||||
SetObjectProperty(objUser, "msIIS-FTPRoot", user.MsIIS_FTPRoot);
|
||||
}
|
||||
|
||||
objUser.Properties["userAccountControl"].Value =
|
||||
ADAccountOptions.UF_NORMAL_ACCOUNT | ADAccountOptions.UF_PASSWD_NOTREQD;
|
||||
objUser.CommitChanges();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2011, Outercurve Foundation.
|
||||
// Copyright (c) 2012, Outercurve Foundation.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
|
@ -28,6 +28,7 @@
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
|
@ -51,5 +52,18 @@ namespace WebsitePanel.Providers.Utils
|
|||
|
||||
return Regex.Replace(str, "\\W+", "_", RegexOptions.Compiled);
|
||||
}
|
||||
|
||||
public static string CleanupASCIIControlCharacters(string s)
|
||||
{
|
||||
byte[] invalidCharacters = { 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0xB,
|
||||
0xC, 0xE, 0xF, 0x10, 0x11, 0x12, 0x14, 0x15, 0x16,
|
||||
0x17, 0x18, 0x1A, 0x1B, 0x1E, 0x1F, 0x7F };
|
||||
|
||||
byte[] sanitizedBytes = (from a in Encoding.UTF8.GetBytes(s)
|
||||
where !invalidCharacters.Contains(a)
|
||||
select a).ToArray();
|
||||
|
||||
return Encoding.UTF8.GetString(sanitizedBytes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2011, Outercurve Foundation.
|
||||
// Copyright (c) 2012, Outercurve Foundation.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2011, Outercurve Foundation.
|
||||
// Copyright (c) 2012, Outercurve Foundation.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue