public static function loadUserInfo()
    {
        if (defined('CIIMS_INSTALL'))
            return;
        
        if (isset(Yii::app()->user))
        {
            // Load some specific CiiMS JS here
            $json = CJSON::encode(array(
                'email' 		=>  Cii::get(Yii::app()->user, 'email'),
                'token' 		=> Cii::getUserConfig('api_key', false),
                'role' 			=> Cii::get(Yii::app()->user, 'role'),
                'isAuthenticated' 	=> isset(Yii::app()->user->id),
                'debug' 		=> YII_DEBUG,
                'time' 			=> time(),
                'version' 		=> YII_DEBUG ? Cii::getVersion() : null,
                'language' 		=> Cii::setApplicationLanguage(),
                'hosted' 		=> defined('CII_CONFIG'),
		'api' 			=> Yii::app()->getBaseUrl(true) . '/api'
            ));

            Yii::app()->clientScript->registerScript('ciims', "
                localStorage.setItem('ciims', '$json');
            ", CClientScript::POS_HEAD);
        }
    }