Tuesday, 30 March 2010

Blackbus.org hacked!

I logged on this morning to check Blackbus.org (a useful site for users of Raiser's Edge / Netcommunity / other Blackbaud products), and discovered that it seems to have been hacked.

I'm hoping that everyone else who logs on spots the problem - our firewall / anti-virus intercepted the nastiness before it got to us.

An iframe is being injected into every page on the site, after the closing HTML tag, linking to "ramualdo.com/lib/index.php" (don't go there).

What does it do? I have no idea, as it's being blocked here at work. I'm going to have a peek when I get home, but I would advise anyone reading this not to go to Blackbus, especially if they are using IE6/7/8 or a version of Chrome or Firefox that isn't up to date.

There's lots of nasty IE bugs around at the moment that it might be trying to exploit, and countless other exploits with third party software like Adobe Reader / Flash. So I'd stay away for a little while unless you're confident you're not going to get infected.

Hopefully Blackbus will sort it out soon.

Update: It's fixed!

Tuesday, 23 March 2010

Javascript setTimeout function parameters

Not really related to Netcommunity, but this might be useful to anyone struggling with Javascript timers, and more specifically calling a function with arguments from a timer.

Calling a function from a Javascript timer usually goes something like this:

timer = setTimeout('myfunction()',10);

Call myfunction() after 10 milliseconds. But what if you want to include some arguments in the function call? Surely this would work - x is a string:

timer = setTimeout('myfunction(x)',10);

For some irritating reason it doesn't. So I did some poking around to try and find a solution, and there are some, including using closures - but then I found this solution that seems to work nicely:

timer = setTimeout('myfunction("' + x + '"),10);

My particular use of this is as follows:

box = function(id,x,y) {
this.id = id;
this.x = x;
this.y = y;
this.timer = function() {
timer = setTimeout('animate("'+this.id+'")',10);
}
this.prepare = function() {
moveto(this.id, this.x, this.y);
}
}


boxone = new box("myid",50,50);
boxone.prepare();
boxone.timer();

I created a constructor function for a box; I then created a new box and then called the prepare function to put the box somewhere and the timer function to fire off a timer that starts an animation. It was that timer, contained within the constructor, that I was having trouble with - I couldn't pass arguments through to the next function.

I think that for some reason Javascript can't evaluate function arguments that are being called from a setTimeout in that way - so therefore you have to evaluate them before passing them into the function. That is why breaking up the string and sticking it all together with + works - it's asking Javascript to work out what your argument actually is before calling the function.

Does that make any sense? Probably not. I felt like writing it down anyway.

Monday, 1 March 2010

Netcommunity to Raiser's Edge

I've been half-heartedly attempting to send stuff from Netcommunity to Raiser's Edge today. There's an example on Blackbaud Labs that shows you how to update someone's Raiser's Edge record from Netcommunity. That particular example is a form that collects a couple of details from a user, and saves them as a Custom Transaction. The Custom Transaction is then processed by a Raiser's Edge plugin written especially for the task.

That all sounds a bit tricky and complicated to me, and I assumed (foolishly) that there would be some kind of in-built method in Netcommunity that would allow you to do stuff like that without having to go to all the hassle of writing a plugin. If there is, I can't get it to work though.

I've been trying to make use of this:

BBNCExtensions.API.Transactions.Profiles.ProfileUpdateArgs p = new BBNCExtensions.API.Transactions.Profiles.ProfileUpdateArgs();

It looks pretty good - if you create an object of the type above, it has some methods and properties that look perfect for what I want to do, for example:

// get the id of a custom attribute in raiser's edge
int att_id = p.Data.Attributes.GetAttributeTypeIdFromName("my attribute");

// set the value of the attribute to something
p.Data.Attributes.SetValue(att_id, "my value");

// fire it off to raiser's edge... please?
this.API.Transactions.RecordProfileUpdate(p)

Or not, as it doesn't work. Hmmm. Any ideas?

I read somewhere on Labs that at the moment Blackbaud only support Donations in this manner, and not Profile Updates or anything like that, but if the methods are there then why not? Or am I just being rubbish and not understanding how this works?