Esempio n. 1
0
        private static string CreatePostReplyForwardHeader(BodyFormat bodyFormat, Item item, UserContext userContext, string postToFolderName)
        {
            PostItem postItem = item as PostItem;

            if (postItem == null)
            {
                throw new ArgumentException("OWA logic error . CreatePostReplyForwardheader is called on a non-PostItem item.");
            }
            if (postToFolderName == null)
            {
                throw new ArgumentNullException("postToFolderName");
            }
            if (string.Empty == postToFolderName)
            {
                throw new ArgumentException("postToFolderName should not be empty. ");
            }
            StringBuilder stringBuilder = new StringBuilder();
            bool          outputHtml    = BodyFormat.TextHtml == bodyFormat;

            if (postItem.Sender != null)
            {
                if (Utilities.IsOnBehalfOf(postItem.Sender, postItem.From))
                {
                    stringBuilder.Append(string.Format(LocalizedStrings.GetHtmlEncoded(-1426120402), ReplyForwardUtilities.GetParticipantDisplayString(postItem.Sender, outputHtml), ReplyForwardUtilities.GetParticipantDisplayString(postItem.From, outputHtml)));
                }
                else
                {
                    ReplyForwardUtilities.AppendParticipantDisplayString(postItem.Sender, stringBuilder, outputHtml);
                }
            }
            string fromLabel = string.Empty;

            switch (bodyFormat)
            {
            case BodyFormat.TextPlain:
                fromLabel = LocalizedStrings.GetNonEncoded(-1376223345);
                return(ReplyForwardUtilities.CreatePostTextReplyForwardHeader(postItem, userContext, fromLabel, stringBuilder.ToString(), postToFolderName));

            case BodyFormat.TextHtml:
                fromLabel = LocalizedStrings.GetHtmlEncoded(-1376223345);
                return(ReplyForwardUtilities.CreatePostHtmlReplyForwardHeader(postItem, userContext, fromLabel, stringBuilder.ToString(), postToFolderName));

            default:
                throw new ArgumentException("Unsupported body format");
            }
        }
Esempio n. 2
0
 protected void RenderMessage(TextWriter output)
 {
     if (output == null)
     {
         throw new ArgumentNullException("output");
     }
     AttachmentPolicy.Level levelForAttachment = AttachmentLevelLookup.GetLevelForAttachment(this.utilities.FileExtension, this.utilities.MimeType, base.UserContext);
     if (AttachmentPolicy.Level.Block == levelForAttachment)
     {
         if (base.UserContext.IsBasicExperience)
         {
             output.Write("<table class=tbWIB><tr><td class=\"");
             output.Write(Utilities.GetTDClassForWebReadyViewHead(base.UserContext.IsBasicExperience));
             output.Write("\"><img  class=\"iei errInfo\" src=\"");
             base.OwaContext.UserContext.RenderThemeFileUrl(output, ThemeFileId.Exclaim);
             output.Write("\" alt=\"\"><span class=\"errInfo\">");
         }
         else
         {
             output.Write("<table class=tbWIB><tr><td>");
             base.OwaContext.UserContext.RenderThemeImage(output, ThemeFileId.Exclaim, "iei errInfo", new object[0]);
             output.Write("<span class=\"errInfo\">");
         }
         output.Write(LocalizedStrings.GetHtmlEncoded(437967712));
         output.Write("</span></td></tr></table>");
         return;
     }
     if (AttachmentPolicy.Level.ForceSave == levelForAttachment)
     {
         output.Write("<table class=tbNIB><tr><td class=\"msg ");
         output.Write(Utilities.GetTDClassForWebReadyViewHead(base.UserContext.IsBasicExperience));
         output.Write("\">");
         this.RenderHtmlEncodedSaveAttachmentToDiskMessage();
         output.Write("</td></tr></table>");
         return;
     }
     if (AttachmentPolicy.Level.Allow == levelForAttachment)
     {
         output.Write("<table class=tbNIB><tr><td class=\"msg ");
         output.Write(Utilities.GetTDClassForWebReadyViewHead(base.UserContext.IsBasicExperience));
         output.Write("\">");
         output.Write(base.UserContext.IsBasicExperience ? LocalizedStrings.GetHtmlEncoded(94137446) : LocalizedStrings.GetHtmlEncoded(2080319064));
         output.Write("</td></tr></table>");
     }
 }
 // Token: 0x06000BB3 RID: 2995 RVA: 0x00051AD0 File Offset: 0x0004FCD0
 protected void RenderTimeZoneSelection()
 {
     base.Response.Write("<select id=selTz name=");
     base.Response.Write("tzid");
     base.Response.Write(" class=languageInputText onchange=\"isTimezoneSelectedCheck()\">");
     base.Response.Write(" <option selected=\"selected\">");
     base.Response.Write(LocalizedStrings.GetHtmlEncoded(394323495));
     base.Response.Write("</option> ");
     foreach (ExTimeZone exTimeZone in ExTimeZoneEnumerator.Instance)
     {
         base.Response.Write("<option");
         base.Response.Write(" value=\"");
         Utilities.HtmlEncode(exTimeZone.Id, base.Response.Output);
         base.Response.Write("\">");
         Utilities.RenderDirectionEnhancedValue(base.Response.Output, exTimeZone.LocalizableDisplayName.ToString(Thread.CurrentThread.CurrentUICulture), OwaPage.IsRtl);
     }
     base.Response.Write("</select>");
 }
