示例#1
0
        // Token: 0x06003029 RID: 12329 RVA: 0x00119B08 File Offset: 0x00117D08
        public static bool AddFavorite(DocumentLibrary library, UserContext userContext, out int countOfFavorites)
        {
            if (library == null)
            {
                throw new ArgumentNullException("library");
            }
            if (userContext == null)
            {
                throw new ArgumentNullException("userContext");
            }
            List <DocumentLibrary> favoritesList = DocumentLibraryUtilities.GetFavoritesList(userContext);

            countOfFavorites = favoritesList.Count;
            if (DocumentLibraryUtilities.FavoriteExists(favoritesList, library.Uri))
            {
                return(false);
            }
            favoritesList.Add(library);
            favoritesList.Sort();
            DocumentLibraryUtilities.SaveList(favoritesList, userContext);
            return(true);
        }
示例#2
0
 // Token: 0x06003036 RID: 12342 RVA: 0x0011A754 File Offset: 0x00118954
 private static void SaveList(List <DocumentLibrary> libraries, UserContext userContext)
 {
     using (UserConfiguration userConfiguration = UserConfigurationUtilities.GetUserConfiguration("Owa.DocumentLibraryFavorites", userContext))
     {
         using (Stream xmlStream = userConfiguration.GetXmlStream())
         {
             xmlStream.SetLength(0L);
             using (StreamWriter streamWriter = new StreamWriter(xmlStream))
             {
                 using (XmlTextWriter xmlTextWriter = new XmlTextWriter(streamWriter))
                 {
                     xmlTextWriter.WriteStartElement("docLibs");
                     foreach (DocumentLibrary library in libraries)
                     {
                         DocumentLibraryUtilities.RenderLibraryItemAsXml(xmlTextWriter, library);
                     }
                     xmlTextWriter.WriteFullEndElement();
                 }
             }
         }
         try
         {
             userConfiguration.Save();
         }
         catch (ObjectNotFoundException ex)
         {
             ExTraceGlobals.CoreTracer.TraceDebug <string>(0L, "DocumentLibraryUtilities.SaveList: Failed. Exception: {0}", ex.Message);
         }
         catch (QuotaExceededException ex2)
         {
             ExTraceGlobals.CoreTracer.TraceDebug <string>(0L, "DocumentLibraryUtilities.SaveList: Failed. Exception: {0}", ex2.Message);
         }
         catch (SaveConflictException ex3)
         {
             ExTraceGlobals.CoreTracer.TraceDebug <string>(0L, "DocumentLibraryUtilities.SaveList: Failed. Exception: {0}", ex3.Message);
         }
     }
 }
示例#3
0
        // Token: 0x06003028 RID: 12328 RVA: 0x00119AA4 File Offset: 0x00117CA4
        public static void RenderFavorites(TextWriter output, UserContext userContext)
        {
            if (output == null)
            {
                throw new ArgumentNullException("output");
            }
            if (userContext == null)
            {
                throw new ArgumentNullException("userContext");
            }
            List <DocumentLibrary>        favoritesList = DocumentLibraryUtilities.GetFavoritesList(userContext);
            IEnumerator <DocumentLibrary> enumerator    = favoritesList.GetEnumerator();
            int num = 0;

            while (enumerator.MoveNext())
            {
                num++;
                if (num > 1000)
                {
                    break;
                }
                DocumentLibraryUtilities.RenderLibraryItem(output, enumerator.Current, userContext, true);
            }
        }
