From e8565650e4a997100d747a61b28f170a36b8a802 Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Sat, 21 Jan 2017 18:47:09 +0100 Subject: [PATCH] Merge branch 'master' into move-masterpages-to-views # Conflicts: # .gitignore # OurUmbraco.Site/OurUmbraco.Site.csproj # OurUmbraco.Site/Views/MacroPartials/Members/ForgotPassword.cshtml # OurUmbraco.Site/Views/Partials/Members/ForgotPassword.cshtml # OurUmbraco.Site/Views/Partials/Members/Login.cshtml # OurUmbraco.Site/Views/Search/Search.aspx.cs # OurUmbraco.Site/Views/Web.config # OurUmbraco.Site/config/ClientDependency.config # OurUmbraco.Site/config/Dashboard.config # OurUmbraco.Site/config/imageprocessor/cache.config # OurUmbraco.Site/masterpages/Community.master # OurUmbraco.Site/masterpages/ReleaseProgress.master # OurUmbraco.Site/masterpages/Repository/Projects.master # OurUmbraco.Site/masterpages/popular.master # OurUmbraco.Site/packages.config # OurUmbraco/Our/Controllers/LoginController.cs # OurUmbraco/Our/MigrationsHandler.cs # OurUmbraco/OurUmbraco.csproj # OurUmbraco/packages.config --- .gitignore | 2 +- OurUmbraco.Site/ApplicationInsights.config | 81 ++++++++ OurUmbraco.Site/ImageGen.ashx | 16 -- OurUmbraco.Site/OurUmbraco.Site.csproj | 89 ++++++++- .../ConnectedService.json | 7 + OurUmbraco.Site/Views/Community.cshtml | 4 +- OurUmbraco.Site/Views/FileDownload.cshtml | 82 +++++++- .../Views/MacroPartials/Community/Home.cshtml | 64 +++++- .../MacroPartials/Community/Scripts.cshtml | 18 ++ .../MacroPartials/Forum/LatestActivity.cshtml | 54 ----- .../Views/MacroPartials/Forum/Thread.cshtml | 14 +- .../Releases/ReleasesDropdown.cshtml | 2 +- .../Views/Partials/Home/ForumActivity.cshtml | 26 --- .../Partials/Home/LatestForumActivity.cshtml | 40 ++++ .../Partials/Home/TwitterSearchUmbraco.cshtml | 25 +++ .../Views/Partials/Members/Register.cshtml | 6 + OurUmbraco.Site/Views/Web.config | 1 + .../config/ClientDependency.config | 22 +- OurUmbraco.Site/config/Dashboard.config | 44 ++-- OurUmbraco.Site/config/IISRewriteMaps.config | 44 +++- OurUmbraco.Site/config/log4net.config | 16 +- .../repository-popularpackages.cshtml | 2 + .../repository-view-category.cshtml | 5 +- .../repository-view-project.cshtml | 25 ++- OurUmbraco.Site/packages.config | 13 +- OurUmbraco.Site/web.template.config | 49 ++++- .../Controllers/TwitterSearchController.cs | 63 ++++++ .../Controllers/LatestActivityController.cs | 31 +++ OurUmbraco/Forum/Models/ReadOnlyTopic.cs | 6 + .../Notifications/NewForumComment.cs | 2 +- .../Notifications/NewForumTopic.cs | 2 +- OurUmbraco/Our/Api/CommunityController.cs | 2 +- OurUmbraco/Our/Controllers/LoginController.cs | 11 +- .../Our/Controllers/RegisterController.cs | 29 ++- .../OurApplicationStartupHandler.cs | 1 + .../Our/CustomHandlers/ProjectIndexer.cs | 8 +- .../ErrorHandler/AiHandleErrorAttribute.cs | 1 + OurUmbraco/Our/Examine/ExamineHelper.cs | 3 +- OurUmbraco/Our/Examine/ForumDataService.cs | 2 +- .../Examine/ProjectNodeIndexDataService.cs | 2 +- OurUmbraco/Our/Extensions/StringExtensions.cs | 4 +- OurUmbraco/Our/FilterConfig.cs | 13 ++ OurUmbraco/Our/MigrationsHandler.cs | 189 +++++++++++++----- OurUmbraco/Our/Utils.cs | 6 + .../Our/usercontrols/FileDownloadProxy.ascx | 1 - .../usercontrols/FileDownloadProxy.ascx.cs | 83 -------- .../FileDownloadProxy.ascx.designer.cs | 15 -- OurUmbraco/Our/usercontrols/__Signup.ascx.cs | 2 +- OurUmbraco/OurUmbraco.csproj | 98 ++++++++- OurUmbraco/Project/ProjectExtensions.cs | 2 +- OurUmbraco/Wiki/BusinessLogic/WikiFile.cs | 3 +- OurUmbraco/app.config | 2 +- OurUmbraco/packages.config | 53 ++++- live.proj | 18 +- 54 files changed, 1061 insertions(+), 342 deletions(-) create mode 100644 OurUmbraco.Site/ApplicationInsights.config delete mode 100644 OurUmbraco.Site/ImageGen.ashx create mode 100644 OurUmbraco.Site/Service References/Application Insights/ConnectedService.json create mode 100644 OurUmbraco.Site/Views/MacroPartials/Community/Scripts.cshtml delete mode 100644 OurUmbraco.Site/Views/MacroPartials/Forum/LatestActivity.cshtml delete mode 100644 OurUmbraco.Site/Views/Partials/Home/ForumActivity.cshtml create mode 100644 OurUmbraco.Site/Views/Partials/Home/LatestForumActivity.cshtml create mode 100644 OurUmbraco.Site/Views/Partials/Home/TwitterSearchUmbraco.cshtml create mode 100644 OurUmbraco/Community/Controllers/TwitterSearchController.cs create mode 100644 OurUmbraco/Forum/Controllers/LatestActivityController.cs create mode 100644 OurUmbraco/Our/ErrorHandler/AiHandleErrorAttribute.cs create mode 100644 OurUmbraco/Our/FilterConfig.cs delete mode 100644 OurUmbraco/Our/usercontrols/FileDownloadProxy.ascx delete mode 100644 OurUmbraco/Our/usercontrols/FileDownloadProxy.ascx.cs delete mode 100644 OurUmbraco/Our/usercontrols/FileDownloadProxy.ascx.designer.cs diff --git a/.gitignore b/.gitignore index 37fce33f..d81ee917 100644 --- a/.gitignore +++ b/.gitignore @@ -65,4 +65,4 @@ OurUmbraco.Site/apidocs/ OurUmbraco.Site/App_Data/Documentation/ OurUmbraco.Site/App_Data/NotificationTest/ build/tools/node* -wwwcache/* +wwwcache/ diff --git a/OurUmbraco.Site/ApplicationInsights.config b/OurUmbraco.Site/ApplicationInsights.config new file mode 100644 index 00000000..d198df54 --- /dev/null +++ b/OurUmbraco.Site/ApplicationInsights.config @@ -0,0 +1,81 @@ + + + + + + + + + + + search|spider|crawl|Bot|Monitor|AlwaysOn + + + + + + + + + + + + + + + + + + + + + + System.Web.Handlers.TransferRequestHandler + Microsoft.VisualStudio.Web.PageInspector.Runtime.Tracing.RequestDataHttpHandler + System.Web.StaticFileHandler + System.Web.Handlers.AssemblyResourceLoader + System.Web.Optimization.BundleHandler + System.Web.Script.Services.ScriptHandlerFactory + System.Web.Handlers.TraceHandler + System.Web.Services.Discovery.DiscoveryRequestHandler + System.Web.HttpDebugHandler + + + + + + + + 5 + + + + + lalalala-not-telling-you + \ No newline at end of file diff --git a/OurUmbraco.Site/ImageGen.ashx b/OurUmbraco.Site/ImageGen.ashx deleted file mode 100644 index e80f96b9..00000000 --- a/OurUmbraco.Site/ImageGen.ashx +++ /dev/null @@ -1,16 +0,0 @@ -<%@ WebHandler Language="c#" Class="RequestHandler" %> - -public class RequestHandler : System.Web.IHttpHandler -{ - public bool IsReusable - { - get { return false; } - } - - public void ProcessRequest(System.Web.HttpContext context) - { - ImageGen.ImageGenQueryStringParser parser = new ImageGen.ImageGenQueryStringParser(); - parser.Process(context); - parser = null; - } -} diff --git a/OurUmbraco.Site/OurUmbraco.Site.csproj b/OurUmbraco.Site/OurUmbraco.Site.csproj index 6103b786..a751fbd8 100644 --- a/OurUmbraco.Site/OurUmbraco.Site.csproj +++ b/OurUmbraco.Site/OurUmbraco.Site.csproj @@ -26,6 +26,8 @@ + /subscriptions/76a04863-9a92-45d6-9801-b26d74a625c4/resourcegroups/Default-ApplicationInsights-EastUS/providers/microsoft.insights/components/OurUmbraco.Site + /subscriptions/76a04863-9a92-45d6-9801-b26d74a625c4/resourcegroups/Default-ApplicationInsights-EastUS/providers/microsoft.insights/components/OurUmbraco.Site true @@ -47,6 +49,10 @@ false + + ..\packages\Autofac.3.5.2\lib\net40\Autofac.dll + True + ..\packages\AutoMapper.3.3.1\lib\net40\AutoMapper.dll True @@ -103,10 +109,6 @@ ..\packages\ImageProcessor.Web.4.8.0\lib\net45\ImageProcessor.Web.dll True - - ..\packages\UrlTracker.3.11\lib\InfoCaster.Umbraco.UrlTracker.dll - True - ..\packages\UmbracoCms.Core.7.5.7\lib\interfaces.dll True @@ -127,10 +129,42 @@ ..\packages\Markdown.1.14.4\lib\net45\MarkdownSharp.dll True + + ..\packages\Microsoft.ApplicationInsights.Agent.Intercept.2.0.6\lib\net45\Microsoft.AI.Agent.Intercept.dll + True + + + ..\packages\Microsoft.ApplicationInsights.DependencyCollector.2.2.0\lib\net45\Microsoft.AI.DependencyCollector.dll + True + + + ..\packages\Microsoft.ApplicationInsights.PerfCounterCollector.2.2.0\lib\net45\Microsoft.AI.PerfCounterCollector.dll + True + + + ..\packages\Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.2.2.0\lib\net45\Microsoft.AI.ServerTelemetryChannel.dll + True + + + ..\packages\Microsoft.ApplicationInsights.Web.2.2.0\lib\net45\Microsoft.AI.Web.dll + True + + + ..\packages\Microsoft.ApplicationInsights.WindowsServer.2.2.0\lib\net45\Microsoft.AI.WindowsServer.dll + True + ..\packages\UmbracoCms.Core.7.5.7\lib\Microsoft.ApplicationBlocks.Data.dll True + + ..\packages\Microsoft.ApplicationInsights.2.2.0\lib\net45\Microsoft.ApplicationInsights.dll + True + + + ..\packages\Microsoft.ApplicationInsights.TraceListener.2.2.0\lib\net45\Microsoft.ApplicationInsights.TraceListener.dll + True + ..\packages\Microsoft.AspNet.Identity.Core.2.2.1\lib\net45\Microsoft.AspNet.Identity.Core.dll True @@ -176,6 +210,18 @@ ..\packages\Microsoft.Owin.Security.OAuth.3.0.1\lib\net45\Microsoft.Owin.Security.OAuth.dll True + + ..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.dll + True + + + ..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.dll + True + + + ..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.Desktop.dll + True + ..\packages\Microsoft.AspNet.WebHelpers.3.2.3\lib\net45\Microsoft.Web.Helpers.dll True @@ -192,14 +238,18 @@ ..\packages\MySql.Data.6.9.8\lib\net45\MySql.Data.dll True - - ..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll + + ..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll True ..\packages\Owin.1.0\lib\net40\Owin.dll True + + ..\packages\reCAPTCH.MVC.1.0.1\lib\net45\reCAPTCHA.MVC.dll + True + False ..\packages\RestSharp.104.1\lib\net4\RestSharp.dll @@ -225,11 +275,20 @@ ..\packages\UmbracoCms.Core.7.5.7\lib\System.Data.SqlServerCe.Entity.dll True + + + ..\packages\Microsoft.Net.Http.2.2.29\lib\net45\System.Net.Http.Extensions.dll + True + ..\packages\Microsoft.AspNet.WebApi.Client.5.2.3\lib\net45\System.Net.Http.Formatting.dll True + + ..\packages\Microsoft.Net.Http.2.2.29\lib\net45\System.Net.Http.Primitives.dll + True + ..\packages\System.Reflection.Metadata.1.0.21\lib\portable-net45+win8\System.Reflection.Metadata.dll @@ -289,6 +348,10 @@ ..\packages\UmbracoCms.Core.7.5.7\lib\TidyNet.dll True + + ..\packages\TweetinviAPI.1.2.0\lib\net45\Tweetinvi.dll + True + ..\packages\UmbracoCms.Core.7.5.7\lib\umbraco.dll True @@ -604,6 +667,9 @@ + + PreserveNewest + @@ -1690,6 +1756,9 @@ + + + Designer @@ -4265,7 +4334,10 @@ - + + + + @@ -4321,6 +4393,9 @@ + + + 11.0 $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v11.0 diff --git a/OurUmbraco.Site/Service References/Application Insights/ConnectedService.json b/OurUmbraco.Site/Service References/Application Insights/ConnectedService.json new file mode 100644 index 00000000..1127744c --- /dev/null +++ b/OurUmbraco.Site/Service References/Application Insights/ConnectedService.json @@ -0,0 +1,7 @@ +{ + "ProviderId": "Microsoft.ApplicationInsights.ConnectedService.ConnectedServiceProvider", + "Version": "7.16.109.2", + "GettingStartedDocument": { + "Uri": "https://go.microsoft.com/fwlink/?LinkID=613413" + } +} \ No newline at end of file diff --git a/OurUmbraco.Site/Views/Community.cshtml b/OurUmbraco.Site/Views/Community.cshtml index 44c746d8..5e16550e 100644 --- a/OurUmbraco.Site/Views/Community.cshtml +++ b/OurUmbraco.Site/Views/Community.cshtml @@ -24,4 +24,6 @@ -} \ No newline at end of file +} + +@Umbraco.RenderMacro("CommunityHomeScripts") \ No newline at end of file diff --git a/OurUmbraco.Site/Views/FileDownload.cshtml b/OurUmbraco.Site/Views/FileDownload.cshtml index ea1c2645..fd0929e3 100644 --- a/OurUmbraco.Site/Views/FileDownload.cshtml +++ b/OurUmbraco.Site/Views/FileDownload.cshtml @@ -1,5 +1,81 @@ -@inherits UmbracoTemplatePage +@using OurUmbraco.Wiki.BusinessLogic +@inherits UmbracoTemplatePage @{ Layout = "~/Views/Master.cshtml"; -} -@Umbraco.RenderMacro("FileDownloadProxy") \ No newline at end of file + if (Request["id"] == null) + { + return; + } + + int fileId; + if (int.TryParse(Request["id"], out fileId) == false) + { + return; + } + + if (fileId == 0) + { + return; + } + + var wikiFile = new WikiFile(fileId); + + wikiFile.UpdateDownloadCounter(false, wikiFile.FileType == "package"); + using (var sqlHelper = umbraco.BusinessLogic.Application.SqlHelper) + { + var path = sqlHelper.ExecuteScalar( + "Select path from wikiFiles where id = @id;", + sqlHelper.CreateParameter("@id", fileId)); + + var file = sqlHelper.ExecuteScalar( + "Select name from wikiFiles where id = @id;", + sqlHelper.CreateParameter("@id", fileId)); + + var fileinfo = new System.IO.FileInfo(Server.MapPath(path)); + + var extension = System.IO.Path.GetExtension(Server.MapPath(path)); + var type = ""; + // set known types based on file extension + if (extension != null) + { + switch (extension.ToLower()) + { + case ".tif": + case ".tiff": + type = "image/tiff"; + break; + case ".jpg": + case ".jpeg": + type = "image/jpeg"; + break; + case ".gif": + type = "image/gif"; + break; + case ".docx": + case ".doc": + case ".rtf": + type = "Application/msword"; + break; + case ".pdf": + type = "Application/pdf"; + break; + case ".png": + type = "image/png"; + break; + case ".bmp": + type = "image/bmp"; + break; + default: + type = "application/octet-stream"; + break; + } + } + + Response.Clear(); + + Response.AddHeader("Content-Disposition", "attachment; filename= " + file.Replace(" ", "-")); + Response.AddHeader("Content-Length", fileinfo.Length.ToString()); + Response.ContentType = type; + Response.WriteFile(path); + } +} \ No newline at end of file diff --git a/OurUmbraco.Site/Views/MacroPartials/Community/Home.cshtml b/OurUmbraco.Site/Views/MacroPartials/Community/Home.cshtml index 54e09b58..0a5e651d 100644 --- a/OurUmbraco.Site/Views/MacroPartials/Community/Home.cshtml +++ b/OurUmbraco.Site/Views/MacroPartials/Community/Home.cshtml @@ -57,11 +57,71 @@ @if (Members.IsLoggedIn()) { - @Html.Partial("home/forumactivity") + @ForumActivity() + @TwitterSearch() @Html.Partial("home/documentation") } else { @Html.Partial("home/documentation") - @Html.Partial("home/forumactivity") + @ForumActivity() + @TwitterSearch() } + +@helper ForumActivity() +{ +
+
+
+ +
+

