function getPilotRealName($pilotIDview, $serverID, $getAlsoCountry = 0, $getAlsoExternalIndicator = 1, $gender = 1) { global $db, $pilotsTable, $opMode; global $currentlang, $nativeLanguage, $langEncodings, $lang2iso, $langEncodings; global $countries, $langEncodings; global $CONF_use_leonardo_names, $PREFS, $CONF, $moduleRelPath; # martin jursa may 2008: # make the function error-tolerant, in case $pilotIDview is submitted in the form [serverid]_[userid] if (strpos($pilotIDview, '_') !== false) { $parts = explode('_', $pilotIDview); $pilotIDview = $parts[1]; $serverID = $parts[0]; } if ($PREFS->nameOrder == 1) { $nOrder = "CONCAT(FirstName,' ',LastName)"; $nOrderEn = "CONCAT(FirstNameEn,' ',LastNameEn)"; } else { $nOrder = "CONCAT(LastName,' ',FirstName)"; $nOrderEn = "CONCAT(LastNameEn,' ',FirstNameEn)"; } $query = "SELECT {$nOrder} as realName ,{$nOrderEn} as realNameEn, countryCode,serverID,Sex FROM {$pilotsTable} WHERE pilotID={$pilotIDview} AND serverID={$serverID}"; $res = $db->sql_query($query); // echo $query; // Get real name from leonardo_pilots // // we must make sure the name can be displayed in the $currentlang encoding // if ($res) { $pilot = $db->sql_fetchrow($res); $realName = $pilot['realName']; $realNameEn = $pilot['realNameEn']; $pilotCountry = strtolower($pilot['countryCode']); if (strlen($realName) > 1 && ($CONF_use_leonardo_names || $langEncodings[$currentlang] == $langEncodings[$nativeLanguage])) { // always return real name $str = $realName; // we have some info on how to tranlitarate // and the currentlang is not the native lang of the pilot. $pilotLang = ""; if ($pilotCountry && !countryHasLang($pilotCountry, $currentlang)) { if (($pilotLang = array_search($pilotCountry, $lang2iso)) === NULL) { $pilotLang = $nativeLanguage; } //echo $pilotLang."#".$pilotCountry."$"; } // if all else fails translitarate using the nativeLangauge if (!$pilotCountry && !$pilotLang && $langEncodings[$nativeLanguage] != $langEncodings[$currentlang]) { $pilotLang = $nativeLanguage; } // echo ">$realName#$pilotLang#$pilotCountry#<br>"; $enc = $langEncodings[$pilotLang]; if ($enc) { if (strlen($realNameEn) > 1) { $str = $realNameEn; } else { $str = transliterate($str, $enc); } } //echo $realName."@"; // else return as is. if ($getAlsoCountry) { $str = getNationalityDescription($pilot['countryCode'], 1, 0) . $str; } if ($gender == 1 && strtoupper($pilot['Sex']) == 'F' && $getAlsoCountry) { // the $getAlsoCountry will prevent putting the F symbol in sync-log $str .= leoHtml::img("icon_female_small.gif", 0, 0, 'absmiddle', '', 'icons1'); } $str = $str . getExternalLinkIconStr($serverID, '', $getAlsoExternalIndicator); return $str; } /* if (strlen ($realName)>1) && $currentlang==$nativeLanguage) { // else realname is no good if ($getAlsoCountry ) return getNationalityDescription($pilot['countryCode'],1,0)."$realName"; else return $realName; }*/ } if ($opMode == 1) { // phpNuke $res = $db->sql_query("SELECT username,name FROM " . $CONF['userdb']['users_table'] . " WHERE " . $CONF['userdb']['user_id_field'] . "=" . $pilotIDview); if ($res) { $row = $db->sql_fetchrow($res); if ($currentlang != $nativeLanguage) { $realName = $row["username"]; } else { if ($row["name"] != '') { $realName = $row["name"]; } else { $realName = $row["username"]; } } $str = $realName; } } else { // phpBB $res = $db->sql_query("SELECT " . $CONF['userdb']['user_real_name_field'] . " FROM " . $CONF['userdb']['users_table'] . " WHERE " . $CONF['userdb']['user_id_field'] . "=" . $pilotIDview); if ($res) { $row = $db->sql_fetchrow($res); $realName = $row[$CONF['userdb']['user_real_name_field']]; $str = $realName; // we have some info on how to tranlitarate // and the currentlang is not the native lang of the pilot. $pilotLang = ""; if ($pilotCountry && !countryHasLang($pilotCountry, $currentlang)) { if (($pilotLang = array_search($pilotCountry, $lang2iso)) === NULL) { $pilotLang = $nativeLanguage; } //echo $pilotLang."#".$pilotCountry."$"; } // if all else fails translitarate using the nativeLangauge if (!$pilotCountry && !$pilotLang && $langEncodings[$nativeLanguage] != $langEncodings[$currentlang]) { $pilotLang = $nativeLanguage; } // echo "($str)>".$pilotLang."#".$pilotCountry."$"; $enc = $langEncodings[$pilotLang]; if ($enc) { if (strlen($realNameEn) > 1) { $str = $realNameEn; } else { $str = transliterate($str, $enc); } } //echo $realName."@"; // else return as is. } } $str .= getExternalLinkIconStr($serverID, '', $getAlsoExternalIndicator); if ($getAlsoCountry) { $str = getNationalityDescription($pilot['countryCode'], 1, 0) . $str; } if ($gender == 1 && strtoupper($pilot['Sex']) == 'F' && $getAlsoCountry) { // the $getAlsoCountry will prevent putting the F symbol in sync-log $str .= leoHtml::img("icon_female_small.gif", 0, 0, 'absmiddle', '', 'icons1'); } return $str; }
function getAttribute($attrName, $forceIntl = -1) { global $db, $currentlang, $nativeLanguage, $CONFIG_forceIntl; if (!$this->gotValues) { $this->getFromDB(); } if ($forceIntl == -1) { $forceIntl = $CONFIG_forceIntl; } $intName = "int" . strtoupper(substr($attrName, 0, 1)) . substr($attrName, 1); if (countryHasLang($this->countryCode, $currentlang) && !$forceIntl) { $name = $attrName; if (!$this->{$name}) { $name = $intName; } } else { $name = $intName; if (!$this->{$name}) { $name = $attrName; } } return $this->{$name}; }
function selectWaypointLocation($name, $intName, $countryCode, $forceIntl = -1) { global $currentlang, $nativeLanguage; global $CONFIG_forceIntl; if ($forceIntl == -1) { $forceIntl = $CONFIG_forceIntl; } // if ( $nativeLanguage==$currentlang || countryHasLang($countryCode,$currentlang) ) $tname=$name; if (countryHasLang($countryCode, $currentlang) && !$forceIntl) { $tname = $name; } else { $tname = $intName; } return $tname; }