Changeset 1509 for FCKeditor.Java/branches/2.4/src/main/java/net/fckeditor/handlers/ExtensionsHandler.java
- Timestamp:
- 2008-02-13 23:08:27 (9 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
FCKeditor.Java/branches/2.4/src/main/java/net/fckeditor/handlers/ExtensionsHandler.java
r1455 r1509 25 25 import java.util.Set; 26 26 27 import net.fckeditor. FileType;27 import net.fckeditor.ResourceType; 28 28 import net.fckeditor.tool.Utils; 29 29 … … 40 40 public class ExtensionsHandler { 41 41 42 private static Map< FileType, Set<String>> extensionsAllowed = new HashMap<FileType, Set<String>>();43 private static Map< FileType, Set<String>> extensionsDenied = new HashMap<FileType, Set<String>>();42 private static Map<ResourceType, Set<String>> extensionsAllowed = new HashMap<ResourceType, Set<String>>(); 43 private static Map<ResourceType, Set<String>> extensionsDenied = new HashMap<ResourceType, Set<String>>(); 44 44 45 45 static { 46 46 // load defaults 47 extensionsAllowed.put( FileType.FILE, Utils.getSet(ConfigurationHandler48 .getDefaultProperty(" fckeditor.file.extensions.allowed")));49 extensionsDenied.put( FileType.FILE, Utils.getSet(ConfigurationHandler50 .getDefaultProperty(" fckeditor.file.extensions.denied")));51 extensionsAllowed.put( FileType.MEDIA, Utils.getSet(ConfigurationHandler52 .getDefaultProperty(" fckeditor.media.extensions.allowed")));53 extensionsDenied.put( FileType.MEDIA, Utils.getSet(ConfigurationHandler54 .getDefaultProperty(" fckeditor.media.extensions.denied")));55 extensionsAllowed.put( FileType.IMAGE, Utils.getSet(ConfigurationHandler56 .getDefaultProperty(" fckeditor.image.extensions.allowed")));57 extensionsDenied.put( FileType.IMAGE, Utils.getSet(ConfigurationHandler58 .getDefaultProperty(" fckeditor.image.extensions.denied")));59 extensionsAllowed.put( FileType.FLASH, Utils.getSet(ConfigurationHandler60 .getDefaultProperty(" fckeditor.flash.extensions.allowed")));61 extensionsDenied.put( FileType.FLASH, Utils.getSet(ConfigurationHandler62 .getDefaultProperty(" fckeditor.flash.extensions.denied")));47 extensionsAllowed.put(ResourceType.File, Utils.getSet(ConfigurationHandler 48 .getDefaultProperty("connector.extensions.file.allowed"))); 49 extensionsDenied.put(ResourceType.File, Utils.getSet(ConfigurationHandler 50 .getDefaultProperty("connector.extensions.file.denied"))); 51 extensionsAllowed.put(ResourceType.Media, Utils.getSet(ConfigurationHandler 52 .getDefaultProperty("connector.extensions.media.allowed"))); 53 extensionsDenied.put(ResourceType.Media, Utils.getSet(ConfigurationHandler 54 .getDefaultProperty("connector.extensions.media.denied"))); 55 extensionsAllowed.put(ResourceType.Image, Utils.getSet(ConfigurationHandler 56 .getDefaultProperty("connector.extensions.image.allowed"))); 57 extensionsDenied.put(ResourceType.Image, Utils.getSet(ConfigurationHandler 58 .getDefaultProperty("connector.extensions.image.denied"))); 59 extensionsAllowed.put(ResourceType.Flash, Utils.getSet(ConfigurationHandler 60 .getDefaultProperty("connector.extensions.flash.allowed"))); 61 extensionsDenied.put(ResourceType.Flash, Utils.getSet(ConfigurationHandler 62 .getDefaultProperty("connector.extensions.flash.denied"))); 63 63 } 64 64 … … 70 70 * @return Set of allowed extensions or an empty set. 71 71 */ 72 public static Set<String> getExtensionsAllowed(final FileType type) {72 public static Set<String> getExtensionsAllowed(final ResourceType type) { 73 73 return extensionsAllowed.get(type); 74 74 } … … 83 83 * Required format: <code>ext1|ext2|ext3</code> 84 84 */ 85 public static void setExtensionsAllowed(final FileType type, final String extensionsList) {85 public static void setExtensionsAllowed(final ResourceType type, final String extensionsList) { 86 86 if (extensionsList != null) { 87 87 extensionsAllowed.put(type, Utils.getSet(extensionsList)); … … 97 97 * @return Set of denied extensions or an empty set. 98 98 */ 99 public static Set<String> getExtensionsDenied(final FileType type) {99 public static Set<String> getExtensionsDenied(final ResourceType type) { 100 100 return extensionsDenied.get(type); 101 101 } … … 110 110 * Required format: <code>ext1|ext2|ext3</code> 111 111 */ 112 public static void setExtensionsDenied(final FileType type, final String extensionsList) {112 public static void setExtensionsDenied(final ResourceType type, final String extensionsList) { 113 113 if (extensionsList != null) { 114 114 extensionsDenied.put(type, Utils.getSet(extensionsList)); … … 124 124 * @return True, false. False is returned too, if 'type' or 'extensions' is null. 125 125 */ 126 public static boolean isAllowed(final FileType type, final String extension) {126 public static boolean isAllowed(final ResourceType type, final String extension) { 127 127 if (type == null || extension == null) 128 128 return false;