(2003-2009) * @author Froxlor team (2010-) * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @package Functions * */ /** * Returns correct user salutation, either "Firstname Name" or "Company" * * @param array An array with keys firstname, name and company * @return string The correct salutation * * @author Florian Lippert */ function getCorrectUserSalutation($userinfo) { $returnval = ''; if(isset($userinfo['firstname']) && isset($userinfo['name']) && isset($userinfo['company'])) { // Always prefer firstname name if($userinfo['company'] != '' && $userinfo['name'] == '' && $userinfo['firstname'] == '') { $returnval = $userinfo['company']; } else { $returnval = $userinfo['firstname'] . ' ' . $userinfo['name']; } } return $returnval; }