Esempio n. 4
0
 // Token: 0x06001172 RID: 4466 RVA: 0x0006971C File Offset: 0x0006791C
 private void InitializeDelegateSessionHandle(ExchangePrincipal exchangePrincipal, UserContext userContext)
 {
     try
     {
         this.delegateSessionHandle = userContext.GetDelegateSessionHandle(exchangePrincipal);
     }
     catch (MailboxInSiteFailoverException exception)
     {
         this.HandleOtherMailboxFailover(exception, exchangePrincipal.LegacyDn);
     }
     catch (MailboxCrossSiteFailoverException exception2)
     {
         this.HandleOtherMailboxFailover(exception2, exchangePrincipal.LegacyDn);
     }
     catch (NotSupportedWithServerVersionException innerException)
     {
         throw new OwaSharedFromOlderVersionException(LocalizedStrings.GetHtmlEncoded(1354015881), innerException);
     }
     catch (StoragePermanentException ex)
     {
         string message = string.Format(CultureInfo.InvariantCulture, "OwaStoreObjectIdSessionHandle Ctor. Unable to get GetDelegateSessionHandle with exchange principal from legacy DN {0}. Exception: {1}.", new object[]
         {
             exchangePrincipal.LegacyDn,
             ex.Message
         });
         ExTraceGlobals.CoreCallTracer.TraceDebug((long)this.GetHashCode(), message);
         userContext.DelegateSessionManager.RemoveInvalidExchangePrincipal(exchangePrincipal.LegacyDn);
     }
     catch (StorageTransientException ex2)
     {
         string message2 = string.Format(CultureInfo.InvariantCulture, "OwaStoreObjectIdSessionHandle Ctor. Unable to get GetDelegateSessionHandle with exchange principal from legacy DN {0}. Exception: {1}.", new object[]
         {
             exchangePrincipal.LegacyDn,
             ex2.Message
         });
         ExTraceGlobals.CoreCallTracer.TraceDebug((long)this.GetHashCode(), message2);
         userContext.DelegateSessionManager.RemoveInvalidExchangePrincipal(exchangePrincipal.LegacyDn);
     }
     if (this.delegateSessionHandle == null || this.Session == null)
     {
         throw new ObjectNotFoundException(ServerStrings.ErrorMissingMailboxOrPermission);
     }
 }
Esempio n. 5
0
        private static string CreatePostHtmlReplyForwardHeader(PostItem item, UserContext userContext, string fromLabel, string fromHtmlMarkup, string postToFolderName)
        {
            StringBuilder stringBuilder = new StringBuilder(150);

            stringBuilder.Append("<HR tabindex=\"-1\">");
            stringBuilder.Append("<DIV id=divRplyFwdMsg>");
            stringBuilder.AppendFormat(CultureInfo.InvariantCulture, "<FONT FACE=\"{0}\" size=\"2\">", new object[]
            {
                Utilities.GetDefaultFontName()
            });
            if (!string.IsNullOrEmpty(fromHtmlMarkup))
            {
                stringBuilder.Append("<B>");
                stringBuilder.Append(fromLabel);
                stringBuilder.Append("</B> ");
                stringBuilder.Append(fromHtmlMarkup);
                stringBuilder.Append("<BR>");
            }
            ExDateTime postedTime = item.PostedTime;

            stringBuilder.Append("<B>");
            stringBuilder.Append(LocalizedStrings.GetHtmlEncoded(1890363921));
            stringBuilder.Append("</B> ");
            stringBuilder.AppendFormat(Utilities.HtmlEncode(Strings.SentTime), item.PostedTime.ToLongDateString(), item.PostedTime.ToString(userContext.UserOptions.TimeFormat));
            stringBuilder.Append("<BR>");
            stringBuilder.Append("<B>");
            stringBuilder.Append(LocalizedStrings.GetHtmlEncoded(737701919));
            stringBuilder.Append("</B> ");
            Utilities.HtmlEncode(postToFolderName, stringBuilder);
            stringBuilder.Append("<BR>");
            stringBuilder.Append("<B>");
            stringBuilder.Append(LocalizedStrings.GetHtmlEncoded(-1239615092));
            stringBuilder.Append("</B> ");
            Utilities.HtmlEncode(item.ConversationTopic, stringBuilder);
            stringBuilder.Append("<BR>");
            stringBuilder.Append("</FONT><BR></DIV>");
            stringBuilder.Append("</DIV>");
            return(stringBuilder.ToString());
        }
 public void RenderOpenLink(TextWriter output)
 {
     if (output == null)
     {
         throw new ArgumentNullException("output");
     }
     AttachmentPolicy.Level levelForAttachment = AttachmentLevelLookup.GetLevelForAttachment(this.fileExtension, this.mimeType, this.owaContext.UserContext);
     output.Write("<span id=\"spnLnk\" tabindex=\"-1\">");
     SmallIconManager.RenderFileIcon(output, this.owaContext.UserContext, this.fileExtension, "tbLh", new string[0]);
     output.Write("<span class=\"tbLh\">");
     if (levelForAttachment == AttachmentPolicy.Level.ForceSave || levelForAttachment == AttachmentPolicy.Level.Allow)
     {
         output.Write("<a id=\"lnk\" href=\"");
         output.Write(this.openLink);
         output.Write("\" target=_blank onclick=\"");
         output.Write("return onClkAtmt(");
         output.Write((int)levelForAttachment);
         output.Write(")\" title=\"");
         Utilities.HtmlEncode(this.fileName, output);
         output.Write("\">");
         Utilities.HtmlEncode(AttachmentUtility.TrimAttachmentDisplayName(this.fileName, null, false), output);
         output.Write("</a>");
     }
     else
     {
         Utilities.HtmlEncode(AttachmentUtility.TrimAttachmentDisplayName(this.fileName, null, false), output);
     }
     if (this.fileSize > 0L)
     {
         output.Write(this.owaContext.UserContext.DirectionMark);
         output.Write(" ");
         output.Write(LocalizedStrings.GetHtmlEncoded(6409762));
         Utilities.RenderSizeWithUnits(output, this.fileSize, true);
         output.Write(this.owaContext.UserContext.DirectionMark);
         output.Write(LocalizedStrings.GetHtmlEncoded(-1023695022));
     }
     output.Write("</span></span>");
 }
