Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test PR #2007

Open
wants to merge 27 commits into
base: master
Choose a base branch
from
Open

Test PR #2007

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
f15dcc2
PayPal PLUS throws an exception if an initially empty configuration p…
mgesing Jun 30, 2016
ab3c8b1
Export all product categories rather than all of current store (cause…
mgesing Jul 4, 2016
dfb6e11
SKU, EAN, MPN of last attribute combination was exported for all comb…
mgesing Jul 4, 2016
07a38ef
GMC: Id should be unique when exporting attribute combinations as pro…
mgesing Jul 4, 2016
7526f3f
GMC: No special price exported when the special price period was not …
mgesing Jul 4, 2016
1a6ff6f
GMC: Attribute price adjustments were ignored when exporting attribut…
mgesing Jul 7, 2016
783bf87
GMC: Associated products that are not individually visible are not ex…
mgesing Jul 11, 2016
d9455aa
Fixes "Cannot insert the value NULL into column 'IsPublic', table 'db…
mgesing Jul 11, 2016
e6ef17b
Export: Projected customer id was ignored in price calculation
mgesing Jul 13, 2016
e654f15
Revert "Export: Projected customer id was ignored in price calculation"
mgesing Jul 13, 2016
53d6141
Awarded reward points should be rounded towards zero rather than to n…
mgesing Aug 12, 2016
972e217
Added PayPal partner attribution Id as request header
mgesing Aug 17, 2016
6cf721e
PayPal PLUS: Integration review through PayPal
mgesing Sep 1, 2016
a3d5797
PayPal PLUS: Integration review through PayPal (part 2)
mgesing Sep 3, 2016
c798768
PayPal PLUS: Generic attribute caching problem. Fixes "Item amount mu…
mgesing Sep 6, 2016
b3a4be2
Resolves #1030 Order export: does not export the data of the attribut…
mgesing Sep 28, 2016
4f42740
Order export does not export shipping address
mgesing Oct 4, 2016
71e7bd5
Filter shows wrong number of products if "Include products from subca…
mgesing Oct 6, 2016
77092c4
PayPal PLUS: Excluding tax issue. Fixes "Transaction amount details (…
mgesing Oct 20, 2016
36a2384
PayPal PLUS: Still faced with rounding issues
mgesing Dec 19, 2016
a91cadc
PayPal PLUS: Fixes "Cannot perform runtime binding on a null referenc…
mgesing Jan 25, 2017
f2b938b
More reliable recognition of anonymous visitors (bad bots, cookie-rej…
muratcakir Feb 28, 2017
351eda2
Caching fix for last commit (duplicate guest customer roles)
muratcakir Mar 6, 2017
ff21b94
Fixes compilation error
mgesing Mar 24, 2017
bf85a07
PayPal Express: Fixes net price issue
mgesing Apr 28, 2017
b78a251
PayPal PLUS: /v1/payments/payment/<id>/payment-instruction not workin…
mgesing May 2, 2017
e76cce4
Facebook login out of function due to Facebook API changes (always re…
mgesing Aug 14, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Libraries/SmartStore.Core/Collections/LazyMultimap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public virtual void Collect(IEnumerable<int> keys)
}

/// <summary>
/// Collect single key for combinde loading
/// Collect single key for combined loading
/// </summary>
/// <param name="key">Data key</param>
public virtual void Collect(int key)
Expand Down
20 changes: 15 additions & 5 deletions src/Libraries/SmartStore.Core/IWebHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,21 @@ public partial interface IWebHelper
/// <returns>URL referrer</returns>
string GetUrlReferrer();

/// <summary>
/// Get context IP address
/// </summary>
/// <returns>URL referrer</returns>
string GetCurrentIpAddress();
/// <summary>
/// Gets a unique client identifier
/// </summary>
/// <returns>A unique identifier</returns>
/// <remarks>
/// The client identifier is a hashed combination of client ip address and user agent.
/// This method returns <c>null</c> if IP or user agent (or both) cannot be determined.
/// </remarks>
string GetClientIdent();

/// <summary>
/// Get context IP address
/// </summary>
/// <returns>URL referrer</returns>
string GetCurrentIpAddress();

/// <summary>
/// Gets this page name
Expand Down
7 changes: 1 addition & 6 deletions src/Libraries/SmartStore.Core/IWorkContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,5 @@ public interface IWorkContext
/// Gets or sets a value indicating whether we're in admin area
/// </summary>
bool IsAdmin { get; set; }

///// <summary>
///// Gets a value indicating whether we're in the public shop
///// </summary>
//bool IsPublic { get; }
}
}
}
61 changes: 58 additions & 3 deletions src/Libraries/SmartStore.Core/WebHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public partial class WebHelper : IWebHelper
private bool? _isCurrentConnectionSecured;
private string _storeHost;
private string _storeHostSsl;
private string _ipAddress;
private bool? _appPathPossiblyAppended;
private bool? _appPathPossiblyAppendedSsl;

