Refactor /offline

Refactor /offline, also affected cron.php.