Integrating Akismet with Joomlaboard Forum

JoomlaBoard is a very nice and simple forum that integrates to Joomla (one of the most common content management system available out there).

All the code is GPL and PHP, so you can deal with it as you want.

Recently we have had a lot of spam on our community website. Apparently there are people determined enough to register to the website, then confirm their registration via email and finally post spam. We respond most of the time in a matter of minutes, but too late for the RSS feed not to pick it up. So instead I have looked at a way to spamproof the forum some more. Apparently Akismet is one of the best tools out there, so I thought I ought to try it out.

I just used the PHP class developed by Alex. I copied it to the repertory components/com_joomlaboard/ in my Joomla instance.

I looked into the post.php file:

    215                //check if the post must be reviewed by a Moderator prior to showing
    216                //doesn't apply to admin/moderator posts
    217                $holdPost=0;
    218                if (!$is_moderator){
    219                   $database->setQuery("SELECT review FROM #__sb_categories WHERE id=$catid");
    220                   $holdPost=$database->loadResult();
    221                }

Hmmm, the $holdPost variable really looks good. We do not want to delete the message right away, it would be great to have it just moderated.

So I added those lines, which are an ugly copy/paste of the example provided with the PHP class, adapted to Joomlaboard:

    222                // the forum is not moderated by default, so we check for spam
    223                if ($holdPost == 0) {
    224                   include 'Akismet.class.php';
    225                   $WordPressAPIKey =  'xxxxxxxxxxxxx'; // replace it with your own key
    226                   $MyBlogURL = 'http://bpms.intalio.com';
    227
    228                   $akismet = new Akismet($MyBlogURL ,$WordPressAPIKey);
    229                   $akismet->setCommentAuthor($sb_authorname);
    230                   $akismet->setCommentAuthorEmail($email);
    231
    232                   $akismet->setCommentType('forum');
    233                   $akismet->setReferrer($_SERVER["HTTP_REFERER"]);
    234                   $akismet->setCommentContent($message);
    235                   //$akismet->setPermalink('http://www.example.com/blog/alex/someurl/');
    236
    237                  if($akismet->isCommentSpam()){
    238                     $holdPost=1;
    239                  }
    240                }

And then connected as John Smith to spam myself. I looked into the Akismet spam of my own blogs to get some crispy ones.

Moderated spam

Here is the diff of the post.php file, for those interested to apply it quickly.

Note that you will need to have an Akismet API key to be able to connect to the Akismet service.

Thanks to Pascal for letting me try this out !

Posted in General. Comments Off

Tumbling on several tumblrs

I really love Tumblr, and I love filling up my watchlog,

but it gets a bit messy when you have two Tumblr accounts: you never really know on which you are logged, and it becomes painful quickly.

So.. any firefox brilliant extension for that ? Or just a better bookmarklet from the guys ?

Posted in Notes. No Comments »

OSGi.does.not.like.5 token versions

I switched to Eclipse 3.3 for fun (and the T-shirt was tempting too), and banged into my first obstacle. Now the four digits scheme is strictly enforced for the version numbers.
That’s ok with me, I just changed the version numbers to add one more ‘.’ somewhere.

The thing is… our build system adds the build number as a new token.

So when building my new artifact, I had a version like this 1.0.0.0.001. That’s quite ugly. Well, I didn’t put too much attention into it.

Then switching to Eclipse 3.3 would not happen.

Here is the stacktrace you get when trying to activate a plugin with 5 tokens:

org.osgi.framework.BundleException:
Exception in org.eclipse.update.internal.configurator.ConfigurationActivator.start() of bundle org.eclipse.update.configurator.
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:1018)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:974)
	at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:346)
	at org.eclipse.osgi.framework.internal.core.AbstractBundle.resume(AbstractBundle.java:350)
	at org.eclipse.osgi.framework.internal.core.Framework.resumeBundle(Framework.java:1118)

with a nested stacktrace:

