public IHttpActionResult Main() { try { var request = new AuthenticatedRequest(); var dynamicInfo = DynamicInfo.GetDynamicInfo(request, request.UserInfo); var ifInfo = TranslateUtils.JsonDeserialize <DynamicInfo.IfInfo>(dynamicInfo.ElementValues); var isSuccess = false; var html = string.Empty; if (ifInfo != null) { if (StringUtils.EqualsIgnoreCase(ifInfo.Type, StlIf.TypeIsUserLoggin)) { isSuccess = request.IsUserLoggin; } else if (StringUtils.EqualsIgnoreCase(ifInfo.Type, StlIf.TypeIsAdministratorLoggin)) { isSuccess = request.IsAdminLoggin; } else if (StringUtils.EqualsIgnoreCase(ifInfo.Type, StlIf.TypeIsUserOrAdministratorLoggin)) { isSuccess = request.IsUserLoggin || request.IsAdminLoggin; } else if (StringUtils.EqualsIgnoreCase(ifInfo.Type, StlIf.TypeIsUserGroup)) { if (request.IsUserLoggin) { var group = UserGroupManager.GetUserGroupInfo(request.UserInfo.GroupId); if (StringUtils.EqualsIgnoreCase(ifInfo.Op, StlIf.OperateNotEquals)) { isSuccess = !StringUtils.EqualsIgnoreCase(group.GroupName, ifInfo.Value); } else { isSuccess = StringUtils.EqualsIgnoreCase(group.GroupName, ifInfo.Value); } } } var template = isSuccess ? dynamicInfo.SuccessTemplate : dynamicInfo.FailureTemplate; html = StlDynamic.ParseDynamicContent(dynamicInfo, template); } return(Ok(new { Value = isSuccess, Html = html })); } catch (Exception ex) { return(InternalServerError(ex)); } }
public IHttpActionResult Main() { try { var request = new AuthenticatedRequest(); var siteId = request.GetPostInt("siteId"); var pageChannelId = request.GetPostInt("pageChannelId"); if (pageChannelId == 0) { pageChannelId = siteId; } var pageContentId = request.GetPostInt("pageContentId"); var pageTemplateId = request.GetPostInt("pageTemplateId"); var isPageRefresh = request.GetPostBool("isPageRefresh"); var templateContent = TranslateUtils.DecryptStringBySecretKey(request.GetPostString("templateContent")); var ajaxDivId = AttackUtils.FilterSqlAndXss(request.GetPostString("ajaxDivId")); var channelId = request.GetPostInt("channelId"); if (channelId == 0) { channelId = pageChannelId; } var contentId = request.GetPostInt("contentId"); if (contentId == 0) { contentId = pageContentId; } var pageUrl = TranslateUtils.DecryptStringBySecretKey(request.GetPostString("pageUrl")); var pageIndex = request.GetPostInt("pageNum"); if (pageIndex > 0) { pageIndex--; } var queryString = PageUtils.GetQueryStringFilterXss(PageUtils.UrlDecode(HttpContext.Current.Request.RawUrl)); queryString.Remove("siteId"); return(Ok(new { Html = StlDynamic.ParseDynamicContent(siteId, channelId, contentId, pageTemplateId, isPageRefresh, templateContent, pageUrl, pageIndex, ajaxDivId, queryString, request.UserInfo) })); } catch (Exception ex) { return(InternalServerError(ex)); } }
public IHttpActionResult Main() { try { var request = new AuthenticatedRequest(); var dynamicInfo = DynamicInfo.GetDynamicInfo(request, request.UserInfo); return(Ok(new { Value = true, Html = StlDynamic.ParseDynamicContent(dynamicInfo, dynamicInfo.SuccessTemplate) })); } catch (Exception ex) { return(InternalServerError(ex)); } }
public IHttpActionResult Main() { try { var request = new AuthRequest(); var siteId = request.GetPostInt("siteId"); var channelId = request.GetPostInt("channelId"); var contentId = request.GetPostInt("contentId"); var templateId = request.GetPostInt("templateId"); var ajaxDivId = AttackUtils.FilterSqlAndXss(request.GetPostString("ajaxDivId")); var pageUrl = TranslateUtils.DecryptStringBySecretKey(request.GetPostString("pageUrl")); var testType = AttackUtils.FilterSqlAndXss(request.GetPostString("testType")); //var testValue = PageUtils.FilterSqlAndXss(request.GetPostString("testValue")); //var testOperate = PageUtils.FilterSqlAndXss(request.GetPostString("testOperate")); var successTemplate = TranslateUtils.DecryptStringBySecretKey(request.GetPostString("successTemplate")); var failureTemplate = TranslateUtils.DecryptStringBySecretKey(request.GetPostString("failureTemplate")); var isSuccess = false; if (StringUtils.EqualsIgnoreCase(testType, StlIf.TypeIsUserLoggin)) { isSuccess = request.IsUserLoggin; } else if (StringUtils.EqualsIgnoreCase(testType, StlIf.TypeIsAdministratorLoggin)) { isSuccess = request.IsAdminLoggin; } else if (StringUtils.EqualsIgnoreCase(testType, StlIf.TypeIsUserOrAdministratorLoggin)) { isSuccess = request.IsUserLoggin || request.IsAdminLoggin; } return(Ok(new { Html = StlDynamic.ParseDynamicContent(siteId, channelId, contentId, templateId, false, isSuccess ? successTemplate : failureTemplate, pageUrl, 0, ajaxDivId, null, request.UserInfo) })); } catch (Exception ex) { return(InternalServerError(ex)); } }