Ejemplo n.º 1
0
        public void GenerateSidebarSurface()
        {
            var surface = new WebTemplate()
            {
                Name = "SidebarTemplate",
                Html = "/Website/templates/SidebarTemplate.html"
            };

            var sidebarLeft = new WebSection()
            {
                Template = surface,
                Name     = "Left",
                Default  = false
            };

            new WebSection()
            {
                Template = surface,
                Name     = "Right",
                Default  = true
            };

            var templatesUrl = new WebUrl()
            {
                Template = surface,
                Url      = "/website/cms/surfaces"
            };

            new WebMap()
            {
                Url = templatesUrl, Section = sidebarLeft, ForeignUrl = "/website/help?topic=surfaces", SortNumber = 1
            };
        }
Ejemplo n.º 2
0
        public void GenerateDefaultSurface()
        {
            var surface = new WebTemplate()
            {
                Name = "DefaultTemplate",
                Html = "/Website/templates/DefaultTemplate.html"
            };

            var topbar = new WebSection()
            {
                Template = surface,
                Name     = "TopBar",
                Default  = false
            };

            var main = new WebSection()
            {
                Template = surface,
                Name     = "Main",
                Default  = true
            };

            var catchAllUrl = new WebUrl()
            {
                Template = surface,
                Url      = null,
                IsFinal  = true
            };

            new WebMap()
            {
                Section = topbar, ForeignUrl = "/signin/user", SortNumber = 1
            };
        }
Ejemplo n.º 3
0
        public JsonResult Create(WebUrl model)
        {
            //if (!Request.IsAuthenticated)
            //    return Json(new { result = false, msg = "请您先<a href=\"/User/Login\">登录</a>" });

            model = new WebUrl()
            {
                ShortUrl = YueQian.ShortUrl.Core.ShortUrlGenerator.Generator(6)
            };
            UpdateModel(model);
            model.BrowerInfo = BrowserInfo.GetFullUserAgent();
            model.Ip         = IPAddress.IP;
            if (!model.Url.IsHttpUrl())
            {
                return(Json(new { result = false, msg = "您填写网址格式错误,请重新输入!" }));
            }
            if (string.IsNullOrEmpty(model.Title))
            {
                model.Title = "跃迁短址";
            }
            model.CreationDate = DateTime.Now;

            var user = System.Web.Security.Membership.GetUser(User.Identity.Name);

            if (Request.IsAuthenticated)
            {
                model.UserId   = user.ProviderUserKey.ToString();
                model.UserName = User.Identity.Name;
            }
            else
            {
                model.UserId   = "0";
                model.UserName = "******";
            }
            model.Url = model.Url.EnSureUrl();
            if (Request.IsAuthenticated)
            {
                IMongoQuery condition = Query.Null;
                condition = Query.EQ("UserId", user.ProviderUserKey.ToString());
                condition = Query.And(condition, Query.EQ("Url", model.Url));

                if (MongoHelper.Instance.Has(condition, "WebUrl"))
                {
                    return(Json(new { result = false, msg = "该网址您已经添加过了,请重新填写一个吧!" }));
                }
            }
            if (MongoHelper.Instance.Save(model))
            {
                StringBuilder msg = new StringBuilder();
                msg.AppendFormat("<a target=\"blank\" href=\"http://yqurl.com/{0}\">yqurl.com/{0}</a>", model.ShortUrl);
                if (!Request.IsAuthenticated)
                {
                    msg.AppendFormat(" <span class=\"reg\">快来<a href=\"/User/register?returnUrl=/User?s={0}\">注册</a>获取丰厚收益和更多功能</span> <a class=\"login\" href=\"/User/Login?returnUrl=/User?s={0}\">登录</a>", model.ShortUrl);
                }

                return(Json(new { result = true, msg = msg.ToString() }));
            }
            return(Json(new { result = false, msg = "提交短址信息错误,请重试!" }));
        }
Ejemplo n.º 4
0
 public VideosGridViewBinding(string image, int viewers, string title, TimeSpan length, string url)
 {
     this.Image   = new Uri(image);
     this.Viewers = viewers;
     this.Title   = title;
     this.Length  = length.Minutes.ToString() + ":" + length.Seconds.ToString();
     this.Url     = new WebUrl(url);
 }
Ejemplo n.º 5
0
 public SubscriberEmote(string channelName,
                        JObject emotes,
                        string badgeUrl,
                        long set)
 {
     this.channelName = channelName;
     this.emotes      = LoadEmotes(emotes);
     this.badge       = new WebUrl(badgeUrl);
     this.set         = set;
 }
