+ public void afterCommentPosting(EntityComment aComment) {
+ if (checkEntity(aComment)) {
+ try {
+ aComment.setValueForProperty("is_published", "0");
+ aComment.update();
+ }
+ catch (Throwable t) {
+ }
+ }
+ super.afterCommentPosting(aComment);
+ }
+
+ private boolean checkEntity(Entity anEntity) {
+ String forbiddenWordsSpecification = MirGlobal.getConfigPropertyWithDefault("IndymediaNL.forbiddenExpressions", "");
+ List forbiddenWords = ParameterExpander.splitString(forbiddenWordsSpecification, ":");
+ Iterator i, j;
+ boolean found = false;
+ String field;
+
+
+ try {
+ j = anEntity.getFields().iterator();
+ while (!found && j.hasNext()) {
+ field = anEntity.getValue((String) j.next());
+
+ if (field!=null) {
+ field=field.toLowerCase();
+ i = forbiddenWords.iterator();
+ while (!found && i.hasNext()) {
+ String forbiddenWord = (String) i.next();
+
+ try {
+ if (field.indexOf(forbiddenWord.toLowerCase())>=0) {
+ found = true;
+ }
+ }
+ catch (Throwable t) {
+ logger.printError("Error while matching " + field + " to " + forbiddenWord + ": " + t.toString());
+ }
+ }
+ }
+ }
+ }
+ catch (Throwable t) {
+ }
+
+ return found;