Expand All @@ -56,17 +57,71 @@ public virtual string GetUrlReferrer()
return referrerUrl;
}

public virtual string GetClientIdent()
{
var ipAddress = this.GetCurrentIpAddress();
var userAgent = _httpContext.Request != null ? _httpContext.Request.UserAgent : string.Empty;

if (ipAddress.HasValue() && userAgent.HasValue())
{
return (ipAddress + userAgent).GetHashCode().ToString();
}

return null;
}

public virtual string GetCurrentIpAddress()
{
if (_ipAddress != null)
{
return _ipAddress;
}

if (_httpContext == null && _httpContext.Request == null)
{
return string.Empty;
}

var vars = _httpContext.Request.ServerVariables;

var keysToCheck = new string[]
{
"HTTP_CLIENT_IP",
"HTTP_X_FORWARDED_FOR",
"HTTP_X_FORWARDED",
"HTTP_X_CLUSTER_CLIENT_IP",
"HTTP_FORWARDED_FOR",
"HTTP_FORWARDED",
"REMOTE_ADDR",
"HTTP_CF_CONNECTING_IP"
};

string result = null;

if (_httpContext != null && _httpContext.Request != null)
result = _httpContext.Request.UserHostAddress;
foreach (var key in keysToCheck)
{
var ipString = vars[key];
if (ipString.HasValue())
{
var arrStrings = ipString.Split(',');
// Take the last entry
ipString = arrStrings[arrStrings.Length - 1].Trim();

IPAddress address;
if (IPAddress.TryParse(ipString, out address))
{
result = ipString;
break;
}
}
}

if (result == "::1")
{
result = "127.0.0.1";
}

return result.EmptyNull();
return (_ipAddress = result.EmptyNull());
}

