public string SavePluginSinglePageData(HttpContext context) { try { var objCtrl = new NBrightBuyController(); //get uploaded params var ajaxInfo = NBrightBuyUtils.GetAjaxFields(context); var lang = NBrightBuyUtils.SetContextLangauge(ajaxInfo); // Ajax breaks context with DNN, so reset the context language to match the client. var editlang = NBrightBuyUtils.GetEditLang(ajaxInfo); var itemid = ajaxInfo.GetXmlProperty("genxml/hidden/itemid"); if (Utils.IsNumeric(itemid)) { var nbi = objCtrl.Get(Convert.ToInt32(itemid)); if (nbi != null) { // get data passed back by ajax var strIn = HttpUtility.UrlDecode(Utils.RequestParam(context, "inputxml")); // update record with ajax data nbi.UpdateAjax(strIn); objCtrl.Update(nbi); // do langauge record var nbi2 = objCtrl.GetDataLang(Convert.ToInt32(itemid), editlang); nbi2.UpdateAjax(strIn); objCtrl.Update(nbi2); } DataCache.ClearCache(); // clear ALL cache. } return(""); } catch (Exception e) { return(e.ToString()); } }
public string ProcessCommand(string paramCmd, HttpContext context, string editlang = "") { var strOut = "CATEGORY - ERROR!! - No Security rights or function command."; var ajaxInfo = NBrightBuyUtils.GetAjaxFields(context); EntityTypeCode = ajaxInfo.GetXmlProperty("genxml/hidden/entitytypecode"); if (EntityTypeCode == "") { EntityTypeCode = "CATEGORY"; // default to category } EditLangCurrent = NBrightBuyUtils.GetEditLang(ajaxInfo, Utils.GetCurrentCulture()); if (!paramCmd.ToLower().Contains("save")) { // pickup nextlang, indicates if we are changing languages. (Don't use if saving data, only for getting next language.) EditLangCurrent = NBrightBuyUtils.GetNextLang(ajaxInfo, EditLangCurrent); } if (PluginUtils.CheckPluginSecurity(PortalSettings.Current.PortalId, "categories")) { switch (paramCmd) { case "category_admin_getlist": strOut = CategoryAdminList(context, "", EditLangCurrent); break; case "category_admin_getdetail": strOut = CategoryAdminDetail(context, 0, EditLangCurrent); break; case "category_admin_addnew": strOut = CategoryAdminAddNew(context); break; case "category_admin_savelist": strOut = CategoryAdminSaveList(context); break; case "category_admin_save": strOut = CategorySave(context, EditLangCurrent); break; case "category_admin_saveexit": strOut = CategorySave(context, EditLangCurrent); break; case "category_admin_movecategory": strOut = MoveCategoryAdmin(context); break; case "category_admin_delete": strOut = DeleteCategory(context); break; case "category_updateimages": strOut = UpdateCategoryImages(context, EditLangCurrent); break; case "category_getproductselectlist": var productFunctions = new ProductFunctions(); strOut = productFunctions.ProductAdminList(context, true, EditLangCurrent, "", true); break; case "category_selectchangehidden": strOut = CategoryHidden(context); break; case "category_selectcatxref": strOut = SelectCatXref(context, EditLangCurrent); break; case "category_deletecatxref": strOut = DeleteCatXref(context); break; case "category_deleteallcatxref": strOut = DeleteAllCatXref(context, EditLangCurrent); break; case "category_copyallcatxref": strOut = CopyAllCatXref(context); break; case "category_moveallcatxref": strOut = CopyAllCatXref(context, true); break; case "category_cattaxupdate": strOut = CatTaxUpdate(context, EditLangCurrent); break; case "category_addgroupfilter": strOut = AddGroupFilter(context, EditLangCurrent); break; case "category_removegroupfilter": strOut = RemoveGroupFilter(context, EditLangCurrent); break; case "category_categorygroupfilter": strOut = CategoryGroupFilters(context, EditLangCurrent); break; } } switch (paramCmd) { case "category_categoryproductlist": strOut = GetCategoryProductList(context, EditLangCurrent); break; case "category_removeimage": strOut = RemoveCategoryImage(context, EditLangCurrent); break; case "category_displayproductselect": strOut = CategoryProductSelect(context, EditLangCurrent); break; } return(strOut); }
public void ProcessRequest(HttpContext context) { #region "Initialize" var strOut = "** No Action **"; var paramCmd = Utils.RequestQueryStringParam(context, "cmd"); var itemId = Utils.RequestQueryStringParam(context, "itemid"); var ctlType = Utils.RequestQueryStringParam(context, "ctltype"); var idXref = Utils.RequestQueryStringParam(context, "idxref"); var xpathpdf = Utils.RequestQueryStringParam(context, "pdf"); var xpathref = Utils.RequestQueryStringParam(context, "pdfref"); var lang = Utils.RequestQueryStringParam(context, "lang"); var language = Utils.RequestQueryStringParam(context, "language"); var moduleId = Utils.RequestQueryStringParam(context, "mid"); var moduleKey = Utils.RequestQueryStringParam(context, "mkey"); var parentid = Utils.RequestQueryStringParam(context, "parentid"); var entryid = Utils.RequestQueryStringParam(context, "entryid"); var entryxid = Utils.RequestQueryStringParam(context, "entryxid"); var catid = Utils.RequestQueryStringParam(context, "catid"); var catxid = Utils.RequestQueryStringParam(context, "catxid"); var templatePrefix = Utils.RequestQueryStringParam(context, "tprefix"); var value = Utils.RequestQueryStringParam(context, "value"); var itemListName = Utils.RequestQueryStringParam(context, "listname"); if (itemListName == "") { itemListName = "ItemList"; } if (itemListName == "*") { itemListName = "ItemList"; } #region "setup language" // because we are using a webservice the system current thread culture might not be set correctly, NBrightBuyUtils.SetContextLangauge(context); var ajaxInfo = NBrightBuyUtils.GetAjaxFields(context); _editlang = NBrightBuyUtils.GetEditLang(ajaxInfo, Utils.GetCurrentCulture()); #endregion Logging.Debug($"XmlConnector called with: paramCmd='{paramCmd}', itemId='{itemId}', itemListName='{itemListName}'"); #endregion try { #region "Do processing of command" if (paramCmd.StartsWith("client.")) { strOut = ClientFunctions.ProcessCommand(paramCmd, context); } else if (paramCmd.StartsWith("orderadmin_")) { strOut = OrderFunctions.ProcessCommand(paramCmd, context); } else if (paramCmd.StartsWith("payment_")) { strOut = PaymentFunctions.ProcessCommand(paramCmd, context); } else if (paramCmd.StartsWith("product_")) { var productFunctions = new ProductFunctions(); strOut = productFunctions.ProcessCommand(paramCmd, context, _editlang); } else if (paramCmd.StartsWith("category_")) { var categoryFunctions = new CategoryFunctions(); strOut = categoryFunctions.ProcessCommand(paramCmd, context, _editlang); } else if (paramCmd.StartsWith("property_")) { var propertyFunctions = new PropertyFunctions(); strOut = propertyFunctions.ProcessCommand(paramCmd, context, _editlang); } else if (paramCmd.StartsWith("itemlist_")) { strOut = ItemListsFunctions.ProcessCommand(paramCmd, context); } else if (paramCmd.StartsWith("addressadmin_")) { strOut = AddressAdminFunctions.ProcessCommand(paramCmd, context); } else if (paramCmd.StartsWith("plugins_")) { strOut = PluginFunctions.ProcessCommand(paramCmd, context); } else if (paramCmd.StartsWith("cart_")) { strOut = CartFunctions.ProcessCommand(paramCmd, context); } else { switch (paramCmd) { case "test": strOut = "<root>" + UserController.Instance.GetCurrentUserInfo().Username + "</root>"; break; case "setdata": break; case "deldata": break; case "getdata": strOut = GetReturnData(context); break; case "fileupload": if (NBrightBuyUtils.CheckRights()) { strOut = FileUpload(context); } break; case "fileclientupload": if (StoreSettings.Current.GetBool("allowupload")) { strOut = FileUpload(context, itemId); } break; case "docdownload": strOut = DownloadSystemFile(paramCmd, context); break; case "printproduct": break; case "renderpostdata": strOut = RenderPostData(context); break; case "getsettings": strOut = GetSettings(context); break; case "savesettings": if (NBrightBuyUtils.CheckRights()) { strOut = SaveSettings(context); } break; case "updateprofile": strOut = UpdateProfile(context); break; case "dosearch": strOut = DoSearch(context); break; case "resetsearch": strOut = ResetSearch(context); break; case "orderby": strOut = DoOrderBy(context); break; case "renderthemefolders": strOut = RenderThemeFolders(context); break; } } if (strOut == "** No Action **") { var ajaxprovider = ajaxInfo.GetXmlProperty("genxml/hidden/ajaxprovider"); if (ajaxprovider == "") { ajaxprovider = Utils.RequestQueryStringParam(context, "ajaxprovider"); } var pluginData = new PluginData(PortalSettings.Current.PortalId); var provList = pluginData.GetAjaxProviders(); if (ajaxprovider != "") { strOut = "Ajax Provider not found: " + ajaxprovider; if (provList.ContainsKey(ajaxprovider)) { var ajaxprov = AjaxInterface.Instance(ajaxprovider); if (ajaxprov != null) { strOut = ajaxprov.ProcessCommand(paramCmd, context, _editlang); } } } else { foreach (var d in provList) { if (paramCmd.ToLower().StartsWith(d.Key.ToLower() + "_") || paramCmd.ToLower().StartsWith("cmd" + d.Key.ToLower() + "_")) { var ajaxprov = AjaxInterface.Instance(d.Key); if (ajaxprov != null) { strOut = ajaxprov.ProcessCommand(paramCmd, context, _editlang); } } } } } #endregion } catch (Exception ex) { strOut = ex.ToString(); Logging.LogException(ex); //Exceptions.LogException(ex); } #region "return results" //send back xml as plain text context.Response.Clear(); context.Response.ContentType = "text/plain"; context.Response.Write(strOut); context.Response.End(); #endregion }
public void ProcessRequest(HttpContext context) { #region "Initialize" var strOut = "** No Action **"; var paramCmd = Utils.RequestQueryStringParam(context, "cmd"); var itemId = Utils.RequestQueryStringParam(context, "itemid"); var ctlType = Utils.RequestQueryStringParam(context, "ctltype"); var idXref = Utils.RequestQueryStringParam(context, "idxref"); var xpathpdf = Utils.RequestQueryStringParam(context, "pdf"); var xpathref = Utils.RequestQueryStringParam(context, "pdfref"); var lang = Utils.RequestQueryStringParam(context, "lang"); var language = Utils.RequestQueryStringParam(context, "language"); var moduleId = Utils.RequestQueryStringParam(context, "mid"); var moduleKey = Utils.RequestQueryStringParam(context, "mkey"); var parentid = Utils.RequestQueryStringParam(context, "parentid"); var entryid = Utils.RequestQueryStringParam(context, "entryid"); var entryxid = Utils.RequestQueryStringParam(context, "entryxid"); var catid = Utils.RequestQueryStringParam(context, "catid"); var catxid = Utils.RequestQueryStringParam(context, "catxid"); var templatePrefix = Utils.RequestQueryStringParam(context, "tprefix"); var value = Utils.RequestQueryStringParam(context, "value"); var itemListName = Utils.RequestQueryStringParam(context, "listname"); if (itemListName == "") { itemListName = "ItemList"; } if (itemListName == "*") { itemListName = "ItemList"; } #region "setup language" // because we are using a webservice the system current thread culture might not be set correctly, _uilang = NBrightBuyUtils.SetContextLangauge(context); var ajaxInfo = NBrightBuyUtils.GetAjaxFields(context); _editlang = NBrightBuyUtils.GetEditLang(ajaxInfo, _uilang); #endregion Logging.Debug($"XmlConnector called with: paramCmd='{paramCmd}', itemId='{itemId}', itemListName='{itemListName}'"); #endregion try { #region "Do processing of command" if (paramCmd.StartsWith("client.")) { strOut = ClientFunctions.ProcessCommand(paramCmd, context); } else if (paramCmd.StartsWith("orderadmin_")) { strOut = OrderFunctions.ProcessCommand(paramCmd, context); } else if (paramCmd.StartsWith("payment_")) { strOut = PaymentFunctions.ProcessCommand(paramCmd, context); } else if (paramCmd.StartsWith("product_")) { ProductFunctions.EntityTypeCode = "PRD"; strOut = ProductFunctions.ProcessCommand(paramCmd, context, _editlang); } else if (paramCmd.StartsWith("category_")) { CategoryFunctions.EntityTypeCode = "CATEGORY"; strOut = CategoryFunctions.ProcessCommand(paramCmd, context, _editlang); } else if (paramCmd.StartsWith("property_")) { PropertyFunctions.EntityTypeCode = "CATEGORY"; strOut = PropertyFunctions.ProcessCommand(paramCmd, context, _editlang); } else if (paramCmd.StartsWith("itemlist_")) { strOut = ItemListsFunctions.ProcessCommand(paramCmd, context); } else if (paramCmd.StartsWith("addressadmin_")) { strOut = AddressAdminFunctions.ProcessCommand(paramCmd, context); } else if (paramCmd.StartsWith("plugins_")) { strOut = PluginFunctions.ProcessCommand(paramCmd, context); } else if (paramCmd.StartsWith("cart_")) { strOut = CartFunctions.ProcessCommand(paramCmd, context); } else { switch (paramCmd) { case "test": strOut = "<root>" + UserController.Instance.GetCurrentUserInfo().Username + "</root>"; break; case "setdata": break; case "deldata": break; case "getdata": strOut = GetReturnData(context); break; case "fileupload": if (NBrightBuyUtils.CheckRights()) { strOut = FileUpload(context); } break; case "fileclientupload": if (StoreSettings.Current.GetBool("allowupload")) { strOut = FileUpload(context, itemId); } break; case "docdownload": var fname = Utils.RequestQueryStringParam(context, "filename"); var filekey = Utils.RequestQueryStringParam(context, "key"); if (filekey != "") { var uData = new UserData(); if (uData.HasPurchasedDocByKey(filekey)) { fname = uData.GetPurchasedFileName(filekey); } fname = StoreSettings.Current.FolderDocuments + "/" + fname; } if (fname != "") { strOut = fname; // return this is error. var downloadname = Utils.RequestQueryStringParam(context, "downloadname"); var fpath = HttpContext.Current.Server.MapPath(fname); if (downloadname == "") { downloadname = Path.GetFileName(fname); } try { Utils.ForceDocDownload(fpath, downloadname, context.Response); } catch (Exception ex) { // ignore, robots can cause error on thread abort. //Exceptions.LogException(ex); Logging.Debug($"XmlConnector.ProcessRequest exception for {paramCmd} which is ignored because bots tend to cause these on thread abort: {ex.Message}."); } } break; case "printproduct": break; case "renderpostdata": strOut = RenderPostData(context); break; case "getsettings": strOut = GetSettings(context); break; case "savesettings": if (NBrightBuyUtils.CheckRights()) { strOut = SaveSettings(context); } break; case "updateprofile": strOut = UpdateProfile(context); break; case "dosearch": strOut = DoSearch(context); break; case "resetsearch": strOut = ResetSearch(context); break; case "orderby": strOut = DoOrderBy(context); break; case "renderthemefolders": strOut = RenderThemeFolders(context); break; } } if (strOut == "** No Action **") { var pluginData = new PluginData(PortalSettings.Current.PortalId); var provList = pluginData.GetAjaxProviders(); foreach (var d in provList) { if (paramCmd.ToLower().StartsWith(d.Key.ToLower() + "_") || paramCmd.ToLower().StartsWith("cmd" + d.Key.ToLower() + "_")) { var ajaxprov = AjaxInterface.Instance(d.Key); if (ajaxprov != null) { strOut = ajaxprov.ProcessCommand(paramCmd, context, _editlang); } } } } #endregion } catch (Exception ex) { strOut = ex.ToString(); Logging.LogException(ex); //Exceptions.LogException(ex); } #region "return results" //send back xml as plain text context.Response.Clear(); context.Response.ContentType = "text/plain"; context.Response.Write(strOut); context.Response.End(); #endregion }
public static string ProcessCommand(string paramCmd, HttpContext context, string editlang = "") { var strOut = "PROPERTY - ERROR!! - No Security rights or function command."; var ajaxInfo = NBrightBuyUtils.GetAjaxFields(context); UiLang = ajaxInfo.GetXmlProperty("genxml/hidden/uilang"); if (UiLang == "") { UiLang = EditLangCurrent; } var userId = ajaxInfo.GetXmlPropertyInt("genxml/hidden/userid"); EntityTypeCode = ajaxInfo.GetXmlProperty("genxml/hidden/entitytypecode"); if (EntityTypeCode == "") { EntityTypeCode = "CAT"; // default to category } UiLang = NBrightBuyUtils.GetUILang(ajaxInfo); EditLangCurrent = editlang; if (EditLangCurrent == "") { EditLangCurrent = NBrightBuyUtils.GetEditLang(ajaxInfo); } if (!paramCmd.ToLower().Contains("save")) { // pickup nextlang, indicates if we are changing languages. (Don't use if saving data, only for getting next language.) EditLangCurrent = NBrightBuyUtils.GetNextLang(ajaxInfo, EditLangCurrent); } switch (paramCmd) { case "property_admin_getlist": if (!NBrightBuyUtils.CheckManagerRights()) { break; } strOut = CategoryFunctions.CategoryAdminList(context, "property", EditLangCurrent); break; case "property_admin_getdetail": if (!NBrightBuyUtils.CheckManagerRights()) { break; } strOut = CategoryFunctions.CategoryAdminDetail(context, 0, EditLangCurrent); break; case "property_admin_addnew": if (!NBrightBuyUtils.CheckManagerRights()) { break; } strOut = CategoryFunctions.CategoryAdminAddNew(context, "property"); break; case "property_admin_savelist": if (!NBrightBuyUtils.CheckManagerRights()) { break; } strOut = CategoryFunctions.CategoryAdminSaveList(context); break; case "property_admin_save": if (!NBrightBuyUtils.CheckManagerRights()) { break; } strOut = CategoryFunctions.CategorySave(context, EditLangCurrent); break; case "property_admin_saveexit": if (!NBrightBuyUtils.CheckManagerRights()) { break; } strOut = CategoryFunctions.CategorySave(context, EditLangCurrent); break; case "property_admin_movecategory": if (!NBrightBuyUtils.CheckManagerRights()) { break; } strOut = CategoryFunctions.MoveCategoryAdmin(context, "property"); break; case "property_admin_delete": if (!NBrightBuyUtils.CheckManagerRights()) { break; } strOut = CategoryFunctions.DeleteCategory(context, "property"); break; case "property_updateimages": if (!NBrightBuyUtils.CheckManagerRights()) { break; } strOut = CategoryFunctions.UpdateCategoryImages(context, EditLangCurrent); break; case "property_getproductselectlist": if (!NBrightBuyUtils.CheckManagerRights()) { break; } strOut = ProductFunctions.ProductAdminList(context, true, EditLangCurrent, "", true); break; case "property_selectchangehidden": if (!NBrightBuyUtils.CheckManagerRights()) { break; } strOut = CategoryFunctions.CategoryHidden(context); break; case "property_categoryproductlist": strOut = CategoryFunctions.GetCategoryProductList(context, EditLangCurrent); break; case "property_removeimage": strOut = CategoryFunctions.RemoveCategoryImage(context, EditLangCurrent); break; case "property_displayproductselect": strOut = CategoryFunctions.CategoryProductSelect(context, EditLangCurrent); break; case "property_selectcatxref": if (NBrightBuyUtils.CheckRights()) { strOut = CategoryFunctions.SelectCatXref(context, EditLangCurrent); } break; case "property_deletecatxref": if (NBrightBuyUtils.CheckRights()) { strOut = CategoryFunctions.DeleteCatXref(context); } break; case "property_deleteallcatxref": if (NBrightBuyUtils.CheckRights()) { strOut = CategoryFunctions.DeleteAllCatXref(context, EditLangCurrent); } break; } return(strOut); }