示例#1
0
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            Entities.Users.UserInfo userInfo = Entities.Users.UserController.GetCurrentUserInfo();
            if (!Page.IsPostBack && userInfo != null && userInfo.UserID != Null.NullInteger)
            {
                //check view permissions - Yes?
                var portalSettings = PortalController.GetCurrentPortalSettings();
                var pageCulture    = Thread.CurrentThread.CurrentCulture.Name;
                if (string.IsNullOrEmpty(pageCulture))
                {
                    pageCulture = PortalController.GetActivePortalLanguage(portalSettings.PortalId);
                }

                List <TabInfo> tabs          = TabController.GetTabsBySortOrder(portalSettings.PortalId, pageCulture, true);
                var            sortedTabList = TabController.GetPortalTabs(tabs, Null.NullInteger, false, Null.NullString, true, false, true, true, true);

                Items.Clear();
                foreach (var _tab in sortedTabList)
                {
                    RadComboBoxItem tabItem = new RadComboBoxItem(_tab.IndentedTabName, _tab.FullUrl);
                    tabItem.Enabled = !_tab.DisableLink;

                    Items.Add(tabItem);
                }

                Items.Insert(0, new Telerik.Web.UI.RadComboBoxItem("", ""));
            }

            Width = Unit.Pixel(245);
        }
示例#2
0
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            Entities.Users.UserInfo userInfo = Entities.Users.UserController.GetCurrentUserInfo();
            if (!Page.IsPostBack && userInfo != null && userInfo.UserID != Null.NullInteger)
            {
                //check view permissions - Yes?
                var portalSettings = PortalController.GetCurrentPortalSettings();
                var pageCulture    = Thread.CurrentThread.CurrentCulture.Name;
                if (string.IsNullOrEmpty(pageCulture))
                {
                    pageCulture = PortalController.GetActivePortalLanguage(portalSettings.PortalId);
                }

                List <TabInfo> tabs          = TabController.GetTabsBySortOrder(portalSettings.PortalId, pageCulture, true);
                var            sortedTabList = TabController.GetPortalTabs(tabs, Null.NullInteger, false, Null.NullString, true, false, true, true, true);

                Items.Clear();
                foreach (var _tab in sortedTabList)
                {
                    var linkUrl = string.Empty;
                    switch (LinksType.ToUpperInvariant())
                    {
                    case "USETABNAME":
                        var nameLinkFormat = "http://{0}/Default.aspx?TabName={1}";
                        linkUrl = string.Format(nameLinkFormat, portalSettings.PortalAlias.HTTPAlias, HttpUtility.UrlEncode(_tab.TabName));
                        break;

                    case "USETABID":
                        var idLinkFormat = "http://{0}/Default.aspx?TabId={1}";
                        linkUrl = string.Format(idLinkFormat, portalSettings.PortalAlias.HTTPAlias, _tab.TabID);
                        break;

                    default:
                        linkUrl = _tab.FullUrl;
                        break;
                    }
                    RadComboBoxItem tabItem = new RadComboBoxItem(_tab.IndentedTabName, linkUrl);
                    tabItem.Enabled = !_tab.DisableLink;

                    Items.Add(tabItem);
                }

                Items.Insert(0, new Telerik.Web.UI.RadComboBoxItem("", ""));
            }

            Width = Unit.Pixel(245);
        }
