public void ClassifyLink() { ExTraceGlobals.DocumentsCallTracer.TraceDebug((long)this.GetHashCode(), "DocumentLibraryEventHandler.ClassifyLink"); string text = (string)base.GetParameter("uri"); Uri uri = Utilities.TryParseUri(text); if (uri == null && !text.StartsWith("\\\\", StringComparison.Ordinal)) { text = "http://" + text; uri = Utilities.TryParseUri(text); } if (uri == null || string.IsNullOrEmpty(uri.Scheme) || string.IsNullOrEmpty(uri.Host)) { ExTraceGlobals.DocumentsTracer.TraceDebug(0L, "Cannot parse a Uri from string."); base.RenderPartialFailure(-2054976140, new Strings.IDs?(-381883412), ButtonDialogIcon.Warning); return; } if (!DocumentLibraryUtilities.IsTrustedProtocol(uri.Scheme)) { ExTraceGlobals.DocumentsTracer.TraceDebug(0L, "URI protocol is not http, https or file."); base.RenderPartialFailure(1453018462, new Strings.IDs?(-743095750), ButtonDialogIcon.Information); return; } if (!DocumentLibraryUtilities.IsInternalUri(uri.Host, base.UserContext)) { ExTraceGlobals.DocumentsTracer.TraceDebug(0L, "Not an internal URI"); base.RenderPartialFailure(-1721073157, new Strings.IDs?(1325518514), ButtonDialogIcon.Warning); return; } if (DocumentLibraryUtilities.IsBlockedHostName(uri.Host, base.UserContext)) { ExTraceGlobals.DocumentsTracer.TraceDebug(0L, "Host name is in the blocked list."); base.RenderPartialFailure(343095135, new Strings.IDs?(-777407791), ButtonDialogIcon.Warning); return; } ClassifyResult documentLibraryObjectId = DocumentLibraryUtilities.GetDocumentLibraryObjectId(uri, base.UserContext); if (documentLibraryObjectId.Error != ClassificationError.None) { if (documentLibraryObjectId.Error == ClassificationError.ConnectionFailed) { ExTraceGlobals.DocumentsTracer.TraceDebug(0L, "Connection could not be made to server."); base.RenderPartialFailure(678272416, new Strings.IDs?(-820112926), ButtonDialogIcon.Warning); return; } if (documentLibraryObjectId.Error == ClassificationError.ObjectNotFound) { ExTraceGlobals.DocumentsTracer.TraceDebug(0L, "URI object not found."); base.RenderPartialFailure(-54320700, new Strings.IDs?(1599334062), ButtonDialogIcon.Warning); return; } if (documentLibraryObjectId.Error == ClassificationError.AccessDenied) { ExTraceGlobals.DocumentsTracer.TraceDebug(0L, "URI access is denied."); if (Utilities.IsBasicAuthentication(base.OwaContext.HttpContext.Request)) { base.RenderPartialFailure(234621291, new Strings.IDs?(-3401788), ButtonDialogIcon.Warning); return; } base.RenderPartialFailure(1819837349, new Strings.IDs?(-3401788), ButtonDialogIcon.Warning); return; } else { if (documentLibraryObjectId.Error == ClassificationError.UriTypeNotSupported) { ExTraceGlobals.DocumentsTracer.TraceDebug(0L, "URI is not supported."); base.RenderPartialFailure(1453018462, new Strings.IDs?(-743095750), ButtonDialogIcon.Information); return; } if (documentLibraryObjectId.Error == ClassificationError.InvalidUri) { ExTraceGlobals.DocumentsTracer.TraceDebug(0L, "URI was Invalid."); base.RenderPartialFailure(-2054976140, new Strings.IDs?(-381883412), ButtonDialogIcon.Warning); return; } if (documentLibraryObjectId.Error == ClassificationError.ProxyError) { ExTraceGlobals.DocumentsTracer.TraceDebug(0L, "URI was Invalid."); base.RenderPartialFailure(1454208029, new Strings.IDs?(1335662059), ButtonDialogIcon.Warning); return; } ExTraceGlobals.DocumentsTracer.TraceDebug(0L, "Other classification error. ClassifyResult.Error: " + documentLibraryObjectId.Error.ToString()); base.RenderPartialFailure(-785304559, new Strings.IDs?(-86901060), ButtonDialogIcon.Warning); return; } } else { DocumentLibraryObjectId objectId = documentLibraryObjectId.ObjectId; if (objectId == null) { ExTraceGlobals.DocumentsTracer.TraceDebug(0L, "ObjectId could not be created from Uri"); base.RenderPartialFailure(-2054976140, new Strings.IDs?(-381883412), ButtonDialogIcon.Warning); return; } UriFlags uriFlags = objectId.UriFlags; bool flag = (uriFlags & UriFlags.Sharepoint) == UriFlags.Sharepoint; bool flag2 = (uriFlags & UriFlags.Unc) == UriFlags.Unc; bool flag3 = DocumentLibraryUtilities.IsNavigationToWSSAllowed(base.UserContext); bool flag4 = DocumentLibraryUtilities.IsNavigationToUNCAllowed(base.UserContext); if (objectId.UriFlags == UriFlags.Other) { ExTraceGlobals.DocumentsTracer.TraceDebug(0L, "Link could not be classified as Sharepoint or UNC"); if (flag4 && flag3) { base.RenderPartialFailure(1528018289, new Strings.IDs?(-743095750), ButtonDialogIcon.Information); return; } if (flag4) { base.RenderPartialFailure(-1758685302, new Strings.IDs?(-743095750), ButtonDialogIcon.Information); return; } if (flag3) { base.RenderPartialFailure(762710799, new Strings.IDs?(-743095750), ButtonDialogIcon.Information); } return; } else { if ((flag2 && !flag4) || (flag && !flag3)) { ExTraceGlobals.DocumentsTracer.TraceDebug(0L, "Segmentation failure. Access Denied"); base.RenderPartialFailure(flag2 ? 813043446 : -972777689, new Strings.IDs?(-3401788), ButtonDialogIcon.Warning); return; } this.Writer.Write("<div id=uri>"); this.Writer.Write(text); this.Writer.Write("</div><div id=uf>"); this.Writer.Write((int)uriFlags); this.Writer.Write("</div><div id=oid>"); this.Writer.Write(objectId.ToBase64String()); this.Writer.Write("</div>"); AttachmentPolicy attachmentPolicy = base.UserContext.AttachmentPolicy; this.Writer.Write("<div id=divFwr>"); this.Writer.Write((attachmentPolicy.ForceWebReadyDocumentViewingFirst && DocumentLibraryUtilities.IsWebReadyDocument(objectId, base.UserContext)) ? 1 : 0); this.Writer.Write("</div>"); return; } } }
// Token: 0x0600302E RID: 12334 RVA: 0x00119E0C File Offset: 0x0011800C public static DocumentLibraryObjectId CreateDocumentLibraryObjectId(OwaContext owaContext) { DocumentLibraryObjectId documentLibraryObjectId = null; if (owaContext == null) { throw new ArgumentNullException("owaContext"); } HttpContext httpContext = owaContext.HttpContext; HttpRequest request = httpContext.Request; string queryStringParameter = Utilities.GetQueryStringParameter(request, "TranslatedURL", false); bool flag = !string.IsNullOrEmpty(queryStringParameter); string queryStringParameter2 = Utilities.GetQueryStringParameter(request, "id", false); bool flag2 = !string.IsNullOrEmpty(queryStringParameter2); Uri uri; if (!flag2) { string queryStringParameter3 = Utilities.GetQueryStringParameter(request, "URL", false); uri = Utilities.TryParseUri(queryStringParameter3); } else { documentLibraryObjectId = DocumentLibraryObjectId.Deserialize(queryStringParameter2); if (documentLibraryObjectId == null) { ExTraceGlobals.DocumentsTracer.TraceDebug(0L, "Other classification error. objectId " + queryStringParameter2); Utilities.TransferToErrorPage(owaContext, LocalizedStrings.GetNonEncoded(-785304559), null, ThemeFileId.Warning, true); return(null); } if (documentLibraryObjectId is UncObjectId) { uri = (documentLibraryObjectId as UncObjectId).Path; } else { uri = (documentLibraryObjectId as SharepointSiteId).SiteUri; } } if (uri == null || string.IsNullOrEmpty(uri.Host) || string.IsNullOrEmpty(uri.Scheme)) { ExTraceGlobals.DocumentsTracer.TraceDebug(0L, "URI was Invalid."); Utilities.TransferToErrorPage(owaContext, LocalizedStrings.GetNonEncoded(-2054976140), flag ? string.Format(LocalizedStrings.GetHtmlEncoded(-666455008), "<a href=\"" + Utilities.UrlEncode(queryStringParameter) + "\" target=\"_blank\" class=lnk>", "</a>") : null, ThemeFileId.Warning, true); return(null); } if (!DocumentLibraryUtilities.IsTrustedProtocol(uri.Scheme)) { ExTraceGlobals.DocumentsTracer.TraceDebug(0L, "URI protocol is not http, https or file."); Utilities.TransferToErrorPage(owaContext, LocalizedStrings.GetNonEncoded(1453018462), null, ThemeFileId.ButtonDialogInfo, true); return(null); } if (!DocumentLibraryUtilities.IsInternalUri(uri.Host, owaContext.UserContext)) { ExTraceGlobals.DocumentsTracer.TraceDebug(0L, "URI was not internal."); Utilities.TransferToErrorPage(owaContext, LocalizedStrings.GetNonEncoded(-1721073157), null, ThemeFileId.Warning, true); return(null); } if (DocumentLibraryUtilities.IsBlockedHostName(uri.Host, owaContext.UserContext)) { ExTraceGlobals.DocumentsTracer.TraceDebug(0L, "URI was blocked."); Utilities.TransferToErrorPage(owaContext, LocalizedStrings.GetNonEncoded(343095135), null, ThemeFileId.Warning, true); return(null); } ClassifyResult documentLibraryObjectId2 = DocumentLibraryUtilities.GetDocumentLibraryObjectId(uri, owaContext.UserContext); if (documentLibraryObjectId2.Error != ClassificationError.None) { string errorDetailedDescription = null; ThemeFileId icon = ThemeFileId.Warning; string nonEncoded; if (documentLibraryObjectId2.Error == ClassificationError.ConnectionFailed) { ExTraceGlobals.DocumentsTracer.TraceDebug(0L, "Connection could not be made to server."); nonEncoded = LocalizedStrings.GetNonEncoded(678272416); } else if (documentLibraryObjectId2.Error == ClassificationError.ObjectNotFound) { ExTraceGlobals.DocumentsTracer.TraceDebug(0L, "URI object not found."); nonEncoded = LocalizedStrings.GetNonEncoded(-54320700); } else if (documentLibraryObjectId2.Error == ClassificationError.AccessDenied) { ExTraceGlobals.DocumentsTracer.TraceDebug(0L, "URI access is denied."); nonEncoded = LocalizedStrings.GetNonEncoded(234621291); } else if (documentLibraryObjectId2.Error == ClassificationError.UriTypeNotSupported) { ExTraceGlobals.DocumentsTracer.TraceDebug(0L, "URI is not supported."); nonEncoded = LocalizedStrings.GetNonEncoded(1453018462); icon = ThemeFileId.ButtonDialogInfo; } else if (documentLibraryObjectId2.Error == ClassificationError.InvalidUri) { ExTraceGlobals.DocumentsTracer.TraceDebug(0L, "URI was Invalid."); nonEncoded = LocalizedStrings.GetNonEncoded(-2054976140); if (flag) { errorDetailedDescription = string.Format(LocalizedStrings.GetNonEncoded(-666455008), "<a href=\"" + queryStringParameter + "\" target=\"_blank\" class=lnk>", "</a>"); } } else { ExTraceGlobals.DocumentsTracer.TraceDebug(0L, "Other classification error. ClassifyResult.Error: " + documentLibraryObjectId2.Error.ToString()); nonEncoded = LocalizedStrings.GetNonEncoded(-785304559); } Utilities.TransferToErrorPage(owaContext, nonEncoded, errorDetailedDescription, icon, true); return(null); } if (!flag2) { documentLibraryObjectId = documentLibraryObjectId2.ObjectId; } return(documentLibraryObjectId); }