Ejemplo n.º 1
0
        public void LoadForums()
        {
            //Dim dr As IDataReader
            //dr = DataProvider.Instance.PortalForums(PortalId)
            //Dim i As Integer = 0
            //While dr.Read
            //    drpForumInstance.Items.Insert(i, New Web.UI.WebControls.ListItem(CType(dr("TabName"), String), CType(dr("ModuleID"), String)))
            //End While
            //dr.Close()
            int i  = 0;
            var mc = new Entities.Modules.ModuleController();
            var tc = new Entities.Tabs.TabController();

            Entities.Tabs.TabInfo ti;
            foreach (Entities.Modules.ModuleInfo mi in mc.GetModules(PortalId))
            {
                if (mi.DesktopModule.ModuleName.Trim().ToLowerInvariant() == "Active Forums".ToLowerInvariant() && mi.IsDeleted == false)
                {
                    ti = tc.GetTab(mi.TabID, PortalId, false);
                    if (ti != null)
                    {
                        if (ti.IsDeleted == false)
                        {
                            drpForumInstance.Items.Insert(i, new ListItem(ti.TabName + " - " + mi.DesktopModule.ModuleName, Convert.ToString(mi.ModuleID)));
                            i += 1;
                        }
                    }
                }
            }

            drpForumInstance.Items.Insert(0, new ListItem("-- Select a Forum Instance --", "-1"));
        }
        public int GetActiveSocialStatus(int PortalId)
        {
#if SKU_LITE
            //Not Available
            return(-2);
#else
            //TODO: the following can probably be removed? Not sure on AS support anymore
            if (System.IO.File.Exists(HttpContext.Current.Server.MapPath("~/bin/active.modules.social.dll")))
            {
                var mc = new Entities.Modules.ModuleController();
                var tc = new Entities.Tabs.TabController();
                Entities.Tabs.TabInfo ti;
                foreach (Entities.Modules.ModuleInfo mi in mc.GetModules(PortalId))
                {
                    if (mi.DesktopModule.ModuleName.Contains("Active Social") && mi.IsDeleted == false)
                    {
                        ti = tc.GetTab(mi.TabID, PortalId, false);
                        if (ti != null)
                        {
                            if (ti.IsDeleted == false)
                            {
                                //Installed and ready
                                return(1);
                            }
                        }
                    }
                }
                //Not installed on portal
                return(0);
            }
            //Not Installed
            return(-1);
#endif
        }