Ejemplo n.º 6
0
        /// <summary>
        /// بروزرسانی لینک
        /// </summary>
        /// <param name="webUrl">مدل اطلاعات لینک</param>
        public void Edit(WebUrlViewModel webUrlViewModel)
        {
            WebUrl mdl = _ctx.WebUrls.Find(webUrlViewModel.Id);

            if (mdl != null)
            {
                mdl.Url = webUrlViewModel.Url;
                _ctx.WebUrls.Update(mdl);
                _ctx.SaveChanges();
            }
        }
Ejemplo n.º 7
0
 public void Awake()
 {
     if (File.Exists(ConfigPath.UrlInfo))
     {
         this.urlInfo = JsonHelper.FromJson <WebUrl>(File.ReadAllText(ConfigPath.UrlInfo));
     }
     else
     {
         this.urlInfo = new WebUrl();
     }
 }
Ejemplo n.º 8
0
        public override string GetUrl()
        {
            string serverRelativeUrl = this.WebUrl.Substring(this.WebUrl.IndexOf('/', 9));
            string folderPath        = this.FolderPath;

            if (this.FolderPath.IndexOf(serverRelativeUrl) == 0)
            {
                folderPath = this.FolderPath.Substring(serverRelativeUrl.Length);
            }
            //serverRelativeUrl
            return(WebUrl.CombineUrl(folderPath).TrimEnd(new char[] { '/' }));
        }
Ejemplo n.º 9
0
        private string GetURL()
        {
            if (EntityFactory.MainHeroView == null)
            {
                return(null);
            }

            uint nUserID = GameLogicAPI.getPlayerUserID(EntityFactory.MainHeroView.ID);

            if (nUserID == 0)
            {
                return(null);
            }

            IntPtr account = GameLogicAPI.getActorClientAccount();

            if (account == null || account == IntPtr.Zero)
            {
                return(null);
            }

            string username = Marshal.PtrToStringAnsi(account);

            if (string.IsNullOrEmpty(username))
            {
                return(null);
            }

            string time = DateTime.Now.ToString("yyyyMMddHHmm");
            string sign = Md5Sum(string.Format("{0}{1}{2}{3}", nUserID, username, time, KEY));

            string host = null;

            if (!WebUrl.TryGetValue(GameWebUrl.WEB_INTERFACE_LINK, out host))
            {
                Trace.Log("gamepromotion not have host in WebUrl.");
                return(null);
            }

            if (string.IsNullOrEmpty(host))
            {
                Trace.Log(string.Format("gamepromotion host is empty"));
                return(null);
            }

            string get_info_and_user_list = host + GET_INFO_AND_USER_LIST;
            string url = string.Format(get_info_and_user_list, nUserID, username, GAMEID, time, sign);

            return(url);
        }
Ejemplo n.º 10
0
        protected WebUrl GetWebUrl(string requestUri)
        {
            WebUrl webUrl = Db.SQL <WebUrl>("SELECT wu FROM Simplified.Ring6.WebUrl wu WHERE wu.Url = ?", requestUri).First;

            if (webUrl == null)
            {
                string wildCard = GetWildCardUrl(requestUri);

                webUrl = Db.SQL <WebUrl>("SELECT wu FROM Simplified.Ring6.WebUrl wu WHERE wu.Url = ?", wildCard).First
                         ?? Db.SQL <WebUrl>("SELECT wu FROM Simplified.Ring6.WebUrl wu WHERE (wu.Url IS NULL OR wu.Url = ?) AND wu.IsFinal = ?", string.Empty, true).First
                         ?? Db.SQL <WebUrl>("SELECT wu FROM Simplified.Ring6.WebUrl wu WHERE wu.Url IS NULL OR wu.Url = ?", string.Empty).First;
            }
            return(webUrl);
        }
Ejemplo n.º 11
0
 public Organisation(string uniqueName, string friendlyName, string version, EndpointCollection endPoints)
 {
     UniqueName   = uniqueName;
     FriendlyName = friendlyName;
     Version      = version;
     if (endPoints.ContainsKey(EndpointType.WebApplication))
     {
         WebUrl = endPoints[EndpointType.WebApplication];
         if (WebUrl != null && WebUrl.EndsWith("/"))
         {
             WebUrl = WebUrl.Substring(0, WebUrl.Length - 1);
         }
     }
 }
Ejemplo n.º 12
0
 public Emote(string name,
              string url,
              string description)
 {
     this.name = name;
     if (url.StartsWith("http:"))
     {
         this.url = new WebUrl(url);
     }
     else
     {
         url      = "http:" + url;
         this.url = new WebUrl(url);
     }
     this.description = description;
 }
Ejemplo n.º 13
0
        public VideosGridViewBinding(Video video)
        {
            if (video.preview != null)
            {
                this.Image = video.preview.url;
            }
            this.Viewers = video.views;
            this.Title   = video.title;
            TimeSpan length = TimeSpan.FromSeconds(video.length);

            if (length.Seconds > 10)
            {
                this.Length = length.Minutes.ToString() + ":" + length.Seconds.ToString();
            }
            else
            {
                this.Length = length.Minutes.ToString() + ":0" + length.Seconds.ToString();
            }
            this.Url = video.url;
        }
Ejemplo n.º 14
0
        public JsonResult Edit(WebUrl model)
        {
            var isNew = model.Id <= 0;

            if (isNew)
            {
                model = new WebUrl()
                {
                    ShortUrl = ShortUrl.Core.ShortUrlGenerator.Generator(6)
                }
            }
            ;
            UpdateModel(model);
            if (!model.Url.IsHttpUrl())
            {
                return(Json(new { result = false, msg = "您填写网址格式错误,请重新输入!" }));
            }
            if (string.IsNullOrEmpty(model.Title))
            {
                model.Title = "无标题";
            }
            model.CreationDate = DateTime.Now;
            model.UserId       = CurrentUserId;
            model.UserName     = User.Identity.Name;
            model.BrowerInfo   = BrowserInfo.GetFullUserAgent();
            model.Ip           = IPAddress.IP;
            if (isNew && MongoHelper.Instance.Has(UserIdentityQueryBuilder(Query.EQ("Url", model.Url)), "WebUrl"))
            {
                return(Json(new { result = false, msg = "该网址您已经添加过了,请重新填写一个吧!" }));
            }
            if (MongoHelper.Instance.Save(model))
            {
                var msg = "更新短址信息成功!";
                if (isNew)
                {
                    msg = "新增短址信息成功!";
                }
                return(Json(new { result = true, url = string.Format("/User/Succeed/{0}?msg={1}", model.ShortUrl, msg) }));
            }
            return(Json(new { result = false, msg = "提交短址信息错误,请重试!" }));
        }
Ejemplo n.º 15
0
        public async Task <IActionResult> Create(WebUrlAddCommand webUrlAddCommand)
        {
            ViewBag.Message = null;
            if (ModelState.IsValid)
            {
                if (!webUrlAddCommand.Url.ToFix().UrlChecker())
                {
                    return(RedirectToAction("Create", new { message = URLShortener.Core.Resource.Resource_Fa.UrlIsNotValid }));
                }
                var url = _webUrlService.GetWebUrl(webUrlAddCommand.Url.ToFix());
                if (url != null)
                {
                    return(RedirectToAction("Create", new { message = URLShortener.Core.Resource.Resource_Fa.ThisFaNameIsAllready }));
                }
                ///حلقه تولید لینک کوتاه و بررسی موجود نبودن در دیتا بیس
                string urlshort = string.Empty;
                string isurl    = webUrlAddCommand.Url.ToFix();
                do
                {
                    urlshort = TextHelper.ToShortUrl(5, isurl);
                    isurl    = string.Empty;
                } while (_webUrlService.ExistsUrlShort(urlshort));

                Guid   userId = Guid.Parse(User.FindFirst(ClaimTypes.NameIdentifier).Value);
                WebUrl webUrl = new WebUrl()
                {
                    Id         = Guid.Empty,
                    Url        = webUrlAddCommand.Url.ToFix(),
                    UrlShort   = urlshort,
                    CreateTime = DateTime.Now,
                    ClickCount = 0,
                    UserId     = userId
                };
                _webUrlService.Add(webUrl);
                return(RedirectToAction(nameof(Index)));
            }
            return(View(webUrlAddCommand));
        }
Ejemplo n.º 16
0
        public System.Collections.IEnumerator BuildRecommendQRCode()
        {
            uint nUserID = GameLogicAPI.getPlayerUserID(EntityFactory.MainHeroView.ID);

            if (nUserID == 0)
            {
                Trace.Log("gamepromotion : get player userid failed.");
            }

            string host = null;

            if (!WebUrl.TryGetValue(GameWebUrl.QRCODE_LINK, out host))
            {
                Trace.Log("gamepromotion : not find QR LINK.");
                yield break;
            }
            if (string.IsNullOrEmpty(host))
            {
                Trace.Log("gamepromotion : QR LINK is empty.");
                yield break;
            }

            string url = string.Format("{0}{1}?u={2}&w=256&c=black&b=white&bw=4&bs=4&bc=orange&t=0&l=", Config.QRBuildUrl, host, nUserID);
            WWW    www = new WWW(url);

            yield return(www);

            if (www.error != null)
            {
                Debug.LogWarning(www.error);
                yield break;
            }

            m_RQCode = www.texture;

            UISystem.Instance.SendWndMessage(WndMsgID.WND_MSG_GAME_PROMOTION_SET_QRCODE);
        }