public virtual string GetThisPageUrl(bool includeQueryString)
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
namespace SmartStore.Data.Migrations
{
using System.Data.Entity.Migrations;
using System.Web.Hosting;
using Core.Data;

public partial class FixExportDeploymentIsPublic : DbMigration
{
public override void Up()
{
if (HostingEnvironment.IsHosted && DataSettings.Current.IsSqlServer)
{
Sql("IF EXISTS(SELECT TOP 1 1 FROM sys.objects o INNER JOIN sys.columns c ON o.object_id = c.object_id WHERE o.name = 'ExportDeployment' AND c.name = 'IsPublic') ALTER TABLE [dbo].[ExportDeployment] DROP COLUMN [IsPublic];");
}
}

public override void Down()
{
}
}
}

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions src/Libraries/SmartStore.Data/SmartStore.Data.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,10 @@
<Compile Include="Migrations\201605201911421_ExportRevision.Designer.cs">
<DependentUpon>201605201911421_ExportRevision.cs</DependentUpon>
</Compile>
<Compile Include="Migrations\201607111548571_FixExportDeploymentIsPublic.cs" />
<Compile Include="Migrations\201607111548571_FixExportDeploymentIsPublic.Designer.cs">
<DependentUpon>201607111548571_FixExportDeploymentIsPublic.cs</DependentUpon>
</Compile>
<Compile Include="Setup\Builder\ActivityLogTypeMigrator.cs" />
<Compile Include="Setup\Builder\PermissionMigrator.cs" />
<Compile Include="Setup\Builder\SettingsBuilder.cs" />
Expand Down Expand Up @@ -752,6 +756,9 @@
<EmbeddedResource Include="Migrations\201605201911421_ExportRevision.resx">
<DependentUpon>201605201911421_ExportRevision.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Migrations\201607111548571_FixExportDeploymentIsPublic.resx">
<DependentUpon>201607111548571_FixExportDeploymentIsPublic.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Sql\Indexes.sql" />
<EmbeddedResource Include="Sql\StoredProcedures.sql" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace SmartStore.Services.Authentication
/// </summary>
public partial class FormsAuthenticationService : IAuthenticationService
{
private readonly HttpContextBase _httpContext;
private readonly HttpContextBase _httpContext;
private readonly ICustomerService _customerService;
private readonly CustomerSettings _customerSettings;
private readonly TimeSpan _expirationTimeSpan;
Expand All @@ -33,7 +33,6 @@ public FormsAuthenticationService(HttpContextBase httpContext, ICustomerService
this._expirationTimeSpan = FormsAuthentication.Timeout;
}


public virtual void SignIn(Customer customer, bool createPersistentCookie)
{
var now = DateTime.UtcNow.ToLocalTime();
Expand Down Expand Up @@ -95,6 +94,21 @@ public virtual Customer GetAuthenticatedCustomer()

if (customer != null && customer.Active && !customer.Deleted && customer.IsRegistered())
{
if (customer.LastLoginDateUtc == null)
{
try
{
// This is most probably the very first "login" after registering. Delete the
// ASP.NET anonymous id cookie so that a new guest account can be created
// upon signing out.
System.Web.Security.AnonymousIdentificationModule.ClearAnonymousIdentifier();
}
finally
{
customer.LastLoginDateUtc = DateTime.UtcNow;
_customerService.UpdateCustomer(customer);
}
}
_cachedCustomer = customer;
}

Expand All @@ -117,5 +131,5 @@ public virtual Customer GetAuthenticatedCustomerFromTicket(FormsAuthenticationTi

return customer;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,20 @@ public partial interface IProductAttributeParser
IEnumerable<ProductVariantAttributeValue> ParseProductVariantAttributeValues(string attributesXml);

/// <summary>
/// Get list of localized product variant attribute values
/// Get list of product variant attribute values
/// </summary>
/// <param name="attributeCombination">Map of combined attributes</param>
/// <param name="attributes">Product variant attributes</param>
/// <param name="languageId">Language identifier</param>
/// <returns>List of localized product variant attribute values</returns>
IList<string> ParseProductVariantAttributeValues(Multimap<int, string> attributeCombination, IEnumerable<ProductVariantAttribute> attributes, int languageId = 0);
/// <returns>List of product variant attribute values</returns>
IList<ProductVariantAttributeValue> ParseProductVariantAttributeValues(Multimap<int, string> attributeCombination, IEnumerable<ProductVariantAttribute> attributes);

/// <summary>
/// Gets selected product variant attribute value
/// </summary>
/// <summary>
/// Gets selected product variant attribute value
/// </summary>
/// <param name="attributesXml">XML formatted attributes</param>
/// <param name="productVariantAttributeId">Product variant attribute identifier</param>
/// <returns>Product variant attribute value</returns>
IList<string> ParseValues(string attributesXml, int productVariantAttributeId);
/// <param name="productVariantAttributeId">Product variant attribute identifier</param>
/// <returns>Product variant attribute value</returns>
IList<string> ParseValues(string attributesXml, int productVariantAttributeId);

/// <summary>
/// Adds an attribute
Expand Down
39 changes: 17 additions & 22 deletions src/Libraries/SmartStore.Services/Catalog/ProductAttributeParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,13 @@
using SmartStore.Core.Caching;
using SmartStore.Core.Data;
using SmartStore.Core.Domain.Catalog;
using SmartStore.Services.Localization;

namespace SmartStore.Services.Catalog
{
/// <summary>
/// Product attribute parser
/// </summary>
public partial class ProductAttributeParser : IProductAttributeParser
/// <summary>
/// Product attribute parser
/// </summary>
public partial class ProductAttributeParser : IProductAttributeParser
{
// 0 = ProductId, 1 = AttributeXml Hash
private const string ATTRIBUTECOMBINATION_BY_ID_HASH = "SmartStore.parsedattributecombination.id-{0}-{1}";
Expand Down Expand Up @@ -194,12 +193,12 @@ where id.HasValue()
return values;
}

public virtual IList<string> ParseProductVariantAttributeValues(Multimap<int, string> attributeCombination, IEnumerable<ProductVariantAttribute> attributes, int languageId = 0)
public virtual IList<ProductVariantAttributeValue> ParseProductVariantAttributeValues(Multimap<int, string> attributeCombination, IEnumerable<ProductVariantAttribute> attributes)
{
var values = new List<string>();
var result = new List<ProductVariantAttributeValue>();

if (attributeCombination == null || !attributeCombination.Any())
return values;
return result;

var allValueIds = new List<int>();

Expand All @@ -219,28 +218,24 @@ public virtual IList<string> ParseProductVariantAttributeValues(Multimap<int, st
foreach (var attribute in attributes)
{
var attributeValue = attribute.ProductVariantAttributeValues.FirstOrDefault(x => x.Id == id);
if (attributeValue != null)
if (attributeValue != null && !result.Any(x => x.Id == attributeValue.Id))
{
var value = attributeValue.GetLocalized(x => x.Name, languageId, true, false);

if (!values.Any(x => x.IsCaseInsensitiveEqual(value)))
values.Add(value);
result.Add(attributeValue);
break;
}
}
}

return values;
return result;
}


/// <summary>
/// Gets selected product variant attribute value
/// </summary>
/// <param name="attributesXml">Attributes</param>
/// <param name="productVariantAttributeId">Product variant attribute identifier</param>
/// <returns>Product variant attribute value</returns>
public virtual IList<string> ParseValues(string attributesXml, int productVariantAttributeId)
/// <summary>
/// Gets selected product variant attribute value
/// </summary>
/// <param name="attributesXml">Attributes</param>
/// <param name="productVariantAttributeId">Product variant attribute identifier</param>
/// <returns>Product variant attribute value</returns>
public virtual IList<string> ParseValues(string attributesXml, int productVariantAttributeId)
{
var selectedProductVariantAttributeValues = new List<string>();
try
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,8 @@ public virtual bool IsBot
{
if (!_isBot.HasValue)
{
_isBot = _httpContext.Request.Browser.Crawler || this.Device.IsBot || this.UserAgent.IsBot;
// empty useragent > bad bot!
_isBot = this.RawValue.IsEmpty() || _httpContext.Request.Browser.Crawler || this.Device.IsBot || this.UserAgent.IsBot;
}
return _isBot.Value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public static bool IsBackgroundTaskAccount(this Customer customer)
}

/// <summary>
/// Gets a value indicating whether customer a search engine
/// Gets a value indicating whether customer is a search engine
/// </summary>
/// <param name="customer">Customer</param>
/// <returns>Result</returns>
Expand Down Expand Up @@ -84,13 +84,13 @@ public static bool IsPdfConverter(this Customer customer)
return result;
}

/// <summary>
/// Gets a value indicating whether customer is administrator
/// </summary>
/// <param name="customer">Customer</param>
/// <param name="onlyActiveCustomerRoles">A value indicating whether we should look only in active customer roles</param>
/// <returns>Result</returns>
public static bool IsAdmin(this Customer customer, bool onlyActiveCustomerRoles = true)
/// <summary>
/// Gets a value indicating whether customer is administrator
/// </summary>
/// <param name="customer">Customer</param>
/// <param name="onlyActiveCustomerRoles">A value indicating whether we should look only in active customer roles</param>
/// <returns>Result</returns>
public static bool IsAdmin(this Customer customer, bool onlyActiveCustomerRoles = true)
{
return IsInCustomerRole(customer, SystemCustomerRoleNames.Administrators, onlyActiveCustomerRoles);
}
Expand Down
Loading