Forum Activity

+

+ Recent activity in the forums, where people are helping each other with current problems. +

+
+
+ Recent posts +
+ +
+

Loading latest forum activity...

+
+ + + +
+
+
+} + +@helper TwitterSearch() +{ +
+
+
+ +
+

Twitter Activity

+

+ Recent activity on twitter, where people are talking about Umbraco. +

+
+
+ Recent tweets +
+ + + + + +
+
+
+} \ No newline at end of file diff --git a/OurUmbraco.Site/Views/MacroPartials/Community/Scripts.cshtml b/OurUmbraco.Site/Views/MacroPartials/Community/Scripts.cshtml new file mode 100644 index 00000000..387314f7 --- /dev/null +++ b/OurUmbraco.Site/Views/MacroPartials/Community/Scripts.cshtml @@ -0,0 +1,18 @@ +@inherits Umbraco.Web.Macros.PartialViewMacroPage + \ No newline at end of file diff --git a/OurUmbraco.Site/Views/MacroPartials/Forum/LatestActivity.cshtml b/OurUmbraco.Site/Views/MacroPartials/Forum/LatestActivity.cshtml deleted file mode 100644 index 127e3def..00000000 --- a/OurUmbraco.Site/Views/MacroPartials/Forum/LatestActivity.cshtml +++ /dev/null @@ -1,54 +0,0 @@ -@using OurUmbraco.Forum.Extensions -@using OurUmbraco.Forum.Models -@using OurUmbraco.Forum.Services -@using OurUmbraco.Our -@inherits Umbraco.Web.Macros.PartialViewMacroPage - -@{ - var ts = new TopicService(ApplicationContext.DatabaseContext); -} - -
- @Column(ts.GetLatestTopics(6, 1)) -
- -@helper Column(IEnumerable topics) -{ - foreach (var topic in topics.ToArray()) - { - var cat = Umbraco.TypedContent(topic.ParentId); - var mem = Members.GetById(topic.LatestReplyAuthor) ?? Members.GetById(topic.MemberId); - - - -
- @if(mem != null) - { - @Html.Raw(Utils.GetMemberAvatar(mem, 100)) - } -
- -
-
-

@topic.Title

-

- @if (topic.Replies != 0 && !string.IsNullOrEmpty(topic.LastReplyAuthorName)) - { - last edited by @topic.LastReplyAuthorName - } - else - { - created by @topic.AuthorName - } - - @topic.Updated.ConvertToRelativeTime() -

-
- -
- @cat.Name -
-
-
- } -} \ No newline at end of file diff --git a/OurUmbraco.Site/Views/MacroPartials/Forum/Thread.cshtml b/OurUmbraco.Site/Views/MacroPartials/Forum/Thread.cshtml index b23390b5..9871b060 100644 --- a/OurUmbraco.Site/Views/MacroPartials/Forum/Thread.cshtml +++ b/OurUmbraco.Site/Views/MacroPartials/Forum/Thread.cshtml @@ -3,6 +3,7 @@ @using OurUmbraco.Forum.Extensions @using OurUmbraco.Forum.Services @using OurUmbraco.NotificationsWeb.Library +@using Umbraco.Core.Logging @{ var topicService = new TopicService(ApplicationContext.DatabaseContext); @@ -61,8 +62,17 @@ }
    - - @Html.Partial("forum/question", topic) + + @{ + try + { + @Html.Partial("forum/question", topic) + } + catch (Exception ex) + { + LogHelper.Error(string.Format("~/Views/MacroPartials/Forum/Thread.cshtml - error rendering topic with id {0}", topic.Id), ex); + } + } @foreach (var comment in topic.Comments.Where(x => x.ParentCommentId == 0)) { diff --git a/OurUmbraco.Site/Views/MacroPartials/Releases/ReleasesDropdown.cshtml b/OurUmbraco.Site/Views/MacroPartials/Releases/ReleasesDropdown.cshtml index c35ee9a2..bedfa1f3 100644 --- a/OurUmbraco.Site/Views/MacroPartials/Releases/ReleasesDropdown.cshtml +++ b/OurUmbraco.Site/Views/MacroPartials/Releases/ReleasesDropdown.cshtml @@ -73,7 +73,7 @@ @foreach (var version in versions) { - if (version.Key.ToString() == fromVersion.ToString()) + if (fromVersion != null && version.Key.ToString() == fromVersion.ToString()) { } diff --git a/OurUmbraco.Site/Views/Partials/Home/ForumActivity.cshtml b/OurUmbraco.Site/Views/Partials/Home/ForumActivity.cshtml deleted file mode 100644 index c33dd314..00000000 --- a/OurUmbraco.Site/Views/Partials/Home/ForumActivity.cshtml +++ /dev/null @@ -1,26 +0,0 @@ -@inherits Umbraco.Web.Macros.PartialViewMacroPage - -
    -
    -
    - -
    -

    Forum Activity

    -

    - Recent activity in the forums, where people are helping each other with current problems. -

    -
    -
    - Recent posts -
    - - @Umbraco.RenderMacro("ForumLatestActivity") - - - - -
    -
    -
    \ No newline at end of file diff --git a/OurUmbraco.Site/Views/Partials/Home/LatestForumActivity.cshtml b/OurUmbraco.Site/Views/Partials/Home/LatestForumActivity.cshtml new file mode 100644 index 00000000..e3846dd6 --- /dev/null +++ b/OurUmbraco.Site/Views/Partials/Home/LatestForumActivity.cshtml @@ -0,0 +1,40 @@ +@using OurUmbraco.Forum.Extensions +@using OurUmbraco.Forum.Models +@model ReadOnlyTopic[] + +@foreach (var topic in Model) +{ + + +
    + @Html.Raw(topic.LastReplyAuthorAvatar) +
    + +
    +
    +

    @topic.Title

    +

    + @if (topic.Replies != 0 && !string.IsNullOrEmpty(topic.LastReplyAuthorName)) + { + last updated by @topic.LastReplyAuthorName + } + else + { + created by @topic.AuthorName + } + + @topic.Updated.ConvertToRelativeTime() +

    +
    + +
    + @topic.CategoryName +
    +
    +
    +} + +@if (Model.Any() == false) +{ +

    Could not load recent forum activity.

    +} \ No newline at end of file diff --git a/OurUmbraco.Site/Views/Partials/Home/TwitterSearchUmbraco.cshtml b/OurUmbraco.Site/Views/Partials/Home/TwitterSearchUmbraco.cshtml new file mode 100644 index 00000000..691ccd7a --- /dev/null +++ b/OurUmbraco.Site/Views/Partials/Home/TwitterSearchUmbraco.cshtml @@ -0,0 +1,25 @@ +@using OurUmbraco.Forum.Extensions +@using Tweetinvi.Models +@model ITweet[] + +@foreach (var tweet in Model) +{ + + +
    + +
    + +
    +
    +

    @tweet.Text

    +

    @tweet.CreatedAt.ConvertToRelativeTime() by @@@tweet.CreatedBy.UserIdentifier.ScreenName (@tweet.CreatedBy.Name)

    +
    +
    +
    +} + +@if (Model.Any() == false) +{ +

    Could not load recent tweets.

    +} \ No newline at end of file diff --git a/OurUmbraco.Site/Views/Partials/Members/Register.cshtml b/OurUmbraco.Site/Views/Partials/Members/Register.cshtml index fa8a9c52..869eae93 100644 --- a/OurUmbraco.Site/Views/Partials/Members/Register.cshtml +++ b/OurUmbraco.Site/Views/Partials/Members/Register.cshtml @@ -1,4 +1,5 @@ @using OurUmbraco.Our.Controllers +@using reCAPTCHA.MVC @inherits UmbracoViewPage @{ Html.EnableClientValidation(true); @@ -60,6 +61,11 @@ @Html.CheckBoxFor(m => m.AgreeTerms) @Html.ValidationMessageFor(m => m.AgreeTerms) + +
    + @Html.Recaptcha() + @Html.ValidationMessage("ReCaptcha") +
    } diff --git a/OurUmbraco.Site/Views/Web.config b/OurUmbraco.Site/Views/Web.config index 82d02c58..cbbf4f89 100644 --- a/OurUmbraco.Site/Views/Web.config +++ b/OurUmbraco.Site/Views/Web.config @@ -12,6 +12,7 @@ + diff --git a/OurUmbraco.Site/config/ClientDependency.config b/OurUmbraco.Site/config/ClientDependency.config index 98f650ca..7a5958cf 100644 --- a/OurUmbraco.Site/config/ClientDependency.config +++ b/OurUmbraco.Site/config/ClientDependency.config @@ -10,7 +10,7 @@ NOTES: * Compression/Combination/Minification is not enabled unless debug="false" is specified on the 'compiliation' element in the web.config * A new version will invalidate both client and server cache and create new persisted files --> - + - - - - + + + + - - + + @@ -44,12 +45,15 @@ NOTES: --> - + - + diff --git a/OurUmbraco.Site/config/Dashboard.config b/OurUmbraco.Site/config/Dashboard.config index ff7209da..7a8c49bd 100644 --- a/OurUmbraco.Site/config/Dashboard.config +++ b/OurUmbraco.Site/config/Dashboard.config @@ -30,16 +30,6 @@ views/dashboard/developer/developerdashboardvideos.html - - - - /App_Plugins/OurManagement/ourmanagement.html - - - - - views/dashboard/developer/examinemanagement.html - @@ -51,6 +41,11 @@ views/dashboard/developer/redirecturls.html + + + views/dashboard/developer/examinemanagement.html + +
    @@ -97,13 +92,38 @@
    - + +
    + + developer + + + + ~/usercontrols/dashboard/ForceDocumentationDownload.ascx + + +
    +
    developer + + + ~/usercontrols/dashboard/ForceYouTrackDownload.ascx + + +
    +
    + + developer + + + + views/dashboard/developer/healthcheck.html + +
    -
    developer diff --git a/OurUmbraco.Site/config/IISRewriteMaps.config b/OurUmbraco.Site/config/IISRewriteMaps.config index b0d7677f..3406a02e 100644 --- a/OurUmbraco.Site/config/IISRewriteMaps.config +++ b/OurUmbraco.Site/config/IISRewriteMaps.config @@ -19,6 +19,7 @@ + @@ -152,6 +153,13 @@ + + + + + + + @@ -410,6 +418,7 @@ + @@ -461,6 +470,37 @@ + + + + + + + + + + + + value="/projects/umbraco-pro/contour/documentation/" /> + + + - - + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/OurUmbraco.Site/config/log4net.config b/OurUmbraco.Site/config/log4net.config index 302958c5..c775fa7d 100644 --- a/OurUmbraco.Site/config/log4net.config +++ b/OurUmbraco.Site/config/log4net.config @@ -30,6 +30,18 @@ + + + + + + + + + + - - + \ No newline at end of file diff --git a/OurUmbraco.Site/macroScripts/repository-popularpackages.cshtml b/OurUmbraco.Site/macroScripts/repository-popularpackages.cshtml index 6c154ce4..c8e38cc4 100644 --- a/OurUmbraco.Site/macroScripts/repository-popularpackages.cshtml +++ b/OurUmbraco.Site/macroScripts/repository-popularpackages.cshtml @@ -11,6 +11,8 @@ @using Umbraco.Web @{ + System.Web.Helpers.AntiForgeryConfig.SuppressXFrameOptionsHeader = true; + var take = 30; var filters = new List(); diff --git a/OurUmbraco.Site/macroScripts/repository-view-category.cshtml b/OurUmbraco.Site/macroScripts/repository-view-category.cshtml index 567dbc7f..cd144f7f 100644 --- a/OurUmbraco.Site/macroScripts/repository-view-category.cshtml +++ b/OurUmbraco.Site/macroScripts/repository-view-category.cshtml @@ -3,6 +3,7 @@ @using Umbraco.Core @{ + System.Web.Helpers.AntiForgeryConfig.SuppressXFrameOptionsHeader = true; var id = int.Parse(Request.QueryString["category_id"]); var categoryProvider = new OurUmbraco.MarketPlace.Providers.UmbracoCategoryProvider(); @@ -61,7 +62,7 @@

    @project.Name

    -
    @project.GetCategoryName()
    +
    @project.Name
    @project.ListingType
    @@ -69,7 +70,7 @@ diff --git a/OurUmbraco.Site/macroScripts/repository-view-project.cshtml b/OurUmbraco.Site/macroScripts/repository-view-project.cshtml index 443e4d98..0a29ba3f 100644 --- a/OurUmbraco.Site/macroScripts/repository-view-project.cshtml +++ b/OurUmbraco.Site/macroScripts/repository-view-project.cshtml @@ -1,8 +1,14 @@ @using OurUmbraco.Project @using Umbraco.Web @{ + System.Web.Helpers.AntiForgeryConfig.SuppressXFrameOptionsHeader = true; + var ProjectsProvider = new OurUmbraco.MarketPlace.NodeListing.NodeListingProvider(); - var projectId = int.Parse(Request.QueryString["project_id"]); + int projectId; + if (int.TryParse(Request.QueryString["project_id"], out projectId) == false) + { + return; + } var qs = Request.RawUrl.Substring(Request.RawUrl.IndexOf('?') + 1).Replace("&project_id=" + projectId, ""); var callback = Request.QueryString["callback"]; @@ -19,7 +25,10 @@ string ProjectCompatitbleWithDotNet = "4.0"; string ProjectCompatitbleWithMediumTrust = "No"; - if (Project.Description.Length > 2000) { descCssClass = "wrap"; } + if (Project.Description.Length > 2000) + { + descCssClass = "wrap"; + } int currentReleaseFile = 0; if (int.TryParse(Project.CurrentReleaseFile, out currentReleaseFile)) @@ -143,9 +152,15 @@

    Screenshots

    @foreach (var image in Project.ScreenShots) { - - - + if (image.Path.EndsWith("gif") || + image.Path.EndsWith("png") || + image.Path.EndsWith("jpg") || + image.Path.EndsWith("jpeg")) + { + + + + } } diff --git a/OurUmbraco.Site/packages.config b/OurUmbraco.Site/packages.config index d273dba7..ba4078b7 100644 --- a/OurUmbraco.Site/packages.config +++ b/OurUmbraco.Site/packages.config @@ -18,6 +18,14 @@ + + + + + + + + @@ -45,20 +53,21 @@ - + + + - \ No newline at end of file diff --git a/OurUmbraco.Site/web.template.config b/OurUmbraco.Site/web.template.config index d726b910..9d7345a2 100644 --- a/OurUmbraco.Site/web.template.config +++ b/OurUmbraco.Site/web.template.config @@ -15,6 +15,12 @@
    + + +
    +
    +
    + @@ -24,7 +30,6 @@ - @@ -32,6 +37,13 @@ + + + + + + + + + + + + + + @@ -159,8 +180,8 @@ - - + + @@ -343,6 +364,9 @@ + + + @@ -516,6 +540,14 @@ + + + + + + + + @@ -570,7 +602,7 @@ - + @@ -580,7 +612,7 @@ - + @@ -625,4 +657,11 @@ + + + + + + + \ No newline at end of file diff --git a/OurUmbraco/Community/Controllers/TwitterSearchController.cs b/OurUmbraco/Community/Controllers/TwitterSearchController.cs new file mode 100644 index 00000000..59d21c80 --- /dev/null +++ b/OurUmbraco/Community/Controllers/TwitterSearchController.cs @@ -0,0 +1,63 @@ +using System; +using System.Configuration; +using System.Linq; +using System.Web.Mvc; +using Tweetinvi; +using Tweetinvi.Models; +using Tweetinvi.Parameters; +using Umbraco.Core; +using Umbraco.Core.Cache; +using Umbraco.Core.Logging; +using Umbraco.Web; +using Umbraco.Web.Mvc; + +namespace OurUmbraco.Community.Controllers +{ + public class TwitterSearchController : SurfaceController + { + public ActionResult TwitterSearchResult(int numberOfResults = 6) + { + if (numberOfResults > 30) + numberOfResults = 6; + + ITweet[] filteredTweets = { }; + try + { + var tweets = ApplicationContext.ApplicationCache.RuntimeCache.GetCacheItem("UmbracoSearchedTweets", + () => + { + Auth.SetUserCredentials(ConfigurationManager.AppSettings["twitterConsumerKey"], + ConfigurationManager.AppSettings["twitterConsumerSecret"], + ConfigurationManager.AppSettings["twitterUserAccessToken"], + ConfigurationManager.AppSettings["twitterUserAccessSecret"]); + Tweetinvi.User.GetAuthenticatedUser(); + + var searchParameter = new SearchTweetsParameters("umbraco") { SearchType = SearchResultType.Recent }; + return Search.SearchTweets(searchParameter).ToArray(); + + }, TimeSpan.FromMinutes(2)); + + var settingsNode = Umbraco.TypedContentAtRoot().FirstOrDefault(); + if (settingsNode != null) + { + var usernameFilter = settingsNode.GetPropertyValue("twitterFilterAccounts") + .ToLowerInvariant().Split(',').Where(x => x != string.Empty); + var wordFilter = settingsNode.GetPropertyValue("twitterFilterWords") + .ToLowerInvariant().Split(',').Where(x => x != string.Empty); + + filteredTweets = tweets.Where(x => + x.CreatedBy.UserIdentifier.ScreenName.ToLowerInvariant().ContainsAny(usernameFilter) == false + && x.Text.ToLowerInvariant().ContainsAny(wordFilter) == false) + .Take(numberOfResults) + .ToArray(); + } + } + catch (Exception ex) + { + LogHelper.Error("Could not get tweets", ex); + } + + return PartialView("~/Views/Partials/Home/TwitterSearchUmbraco.cshtml", filteredTweets); + } + } +} diff --git a/OurUmbraco/Forum/Controllers/LatestActivityController.cs b/OurUmbraco/Forum/Controllers/LatestActivityController.cs new file mode 100644 index 00000000..f355cf4b --- /dev/null +++ b/OurUmbraco/Forum/Controllers/LatestActivityController.cs @@ -0,0 +1,31 @@ +using System.Linq; +using System.Web.Mvc; +using OurUmbraco.Forum.Services; +using Umbraco.Web.Mvc; + +namespace OurUmbraco.Forum.Controllers +{ + public class LatestActivityController : SurfaceController + { + public ActionResult LatestActivity(int numberOfTopics = 6) + { + if (numberOfTopics > 30) + numberOfTopics = 6; + + var ts = new TopicService(ApplicationContext.DatabaseContext); + var topics = ts.GetLatestTopics(numberOfTopics).ToArray(); + foreach (var topic in topics) + { + var category = Umbraco.TypedContent(topic.ParentId); + if(category != null) + topic.CategoryName = category.Name; + + var member = Members.GetById(topic.LatestReplyAuthor) ?? Members.GetById(topic.MemberId); + if (member != null) + topic.LastReplyAuthorAvatar = Our.Utils.GetMemberAvatar(member, 100); + } + + return PartialView("~/Views/Partials/Home/LatestForumActivity.cshtml", topics); + } + } +} diff --git a/OurUmbraco/Forum/Models/ReadOnlyTopic.cs b/OurUmbraco/Forum/Models/ReadOnlyTopic.cs index b7f8ac1c..127e8028 100644 --- a/OurUmbraco/Forum/Models/ReadOnlyTopic.cs +++ b/OurUmbraco/Forum/Models/ReadOnlyTopic.cs @@ -16,5 +16,11 @@ namespace OurUmbraco.Forum.Models [ResultColumn("LastReplyAuthorName")] public string LastReplyAuthorName { get; set; } + + [ResultColumn("LastReplyAuthorAvatar")] + public string LastReplyAuthorAvatar { get; set; } + + [ResultColumn("CategoryName")] + public string CategoryName { get; set; } } } \ No newline at end of file diff --git a/OurUmbraco/NotificationsCore/Notifications/NewForumComment.cs b/OurUmbraco/NotificationsCore/Notifications/NewForumComment.cs index 17c2fe3b..95061d37 100644 --- a/OurUmbraco/NotificationsCore/Notifications/NewForumComment.cs +++ b/OurUmbraco/NotificationsCore/Notifications/NewForumComment.cs @@ -68,7 +68,7 @@ namespace OurUmbraco.NotificationsCore.Notifications var domain = _details.SelectSingleNode("//domain").InnerText; var body = _details.SelectSingleNode("//body").InnerText; body = string.Format(body, topic.Title, "https://" + domain + url + "#comment-" + comment.Id, memberName, - HttpUtility.HtmlDecode(umbraco.library.StripHtml(comment.Body))); + HttpUtility.HtmlDecode(comment.Body.StripHtml())); var mailMessage = new MailMessage { diff --git a/OurUmbraco/NotificationsCore/Notifications/NewForumTopic.cs b/OurUmbraco/NotificationsCore/Notifications/NewForumTopic.cs index d02711c3..b5db9f2e 100644 --- a/OurUmbraco/NotificationsCore/Notifications/NewForumTopic.cs +++ b/OurUmbraco/NotificationsCore/Notifications/NewForumTopic.cs @@ -68,7 +68,7 @@ namespace OurUmbraco.NotificationsCore.Notifications var body = _details.SelectSingleNode("//body").InnerText; body = string.Format(body, forum.Name, "https://" + domain + url, memberName, topic.Title, - HttpUtility.HtmlDecode(umbraco.library.StripHtml(topic.Body))); + HttpUtility.HtmlDecode(topic.Body.StripHtml())); var mailMessage = new MailMessage { diff --git a/OurUmbraco/Our/Api/CommunityController.cs b/OurUmbraco/Our/Api/CommunityController.cs index 65c4fd0a..f3f01de8 100644 --- a/OurUmbraco/Our/Api/CommunityController.cs +++ b/OurUmbraco/Our/Api/CommunityController.cs @@ -37,7 +37,7 @@ namespace OurUmbraco.Our.Api } break; case "gravatar": - var gravatarUrl = "http://www.gravatar.com/avatar/" + umbraco.library.md5(member.Email) + "?s=48&d=monsterid"; + var gravatarUrl = "https://www.gravatar.com/avatar/" + umbraco.library.md5(member.Email) + "?s=48&d=monsterid"; return SaveUrlAsBuddyIcon(gravatarUrl, member); } diff --git a/OurUmbraco/Our/Controllers/LoginController.cs b/OurUmbraco/Our/Controllers/LoginController.cs index 0831303d..7d49fef7 100644 --- a/OurUmbraco/Our/Controllers/LoginController.cs +++ b/OurUmbraco/Our/Controllers/LoginController.cs @@ -6,13 +6,14 @@ using System.Text; using System.Web.Mvc; using System.Web.Security; using OurUmbraco.Our.usercontrols; +using reCAPTCHA.MVC; using Umbraco.Core; using Umbraco.Web.Models; using Umbraco.Web.Mvc; namespace OurUmbraco.Our.Controllers { - public class LoginController: SurfaceController + public class LoginController : SurfaceController { [ChildActionOnly] public ActionResult RenderLogin() @@ -28,6 +29,7 @@ namespace OurUmbraco.Our.Controllers return PartialView("~/Views/Partials/Members/ForgotPassword.cshtml", loginModel); } + [CaptchaValidator] public ActionResult Login(LoginModel model) { if (ModelState.IsValid == false) @@ -83,6 +85,7 @@ namespace OurUmbraco.Our.Controllers return CurrentUmbracoPage(); } + [CaptchaValidator] public ActionResult ForgotPassword(LoginModel model) { if(string.IsNullOrWhiteSpace(model.Username)) @@ -119,8 +122,7 @@ namespace OurUmbraco.Our.Controllers if (m == null) { // Don't add an error and reveal that someone with this email address exists on this site - TempData["Success"] = true; - return RedirectToCurrentUmbracoPage(); + return Redirect(CurrentPage.Url + "?success=true"); } // Automatically approve all members, as we don't have an approval process now @@ -153,8 +155,7 @@ namespace OurUmbraco.Our.Controllers smtpClient.Send(mailMessage); } - TempData["Success"] = true; - return RedirectToCurrentUmbracoPage(); + return Redirect(CurrentPage.Url + "?success=true"); } private string RandomString(int size, bool lowerCase) diff --git a/OurUmbraco/Our/Controllers/RegisterController.cs b/OurUmbraco/Our/Controllers/RegisterController.cs index f6e73c74..e62595b7 100644 --- a/OurUmbraco/Our/Controllers/RegisterController.cs +++ b/OurUmbraco/Our/Controllers/RegisterController.cs @@ -6,6 +6,7 @@ using System.Web.Hosting; using System.Web.Mvc; using OurUmbraco.Our.Models; using OurUmbraco.Our.usercontrols; +using reCAPTCHA.MVC; using Umbraco.Core; using Umbraco.Core.Logging; using Umbraco.Core.Models; @@ -26,6 +27,7 @@ namespace OurUmbraco.Our.Controllers [HttpPost] [ValidateAntiForgeryToken] + [CaptchaValidator] public ActionResult HandleSubmit(RegisterModel model) { var locationInvalid = string.IsNullOrEmpty(model.Latitude) || string.IsNullOrEmpty(model.Longitude); @@ -41,7 +43,7 @@ namespace OurUmbraco.Our.Controllers } var memberService = Services.MemberService; - + if (memberService.GetByEmail(model.Email) != null) { ModelState.AddModelError("Email", "A member with that email address already exists"); @@ -60,6 +62,27 @@ namespace OurUmbraco.Our.Controllers return Redirect("/"); } + // these values are enforced in MemberDto which is internal ;-( + // we should really have ways to query for Core meta-data! + const int maxEmailLength = 400; + const int maxLoginNameLength = 200; + const int maxPasswordLength = 400; + const int maxPropertyLength = 400; + + if (model.Email != null && model.Email.Length > maxEmailLength + || model.Name != null && model.Name.Length > maxLoginNameLength + || model.Password != null && model.Password.Length > maxPasswordLength + || model.Location != null && model.Location.Length > maxPropertyLength + || model.Longitude != null && model.Longitude.Length > maxPropertyLength + || model.Latitude != null && model.Latitude.Length > maxPropertyLength + || model.TwitterAlias != null && model.TwitterAlias.Length > maxPropertyLength + ) + { + // has to be a rogue registration + // go away! + return Redirect("/"); + } + var member = memberService.CreateMember(model.Email, model.Email, model.Name, "member"); member.SetValue("location", model.Location); member.SetValue("longitude", model.Longitude); @@ -86,7 +109,7 @@ namespace OurUmbraco.Our.Controllers memberService.AssignRole(member.Username, "standard"); - memberService.SavePassword(member, model.Password); + memberService.SavePassword(member, model.Password); Members.Login(model.Email, model.Password); @@ -127,7 +150,7 @@ namespace OurUmbraco.Our.Controllers private static string GetAvatarPath(IMembershipUser member) { - var url = "http://www.gravatar.com/avatar/" + member.Email.ToMd5() + "?s=400&d=retro"; + var url = "https://www.gravatar.com/avatar/" + member.Email.ToMd5() + "?s=400&d=retro"; try { diff --git a/OurUmbraco/Our/CustomHandlers/OurApplicationStartupHandler.cs b/OurUmbraco/Our/CustomHandlers/OurApplicationStartupHandler.cs index b68d9e44..d1a163cd 100644 --- a/OurUmbraco/Our/CustomHandlers/OurApplicationStartupHandler.cs +++ b/OurUmbraco/Our/CustomHandlers/OurApplicationStartupHandler.cs @@ -20,6 +20,7 @@ namespace OurUmbraco.Our.CustomHandlers { BindExamineEvents(); ZipDownloader.OnFinish += ZipDownloader_OnFinish; + FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); } private void BindExamineEvents() diff --git a/OurUmbraco/Our/CustomHandlers/ProjectIndexer.cs b/OurUmbraco/Our/CustomHandlers/ProjectIndexer.cs index 1dd4f026..8dfe7054 100644 --- a/OurUmbraco/Our/CustomHandlers/ProjectIndexer.cs +++ b/OurUmbraco/Our/CustomHandlers/ProjectIndexer.cs @@ -6,6 +6,7 @@ using Examine.LuceneEngine.Providers; using OurUmbraco.Our.Examine; using OurUmbraco.Wiki.BusinessLogic; using Umbraco.Core; +using Umbraco.Core.Logging; using Umbraco.Core.Models; using Umbraco.Core.Models.EntityBase; using Umbraco.Core.Services; @@ -64,12 +65,15 @@ namespace OurUmbraco.Our.CustomHandlers var projectVotes = Utils.GetProjectTotalVotes(content.Id); var files = WikiFile.CurrentFiles(content.Id).ToArray(); - var compatVersions = Utils.GetProjectCompatibleVersions(content.Id); - + var compatVersions = Utils.GetProjectCompatibleVersions(content.Id) ?? new List(); + var simpleDataIndexer = (SimpleDataIndexer)ExamineManager.Instance.IndexProviderCollection["projectIndexer"]; simpleDataSet = ((ProjectNodeIndexDataService)simpleDataIndexer.DataService) .MapProjectToSimpleDataIndexItem(content, simpleDataSet, "project", projectVotes, files, downloads, compatVersions); + if (simpleDataSet.NodeDefinition.Type == null) + simpleDataSet.NodeDefinition.Type = "project"; + var xml = simpleDataSet.RowData.ToExamineXml(simpleDataSet.NodeDefinition.NodeId, simpleDataSet.NodeDefinition.Type); simpleDataIndexer.ReIndexNode(xml, "project"); } diff --git a/OurUmbraco/Our/ErrorHandler/AiHandleErrorAttribute.cs b/OurUmbraco/Our/ErrorHandler/AiHandleErrorAttribute.cs new file mode 100644 index 00000000..d11de830 --- /dev/null +++ b/OurUmbraco/Our/ErrorHandler/AiHandleErrorAttribute.cs @@ -0,0 +1 @@ +using System; using System.Web.Mvc; using Microsoft.ApplicationInsights; namespace OurUmbraco.Our.ErrorHandler { [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, Inherited = true, AllowMultiple = true)] public class AiHandleErrorAttribute : HandleErrorAttribute { public override void OnException(ExceptionContext filterContext) { if (filterContext != null && filterContext.HttpContext != null && filterContext.Exception != null) { //If customError is Off, then AI HTTPModule will report the exception if (filterContext.HttpContext.IsCustomErrorEnabled) { var ai = new TelemetryClient(); ai.TrackException(filterContext.Exception); } } base.OnException(filterContext); } } } \ No newline at end of file diff --git a/OurUmbraco/Our/Examine/ExamineHelper.cs b/OurUmbraco/Our/Examine/ExamineHelper.cs index cbdbd209..61f6b26e 100644 --- a/OurUmbraco/Our/Examine/ExamineHelper.cs +++ b/OurUmbraco/Our/Examine/ExamineHelper.cs @@ -5,6 +5,7 @@ using System.Linq; using System.Text.RegularExpressions; using Examine; using Examine.LuceneEngine; +using Umbraco.Core; using Umbraco.Core.Logging; namespace OurUmbraco.Our.Examine @@ -45,7 +46,7 @@ namespace OurUmbraco.Our.Examine lines.AddRange(File.ReadAllLines(file.FullName)); var body = lines.Any() - ? umbraco.library.StripHtml(RemoveSpecialCharacters(string.Join("", lines))) + ? RemoveSpecialCharacters(string.Join("", lines)).StripHtml() : string.Empty; var firstHeadline = lines.FirstOrDefault(x => x.StartsWith("#")); diff --git a/OurUmbraco/Our/Examine/ForumDataService.cs b/OurUmbraco/Our/Examine/ForumDataService.cs index f484059f..d4833018 100644 --- a/OurUmbraco/Our/Examine/ForumDataService.cs +++ b/OurUmbraco/Our/Examine/ForumDataService.cs @@ -23,7 +23,7 @@ namespace OurUmbraco.Our.Examine foreach (var currentComment in topic.Comments.Where(c => c.IsSpam == false)) commentText += currentComment.Body; - var body = library.StripHtml(topic.Body + commentText); + var body = (topic.Body + commentText).StripHtml(); simpleDataSet.NodeDefinition.NodeId = id; simpleDataSet.NodeDefinition.Type = indexType; diff --git a/OurUmbraco/Our/Examine/ProjectNodeIndexDataService.cs b/OurUmbraco/Our/Examine/ProjectNodeIndexDataService.cs index b74f4fbe..d8a57031 100644 --- a/OurUmbraco/Our/Examine/ProjectNodeIndexDataService.cs +++ b/OurUmbraco/Our/Examine/ProjectNodeIndexDataService.cs @@ -216,7 +216,7 @@ namespace OurUmbraco.Our.Examine //remove the current version field from the lucene doc e.Document.RemoveField("body"); //add a 'body' field with stripped html - e.Document.Add(new Field("body", library.StripHtml(e.Fields["body"]), Field.Store.YES, Field.Index.ANALYZED, Field.TermVector.YES)); + e.Document.Add(new Field("body", e.Fields["body"].StripHtml(), Field.Store.YES, Field.Index.ANALYZED, Field.TermVector.YES)); } //If there is a versions field, we'll split it and index the same field on each version diff --git a/OurUmbraco/Our/Extensions/StringExtensions.cs b/OurUmbraco/Our/Extensions/StringExtensions.cs index ce2b7149..7362b8cf 100644 --- a/OurUmbraco/Our/Extensions/StringExtensions.cs +++ b/OurUmbraco/Our/Extensions/StringExtensions.cs @@ -12,8 +12,8 @@ namespace OurUmbraco.Our.Extensions public static string MakeSearchQuerySafe(this string query) { if (query == null) return string.Empty; - var regex = new Regex(@"[^\w\s-]"); - return regex.Replace(query, " "); + var regex = new Regex(@"[^\w\s]"); + return regex.Replace(query, " ").ToLowerInvariant(); } } } diff --git a/OurUmbraco/Our/FilterConfig.cs b/OurUmbraco/Our/FilterConfig.cs new file mode 100644 index 00000000..e028d249 --- /dev/null +++ b/OurUmbraco/Our/FilterConfig.cs @@ -0,0 +1,13 @@ +using System.Web.Mvc; +using OurUmbraco.Our.ErrorHandler; + +namespace OurUmbraco.Our +{ + public class FilterConfig + { + public static void RegisterGlobalFilters(GlobalFilterCollection filters) + { + filters.Add(new AiHandleErrorAttribute()); + } + } +} \ No newline at end of file diff --git a/OurUmbraco/Our/MigrationsHandler.cs b/OurUmbraco/Our/MigrationsHandler.cs index ba462f39..998bbb10 100644 --- a/OurUmbraco/Our/MigrationsHandler.cs +++ b/OurUmbraco/Our/MigrationsHandler.cs @@ -7,7 +7,6 @@ using System.Web.Hosting; using Umbraco.Core; using Umbraco.Core.Logging; using Umbraco.Core.Models; -using Umbraco.Web; using File = System.IO.File; using Macro = umbraco.cms.businesslogic.macro.Macro; @@ -33,16 +32,18 @@ namespace OurUmbraco.Our UseNewRegistrationForm(); AddStrictMinimumVersionForPackages(); AddSearchDocumentTypeAndPage(); - UseNewLoginForm(); - UseNewForgotPasswordForm(); UseNewMyProjectsOverview(); UseNewRssFeedsOverview(); RenameUaaStoUCloud(); AddMarkAsSolutionReminderSent(); RenameUaaStoUCloud(); AddMarkAsSolutionReminderSent(); + UseNewLoginForm(); + UseNewForgotPasswordForm(); + AddTwitterFilters(); + AddHomeScriptsMacro(); } - + private void EnsureMigrationsMarkerPathExists() { var path = HostingEnvironment.MapPath(MigrationMarkersPath); @@ -593,56 +594,6 @@ namespace OurUmbraco.Our } } - private void UseNewLoginForm() - { - var migrationName = MethodBase.GetCurrentMethod().Name; - - try - { - var path = HostingEnvironment.MapPath(MigrationMarkersPath + migrationName + ".txt"); - if (File.Exists(path)) - return; - - var macroService = ApplicationContext.Current.Services.MacroService; - var macro = macroService.GetByAlias("MemberLogin"); - macro.ControlType = ""; - macro.ScriptPath = "~/Views/MacroPartials/Members/Login.cshtml"; - macroService.Save(macro); - - string[] lines = { "" }; - File.WriteAllLines(path, lines); - } - catch (Exception ex) - { - LogHelper.Error(string.Format("Migration: '{0}' failed", migrationName), ex); - } - } - - private void UseNewForgotPasswordForm() - { - var migrationName = MethodBase.GetCurrentMethod().Name; - - try - { - var path = HostingEnvironment.MapPath(MigrationMarkersPath + migrationName + ".txt"); - if (File.Exists(path)) - return; - - var macroService = ApplicationContext.Current.Services.MacroService; - var macro = macroService.GetByAlias("MemberPasswordReminder"); - macro.ControlType = ""; - macro.ScriptPath = "~/Views/MacroPartials/Members/ForgotPassword.cshtml"; - macroService.Save(macro); - - string[] lines = { "" }; - File.WriteAllLines(path, lines); - } - catch (Exception ex) - { - LogHelper.Error(string.Format("Migration: '{0}' failed", migrationName), ex); - } - } - private void UseNewMyProjectsOverview() { var migrationName = MethodBase.GetCurrentMethod().Name; @@ -818,5 +769,135 @@ namespace OurUmbraco.Our LogHelper.Error(string.Format("Migration: '{0}' failed", migrationName), ex); } } + + private void UseNewLoginForm() + { + var migrationName = MethodBase.GetCurrentMethod().Name; + + try + { + var path = HostingEnvironment.MapPath(MigrationMarkersPath + migrationName + ".txt"); + if (File.Exists(path)) + return; + + var macroService = ApplicationContext.Current.Services.MacroService; + var macro = macroService.GetByAlias("MemberLogin"); + macro.ControlType = ""; + macro.ScriptPath = "~/Views/MacroPartials/Members/Login.cshtml"; + macroService.Save(macro); + + string[] lines = { "" }; + File.WriteAllLines(path, lines); + } + catch (Exception ex) + { + LogHelper.Error(string.Format("Migration: '{0}' failed", migrationName), ex); + } + } + + private void UseNewForgotPasswordForm() + { + var migrationName = MethodBase.GetCurrentMethod().Name; + + try + { + var path = HostingEnvironment.MapPath(MigrationMarkersPath + migrationName + ".txt"); + if (File.Exists(path)) + return; + + var macroService = ApplicationContext.Current.Services.MacroService; + var macro = macroService.GetByAlias("MemberPasswordReminder"); + macro.ControlType = ""; + macro.ScriptPath = "~/Views/MacroPartials/Members/ForgotPassword.cshtml"; + macroService.Save(macro); + + string[] lines = { "" }; + File.WriteAllLines(path, lines); + } + catch (Exception ex) + { + LogHelper.Error(string.Format("Migration: '{0}' failed", migrationName), ex); + } + } + + private void AddTwitterFilters() + { + var migrationName = MethodBase.GetCurrentMethod().Name; + + try + { + var path = HostingEnvironment.MapPath(MigrationMarkersPath + migrationName + ".txt"); + if (File.Exists(path)) + return; + + var contentTypeService = ApplicationContext.Current.Services.ContentTypeService; + var communityContentType = contentTypeService.GetContentType("Community"); + var propertyTypeAlias = "twitterFilterAccounts"; + var textboxMultiple = new DataTypeDefinition("Umbraco.TextboxMultiple"); + + var tabName = "Settings"; + if (communityContentType.PropertyGroups.Contains(tabName) == false) + communityContentType.AddPropertyGroup(tabName); + + if (communityContentType.PropertyTypeExists(propertyTypeAlias) == false) + { + var textboxAccountsFilter = new PropertyType(textboxMultiple, propertyTypeAlias) { Name = "CSV of Twitter accounts to filter" }; + communityContentType.AddPropertyType(textboxAccountsFilter, tabName); + } + + propertyTypeAlias = "twitterFilterWords"; + if (communityContentType.PropertyTypeExists(propertyTypeAlias) == false) + { + var textboxWordFilter = new PropertyType(textboxMultiple, propertyTypeAlias) { Name = "CSV of words filter tweets out" }; + communityContentType.AddPropertyType(textboxWordFilter, tabName); + } + + contentTypeService.Save(communityContentType); + + string[] lines = { "" }; + File.WriteAllLines(path, lines); + } + catch (Exception ex) + { + LogHelper.Error(string.Format("Migration: '{0}' failed", migrationName), ex); + } + } + + + private void AddHomeScriptsMacro() + { + var migrationName = MethodBase.GetCurrentMethod().Name; + + try + { + var path = HostingEnvironment.MapPath(MigrationMarkersPath + migrationName + ".txt"); + if (File.Exists(path)) + return; + + var macroService = ApplicationContext.Current.Services.MacroService; + var macroAlias = "CommunityHomeScripts"; + if (macroService.GetByAlias(macroAlias) == null) + { + // Run migration + + var macro = new Macro + { + Name = "[Community] Home Scripts", + Alias = macroAlias, + ScriptingFile = "~/Views/MacroPartials/Community/Scripts.cshtml", + UseInEditor = false + }; + macro.Save(); + } + + string[] lines = { "" }; + File.WriteAllLines(path, lines); + } + catch (Exception ex) + { + LogHelper.Error(string.Format("Migration: '{0}' failed", migrationName), ex); + } + } + } } \ No newline at end of file diff --git a/OurUmbraco/Our/Utils.cs b/OurUmbraco/Our/Utils.cs index b45e7d69..2b0229b2 100644 --- a/OurUmbraco/Our/Utils.cs +++ b/OurUmbraco/Our/Utils.cs @@ -238,6 +238,9 @@ namespace OurUmbraco.Our if (hasAvatar) { var avatarPath = member.GetPropertyValue("avatar").ToString(); + if (avatarPath.StartsWith("http://") || avatarPath.StartsWith("https://")) + return avatarPath; + var path = HostingEnvironment.MapPath(avatarPath); if (System.IO.File.Exists(path)) return path; @@ -286,6 +289,9 @@ namespace OurUmbraco.Our { try { + if (memberAvatarPath.StartsWith("http://") || memberAvatarPath.StartsWith("https://")) + return null; + return Image.FromFile(memberAvatarPath); } catch (Exception ex) diff --git a/OurUmbraco/Our/usercontrols/FileDownloadProxy.ascx b/OurUmbraco/Our/usercontrols/FileDownloadProxy.ascx deleted file mode 100644 index 60aee6f4..00000000 --- a/OurUmbraco/Our/usercontrols/FileDownloadProxy.ascx +++ /dev/null @@ -1 +0,0 @@ -<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="FileDownloadProxy.ascx.cs" Inherits="OurUmbraco.Our.usercontrols.FileDownloadProxy" %> diff --git a/OurUmbraco/Our/usercontrols/FileDownloadProxy.ascx.cs b/OurUmbraco/Our/usercontrols/FileDownloadProxy.ascx.cs deleted file mode 100644 index 29c717ae..00000000 --- a/OurUmbraco/Our/usercontrols/FileDownloadProxy.ascx.cs +++ /dev/null @@ -1,83 +0,0 @@ -using System; -using OurUmbraco.Wiki.BusinessLogic; -using BL = umbraco.BusinessLogic; - -namespace OurUmbraco.Our.usercontrols -{ - public partial class FileDownloadProxy : System.Web.UI.UserControl - { - protected void Page_Load(object sender, EventArgs e) - { - if (Request["id"] == null) - return; - - var fileId = int.Parse(Request["id"]); - - var wikiFile = new WikiFile(fileId); - - wikiFile.UpdateDownloadCounter(false, wikiFile.FileType == "package"); - using (var sqlHelper = BL.Application.SqlHelper) - { - var path = sqlHelper.ExecuteScalar( - "Select path from wikiFiles where id = @id;", - sqlHelper.CreateParameter("@id", fileId)); - - var file = sqlHelper.ExecuteScalar( - "Select name from wikiFiles where id = @id;", - sqlHelper.CreateParameter("@id", fileId)); - - var fileinfo = new System.IO.FileInfo(Server.MapPath(path)); - - var extension = System.IO.Path.GetExtension(Server.MapPath(path)); - var type = ""; - // set known types based on file extension - if (extension != null) - { - switch (extension.ToLower()) - { - case ".tif": - case ".tiff": - type = "image/tiff"; - break; - case ".jpg": - case ".jpeg": - type = "image/jpeg"; - break; - case ".gif": - type = "image/gif"; - break; - case ".docx": - case ".doc": - case ".rtf": - type = "Application/msword"; - break; - case ".pdf": - type = "Application/pdf"; - break; - case ".png": - type = "image/png"; - break; - case ".bmp": - type = "image/bmp"; - break; - default: - type = "application/octet-stream"; - break; - } - } - - Response.Clear(); - - Response.AddHeader("Content-Disposition", "attachment; filename= " + MakeSafeFileName(file)); - Response.AddHeader("Content-Length", fileinfo.Length.ToString()); - Response.ContentType = type; - Response.WriteFile(path); - } - } - - private string MakeSafeFileName(string orig) - { - return orig.Replace(" ","-"); - } - } -} \ No newline at end of file diff --git a/OurUmbraco/Our/usercontrols/FileDownloadProxy.ascx.designer.cs b/OurUmbraco/Our/usercontrols/FileDownloadProxy.ascx.designer.cs deleted file mode 100644 index 2e0384e0..00000000 --- a/OurUmbraco/Our/usercontrols/FileDownloadProxy.ascx.designer.cs +++ /dev/null @@ -1,15 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace OurUmbraco.Our.usercontrols { - - - public partial class FileDownloadProxy { - } -} diff --git a/OurUmbraco/Our/usercontrols/__Signup.ascx.cs b/OurUmbraco/Our/usercontrols/__Signup.ascx.cs index e674b8d1..0330d493 100644 --- a/OurUmbraco/Our/usercontrols/__Signup.ascx.cs +++ b/OurUmbraco/Our/usercontrols/__Signup.ascx.cs @@ -180,7 +180,7 @@ namespace OurUmbraco.Our.usercontrols private static string GetAvatarPath(IMember member) { - var url = "http://www.gravatar.com/avatar/" + member.Email.ToMd5() + "?s=400&d=retro"; + var url = "https://www.gravatar.com/avatar/" + member.Email.ToMd5() + "?s=400&d=retro"; try { diff --git a/OurUmbraco/OurUmbraco.csproj b/OurUmbraco/OurUmbraco.csproj index 2ad8f23c..f58cf420 100644 --- a/OurUmbraco/OurUmbraco.csproj +++ b/OurUmbraco/OurUmbraco.csproj @@ -12,6 +12,8 @@ v4.5.2 512 + + true @@ -31,6 +33,10 @@ 4 + + ..\packages\Autofac.3.5.2\lib\net40\Autofac.dll + True + ..\packages\AutoMapper.3.3.1\lib\net40\AutoMapper.dll True @@ -71,12 +77,12 @@ ..\packages\Examine.0.1.80\lib\net45\Examine.dll True - - ..\packages\Hangfire.Core.1.6.7\lib\net45\Hangfire.Core.dll + + ..\packages\Hangfire.Core.1.6.8\lib\net45\Hangfire.Core.dll True - - ..\packages\Hangfire.SqlServer.1.6.7\lib\net45\Hangfire.SqlServer.dll + + ..\packages\Hangfire.SqlServer.1.6.8\lib\net45\Hangfire.SqlServer.dll True @@ -123,6 +129,10 @@ ..\packages\UmbracoCms.Core.7.5.7\lib\Microsoft.ApplicationBlocks.Data.dll True + + ..\packages\Microsoft.ApplicationInsights.2.2.0\lib\net45\Microsoft.ApplicationInsights.dll + True + ..\packages\Microsoft.AspNet.Identity.Core.2.2.1\lib\net45\Microsoft.AspNet.Identity.Core.dll True @@ -131,6 +141,38 @@ ..\packages\Microsoft.AspNet.Identity.Owin.2.2.1\lib\net45\Microsoft.AspNet.Identity.Owin.dll True + + ..\packages\Microsoft.Extensions.Configuration.1.1.0\lib\netstandard1.1\Microsoft.Extensions.Configuration.dll + True + + + ..\packages\Microsoft.Extensions.Configuration.Abstractions.1.1.0\lib\netstandard1.0\Microsoft.Extensions.Configuration.Abstractions.dll + True + + + ..\packages\Microsoft.Extensions.Configuration.FileExtensions.1.1.0\lib\net451\Microsoft.Extensions.Configuration.FileExtensions.dll + True + + + ..\packages\Microsoft.Extensions.Configuration.Json.1.1.0\lib\net451\Microsoft.Extensions.Configuration.Json.dll + True + + + ..\packages\Microsoft.Extensions.FileProviders.Abstractions.1.1.0\lib\netstandard1.0\Microsoft.Extensions.FileProviders.Abstractions.dll + True + + + ..\packages\Microsoft.Extensions.FileProviders.Physical.1.1.0\lib\net451\Microsoft.Extensions.FileProviders.Physical.dll + True + + + ..\packages\Microsoft.Extensions.FileSystemGlobbing.1.1.0\lib\net45\Microsoft.Extensions.FileSystemGlobbing.dll + True + + + ..\packages\Microsoft.Extensions.Primitives.1.1.0\lib\netstandard1.0\Microsoft.Extensions.Primitives.dll + True + ..\packages\Microsoft.IO.RecyclableMemoryStream.1.2.0\lib\net45\Microsoft.IO.RecyclableMemoryStream.dll True @@ -159,6 +201,18 @@ ..\packages\Microsoft.Owin.Security.OAuth.3.0.1\lib\net45\Microsoft.Owin.Security.OAuth.dll True + + ..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.dll + True + + + ..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.dll + True + + + ..\packages\Microsoft.Bcl.Async.1.0.168\lib\net40\Microsoft.Threading.Tasks.Extensions.Desktop.dll + True + ..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll True @@ -171,14 +225,18 @@ ..\packages\MySql.Data.6.9.8\lib\net45\MySql.Data.dll True - - ..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll + + ..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll True ..\packages\Owin.1.0\lib\net40\Owin.dll True + + ..\packages\reCAPTCH.MVC.1.0.1\lib\net45\reCAPTCHA.MVC.dll + True + ..\packages\RestSharp.104.1\lib\net4\RestSharp.dll True @@ -192,6 +250,7 @@ True + @@ -205,12 +264,31 @@ True + + + + ..\packages\Microsoft.Net.Http.2.2.29\lib\net45\System.Net.Http.Extensions.dll + True + ..\packages\Microsoft.AspNet.WebApi.Client.5.2.3\lib\net45\System.Net.Http.Formatting.dll True + + ..\packages\Microsoft.Net.Http.2.2.29\lib\net45\System.Net.Http.Primitives.dll + True + + + + ..\packages\System.Runtime.CompilerServices.Unsafe.4.3.0\lib\netstandard1.0\System.Runtime.CompilerServices.Unsafe.dll + True + + + ..\packages\System.Runtime.InteropServices.RuntimeInformation.4.3.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll + True + @@ -266,6 +344,10 @@ ..\packages\UmbracoCms.Core.7.5.7\lib\TidyNet.dll True + + ..\packages\TweetinviAPI.1.2.0\lib\net45\Tweetinvi.dll + True + ..\packages\UmbracoCms.Core.7.5.7\lib\umbraco.dll True @@ -313,6 +395,7 @@ + @@ -342,6 +425,7 @@ + @@ -449,6 +533,7 @@ + @@ -460,6 +545,7 @@ + diff --git a/OurUmbraco/Project/ProjectExtensions.cs b/OurUmbraco/Project/ProjectExtensions.cs index 60e54e8f..eec45567 100644 --- a/OurUmbraco/Project/ProjectExtensions.cs +++ b/OurUmbraco/Project/ProjectExtensions.cs @@ -99,7 +99,7 @@ namespace OurUmbraco.Project public static string StripHtmlAndLimit(this String str, int chars) { - str = umbraco.library.StripHtml(str); + str = str.StripHtml(); if (str.Length > chars) str = str.Substring(0, chars); diff --git a/OurUmbraco/Wiki/BusinessLogic/WikiFile.cs b/OurUmbraco/Wiki/BusinessLogic/WikiFile.cs index f9da9d23..96c34be7 100644 --- a/OurUmbraco/Wiki/BusinessLogic/WikiFile.cs +++ b/OurUmbraco/Wiki/BusinessLogic/WikiFile.cs @@ -395,7 +395,8 @@ namespace OurUmbraco.Wiki.BusinessLogic } else { - throw new ArgumentException(string.Format("No node exists with id '{0}'", Id)); + HttpContext.Current.Response.StatusCode = 404; + HttpContext.Current.Response.End(); } } } diff --git a/OurUmbraco/app.config b/OurUmbraco/app.config index dd85d62e..871d80d3 100644 --- a/OurUmbraco/app.config +++ b/OurUmbraco/app.config @@ -33,7 +33,7 @@ - + diff --git a/OurUmbraco/packages.config b/OurUmbraco/packages.config index 106bbd96..0506180d 100644 --- a/OurUmbraco/packages.config +++ b/OurUmbraco/packages.config @@ -6,9 +6,9 @@ - - - + + + @@ -17,6 +17,7 @@ + @@ -28,7 +29,17 @@ + + + + + + + + + + @@ -38,11 +49,45 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/live.proj b/live.proj index fbceb072..2e5d0098 100644 --- a/live.proj +++ b/live.proj @@ -1,4 +1,4 @@ - + .\ .\OurUmbraco.Site\ @@ -10,20 +10,28 @@ - + $(SourceDirectory)web.config $(DeployHelperDirectory)\$(ProjectName)\ConfigTransforms\Web.$(Environment).config - $(DeployHelperDirectory)\$(ProjectName)\$(Environment)\ + $(SourceDirectory)ApplicationInsights.config + $(DeployHelperDirectory)\$(ProjectName)\ConfigTransforms\ApplicationInsights.$(Environment).config + $(DeployHelperDirectory)\$(ProjectName)\$(Environment)\ + False - + + + \ No newline at end of file