Ejemplo n.º 17
0
        /// <summary>
        /// افزودن لینک
        /// </summary>
        /// <param name="webUrl">مدل اطلاعات لینک</param>

        public void Add(WebUrl webUrl)
        {
            _ctx.WebUrls.Add(webUrl);
            _ctx.SaveChanges();
        }
Ejemplo n.º 18
0
 /// <summary>
 /// افزودن لینک
 /// </summary>
 /// <param name="webUrl">مدل اطلاعات لینک</param>
 public void Add(WebUrl webUrl)
 {
     _webUrlRepository.Add(webUrl);
 }
Ejemplo n.º 19
0
        public void Register()
        {
            Application.Current.Use(new HtmlFromJsonProvider());
            Application.Current.Use(new PartialToStandaloneHtmlProvider());

            Handle.GET("/WebsiteProvider", () =>
            {
                return("Welcome to WebsiteProvider.");
            });

            Handle.GET("/WebsiteProvider/partial/template/{?}", (string templateId) =>
            {
                var page = new WebTemplatePage
                {
                    Data = GetWebTemplate(templateId)
                };
                InitializeTemplate(page);
                return(page);
            });

            Handle.GET("/WebsiteProvider/partial/layout/{?}", (string templateId) =>
            {
                WrapperPage page;

                if (Session.Current != null)
                {
                    page = Session.Current.Data as WrapperPage;
                    var sessionWebTemplate = page?.WebTemplatePage.Data;

                    if (sessionWebTemplate != null)
                    {
                        var webTemplate = GetWebTemplate(templateId);
                        if (sessionWebTemplate.Equals(webTemplate))
                        {
                            return(page);
                        }
                    }
                }
                else
                {
                    Session.Current = new Session(SessionOptions.PatchVersioning);
                }

                page = new WrapperPage
                {
                    Session = Session.Current
                };

                if (page.Session.PublicViewModel != page)
                {
                    page.Session.PublicViewModel = page;
                }

                return(page);
            });

            Handle.GET("/WebsiteProvider/partial/wrapper?uri={?}&response={?}", (string requestUri, string responseKey) =>
            {
                Response currentResponse = ResponseStorage.Get(responseKey);
                WebUrl webUrl            = this.GetWebUrl(requestUri);
                WebTemplate template     = webUrl?.Template;

                if (template == null)
                {
                    throw new Exception("Default template is missing");
                }

                WrapperPage master = GetLayoutPage(template);
                master.IsFinal     = webUrl.IsFinal || string.IsNullOrEmpty(webUrl.Url);

                if (!template.Equals(master.WebTemplatePage.Data))
                {
                    master.WebTemplatePage = GetTemplatePage(template.GetObjectID());
                }

                UpdateTemplateSections(requestUri, currentResponse, master.WebTemplatePage, webUrl);

                return(master);
            });

            RegisterFilter();
        }
Ejemplo n.º 20
0
        /// <summary>
        /// 充值
        /// </summary>
        /// <param name="userid"></param>
        /// <param name="token"></param>
        /// <returns></returns>
        public string GetRecharge(string userid, string token)
        {
            return(WebUrl.CombinePath(string.Format("index.php/home/Payment/index?uid={0}&token={1}", userid, token)));
//            return WebUrl + "/index.php/home/Payment/index?uid=" + userid + "&token=" + tokend;
        }