示例#3
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            var      objTabController = new TabController();
            int      i;
            int      iItemIndex;
            int      iRootGroupId = 0;
            qElement temp;
            int      StartingItemId = 0;

            AuthPages     = new ArrayList();
            PagesQueue    = new Queue();
            arrayShowPath = new ArrayList();
            iItemIndex    = 0;
            //---------------------------------------------------

            SetPanelbarProperties();

            if (!Page.IsPostBack)
            {
                //optional code to support displaying a specific branch of the page tree
                GetShowOnlyCurrent(objTabController, ref StartingItemId, ref iRootGroupId);
                //Fixed: For i = 0 To Me.PortalSettings.DesktopTabs.Count - 1
                int             portalID    = PortalSettings.ActiveTab.IsSuperTab ? -1 : PortalSettings.PortalId;
                IList <TabInfo> desktopTabs = TabController.GetTabsBySortOrder(portalID, PortalController.GetActivePortalLanguage(portalID), true);
                for (i = 0; i <= desktopTabs.Count - 1; i++)
                {
                    {
                        if (((desktopTabs[i]).TabID == PortalSettings.ActiveTab.TabID))
                        {
                            FillShowPathArray(ref arrayShowPath, (desktopTabs[i]).TabID, objTabController);
                        }
                        //Fariborz Khosravi
                        //if (((desktopTabs[i]).IsVisible && !(desktopTabs[i]).IsDeleted) &&
                        //    (((desktopTabs[i]).StartDate == DateTime.MinValue && (desktopTabs[i]).EndDate == DateTime.MinValue) ||
                        //     ((desktopTabs[i]).StartDate < DateTime.Now && (desktopTabs[i]).EndDate > DateTime.Now) || AdminMode) &&
                        //    (TabPermissionController.CanViewPage(desktopTabs[i]) && !CheckToExclude((desktopTabs[i]).TabName, (desktopTabs[i]).TabID)))
                        if (((desktopTabs[i]).IsVisible && !(desktopTabs[i]).IsDeleted) &&
                            (((desktopTabs[i]).StartDate == DotNetNuke.Common.Utilities.Null.NullDate && (desktopTabs[i]).EndDate == DotNetNuke.Common.Utilities.Null.NullDate) ||
                             ((desktopTabs[i]).StartDate <DateTime.Now && (desktopTabs[i]).EndDate> DateTime.Now) || AdminMode) &&
                            (TabPermissionController.CanViewPage(desktopTabs[i]) && !CheckToExclude((desktopTabs[i]).TabName, (desktopTabs[i]).TabID)))
                        {
                            temp              = new qElement();
                            temp.page         = desktopTabs[i];
                            temp.radPanelItem = new RadPanelItem();
                            if (CheckShowOnlyCurrent((desktopTabs[i]).TabID, (desktopTabs[i]).ParentId, StartingItemId, iRootGroupId) && CheckPanelVisibility(desktopTabs[i]))
                            {
                                iItemIndex = iItemIndex + 1;
                                temp.item  = iItemIndex;
                                PagesQueue.Enqueue(AuthPages.Count);
                                RadPanel1.Items.Add(temp.radPanelItem);
                            }
                            AuthPages.Add(temp);
                        }
                    }
                }
                BuildPanelbar(RadPanel1.Items);
                if ((0 == RadPanel1.Items.Count))
                {
                    RadPanel1.Visible = false;
                }
            }
        }