示例#4
0
        public void GetDocument()
        {
            bool flag = false;

            ExTraceGlobals.MailCallTracer.TraceDebug((long)this.GetHashCode(), "DocumentEventHandler.GetDocument");
            base.ShowErrorInPage  = true;
            base.DontWriteHeaders = true;
            HttpContext httpContext = base.OwaContext.HttpContext;

            if (!DocumentLibraryUtilities.IsDocumentsAccessEnabled(base.UserContext))
            {
                throw new OwaSegmentationException("Access to this document library is disabled");
            }
            string text = (string)base.GetParameter("id");
            string s    = (string)base.GetParameter("URL");
            DocumentLibraryObjectId documentLibraryObjectId = DocumentLibraryUtilities.CreateDocumentLibraryObjectId(base.OwaContext);

            if (documentLibraryObjectId == null)
            {
                return;
            }
            try
            {
                this.DataBind(documentLibraryObjectId);
            }
            finally
            {
                if (this.stream == null)
                {
                    this.Dispose();
                }
            }
            if (this.stream == null)
            {
                return;
            }
            UserContext userContext = base.OwaContext.UserContext;

            AttachmentPolicy.Level levelForAttachment = AttachmentLevelLookup.GetLevelForAttachment(Path.GetExtension(this.fileName), this.contentType, userContext);
            if (base.IsParameterSet("allowLevel2"))
            {
                flag = true;
            }
            if (levelForAttachment == AttachmentPolicy.Level.Block)
            {
                string errorDescription = string.Format(CultureInfo.InvariantCulture, LocalizedStrings.GetNonEncoded(1280363351), new object[]
                {
                    this.fileName
                });
                Utilities.TransferToErrorPage(base.OwaContext, errorDescription, null, ThemeFileId.ButtonDialogInfo, true);
                return;
            }
            if (levelForAttachment == AttachmentPolicy.Level.ForceSave && !flag)
            {
                string queryStringParameter = Utilities.GetQueryStringParameter(httpContext.Request, "ns");
                string text2 = string.Concat(new string[]
                {
                    "<br> <a onclick=\"return false;\" href=\"ev.owa?ns=",
                    queryStringParameter,
                    "&ev=GetDoc&allowLevel2=1&URL=",
                    Utilities.UrlEncode(s),
                    "&id=",
                    Utilities.UrlEncode(documentLibraryObjectId.ToBase64String()),
                    Utilities.GetCanaryRequestParameter(),
                    "\">",
                    Utilities.HtmlEncode(this.fileName),
                    "</a>"
                });
                string errorDetailedDescription = string.Format(CultureInfo.InvariantCulture, LocalizedStrings.GetHtmlEncoded(-625229753), new object[]
                {
                    text2
                });
                Utilities.TransferToErrorPage(base.OwaContext, LocalizedStrings.GetHtmlEncoded(-226672911), errorDetailedDescription, ThemeFileId.ButtonDialogInfo, true, true);
                return;
            }
            int num = AttachmentHandler.SendDocumentContentToHttpStream(httpContext, this.stream, this.fileName, DocumentEventHandler.CalculateFileExtension(this.fileName), this.contentType);

            if (this.contentType != null && this.contentType.Equals("application/x-zip-compressed", StringComparison.OrdinalIgnoreCase))
            {
                Utilities.DisableContentEncodingForThisResponse(base.OwaContext.HttpContext.Response);
            }
            if (Globals.ArePerfCountersEnabled)
            {
                if ((documentLibraryObjectId.UriFlags & UriFlags.Sharepoint) != (UriFlags)0)
                {
                    OwaSingleCounters.WssBytes.IncrementBy((long)num);
                    OwaSingleCounters.WssRequests.Increment();
                    return;
                }
                if ((documentLibraryObjectId.UriFlags & UriFlags.Unc) != (UriFlags)0)
                {
                    OwaSingleCounters.UncBytes.IncrementBy((long)num);
                    OwaSingleCounters.UncRequests.Increment();
                }
            }
        }