Caused by: org.eclipse.core.runtime.CoreException:
Cannot create configuration in file:/home/atoulme/eclipse/configuration/
	at org.eclipse.update.internal.configurator.Utils.newCoreException(Utils.java:96)
	at org.eclipse.update.internal.configurator.ConfigurationActivator.initialize(ConfigurationActivator.java:111)
	at org.eclipse.update.internal.configurator.ConfigurationActivator.start(ConfigurationActivator.java:69)

with a root exception:

org.eclipse.core.runtime.CoreException: Cannot create configuration in file:/home/atoulme/eclipse/configuration/
	at org.eclipse.update.internal.configurator.Utils.newCoreException(Utils.java:96)
	at org.eclipse.update.internal.configurator.ConfigurationActivator.initialize(ConfigurationActivator.java:111)
	at org.eclipse.update.internal.configurator.ConfigurationActivator.start(ConfigurationActivator.java:69)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl$2.run(BundleContextImpl.java:999)
	at java.security.AccessController.doPrivileged(Native Method)

Ordinarily, having a stacktrace means you already won. You just have to go at the right line of code, fix the problem and get the thing running.
In this case, the bundles that were throwing the exception are completely out of the Eclipse SDK workspace code, so the only option I had was to go look at it on cvs.
I ended downloading the code, compiling it in my 3.2.2 workspace and add a line in the getPlatformConfiguration() method.

**
	 * Creates and starts the platform configuration.
	 * @return the just started platform configuration
	 */
	private PlatformConfiguration getPlatformConfiguration(URL installURL, Location configLocation) {
		try {
			PlatformConfiguration.startup(installURL, configLocation);
		} catch (Exception e) {
			System.err.println("THERE WAS AN EXCEPTION" + e);
			e.printStackTrace();
			if (platformTracker != null) {
				String message = e.getMessage();
				if (message == null)
					message = ""; //$NON-NLS-1$
				Utils.log(Utils.newStatus(message, e));
			}
		}
		return PlatformConfiguration.getCurrent();

	}

Suddenly, I had the right stacktrace popping up:

THERE WAS AN EXCEPTIONjava.lang.IllegalArgumentException: invalid format
java.lang.IllegalArgumentException: invalid format
        at org.osgi.framework.Version.(Version.java:143)
        at org.osgi.framework.Version.parseVersion(Version.java:209)
        at org.eclipse.update.internal.configurator.VersionedIdentifier.(VersionedIdentifier.java:21)

Please look at the constructor of the Version class if you want to know more on the version string parsing. It says it better than an hundred words.

I hope this helps people migrating to Eclipse 3.3. I am 100% guilty of not respecting the OSGi standard (and I am now running to get this all fixed, and up and running with the latest RC!).

I opened a bugzilla entry to report this hidden stacktrace, feel free to comment it!

The EMF Compare component is getting there

I was one of the first contributors to the EMF Compare component, and I have to say I am glad to see it growing and maturing as the project lead, Cedric Brun, reports it. Congratulations to Obeo for their hard work!

The goal of this component is to compare effectively models, without using a UI.

On my plate, I need to test it with some of our BPMN models and see how it tracks down the changes. BPMN is a bit tricky because of the extensive use of edges, instead of having attribute changes as in UML (most of th time, when I was developing my contribution to this component, I was using a class diagram).

More here.

Java on Mac

Apparently, Java is going to require some work on Apple, as this post puts it. On top of that, Leopard won’t run Eclipse as is.

What I like is that both articles are optimistic and just want to get past it.

Posted in Notes. No Comments »

Eclipse Rss feed

I might be contributing a feed to PlanetEclipse.

The request is right over there, feel free to comment!

Posted in Eclipse. 1 Comment »

5.0 Beta is out of the door.

We’ve publicly announced tonight that Intalio|BPMS 5.0 Beta is out on our community web site. It actually has been there for some time.
It’s been a thrilling month, and more is coming.
The GA is next on the list.

Thanks everyone for your feedback on our product! We appreciate your support.