示例#4
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            try
            {
                bool blnValid = true;
//                string strTransactionID;
                int intRoleID   = 0;
                int intPortalID = PortalSettings.PortalId;
                int intUserID   = 0;
//                string strDescription;
                double dblAmount = 0;
//                string strEmail;
                bool   blnCancel   = false;
                string strPayPalID = Null.NullString;
                string strPost     = "cmd=_notify-validate";
                foreach (string strName in Request.Form)
                {
                    string strValue = Request.Form[strName];
                    switch (strName)
                    {
                    case "txn_type":     //get the transaction type
                        string strTransactionType = strValue;
                        switch (strTransactionType)
                        {
                        case "subscr_signup":
                        case "subscr_payment":
                        case "web_accept":
                            break;

                        case "subscr_cancel":
                            blnCancel = true;
                            break;

                        default:
                            blnValid = false;
                            break;
                        }
                        break;

                    case "payment_status":     //verify the status
                        if (strValue != "Completed")
                        {
                            blnValid = false;
                        }
                        break;

                    case "txn_id":     //verify the transaction id for duplicates
//                            strTransactionID = strValue;
                        break;

                    case "receiver_email":     //verify the PayPalId
                        strPayPalID = strValue;
                        break;

                    case "mc_gross":     // verify the price
                        dblAmount = double.Parse(strValue);
                        break;

                    case "item_number":     //get the RoleID
                        intRoleID = Int32.Parse(strValue);
                        //RoleInfo objRole = objRoles.GetRole(intRoleID, intPortalID);
                        break;

                    case "item_name":     //get the product description
//                            strDescription = strValue;
                        break;

                    case "custom":     //get the UserID
                        intUserID = Int32.Parse(strValue);
                        break;

                    case "email":     //get the email
//                            strEmail = strValue;
                        break;
                    }

                    //reconstruct post for postback validation
                    strPost += string.Format("&{0}={1}", Globals.HTTPPOSTEncode(strName), Globals.HTTPPOSTEncode(strValue));
                }

                //postback to verify the source
                if (blnValid)
                {
                    Dictionary <string, string> settings = PortalController.Instance.GetPortalSettings(PortalSettings.PortalId);
                    string strPayPalURL;

                    // Sandbox mode
                    if (settings.ContainsKey("paypalsandbox") && !String.IsNullOrEmpty(settings["paypalsandbox"]) && settings["paypalsandbox"].Equals("true", StringComparison.InvariantCultureIgnoreCase))
                    {
                        strPayPalURL = "https://www.sandbox.paypal.com/cgi-bin/webscr?";
                    }
                    else
                    {
                        strPayPalURL = "https://www.paypal.com/cgi-bin/webscr?";
                    }
                    var objRequest = Globals.GetExternalRequest(strPayPalURL);
                    objRequest.Method        = "POST";
                    objRequest.ContentLength = strPost.Length;
                    objRequest.ContentType   = "application/x-www-form-urlencoded";
                    using (var objStream = new StreamWriter(objRequest.GetRequestStream()))
                    {
                        objStream.Write(strPost);
                    }

                    string strResponse;
                    using (var objResponse = (HttpWebResponse)objRequest.GetResponse())
                    {
                        using (var sr = new StreamReader(objResponse.GetResponseStream()))
                        {
                            strResponse = sr.ReadToEnd();
                        }
                    }
                    switch (strResponse)
                    {
                    case "VERIFIED":
                        break;

                    default:
                        //possible fraud
                        blnValid = false;
                        break;
                    }
                }
                if (blnValid)
                {
                    int        intAdministratorRoleId = 0;
                    string     strProcessorID         = Null.NullString;
                    PortalInfo objPortalInfo          = PortalController.Instance.GetPortal(intPortalID);
                    if (objPortalInfo != null)
                    {
                        intAdministratorRoleId = objPortalInfo.AdministratorRoleId;
                        strProcessorID         = objPortalInfo.ProcessorUserId.ToLower();
                    }

                    if (intRoleID == intAdministratorRoleId)
                    {
                        //admin portal renewal
                        strProcessorID = Host.ProcessorUserId.ToLower();
                        float portalPrice = objPortalInfo.HostFee;
                        if ((portalPrice.ToString() == dblAmount.ToString()) && (HttpUtility.UrlDecode(strPayPalID.ToLower()) == strProcessorID))
                        {
                            PortalController.Instance.UpdatePortalExpiry(intPortalID, PortalController.GetActivePortalLanguage(intPortalID));
                        }
                        else
                        {
                            var log = new LogInfo
                            {
                                LogPortalID   = intPortalID,
                                LogPortalName = PortalSettings.PortalName,
                                LogUserID     = intUserID,
                                LogTypeKey    = EventLogController.EventLogType.POTENTIAL_PAYPAL_PAYMENT_FRAUD.ToString()
                            };
                            LogController.Instance.AddLog(log);
                        }
                    }
                    else
                    {
                        //user subscription
                        RoleInfo objRoleInfo = RoleController.Instance.GetRole(intPortalID, r => r.RoleID == intRoleID);
                        float    rolePrice   = objRoleInfo.ServiceFee;
                        float    trialPrice  = objRoleInfo.TrialFee;
                        if ((rolePrice.ToString() == dblAmount.ToString() || trialPrice.ToString() == dblAmount.ToString()) && (HttpUtility.UrlDecode(strPayPalID.ToLower()) == strProcessorID))
                        {
                            RoleController.Instance.UpdateUserRole(intPortalID, intUserID, intRoleID, RoleStatus.Approved, false, blnCancel);
                        }
                        else
                        {
                            var log = new LogInfo
                            {
                                LogPortalID   = intPortalID,
                                LogPortalName = PortalSettings.PortalName,
                                LogUserID     = intUserID,
                                LogTypeKey    = EventLogController.EventLogType.POTENTIAL_PAYPAL_PAYMENT_FRAUD.ToString()
                            };
                            LogController.Instance.AddLog(log);
                        }
                    }
                }
            }
            catch (Exception exc) //Page failed to load
            {
                Exceptions.ProcessPageLoadException(exc);
            }
        }
        /// <summary>
        /// Returns a portal info object for the portal
        /// </summary>
        /// <param name="portalId"></param>
        /// <param name="exceptionOnNull"></param>
        /// <remarks>This method wraps the PortalController.GetPortal method, and adds a check if the reuslt is null.</remarks>.
        /// <returns></returns>
        public static PortalInfo GetPortal(int portalId, bool exceptionOnNull)
        {
            PortalInfo pi = null;
            //775 : change to use threadsafe dictionary
            SharedDictionary <int, PortalInfo> portals = (SharedDictionary <int, PortalInfo>)DataCache.GetCache(PortalsKey) ??
                                                         new SharedDictionary <int, PortalInfo>();

            using (portals.GetWriteLock())
            {
                if (portals.ContainsKey(portalId))
                {
                    //portal found, return
                    pi = portals[portalId];
                }
                else
                {
                    try
                    {
                        //if not found, get from database
                        pi = PortalController.Instance.GetPortal(portalId);

                        if (pi == null)
                        {
                            // Home page redirect loop when using default language not en-US and first request with secondary language
                            //calls get portal using culture code to support
                            string cultureCode = PortalController.GetActivePortalLanguage(portalId);
                            pi = PortalController.Instance.GetPortal(portalId, cultureCode);
                        }
                        if (pi != null)
                        {
                            // Home page redirect loop when using default language not en-US and first request with secondary language
                            //check for correct, default language code in portal object
                            string portalCultureCode = pi.CultureCode;
                            if (portalCultureCode != null &&
                                String.CompareOrdinal(portalCultureCode, pi.DefaultLanguage) != 0)
                            {
                                //portal culture code and default culture code are not the same.
                                //this means we will get the incorrect home page tab id
                                //call back and get the correct one as per the default language
                                PortalInfo defaultLangPortal = PortalController.Instance.GetPortal(portalId, pi.DefaultLanguage);
                                if (defaultLangPortal != null)
                                {
                                    pi = defaultLangPortal;
                                }
                            }
                        }
                        if (pi != null)
                        {
                            //add to dictionary and re-store in cache
                            portals.Add(pi.PortalID, pi);
                            DataCache.SetCache(PortalsKey, portals); //store back in dictionary
                        }
                    }
// ReSharper disable EmptyGeneralCatchClause
                    catch
// ReSharper restore EmptyGeneralCatchClause
                    {
                        //912: capture as fall back any exception resulting from doing a portal lookup in 6.x
                        //this happens when portalId = -1
                        //no long, no handling, just passonwards with null portal
                    }
                }
            }

            if (exceptionOnNull && pi == null)
            {
                throw new NullReferenceException("No Portal Found for portalid : " + portalId.ToString());
            }
            return(pi);
        }