Skip to content

Commit b96b5af

Browse files
committed
Merge branch 'release/v_4.8.4'
2 parents d1f87ea + e6f4816 commit b96b5af

16 files changed

+321
-54
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*.lo
1616

1717
# Shared objects (inc. Windows DLLs)
18-
*.dll
18+
1919
*.so
2020
*.so.*
2121
*.dylib
@@ -33,3 +33,6 @@
3333
*.su
3434
obj/
3535
install/
36+
.vs/
37+
*.user
38+
packages/

Config/cache.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<caching currentCache="DiskCache">
33
<caches>
4-
<cache name="DiskCache" type="ImageProcessor.Web.Caching.DiskCache, ImageProcessor.Web" maxDays="365" browserMaxDays="10">
4+
<cache name="DiskCache" type="ImageProcessor.Web.Caching.DiskCache, ImageProcessor.Web" maxDays="365" browserMaxDays="10" folderDepth="6" trimCache="true">
55
<settings>
66
<setting key="VirtualCachePath" value="~/app_data/OpenImageProcessor/ImageCache" />
77
</settings>

Config/security.config

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
<security>
33
<services>
44
<service name="LocalFileImageService" type="ImageProcessor.Web.Services.LocalFileImageService, ImageProcessor.Web"/>
5+
<!-- <service name="ImgClickService" type="Satrabel.OpenImageProcessor.Services.ImgClickService, Satrabel.OpenImageProcessor"/> -->
6+
57
<!--Disable the LocalFileImageService and enable this one when using virtual paths. -->
68
<!--<service name="CloudImageService" type="ImageProcessor.Web.Services.CloudImageService, ImageProcessor.Web">
79
<settings>
@@ -11,14 +13,16 @@
1113
<setting key="Host" value="http://yourhost.com/"/>
1214
</settings>
1315
</service>-->
14-
<!--<service prefix="remote.axd" name="RemoteImageService" type="ImageProcessor.Web.Services.RemoteImageService, ImageProcessor.Web">
16+
<!--
17+
<service prefix="remote.axd" name="RemoteImageService" type="ImageProcessor.Web.Services.RemoteImageService, ImageProcessor.Web">
1518
<settings>
1619
<setting key="MaxBytes" value="4194304"/>
1720
<setting key="Timeout" value="3000"/>
1821
<setting key="Protocol" value="http"/>
1922
</settings>
2023
<whitelist>
2124
</whitelist>
22-
</service>-->
25+
</service>
26+
-->
2327
</services>
2428
</security>

