示例#1
0
        private void LoadBaseData()
        {
            ControlList baseData = this.Content.GetSubControl("basedata");

            baseData["currentuser"].InnerText   = this.CurrentUser;
            baseData["pageviewcount"].InnerText = PageViewCount().ToString();

            foreach (string pageInHistory in History())
            {
                XmlNode historyNode = baseData["history"].OwnerDocument.CreateElement("item");
                historyNode.InnerText = pageInHistory;
                baseData["history"].AppendChild(historyNode);
            }
        }
示例#2
0
        public Process(System.Web.UI.Page httpPage, PluginServices pluginServices)
        {
            Plugins  = pluginServices;
            HttpPage = httpPage;
            XmlData  = new XmlDocument();

            Plugins.FindPlugins(this, Common.CombinePaths(Root, "Bin"));

            XmlNode xmlNode = XmlData.CreateElement("data");

            XmlData.AppendChild(xmlNode);

            Content    = new ControlList(xmlNode);
            m_BasePath = httpPage.Request.ServerVariables["SERVER_PROTOCOL"].Split('/')[0].ToLower() + "://" + httpPage.Request.ServerVariables["SERVER_NAME"] + ":" + httpPage.Request.ServerVariables["SERVER_PORT"] + httpPage.Request.ApplicationPath.TrimEnd('/') + "";
            Content["basepath"].InnerText  = m_BasePath;
            Content["referrer"].InnerText  = httpPage.Server.UrlEncode(httpPage.Request.ServerVariables["HTTP_REFERER"]);
            Content["domain"].InnerText    = httpPage.Server.UrlEncode(httpPage.Request.ServerVariables["SERVER_NAME"]);
            Content["useragent"].InnerText = httpPage.Server.UrlEncode(httpPage.Request.ServerVariables["HTTP_USER_AGENT"]);
            Content["sessionid"].InnerText = httpPage.Server.UrlEncode(httpPage.Session.LCID.ToString());
            Content["ip"].InnerText        = httpPage.Server.UrlEncode(httpPage.Request.ServerVariables["REMOTE_ADDR"]);

            QueryData   = new XmlItemList(CommonXml.GetNode(xmlNode, "query/data", EmptyNodeHandling.CreateNew));
            Attributes  = new XmlItemList(CommonXml.GetNode(xmlNode, "attributes", EmptyNodeHandling.CreateNew));
            QueryEvents = new XmlItemList(CommonXml.GetNode(xmlNode, "query/events", EmptyNodeHandling.CreateNew));
            QueryOther  = new XmlItemList(CommonXml.GetNode(xmlNode, "query/other", EmptyNodeHandling.CreateNew));

            processQueries();

            ConfigureDebugging();

            CookieLoginDuringProcessInit(httpPage);

            LoadBaseData();
            // loads new user...

            if (this.QueryEvents["main"] == "login")
            {
                if (!Login(QueryData["login"], QueryData["password"]))
                {
                    if (m_Settings["messages/loginerror"] != string.Empty)
                    {
                        httpPage.Response.Redirect(BasePath + "/login.aspx?error=" + httpPage.Server.UrlEncode(m_Settings["messages/loginerror"]));
                    }
                    else
                    {
                        httpPage.Response.Redirect(BasePath + "/login.aspx");
                    }
                }
                else
                {
                    SetLoginCookie(httpPage);

                    // Set session timeout to 3 hours
                    httpPage.Session.Timeout = 180;
                }
            }
            else if (this.QueryEvents["main"] == "logout")
            {
                System.Web.HttpCookie loginCookie = new System.Web.HttpCookie("login_cookie", "");
                httpPage.Response.SetCookie(loginCookie);
                Logout();
            }
        }