示例#5
0
        public void SendByEmail()
        {
            ExTraceGlobals.DocumentsCallTracer.TraceDebug((long)this.GetHashCode(), "DocumentLibraryEventHandler.SendByEmail");
            MessageItem messageItem = null;

            string[] array  = (string[])base.GetParameter("uri");
            Stream   stream = null;
            bool     flag   = DocumentLibraryUtilities.IsNavigationToWSSAllowed(base.UserContext);
            bool     flag2  = DocumentLibraryUtilities.IsNavigationToUNCAllowed(base.UserContext);

            try
            {
                for (int i = 0; i < array.Length; i++)
                {
                    ClassifyResult documentLibraryObjectId = DocumentLibraryUtilities.GetDocumentLibraryObjectId(array[i], base.UserContext);
                    if (documentLibraryObjectId == null)
                    {
                        ExTraceGlobals.DocumentsTracer.TraceDebug(0L, "Could not classify link: " + array[i]);
                        throw new OwaEventHandlerException("Could not add attachment to email", LocalizedStrings.GetNonEncoded(1948229493), OwaEventHandlerErrorCode.SendByEmailError);
                    }
                    DocumentLibraryObjectId objectId = documentLibraryObjectId.ObjectId;
                    if (objectId == null)
                    {
                        ExTraceGlobals.DocumentsTracer.TraceDebug(0L, "ObjectId could not be created from URI parameter: " + array[i]);
                        throw new OwaEventHandlerException("Could not add attachment to email", LocalizedStrings.GetNonEncoded(1948229493), OwaEventHandlerErrorCode.SendByEmailError);
                    }
                    UriFlags uriFlags = objectId.UriFlags;
                    try
                    {
                        string text;
                        switch (uriFlags)
                        {
                        case UriFlags.SharepointDocument:
                        {
                            if (!flag)
                            {
                                throw new OwaSegmentationException("Access to Sharepoint documents is disabled");
                            }
                            SharepointSession  session            = base.UserContext.LogonIdentity.CreateSharepointSession(objectId);
                            SharepointDocument sharepointDocument = SharepointDocument.Read(session, objectId);
                            stream = sharepointDocument.GetDocument();
                            text   = (string.IsNullOrEmpty(sharepointDocument.DisplayName) ? LocalizedStrings.GetNonEncoded(1797976510) : sharepointDocument.DisplayName);
                            break;
                        }

                        case UriFlags.UncDocument:
                        {
                            if (!flag2)
                            {
                                throw new OwaSegmentationException("Access to Unc documents is disabled");
                            }
                            UncSession  session2    = base.UserContext.LogonIdentity.CreateUncSession(objectId);
                            UncDocument uncDocument = UncDocument.Read(session2, objectId);
                            stream = uncDocument.GetDocument();
                            text   = Path.GetFileName(uncDocument.Uri.ToString());
                            if (!string.IsNullOrEmpty(text))
                            {
                                text = HttpUtility.UrlDecode(text);
                            }
                            break;
                        }

                        default:
                            throw new OwaNotSupportedException("Unhandled document library type");
                        }
                        if (messageItem == null)
                        {
                            messageItem = MessageItem.Create(base.UserContext.MailboxSession, base.UserContext.DraftsFolderId);
                            messageItem[ItemSchema.ConversationIndexTracking] = true;
                        }
                        int num;
                        AttachmentAddResult attachmentAddResult = AttachmentUtility.AddAttachmentFromStream(messageItem, text, null, stream, base.UserContext, out num);
                        if (Globals.ArePerfCountersEnabled)
                        {
                            if (uriFlags == UriFlags.UncDocument)
                            {
                                OwaSingleCounters.UncRequests.Increment();
                                OwaSingleCounters.UncBytes.IncrementBy((long)num);
                            }
                            else
                            {
                                OwaSingleCounters.WssRequests.Increment();
                                OwaSingleCounters.WssBytes.IncrementBy((long)num);
                            }
                        }
                        if (attachmentAddResult.ResultCode != AttachmentAddResultCode.NoError)
                        {
                            throw new OwaEventHandlerException("Could not add attachment to email. " + attachmentAddResult.Message, LocalizedStrings.GetNonEncoded(1948229493), OwaEventHandlerErrorCode.SendByEmailError);
                        }
                    }
                    finally
                    {
                        if (stream != null)
                        {
                            stream.Close();
                            stream = null;
                        }
                    }
                }
                messageItem.Save(SaveMode.ResolveConflicts);
                messageItem.Load();
                this.Writer.Write(messageItem.Id.ObjectId.ToBase64String());
            }
            finally
            {
                if (messageItem != null)
                {
                    messageItem.Dispose();
                    messageItem = null;
                }
            }
        }
示例#6
0
        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;
                }
            }
        }