OpenImageProcessor-2017.sln

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 15
4+
VisualStudioVersion = 15.0.26228.10
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenImageProcessor", "OpenImageProcessor.csproj", "{82DF4E3D-0255-4961-84DD-84E9372EDFE3}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{82DF4E3D-0255-4961-84DD-84E9372EDFE3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{82DF4E3D-0255-4961-84DD-84E9372EDFE3}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{82DF4E3D-0255-4961-84DD-84E9372EDFE3}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{82DF4E3D-0255-4961-84DD-84E9372EDFE3}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
EndGlobal

OpenImageProcessor.csproj

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,13 @@
2020
<IISExpressWindowsAuthentication />
2121
<IISExpressUseClassicPipelineMode />
2222
<TargetFrameworkProfile />
23+
<UseGlobalApplicationHostFile />
2324
</PropertyGroup>
2425
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
2526
<DebugSymbols>true</DebugSymbols>
2627
<DebugType>full</DebugType>
2728
<Optimize>false</Optimize>
28-
<OutputPath>..\..\bin\</OutputPath>
29+
<OutputPath>..\..\v700\Thassos2015\Website\bin\</OutputPath>
2930
<DefineConstants>DEBUG;TRACE</DefineConstants>
3031
<ErrorReport>prompt</ErrorReport>
3132
<WarningLevel>4</WarningLevel>
@@ -43,15 +44,23 @@
4344
<ItemGroup>
4445
<Reference Include="DotNetNuke, Version=7.4.1.280, Culture=neutral, processorArchitecture=MSIL">
4546
<SpecificVersion>False</SpecificVersion>
46-
<HintPath>..\..\bin\DotNetNuke.dll</HintPath>
47+
<HintPath>ref\DotNetNuke.dll</HintPath>
48+
<Private>False</Private>
4749
</Reference>
4850
<Reference Include="DotNetNuke.Web, Version=7.4.1.280, Culture=neutral, processorArchitecture=MSIL">
4951
<SpecificVersion>False</SpecificVersion>
50-
<HintPath>..\..\bin\DotNetNuke.Web.dll</HintPath>
52+
<HintPath>ref\DotNetNuke.Web.dll</HintPath>
53+
<Private>False</Private>
54+
</Reference>
55+
<Reference Include="ImageProcessor, Version=2.4.5.0, Culture=neutral, processorArchitecture=MSIL">
56+
<SpecificVersion>False</SpecificVersion>
57+
<HintPath>ref\ImageProcessor.dll</HintPath>
58+
<Private>True</Private>
5159
</Reference>
52-
<Reference Include="ImageProcessor.Web, Version=4.6.4.0, Culture=neutral, processorArchitecture=MSIL">
60+
<Reference Include="ImageProcessor.Web, Version=4.6.6.0, Culture=neutral, processorArchitecture=MSIL">
5361
<SpecificVersion>False</SpecificVersion>
54-
<HintPath>..\..\bin\ImageProcessor.Web.dll</HintPath>
62+
<HintPath>ref\ImageProcessor.Web.dll</HintPath>
63+
<Private>True</Private>
5564
</Reference>
5665
<Reference Include="Microsoft.CSharp" />
5766
<Reference Include="System" />
@@ -70,10 +79,13 @@
7079
<Reference Include="System.Xml.Linq" />
7180
</ItemGroup>
7281
<ItemGroup>
82+
<Compile Include="Services\ImgClickService.cs" />
83+
<Compile Include="Services\ImgClickHelper.cs" />
7384
<Compile Include="Properties\AssemblyInfo.cs" />
7485
<Compile Include="ValidatingRequest.cs" />
7586
</ItemGroup>
7687
<ItemGroup>
88+
<Content Include="images\thumbnail_vierkant.jpg" />
7789
<Content Include="License.txt" />
7890
<Content Include="ReleaseNotes.txt" />
7991
</ItemGroup>
@@ -84,13 +96,6 @@
8496
<Content Include="BuildScripts\ModulePackage.targets" />
8597
<Content Include="BuildScripts\MSBuild.Community.Tasks.Targets" />
8698
</ItemGroup>
87-
<ItemGroup>
88-
<Content Include="App_LocalResources\View.ascx.resx" />
89-
</ItemGroup>
90-
<ItemGroup>
91-
<Content Include="App_LocalResources\Edit.ascx.resx" />
92-
<Content Include="App_LocalResources\Settings.ascx.resx" />
93-
</ItemGroup>
9499
<ItemGroup>
95100
<Content Include="packages.config" />
96101
</ItemGroup>
@@ -110,6 +115,7 @@
110115
<DependentUpon>web.config</DependentUpon>
111116
</None>
112117
</ItemGroup>
118+
<ItemGroup />
113119
<PropertyGroup>
114120
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
115121
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>

OpenImageProcessor.csproj.user

Lines changed: 0 additions & 31 deletions
This file was deleted.

OpenImageProcessor.dnn

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<dotnetnuke type="Package" version="5.0">
22
<packages>
3-
<package name="OpenImageProcessor" type="Library" version="04.06.06">
3+
<package name="OpenImageProcessor" type="Library" version="04.08.04">
44
<friendlyName>OpenImageProcessor</friendlyName>
55
<description>Satrabel OpenImageProcessor</description>
66
<iconFile>~/Images/icon_extensions.gif</iconFile>
@@ -13,7 +13,7 @@
1313
<license src="License.txt"></license>
1414
<releaseNotes src="ReleaseNotes.txt"></releaseNotes>
1515
<dependencies>
16-
16+
<dependency type="CoreVersion">07.03.02</dependency>
1717
</dependencies>
1818
<components>
1919
<component type="Assembly">

Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,5 @@
3030
//
3131
// You can specify all the values or you can default the Revision and Build Numbers
3232
// by using the '*' as shown below:
33-
[assembly: AssemblyVersion("00.00.01.*")]
34-
[assembly: AssemblyFileVersion("00.00.01.*")]
33+
[assembly: AssemblyVersion("00.00.02.*")]
34+
[assembly: AssemblyFileVersion("00.00.02.0")]

Services/ImgClickHelper.cs

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
#region Copyright
2+
//
3+
// DotNetNuke® - http://www.dotnetnuke.com
4+
// Copyright (c) 2002-2016
5+
// by DotNetNuke Corporation
6+
//
7+
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
8+
// documentation files (the "Software"), to deal in the Software without restriction, including without limitation
9+
// the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
10+
// to permit persons to whom the Software is furnished to do so, subject to the following conditions:
11+
//
12+
// The above copyright notice and this permission notice shall be included in all copies or substantial portions
13+
// of the Software.
14+
//
15+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
16+
// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17+
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
18+
// CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
19+
// DEALINGS IN THE SOFTWARE.
20+
#endregion
21+
#region Usings
22+
23+
using System;
24+
using System.Collections.Specialized;
25+
using System.Threading;
26+
using System.Web;
27+
using DotNetNuke.Common;
28+
using DotNetNuke.Common.Utilities;
29+
using DotNetNuke.Entities.Portals;
30+
using DotNetNuke.Entities.Users;
31+
using DotNetNuke.Security.Permissions;
32+
using DotNetNuke.Services.FileSystem;
33+
using PermissionsNotMetException = DotNetNuke.Services.FileSystem.PermissionsNotMetException;
34+
35+
#endregion
36+
37+
namespace Satrabel.OpenImageProcessor.Services
38+
{
39+
40+
public static class ImgClickHelper
41+
{
42+
public static string Key() => "imgclick";
43+
44+
public static bool IsValidRequest(HttpContext context, string path)
45+
{
46+
var id = path.Substring(Key().Length + 1);
47+
var filename = GetFileNameFromPath(context, id.Replace("/", "\\"));
48+
return !string.IsNullOrEmpty(filename);
49+
}
50+
51+
/// -----------------------------------------------------------------------------
52+
/// <summary>
53+
/// This handler handles requests for LinkClick.aspx, but only those specifc
54+
/// to file serving
55+
/// </summary>
56+
/// <param name="context">System.Web.HttpContext)</param>
57+
/// <param name="id"></param>
58+
/// <remarks>
59+
/// </remarks>
60+
/// -----------------------------------------------------------------------------
61+
public static string GetFileNameFromPath(HttpContext context, string id)
62+
{
63+
string retval = string.Empty;
64+
65+
var fileId = GetFileIdFromFilename(id);
66+
if (fileId > 0)
67+
{
68+
retval = GetFileNameIfAllowed(context, fileId);
69+
}
70+
else
71+
{
72+
DotNetNuke.Services.Exceptions.Exceptions.ProcessHttpException($"fileid not found for Id {id}");
73+
}
74+
return retval;
75+
}
76+
77+
private static int GetFileIdFromFilename(string id)
78+
{
79+
var piece = id.Split('\\');
80+
81+
if (piece.Length != 2) throw new ArgumentOutOfRangeException(nameof(id));
82+
if (!piece[1].EndsWith(".axd")) throw new ArgumentOutOfRangeException(nameof(id));
83+
84+
int portalid;
85+
int.TryParse(piece[0], out portalid);
86+
var hash = piece[1].Substring(0, piece[1].Length - 4);
87+
88+
var coll = new NameValueCollection { { "fileticket", hash }, { "portalid", portalid.ToString() } };
89+
return FileLinkClickController.Instance.GetFileIdFromLinkClick(coll);
90+
}
91+
92+
private static string GetFileNameIfAllowed(HttpContext context, int fileId)
93+
{
94+
string retval = string.Empty;
95+
try
96+
{
97+
var url = "FileID=" + fileId;
98+
var file = FileManager.Instance.GetFile(int.Parse(UrlUtils.GetParameterValue(url)));
99+
if (file != null && file.IsImageFile())
100+
{
101+
if (!file.IsEnabled /*|| !HasAPublishedVersion(file)*/)
102+
{
103+
if (context.Request.IsAuthenticated)
104+
{
105+
context.Response.Redirect(Globals.AccessDeniedURL(DotNetNuke.Services.Localization.Localization.GetString("FileAccess.Error")), true);
106+
}
107+
else
108+
{
109+
context.Response.Redirect(Globals.AccessDeniedURL(), true);
110+
}
111+
}
112+
else
113+
{
114+
var folder = FolderManager.Instance.GetFolder(file.FolderId);
115+
if (FolderPermissionController.Instance.CanViewFolder(folder))
116+
{
117+
retval = file.PhysicalPath + ".resources";
118+
}
119+
else
120+
{
121+
//UserInfo objUserInfo = UserController.Instance.GetCurrentUserInfo();
122+
//PortalSettings settings = PortalController.Instance.GetCurrentPortalSettings();
123+
124+
//todo uncomment this line when you are able to get current user and current portalsettings
125+
//throw new PermissionsNotMetException("You do not have permission to view this file.");
126+
//todo or better, let retval = the path to a thumbnail file (not allowed) or a file specified by the settings
127+
retval = file.PhysicalPath + ".resources";
128+
}
129+
}
130+
}
131+
}
132+
catch (ThreadAbortException)
133+
{
134+
}
135+
catch (Exception ex)
136+
{
137+
DotNetNuke.Services.Exceptions.Exceptions.ProcessHttpException($"File not found for fileid {fileId}");
138+
}
139+
return retval;
140+
}
141+
142+
public static bool IsImageFile(this IFileInfo file)
143+
{
144+
return (Globals.glbImageFileTypes + ",").IndexOf(file.Extension.ToLower().Replace(".", "") + ",") > -1;
145+
}
146+
}
147+
}

0 commit comments

Comments
 (0)