Models rewrite; removed RedBeanPHP; misc changes

Pages load 1.5-2x faster
Exception trace in JSON is now represented as an array
Fixed pagination of default favorites page in user pages
Fixed thumbnail size validation for non-square thumbnails
Fixed changing access rank