Part 1: CS and defined('JPATH_PLATFORM') or die; stuff

@wilsonge
here is the first part of CS and `defined('JPATH_PLATFORM') or die;` stuff.  This also fix a few Messagestypes please review it and let me know if there is a issue.