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; }
<td> </td> <td colspan="2" valign="top" bgcolor="#F5F2EB"><div align="left"> <?php if ($CONF_use_NAC) { echo "<strong>" . _Club . ":</strong> " . NACclub::getClubName($pilot['NACid'], $pilot['NACclubID']); } ?> </div></td> </tr> <tr> <td valign="top" bgcolor="#E9EDF5"><div align="right"><?php echo _COUNTRY; ?> </div></td> <td valign="top" bgcolor="#F9F9F9"> <?php echo getNationalityDescription($pilot['countryCode']); ?> </td> <td> </td> <td colspan="2" rowspan="8" valign="top"><?php if ($pilot['PilotPhoto'] > 0) { checkPilotPhoto($serverIDview, $pilotIDview); ?> <div align="center"><strong><?php echo _Photo; ?> </strong><br> <?php $imgBigRel = getPilotPhotoRelFilename($serverIDview, $pilotIDview); $imgBig = getPilotPhotoFilename($serverIDview, $pilotIDview); list($width, $height, $type, $attr) = getimagesize($imgBig);