Esempio n. 7
0
        public static void ProcessReminders(UserContext userContext, TextWriter writer)
        {
            ExDateTime localTime = DateTimeUtilities.GetLocalTime(userContext);
            int        num       = (int)localTime.Bias.TotalMinutes;

            if (num != userContext.RemindersTimeZoneOffset)
            {
                userContext.RemindersTimeZoneOffset = num;
            }
            writer.Write("rmNotfy(");
            writer.Write(num);
            writer.Write(", 1, \"");
            Utilities.JavascriptEncode(DateTimeUtilities.GetJavascriptDate(localTime), writer);
            writer.Write("\", \"");
            bool reminderItems = RemindersRenderingUtilities.GetReminderItems(userContext, localTime, writer);

            if (reminderItems)
            {
                writer.Write("\", \"");
                Utilities.JavascriptEncode(LocalizedStrings.GetHtmlEncoded(-1707229168), writer);
            }
            writer.Write("\");");
        }
Esempio n. 8
0
        private static string CreateHtmlReplyForwardHeader(Item item, UserContext userContext, string fromLabel, string fromHtmlMarkup, string toLabel, string ccLabel, IList <IRecipientBase> toRecipients, IList <IRecipientBase> ccRecipients)
        {
            StringBuilder stringBuilder = new StringBuilder(150);

            stringBuilder.Append("<HR tabindex=\"-1\">");
            stringBuilder.Append("<DIV id=divRplyFwdMsg>");
            stringBuilder.AppendFormat(CultureInfo.InvariantCulture, "<FONT FACE=\"{0}\" size=\"2\" color=\"#000000\">", new object[]
            {
                Utilities.GetDefaultFontName()
            });
            if (!string.IsNullOrEmpty(fromHtmlMarkup))
            {
                stringBuilder.Append("<B>");
                stringBuilder.Append(fromLabel);
                stringBuilder.Append("</B> ");
                stringBuilder.Append(fromHtmlMarkup);
                stringBuilder.Append("<BR>");
            }
            object obj = item.TryGetProperty(ItemSchema.SentTime);

            if (obj != null && obj is ExDateTime)
            {
                ExDateTime exDateTime = (ExDateTime)obj;
                stringBuilder.Append("<B>");
                stringBuilder.Append(LocalizedStrings.GetHtmlEncoded(295620541));
                stringBuilder.Append("</B> ");
                stringBuilder.AppendFormat(Utilities.HtmlEncode(Strings.SentTime), exDateTime.ToLongDateString(), exDateTime.ToString(userContext.UserOptions.TimeFormat));
                stringBuilder.Append("<BR>");
            }
            if (0 < toRecipients.Count)
            {
                stringBuilder.Append("<B>");
                stringBuilder.Append(toLabel);
                stringBuilder.Append("</B> ");
                int num = 0;
                foreach (IRecipientBase recipientBase in toRecipients)
                {
                    num++;
                    Utilities.HtmlEncode(recipientBase.Participant.DisplayName, stringBuilder);
                    if (num < toRecipients.Count)
                    {
                        stringBuilder.Append("; ");
                    }
                }
                stringBuilder.Append("<BR>");
            }
            if (0 < ccRecipients.Count)
            {
                stringBuilder.Append("<B>");
                stringBuilder.Append(ccLabel);
                stringBuilder.Append("</B> ");
                int num2 = 0;
                foreach (IRecipientBase recipientBase2 in ccRecipients)
                {
                    num2++;
                    Utilities.HtmlEncode(recipientBase2.Participant.DisplayName, stringBuilder);
                    if (num2 < ccRecipients.Count)
                    {
                        stringBuilder.Append("; ");
                    }
                }
                stringBuilder.Append("<BR>");
            }
            stringBuilder.Append("<B>");
            stringBuilder.Append(LocalizedStrings.GetHtmlEncoded(-881075747));
            stringBuilder.Append("</B> ");
            string text = item.TryGetProperty(ItemSchema.Subject) as string;

            if (text == null)
            {
                text = string.Empty;
            }
            Utilities.HtmlEncode(text, stringBuilder);
            stringBuilder.Append("<BR>");
            if (ReplyForwardUtilities.IsMeetingItem(item))
            {
                stringBuilder.Append("<B>");
                stringBuilder.Append(LocalizedStrings.GetHtmlEncoded(-524211323));
                stringBuilder.Append("</B> ");
                Utilities.HtmlEncode(Utilities.GenerateWhen(item), stringBuilder);
                stringBuilder.Append("<BR><B>");
                stringBuilder.Append(LocalizedStrings.GetHtmlEncoded(1666265192));
                stringBuilder.Append("</B> ");
                string text2 = item.TryGetProperty(CalendarItemBaseSchema.Location) as string;
                if (!string.IsNullOrEmpty(text2))
                {
                    Utilities.HtmlEncode(text2, stringBuilder);
                }
                stringBuilder.Append("<BR>");
            }
            stringBuilder.Append("</FONT><BR></DIV>");
            stringBuilder.Append("</DIV>");
            return(stringBuilder.ToString());
        }
