Initial project's source code check-in.

This commit is contained in:
ptsurbeleu 2011-07-13 16:07:32 -07:00
commit b03b0b373f
4573 changed files with 981205 additions and 0 deletions

View file

@ -0,0 +1,20 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("WebsitePanel.AWStats.Viewer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyProduct("WebsitePanel.AWStats.Viewer")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("dc9fe3a4-572c-42d0-9c5e-6dc59e2563ae")]

View file

@ -0,0 +1,78 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebsitePanel.AWStats.Viewer.Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Advanced Statistics</title>
<style type="text/css">
<!--
body { margin: 0; }
.aws_border { border: 2px solid #CCCCDD; margin-top: 100px; }
.aws_title { font: 13px verdana, arial, helvetica, sans-serif; font-weight: bold; background-color: #CCCCDD; text-align: center; padding: 3px; color: #000000; }
.aws_data { background-color: #FFFFFF; }
.aws_button {
font-family: arial,verdana,helvetica, sans-serif;
font-size: 12px;
border: 1px solid #ccd7e0;
background-image : url(icon/other/button.gif);
}
.aws_pad { padding: 3px; }
td { border-color: #ECECEC; border-left-width: 0px; border-right-width: 1px; border-top-width: 0px; border-bottom-width: 1px; font: 11px verdana, arial, helvetica, sans-serif; color: #000000; }
p { font: 11px verdana, arial, helvetica, sans-serif; color: #000000; text-align: center; }
b { font-weight: bold; }
a { font: 11px verdana, arial, helvetica, sans-serif; }
a:link { color: #0011BB; text-decoration: none; }
a:visited { color: #0011BB; text-decoration: none; }
a:hover { color: #605040; text-decoration: underline; }
.currentday { font-weight: bold; }
//-->
</style>
</head>
<body>
<form id="form1" runat="server">
<table class="aws_border" align="center" cellPadding="10" cellspacing="0" width="300px">
<tr>
<td class="aws_title">Login to Advanced Statistics</td>
</tr>
<tr>
<td align="center">
<table class="aws_data">
<tr>
<td colspan="2" align="center">
<asp:Label ID="lblMessage" Runat="server" ForeColor="Red"></asp:Label>
</td>
</tr>
<tr>
<td class="aws"><b>Domain:</b></td>
<td>
<asp:TextBox id="txtDomain" runat="server" Width="150px"></asp:TextBox>
<asp:RequiredFieldValidator id="valRequireDomain" runat="server" ErrorMessage="*" ControlToValidate="txtDomain"></asp:RequiredFieldValidator></td>
</tr>
<tr>
<td class="aws">Username:</td>
<td>
<asp:TextBox id="txtUsername" runat="server" Width="150px"></asp:TextBox>
<asp:RequiredFieldValidator id="valRequireUsername" runat="server" ErrorMessage="*" ControlToValidate="txtUsername"></asp:RequiredFieldValidator></td>
</tr>
<tr>
<td class="aws">Password:</td>
<td>
<asp:TextBox id="txtPassword" runat="server" TextMode="Password" Width="150px"></asp:TextBox>
<asp:RequiredFieldValidator id="valRequirePassword" runat="server" ErrorMessage="*" ControlToValidate="txtPassword"></asp:RequiredFieldValidator></td>
</tr>
<tr>
<td class="aws_pad" colspan="2" align="center">
<asp:Button id="btnView" runat="server" Text="Display Statistics" CssClass="aws_button" OnClick="btnView_Click"></asp:Button></td>
</tr>
</table>
</td>
</tr>
</table>
<p>
* You should specify username and password that you use to login to
<a href="http://demo.websitepanel.net" target="_blank">http://demo.websitepanel.net</a>.
</p>
</form>
</body>
</html>

View file

@ -0,0 +1,225 @@
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using System.IO;
using System.Net;
namespace WebsitePanel.AWStats.Viewer
{
public partial class Default : System.Web.UI.Page
{
private void Page_Load(object sender, EventArgs e)
{
if (Request.IsAuthenticated)
{
string identity = Context.User.Identity.Name;
string domain = identity.Split('=')[0];
if (String.Compare(Request["config"], domain, true) != 0)
{
FormsAuthentication.SignOut();
Response.Redirect(Request.Url.AbsolutePath);
}
Response.Clear();
string queryParams = Request.Url.Query;
string awStatsUrl = AWStatsUrl;
if (awStatsUrl.IndexOf(":") == -1)
{
string appUrl = Request.Url.ToString();
appUrl = appUrl.Substring(0, appUrl.LastIndexOf("/"));
awStatsUrl = appUrl + awStatsUrl;
}
string awStatsPage = GetWebDocument(awStatsUrl + queryParams);
// replace links
awStatsPage = awStatsPage.Replace(AWStatsScript, Request.Url.AbsolutePath);
Response.Write(awStatsPage);
Response.End();
}
else
{
lblMessage.Visible = false;
if (!IsPostBack)
{
string domain = Request["domain"];
string username = Request["username"];
string password = Request["password"];
if (String.IsNullOrEmpty(domain))
domain = Request["config"];
txtDomain.Text = domain;
if (!String.IsNullOrEmpty(username))
txtUsername.Text = username;
// check for autologin
if (!String.IsNullOrEmpty(domain)
&& !String.IsNullOrEmpty(username)
&& !String.IsNullOrEmpty(password))
{
// perform login
Login(domain, username, password);
}
}
}
}
protected void btnView_Click(object sender, EventArgs e)
{
if (!Page.IsValid)
return;
// perform login
Login(txtDomain.Text.Trim(), txtUsername.Text.Trim(), txtPassword.Text);
}
private void Login(string domain, string username, string password)
{
// check user
AuthenticationResult result =
AuthenticationProvider.Instance.AuthenticateUser(domain, username, password);
if (result == AuthenticationResult.OK)
{
FormsAuthentication.SetAuthCookie(domain + "=" + username, false);
Response.Redirect(Request.Url.AbsolutePath + "?config=" + domain);
}
// show error message
lblMessage.Text = ConfigurationManager.AppSettings["AWStats.Message.DomainNotFound"];
if (result == AuthenticationResult.WrongUsername)
lblMessage.Text = ConfigurationManager.AppSettings["AWStats.Message.WrongUsername"];
else if (result == AuthenticationResult.WrongPassword)
lblMessage.Text = ConfigurationManager.AppSettings["AWStats.Message.WrongPassword"];
lblMessage.Visible = true;
}
#region Private Helpers
private string GetWebDocument(string url)
{
HttpWebResponse result = null;
StringBuilder sb = new StringBuilder();
try
{
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
string lang = Request.Headers["Accept-Language"];
req.Headers["Accept-Language"] = lang;
string username = ConfigurationManager.AppSettings["AWStats.Username"];
if (username != null && username != "")
{
string password = ConfigurationManager.AppSettings["AWStats.Password"];
string domain = null;
int sepIdx = username.IndexOf("\\");
if (sepIdx != -1)
{
domain = username.Substring(0, sepIdx);
username = username.Substring(sepIdx + 1);
}
req.Credentials = new NetworkCredential(username, password, domain);
}
else
{
req.Credentials = CredentialCache.DefaultNetworkCredentials;
}
result = (HttpWebResponse)req.GetResponse();
Stream ReceiveStream = result.GetResponseStream();
string respEnc = !String.IsNullOrEmpty(result.ContentEncoding) ? result.ContentEncoding : "utf-8";
Encoding encode = System.Text.Encoding.GetEncoding(respEnc);
StreamReader sr = new StreamReader(ReceiveStream, encode);
Char[] read = new Char[256];
int count = sr.Read(read, 0, 256);
while (count > 0)
{
String str = new String(read, 0, count);
sb.Append(str);
count = sr.Read(read, 0, 256);
}
}
catch (WebException ex)
{
Response.Write("Error while opening '" + url + "': " + ex.Message);
}
catch (Exception ex)
{
Response.Write(ex.ToString());
}
finally
{
if (result != null)
{
result.Close();
}
}
return sb.ToString();
}
private string AWStatsUrl
{
get { return ConfigurationManager.AppSettings["AWStats.URL"]; }
}
private string AWStatsScript
{
get
{
int idx = AWStatsUrl.LastIndexOf("/");
return (idx == -1) ? AWStatsUrl : AWStatsUrl.Substring(idx + 1);
}
}
#endregion
}
}

View file

@ -0,0 +1,97 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.1873
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace WebsitePanel.AWStats.Viewer {
public partial class Default {
/// <summary>
/// form1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
/// <summary>
/// lblMessage control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label lblMessage;
/// <summary>
/// txtDomain control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox txtDomain;
/// <summary>
/// valRequireDomain control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.RequiredFieldValidator valRequireDomain;
/// <summary>
/// txtUsername control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox txtUsername;
/// <summary>
/// valRequireUsername control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.RequiredFieldValidator valRequireUsername;
/// <summary>
/// txtPassword control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.TextBox txtPassword;
/// <summary>
/// valRequirePassword control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.RequiredFieldValidator valRequirePassword;
/// <summary>
/// btnView control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Button btnView;
}
}

View file

@ -0,0 +1,76 @@
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.Configuration;
namespace WebsitePanel.AWStats.Viewer
{
/// <summary>
/// Summary description for AuthenticationProvider.
/// </summary>
public abstract class AuthenticationProvider
{
private static AuthenticationProvider objProvider;
public static AuthenticationProvider Instance
{
get
{
if (objProvider == null)
{
string providerType = ConfigurationManager.AppSettings["AWStats.AuthenticationProvider"];
if (providerType == null || providerType == "")
throw new Exception("AuthenticationProvider implementation type is not specified");
try
{
// instantiate provider
objProvider = (AuthenticationProvider)Activator.CreateInstance(Type.GetType(providerType));
}
catch (Exception ex)
{
throw new Exception(String.Format("Can not instantiate '{0}' authentication provider",
providerType), ex);
}
}
return objProvider;
}
}
public abstract AuthenticationResult AuthenticateUser(string domain, string username, string password);
}
public enum AuthenticationResult
{
OK,
WrongUsername,
WrongPassword,
DomainNotFound
}
}

View file

@ -0,0 +1,102 @@
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.Configuration;
using System.IO;
using System.Web;
namespace WebsitePanel.AWStats.Viewer
{
/// <summary>
/// Summary description for ConfigFileAuthenticationProvider.
/// </summary>
public class ConfigFileAuthenticationProvider : AuthenticationProvider
{
public override AuthenticationResult AuthenticateUser(string domain, string username, string password)
{
string dataFolder = ConfigurationManager.AppSettings["AWStats.ConfigFileAuthenticationProvider.DataFolder"];
if(dataFolder.StartsWith("~"))
dataFolder = HttpContext.Current.Server.MapPath(dataFolder);
string awStatsScript = ConfigurationManager.AppSettings["AWStats.URL"];
int idx = awStatsScript.LastIndexOf("/");
awStatsScript = (idx == -1) ? awStatsScript : awStatsScript.Substring(idx + 1);
string prefix = awStatsScript;
int dotIdx = prefix.LastIndexOf(".");
if(dotIdx != -1)
prefix = prefix.Substring(0, dotIdx);
string dataFile = Path.Combine(dataFolder, prefix + "." + domain + ".conf");
if(!File.Exists(dataFile))
return AuthenticationResult.DomainNotFound;
string[] pairs = new string[0];
// read file contents
StreamReader reader = null;
try
{
reader = new StreamReader(dataFile);
string line;
while((line = reader.ReadLine()) != null)
{
idx = line.IndexOf("=");
if(idx == -1)
continue;
string key = line.Substring(0, idx).Trim();
if(key.ToLower() == "siteusers")
{
pairs = line.Substring(idx + 1).Trim().Split(';');
foreach(string pair in pairs)
{
string[] credentials = pair.Split('=');
if(String.Compare(credentials[0], username, true) == 0)
{
// check password
return (password == credentials[1]) ? AuthenticationResult.OK : AuthenticationResult.WrongPassword;
}
}
}
}
}
catch(Exception ex)
{
HttpContext.Current.Response.Write(ex.ToString());
}
finally
{
if(reader != null)
reader.Close();
}
return AuthenticationResult.WrongUsername;
}
}
}

View file

@ -0,0 +1,109 @@
// Copyright (c) 2011, Outercurve Foundation.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice, this
// list of conditions and the following disclaimer.
//
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// - Neither the name of the Outercurve Foundation nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
using System;
using System.Configuration;
using WebsitePanel.EnterpriseServer;
using WebsitePanel.Providers.Statistics;
namespace WebsitePanel.AWStats.Viewer
{
/// <summary>
/// Summary description for WebsitePanelAuthenticationProvider.
/// </summary>
public class WebsitePanelAuthenticationProvider : AuthenticationProvider
{
public override AuthenticationResult AuthenticateUser(string domain, string username, string password)
{
try
{
// authentication
esAuthentication auth = new esAuthentication();
SetupProxy(auth);
int result = auth.AuthenticateUser(username, password, "");
if (result == -109)
return AuthenticationResult.WrongUsername;
else if (result == -110)
return AuthenticationResult.WrongPassword;
// load user account
UserInfo user = auth.GetUserByUsernamePassword(username, password, "");
if (user == null)
return AuthenticationResult.WrongUsername;
// get all packages
esPackages packagesProxy = new esPackages();
SetupProxy(packagesProxy, username, password);
esStatisticsServers statsServers = new esStatisticsServers();
SetupProxy(statsServers, username, password);
PackageInfo[] packages = packagesProxy.GetMyPackages(user.UserId);
// load all statistics sites from all packages
foreach (PackageInfo package in packages)
{
StatsSite[] sites = statsServers.GetStatisticsSites(package.PackageId, false);
foreach (StatsSite site in sites)
{
if (String.Compare(site.Name, domain, true) == 0)
return AuthenticationResult.OK;
}
}
}
catch (Exception ex)
{
System.Web.HttpContext.Current.Response.Write(ex.ToString());
}
return AuthenticationResult.DomainNotFound;
}
private void SetupProxy(Microsoft.Web.Services3.WebServicesClientProtocol proxy)
{
SetupProxy(proxy, null, null);
}
private void SetupProxy(Microsoft.Web.Services3.WebServicesClientProtocol proxy,
string username, string password)
{
// create ES configurator
string serverUrl = ConfigurationManager.AppSettings["AWStats.WebsitePanelAuthenticationProvider.EnterpriseServer"];
if (String.IsNullOrEmpty(serverUrl))
throw new Exception("Enterprise Server URL could not be empty");
EnterpriseServerProxyConfigurator cnfg = new EnterpriseServerProxyConfigurator();
cnfg.EnterpriseServerUrl = serverUrl;
cnfg.Username = username;
cnfg.Password = password;
cnfg.Configure(proxy);
}
}
}

View file

@ -0,0 +1,21 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>WebsitePanel AWStats Viewer - Readme</title>
</head>
<body>
<h1>
WebsitePanel AWStats Viewer - Readme</h1>
<p>
WebsitePanel AWStats Viewer is a web application providing authentication for
AWStats against WebsitePanel users database.</p>
<h2>
License</h2>
<p>
WebsitePanel AWStats Viewer is released under BSD license. Please see LICENSE.txt file in the
root folder of this project.</p>
</body>
</html>

View file

@ -0,0 +1,38 @@
<?xml version="1.0"?>
<configuration>
<appSettings>
<!-- AWStats Viewer Settings -->
<add key="AWStats.URL" value="/cgi-bin/awstats.pl"/>
<add key="AWStats.Username" value=""/>
<add key="AWStats.Password" value=""/>
<!-- Messages -->
<add key="AWStats.Message.DomainNotFound" value="Advanced statistics is not enabled for the specified domain. Login to control panel, open 'My Resources -> Advanced Statistics' page and add a new statistics site."/>
<add key="AWStats.Message.WrongUsername" value="Account with the specified username does not exist! Make sure you type correct Control Panel username/password."/>
<add key="AWStats.Message.WrongPassword" value="Incorrect password has been specified!"/>
<!-- Authentication provider -->
<add key="AWStats.AuthenticationProvider" value="WebsitePanel.AWStats.Viewer.WebsitePanelAuthenticationProvider, WebsitePanel.AWStats.Viewer"/>
<!-- ConfigFileAuthenticationProvider settings -->
<add key="AWStats.ConfigFileAuthenticationProvider.DataFolder" value="~/cgi-bin"/>
<!-- WebsitePanelAuthenticationProvider settings -->
<add key="AWStats.WebsitePanelAuthenticationProvider.EnterpriseServer" value="http://localhost/EnterpriseServer"/>
</appSettings>
<system.web>
<compilation defaultLanguage="c#" debug="true"/>
<customErrors mode="RemoteOnly"/>
<!-- AUTHENTICATION -->
<authentication mode="Forms">
<forms name=".AWSTATSVIEWER" loginUrl="default.aspx" protection="All" timeout="30" path="/">
</forms>
</authentication>
<!-- AUTHORIZATION -->
<authorization>
<allow users="*"/>
<!-- Allow all users -->
</authorization>
</system.web>
</configuration>

View file

@ -0,0 +1,33 @@
<?xml version="1.0"?>
<configuration>
<appSettings>
<!-- AWStats Viewer Settings -->
<add key="AWStats.URL" value="/cgi-bin/awstats.pl"/>
<add key="AWStats.Username" value=""/>
<add key="AWStats.Password" value=""/>
<!-- Messages -->
<add key="AWStats.Message.DomainNotFound" value="Advanced statistics is not enabled for the specified domain. Login to control panel, open 'My Resources -&gt; Advanced Statistics' page and add a new statistics site."/>
<add key="AWStats.Message.WrongUsername" value="Account with the specified username does not exist! Make sure you type correct Control Panel username/password."/>
<add key="AWStats.Message.WrongPassword" value="Incorrect password has been specified!"/>
<!-- Authentication provider -->
<add key="AWStats.AuthenticationProvider" value="WebsitePanel.AWStats.Viewer.WebsitePanelAuthenticationProvider, WebsitePanel.AWStats.Viewer"/>
<!-- ConfigFileAuthenticationProvider settings -->
<add key="AWStats.ConfigFileAuthenticationProvider.DataFolder" value="~/cgi-bin"/>
<!-- WebsitePanelAuthenticationProvider settings -->
<add key="AWStats.WebsitePanelAuthenticationProvider.EnterpriseServer" value="http://localhost/EnterpriseServer"/>
</appSettings>
<system.web>
<compilation defaultLanguage="c#" debug="true" targetFramework="4.0"/>
<customErrors mode="RemoteOnly"/>
<!-- AUTHENTICATION -->
<authentication mode="Forms">
<forms name=".AWSTATSVIEWER" loginUrl="default.aspx" protection="All" timeout="30" path="/">
</forms>
</authentication>
<!-- AUTHORIZATION -->
<authorization>
<allow users="*"/>
<!-- Allow all users -->
</authorization>
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/></system.web>
</configuration>

View file

@ -0,0 +1,179 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{5F8C0079-C339-4590-BF10-DBA470329293}</ProjectGuid>
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ApplicationIcon>
</ApplicationIcon>
<AssemblyKeyContainerName>
</AssemblyKeyContainerName>
<AssemblyName>WebsitePanel.AWStats.Viewer</AssemblyName>
<AssemblyOriginatorKeyFile>
</AssemblyOriginatorKeyFile>
<DefaultClientScript>JScript</DefaultClientScript>
<DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
<DefaultTargetSchema>IE50</DefaultTargetSchema>
<DelaySign>false</DelaySign>
<OutputType>Library</OutputType>
<RootNamespace>WebsitePanel.AWStats.Viewer</RootNamespace>
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
<StartupObject>
</StartupObject>
<FileUpgradeFlags>
</FileUpgradeFlags>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<OldToolsVersion>3.5</OldToolsVersion>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<OutputPath>bin\</OutputPath>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
<BaseAddress>285212672</BaseAddress>
<CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
<ConfigurationOverrideFile>
</ConfigurationOverrideFile>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DocumentationFile>
</DocumentationFile>
<DebugSymbols>true</DebugSymbols>
<FileAlignment>4096</FileAlignment>
<NoStdLib>false</NoStdLib>
<NoWarn>
</NoWarn>
<Optimize>false</Optimize>
<RegisterForComInterop>false</RegisterForComInterop>
<RemoveIntegerChecks>false</RemoveIntegerChecks>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<WarningLevel>4</WarningLevel>
<DebugType>full</DebugType>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<OutputPath>bin\</OutputPath>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
<BaseAddress>285212672</BaseAddress>
<CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
<ConfigurationOverrideFile>
</ConfigurationOverrideFile>
<DefineConstants>TRACE</DefineConstants>
<DocumentationFile>
</DocumentationFile>
<DebugSymbols>false</DebugSymbols>
<FileAlignment>4096</FileAlignment>
<NoStdLib>false</NoStdLib>
<NoWarn>
</NoWarn>
<Optimize>true</Optimize>
<RegisterForComInterop>false</RegisterForComInterop>
<RemoveIntegerChecks>false</RemoveIntegerChecks>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<WarningLevel>4</WarningLevel>
<DebugType>none</DebugType>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.Web.Services3">
<HintPath>..\..\..\Lib\Microsoft.Web.Services3.dll</HintPath>
</Reference>
<Reference Include="System">
<Name>System</Name>
</Reference>
<Reference Include="System.configuration" />
<Reference Include="System.Data">
<Name>System.Data</Name>
</Reference>
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Drawing">
<Name>System.Drawing</Name>
</Reference>
<Reference Include="System.Web">
<Name>System.Web</Name>
</Reference>
<Reference Include="System.Web.ApplicationServices" />
<Reference Include="System.Web.DynamicData" />
<Reference Include="System.Web.Entity" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Web.Services">
<Name>System.Web.Services</Name>
</Reference>
<Reference Include="System.Xml">
<Name>System.XML</Name>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="WebsitePanel.EnterpriseServer.Base, Version=1.0.0.0, Culture=neutral, PublicKeyToken=da8782a6fc4d0081, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\Bin\WebsitePanel.EnterpriseServer.Base.dll</HintPath>
</Reference>
<Reference Include="WebsitePanel.EnterpriseServer.Client, Version=1.0.0.0, Culture=neutral, PublicKeyToken=da8782a6fc4d0081, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\Bin\WebsitePanel.EnterpriseServer.Client.dll</HintPath>
</Reference>
<Reference Include="WebsitePanel.Providers.Base, Version=1.0.0.0, Culture=neutral, PublicKeyToken=da8782a6fc4d0081, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\Bin\WebsitePanel.Providers.Base.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Content Include="Default.aspx" />
<Compile Include="..\..\VersionInfo.cs">
<Link>VersionInfo.cs</Link>
</Compile>
<Compile Include="AssemblyInfo.cs" />
<Compile Include="Default.aspx.cs">
<SubType>ASPXCodeBehind</SubType>
<DependentUpon>Default.aspx</DependentUpon>
</Compile>
<Compile Include="Default.aspx.designer.cs">
<DependentUpon>Default.aspx</DependentUpon>
</Compile>
<Compile Include="Providers\AuthenticationProvider.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Providers\ConfigFile\ConfigFileAuthenticationProvider.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Providers\WebsitePanel\WebsitePanelAuthenticationProvider.cs">
<SubType>Code</SubType>
</Compile>
<Content Include="Readme.htm" />
</ItemGroup>
<ItemGroup>
<Content Include="Web-v2.0.config" />
<None Include="Web.config" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PreBuildEvent>
</PreBuildEvent>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
<WebProjectProperties>
<UseIIS>False</UseIIS>
<AutoAssignPort>True</AutoAssignPort>
<DevelopmentServerPort>1444</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>
</IISUrl>
<NTLMAuthentication>False</NTLMAuthentication>
<UseCustomServer>False</UseCustomServer>
<CustomServerUrl>
</CustomServerUrl>
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
</WebProjectProperties>
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
</Project>