Ejemplo n.º 3
0
        public int GetActiveSocialStatus(int PortalId)
        {
#if SKU_LITE
			//Not Available
			return -2;
#else
            //TODO: the following can probably be removed? Not sure on AS support anymore
            if (System.IO.File.Exists(HttpContext.Current.Server.MapPath("~/bin/active.modules.social.dll")))
            {
                var mc = new Entities.Modules.ModuleController();
                var tc = new Entities.Tabs.TabController();
                Entities.Tabs.TabInfo ti;
                foreach (Entities.Modules.ModuleInfo mi in mc.GetModules(PortalId))
                {
                    if (mi.ModuleName.Contains("Active Social") && mi.IsDeleted == false)
                    {
                        ti = tc.GetTab(mi.TabID, PortalId, false);
                        if (ti != null)
                        {
                            if (ti.IsDeleted == false)
                            {
                                //Installed and ready
                                return 1;
                            }
                        }
                    }
                }
                //Not installed on portal
                return 0;
            }
            //Not Installed
            return -1;
#endif
        }
        private void BindPrivateMessagingTab()
        {
            drpMessagingTab.Items.Clear();
            drpMessagingTab.ClearSelection();

            var mc = new Entities.Modules.ModuleController();
            var tc = new TabController();

            foreach (Entities.Modules.ModuleInfo mi in mc.GetModules(PortalId))
            {
                if (!mi.DesktopModule.ModuleName.Contains("DnnForge - PrivateMessages") || mi.IsDeleted)
                {
                    continue;
                }

                var ti = tc.GetTab(mi.TabID, PortalId, false);
                if (ti != null && !ti.IsDeleted)
                {
                    drpMessagingTab.Items.Add(new ListItem
                    {
                        Text     = ti.TabName + " - Ventrian Messages",
                        Value    = ti.TabID.ToString(),
                        Selected = ti.TabID == MessagingTabId
                    });
                }
            }

            if (drpMessagingTab.Items.Count == 0)
            {
                drpMessagingTab.Items.Add(new ListItem("No Messaging Tabs Found", "-1"));
                drpMessagingTab.Enabled = false;
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// SaveMediaSettings - this allows you to abstract the saving of the settings that can be defined
        /// </summary>
        /// <remarks>
        /// 20120820 - Created.
        /// </remarks>
        private void SaveMediaSettings()
        {
            Entities.Modules.ModuleController ctlModule = new Entities.Modules.ModuleController();

            // save settings to the module settings data store
            ctlModule.UpdateModuleSetting(ModuleId, MediaController.SETTING_POSTTOJOURNAL, chkPostToJournal.Checked.ToString());
            ctlModule.UpdateModuleSetting(ModuleId, MediaController.SETTING_OVERRIDEJOURNALSETTING, chkOverrideJournalSetting.Checked.ToString());

            ///
            /// TODO: Need to add logic to take the setting changes below into account before leaving the page
            /// Example: Notify users before leaving this view if that setting just got saved.
            ///

            if (IsCurrentUserAdmin)
            {
                // save settings to the portal settings data store
                Entities.Portals.PortalController.UpdatePortalSetting(PortalId, MediaController.SETTING_POSTTOJOURNAL, chkPostToJournal.Checked.ToString(), true, PortalSettings.CultureCode);
                Entities.Portals.PortalController.UpdatePortalSetting(PortalId, MediaController.SETTING_POSTTOJOURNALSITEWIDE, chkPostToJournalSiteWide.Checked.ToString(), true, PortalSettings.CultureCode);

                Entities.Portals.PortalController.UpdatePortalSetting(PortalId, MediaController.SETTING_NOTIFYONUPDATE, chkNotifyOnUpdate.Checked.ToString(), true, PortalSettings.CultureCode);
            }

            // force the module to use the new settings
            Entities.Modules.ModuleController.SynchronizeModule(ModuleId);
        }
        public HttpResponseMessage RunMaintenance(RunMaintenanceDTO dto)
        {
            var objModules = new Entities.Modules.ModuleController();
            var objSettings = new SettingsInfo {MainSettings = objModules.GetModuleSettings(dto.ModuleId)};
            var rows = DataProvider.Instance().Forum_Maintenance(dto.ForumId, dto.OlderThan, dto.LastActive, dto.ByUserId, dto.WithNoReplies, dto.DryRun, objSettings.DeleteBehavior);
            if (dto.DryRun)
                return Request.CreateResponse(HttpStatusCode.OK, new { Result = string.Format(Utilities.GetSharedResource("[RESX:Maint:DryRunResults]", true), rows.ToString()) });

            return Request.CreateResponse(HttpStatusCode.OK, new { Result = Utilities.GetSharedResource("[RESX:ProcessComplete]", true) });
        }
        public HttpResponseMessage RunMaintenance(RunMaintenanceDTO dto)
        {
            var objModules  = new Entities.Modules.ModuleController();
            var objSettings = new SettingsInfo {
                MainSettings = objModules.GetModuleSettings(dto.ModuleId)
            };
            var rows = DataProvider.Instance().Forum_Maintenance(dto.ForumId, dto.OlderThan, dto.LastActive, dto.ByUserId, dto.WithNoReplies, dto.DryRun, objSettings.DeleteBehavior);

            if (dto.DryRun)
            {
                return(Request.CreateResponse(HttpStatusCode.OK, new { Result = string.Format(Utilities.GetSharedResource("[RESX:Maint:DryRunResults]", true), rows.ToString()) }));
            }

            return(Request.CreateResponse(HttpStatusCode.OK, new { Result = Utilities.GetSharedResource("[RESX:ProcessComplete]", true) }));
        }
        public HttpResponseMessage ToggleURLHandler(ToggleUrlHandlerDTO dto)
        {
            var objModules = new Entities.Modules.ModuleController();
            var objSettings = new SettingsInfo { MainSettings = objModules.GetModuleSettings(dto.ModuleId) };
            var cfg = new ConfigUtils();
            bool success;
            if (Utilities.IsRewriteLoaded())
            {
                cfg.DisableRewriter(HttpContext.Current.Server.MapPath("~/web.config"));
                return Request.CreateResponse(HttpStatusCode.OK, "disabled");
            }

            cfg.EnableRewriter(HttpContext.Current.Server.MapPath("~/web.config"));
            return Request.CreateResponse(HttpStatusCode.OK, "enabled");
        }
        public HttpResponseMessage ToggleURLHandler(ToggleUrlHandlerDTO dto)
        {
            var objModules  = new Entities.Modules.ModuleController();
            var objSettings = new SettingsInfo {
                MainSettings = objModules.GetModuleSettings(dto.ModuleId)
            };
            var  cfg = new ConfigUtils();
            bool success;

            if (Utilities.IsRewriteLoaded())
            {
                cfg.DisableRewriter(HttpContext.Current.Server.MapPath("~/web.config"));
                return(Request.CreateResponse(HttpStatusCode.OK, "disabled"));
            }

            cfg.EnableRewriter(HttpContext.Current.Server.MapPath("~/web.config"));
            return(Request.CreateResponse(HttpStatusCode.OK, "enabled"));
        }
Ejemplo n.º 10
0
		private void LoadSettings(int PortalId, int ModuleId)
		{
			try
			{
				var objModules = new Entities.Modules.ModuleController();
				var xDoc = new System.Xml.XmlDocument();
				xDoc.Load(sPath);
				if (xDoc != null)
				{

					System.Xml.XmlNode xRoot = xDoc.DocumentElement;
					System.Xml.XmlNodeList xNodeList = xRoot.SelectNodes("//mainsettings/setting");
					if (xNodeList.Count > 0)
					{
						int i;
						for (i = 0; i < xNodeList.Count; i++)
						{
							objModules.UpdateModuleSetting(ModuleId, xNodeList[i].Attributes["name"].Value, xNodeList[i].Attributes["value"].Value);

						}
					}
				}
				objModules.UpdateModuleSetting(ModuleId, SettingKeys.IsInstalled, "True");
				objModules.UpdateModuleSetting(ModuleId, "NeedsConvert", "False");
				try
				{
					System.Globalization.DateTimeFormatInfo nfi = new System.Globalization.CultureInfo("en-US", true).DateTimeFormat;


					objModules.UpdateModuleSetting(ModuleId, SettingKeys.InstallDate, DateTime.Now.ToString(new System.Globalization.CultureInfo("en-US")));
				}
				catch (Exception ex)
				{
					Services.Exceptions.Exceptions.LogException(ex);
				}
			}
			catch (Exception ex)
			{

			}
		}
Ejemplo n.º 11
0
 public override void UpdateSettings()
 {
     try
     {
         var objModules = new Entities.Modules.ModuleController();
         // Update ModuleSettings
         objModules.UpdateModuleSetting(ModuleId, "AFTopicsTemplate", drpTopicsTemplate.SelectedItem.Value);
         objModules.UpdateModuleSetting(ModuleId, "AFTopicTemplate", drpTopicTemplate.SelectedItem.Value);
         objModules.UpdateModuleSetting(ModuleId, "AFForumViewTemplate", drpForumViewTemplate.SelectedItem.Value);
         objModules.UpdateModuleSetting(ModuleId, "AFForumModuleID", drpForumInstance.SelectedItem.Value);
         objModules.UpdateModuleSetting(ModuleId, "AFForumGroup", drpForum.SelectedItem.Value);
         //objModules.UpdateModuleSetting(ModuleId, "AFEnableToolbar", CType(chkEnableToolbar.Checked, String))
         string ForumGroup;
         int    ForumGroupID = 0;
         ForumGroup = drpForum.SelectedItem.Value;
         if ((ForumGroup.IndexOf("GROUPID:", 0) + 1) > 0)
         {
             objModules.UpdateModuleSetting(ModuleId, "AFViewType", "AFGROUP");
         }
         else
         {
             objModules.UpdateModuleSetting(ModuleId, "AFViewType", "TOPICS");
         }
         int    @int = ForumGroup.IndexOf(":") + 1;
         string sID  = ForumGroup.Substring(@int);
         //ForumGroupID = CType(ForumGroup.Substring(ForumGroup.IndexOf(":")), Integer)
         objModules.UpdateModuleSetting(ModuleId, "AFForumGroupID", sID);
         DataCache.CacheClear(drpForumInstance.SelectedItem.Value + TabId + sID + "TopicTemplate");
         DataCache.CacheClear(drpForumInstance.SelectedItem.Value + TabId + sID + "TopicsTemplate");
         DataCache.CacheClear(drpForumInstance.SelectedItem.Value + TabId + "ForumTemplate");
         // Redirect back to the portal home page
         Response.Redirect(Utilities.NavigateUrl(TabId), true);
     }
     catch (Exception exc)
     {
         Services.Exceptions.Exceptions.ProcessModuleLoadException(this, exc);
     }
 }
		public override void UpdateSettings()
		{
			try
			{
				var objModules = new Entities.Modules.ModuleController();
				// Update ModuleSettings
				objModules.UpdateModuleSetting(ModuleId, "AFTopicsTemplate", drpTopicsTemplate.SelectedItem.Value);
				objModules.UpdateModuleSetting(ModuleId, "AFTopicTemplate", drpTopicTemplate.SelectedItem.Value);
				objModules.UpdateModuleSetting(ModuleId, "AFForumViewTemplate", drpForumViewTemplate.SelectedItem.Value);
				objModules.UpdateModuleSetting(ModuleId, "AFForumModuleID", drpForumInstance.SelectedItem.Value);
				objModules.UpdateModuleSetting(ModuleId, "AFForumGroup", drpForum.SelectedItem.Value);
				//objModules.UpdateModuleSetting(ModuleId, "AFEnableToolbar", CType(chkEnableToolbar.Checked, String))
				string ForumGroup;
				int ForumGroupID = 0;
				ForumGroup = drpForum.SelectedItem.Value;
				if ((ForumGroup.IndexOf("GROUPID:", 0) + 1) > 0)
				{
					objModules.UpdateModuleSetting(ModuleId, "AFViewType", "AFGROUP");
				}
				else
				{
					objModules.UpdateModuleSetting(ModuleId, "AFViewType", "TOPICS");
				}
				int @int = ForumGroup.IndexOf(":") + 1;
				string sID = ForumGroup.Substring(@int);
				//ForumGroupID = CType(ForumGroup.Substring(ForumGroup.IndexOf(":")), Integer)
				objModules.UpdateModuleSetting(ModuleId, "AFForumGroupID", sID);
				DataCache.CacheClear(drpForumInstance.SelectedItem.Value + TabId + sID + "TopicTemplate");
				DataCache.CacheClear(drpForumInstance.SelectedItem.Value + TabId + sID + "TopicsTemplate");
				DataCache.CacheClear(drpForumInstance.SelectedItem.Value + TabId + "ForumTemplate");
				// Redirect back to the portal home page
				Response.Redirect(Utilities.NavigateUrl(TabId), true);
			}
			catch (Exception exc)
			{
				Services.Exceptions.Exceptions.ProcessModuleLoadException(this, exc);
			}
		}
        private void LoadSettings(int PortalId, int ModuleId)
        {
            try
            {
                var objModules = new Entities.Modules.ModuleController();
                var xDoc       = new System.Xml.XmlDocument();
                xDoc.Load(sPath);
                if (xDoc != null)
                {
                    System.Xml.XmlNode     xRoot     = xDoc.DocumentElement;
                    System.Xml.XmlNodeList xNodeList = xRoot.SelectNodes("//mainsettings/setting");
                    if (xNodeList.Count > 0)
                    {
                        int i;
                        for (i = 0; i < xNodeList.Count; i++)
                        {
                            objModules.UpdateModuleSetting(ModuleId, xNodeList[i].Attributes["name"].Value, xNodeList[i].Attributes["value"].Value);
                        }
                    }
                }
                objModules.UpdateModuleSetting(ModuleId, SettingKeys.IsInstalled, "True");
                objModules.UpdateModuleSetting(ModuleId, "NeedsConvert", "False");
                try
                {
                    System.Globalization.DateTimeFormatInfo nfi = new System.Globalization.CultureInfo("en-US", true).DateTimeFormat;


                    objModules.UpdateModuleSetting(ModuleId, SettingKeys.InstallDate, DateTime.Now.ToString(new System.Globalization.CultureInfo("en-US")));
                }
                catch (Exception ex)
                {
                    Services.Exceptions.Exceptions.LogException(ex);
                }
            }
            catch (Exception ex)
            {
            }
        }
Ejemplo n.º 14
0
        public void OnBeginRequest(object s, EventArgs e)
        {
            _forumId      = -1;
            _tabId        = -1;
            _moduleId     = -1;
            _topicId      = -1;
            _page         = 1;
            _contentId    = -1;
            _archived     = 0;
            _forumgroupId = -1;
            _mainSettings = null;
            _categoryId   = -1;
            _tagId        = -1;

            HttpApplication   app           = (HttpApplication)s;
            HttpServerUtility Server        = app.Server;
            HttpRequest       Request       = app.Request;
            HttpResponse      Response      = app.Response;
            string            requestedPath = app.Request.Url.AbsoluteUri;
            HttpContext       Context       = ((HttpApplication)s).Context;
            int PortalId = -1;

            DotNetNuke.Entities.Portals.PortalAliasInfo objPortalAliasInfo = null;
            string sUrl = HttpContext.Current.Request.RawUrl.Replace("http://", string.Empty).Replace("https://", string.Empty);

            objPortalAliasInfo = PortalAliasController.Instance.GetPortalAlias(HttpContext.Current.Request.Url.Host);
            if (Request.RawUrl.ToLowerInvariant().Contains("404.aspx"))
            {
                string sEx = ".jpg,.gif,.png,.swf,.js,.css,.html,.htm,desktopmodules,portals,.ashx,.ico,.txt,.doc,.docx,.pdf,.xml,.xls,.xlsx,.ppt,.pptx,.csv,.zip,.asmx,.aspx";
                foreach (string sn in sEx.Split(','))
                {
                    if (sUrl.Contains(sn))
                    {
                        // IO.File.AppendAllText(sPath, Request.RawUrl & "165<br />")
                        return;
                    }
                }
            }
            if (Request.Url.LocalPath.ToLower().Contains("scriptresource.axd") || Request.Url.LocalPath.ToLower().Contains("webresource.axd") || Request.Url.LocalPath.ToLower().Contains("viewer.aspx") || Request.Url.LocalPath.ToLower().Contains("cb.aspx") || Request.Url.LocalPath.ToLower().Contains("filesupload.aspx") || Request.Url.LocalPath.ToLower().Contains(".gif") || Request.Url.LocalPath.ToLower().Contains(".jpg") || Request.Url.LocalPath.ToLower().Contains(".css") || Request.Url.LocalPath.ToLower().Contains(".png") || Request.Url.LocalPath.ToLower().Contains(".swf") || Request.Url.LocalPath.ToLower().Contains(".htm") || Request.Url.LocalPath.ToLower().Contains(".html") || Request.Url.LocalPath.ToLower().Contains(".ashx") || Request.Url.LocalPath.ToLower().Contains(".cur") || Request.Url.LocalPath.ToLower().Contains(".ico") || Request.Url.LocalPath.ToLower().Contains(".txt") || Request.Url.LocalPath.ToLower().Contains(".pdf") || Request.Url.LocalPath.ToLower().Contains(".xml") || Request.Url.LocalPath.ToLower().Contains("/portals/") || Request.Url.LocalPath.ToLower().Contains("/desktopmodules/") || Request.Url.LocalPath.ToLower().Contains("evexport.aspx") || Request.Url.LocalPath.ToLower().Contains("signupjs.aspx") || Request.Url.LocalPath.ToLower().Contains("evsexport.aspx") || Request.Url.LocalPath.ToLower().Contains("fbcomm.aspx") || Request.Url.LocalPath.ToLower().Contains(".aspx") || Request.Url.LocalPath.ToLower().Contains(".js"))
            {
                return;
            }
            if (Request.Url.LocalPath.ToLower().Contains("install.aspx") || Request.Url.LocalPath.ToLower().Contains("installwizard.aspx") || Request.Url.LocalPath.ToLower().Contains("captcha.aspx") || Request.RawUrl.Contains("viewer.aspx") || Request.RawUrl.Contains("blank.html") || Request.RawUrl.Contains("default.htm") || Request.RawUrl.Contains("autosuggest.aspx"))
            {
                return;
            }
            PortalId = objPortalAliasInfo.PortalID;
            string searchURL = sUrl;

            searchURL = searchURL.Replace(objPortalAliasInfo.HTTPAlias, string.Empty);
            if (searchURL.Length < 2)
            {
                return;
            }
            string query = string.Empty;

            if (searchURL.Contains("?"))
            {
                query     = searchURL.Substring(searchURL.IndexOf("?"));
                searchURL = searchURL.Substring(0, searchURL.IndexOf("?") - 1);
            }
            string newSearchURL = string.Empty;

            foreach (string up in searchURL.Split('/'))
            {
                if (!(string.IsNullOrEmpty(up)))
                {
                    if (!(SimulateIsNumeric.IsNumeric(up)))
                    {
                        newSearchURL += up + "/";
                    }
                }
            }
            bool canContinue = false;

            Data.Common db      = new Data.Common();
            string      tagName = string.Empty;
            string      catName = string.Empty;

            if (newSearchURL.Contains("/category/") || newSearchURL.Contains("/tag/"))
            {
                if (newSearchURL.Contains("/category/"))
                {
                    string cat       = "/category/";
                    int    iEnd      = newSearchURL.IndexOf("/", newSearchURL.IndexOf(cat) + cat.Length + 1);
                    string catString = newSearchURL.Substring(newSearchURL.IndexOf(cat), iEnd - newSearchURL.IndexOf(cat));
                    catName      = catString.Replace(cat, string.Empty);
                    catName      = catName.Replace("/", string.Empty);
                    newSearchURL = newSearchURL.Replace(catString, string.Empty);
                }
                if (newSearchURL.Contains("/tag/"))
                {
                    string tag       = "/tag/";
                    int    iEnd      = newSearchURL.IndexOf("/", newSearchURL.IndexOf(tag) + tag.Length + 1);
                    string tagString = newSearchURL.Substring(newSearchURL.IndexOf(tag), iEnd - newSearchURL.IndexOf(tag));
                    tagName      = tagString.Replace(tag, string.Empty);
                    tagName      = tagName.Replace("/", string.Empty);
                    newSearchURL = newSearchURL.Replace(tagString, string.Empty);
                }
            }
            if ((sUrl.Contains("afv") && sUrl.Contains("post")) | (sUrl.Contains("afv") && sUrl.Contains("confirmaction")) | (sUrl.Contains("afv") && sUrl.Contains("sendto")) | (sUrl.Contains("afv") && sUrl.Contains("modreport")) | (sUrl.Contains("afv") && sUrl.Contains("search")) | sUrl.Contains("dnnprintmode") || sUrl.Contains("asg") || (sUrl.Contains("afv") && sUrl.Contains("modtopics")))
            {
                return;
            }
            try
            {
                using (IDataReader dr = db.URLSearch(PortalId, newSearchURL))
                {
                    while (dr.Read())
                    {
                        _tabId        = int.Parse(dr["TabID"].ToString());
                        _moduleId     = int.Parse(dr["ModuleId"].ToString());
                        _forumgroupId = int.Parse(dr["ForumGroupId"].ToString());
                        _forumId      = int.Parse(dr["ForumId"].ToString());
                        _topicId      = int.Parse(dr["TopicId"].ToString());
                        _archived     = int.Parse(dr["Archived"].ToString());
                        _otherId      = int.Parse(dr["OtherId"].ToString());
                        _urlType      = int.Parse(dr["UrlType"].ToString());
                        canContinue   = true;
                    }
                    dr.Close();
                }
            }
            catch (Exception ex)
            {
            }
            if (!(string.IsNullOrEmpty(catName)))
            {
                _categoryId = db.Tag_GetIdByName(PortalId, _moduleId, catName, true);
                _otherId    = _categoryId;
                _urlType    = 2;
            }
            if (!(string.IsNullOrEmpty(tagName)))
            {
                _tagId   = db.Tag_GetIdByName(PortalId, _moduleId, tagName, false);
                _otherId = _tagId;
                _urlType = 3;
            }

            if (_archived == 1)
            {
                sUrl = db.GetUrl(_moduleId, _forumgroupId, _forumId, _topicId, _userId, -1);
                if (!(string.IsNullOrEmpty(sUrl)))
                {
                    string sHost = objPortalAliasInfo.HTTPAlias;
                    if (sUrl.StartsWith("/"))
                    {
                        sUrl = sUrl.Substring(1);
                    }
                    if (!(sHost.EndsWith("/")))
                    {
                        sHost += "/";
                    }
                    sUrl = sHost + sUrl;
                    if (!(sUrl.EndsWith("/")))
                    {
                        sUrl += "/";
                    }
                    if (!(sUrl.StartsWith("http")))
                    {
                        if (Request.IsSecureConnection)
                        {
                            sUrl = "https://" + sUrl;
                        }
                        else
                        {
                            sUrl = "http://" + sUrl;
                        }
                    }
                    Response.Clear();
                    Response.Status = "301 Moved Permanently";
                    Response.AddHeader("Location", sUrl);
                    Response.End();
                }
            }
            if (_moduleId > 0)
            {
                Entities.Modules.ModuleController objModules = new Entities.Modules.ModuleController();
                SettingsInfo objSettings = new SettingsInfo();
                objSettings.MainSettings = objModules.GetModuleSettings(_moduleId);
                _mainSettings            = objSettings;      // DataCache.MainSettings(_moduleId)
            }
            if (_mainSettings == null)
            {
                return;
            }
            if (!_mainSettings.URLRewriteEnabled)
            {
                return;
            }
            if (!canContinue && (Request.RawUrl.Contains(ParamKeys.TopicId) || Request.RawUrl.Contains(ParamKeys.ForumId) || Request.RawUrl.Contains(ParamKeys.GroupId)))
            {
                sUrl = HandleOldUrls(Request.RawUrl, objPortalAliasInfo.HTTPAlias);
                if (!(string.IsNullOrEmpty(sUrl)))
                {
                    if (!(sUrl.StartsWith("http")))
                    {
                        if (Request.IsSecureConnection)
                        {
                            sUrl = "https://" + sUrl;
                        }
                        else
                        {
                            sUrl = "http://" + sUrl;
                        }
                    }
                    Response.Clear();
                    Response.Status = "301 Moved Permanently";
                    Response.AddHeader("Location", sUrl);
                    Response.End();
                }
            }
            if (!canContinue)
            {
                string topicUrl = string.Empty;
                if (newSearchURL.EndsWith("/"))
                {
                    newSearchURL = newSearchURL.Substring(0, newSearchURL.Length - 1);
                }
                if (newSearchURL.Contains("/"))
                {
                    topicUrl = newSearchURL.Substring(newSearchURL.LastIndexOf("/"));
                }
                topicUrl = topicUrl.Replace("/", string.Empty);
                if (!(string.IsNullOrEmpty(topicUrl)))
                {
                    Data.Topics topicsDb = new Data.Topics();
                    _topicId = topicsDb.TopicIdByUrl(PortalId, _moduleId, topicUrl.ToLowerInvariant());
                    if (_topicId > 0)
                    {
                        sUrl = db.GetUrl(_moduleId, _forumgroupId, _forumId, _topicId, _userId, -1);
                    }
                    else
                    {
                        sUrl = string.Empty;
                    }
                    if (!(string.IsNullOrEmpty(sUrl)))
                    {
                        string sHost = objPortalAliasInfo.HTTPAlias;
                        if (sHost.EndsWith("/") && sUrl.StartsWith("/"))
                        {
                            sUrl = sHost.Substring(0, sHost.Length - 1) + sUrl;
                        }
                        else if (!(sHost.EndsWith("/")) && !(sUrl.StartsWith("/")))
                        {
                            sUrl = sHost + "/" + sUrl;
                        }
                        else
                        {
                            sUrl = sHost + sUrl;
                        }
                        if (sUrl.StartsWith("/"))
                        {
                            sUrl = sUrl.Substring(1);
                        }
                        if (!(sUrl.StartsWith("http")))
                        {
                            if (Request.IsSecureConnection)
                            {
                                sUrl = "https://" + sUrl;
                            }
                            else
                            {
                                sUrl = "http://" + sUrl;
                            }
                        }
                        if (!(string.IsNullOrEmpty(sUrl)))
                        {
                            Response.Clear();
                            Response.Status = "301 Moved Permanently";
                            Response.AddHeader("Location", sUrl);
                            Response.End();
                        }
                    }
                }
            }

            if (canContinue)
            {
                if (searchURL != newSearchURL)
                {
                    string urlTail = searchURL.Replace(newSearchURL, string.Empty);
                    if (urlTail.StartsWith("/"))
                    {
                        urlTail = urlTail.Substring(1);
                    }
                    if (urlTail.EndsWith("/"))
                    {
                        urlTail = urlTail.Substring(0, urlTail.Length - 1);
                    }
                    if (urlTail.Contains("/"))
                    {
                        urlTail = urlTail.Substring(0, urlTail.IndexOf("/") - 1);
                    }
                    if (SimulateIsNumeric.IsNumeric(urlTail))
                    {
                        _page = Convert.ToInt32(urlTail);
                    }
                }

                string sPage = string.Empty;
                sPage = "&afpg=" + _page.ToString();
                string qs = string.Empty;
                if (sUrl.Contains("?"))
                {
                    qs = "&" + sUrl.Substring(sUrl.IndexOf("?") + 1);
                }
                string catQS = string.Empty;
                if (_categoryId > 0)
                {
                    catQS = "&act=" + _categoryId.ToString();
                }
                string sendTo = string.Empty;
                if (_topicId > 0)
                {
                    sendTo = ResolveUrl(app.Context.Request.ApplicationPath, "~/default.aspx?tabid=" + _tabId + "&aft=" + _topicId + sPage + qs);
                }
                else if (_forumId > 0)
                {
                    sendTo = ResolveUrl(app.Context.Request.ApplicationPath, "~/default.aspx?tabid=" + _tabId + "&aff=" + _forumId + sPage + qs + catQS);
                }
                else if (_forumgroupId > 0)
                {
                    sendTo = ResolveUrl(app.Context.Request.ApplicationPath, "~/default.aspx?tabid=" + _tabId + "&afg=" + _forumgroupId + sPage + qs + catQS);
                }
                else if (_urlType == 2 && _otherId > 0)
                {
                    sendTo = ResolveUrl(app.Context.Request.ApplicationPath, "~/default.aspx?tabid=" + _tabId + "&act=" + _otherId + sPage + qs);
                }
                else if (_urlType == 3 && _otherId > 0)
                {
                    sendTo = ResolveUrl(app.Context.Request.ApplicationPath, "~/default.aspx?tabid=" + _tabId + "&afv=grid&afgt=tags&aftg=" + _otherId + sPage + qs);
                }
                else if (_urlType == 1)
                {
                    string v = string.Empty;
                    switch (_otherId)
                    {
                    case 1:
                        v = "unanswered";
                        break;

                    case 2:
                        v = "notread";
                        break;

                    case 3:
                        v = "mytopics";
                        break;

                    case 4:
                        v = "activetopics";
                        break;

                    case 5:
                        v = "afprofile";
                        break;
                    }
                    sendTo = ResolveUrl(app.Context.Request.ApplicationPath, "~/default.aspx?tabid=" + _tabId + "&afv=grid&afgt=" + v + sPage + qs);
                }
                else if (_tabId > 0)
                {
                    sendTo = ResolveUrl(app.Context.Request.ApplicationPath, "~/default.aspx?tabid=" + _tabId + sPage + qs);
                }

                RewriteUrl(app.Context, sendTo);
            }
        }
Ejemplo n.º 15
0
        /// -----------------------------------------------------------------------------
        ///         ''' <summary>
        ///         ''' UpdateSettings saves the modified settings to the Database
        ///         ''' </summary>
        ///         ''' <remarks>
        ///         ''' </remarks>
        ///         ''' <history>
        ///         '''		[cnurse]	10/20/2004	created
        ///         '''		[cnurse]	10/25/2004	upated to use TabModuleId rather than TabId/ModuleId
        ///         ''' </history>
        ///         ''' -----------------------------------------------------------------------------
        public override void UpdateSettings()
        {
            try
            {
                Entities.Modules.ModuleController objModules = new Entities.Modules.ModuleController();
                // 2014 TODO: Menu
                objModules.UpdateModuleSetting(ModuleId, SettingName.DisplayMode, optControl.SelectedItem.Value);
                objModules.UpdateModuleSetting(ModuleId, SettingName.Direction, optView.SelectedItem.Value);
                objModules.UpdateModuleSetting(ModuleId, SettingName.LinkDescriptionMode, optInfo.SelectedItem.Value);
                objModules.UpdateModuleSetting(ModuleId, SettingName.Icon, ctlIcon.Url);
                objModules.UpdateModuleSetting(ModuleId, "nowrap", optNoWrap.SelectedItem.Value);
                objModules.UpdateModuleSetting(ModuleId, SettingName.ModuleContentType, optLinkModuleType.SelectedValue);
                objModules.UpdateModuleSetting(ModuleId, SettingName.UsePermissions, optUsePermissions.SelectedValue);
                // objModules.UpdateModuleSetting(ModuleId, "usepopup", optUsePopup.SelectedValue)
                objModules.UpdateModuleSetting(ModuleId, SettingName.DisplayAttribute, optDisplayAttribute.SelectedValue);
                objModules.UpdateModuleSetting(ModuleId, SettingName.DisplayOrder, optDisplayOrder.SelectedValue);
                // 2014 TODO
                objModules.UpdateModuleSetting(ModuleId, SettingName.MenuAllUsers, optMenuAllUsers.SelectedValue);

                switch ((Enums.ModuleContentTypes) int.Parse(optLinkModuleType.SelectedValue))
                {
                case Enums.ModuleContentTypes.Menu:
                {
                    objModules.UpdateModuleSetting(ModuleId, Consts.ModuleContentItem, optTypeContentSelection.SelectedValue);
                    break;
                }

                case Enums.ModuleContentTypes.Folder:
                {
                    objModules.UpdateModuleSetting(ModuleId, Consts.ModuleContentItem, optTypeContentSelection.SelectedValue);
                    objModules.UpdateModuleSetting(ModuleId, Consts.FolderId, optTypeContentSelection.SelectedValue);
                    break;
                }

                case Enums.ModuleContentTypes.Friends:
                {
                    objModules.UpdateModuleSetting(ModuleId, Consts.ModuleContentItem, optTypeContentSelection.SelectedValue);
                    break;
                }

                default:
                {
                    break;
                }
                }

                bool allowCaching = true;

                if (optControl.SelectedItem.Value == Consts.DisplayModeDropdown)
                {
                    allowCaching = false;
                }

                if (optInfo.SelectedItem.Value == "Y")
                {
                    allowCaching = false;
                }

                if (!allowCaching)
                {
                    DotNetNuke.Entities.Modules.ModuleInfo objModule = objModules.GetModule(ModuleId, TabId, false);
                    if (objModule.CacheTime > 0)
                    {
                        objModule.CacheTime = 0;
                        objModules.UpdateModule(objModule);
                    }
                }

                ModuleController.SynchronizeModule(ModuleId);
            }
            catch (Exception exc)
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Ejemplo n.º 16
0
		public bool MoveSettings(int forumModuleId, int tabModuleId)
		{
			var objModules = new Entities.Modules.ModuleController();
			var currSettings = new SettingsInfo {MainSettings = Settings.GeneralSettings(forumModuleId, "GEN")};

		    objModules.UpdateModuleSetting(tabModuleId, SettingKeys.PageSize, currSettings.PageSize.ToString());
			objModules.UpdateModuleSetting(tabModuleId, SettingKeys.UserNameDisplay, currSettings.UserNameDisplay);
			objModules.UpdateModuleSetting(tabModuleId, SettingKeys.ProfileVisibility, ((int)currSettings.ProfileVisibility).ToString());
			objModules.UpdateModuleSetting(tabModuleId, SettingKeys.EnablePoints, currSettings.EnablePoints.ToString());
			objModules.UpdateModuleSetting(tabModuleId, SettingKeys.TopicPointValue, currSettings.TopicPointValue.ToString());
			objModules.UpdateModuleSetting(tabModuleId, SettingKeys.ReplyPointValue, currSettings.ReplyPointValue.ToString());
			objModules.UpdateModuleSetting(tabModuleId, SettingKeys.AnswerPointValue, currSettings.AnswerPointValue.ToString());
			objModules.UpdateModuleSetting(tabModuleId, SettingKeys.MarkAnswerPointValue, currSettings.MarkAsAnswerPointValue.ToString());
			objModules.UpdateModuleSetting(tabModuleId, SettingKeys.ModPointValue, currSettings.ModPointValue.ToString());
			objModules.UpdateModuleSetting(tabModuleId, SettingKeys.AvatarHeight, currSettings.AvatarHeight.ToString());
			objModules.UpdateModuleSetting(tabModuleId, SettingKeys.AvatarWidth, currSettings.AvatarWidth.ToString());
			objModules.UpdateModuleSetting(tabModuleId, SettingKeys.AllowSignatures, currSettings.AllowSignatures.ToString());
			objModules.UpdateModuleSetting(tabModuleId, SettingKeys.ForumTemplateId, currSettings.ForumTemplateID.ToString());
			objModules.UpdateModuleSetting(tabModuleId, SettingKeys.InstallDate, currSettings.InstallDate.ToString());
			objModules.UpdateModuleSetting(tabModuleId, SettingKeys.IsInstalled, currSettings.IsInstalled.ToString());
			objModules.UpdateModuleSetting(tabModuleId, SettingKeys.Theme, currSettings.Theme);
			objModules.UpdateModuleSetting(tabModuleId, SettingKeys.FullText, currSettings.FullText.ToString());
			objModules.UpdateModuleSetting(tabModuleId, SettingKeys.MailQueue, currSettings.MailQueue.ToString());
			objModules.UpdateModuleSetting(tabModuleId, SettingKeys.FloodInterval, currSettings.FloodInterval.ToString());
			objModules.UpdateModuleSetting(tabModuleId, SettingKeys.EditInterval, currSettings.EditInterval.ToString());
			objModules.UpdateModuleSetting(tabModuleId, SettingKeys.DeleteBehavior, currSettings.DeleteBehavior.ToString());
			objModules.UpdateModuleSetting(tabModuleId, SettingKeys.AddThisAccount, currSettings.AddThisAccount);
			objModules.UpdateModuleSetting(tabModuleId, SettingKeys.EnableAutoLink, currSettings.AutoLinkEnabled.ToString());
			objModules.UpdateModuleSetting(tabModuleId, SettingKeys.EnableURLRewriter, currSettings.URLRewriteEnabled.ToString());
			if (string.IsNullOrEmpty(currSettings.PrefixURLBase))
			{
				objModules.UpdateModuleSetting(tabModuleId, SettingKeys.PrefixURLBase, "forums");
			}
			else
			{
				objModules.UpdateModuleSetting(tabModuleId, SettingKeys.PrefixURLBase, currSettings.PrefixURLBase);
			}
			if (string.IsNullOrEmpty(currSettings.PrefixURLOther))
			{
				objModules.UpdateModuleSetting(tabModuleId, SettingKeys.PrefixURLOther, "views");
			}
			else
			{
				objModules.UpdateModuleSetting(tabModuleId, SettingKeys.PrefixURLOther, currSettings.PrefixURLOther);
			}
			if (string.IsNullOrEmpty(currSettings.PrefixURLTag))
			{
				objModules.UpdateModuleSetting(tabModuleId, SettingKeys.PrefixURLTags, "tag");
			}
			else
			{
				objModules.UpdateModuleSetting(tabModuleId, SettingKeys.PrefixURLTags, currSettings.PrefixURLTag);
			}
			if (string.IsNullOrEmpty(currSettings.PrefixURLCategory))
			{
				objModules.UpdateModuleSetting(tabModuleId, SettingKeys.PrefixURLCategories, "category");
			}
			else
			{
				objModules.UpdateModuleSetting(tabModuleId, SettingKeys.PrefixURLCategories, currSettings.PrefixURLCategory);
			}

			objModules.UpdateModuleSetting(tabModuleId, "NeedsConvert", "False");
			objModules.UpdateModuleSetting(tabModuleId, "AFINSTALLED", "True");
			DataCache.CacheClear(string.Format(CacheKeys.MainSettings, forumModuleId));

            return false;
		}
Ejemplo n.º 17
0
        protected override void OnLoad(EventArgs e)
		{
			base.OnLoad(e);

            jQuery.RequestRegistration();
            jQuery.RequestUIRegistration();

            IsCallBack = cbShell.IsCallback;

            btnReturn.ClientSideScript = "window.location.href = '" + Common.Globals.NavigateURL(TabId) + "';";
            var objModules = new Entities.Modules.ModuleController();
            cbModal.LoadingTemplate = GetLoadingTemplateSmall();
            Hashtable Settings = objModules.GetModuleSettings(ModuleId);
            string upFilePath = Server.MapPath("~/desktopmodules/activeforums/upgrade4x.txt");
            if (Convert.ToBoolean(Settings["AFINSTALLED"]) == false)
            {
                try
                {
                    var fc = new ForumsConfig();
                    bool configComplete = fc.ForumsInit(PortalId, ModuleId);
                    objModules.UpdateModuleSetting(ModuleId, "AFINSTALLED", configComplete.ToString());
                    if (System.IO.File.Exists(upFilePath))
                    {
                        System.IO.File.Delete(upFilePath);
                    }
                }
                catch (Exception ex)
                {
                    Services.Exceptions.Exceptions.LogException(ex);
                }
            }
            bool loadDefault = true;
            if (System.IO.File.Exists(upFilePath))
            {
                var db = new Data.Common();
                if (db.SecurityUpgraded())
                {
                    if (System.IO.File.Exists(upFilePath))
                    {
                        System.IO.File.Delete(upFilePath);
                    }
                }
                else
                {
                    loadDefault = false;
                    GetControl("upgrade", string.Empty, IsCallBack);
                }
            }

            ClientResourceManager.RegisterStyleSheet(Page, "~/DesktopModules/ActiveForums/ControlPanel.css");
            ClientResourceManager.RegisterStyleSheet(Page, "~/DesktopModules/ActiveForums/themes/" + MainSettings.Theme + "/jquery-ui.min.css");


            lblProd.Visible = true;
            lblCopy.Visible = true;
            //TODO: this should be resources instead of harcoded text?
            lblProd.Text = "Active Forums " + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
            lblCopy.Text = "©" + DateTime.Now.Year + " DotNetNuke Corporation";

            try
            {
                if (!Page.IsPostBack)
                {
                    GetControl(CurrentView, Params, IsCallBack);
                }

            }
            catch (Exception ex)
            {

                if (Request.QueryString["cptry"] == null)
                {
                    string sURL = EditUrl("", "", "EDIT", "cptry=1");
                    Response.Redirect(sURL);
                }
                else
                {
                    Services.Exceptions.Exceptions.ProcessModuleLoadException(this, ex);
                }
            }


            ClientResourceManager.RegisterScript(Page, "~/desktopmodules/activeforums/scripts/json2009.min.js", 101);
            ClientResourceManager.RegisterScript(Page, "~/desktopmodules/activeforums/scripts/jquery.history.js", 102);
            ClientResourceManager.RegisterScript(Page, "~/desktopmodules/activeforums/scripts/afadmin.js", 103);
            ClientResourceManager.RegisterScript(Page, "~/desktopmodules/activeforums/scripts/jquery.listreorder.js", 104);
            ClientResourceManager.RegisterScript(Page, "~/desktopmodules/activeforums/active/amlib.js", 105);






            string lang = "en-US";
            if (Request.QueryString["language"] != null)
            {
                lang = Request.QueryString["language"];
            }
            if (string.IsNullOrEmpty(lang))
            {
                lang = PortalSettings.DefaultLanguage;
            }
            if (string.IsNullOrEmpty(lang))
            {
                lang = "en-US";
            }
            string adminHandler = VirtualPathUtility.ToAbsolute("~/desktopmodules/activeforums/handlers/adminhelper.ashx") + "?TabId=" + TabId.ToString() + "&PortalId=" + PortalId.ToString() + "&moduleid=" + ModuleId + "&language=" + lang;
            var sb = new StringBuilder();
            sb.AppendLine("var asScriptPath = '" + VirtualPathUtility.ToAbsolute("~/desktopmodules/activeforums/scripts/") + "';");
            sb.AppendFormat("var afAdminHandlerURL = '{0}';", adminHandler);
            sb.AppendLine("var af_imgPath = '" + VirtualPathUtility.ToAbsolute("~/DesktopModules/ActiveForums/themes/" + MainSettings.Theme) + "';");
            string sLoadImg;
            sLoadImg = "var afSpinLg = new Image();afSpinLg.src='" + VirtualPathUtility.ToAbsolute("~/desktopmodules/activeforums/images/spinner-lg.gif") + "';";
            sLoadImg += "var afSpin = new Image();afSpin.src='" + VirtualPathUtility.ToAbsolute("~/desktopmodules/activeforums/images/spinner.gif") + "';";
            sb.AppendLine(sLoadImg);
            Page.ClientScript.RegisterStartupScript(Page.GetType(), "afscripts", sb.ToString(), true);

            ServicesFramework.Instance.RequestAjaxAntiForgerySupport();

        }
Ejemplo n.º 18
0
		public void OnBeginRequest(object s, EventArgs e)
		{
			_forumId = -1;
			_tabId = -1;
			_moduleId = -1;
			_topicId = -1;
			_page = 1;
			_contentId = -1;
			_archived = 0;
			_forumgroupId = -1;
			_mainSettings = null;
			_categoryId = -1;
			_tagId = -1;

			HttpApplication app = (HttpApplication)s;
			HttpServerUtility Server = app.Server;
			HttpRequest Request = app.Request;
			HttpResponse Response = app.Response;
			string requestedPath = app.Request.Url.AbsoluteUri;
			HttpContext Context = ((HttpApplication)s).Context;
			int PortalId = -1;
			DotNetNuke.Entities.Portals.PortalAliasInfo objPortalAliasInfo = null;
			string sUrl = HttpContext.Current.Request.RawUrl.Replace("http://", string.Empty).Replace("https://", string.Empty);
			objPortalAliasInfo = DotNetNuke.Entities.Portals.PortalSettings.GetPortalAliasInfo(HttpContext.Current.Request.Url.Host);
			if (Request.RawUrl.ToLowerInvariant().Contains("404.aspx"))
			{
				string sEx = ".jpg,.gif,.png,.swf,.js,.css,.html,.htm,desktopmodules,portals,.ashx,.ico,.txt,.doc,.docx,.pdf,.xml,.xls,.xlsx,.ppt,.pptx,.csv,.zip,.asmx,.aspx";
				foreach (string sn in sEx.Split(','))
				{
					if (sUrl.Contains(sn))
					{
						// IO.File.AppendAllText(sPath, Request.RawUrl & "165<br />")
						return;
					}
				}
			}
			if (Request.Url.LocalPath.ToLower().Contains("scriptresource.axd") || Request.Url.LocalPath.ToLower().Contains("webresource.axd") || Request.Url.LocalPath.ToLower().Contains("viewer.aspx") || Request.Url.LocalPath.ToLower().Contains("cb.aspx") || Request.Url.LocalPath.ToLower().Contains("filesupload.aspx") || Request.Url.LocalPath.ToLower().Contains(".gif") || Request.Url.LocalPath.ToLower().Contains(".jpg") || Request.Url.LocalPath.ToLower().Contains(".css") || Request.Url.LocalPath.ToLower().Contains(".png") || Request.Url.LocalPath.ToLower().Contains(".swf") || Request.Url.LocalPath.ToLower().Contains(".htm") || Request.Url.LocalPath.ToLower().Contains(".html") || Request.Url.LocalPath.ToLower().Contains(".ashx") || Request.Url.LocalPath.ToLower().Contains(".cur") || Request.Url.LocalPath.ToLower().Contains(".ico") || Request.Url.LocalPath.ToLower().Contains(".txt") || Request.Url.LocalPath.ToLower().Contains(".pdf") || Request.Url.LocalPath.ToLower().Contains(".xml") || Request.Url.LocalPath.ToLower().Contains("/portals/") || Request.Url.LocalPath.ToLower().Contains("/desktopmodules/") || Request.Url.LocalPath.ToLower().Contains("evexport.aspx") || Request.Url.LocalPath.ToLower().Contains("signupjs.aspx") || Request.Url.LocalPath.ToLower().Contains("evsexport.aspx") || Request.Url.LocalPath.ToLower().Contains("fbcomm.aspx") || Request.Url.LocalPath.ToLower().Contains(".aspx") || Request.Url.LocalPath.ToLower().Contains(".js"))
			{
				return;
			}
			if (Request.Url.LocalPath.ToLower().Contains("install.aspx") || Request.Url.LocalPath.ToLower().Contains("installwizard.aspx") || Request.Url.LocalPath.ToLower().Contains("captcha.aspx") || Request.RawUrl.Contains("viewer.aspx") || Request.RawUrl.Contains("blank.html") || Request.RawUrl.Contains("default.htm") || Request.RawUrl.Contains("autosuggest.aspx"))
			{
				return;
			}
			PortalId = objPortalAliasInfo.PortalID;
			string searchURL = sUrl;
			searchURL = searchURL.Replace(objPortalAliasInfo.HTTPAlias, string.Empty);
			if (searchURL.Length < 2)
			{
				return;
			}
			string query = string.Empty;
			if (searchURL.Contains("?"))
			{
				query = searchURL.Substring(searchURL.IndexOf("?"));
				searchURL = searchURL.Substring(0, searchURL.IndexOf("?") - 1);
			}
			string newSearchURL = string.Empty;
			foreach (string up in searchURL.Split('/'))
			{
				if (! (string.IsNullOrEmpty(up)))
				{
					if (! (SimulateIsNumeric.IsNumeric(up)))
					{
						newSearchURL += up + "/";
					}
				}
			}
			bool canContinue = false;
			Data.Common db = new Data.Common();
			string tagName = string.Empty;
			string catName = string.Empty;
			if (newSearchURL.Contains("/category/") || newSearchURL.Contains("/tag/"))
			{
				if (newSearchURL.Contains("/category/"))
				{
					string cat = "/category/";
					int iEnd = newSearchURL.IndexOf("/", newSearchURL.IndexOf(cat) + cat.Length + 1);
					string catString = newSearchURL.Substring(newSearchURL.IndexOf(cat), iEnd - newSearchURL.IndexOf(cat));
					catName = catString.Replace(cat, string.Empty);
					catName = catName.Replace("/", string.Empty);
					newSearchURL = newSearchURL.Replace(catString, string.Empty);
				}
				if (newSearchURL.Contains("/tag/"))
				{
					string tag = "/tag/";
					int iEnd = newSearchURL.IndexOf("/", newSearchURL.IndexOf(tag) + tag.Length + 1);
					string tagString = newSearchURL.Substring(newSearchURL.IndexOf(tag), iEnd - newSearchURL.IndexOf(tag));
					tagName = tagString.Replace(tag, string.Empty);
					tagName = tagName.Replace("/", string.Empty);
					newSearchURL = newSearchURL.Replace(tagString, string.Empty);
				}
			}
			if ((sUrl.Contains("afv") && sUrl.Contains("post")) | (sUrl.Contains("afv") && sUrl.Contains("confirmaction")) | (sUrl.Contains("afv") && sUrl.Contains("sendto")) | (sUrl.Contains("afv") && sUrl.Contains("modreport")) | (sUrl.Contains("afv") && sUrl.Contains("search")) | sUrl.Contains("dnnprintmode") || sUrl.Contains("asg") || (sUrl.Contains("afv") && sUrl.Contains("modtopics")))
			{
				return;
			}
			try
			{
				using (IDataReader dr = db.URLSearch(PortalId, newSearchURL))
				{
					while (dr.Read())
					{
						_tabId = int.Parse(dr["TabID"].ToString());
						_moduleId = int.Parse(dr["ModuleId"].ToString());
						_forumgroupId = int.Parse(dr["ForumGroupId"].ToString());
						_forumId = int.Parse(dr["ForumId"].ToString());
						_topicId = int.Parse(dr["TopicId"].ToString());
						_archived = int.Parse(dr["Archived"].ToString());
						_otherId = int.Parse(dr["OtherId"].ToString());
						_urlType = int.Parse(dr["UrlType"].ToString());
						canContinue = true;
					}
					dr.Close();
				}
			}
			catch (Exception ex)
			{

			}
			if (! (string.IsNullOrEmpty(catName)))
			{
				_categoryId = db.Tag_GetIdByName(PortalId, _moduleId, catName, true);
				_otherId = _categoryId;
				_urlType = 2;
			}
			if (! (string.IsNullOrEmpty(tagName)))
			{
				_tagId = db.Tag_GetIdByName(PortalId, _moduleId, tagName, false);
				_otherId = _tagId;
				_urlType = 3;
			}

			if (_archived == 1)
			{
				sUrl = db.GetUrl(_moduleId, _forumgroupId, _forumId, _topicId, _userId, -1);
				if (! (string.IsNullOrEmpty(sUrl)))
				{
					string sHost = objPortalAliasInfo.HTTPAlias;
					if (sUrl.StartsWith("/"))
					{
						sUrl = sUrl.Substring(1);
					}
					if (! (sHost.EndsWith("/")))
					{
						sHost += "/";
					}
					sUrl = sHost + sUrl;
					if (! (sUrl.EndsWith("/")))
					{
						sUrl += "/";
					}
					if (! (sUrl.StartsWith("http")))
					{
						if (Request.IsSecureConnection)
						{
							sUrl = "https://" + sUrl;
						}
						else
						{
							sUrl = "http://" + sUrl;
						}
					}
					Response.Clear();
					Response.Status = "301 Moved Permanently";
					Response.AddHeader("Location", sUrl);
					Response.End();

				}
			}
			if (_moduleId > 0)
			{
				Entities.Modules.ModuleController objModules = new Entities.Modules.ModuleController();
				SettingsInfo objSettings = new SettingsInfo();
				objSettings.MainSettings = objModules.GetModuleSettings(_moduleId);
				_mainSettings = objSettings; // DataCache.MainSettings(_moduleId)
			}
			if (_mainSettings == null)
			{
				return;
			}
			if (! _mainSettings.URLRewriteEnabled)
			{
				return;
			}
			if (! canContinue && (Request.RawUrl.Contains(ParamKeys.TopicId) || Request.RawUrl.Contains(ParamKeys.ForumId) || Request.RawUrl.Contains(ParamKeys.GroupId)))
			{
				sUrl = HandleOldUrls(Request.RawUrl, objPortalAliasInfo.HTTPAlias);
				if (! (string.IsNullOrEmpty(sUrl)))
				{
					if (! (sUrl.StartsWith("http")))
					{
						if (Request.IsSecureConnection)
						{
							sUrl = "https://" + sUrl;
						}
						else
						{
							sUrl = "http://" + sUrl;
						}
					}
					Response.Clear();
					Response.Status = "301 Moved Permanently";
					Response.AddHeader("Location", sUrl);
					Response.End();
				}
			}
			if (! canContinue)
			{
				string topicUrl = string.Empty;
				if (newSearchURL.EndsWith("/"))
				{
					newSearchURL = newSearchURL.Substring(0, newSearchURL.Length - 1);
				}
				if (newSearchURL.Contains("/"))
				{
					topicUrl = newSearchURL.Substring(newSearchURL.LastIndexOf("/"));
				}
				topicUrl = topicUrl.Replace("/", string.Empty);
				if (! (string.IsNullOrEmpty(topicUrl)))
				{
					Data.Topics topicsDb = new Data.Topics();
					_topicId = topicsDb.TopicIdByUrl(PortalId, _moduleId, topicUrl.ToLowerInvariant());
					if (_topicId > 0)
					{
						sUrl = db.GetUrl(_moduleId, _forumgroupId, _forumId, _topicId, _userId, -1);
					}
					else
					{
						sUrl = string.Empty;
					}
					if (! (string.IsNullOrEmpty(sUrl)))
					{
						string sHost = objPortalAliasInfo.HTTPAlias;
						if (sHost.EndsWith("/") && sUrl.StartsWith("/"))
						{
							sUrl = sHost.Substring(0, sHost.Length - 1) + sUrl;
						}
						else if (! (sHost.EndsWith("/")) && ! (sUrl.StartsWith("/")))
						{
							sUrl = sHost + "/" + sUrl;
						}
						else
						{
							sUrl = sHost + sUrl;
						}
						if (sUrl.StartsWith("/"))
						{
							sUrl = sUrl.Substring(1);
						}
						if (! (sUrl.StartsWith("http")))
						{
							if (Request.IsSecureConnection)
							{
								sUrl = "https://" + sUrl;
							}
							else
							{
								sUrl = "http://" + sUrl;
							}
						}
						if (! (string.IsNullOrEmpty(sUrl)))
						{
							Response.Clear();
							Response.Status = "301 Moved Permanently";
							Response.AddHeader("Location", sUrl);
							Response.End();
						}
					}
				}

			}

			if (canContinue)
			{
				if (searchURL != newSearchURL)
				{
					string urlTail = searchURL.Replace(newSearchURL, string.Empty);
					if (urlTail.StartsWith("/"))
					{
						urlTail = urlTail.Substring(1);
					}
					if (urlTail.EndsWith("/"))
					{
						urlTail = urlTail.Substring(0, urlTail.Length - 1);
					}
					if (urlTail.Contains("/"))
					{
						urlTail = urlTail.Substring(0, urlTail.IndexOf("/") - 1);
					}
					if (SimulateIsNumeric.IsNumeric(urlTail))
					{
						_page = Convert.ToInt32(urlTail);
					}
				}

				string sPage = string.Empty;
				sPage = "&afpg=" + _page.ToString();
				string qs = string.Empty;
				if (sUrl.Contains("?"))
				{
					qs = "&" + sUrl.Substring(sUrl.IndexOf("?") + 1);
				}
				string catQS = string.Empty;
				if (_categoryId > 0)
				{
					catQS = "&act=" + _categoryId.ToString();
				}
				string sendTo = string.Empty;
				if (_topicId > 0)
				{
					sendTo = ResolveUrl(app.Context.Request.ApplicationPath, "~/default.aspx?tabid=" + _tabId + "&aft=" + _topicId + sPage + qs);
				}
				else if (_forumId > 0)
				{
					sendTo = ResolveUrl(app.Context.Request.ApplicationPath, "~/default.aspx?tabid=" + _tabId + "&aff=" + _forumId + sPage + qs + catQS);
				}
				else if (_forumgroupId > 0)
				{
					sendTo = ResolveUrl(app.Context.Request.ApplicationPath, "~/default.aspx?tabid=" + _tabId + "&afg=" + _forumgroupId + sPage + qs + catQS);
				}
				else if (_urlType == 2 && _otherId > 0)
				{
					sendTo = ResolveUrl(app.Context.Request.ApplicationPath, "~/default.aspx?tabid=" + _tabId + "&act=" + _otherId + sPage + qs);
				}
				else if (_urlType == 3 && _otherId > 0)
				{
					sendTo = ResolveUrl(app.Context.Request.ApplicationPath, "~/default.aspx?tabid=" + _tabId + "&afv=grid&afgt=tags&aftg=" + _otherId + sPage + qs);
				}
				else if (_urlType == 1)
				{
					string v = string.Empty;
					switch (_otherId)
					{
						case 1:
							v = "unanswered";
							break;
						case 2:
							v = "notread";
							break;
						case 3:
							v = "mytopics";
							break;
						case 4:
							v = "activetopics";
							break;
					}
					sendTo = ResolveUrl(app.Context.Request.ApplicationPath, "~/default.aspx?tabid=" + _tabId + "&afv=grid&afgt=" + v + sPage + qs);
				}
				else if (_tabId > 0)
				{
					sendTo = ResolveUrl(app.Context.Request.ApplicationPath, "~/default.aspx?tabid=" + _tabId + sPage + qs);
				}

				RewriteUrl(app.Context, sendTo);
			}
		}
Ejemplo n.º 19
0
        private void GetControl(string view, string options)
        {
            try
            {
                if (!Page.IsPostBack)
                {
                    plhLoader.Controls.Clear();
                }
                ForumBase ctl = null;
                if (view.ToUpperInvariant() == "FORUMVIEW")
                {
                    ctl = (ForumBase)(new DotNetNuke.Modules.ActiveForums.Controls.ForumView());
                }
                else if (view.ToUpperInvariant() == "ADVANCED")
                {
                    ctl = (ForumBase)(LoadControl("~/desktopmodules/activeforums/advanced.ascx"));
                }
                else if ((view.ToUpperInvariant() == Views.Topics.ToUpperInvariant()) || (view.ToUpperInvariant() == "topics".ToUpperInvariant()))
                {
                    ctl = (ForumBase)(new DotNetNuke.Modules.ActiveForums.Controls.TopicsView());
                }
                else if ((view.ToUpperInvariant() == Views.Topic.ToUpperInvariant()) || (view.ToUpperInvariant() == "topic".ToUpperInvariant()))
                {
                    ctl = (ForumBase)(new DotNetNuke.Modules.ActiveForums.Controls.TopicView());
                }
                else if (view.ToUpperInvariant() == "USERSETTINGS".ToUpperInvariant())
                {
                    string ctlPath = string.Empty;
                    ctlPath = "~/DesktopModules/ActiveForums/controls/af_profile.ascx";
                    if (!(System.IO.File.Exists(Server.MapPath(ctlPath))))
                    {
                        ctl = (ForumBase)(new DotNetNuke.Modules.ActiveForums.Controls.ForumView());
                    }
                    else
                    {
                        ctl = (ForumBase)(LoadControl(ctlPath));
                    }
                }
                else
                {
                    // this is where af_post.ascx is used
                    string ctlPath = string.Empty;
                    ctlPath = "~/DesktopModules/ActiveForums/controls/af_" + view + ".ascx";
                    if (!(System.IO.File.Exists(Server.MapPath(ctlPath))))
                    {
                        ctl = (ForumBase)(new DotNetNuke.Modules.ActiveForums.Controls.ForumView());
                    }
                    else
                    {
                        ctl = (ForumBase)(LoadControl(ctlPath));
                    }
                }
                if (ForumId > 0 & ForumInfo != null)
                {
                    ctl.ForumInfo = ForumInfo;
                }
                ctl.ID            = view;
                ctl.ForumId       = ForumId;
                ctl.ForumModuleId = ForumModuleId;
                if (ForumTabId == -1)
                {
                    ForumTabId = TabId;
                }
                ctl.ForumTabId   = ForumTabId;
                ctl.ForumGroupId = ForumGroupId;
                ctl.DefaultForumViewTemplateId  = DefaultForumViewTemplateId;
                ctl.DefaultTopicsViewTemplateId = DefaultTopicsViewTemplateId;
                ctl.DefaultTopicViewTemplateId  = DefaultTopicViewTemplateId;
                ctl.UseTemplatePath             = UseTemplatePath;
                ctl.TemplatePath  = TemplatePath;
                ctl.ParentForumId = ParentForumId;
                if (string.IsNullOrEmpty(ForumIds))
                {
                    ForumIds = UserForumsList;
                }

                if (SocialGroupId > 0)
                {
                    ForumController fc = new ForumController();
                    ForumIds = fc.GetForumIdsBySocialGroup(PortalId, SocialGroupId);

                    if (string.IsNullOrEmpty(ForumIds))
                    {
                        RoleController rc   = new RoleController();
                        RoleInfo       role = rc.GetRole(SocialGroupId, PortalId);
                        //Create new forum
                        bool isPrivate = false;
                        if (!role.IsPublic)
                        {
                            isPrivate = true;
                        }
                        Entities.Modules.ModuleController objModules = new Entities.Modules.ModuleController();
                        Hashtable htSettings = objModules.GetTabModuleSettings(TabModuleId);

                        fc.CreateGroupForum(PortalId, ModuleId, SocialGroupId, Convert.ToInt32(htSettings["ForumGroupTemplate"].ToString()), role.RoleName + " Discussions", role.Description, isPrivate, htSettings["ForumConfig"].ToString());
                        ForumIds = fc.GetForumIdsBySocialGroup(PortalId, SocialGroupId);
                    }
                }
                ctl.ForumIds      = ForumIds;
                ctl.SocialGroupId = SocialGroupId;

                //ctl.PostID = PostID
                ctl.ModuleConfiguration = this.ModuleConfiguration;
                if (!(options == string.Empty))
                {
                    ctl.Params = options;
                }
                ControlsConfig cc = new ControlsConfig();
                cc.AppPath      = Page.ResolveUrl("~/DesktopModules/ActiveForums/");
                cc.ThemePath    = Page.ResolveUrl("~/DesktopModules/ActiveForums/themes/" + MainSettings.Theme + "/");
                cc.TemplatePath = cc.ThemePath + "templates/";
                cc.SiteId       = PortalId;
                cc.PageId       = TabId;
                cc.InstanceId   = ModuleId;
                cc.User         = ForumUser;
                string authorizedViewRoles = ModuleConfiguration.InheritViewPermissions ? TabPermissionController.GetTabPermissions(TabId, PortalId).ToString("VIEW") : ModuleConfiguration.ModulePermissions.ToString("VIEW");
                cc.DefaultViewRoles = Permissions.GetRoleIds(authorizedViewRoles.Split(';'), PortalId);
                cc.AdminRoles       = Permissions.GetRoleIds(this.ModuleConfiguration.ModulePermissions.ToString("EDIT").Split(';'), PortalId);
                cc.ProfileLink      = ""; //GetProfileLink()
                cc.MembersLink      = ""; // GetMembersLink()
                this.ControlConfig  = cc;
                ctl.ControlConfig   = cc;
                LinkControls(ctl.Controls);
                if (!(plhLoader.Controls.Contains(ctl)))
                {
                    plhLoader.Controls.Add(ctl);
                }
                string sOut = null;
                sOut  = System.Environment.NewLine + "<!--  © 2004 - 2013 DNN Corp.,  All Rights Reserved -->" + System.Environment.NewLine;
                sOut += "<!-- Active Forums 5.0  -->" + System.Environment.NewLine;

                Literal lit = new Literal();
                lit.Text = sOut;
                plhLoader.Controls.Add(lit);
            }
            catch (Exception ex)
            {
                DotNetNuke.Services.Exceptions.Exceptions.ProcessModuleLoadException(this, ex);
            }
        }
		public void LoadForums()
		{
			//Dim dr As IDataReader
			//dr = DataProvider.Instance.PortalForums(PortalId)
			//Dim i As Integer = 0
			//While dr.Read
			//    drpForumInstance.Items.Insert(i, New Web.UI.WebControls.ListItem(CType(dr("TabName"), String), CType(dr("ModuleID"), String)))
			//End While
			//dr.Close()
			int i = 0;
			var mc = new Entities.Modules.ModuleController();
			var tc = new Entities.Tabs.TabController();
			Entities.Tabs.TabInfo ti;
			foreach (Entities.Modules.ModuleInfo mi in mc.GetModules(PortalId))
			{
                if (mi.DesktopModule.ModuleName.Trim().ToLowerInvariant() == "Active Forums".ToLowerInvariant() && mi.IsDeleted == false)
				{
					ti = tc.GetTab(mi.TabID, PortalId, false);
					if (ti != null)
					{
						if (ti.IsDeleted == false)
						{
							drpForumInstance.Items.Insert(i, new ListItem(ti.TabName + " - " + mi.DesktopModule.ModuleName, Convert.ToString(mi.ModuleID)));
							i += 1;
						}
					}

				}
			}

			drpForumInstance.Items.Insert(0, new ListItem("-- Select a Forum Instance --", "-1"));
		}
Ejemplo n.º 21
0
        public bool MoveSettings(int forumModuleId, int tabModuleId)
        {
            var objModules   = new Entities.Modules.ModuleController();
            var currSettings = new SettingsInfo {
                MainSettings = Settings.GeneralSettings(forumModuleId, "GEN")
            };

            objModules.UpdateModuleSetting(tabModuleId, SettingKeys.PageSize, currSettings.PageSize.ToString());
            objModules.UpdateModuleSetting(tabModuleId, SettingKeys.UserNameDisplay, currSettings.UserNameDisplay);
            objModules.UpdateModuleSetting(tabModuleId, SettingKeys.ProfileVisibility, ((int)currSettings.ProfileVisibility).ToString());
            objModules.UpdateModuleSetting(tabModuleId, SettingKeys.EnablePoints, currSettings.EnablePoints.ToString());
            objModules.UpdateModuleSetting(tabModuleId, SettingKeys.TopicPointValue, currSettings.TopicPointValue.ToString());
            objModules.UpdateModuleSetting(tabModuleId, SettingKeys.ReplyPointValue, currSettings.ReplyPointValue.ToString());
            objModules.UpdateModuleSetting(tabModuleId, SettingKeys.AnswerPointValue, currSettings.AnswerPointValue.ToString());
            objModules.UpdateModuleSetting(tabModuleId, SettingKeys.MarkAnswerPointValue, currSettings.MarkAsAnswerPointValue.ToString());
            objModules.UpdateModuleSetting(tabModuleId, SettingKeys.ModPointValue, currSettings.ModPointValue.ToString());
            objModules.UpdateModuleSetting(tabModuleId, SettingKeys.AvatarHeight, currSettings.AvatarHeight.ToString());
            objModules.UpdateModuleSetting(tabModuleId, SettingKeys.AvatarWidth, currSettings.AvatarWidth.ToString());
            objModules.UpdateModuleSetting(tabModuleId, SettingKeys.AllowSignatures, currSettings.AllowSignatures.ToString());
            objModules.UpdateModuleSetting(tabModuleId, SettingKeys.ForumTemplateId, currSettings.ForumTemplateID.ToString());
            objModules.UpdateModuleSetting(tabModuleId, SettingKeys.InstallDate, currSettings.InstallDate.ToString());
            objModules.UpdateModuleSetting(tabModuleId, SettingKeys.IsInstalled, currSettings.IsInstalled.ToString());
            objModules.UpdateModuleSetting(tabModuleId, SettingKeys.Theme, currSettings.Theme);
            objModules.UpdateModuleSetting(tabModuleId, SettingKeys.FullText, currSettings.FullText.ToString());
            objModules.UpdateModuleSetting(tabModuleId, SettingKeys.MailQueue, currSettings.MailQueue.ToString());
            objModules.UpdateModuleSetting(tabModuleId, SettingKeys.FloodInterval, currSettings.FloodInterval.ToString());
            objModules.UpdateModuleSetting(tabModuleId, SettingKeys.EditInterval, currSettings.EditInterval.ToString());
            objModules.UpdateModuleSetting(tabModuleId, SettingKeys.DeleteBehavior, currSettings.DeleteBehavior.ToString());
            objModules.UpdateModuleSetting(tabModuleId, SettingKeys.AddThisAccount, currSettings.AddThisAccount);
            objModules.UpdateModuleSetting(tabModuleId, SettingKeys.EnableAutoLink, currSettings.AutoLinkEnabled.ToString());
            objModules.UpdateModuleSetting(tabModuleId, SettingKeys.EnableURLRewriter, currSettings.URLRewriteEnabled.ToString());
            if (string.IsNullOrEmpty(currSettings.PrefixURLBase))
            {
                objModules.UpdateModuleSetting(tabModuleId, SettingKeys.PrefixURLBase, "forums");
            }
            else
            {
                objModules.UpdateModuleSetting(tabModuleId, SettingKeys.PrefixURLBase, currSettings.PrefixURLBase);
            }
            if (string.IsNullOrEmpty(currSettings.PrefixURLOther))
            {
                objModules.UpdateModuleSetting(tabModuleId, SettingKeys.PrefixURLOther, "views");
            }
            else
            {
                objModules.UpdateModuleSetting(tabModuleId, SettingKeys.PrefixURLOther, currSettings.PrefixURLOther);
            }
            if (string.IsNullOrEmpty(currSettings.PrefixURLTag))
            {
                objModules.UpdateModuleSetting(tabModuleId, SettingKeys.PrefixURLTags, "tag");
            }
            else
            {
                objModules.UpdateModuleSetting(tabModuleId, SettingKeys.PrefixURLTags, currSettings.PrefixURLTag);
            }
            if (string.IsNullOrEmpty(currSettings.PrefixURLCategory))
            {
                objModules.UpdateModuleSetting(tabModuleId, SettingKeys.PrefixURLCategories, "category");
            }
            else
            {
                objModules.UpdateModuleSetting(tabModuleId, SettingKeys.PrefixURLCategories, currSettings.PrefixURLCategory);
            }

            objModules.UpdateModuleSetting(tabModuleId, "NeedsConvert", "False");
            objModules.UpdateModuleSetting(tabModuleId, "AFINSTALLED", "True");
            DataCache.CacheClear(string.Format(CacheKeys.MainSettings, forumModuleId));

            return(false);
        }
Ejemplo n.º 22
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            jQuery.RequestRegistration();
            jQuery.RequestUIRegistration();

            IsCallBack = cbShell.IsCallback;

            btnReturn.ClientSideScript = "window.location.href = '" + Common.Globals.NavigateURL(TabId) + "';";
            var objModules = new Entities.Modules.ModuleController();

            cbModal.LoadingTemplate = GetLoadingTemplateSmall();
            Hashtable Settings   = objModules.GetModuleSettings(ModuleId);
            string    upFilePath = Server.MapPath("~/desktopmodules/activeforums/upgrade4x.txt");

            if (Convert.ToBoolean(Settings["AFINSTALLED"]) == false)
            {
                try
                {
                    var  fc             = new ForumsConfig();
                    bool configComplete = fc.ForumsInit(PortalId, ModuleId);
                    objModules.UpdateModuleSetting(ModuleId, "AFINSTALLED", configComplete.ToString());
                    if (System.IO.File.Exists(upFilePath))
                    {
                        System.IO.File.Delete(upFilePath);
                    }
                }
                catch (Exception ex)
                {
                    Services.Exceptions.Exceptions.LogException(ex);
                }
            }
            bool loadDefault = true;

            if (System.IO.File.Exists(upFilePath))
            {
                var db = new Data.Common();
                if (db.SecurityUpgraded())
                {
                    if (System.IO.File.Exists(upFilePath))
                    {
                        System.IO.File.Delete(upFilePath);
                    }
                }
                else
                {
                    loadDefault = false;
                    GetControl("upgrade", string.Empty, IsCallBack);
                }
            }

            ClientResourceManager.RegisterStyleSheet(Page, "~/DesktopModules/ActiveForums/ControlPanel.css");
            ClientResourceManager.RegisterStyleSheet(Page, "~/DesktopModules/ActiveForums/themes/" + MainSettings.Theme + "/jquery-ui.min.css");


            lblProd.Visible = true;
            lblCopy.Visible = true;
            //TODO: this should be resources instead of harcoded text?
            lblProd.Text = "Active Forums " + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
            lblCopy.Text = "©" + DateTime.Now.Year + " DotNetNuke Corporation";

            try
            {
                if (!Page.IsPostBack)
                {
                    GetControl(CurrentView, Params, IsCallBack);
                }
            }
            catch (Exception ex)
            {
                if (Request.QueryString["cptry"] == null)
                {
                    string sURL = EditUrl("", "", "EDIT", "cptry=1");
                    Response.Redirect(sURL);
                }
                else
                {
                    Services.Exceptions.Exceptions.ProcessModuleLoadException(this, ex);
                }
            }


            ClientResourceManager.RegisterScript(Page, "~/desktopmodules/activeforums/scripts/json2009.min.js", 101);
            ClientResourceManager.RegisterScript(Page, "~/desktopmodules/activeforums/scripts/jquery.history.js", 102);
            ClientResourceManager.RegisterScript(Page, "~/desktopmodules/activeforums/scripts/afadmin.js", 103);
            ClientResourceManager.RegisterScript(Page, "~/desktopmodules/activeforums/scripts/jquery.listreorder.js", 104);
            ClientResourceManager.RegisterScript(Page, "~/desktopmodules/activeforums/active/amlib.js", 105);



            string lang = "en-US";

            if (Request.QueryString["language"] != null)
            {
                lang = Request.QueryString["language"];
            }
            if (string.IsNullOrEmpty(lang))
            {
                lang = PortalSettings.DefaultLanguage;
            }
            if (string.IsNullOrEmpty(lang))
            {
                lang = "en-US";
            }
            string adminHandler = VirtualPathUtility.ToAbsolute("~/desktopmodules/activeforums/handlers/adminhelper.ashx") + "?TabId=" + TabId.ToString() + "&PortalId=" + PortalId.ToString() + "&moduleid=" + ModuleId + "&language=" + lang;
            var    sb           = new StringBuilder();

            sb.AppendLine("var asScriptPath = '" + VirtualPathUtility.ToAbsolute("~/desktopmodules/activeforums/scripts/") + "';");
            sb.AppendFormat("var afAdminHandlerURL = '{0}';", adminHandler);
            sb.AppendLine("var af_imgPath = '" + VirtualPathUtility.ToAbsolute("~/DesktopModules/ActiveForums/themes/" + MainSettings.Theme) + "';");
            string sLoadImg;

            sLoadImg  = "var afSpinLg = new Image();afSpinLg.src='" + VirtualPathUtility.ToAbsolute("~/desktopmodules/activeforums/images/spinner-lg.gif") + "';";
            sLoadImg += "var afSpin = new Image();afSpin.src='" + VirtualPathUtility.ToAbsolute("~/desktopmodules/activeforums/images/spinner.gif") + "';";
            sb.AppendLine(sLoadImg);
            Page.ClientScript.RegisterStartupScript(Page.GetType(), "afscripts", sb.ToString(), true);

            ServicesFramework.Instance.RequestAjaxAntiForgerySupport();
        }
Ejemplo n.º 23
0
        private void BindPrivateMessagingTab()
        {
            drpMessagingTab.Items.Clear();
            drpMessagingTab.ClearSelection();

            var mc = new Entities.Modules.ModuleController();
            var tc = new TabController();

            foreach (Entities.Modules.ModuleInfo mi in mc.GetModules(PortalId))
            {
                if (!mi.DesktopModule.ModuleName.Contains("DnnForge - PrivateMessages") || mi.IsDeleted)
                    continue;

                var ti = tc.GetTab(mi.TabID, PortalId, false);
                if (ti != null && !ti.IsDeleted)
                {
                    drpMessagingTab.Items.Add(new ListItem
                    {
                        Text = ti.TabName + " - Ventrian Messages",
                        Value = ti.TabID.ToString(),
                        Selected = ti.TabID == MessagingTabId
                    });
                }
            }

            if (drpMessagingTab.Items.Count == 0)
            {
                drpMessagingTab.Items.Add(new ListItem("No Messaging Tabs Found", "-1"));
                drpMessagingTab.Enabled = false;
            }

        }
Ejemplo n.º 24
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// ExportModule implements the IPortable ExportModule Interface
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <param name="ModuleID">The Id of the module to be exported</param>
        /// <history>
        ///		[cnurse]	11/17/2004	documented
        /// </history>
        /// -----------------------------------------------------------------------------
        public string ExportModule(int ModuleID)
        {
            string strXML = "";

            oRepositoryBusinessController = new Helpers();

            Entities.Modules.ModuleController objModules = new Entities.Modules.ModuleController();
            Entities.Modules.ModuleInfo       objModule  = objModules.GetModule(ModuleID, Null.NullInteger);

            RepositoryObjectCategoriesController RepositoryItemCategoryController = new RepositoryObjectCategoriesController();
            ArrayList RepositoryItemCategories = null;

            RepositoryCommentController CommentController = new RepositoryCommentController();
            ArrayList Comments = null;

            ArrayList RepositoryObjects = GetRepositoryObjects(ModuleID, "", "Name", oRepositoryBusinessController.IS_APPROVED, -1, "", -1);

            if (RepositoryObjects.Count != 0)
            {
                strXML += "<repository>";

                RepositoryInfo objDocument = null;
                foreach (RepositoryInfo objDocument_loopVariable in RepositoryObjects)
                {
                    objDocument = objDocument_loopVariable;
                    strXML     += "<item>";
                    strXML     += "<itemid>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(objDocument.ItemId.ToString()) + "</itemid>";
                    strXML     += "<moduleid>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(objDocument.ModuleId.ToString()) + "</moduleid>";
                    strXML     += "<createdbyuser>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(objDocument.CreatedByUser) + "</createdbyuser>";
                    strXML     += "<createddate>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(objDocument.CreatedDate.ToString()) + "</createddate>";
                    strXML     += "<updatedbyuser>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(objDocument.UpdatedByUser) + "</updatedbyuser>";
                    strXML     += "<updateddate>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(objDocument.UpdatedDate.ToString()) + "</updateddate>";
                    strXML     += "<name>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(objDocument.Name) + "</name>";
                    strXML     += "<description>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(objDocument.Description) + "</description>";
                    strXML     += "<author>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(objDocument.Author) + "</author>";
                    strXML     += "<authoremail>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(objDocument.AuthorEMail) + "</authoremail>";
                    strXML     += "<filesize>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(objDocument.FileSize) + "</filesize>";
                    strXML     += "<downloads>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(objDocument.Downloads.ToString()) + "</downloads>";
                    strXML     += "<previewimage>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(objDocument.PreviewImage) + "</previewimage>";
                    strXML     += "<image>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(objDocument.Image) + "</image>";
                    strXML     += "<filename>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(objDocument.FileName) + "</filename>";
                    strXML     += "<clicks>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(objDocument.Clicks.ToString()) + "</clicks>";
                    strXML     += "<ratingvotes>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(objDocument.RatingVotes.ToString()) + "</ratingvotes>";
                    strXML     += "<ratingtotal>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(objDocument.RatingTotal.ToString()) + "</ratingtotal>";
                    strXML     += "<ratingaverage>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(objDocument.RatingAverage.ToString()) + "</ratingaverage>";
                    strXML     += "<commentcount>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(objDocument.CommentCount.ToString()) + "</commentcount>";
                    strXML     += "<approved>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(objDocument.Approved.ToString()) + "</approved>";
                    strXML     += "<showemail>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(objDocument.ShowEMail.ToString()) + "</showemail>";
                    strXML     += "<summary>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(objDocument.Summary) + "</summary>";
                    strXML     += "<securityroles>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(objDocument.SecurityRoles) + "</securityroles>";

                    Comments = CommentController.GetRepositoryComments(objDocument.ItemId, ModuleID);
                    strXML  += "<comments>";
                    foreach (RepositoryCommentInfo comment in Comments)
                    {
                        strXML += "<comment>";
                        strXML += "<itemid>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(comment.ItemId.ToString()) + "</itemid>";
                        strXML += "<createdbyuser>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(comment.CreatedByUser) + "</createdbyuser>";
                        strXML += "<createddate>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(comment.CreatedDate.ToString()) + "</createddate>";
                        strXML += "<objectid>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(comment.ObjectId.ToString()) + "</objectid>";
                        strXML += "<comment>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(comment.Comment) + "</comment>";
                        strXML += "</comment>";
                    }
                    strXML += "</comments>";

                    RepositoryItemCategories = RepositoryItemCategoryController.GetRepositoryObjectCategories(objDocument.ItemId);
                    strXML += "<categories>";
                    foreach (RepositoryObjectCategoriesInfo cat in RepositoryItemCategories)
                    {
                        strXML += "<category>";
                        strXML += "<itemid>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(cat.ItemID.ToString()) + "</itemid>";
                        strXML += "<objectid>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(cat.ObjectID.ToString()) + "</objectid>";
                        strXML += "<categoryid>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(cat.CategoryID.ToString()) + "</categoryid>";
                        strXML += "</category>";
                    }
                    strXML += "</categories>";

                    strXML += "</item>";
                }

                RepositoryCategoryController CategoryController = new RepositoryCategoryController();
                ArrayList Arr        = CategoryController.GetRepositoryCategories(ModuleID, -1);
                ArrayList categories = new ArrayList();
                oRepositoryBusinessController.AddCategoryToArrayList(ModuleID, -1, Arr, ref categories);

                foreach (RepositoryCategoryInfo objCategory in categories)
                {
                    strXML += "<category>";
                    strXML += "<itemid>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(objCategory.ItemId.ToString()) + "</itemid>";
                    strXML += "<moduleid>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(objCategory.ModuleId.ToString()) + "</moduleid>";
                    strXML += "<category>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(objCategory.Category.ToString()) + "</category>";
                    strXML += "<parent>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(objCategory.Parent.ToString()) + "</parent>";
                    strXML += "<vieworder>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(objCategory.ViewOrder.ToString()) + "</vieworder>";
                    strXML += "<count>" + DotNetNuke.Common.Utilities.XmlUtils.XMLEncode(objCategory.Count.ToString()) + "</count>";
                    strXML += "</category>";
                }

                strXML += "</repository>";
            }

            return(strXML);
        }