Many small fixes, preparation for unit tests

- changed structure to easy unit testing (see #8);
- fixed many small bugs in Yii components, e.g. date bug;
- added support for logging from console application