Esempio n. 9
0
        internal static void RenderError(OwaContext owaContext, TextWriter writer)
        {
            if (owaContext == null)
            {
                throw new ArgumentNullException("owaContext");
            }
            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }
            if (owaContext.ErrorInformation == null)
            {
                throw new ArgumentNullException("owaContext", "owaContext.ErrorInformation is null");
            }
            owaContext.HttpContext.Response.Clear();
            writer.Write("<meta http-equiv=\"Content-Type\" content=\"text/html; CHARSET=utf-8\">");
            writer.Write("<body style=\"background-color:#FFEFB2;font-size:11pt;\"");
            if (owaContext.SessionContext != null && owaContext.SessionContext.IsRtl)
            {
                writer.Write(" dir=\"rtl\"");
            }
            writer.Write(">");
            string value = string.Format("{{font-family:{0};}}", Utilities.GetDefaultFontName());

            writer.Write("<style>");
            writer.Write("BODY");
            if (Culture.GetUserCulture().LCID == 5124 || Culture.GetUserCulture().LCID == 1028 || Culture.GetUserCulture().LCID == 3076)
            {
                writer.Write(OwaPlainTextStyle.GetStyleFromCharset("big5"));
            }
            else if (Culture.GetUserCulture().LCID == 2052 || Culture.GetUserCulture().LCID == 4100)
            {
                writer.Write(OwaPlainTextStyle.GetStyleFromCharset("gb2312"));
            }
            else if (Culture.GetUserCulture().LCID == 1041)
            {
                writer.Write(OwaPlainTextStyle.GetStyleFromCharset("iso-2022-jp"));
            }
            else if (Culture.GetUserCulture().LCID == 1042)
            {
                writer.Write(OwaPlainTextStyle.GetStyleFromCharset("iso-2022-kr"));
            }
            else
            {
                writer.Write(value);
            }
            writer.Write("</style>");
            Utilities.HtmlEncode(owaContext.ErrorInformation.Message, writer);
            if (owaContext.ErrorInformation.OwaEventHandlerErrorCode == OwaEventHandlerErrorCode.WebPartFirstAccessError)
            {
                writer.Write("<br><a target=_blank href=\"");
                writer.Write(Utilities.HtmlEncode(OwaUrl.ApplicationRoot.GetExplicitUrl(owaContext)));
                writer.Write("\">");
                writer.Write(LocalizedStrings.GetHtmlEncoded(675765292));
                writer.Write("</a>");
            }
            else if (owaContext.ErrorInformation.OwaEventHandlerErrorCode == OwaEventHandlerErrorCode.WebPartTaskFolderError || owaContext.ErrorInformation.OwaEventHandlerErrorCode == OwaEventHandlerErrorCode.ErrorEarlyBrowserOnPublishedCalendar || owaContext.ErrorInformation.OwaEventHandlerErrorCode == OwaEventHandlerErrorCode.WebPartCalendarFolderError || owaContext.ErrorInformation.OwaEventHandlerErrorCode == OwaEventHandlerErrorCode.WebPartAccessPublicFolderViaOwaBasicError)
            {
                string value2 = Utilities.HtmlEncode(Globals.SupportedBrowserHelpUrl);
                writer.Write("<br><a target=\"_blank\" href=\"");
                writer.Write(value2);
                writer.Write("\">");
                writer.Write(value2);
                writer.Write("</a>");
            }
            if (owaContext.ErrorInformation.MessageDetails != null)
            {
                writer.Write("<br>");
                Utilities.HtmlEncode(owaContext.ErrorInformation.MessageDetails, writer);
            }
            writer.Write("</body>");
            owaContext.HttpContext.Response.ContentType = Utilities.GetContentTypeString(OwaEventContentType.Html);
            owaContext.HttpContext.Response.AppendHeader("X-OWA-EventResult", "1");
        }
        private void HandleRightsManagementException(RightsManagementException e, OwaStoreObjectId messageId, string correlator)
        {
            RightsManagementFailureCode failureCode = e.FailureCode;

            if (failureCode <= RightsManagementFailureCode.PreLicenseAcquisitionFailed)
            {
                if (failureCode == RightsManagementFailureCode.UserRightNotGranted)
                {
                    this.EnqueueLicensingError(messageId, SanitizedHtmlString.Format(LocalizedStrings.GetHtmlEncoded(-1796455575, this.userCulture), new object[]
                    {
                        string.Empty
                    }), correlator);
                    return;
                }
                if (failureCode != RightsManagementFailureCode.PreLicenseAcquisitionFailed)
                {
                    goto IL_15E;
                }
            }
            else
            {
                switch (failureCode)
                {
                case RightsManagementFailureCode.FailedToExtractTargetUriFromMex:
                case RightsManagementFailureCode.FailedToDownloadMexData:
                    this.EnqueueLicensingError(messageId, SanitizedHtmlString.FromStringId(1314141112, this.userCulture), correlator);
                    return;

                case RightsManagementFailureCode.GetServerInfoFailed:
                    goto IL_15E;

                case RightsManagementFailureCode.InternalLicensingDisabled:
                    this.EnqueueLicensingError(messageId, SanitizedHtmlString.Format(LocalizedStrings.GetHtmlEncoded(1049269714, this.userCulture), new object[]
                    {
                        Utilities.GetOfficeDownloadAnchor(Microsoft.Exchange.Data.Storage.BodyFormat.TextHtml, this.userCulture)
                    }), correlator);
                    return;

                case RightsManagementFailureCode.ExternalLicensingDisabled:
                    this.EnqueueLicensingError(messageId, SanitizedHtmlString.Format(LocalizedStrings.GetHtmlEncoded(1397740097, this.userCulture), new object[]
                    {
                        Utilities.GetOfficeDownloadAnchor(Microsoft.Exchange.Data.Storage.BodyFormat.TextHtml, this.userCulture)
                    }), correlator);
                    return;

                default:
                    switch (failureCode)
                    {
                    case RightsManagementFailureCode.ServerRightNotGranted:
                        this.EnqueueLicensingError(messageId, SanitizedHtmlString.Format(LocalizedStrings.GetHtmlEncoded(784482022, this.userCulture), new object[]
                        {
                            string.Empty
                        }), correlator);
                        return;

                    case RightsManagementFailureCode.InvalidLicensee:
                        break;

                    default:
                        goto IL_15E;
                    }
                    break;
                }
            }
            this.EnqueueLicensingError(messageId, SanitizedHtmlString.FromStringId(-1489754529, this.userCulture), correlator);
            return;

IL_15E:
            SanitizingStringBuilder <OwaHtml> sanitizingStringBuilder = new SanitizingStringBuilder <OwaHtml>(LocalizedStrings.GetNonEncoded(360598592));

            sanitizingStringBuilder.Append("<br>");
            sanitizingStringBuilder.AppendFormat(LocalizedStrings.GetHtmlEncoded(1633606253, this.userCulture), new object[]
            {
                e.Message
            });
            this.EnqueueLicensingError(messageId, sanitizingStringBuilder.ToSanitizedString <SanitizedHtmlString>(), correlator);
        }
