コード例 #1
0
 protected void cmdSearch_Click(object sender, EventArgs e)
 {
     if (txtSearch.Text != "")
     {
         ModuleController objModules = new ModuleController();
         int        searchTabId;
         ModuleInfo SearchModule = objModules.GetModuleByDefinition(PortalSettings.PortalId, "Search Results");
         if (SearchModule == null)
         {
             return;
         }
         else
         {
             searchTabId = SearchModule.TabID;
         }
         if (HostSettings.GetHostSetting("UseFriendlyUrls") == "Y")
         {
             Response.Redirect(Globals.NavigateURL(searchTabId) + "?Search=" + Server.UrlEncode(txtSearch.Text));
         }
         else
         {
             Response.Redirect(Globals.NavigateURL(searchTabId) + "&Search=" + Server.UrlEncode(txtSearch.Text));
         }
     }
 }
コード例 #2
0
        private void SearchExecute()
        {
            int ResultsTabid;

            if (Settings["SearchResultsModule"] != null)
            {
                ResultsTabid = int.Parse(Convert.ToString(Settings["SearchResultsModule"]));
            }
            else
            {
                //Get Default Page
                ModuleController objModules   = new ModuleController();
                ModuleInfo       SearchModule = objModules.GetModuleByDefinition(PortalSettings.PortalId, "Search Results");
                if (SearchModule == null)
                {
                    UI.Skins.Skin.AddModuleMessage(this, Localization.GetString("NoSearchModule", LocalResourceFile), ModuleMessageType.YellowWarning);
                    return;
                }
                else
                {
                    ResultsTabid = SearchModule.TabID;
                }
            }
            if (HostSettings.GetHostSetting("UseFriendlyUrls") == "Y")
            {
                Response.Redirect(Globals.NavigateURL(ResultsTabid) + "?Search=" + Server.UrlEncode(txtSearch.Text));
            }
            else
            {
                Response.Redirect(Globals.NavigateURL(ResultsTabid) + "&Search=" + Server.UrlEncode(txtSearch.Text));
            }
        }
コード例 #3
0
        public static void SendEmail(string from, string to, string cc, string bcc, string subject, string body)
        {
            MailMessage email = new MailMessage();

            if (!string.IsNullOrEmpty(from))
            {
                email.From = new MailAddress(from);
            }
            else
            {
                string hostEmail = HostSettings.GetHostSetting("HostEmail");
                email.From = new MailAddress(hostEmail);
            }
            to.Split(',').ToList().ForEach(t => email.To.Add(t));

            if (!string.IsNullOrEmpty(cc))
            {
                cc.Split(',').ToList().ForEach(x => email.CC.Add(x));
            }
            if (!string.IsNullOrEmpty(bcc))
            {
                bcc.Split(',').ToList().ForEach(x => email.Bcc.Add(x));
            }
            email.Subject      = subject;
            email.IsBodyHtml   = true;
            email.BodyEncoding = Encoding.UTF8;
            email.Body         = body;

            Util.Emailer.SendMail(email);
        }
コード例 #4
0
        protected void Page_Load(Object sender, EventArgs e)
        {
            // public attributes
            if (!String.IsNullOrEmpty(CssClass))
            {
                hypLogin.CssClass = CssClass;
            }

            if (Request.IsAuthenticated)
            {
                if (!String.IsNullOrEmpty(LogoffText))
                {
                    if (LogoffText.IndexOf("src=") != -1)
                    {
                        LogoffText = LogoffText.Replace("src=\"", "src=\"" + PortalSettings.ActiveTab.SkinPath);
                    }
                    hypLogin.Text = LogoffText;
                }
                else
                {
                    hypLogin.Text = Localization.GetString("Logout", Localization.GetResourceFile(this, MyFileName));
                }

                if (HostSettings.GetHostSetting("UseFriendlyUrls") == "Y")
                {
                    hypLogin.NavigateUrl = Globals.FriendlyUrl(PortalSettings.ActiveTab, Globals.ApplicationURL(PortalSettings.ActiveTab.TabID) + "&portalid=" + PortalSettings.PortalId, "Logoff.aspx");
                }
                else
                {
                    hypLogin.NavigateUrl = ResolveUrl("~/Admin/Security/Logoff.aspx?tabid=" + PortalSettings.ActiveTab.TabID + "&portalid=" + PortalSettings.PortalId);
                }
            }
            else
            {
                if (!String.IsNullOrEmpty(Text))
                {
                    if (Text.IndexOf("src=") != -1)
                    {
                        Text = Text.Replace("src=\"", "src=\"" + PortalSettings.ActiveTab.SkinPath);
                    }
                    hypLogin.Text = Text;
                }
                else
                {
                    hypLogin.Text = Localization.GetString("Login", Localization.GetResourceFile(this, MyFileName));
                }

                if (PortalSettings.LoginTabId != -1 && Request.QueryString["override"] == null)
                {
                    // user defined tab
                    hypLogin.NavigateUrl = Globals.NavigateURL(PortalSettings.LoginTabId);
                }
                else
                {
                    // admin tab
                    hypLogin.NavigateUrl = Globals.NavigateURL("Login");
                }
            }
        }