示例#7
0
        public void AddFavoriteLibrary()
        {
            ExTraceGlobals.DocumentsCallTracer.TraceDebug((long)this.GetHashCode(), "DocumentLibraryEventHandler.AddFavoriteLibrary");
            string[] array = (string[])base.GetParameter("uri");
            bool     flag  = false;

            this.Writer.Write("<div id=divAFavLibs>");
            for (int i = 0; i < array.Length; i++)
            {
                ClassifyResult documentLibraryObjectId = DocumentLibraryUtilities.GetDocumentLibraryObjectId(array[i], base.UserContext);
                if (documentLibraryObjectId == null)
                {
                    ExTraceGlobals.DocumentsTracer.TraceDebug(0L, "Could not classify link: " + array[i]);
                }
                else
                {
                    DocumentLibraryObjectId objectId = documentLibraryObjectId.ObjectId;
                    if (objectId != null)
                    {
                        UriFlags        uriFlags        = objectId.UriFlags;
                        DocumentLibrary documentLibrary = new DocumentLibrary();
                        bool            flag2           = DocumentLibraryUtilities.IsNavigationToWSSAllowed(base.UserContext);
                        bool            flag3           = DocumentLibraryUtilities.IsNavigationToUNCAllowed(base.UserContext);
                        UriFlags        uriFlags2       = uriFlags;
                        switch (uriFlags2)
                        {
                        case UriFlags.Sharepoint:
                            {
                                if (!flag2)
                                {
                                    throw new OwaSegmentationException("Access to Sharepoint documents is disabled");
                                }
                                SharepointSession sharepointSession = base.UserContext.LogonIdentity.CreateSharepointSession(objectId);
                                documentLibrary.DisplayName = (string.IsNullOrEmpty(sharepointSession.DisplayName) ? LocalizedStrings.GetNonEncoded(-527057840) : sharepointSession.DisplayName);
                                documentLibrary.SiteName    = sharepointSession.DisplayName;
                                break;
                            }

                        case UriFlags.Unc:
                            {
                                if (!flag3)
                                {
                                    throw new OwaSegmentationException("Access to Unc documents is disabled");
                                }
                                UncSession uncSession = base.UserContext.LogonIdentity.CreateUncSession(objectId);
                                documentLibrary.DisplayName = uncSession.Title;
                                documentLibrary.SiteName    = uncSession.Uri.Host;
                                break;
                            }

                        case UriFlags.Sharepoint | UriFlags.Unc:
                        case UriFlags.DocumentLibrary:
                            goto IL_34F;

                        case UriFlags.SharepointDocumentLibrary:
                        {
                            if (!flag2)
                            {
                                throw new OwaSegmentationException("Access to Sharepoint documents is disabled");
                            }
                            SharepointSession         sharepointSession2        = base.UserContext.LogonIdentity.CreateSharepointSession(objectId);
                            SharepointDocumentLibrary sharepointDocumentLibrary = SharepointDocumentLibrary.Read(sharepointSession2, objectId);
                            documentLibrary.DisplayName = (string.IsNullOrEmpty(sharepointDocumentLibrary.Title) ? LocalizedStrings.GetNonEncoded(477016274) : sharepointDocumentLibrary.Title);
                            documentLibrary.SiteName    = sharepointSession2.DisplayName;
                            break;
                        }

                        case UriFlags.UncDocumentLibrary:
                        {
                            if (!flag3)
                            {
                                throw new OwaSegmentationException("Access to Unc documents is disabled");
                            }
                            UncSession         session            = base.UserContext.LogonIdentity.CreateUncSession(objectId);
                            UncDocumentLibrary uncDocumentLibrary = UncDocumentLibrary.Read(session, objectId);
                            documentLibrary.DisplayName = (string.IsNullOrEmpty(uncDocumentLibrary.Title) ? LocalizedStrings.GetNonEncoded(477016274) : uncDocumentLibrary.Title);
                            documentLibrary.SiteName    = uncDocumentLibrary.Uri.Host;
                            break;
                        }

                        default:
                            switch (uriFlags2)
                            {
                            case UriFlags.SharepointFolder:
                            {
                                if (!flag2)
                                {
                                    throw new OwaSegmentationException("Access to Sharepoint documents is disabled");
                                }
                                SharepointSession sharepointSession3 = base.UserContext.LogonIdentity.CreateSharepointSession(objectId);
                                SharepointDocumentLibraryFolder sharepointDocumentLibraryFolder = SharepointDocumentLibraryFolder.Read(sharepointSession3, objectId);
                                documentLibrary.DisplayName = (string.IsNullOrEmpty(sharepointDocumentLibraryFolder.DisplayName) ? LocalizedStrings.GetNonEncoded(-527057840) : sharepointDocumentLibraryFolder.DisplayName);
                                documentLibrary.SiteName    = sharepointSession3.DisplayName;
                                break;
                            }

                            case UriFlags.UncFolder:
                            {
                                if (!flag3)
                                {
                                    throw new OwaSegmentationException("Access to Unc documents is disabled");
                                }
                                UncSession session2 = base.UserContext.LogonIdentity.CreateUncSession(objectId);
                                UncDocumentLibraryFolder uncDocumentLibraryFolder = UncDocumentLibraryFolder.Read(session2, objectId);
                                documentLibrary.DisplayName = (string.IsNullOrEmpty(uncDocumentLibraryFolder.DisplayName) ? LocalizedStrings.GetNonEncoded(-527057840) : uncDocumentLibraryFolder.DisplayName);
                                documentLibrary.SiteName    = uncDocumentLibraryFolder.Uri.Host;
                                break;
                            }

                            default:
                                goto IL_34F;
                            }
                            break;
                        }
                        documentLibrary.Type = uriFlags;
                        documentLibrary.Uri  = array[i];
                        int num = 0;
                        if (DocumentLibraryUtilities.AddFavorite(documentLibrary, base.UserContext, out num) && num <= 1000)
                        {
                            DocumentLibraryUtilities.RenderLibraryItem(this.Writer, documentLibrary, base.UserContext, true);
                            flag = true;
                            goto IL_3A0;
                        }
                        goto IL_3A0;
                        IL_34F:
                        throw new OwaNotSupportedException("Unhandled document library type");
                    }
                    ExTraceGlobals.DocumentsTracer.TraceDebug(0L, "ObjectId could not be created from URI parameter: " + array[i]);
                }
                IL_3A0 :;
            }
            this.Writer.Write("</div>");
            if (flag)
            {
                this.Writer.Write("<div id=divMsgFav>");
                this.Writer.Write(LocalizedStrings.GetHtmlEncoded(344777715));
                this.Writer.Write("</div><div id=divMsgTtl>");
                this.Writer.Write(LocalizedStrings.GetHtmlEncoded(803639727));
            }
            else
            {
                this.Writer.Write("<div id=divNoLib>");
            }
            this.Writer.Write("</div>");
        }