Esempio n. 11
0
 // Token: 0x06000052 RID: 82 RVA: 0x00003458 File Offset: 0x00001658
 protected string GetNoScriptHtml()
 {
     return(string.Format(LocalizedStrings.GetHtmlEncoded(719849305), "<a href=\"https://go.microsoft.com/fwlink/?linkid=2009667&clcid=0x409\">", "</a>"));
 }
Esempio n. 12
0
 // Token: 0x06000EE9 RID: 3817 RVA: 0x0005E5AB File Offset: 0x0005C7AB
 private static void AppendAlternateSuggestion(StringBuilder errorDetails)
 {
     errorDetails.Append("<br><br><br>");
     errorDetails.Append(LocalizedStrings.GetHtmlEncoded(427833413));
     errorDetails.Append("<br><br>");
 }
        private static SanitizedHtmlString GetIrmErrorDetails(UserContext userContext, RightsManagedMessageDecryptionStatus decryptionStatus)
        {
            if (userContext == null)
            {
                throw new ArgumentNullException("userContext");
            }
            SanitizingStringBuilder <OwaHtml> sanitizingStringBuilder = new SanitizingStringBuilder <OwaHtml>();
            RightsManagementFailureCode       failureCode             = decryptionStatus.FailureCode;

            if (failureCode > RightsManagementFailureCode.PreLicenseAcquisitionFailed)
            {
                switch (failureCode)
                {
                case RightsManagementFailureCode.FailedToExtractTargetUriFromMex:
                case RightsManagementFailureCode.FailedToDownloadMexData:
                    sanitizingStringBuilder.Append(LocalizedStrings.GetNonEncoded(-843834599));
                    goto IL_308;

                case RightsManagementFailureCode.GetServerInfoFailed:
                    goto IL_19E;

                case RightsManagementFailureCode.InternalLicensingDisabled:
                    break;

                case RightsManagementFailureCode.ExternalLicensingDisabled:
                    sanitizingStringBuilder.AppendFormat(LocalizedStrings.GetNonEncoded(-641698444), new object[]
                    {
                        WebReadyViewUtilities.GetOfficeDownloadAnchor(userContext.UserCulture)
                    });
                    goto IL_308;

                default:
                    switch (failureCode)
                    {
                    case RightsManagementFailureCode.ServerRightNotGranted:
                        sanitizingStringBuilder.Append(LocalizedStrings.GetNonEncoded(-271360565));
                        goto IL_308;

                    case RightsManagementFailureCode.InvalidLicensee:
                        goto IL_189;

                    case RightsManagementFailureCode.FeatureDisabled:
                        break;

                    case RightsManagementFailureCode.NotSupported:
                        sanitizingStringBuilder.AppendFormat(LocalizedStrings.GetNonEncoded(-1308596751), new object[]
                        {
                            WebReadyViewUtilities.GetOfficeDownloadAnchor(userContext.UserCulture)
                        });
                        goto IL_308;

                    case RightsManagementFailureCode.CorruptData:
                        sanitizingStringBuilder.Append(LocalizedStrings.GetNonEncoded(-987520932));
                        goto IL_308;

                    default:
                        if (failureCode != RightsManagementFailureCode.Success)
                        {
                            goto IL_19E;
                        }
                        goto IL_308;
                    }
                    break;
                }
                sanitizingStringBuilder.AppendFormat(LocalizedStrings.GetNonEncoded(-1308596751), new object[]
                {
                    WebReadyViewUtilities.GetOfficeDownloadAnchor(userContext.UserCulture)
                });
                goto IL_308;
            }
            if (failureCode == RightsManagementFailureCode.UserRightNotGranted)
            {
                sanitizingStringBuilder.AppendFormat(LocalizedStrings.GetNonEncoded(149546568), new object[]
                {
                    WebReadyViewUtilities.GetOfficeDownloadAnchor(userContext.UserCulture)
                });
                goto IL_308;
            }
            if (failureCode != RightsManagementFailureCode.PreLicenseAcquisitionFailed)
            {
                goto IL_19E;
            }
IL_189:
            sanitizingStringBuilder.Append(LocalizedStrings.GetNonEncoded(-492186842));
            goto IL_308;
IL_19E:
            sanitizingStringBuilder.Append(LocalizedStrings.GetNonEncoded(-624237727));
            Exception exception = decryptionStatus.Exception;

            if (Globals.ShowDebugInformation && exception != null && exception.InnerException != null)
            {
                StringBuilder stringBuilder = new StringBuilder();
                userContext.RenderThemeImage(stringBuilder, ThemeFileId.Expand, string.Empty, new object[0]);
                sanitizingStringBuilder.AppendFormat("<div onclick=\"document.getElementById('divDtls').style.display='';this.style.display='none';adjHght();\" style=\"cursor: pointer; color: #3165cd;\">" + stringBuilder.ToString() + "&nbsp;{0}</div><div id=\"divDtls\" style='display:none'>", new object[]
                {
                    LocalizedStrings.GetNonEncoded(-610047827)
                });
                string text = string.Empty;
                RightsManagementFailureCode failureCode2 = decryptionStatus.FailureCode;
                Exception innerException = exception.InnerException;
                if (innerException is RightsManagementException)
                {
                    RightsManagementException ex = (RightsManagementException)innerException;
                    text = ex.RmsUrl;
                }
                int num = 0;
                while (num < 10 && innerException.InnerException != null)
                {
                    innerException = innerException.InnerException;
                    num++;
                }
                sanitizingStringBuilder.AppendFormat(LocalizedStrings.GetHtmlEncoded(1633606253), new object[]
                {
                    innerException.Message
                });
                if (!string.IsNullOrEmpty(text))
                {
                    sanitizingStringBuilder.Append("<br>");
                    sanitizingStringBuilder.AppendFormat(LocalizedStrings.GetHtmlEncoded(2115316283), new object[]
                    {
                        text
                    });
                }
                if (failureCode2 != RightsManagementFailureCode.Success)
                {
                    sanitizingStringBuilder.Append("<br>");
                    sanitizingStringBuilder.AppendFormat(LocalizedStrings.GetHtmlEncoded(970140031), new object[]
                    {
                        failureCode2
                    });
                }
                sanitizingStringBuilder.Append("</div>");
            }
IL_308:
            return(sanitizingStringBuilder.ToSanitizedString <SanitizedHtmlString>());
        }
