Esempio n. 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.FilePath.ToLower().Contains("chat.aspx"))
        {
            form1.Style.Add("height", "100%");
            footer.Visible = false;
            cssclassname   = "conversation-page";
            form1.Attributes["data-form"] = "form-message";
        }

        if (Request.CurrentExecutionFilePath == "/Login.aspx")
        {
            btnLogin.Visible = false;
        }

        if (Request.CurrentExecutionFilePath == "/Sign-up.aspx")
        {
            btnSignUp.Visible = false;
        }

        if (MyUtils.IsLoggedIn())
        {
            bool is_registration = Request.CurrentExecutionFilePath.ToLower().Contains("/account/registration") ||
                                   Request.CurrentExecutionFilePath.ToLower().Contains("/account/uploadphotos");

            if (!is_registration)
            {
                bool needtoverify = Convert.ToUInt32(MyUtils.GetUserField("email_verified")) == 0;
                buycredits.Visible = !needtoverify;
                if (needtoverify && !Request.CurrentExecutionFilePath.ToLower().Contains("/account/verifyemail"))
                {
                    Response.Redirect("~/Account/VerifyEmail", true);
                    return;
                }
            }


            if (Utils.IsUserBan()) // in case of cookie
            {
                Response.Redirect("~/Login?logout=1");
            }

            if (Utils.IsUserReject())
            {
                if (!is_registration)
                {
                    Session["message"] = "Your account has been rejected. Please, correct your profile and photos.";
                    Response.Redirect("~/Account/Registration");
                }
            }

            MyUtils.UserIsOnline();

            HomeLink           = "/Account/";
            divButtons.Visible = false;
            lblUserName.Text   = MyUtils.GetUserField("username").ToString();
            topdiv.Visible     = true;

            TOPCOUNTS = db.GetRowCache("exec GET_MENU_COUNTS " + MyUtils.ID_USER, 20, "TOPCOUNTS_" + MyUtils.ID_USER);


            if (Request.CurrentExecutionFilePath == "/Account/Registration" ||
                (Request.QueryString["hidemenu"] != null))
            {
                topdiv.Visible      = false;
                divUserName.Visible = false;
            }
            else if (Request.CurrentExecutionFilePath != "/Account/Registration" && Request.CurrentExecutionFilePath != "/Activate.aspx" &&
                     string.IsNullOrEmpty(MyUtils.GetUserField("description").ToString()))
            {
                Response.Redirect("~/Account/Registration");
            }

            if (MyUtils.IsUserAdmin())
            {
                hrefPhotos.Visible   = true;
                hrefProfiles.Visible = true;
            }
        }
        else
        {
            divUserName.Visible = false;
        }


        if (Request.CurrentExecutionFilePath.ToLower() == "/default.aspx")
        {
            WrapperStyle = "max-width:none;padding:0;";
//            topdiv.Visible = false;
        }
    }