Ejemplo n.º 21
0
        public void GenerateHolyGrailSurface()
        {
            var surface = new WebTemplate()
            {
                Name = "HolyGrailTemplate",
                Html = "/Website/templates/HolyGrailTemplate.html"
            };

            var content = new WebSection()
            {
                Template = surface,
                Name     = "Content",
                Default  = true
            };

            var header = new WebSection()
            {
                Template = surface,
                Name     = "Header",
                Default  = false
            };

            var left = new WebSection()
            {
                Template = surface,
                Name     = "Left",
                Default  = false
            };

            var right = new WebSection()
            {
                Template = surface,
                Name     = "Right",
                Default  = false
            };

            var footer = new WebSection()
            {
                Template = surface,
                Name     = "Footer",
                Default  = false
            };

            var homeUrl = new WebUrl()
            {
                Template = surface,
                Url      = "/content/dynamic/apps",
                IsFinal  = true
            };

            var appsUrl = new WebUrl()
            {
                Template = surface,
                Url      = "/content/dynamic/apps/wanted-apps",
                IsFinal  = true
            };

            var profileUrl = new WebUrl()
            {
                Template = surface,
                Url      = "/content/dynamic/userprofile",
                IsFinal  = true
            };

            new WebMap()
            {
                Section = header, ForeignUrl = "/signin/user", SortNumber = 1
            };
            new WebMap()
            {
                Section = header, ForeignUrl = "/content/dynamic/navigation", SortNumber = 2,
            };
            new WebMap()
            {
                Url = homeUrl, Section = header, ForeignUrl = "/content/dynamic/index/header", SortNumber = 3
            };
            new WebMap()
            {
                Url = homeUrl, Section = header, ForeignUrl = "/signin/signinuser", SortNumber = 4
            };
            new WebMap()
            {
                Url = homeUrl, Section = header, ForeignUrl = "/registration", SortNumber = 5
            };
            new WebMap()
            {
                Url = homeUrl, Section = header, ForeignUrl = "/content/dynamic/index/registration", SortNumber = 6
            };

            new WebMap()
            {
                Url = homeUrl, Section = left, ForeignUrl = "/content/dynamic/index/left", SortNumber = 1
            };

            new WebMap()
            {
                Url = homeUrl, Section = right, ForeignUrl = "/content/dynamic/index/right", SortNumber = 1
            };

            new WebMap()
            {
                Url = homeUrl, Section = footer, ForeignUrl = "/content/dynamic/index/footer", SortNumber = 1
            };

            new WebMap()
            {
                Url = appsUrl, Section = header, ForeignUrl = "/content/dynamic/apps/header", SortNumber = 1
            };
            new WebMap()
            {
                Url = appsUrl, Section = header, ForeignUrl = "/content/dynamic/apps/footer", SortNumber = 2
            };

            new WebMap()
            {
                Url = profileUrl, Section = header, ForeignUrl = "/content/dynamic/userprofile/header", SortNumber = 1
            };
            new WebMap()
            {
                Url = profileUrl, Section = content, ForeignUrl = "/userprofile", SortNumber = 2
            };
            new WebMap()
            {
                Url = profileUrl, Section = footer, ForeignUrl = "/content/dynamic/userprofile/footer", SortNumber = 3
            };
        }
Ejemplo n.º 22
0
 public static string GetMappingUrl(this WebSection webSection, WebUrl webUrl = null)
 {
     return(string.IsNullOrWhiteSpace(webUrl?.Url)
         ? $"/website/blender/surface/{webSection.Template.Key}/point/{webSection.Key}"
         : $"/website/blender/surface/{webSection.Template.Key}/point/{webSection.Key}/uri/{webUrl.Key}");
 }
Ejemplo n.º 23
0
 public static bool IsWebUrl(this string text)
 {
     return(WebUrl.IsMatch(text));
 }
Ejemplo n.º 24
0
 public static string GetMappingToken(this WebSection webSection, WebUrl webUrl = null)
 {
     return(webUrl == null
         ? $"website%{webSection.Template.Key}%{webSection.Key}"
         : $"website%{webSection.Template.Key}%{webSection.Key}%{webUrl.Key}");
 }
Ejemplo n.º 25
0
        protected void UpdateTemplateSections(string requestUri, Response response, WebTemplatePage content, WebUrl url)
        {
            foreach (WebSection section in content.Data.Sections)
            {
                var sectionJson = (SectionPage)content.Sections[section.Name];

                var uri = section.GetMappingUrl(url);
                sectionJson.PinContent = Self.GET(uri);

                var json = response.Resource as Json;
                if (section.Default && json != null && sectionJson.MainContent?.RequestUri != requestUri)
                {
                    if (json is WrapperPage)
                    {
                        //we are inserting WebsiteProvider to WebsiteProvider
                        sectionJson.MainContent = json as WrapperPage;
                    }
                    else
                    {
                        //we are inserting different app to WebsiteProvider
                        var page = sectionJson.MainContent;
                        if (page == null || page.WebTemplatePage.Data != null)
                        {
                            page = GetContainerPage(requestUri);
                            sectionJson.MainContent = page;
                        }

                        page.RequestUri = requestUri;
                        page.Reset();
                        page.MergeJson(json);
                    }
                }
            }
        }