Updated formatting and convert the majority of code to Ruby 1.9 syntax

Just gone through a lot of controllers and misc files and sorted out whitespace, updated to the ruby 1.9 syntax, added empty lines to EOF.