public static bool ChangePriority(int priority, string ext) { if (!WebUtils.CheckRightsForAdminSettingsPage(false)) { return(false); } if (!WebUtils.CheckIfPrimaryBlog(false)) { return(false); } try { var x = ExtensionManager.GetExtension(ext); if (x != null) { x.Priority = priority; ExtensionManager.SaveToStorage(x); return(true); } } catch (Exception ex) { Utils.Log("Error changing priority: " + ex.Message); } return(false); }
public static JsonResponse UninstallPackage(string pkgId) { if (!WebUtils.CheckRightsForAdminSettingsPage(false)) { return(null); } if (!WebUtils.CheckIfPrimaryBlog(false)) { return(null); } return(Installer.UninstallPackage(pkgId)); }
public static IEnumerable LoadGalleryPager() { if (!WebUtils.CheckRightsForAdminSettingsPage(false)) { return(null); } if (!WebUtils.CheckIfPrimaryBlog(false)) { return(null); } return(Gallery.GalleryPager == null ? null : Gallery.GalleryPager.PageItems); }
public static IEnumerable LoadGalleryPage(string pkgType, int page, Gallery.OrderType sortOrder, string searchVal) { if (!WebUtils.CheckRightsForAdminSettingsPage(false)) { return(null); } if (!WebUtils.CheckIfPrimaryBlog(false)) { return(null); } return(PackageRepository.FromGallery(pkgType, page, sortOrder, searchVal)); }
public static string LoadBlogsPager(int page, int pageSize, string type) { if (!WebUtils.CheckRightsForAdminPostPages(false)) { return(null); } if (!WebUtils.CheckIfPrimaryBlog(false)) { return(null); } return(JsonBlogs.GetPager(page, pageSize)); }
public static IEnumerable LoadBlogs(int page, int pageSize) { if (!WebUtils.CheckRightsForAdminPostPages(false)) { return(null); } if (!WebUtils.CheckIfPrimaryBlog(false)) { return(null); } return(JsonBlogs.GetBlogs(page, pageSize)); }
public static IEnumerable LoadGalleryPage(string pkgType, int page, PackageManager.OrderType sortOrder, string searchVal) { if (!WebUtils.CheckRightsForAdminSettingsPage(false)) { return(null); } if (!WebUtils.CheckIfPrimaryBlog(false)) { return(null); } return(JsonPackages.GetPage(pkgType, page, sortOrder, searchVal)); }
public static JsonResponse <IEnumerable <KeyValuePair <string, string> > > GetCopyFromBlogs() { if (!WebUtils.CheckRightsForAdminPostPages(false)) { return(null); } if (!WebUtils.CheckIfPrimaryBlog(false)) { return(null); } return(new JsonResponse <IEnumerable <KeyValuePair <string, string> > >() { Success = true, Data = Blog.Blogs.Select(b => new KeyValuePair <string, string>(b.Id.ToString(), b.Name)) }); }
public static IEnumerable LoadGetttyImagesClient(string custId) { if (!WebUtils.CheckRightsForAdminPostPages(false)) { return(null); } if (!WebUtils.CheckIfPrimaryBlog(false)) { return(null); } var gettyImages = new GettyImages(); var userId = gettyImages.GetUserIdByEmail(Security.CurrentMembershipUser.Email); var imageResults = gettyImages.LoadGetttyImagesClient(userId); return(imageResults); }
public static bool UpdateExtensionSourceCode(string sourceCode, string extensionName) { if (!WebUtils.CheckRightsForAdminSettingsPage(false)) { return(false); } if (!WebUtils.CheckIfPrimaryBlog(false)) { return(false); } if (string.IsNullOrWhiteSpace(extensionName)) { return(false); } var ext = ExtensionManager.GetExtension(extensionName); if (ext == null) { return(false); } string extensionFilename = ext.GetPathAndFilename(true); if (string.IsNullOrWhiteSpace(extensionFilename)) { return(false); } try { using (var f = File.CreateText(extensionFilename)) { f.Write(sourceCode); f.Close(); return(true); } } catch (Exception ex) { Utils.Log("Error saving source code: " + ex.Message); return(false); } }
public static IEnumerable LoadGetttyImages(string key) { var gettyImages = new GettyImages(); if (string.IsNullOrEmpty(key)) { return(new List <GettyImage>()); } if (!WebUtils.CheckRightsForAdminPostPages(false)) { return(null); } if (!WebUtils.CheckIfPrimaryBlog(false)) { return(null); } //Get 50 images from getty images by API var imageResults = gettyImages.GetGettyImages(key); return(imageResults); }
public static JsonResponse <JsonBlog> GetBlog(string blogId) { if (!WebUtils.CheckRightsForAdminPostPages(false)) { return(null); } if (!WebUtils.CheckIfPrimaryBlog(false)) { return(null); } if (string.IsNullOrWhiteSpace(blogId) || blogId.Length != 36) { return(new JsonResponse <JsonBlog>() { Success = false, Message = "Blog not found." }); } Blog blog = Blog.GetBlog(new Guid(blogId)); if (blog == null) { return(new JsonResponse <JsonBlog>() { Success = false, Message = "Blog not found." }); } return(new JsonResponse <JsonBlog>() { Success = true, Data = JsonBlogs.CreateJsonBlog(blog) }); }