public BoardController(
     ForumServices forumServices,
     SearchServices searchServices,
     ThreadServices threadServices,
     PostServices postServices,
     PollServices pollServices,
     GlobalServices globalServices,
     IRepository<OnlineUser> onlineUserRepository,
     IRepository<OnlineGuest> onlineGuestRepository,
     IRepository<User> userRepository,
     UserServices usersServices,
     RoleServices roleServices,
     MessageServices messageServices,
     PermissionServices permissionServices,
     FileServices fileServices,
     User currentUser,
     Theme currentTheme)
 {
     _forumServices = forumServices;
     _searchServices = searchServices;
     _threadServices = threadServices;
     _postServices = postServices;
     _pollServices = pollServices;
     _onlineUserRepository = onlineUserRepository;
     _onlineGuestRepository = onlineGuestRepository;
     _userRepository = userRepository;
     _userServices = usersServices;
     _roleServices = roleServices;
     _messageServices = messageServices;
     _permissionServices = permissionServices;
     _fileServices = fileServices;
     _currentUser = currentUser;
     _currentTheme = currentTheme;
     SetTopBreadCrumb("Board");
 }
 public ConfigsController(
     IRepository<Config> configRepository,
     IRepository<PluginConfig> pluginConfigRepository,
     IRepository<Role> roleRepository,
     IRepository<Theme> themeRepository,
     ThemeServices themeServices,
     Theme currentTheme)
 {
     _configRepository = configRepository;
     _pluginConfigRepository = pluginConfigRepository;
     _roleRepository = roleRepository;
     _themeRepository = themeRepository;
     _themeServices = themeServices;
     _currentTheme = currentTheme;
 }
Beispiel #3
0
        public static void ParseBBCodeScriptFile(Theme theme)
        {
            string validHighlighters = SiteConfig.SyntaxHighlighting.Value;
            string[] highlighters = validHighlighters.ToLower().Split(",".ToArray(), StringSplitOptions.RemoveEmptyEntries);
            string[] options = SiteConfig.SyntaxHighlighting.Options.ToLower().Split(",".ToArray(), StringSplitOptions.RemoveEmptyEntries);
            string[] tohide = options.Except(highlighters).ToArray();

            string originalFile;

            string path = HostingEnvironment.MapPath(("~/Themes/" + theme.FolderName + "/Content/Scripts/bbcode-set.js"));

            using (FileStream file = File.Open(path, FileMode.Open, FileAccess.Read, FileShare.Read))
            using (StreamReader reader = new StreamReader(file))
            {
                originalFile = reader.ReadToEnd();
            }

            string[] splitText = originalFile.Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);

            List<string> found = new List<string>();

            foreach (string h in tohide)
            {
                found.AddRange(splitText.Where(x => x.Contains(h)).ToList());
            }

            found = found.Distinct().ToList();

            foreach (string s in found)
            {
                originalFile = originalFile.Replace(s, "// " + s);
            }

            string newPath = HostingEnvironment.MapPath(("~/Themes/" + theme.FolderName + "/Content/Scripts/bbcode-set-parsed.js"));
            using (StreamWriter writeit = File.CreateText(newPath))
            {
                writeit.Write(originalFile);
            }
        }
        public ActionResult CreateTheme(ThemeViewModel model)
        {
            if (IsModelValidAndPersistErrors())
            {
                Theme theme = new Theme()
                {
                    DisplayName = model.DisplayName,
                    FolderName = model.FolderName,
                    Name = model.Name,
                    VisibleToUsers = model.VisibleToUsers
                };
                _themeRepository.Add(theme);

                if (model.DefaultTheme)
                    _themeServices.ChangeDefaultTheme(theme.ThemeID);

                SetSuccess("Theme Created");
                return RedirectToAction("Themes");
            }

            return RedirectToSelf();
        }