mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-20 13:24:01 -07:00
Simplified gender function (#1167)
* Simplified gender function * Update CHANGELOG.md
This commit is contained in:
parent
73671494e9
commit
9973931004
4 changed files with 16 additions and 20 deletions
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
**Merged pull requests:**
|
**Merged pull requests:**
|
||||||
|
|
||||||
|
- Simplified gender function [\#1167](https://github.com/torrentpier/torrentpier/pull/1167) ([belomaxorka](https://github.com/belomaxorka))
|
||||||
- Revert "Fixed input types in some cases (#697)" [20ce8ca](https://github.com/torrentpier/torrentpier/commit/20ce8cae9cf6447f5100ab2d8f4a5299254f5412) ([belomaxorka](https://github.com/belomaxorka))
|
- Revert "Fixed input types in some cases (#697)" [20ce8ca](https://github.com/torrentpier/torrentpier/commit/20ce8cae9cf6447f5100ab2d8f4a5299254f5412) ([belomaxorka](https://github.com/belomaxorka))
|
||||||
- Revert "Fixed input types in some cases (#693)" [74aa6ff](https://github.com/torrentpier/torrentpier/commit/74aa6ff29991186ffc6484980972d5f74e4d0393) ([belomaxorka](https://github.com/belomaxorka))
|
- Revert "Fixed input types in some cases (#693)" [74aa6ff](https://github.com/torrentpier/torrentpier/commit/74aa6ff29991186ffc6484980972d5f74e4d0393) ([belomaxorka](https://github.com/belomaxorka))
|
||||||
- Support simultaneous id & username inputs for browsing profiles [\#1166](https://github.com/torrentpier/torrentpier/pull/1166) ([kovalensky](https://github.com/kovalensky))
|
- Support simultaneous id & username inputs for browsing profiles [\#1166](https://github.com/torrentpier/torrentpier/pull/1166) ([kovalensky](https://github.com/kovalensky))
|
||||||
|
|
|
@ -1994,30 +1994,25 @@ function get_avatar($user_id, $ext_id, $allow_avatar = true, $height = '', $widt
|
||||||
return $user_avatar;
|
return $user_avatar;
|
||||||
}
|
}
|
||||||
|
|
||||||
function gender_image($gender): string
|
/**
|
||||||
|
* Returns gender image
|
||||||
|
*
|
||||||
|
* @param int $gender
|
||||||
|
* @return string|null
|
||||||
|
*/
|
||||||
|
function genderImage(int $gender): ?string
|
||||||
{
|
{
|
||||||
global $bb_cfg, $lang, $images;
|
global $bb_cfg, $lang, $images;
|
||||||
|
|
||||||
$gender = (int)$gender;
|
|
||||||
$user_gender = '';
|
|
||||||
|
|
||||||
if (!$bb_cfg['gender']) {
|
if (!$bb_cfg['gender']) {
|
||||||
return $user_gender;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($gender) {
|
return match ($gender) {
|
||||||
case MALE:
|
MALE => '<img src="' . $images['icon_male'] . '" alt="' . $lang['GENDER_SELECT'][MALE] . '" title="' . $lang['GENDER_SELECT'][MALE] . '" border="0" />',
|
||||||
$user_gender = '<img src="' . $images['icon_male'] . '" alt="' . $lang['GENDER_SELECT'][MALE] . '" title="' . $lang['GENDER_SELECT'][MALE] . '" border="0" />';
|
FEMALE => '<img src="' . $images['icon_female'] . '" alt="' . $lang['GENDER_SELECT'][FEMALE] . '" title="' . $lang['GENDER_SELECT'][FEMALE] . '" border="0" />',
|
||||||
break;
|
default => '<img src="' . $images['icon_nogender'] . '" alt="' . $lang['GENDER_SELECT'][NOGENDER] . '" title="' . $lang['GENDER_SELECT'][NOGENDER] . '" border="0" />',
|
||||||
case FEMALE:
|
};
|
||||||
$user_gender = '<img src="' . $images['icon_female'] . '" alt="' . $lang['GENDER_SELECT'][FEMALE] . '" title="' . $lang['GENDER_SELECT'][FEMALE] . '" border="0" />';
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
$user_gender = '<img src="' . $images['icon_nogender'] . '" alt="' . $lang['GENDER_SELECT'][NOGENDER] . '" title="' . $lang['GENDER_SELECT'][NOGENDER] . '" border="0" />';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $user_gender;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function is_gold($type): string
|
function is_gold($type): string
|
||||||
|
|
|
@ -97,7 +97,7 @@ $template->assign_vars([
|
||||||
'SKYPE' => $profiledata['user_skype'],
|
'SKYPE' => $profiledata['user_skype'],
|
||||||
'TWITTER' => $profiledata['user_twitter'],
|
'TWITTER' => $profiledata['user_twitter'],
|
||||||
'USER_POINTS' => $profiledata['user_points'],
|
'USER_POINTS' => $profiledata['user_points'],
|
||||||
'GENDER' => ($bb_cfg['gender']) ? $lang['GENDER_SELECT'][$profiledata['user_gender']] : '',
|
'GENDER' => $bb_cfg['gender'] ? $lang['GENDER_SELECT'][$profiledata['user_gender']] : '',
|
||||||
'BIRTHDAY' => ($bb_cfg['birthday_enabled'] && !empty($profiledata['user_birthday']) && $profiledata['user_birthday'] != '1900-01-01') ? $profiledata['user_birthday'] : '',
|
'BIRTHDAY' => ($bb_cfg['birthday_enabled'] && !empty($profiledata['user_birthday']) && $profiledata['user_birthday'] != '1900-01-01') ? $profiledata['user_birthday'] : '',
|
||||||
'BIRTHDAY_ICON' => user_birthday_icon($profiledata['user_birthday'], $profiledata['user_id']),
|
'BIRTHDAY_ICON' => user_birthday_icon($profiledata['user_birthday'], $profiledata['user_id']),
|
||||||
'AGE' => ($bb_cfg['birthday_enabled'] && !empty($profiledata['user_birthday']) && $profiledata['user_birthday'] != '1900-01-01') ? birthday_age($profiledata['user_birthday']) : '',
|
'AGE' => ($bb_cfg['birthday_enabled'] && !empty($profiledata['user_birthday']) && $profiledata['user_birthday'] != '1900-01-01') ? birthday_age($profiledata['user_birthday']) : '',
|
||||||
|
|
|
@ -707,7 +707,7 @@ for ($i = 0; $i < $total_posts; $i++) {
|
||||||
'POSTER_GUEST' => $poster_guest,
|
'POSTER_GUEST' => $poster_guest,
|
||||||
'POSTER_ID' => $poster_id,
|
'POSTER_ID' => $poster_id,
|
||||||
'POSTER_AUTHOR' => ($poster_id == $t_data['topic_poster']),
|
'POSTER_AUTHOR' => ($poster_id == $t_data['topic_poster']),
|
||||||
'POSTER_GENDER' => $bb_cfg['gender'] ? gender_image($postrow[$i]['user_gender']) : '',
|
'POSTER_GENDER' => genderImage((int)$postrow[$i]['user_gender']),
|
||||||
'POSTED_AFTER' => $prev_post_time ? delta_time($postrow[$i]['post_time'], $prev_post_time) : '',
|
'POSTED_AFTER' => $prev_post_time ? delta_time($postrow[$i]['post_time'], $prev_post_time) : '',
|
||||||
'IS_UNREAD' => is_unread($postrow[$i]['post_time'], $topic_id, $forum_id),
|
'IS_UNREAD' => is_unread($postrow[$i]['post_time'], $topic_id, $forum_id),
|
||||||
'IS_FIRST_POST' => (!$start && $is_first_post),
|
'IS_FIRST_POST' => (!$start && $is_first_post),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue