Import (meld) from mother_brain.

Added classes ftp, cookies, json_response, magic_cache and scripts/polyfills/*

Updated classes login, session, simple_date and functions.php
Modified to use json_response class instead of function.