コード例 #5
0
        /// <summary>
        /// Sends all queued emails
        /// </summary>
        public override void DoWork()
        {
            try
            {
                int successCount = 0;
                using (IDataReader queuedEmails = AppointmentSqlDataProvider.GetQueuedEmails())
                {
                    while (queuedEmails.Read())
                    {
                        string result = SendMail(
                            new PortalController().GetPortal((int)queuedEmails["PortalId"]).Email,
                            queuedEmails["RecipientList"].ToString(),
                            string.Empty,
                            string.Empty,
                            string.Empty,
                            DotNetNuke.Services.Mail.MailPriority.Normal,
                            queuedEmails["Subject"].ToString(),
                            MailFormat.Html,
                            Encoding.UTF8,
                            queuedEmails["Body"].ToString(),
                            new string[] { queuedEmails["Attachment"].ToString() },
                            string.Empty,
                            string.Empty,
                            string.Empty,
                            string.Empty,
                            "Y".Equals(HostSettings.GetHostSetting("SMTPEnableSSL"), StringComparison.Ordinal));

                        if (string.IsNullOrEmpty(result))
                        {
                            AppointmentSqlDataProvider.ClearQueuedEmail((int)queuedEmails["QueueID"]);
                            successCount++;
                        }
                        else
                        {
                            this.ScheduleHistoryItem.AddLogNote("QueueID " + queuedEmails["QueueID"].ToString() + " failed to send.  SendMail error: " + result + "<br />");
                        }
                    }
                }

                this.ScheduleHistoryItem.Succeeded = true;
                this.ScheduleHistoryItem.AddLogNote("Email Scheduler completed successfully. " + successCount + " emails sent.<br />");
            }
            catch (Exception exc)
            {
                this.ScheduleHistoryItem.Succeeded = false;
                this.ScheduleHistoryItem.AddLogNote("Email Scheduler failed with the following error message: <br/>" + exc.Message + "<br />");
                this.Errored(ref exc);
            }
        }
コード例 #6
0
        public string SendEmailTemplate(EmailTemplateNames templateName, Dictionary <string, string> tokens, string sendToEmail, DataModel.Store store)
        {
            //string storeEmail = storeContext.CurrentStore.GetSetting(StoreSettingNames.OrderCompletedEmailRecipient);
            string storeEmail           = store.GetSetting(StoreSettingNames.OrderCompletedEmailRecipient);
            string customerServiceEmail = store.GetSetting(StoreSettingNames.CustomerServiceEmailAddress);
            string hostEmail            = HostSettings.GetHostSetting("HostEmail");
            string from = !string.IsNullOrEmpty(customerServiceEmail) ? customerServiceEmail : hostEmail;

            vStoreEmailTemplate emailTemplate = store.GetStoreEmailTemplate(templateName);

            string subject = tokenizer.ReplaceTokensInString(HttpUtility.HtmlDecode(emailTemplate.SubjectTemplate), tokens);
            string body    = tokenizer.ReplaceTokensInString(HttpUtility.HtmlDecode(emailTemplate.BodyTemplate), tokens);

            body = InjectEmailCssIntoBody(body);

            return(SendEmail(from, sendToEmail, subject, body, true));
        }
コード例 #7
0
        /// <summary>
        /// Get the current settings from the xml config file
        /// </summary>
        public static Settings GetSettings()
        {
            Settings settings = (Settings)DataCache.GetCache("CompressionConfig");

            if (settings == null)
            {
                settings = Default;

                //Place this in a try/catch as during install the host settings will not exist
                try
                {
                    if (!String.IsNullOrEmpty(HostSettings.GetHostSetting("HttpCompression")))
                    {
                        settings._preferredAlgorithm = (Algorithms)(Convert.ToInt32(HostSettings.GetHostSetting("HttpCompression")));
                    }
                    if (!String.IsNullOrEmpty(HostSettings.GetHostSetting("HttpCompressionLevel")))
                    {
                        settings._compressionLevel = (CompressionLevels)(Convert.ToInt32(HostSettings.GetHostSetting("HttpCompressionLevel")));
                    }
                    if (!String.IsNullOrEmpty(HostSettings.GetHostSetting("WhitespaceFilter")))
                    {
                        settings._whitespace = HostSettings.GetHostSetting("WhitespaceFilter") == "Y" ? true : false;
                    }
                }
                catch (Exception e)
                {
                }

                string filePath = Globals.ApplicationMapPath + "\\Compression.config";

                if (!File.Exists(filePath))
                {
                    //Copy from \Config
                    if (File.Exists(Globals.ApplicationMapPath + Globals.glbConfigFolder + "Compression.config"))
                    {
                        File.Copy(Globals.ApplicationMapPath + Globals.glbConfigFolder + "Compression.config", Globals.ApplicationMapPath + "\\Compression.config", true);
                    }
                }

                //Create a FileStream for the Config file
                FileStream fileReader = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read);

                XPathDocument doc = new XPathDocument(fileReader);

                settings._reg = new Regex(doc.CreateNavigator().SelectSingleNode("compression/whitespace").Value);

                foreach (XPathNavigator nav in doc.CreateNavigator().Select("compression/excludedMimeTypes/mimeType"))
                {
                    settings._excludedTypes.Add(nav.Value.ToLower());
                }
                foreach (XPathNavigator nav in doc.CreateNavigator().Select("compression/excludedPaths/path"))
                {
                    settings._excludedPaths.Add(nav.Value.ToLower());
                }

                if (File.Exists(filePath))
                {
                    //Create a dependancy on SiteUrls.config
                    CacheDependency dep = new CacheDependency(filePath);

                    //Set back into Cache
                    DataCache.SetCache("CompressionConfig", settings, dep);
                }
            }

            return(settings);
        }