示例#8
0
        // Token: 0x06003038 RID: 12344 RVA: 0x0011A938 File Offset: 0x00118B38
        public static ColumnId GetSortedColumn(ColumnId columnId, UriFlags libraryType)
        {
            DocumentSortType sortTypeofLibrary = DocumentLibraryUtilities.GetSortTypeofLibrary(columnId);
            ColumnId         result            = ColumnId.Count;

            switch (sortTypeofLibrary)
            {
            case DocumentSortType.Name:
                switch (libraryType)
                {
                case UriFlags.Sharepoint:
                    return(ColumnId.SharepointDocumentLibraryDisplayName);

                case UriFlags.Unc:
                case UriFlags.UncDocumentLibrary:
                    break;

                case UriFlags.Sharepoint | UriFlags.Unc:
                case UriFlags.DocumentLibrary:
                    return(result);

                case UriFlags.SharepointDocumentLibrary:
                    goto IL_73;

                default:
                    switch (libraryType)
                    {
                    case UriFlags.SharepointFolder:
                        goto IL_73;

                    case UriFlags.UncFolder:
                        break;

                    default:
                        return(result);
                    }
                    break;
                }
                result = ColumnId.UncDocumentDisplayName;
                break;
IL_73:
                result = ColumnId.SharepointDocumentDisplayName;
                break;

            case DocumentSortType.ModifiedByDate:
                switch (libraryType)
                {
                case UriFlags.Sharepoint:
                    return(ColumnId.SharepointDocumentLibraryLastModified);

                case UriFlags.Unc:
                case UriFlags.UncDocumentLibrary:
                    break;

                case UriFlags.Sharepoint | UriFlags.Unc:
                case UriFlags.DocumentLibrary:
                    return(result);

                case UriFlags.SharepointDocumentLibrary:
                    goto IL_C6;

                default:
                    switch (libraryType)
                    {
                    case UriFlags.SharepointFolder:
                        goto IL_C6;

                    case UriFlags.UncFolder:
                        break;

                    default:
                        return(result);
                    }
                    break;
                }
                result = ColumnId.UncDocumentLastModified;
                break;
IL_C6:
                result = ColumnId.SharepointDocumentLastModified;
                break;

            case DocumentSortType.FileSize:
                switch (libraryType)
                {
                case UriFlags.Sharepoint:
                    return(ColumnId.SharepointDocumentLibraryDisplayName);

                case UriFlags.Unc:
                    return(ColumnId.UncDocumentDisplayName);

                case UriFlags.Sharepoint | UriFlags.Unc:
                case UriFlags.DocumentLibrary:
                    return(result);

                case UriFlags.SharepointDocumentLibrary:
                    goto IL_121;

                case UriFlags.UncDocumentLibrary:
                    break;

                default:
                    switch (libraryType)
                    {
                    case UriFlags.SharepointFolder:
                        goto IL_121;

                    case UriFlags.UncFolder:
                        break;

                    default:
                        return(result);
                    }
                    break;
                }
                result = ColumnId.UncDocumentFileSize;
                break;
IL_121:
                result = ColumnId.SharepointDocumentFileSize;
                break;

            case DocumentSortType.Description:
                switch (libraryType)
                {
                case UriFlags.Sharepoint:
                    return(ColumnId.SharepointDocumentLibraryDisplayName);

                case UriFlags.Unc:
                case UriFlags.UncDocumentLibrary:
                    break;

                case UriFlags.Sharepoint | UriFlags.Unc:
                case UriFlags.DocumentLibrary:
                    return(result);

                case UriFlags.SharepointDocumentLibrary:
                    goto IL_1C7;

                default:
                    switch (libraryType)
                    {
                    case UriFlags.SharepointFolder:
                        goto IL_1C7;

                    case UriFlags.UncFolder:
                        break;

                    default:
                        return(result);
                    }
                    break;
                }
                result = ColumnId.UncDocumentDisplayName;
                break;
IL_1C7:
                result = ColumnId.SharepointDocumentLibraryDescription;
                break;

            case DocumentSortType.ModifiedBy:
                switch (libraryType)
                {
                case UriFlags.Sharepoint:
                    return(ColumnId.SharepointDocumentLibraryDisplayName);

                case UriFlags.Unc:
                case UriFlags.UncDocumentLibrary:
                    break;

                case UriFlags.Sharepoint | UriFlags.Unc:
                case UriFlags.DocumentLibrary:
                    return(result);

                case UriFlags.SharepointDocumentLibrary:
                    goto IL_25B;

                default:
                    switch (libraryType)
                    {
                    case UriFlags.SharepointFolder:
                        goto IL_25B;

                    case UriFlags.UncFolder:
                        break;

                    default:
                        return(result);
                    }
                    break;
                }
                result = ColumnId.UncDocumentDisplayName;
                break;
IL_25B:
                result = ColumnId.SharepointDocumentModifiedBy;
                break;

            case DocumentSortType.CheckedOutTo:
                switch (libraryType)
                {
                case UriFlags.Sharepoint:
                    return(ColumnId.SharepointDocumentLibraryDisplayName);

                case UriFlags.Unc:
                case UriFlags.UncDocumentLibrary:
                    break;

                case UriFlags.Sharepoint | UriFlags.Unc:
                case UriFlags.DocumentLibrary:
                    return(result);

                case UriFlags.SharepointDocumentLibrary:
                    goto IL_174;

                default:
                    switch (libraryType)
                    {
                    case UriFlags.SharepointFolder:
                        goto IL_174;

                    case UriFlags.UncFolder:
                        break;

                    default:
                        return(result);
                    }
                    break;
                }
                result = ColumnId.UncDocumentDisplayName;
                break;
IL_174:
                result = ColumnId.SharepointDocumentCheckedOutTo;
                break;

            case DocumentSortType.DocumentCount:
                switch (libraryType)
                {
                case UriFlags.Sharepoint:
                    return(ColumnId.SharepointDocumentLibraryItemCount);

                case UriFlags.Unc:
                case UriFlags.UncDocumentLibrary:
                    break;

                case UriFlags.Sharepoint | UriFlags.Unc:
                case UriFlags.DocumentLibrary:
                    return(result);

                case UriFlags.SharepointDocumentLibrary:
                    goto IL_214;

                default:
                    switch (libraryType)
                    {
                    case UriFlags.SharepointFolder:
                        goto IL_214;

                    case UriFlags.UncFolder:
                        break;

                    default:
                        return(result);
                    }
                    break;
                }
                result = ColumnId.UncDocumentDisplayName;
                break;
IL_214:
                result = ColumnId.SharepointDocumentDisplayName;
                break;
            }
            return(result);
        }
示例#9
0
        // 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);
        }