Esempio n. 14
0
        protected string GetNoScriptHtml()
        {
            string htmlEncoded = LocalizedStrings.GetHtmlEncoded(719849305);

            return(string.Format(htmlEncoded, "<a href=\"http://www.microsoft.com/windows/ie/downloads/default.mspx\">", "</a>"));
        }
Esempio n. 15
0
 protected void RenderBackLink()
 {
     base.Response.Write(string.Format(LocalizedStrings.GetHtmlEncoded(161749640), "<a href=\"" + this.errorInformation.PreviousPageUrl + "\">", "</a>"));
 }
Esempio n. 16
0
        internal static string CreateReplyForwardHeader(BodyFormat bodyFormat, Item item, UserContext userContext, StoreObjectId parentFolderId)
        {
            MessageItem      messageItem      = item as MessageItem;
            PostItem         postItem         = item as PostItem;
            CalendarItemBase calendarItemBase = item as CalendarItemBase;

            if (messageItem == null && calendarItemBase == null && postItem == null)
            {
                throw new ArgumentException("HTML reply forward headers can only be created for MessageItem and CalendarItemBase or PostItem. ");
            }
            if (postItem != null)
            {
                if (parentFolderId == null)
                {
                    throw new ArgumentNullException("parentFolderId");
                }
                string parentFolderName = Utilities.GetParentFolderName(item, parentFolderId, userContext);
                return(ReplyForwardUtilities.CreatePostReplyForwardHeader(bodyFormat, item, userContext, parentFolderName));
            }
            else
            {
                IList <IRecipientBase> toRecipients = null;
                IList <IRecipientBase> ccRecipients = null;
                string        fromLabel             = string.Empty;
                StringBuilder stringBuilder         = new StringBuilder();
                string        toLabel = string.Empty;
                string        ccLabel = string.Empty;
                bool          flag    = bodyFormat == BodyFormat.TextHtml;
                if (messageItem != null)
                {
                    fromLabel = (flag ? LocalizedStrings.GetHtmlEncoded(-1376223345) : LocalizedStrings.GetNonEncoded(-1376223345));
                    if (messageItem.Sender != null)
                    {
                        if (Utilities.IsOnBehalfOf(messageItem.Sender, messageItem.From))
                        {
                            stringBuilder.Append(string.Format(LocalizedStrings.GetHtmlEncoded(-1426120402), ReplyForwardUtilities.GetParticipantDisplayString(messageItem.Sender, flag), ReplyForwardUtilities.GetParticipantDisplayString(messageItem.From, flag)));
                        }
                        else
                        {
                            ReplyForwardUtilities.AppendParticipantDisplayString(messageItem.Sender, stringBuilder, flag);
                        }
                    }
                    toLabel      = (flag ? LocalizedStrings.GetHtmlEncoded(-829627742) : LocalizedStrings.GetNonEncoded(-829627742));
                    ccLabel      = (flag ? LocalizedStrings.GetHtmlEncoded(-798075995) : LocalizedStrings.GetNonEncoded(-798075995));
                    toRecipients = ReplyForwardUtilities.GetMessageRecipientCollection(RecipientItemType.To, messageItem);
                    ccRecipients = ReplyForwardUtilities.GetMessageRecipientCollection(RecipientItemType.Cc, messageItem);
                }
                else if (calendarItemBase != null)
                {
                    fromLabel = (flag ? LocalizedStrings.GetHtmlEncoded(-1376223345) : LocalizedStrings.GetNonEncoded(-1376223345));
                    if (calendarItemBase.Organizer != null)
                    {
                        ReplyForwardUtilities.AppendParticipantDisplayString(calendarItemBase.Organizer, stringBuilder, flag);
                    }
                    toLabel      = (flag ? LocalizedStrings.GetHtmlEncoded(-1709254790) : LocalizedStrings.GetNonEncoded(-1709254790));
                    ccLabel      = (flag ? LocalizedStrings.GetHtmlEncoded(-98673561) : LocalizedStrings.GetNonEncoded(-98673561));
                    toRecipients = ReplyForwardUtilities.GetCalendarItemRecipientCollection(AttendeeType.Required, calendarItemBase);
                    ccRecipients = ReplyForwardUtilities.GetCalendarItemRecipientCollection(AttendeeType.Optional, calendarItemBase);
                }
                switch (bodyFormat)
                {
                case BodyFormat.TextPlain:
                    return(ReplyForwardUtilities.CreateTextReplyForwardHeader(item, userContext, fromLabel, stringBuilder.ToString(), toLabel, ccLabel, toRecipients, ccRecipients));

                case BodyFormat.TextHtml:
                    return(ReplyForwardUtilities.CreateHtmlReplyForwardHeader(item, userContext, fromLabel, stringBuilder.ToString(), toLabel, ccLabel, toRecipients, ccRecipients));

                default:
                    throw new ArgumentException("Unsupported body format");
                }
            }
        }
 // Token: 0x06000E61 RID: 3681 RVA: 0x0005BB50 File Offset: 0x00059D50
 protected void RenderPartialFailure(Strings.IDs messageString, Strings.IDs?titleString, ButtonDialogIcon icon, OwaEventHandlerErrorCode errorCode)
 {
     this.RenderPartialFailure(LocalizedStrings.GetHtmlEncoded(messageString), (titleString != null) ? LocalizedStrings.GetHtmlEncoded(titleString.Value) : null, icon, errorCode);
 }
 private void AcquireUseLicenseAndUsageRightsCallback(IAsyncResult asyncResult)
 {
     if (asyncResult == null)
     {
         throw new ArgumentNullException("asyncResult");
     }
     if (asyncResult.AsyncState == null)
     {
         IrmLicensingManager.Tracer.TraceError((long)this.GetHashCode(), "AcquireLicenseAndRightsCB: asyncResult.AsyncState is null.");
         throw new InvalidOperationException("asyncResult.AsyncState must NOT be null.");
     }
     IrmLicensingManager.AsyncState asyncState = (IrmLicensingManager.AsyncState)asyncResult.AsyncState;
     try
     {
         IrmLicensingManager.Tracer.TraceDebug <OwaStoreObjectId>((long)this.GetHashCode(), "AcquireLicenseAndRightsCB: calling EndAcquireUseLicenseAndUsageRights to get results for message {0}", asyncState.MessageId);
         UseLicenseAndUsageRights useLicenseAndUsageRights = RmsClientManager.EndAcquireUseLicenseAndUsageRights(asyncResult);
         if (string.IsNullOrEmpty(useLicenseAndUsageRights.UseLicense))
         {
             IrmLicensingManager.Tracer.TraceError((long)this.GetHashCode(), "AcquireLicenseAndRightsCB: Use license is null/empty");
             throw new InvalidOperationException("Use license must NOT be null/empty");
         }
         if (this.userContext.State != UserContextState.Active)
         {
             IrmLicensingManager.Tracer.TraceDebug((long)this.GetHashCode(), "AcquireLicenseAndRightsCB: User context is no longer active.  Bailing out.");
         }
         else
         {
             SafeRightsManagementHandle safeRightsManagementHandle = null;
             try
             {
                 RmsClientManager.BindUseLicenseForDecryption(new RmsClientManagerContext(useLicenseAndUsageRights.OrganizationId, RmsClientManagerContext.ContextId.MessageId, asyncState.MessageId.ToString(), null), useLicenseAndUsageRights.LicensingUri, useLicenseAndUsageRights.UseLicense, useLicenseAndUsageRights.PublishingLicense, out safeRightsManagementHandle);
             }
             finally
             {
                 if (safeRightsManagementHandle != null)
                 {
                     safeRightsManagementHandle.Close();
                 }
             }
             bool flag = false;
             try
             {
                 this.userContext.Lock();
                 flag = true;
                 using (Item item = Item.Bind(asyncState.MessageId.GetSession(this.userContext), asyncState.MessageId.StoreObjectId, ItemBindOption.None))
                 {
                     MessageItem messageItem = item as MessageItem;
                     if (messageItem == null)
                     {
                         IrmLicensingManager.Tracer.TraceError((long)this.GetHashCode(), "AcquireLicenseAndRightsCB: bound item is not a message.  Ignoring it.");
                     }
                     else
                     {
                         messageItem.OpenAsReadWrite();
                         messageItem[MessageItemSchema.DRMRights]     = useLicenseAndUsageRights.UsageRights;
                         messageItem[MessageItemSchema.DRMExpiryTime] = useLicenseAndUsageRights.ExpiryTime;
                         if (!DrmClientUtils.IsCachingOfLicenseDisabled(useLicenseAndUsageRights.UseLicense))
                         {
                             using (Stream stream = messageItem.OpenPropertyStream(MessageItemSchema.DRMServerLicenseCompressed, PropertyOpenMode.Create))
                             {
                                 DrmEmailCompression.CompressUseLicense(useLicenseAndUsageRights.UseLicense, stream);
                             }
                         }
                         messageItem[MessageItemSchema.DRMPropsSignature] = useLicenseAndUsageRights.DRMPropsSignature;
                         RightsManagedMessageItem rightsManagedMessageItem = messageItem as RightsManagedMessageItem;
                         if (rightsManagedMessageItem != null && rightsManagedMessageItem.IsRestricted && !rightsManagedMessageItem.TryDecode(Utilities.CreateOutboundConversionOptions(this.userContext), false).Failed)
                         {
                             bool flag2 = false;
                             foreach (AttachmentHandle attachmentHandle in rightsManagedMessageItem.ProtectedAttachmentCollection)
                             {
                                 if (!attachmentHandle.IsInline)
                                 {
                                     flag2 = true;
                                     break;
                                 }
                             }
                             messageItem[MessageItemSchema.AllAttachmentsHidden] = !flag2;
                             rightsManagedMessageItem.AbandonChangesOnProtectedData();
                         }
                         messageItem.Save(SaveMode.ResolveConflicts);
                         if (DrmClientUtils.IsCachingOfLicenseDisabled(useLicenseAndUsageRights.UseLicense))
                         {
                             this.EnqueueLicensingError(asyncState.MessageId, SanitizedHtmlString.FromStringId(-1616549110, this.userCulture), asyncState.RequestCorrelator);
                         }
                         else
                         {
                             this.EnqueueLicenseAcquired(asyncState.MessageId, asyncState.RequestCorrelator);
                         }
                     }
                 }
             }
             finally
             {
                 if (this.userContext.LockedByCurrentThread() && flag)
                 {
                     this.userContext.Unlock();
                 }
             }
         }
     }
     catch (OwaLockTimeoutException arg)
     {
         IrmLicensingManager.Tracer.TraceError <OwaLockTimeoutException>((long)this.GetHashCode(), "AcquireLicenseAndRightsCB: timed-out at acquiring user context lock.  Exception: {0}", arg);
         this.EnqueueLicensingError(asyncState.MessageId, new SanitizedHtmlString(LocalizedStrings.GetNonEncoded(858913858)), asyncState.RequestCorrelator);
     }
     catch (ExchangeConfigurationException arg2)
     {
         IrmLicensingManager.Tracer.TraceError <ExchangeConfigurationException>((long)this.GetHashCode(), "AcquireLicenseAndRightsCB: caught exception.  Exception: {0}", arg2);
         this.HandleExchangeConfigurationException(asyncState.MessageId, asyncState.RequestCorrelator);
     }
     catch (RightsManagementException ex)
     {
         IrmLicensingManager.Tracer.TraceError <RightsManagementException>((long)this.GetHashCode(), "AcquireLicenseAndRightsCB: caught exception.  Exception: {0}", ex);
         this.HandleRightsManagementException(ex, asyncState.MessageId, asyncState.RequestCorrelator);
     }
     catch (StoragePermanentException ex2)
     {
         IrmLicensingManager.Tracer.TraceError <StoragePermanentException>((long)this.GetHashCode(), "AcquireLicenseAndRightsCB: caught exception.  Exception: {0}", ex2);
         this.EnqueueLicensingError(asyncState.MessageId, SanitizedHtmlString.Format(LocalizedStrings.GetHtmlEncoded(994351595, this.userCulture), new object[]
         {
             ex2.Message
         }), asyncState.RequestCorrelator);
     }
     catch (TransientException arg3)
     {
         IrmLicensingManager.Tracer.TraceError <TransientException>((long)this.GetHashCode(), "AcquireLicenseAndRightsCB: caught exception.  Exception: {0}", arg3);
         this.EnqueueLicensingError(asyncState.MessageId, new SanitizedHtmlString(LocalizedStrings.GetNonEncoded(858913858)), asyncState.RequestCorrelator);
     }
     catch (Exception ex3)
     {
         IrmLicensingManager.Tracer.TraceError <Exception>((long)this.GetHashCode(), "AcquireLicenseAndRightsCB: caught exception.  Exception: {0}", ex3);
         if (Globals.SendWatsonReports)
         {
             IrmLicensingManager.Tracer.TraceError((long)this.GetHashCode(), "AcquireLicenseAndRightsCB: sending watson report...");
             string data = string.Format("OWA version: {0}; Message Id: {1}", Globals.ApplicationVersion, asyncState.MessageId.ToBase64String());
             ExWatson.AddExtraData(data);
             ExWatson.SendReport(ex3, ReportOptions.None, null);
             IrmLicensingManager.Tracer.TraceError((long)this.GetHashCode(), "AcquireLicenseAndRightsCB: watson report has been sent.");
         }
     }
 }