//protected abstract bool CheckPagePrivate(); /// <summary> /// is called by LoadControls() /// </summary> /// <returns></returns> protected bool check_page(ViewType viewType) { #region test auf vorhandene qid myParams = page_utilities.EncodeParams(Request.Params); //if (Request.QueryString["qid"] != null) if (myParams["qid"] != null) { //if there's a valid questionnaire_id fill table 'questionnaire_general' and 'page' //questionnaire_id = Request.QueryString["qid"].ToString(); questionnaire_id = myParams["qid"].ToString(); questionnaire_id = questionnaire_id.Replace("?", ""); questionnaire_id = questionnaire_id.Replace("%3f", ""); int qid_int = 0; try { qid_int = Int32.Parse(questionnaire_id); } catch { Response.Redirect("404_invalidqid.aspx", true); return false; } ///implemented on Nov, 12th, 2007 due to a mistake made by Sebastian Olimid ///eDM was send out containing a link with qid = 4258 ///Sebastian needed to change something on the form and deleted 4258 and created ///a new form (4259) if (questionnaire_id == "4258") { questionnaire_id = "4259"; } Hashtable h_params = new Hashtable(); h_params.Add("questionnaire_id", questionnaire_id); questionnaire_general = DB.execProc("select_questionnaire_general", h_params); h_params.Clear(); #region test auf gültige qid if (questionnaire_general.Rows.Count != 0) { qid_country = questionnaire_general.Rows[0]["country_FK"].ToString().ToLower(); qid_language = questionnaire_general.Rows[0]["language_FK"].ToString().ToLower(); //changed to only decide based on language to be able to support new RTL cc-ll combinations (HP homepages) without code change switch (qid_language.ToUpper()) //switch (qid_country.ToUpper() + qid_language.ToUpper()) { //case "ILHE": case "HE": bodyDirection = "right"; break; //case "EMEA_MIDDLE_EASTAR": case "AR": bodyDirection = "right"; break; default: bodyDirection = "left"; break; } page = GetPage(); h_params.Clear(); #region test auf vorhandene page if (page.Rows.Count != 0) { customer = new DataTable(); if (CheckPreview(viewType)) { if (Request.QueryString["rpi"] != null) { reset_guid = Request.QueryString["rpi"]; } post_params = (DataTable)Session["post_params"]; if (post_params != null) { session_valid = true; } else { session_valid = false; } #region validation for Flexfield10(AssetID) //†††20100817 Biju Pattathil | RFG 2.2 Start†††//if ((Request.QueryString["status"] == null) || (Request.QueryString["status"].ToString() != "test")) //{ // if (bool.Parse(questionnaire_general.Rows[0]["any_asset"].ToString())) // { // if (Request.QueryString["flexfield10"] != null) // { // if (Request.QueryString["flexfield10"].ToString() != "") // { // if (!System.Text.RegularExpressions.Regex.IsMatch(Request.QueryString["flexfield10"].ToString(), utility.getParameter("FlexField10Format"))) // { // Response.Redirect(String.Format("~/FormContentError.aspx?flex10msg=flexfield10 Incorrect"), true); // return false; // } // } // } // else // { // Response.Redirect(String.Format("~/FormContentError.aspx?flex10msg=flexfield10 Missing"), true); // return false; // } // } //} //†††20100817 Biju Pattathil | RFG 2.2 Start†††#endregion return true; } else { return false; } } else { Response.Redirect(String.Format("404_noformpage.aspx?cc={0}&ll={1}", qid_country, qid_language), true); return false; } #endregion } else { Response.Redirect("404_invalidqid.aspx", true); return false; } #endregion } else { Response.Redirect("404_noqid.aspx", true); return false; } #endregion }
private bool CheckIfActiveOfflineEtc(ViewType viewType) { if (questionnaire_general.Rows[0]["status_active"].ToString().ToLower() == "true") { #region test auf abgelaufen if (!((DateTime)questionnaire_general.Rows[0]["expire_date"] < DateTime.Now)) { #region test auf personalized und cid/registered_personalized und rid check_page_personalized(viewType); #endregion } else { string expire_redirect = questionnaire_general.Rows[0]["expire_redirect"].ToString(); #region redirect to external or standard expiration page if (expire_redirect != "") { Response.Redirect(expire_redirect, true); } else { Response.Redirect(String.Format("404_expired.aspx?cc={0}&ll={1}", qid_country, qid_language), true); } #endregion return false; } #endregion #region check if the page is offline if (questionnaire_general.Rows[0]["offline_mode"].ToString() != "" || questionnaire_general.Rows[0]["offline_mode"].ToString() != null) { if (IsOffline()) { string expire_redirect = questionnaire_general.Rows[0]["offline_redirect"].ToString(); #region redirect to external or standard expiration page if (expire_redirect != "") { Response.Redirect(expire_redirect, true); } else { Response.Redirect(String.Format("404_maintenance.aspx?cc={0}&ll={1}", qid_country, qid_language), true); } #endregion return false; } } #endregion #region check for scheduled publish DateTime schDt; DateTime.TryParse(questionnaire_general.Rows[0]["publish_date"].ToString(), out schDt); if (schDt > DateTime.Now) { Response.Redirect(String.Format("404_notactive.aspx?cc={0}&ll={1}", qid_country, qid_language), true); } #endregion return true; } else { Response.Redirect(String.Format("404_notactive.aspx?cc={0}&ll={1}", qid_country, qid_language), true); return false; } }
/// <summary> /// is called by check_page /// </summary> protected void check_page_personalized(ViewType viewType) { personalized = false; registered_personalized = false; personalized = (questionnaire_general.Rows[0]["personalized"].ToString().ToLower() == "true"); registered_personalized = (questionnaire_general.Rows[0]["registered_personalized"].ToString().ToLower() == "true"); Hashtable h_params = new Hashtable(); if (personalized | registered_personalized) { #region read cid or rid from URL //if (personalized && Request.QueryString["cid"] != null && Regex.IsMatch(Request.QueryString["cid"], constants.REGEX_GUID_PATTERN, RegexOptions.IgnoreCase) ) if (personalized && myParams["cid"] != null && Regex.IsMatch(myParams["cid"], constants.REGEX_GUID_PATTERN, RegexOptions.IgnoreCase)) { //cid = Request.QueryString["cid"]; cid = myParams["cid"]; } //if (registered_personalized && Request.QueryString["rid"] != null && Regex.IsMatch(Request.QueryString["rid"], constants.REGEX_GUID_PATTERN, RegexOptions.IgnoreCase) ) if (registered_personalized && myParams["rid"] != null && Regex.IsMatch(myParams["rid"], constants.REGEX_GUID_PATTERN, RegexOptions.IgnoreCase)) { #region check whether Session contains the key login if (Session["login"] != null) { //rid = Request.QueryString["rid"]; rid = myParams["rid"]; } else { //remove all occurences of ? and insert only one at the beginning string querystring = utility.clear_querystring(Request.QueryString.ToString()); //string querystring = utility.clear_querystring(HttpUtility.HtmlEncode(Request.QueryString.ToString())); if (questionnaire_general.Rows[0]["Company"].ToString() == Configuration.Company_HPE.ToString()) //RFG 2.20 { if (Request.AppRelativeCurrentExecutionFilePath != "~/live/login_e.aspx") { Response.Redirect(String.Format("~/live/login_e.aspx{0}", querystring)); } } else { if (Request.AppRelativeCurrentExecutionFilePath != "~/live/login.aspx") { Response.Redirect(String.Format("~/live/login.aspx{0}", querystring)); } } } #endregion } #endregion // if there's a cid or a rid then fill table 'customer' if (cid != "" | rid != "") { if (cid != "") { h_params.Add("customer_id", cid); } if (rid != "") { h_params.Add("responser_id", rid); } customer = DB.execProc("select_customer", h_params); h_params.Clear(); #region log visit to site only for CID customers! if (!this.IsPostBack && cid != "" && customer.Rows.Count > 0) { h_params.Add("customer_id", cid); h_params.Add("questionnaire_id", questionnaire_id); h_params.Add("source_type", Migration.ViewTypeToString(viewType)); DB.execProc("insert_response_time", h_params); h_params.Clear(); } #endregion } else { h_params.Add("customer_id", Constants.UnknownCustomer); customer = DB.execProc("select_customer", h_params); h_params.Clear(); } } }
protected bool CheckPreview(ViewType viewType) { #region test auf test-preview if ("production" == utility.getParameter("platform") || "stage" == utility.getParameter("platform") || "dev" == utility.getParameter("platform")) { if (myParams["view"] == "sneak" || HP.Rfg.lib.utility.getParameter("noexternalpreviews") != "true") { #region test auf personalized und cid/registered_personalized und rid check_page_personalized(viewType); return true; #endregion } else { #region test auf active return CheckIfActiveOfflineEtc(viewType); #endregion } } else { #region test auf personalized und cid/registered_personalized und rid check_page_personalized(viewType); return true; #endregion } #endregion }