private async Task <string> Process_V3(string content_username, long contentid, string reason, int type, int mediatype)
        {
            if (HttpContext.User.Identity.IsAuthenticated)
            {
                string sign_in = "<a href=\"" + Config.GetUrl() + "Login.aspx\" class=\"bold\">Sign In</a>";
                string sign_up = "<a href=\"" + Config.GetUrl() + "Register.aspx\" class=\"bold\">Sign Up</a>";
                return(sign_in + " or " + sign_up + " to post report!");
            }
            var info     = SiteConfig.userManager.GetUserAsync(User).Result;
            var userName = info.UserName;

            if (content_username == userName)
            {
                return(SiteConfig.generalLocalizer["_abuse_msg_01"].Value); // You can't post abuse / spam report on your own content.
            }

            if (await AbuseReport.Check_UserName(_context, userName, contentid, type))
            {
                return(SiteConfig.generalLocalizer["_abuse_msg_02"].Value); // "You already post abuse / spam report on this content.";
            }

            //***********************************
            // ENABLE comment if you want to validate report based on ip address
            //***********************************
            string ipaddress = Request.HttpContext.Connection.RemoteIpAddress.ToString();

            if (await AbuseReport.Check_IPAddress(_context, ipaddress, contentid, type))
            {
                return(SiteConfig.generalLocalizer["_abuse_msg_03"].Value); //	Report already posted from this IP address.
            }

            await AbuseReport.Add(_context, contentid, userName, ipaddress, reason, type);

            int count_reports = await AbuseReport.Count(_context, contentid, type);

            if (count_reports > Jugnoon.Settings.Configs.GeneralSettings.spam_count)
            {
                int OldValue = 0;
                switch (type)
                {
                case 0:
                    // disable video
                    VideoBLL.Update_Field_V3(_context, contentid, (byte)0, "isenabled");
                    OldValue = Convert.ToInt32(VideoBLL.Get_Field_Value(_context, contentid, "isenabled"));
                    break;
                }
            }
            return(SiteConfig.generalLocalizer["_abuse_msg_04"].Value);
        }
Example #2
0
        public async Task <ActionResult> load()
        {
            var json   = new StreamReader(Request.Body).ReadToEnd();
            var data   = JsonConvert.DeserializeObject <AbuseEntity>(json);
            var _posts = await AbuseReport.LoadItems(_context, data);

            var _records = 0;

            if (data.id == 0)
            {
                _records = await AbuseReport.Count(_context, data);
            }

            return(Ok(new { posts = _posts, records = _records }));
        }