I base64_decode'd it and best as I can tell it checks for various things then uses curl to go to source sites to download files, writes them to temp dir(s), runs them, then unlink()s the files.That is, you more than likely have who know's what within both your files and database. I strongly suggest you take Patche's suggestion and do a clean install and then roll back your database to the last backup before this happened.