protected void Page_Load(object sender, EventArgs e)
        {
            ((MasterPage)Master).SetPagePermissionLevel(3);
            User loggedUser = Help.GetUserSession(Session);

            if (loggedUser != null && loggedUser.PermissionLevel >= 3)
            {
                string[] logLines = DatabaseHandler.GetLog(Session);

                Label_LogTitle.Text = "Logs as of " + DateTime.Now;

                if (logLines != null)
                {
                    foreach (string s in logLines)
                    {
                        Label l = new Label();
                        l.Text = s;
                        Panel_ViewLog.Controls.AddAt(2, l);
                        Panel_ViewLog.Controls.AddAt(2, new LiteralControl("<br /> <br />"));
                    }
                }

                List <string> activeCodes = DatabaseHandler.GetActiveCodes(Session);

                foreach (string s in activeCodes)
                {
                    Label codeLabel = new Label();
                    codeLabel.ForeColor = codeColor;
                    codeLabel.Text      = s;
                    Panel_ActiveCodes.Controls.Add(codeLabel);
                    Panel_ActiveCodes.Controls.Add(new LiteralControl("<br />"));
                }

                //Slow loading this is a temporary solution
                //System.Threading.Thread.Sleep(1000);

                //Checking if data needs to be filled in...
                string editID = Request.QueryString["editID"];
                if (editID != null)
                {
                    int      postID = int.Parse(editID);
                    NewsPost post   = DatabaseHandler.GetNewsPost(postID);
                    if (post != null && post.Creator.ID == loggedUser.ID)
                    {
                        editingPost                = post;
                        FreeTextBox1.Text          = post.Data; //Server.HtmlDecode(post.Data);
                        FreeTextBox1.UpdateToolbar = true;
                    }
                }
            }
        }
        protected void Button_SubmitNews_Click(object sender, EventArgs e)
        {
            User creator = Help.GetUserSession(Session);

            if (creator != null)
            {
                NewsPost newPost = new NewsPost(0, creator, DateTime.Now, "", FreeTextBox1.Text);
                bool     result  = DatabaseHandler.AddNewsPost(Session, newPost);
                if (result)
                {
                    ShowNewsInfo("A new news post was created!", Color.Green);
                }
                else
                {
                    ShowNewsInfo("Error occured while trying to create a news post.", Color.Red);
                }
            }
        }