Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        public static JsonResponse UninstallPackage(string pkgId)
        {
            if (!WebUtils.CheckRightsForAdminSettingsPage(false))
            {
                return(null);
            }
            if (!WebUtils.CheckIfPrimaryBlog(false))
            {
                return(null);
            }

            return(Installer.UninstallPackage(pkgId));
        }
Esempio n. 3
0
        public static IEnumerable LoadGalleryPager()
        {
            if (!WebUtils.CheckRightsForAdminSettingsPage(false))
            {
                return(null);
            }
            if (!WebUtils.CheckIfPrimaryBlog(false))
            {
                return(null);
            }

            return(Gallery.GalleryPager == null ? null : Gallery.GalleryPager.PageItems);
        }
Esempio n. 4
0
        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));
        }
Esempio n. 5
0
        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));
        }
Esempio n. 6
0
        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));
        }
Esempio n. 7
0
        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));
        }
Esempio n. 8
0
        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))
            });
        }
Esempio n. 9
0
        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);
        }
Esempio n. 10
0
        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);
            }
        }
Esempio n. 11
0
        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);
        }
Esempio n. 12
0
        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)
            });
        }