public static function getUserType() { if ($user_type = PHPWS_Cookie::read('phpws_editor')) { if ($user_type == 'none') { return null; } // prevent shenanigans if (preg_match('/\\W/', $user_type)) { return DEFAULT_EDITOR_TOOL; } if (Editor::isType($user_type)) { return $user_type; } else { PHPWS_Cookie::delete('phpws_editor'); } } return DEFAULT_EDITOR_TOOL; }