mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-22 14:23:57 -07:00
Gold image
Вывод картинки золото/серебро через функцию, для предотвращения дублирования кода.
This commit is contained in:
parent
e6c0b2f930
commit
ab3786b02c
4 changed files with 33 additions and 70 deletions
|
@ -2808,4 +2808,32 @@ function gender_image ($gender)
|
|||
}
|
||||
|
||||
return $user_gender;
|
||||
}
|
||||
|
||||
function is_gold ($type)
|
||||
{
|
||||
global $lang, $tr_cfg;
|
||||
|
||||
if (!$tr_cfg['gold_silver_enabled'])
|
||||
{
|
||||
$is_gold = '';
|
||||
return $is_gold;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch ($type)
|
||||
{
|
||||
case TOR_TYPE_GOLD:
|
||||
$is_gold = '<img src="images/tor_gold.gif" width="16" height="15" title="'. $lang['GOLD'] .'" /> ';
|
||||
break;
|
||||
case TOR_TYPE_SILVER:
|
||||
$is_gold = '<img src="images/tor_silver.gif" width="16" height="15" title="'. $lang['SILVER'] .'" /> ';
|
||||
break;
|
||||
default:
|
||||
$is_gold = '';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $is_gold;
|
||||
}
|
|
@ -48,19 +48,6 @@ if ($releasing)
|
|||
{
|
||||
foreach ($releasing as $i => $row)
|
||||
{
|
||||
$is_gold = '';
|
||||
if ($tr_cfg['gold_silver_enabled'])
|
||||
{
|
||||
if ($row['tor_type'] == TOR_TYPE_GOLD)
|
||||
{
|
||||
$is_gold = '<img src="images/tor_gold.gif" width="16" height="15" title="'. $lang['GOLD'] .'" /> ';
|
||||
}
|
||||
elseif ($row['tor_type'] == TOR_TYPE_SILVER)
|
||||
{
|
||||
$is_gold = '<img src="images/tor_silver.gif" width="16" height="15" title="'. $lang['SILVER'] .'" /> ';
|
||||
}
|
||||
}
|
||||
|
||||
$topic_title = wbr($row['topic_title']);
|
||||
|
||||
$template->assign_block_vars('released', array(
|
||||
|
@ -69,7 +56,7 @@ if ($releasing)
|
|||
'TOPIC_TITLE' => ($row['update_time']) ? $topic_title : "<s>$topic_title</s>",
|
||||
'U_VIEW_FORUM' => FORUM_URL . $row['forum_id'],
|
||||
'U_VIEW_TOPIC' => TOPIC_URL . $row['topic_id'],
|
||||
'TOR_TYPE' => $is_gold,
|
||||
'TOR_TYPE' => is_gold($row['tor_type']),
|
||||
'TOPIC_SEEDERS' => ($row['seeders']) ? $row['seeders'] : 0,
|
||||
'TOPIC_LEECHERS' => ($row['leechers']) ? $row['leechers'] : 0,
|
||||
'SPEED_UP' => ($row['speed_up']) ? humn_size($row['speed_up'], 0, 'KB') .'/s' : '-',
|
||||
|
@ -83,19 +70,6 @@ if ($seeding)
|
|||
{
|
||||
foreach ($seeding as $i => $row)
|
||||
{
|
||||
$is_gold = '';
|
||||
if ($tr_cfg['gold_silver_enabled'])
|
||||
{
|
||||
if ($row['tor_type'] == TOR_TYPE_GOLD)
|
||||
{
|
||||
$is_gold = '<img src="images/tor_gold.gif" width="16" height="15" title="'. $lang['GOLD'] .'" /> ';
|
||||
}
|
||||
elseif ($row['tor_type'] == TOR_TYPE_SILVER)
|
||||
{
|
||||
$is_gold = '<img src="images/tor_silver.gif" width="16" height="15" title="'. $lang['SILVER'] .'" /> ';
|
||||
}
|
||||
}
|
||||
|
||||
$topic_title = wbr($row['topic_title']);
|
||||
|
||||
$template->assign_block_vars('seed', array(
|
||||
|
@ -104,7 +78,7 @@ if ($seeding)
|
|||
'TOPIC_TITLE' => ($row['update_time']) ? $topic_title : "<s>$topic_title</s>",
|
||||
'U_VIEW_FORUM' => FORUM_URL . $row['forum_id'],
|
||||
'U_VIEW_TOPIC' => TOPIC_URL . $row['topic_id'],
|
||||
'TOR_TYPE' => $is_gold,
|
||||
'TOR_TYPE' => is_gold($row['tor_type']),
|
||||
'TOPIC_SEEDERS' => ($row['seeders']) ? $row['seeders'] : 0,
|
||||
'TOPIC_LEECHERS' => ($row['leechers']) ? $row['leechers'] : 0,
|
||||
'SPEED_UP' => ($row['speed_up']) ? humn_size($row['speed_up'], 0, 'KB') .'/s' : '-',
|
||||
|
@ -118,19 +92,6 @@ if ($leeching)
|
|||
{
|
||||
foreach ($leeching as $i => $row)
|
||||
{
|
||||
$is_gold = '';
|
||||
if ($tr_cfg['gold_silver_enabled'])
|
||||
{
|
||||
if ($row['tor_type'] == TOR_TYPE_GOLD)
|
||||
{
|
||||
$is_gold = '<img src="images/tor_gold.gif" width="16" height="15" title="'.$lang['GOLD'].'" /> ';
|
||||
}
|
||||
elseif ($row['tor_type'] == TOR_TYPE_SILVER)
|
||||
{
|
||||
$is_gold = '<img src="images/tor_silver.gif" width="16" height="15" title="'.$lang['SILVER'].'" /> ';
|
||||
}
|
||||
}
|
||||
|
||||
$compl_size = ($row['remain'] && $row['size'] && $row['size'] > $row['remain']) ? ($row['size'] - $row['remain']) : 0;
|
||||
$compl_perc = ($compl_size) ? floor($compl_size * 100 / $row['size']) : 0;
|
||||
$topic_title = wbr($row['topic_title']);
|
||||
|
@ -142,7 +103,7 @@ if ($leeching)
|
|||
'U_VIEW_FORUM' => FORUM_URL . $row['forum_id'],
|
||||
'U_VIEW_TOPIC' => TOPIC_URL . $row['topic_id'],
|
||||
'COMPL_PERC' => $compl_perc,
|
||||
'TOR_TYPE' => $is_gold,
|
||||
'TOR_TYPE' => is_gold($row['tor_type']),
|
||||
'TOPIC_SEEDERS' => ($row['seeders']) ? $row['seeders'] : 0,
|
||||
'TOPIC_LEECHERS' => ($row['leechers']) ? $row['leechers'] : 0,
|
||||
'SPEED_DOWN' => ($row['speed_down']) ? humn_size($row['speed_down'], 0, 'KB') .'/s' : '-',
|
||||
|
|
|
@ -738,19 +738,6 @@ if ($allowed_forums)
|
|||
$forum_id = (!$hide_forum && isset($tor['forum_id'])) ? $tor['forum_id'] : '';
|
||||
$poster_id = (!$hide_author && isset($tor['poster_id'])) ? $tor['poster_id'] : '';
|
||||
|
||||
$is_gold = '';
|
||||
if ($tr_cfg['gold_silver_enabled'])
|
||||
{
|
||||
if ($tor['tor_type'] == TOR_TYPE_GOLD)
|
||||
{
|
||||
$is_gold = '<img src="images/tor_gold.gif" width="16" height="15" title="'.$lang['GOLD'].'" alt="" /> ';
|
||||
}
|
||||
elseif ($tor['tor_type'] == TOR_TYPE_SILVER)
|
||||
{
|
||||
$is_gold = '<img src="images/tor_silver.gif" width="16" height="15" title="'.$lang['SILVER'].'" alt="" /> ';
|
||||
}
|
||||
}
|
||||
|
||||
$template->assign_block_vars('tor', array(
|
||||
'CAT_ID' => $cat_id,
|
||||
'CAT_TITLE' => ($cat_id) ? $cat_title_html[$cat_id] : '',
|
||||
|
@ -771,7 +758,7 @@ if ($allowed_forums)
|
|||
|
||||
'ATTACH_ID' => $att_id,
|
||||
'MAGNET' => $tor_magnet,
|
||||
'TOR_TYPE' => $is_gold,
|
||||
'TOR_TYPE' => is_gold($tor['tor_type']),
|
||||
|
||||
'TOR_FROZEN' => (!IS_AM) ? isset($bb_cfg['tor_frozen'][$tor['tor_status']]) : '',
|
||||
'TOR_STATUS_ICON' => $bb_cfg['tor_icons'][$tor['tor_status']],
|
||||
|
|
|
@ -480,19 +480,6 @@ foreach ($topic_rowset as $topic)
|
|||
}
|
||||
}
|
||||
|
||||
$is_gold = '';
|
||||
if ($tr_cfg['gold_silver_enabled'] && isset($topic['tor_type']))
|
||||
{
|
||||
if ($topic['tor_type'] == TOR_TYPE_GOLD)
|
||||
{
|
||||
$is_gold = '<img src="images/tor_gold.gif" width="16" height="15" title="'.$lang['GOLD'].'" alt="" /> ';
|
||||
}
|
||||
elseif ($topic['tor_type'] == TOR_TYPE_SILVER)
|
||||
{
|
||||
$is_gold = '<img src="images/tor_silver.gif" width="16" height="15" title="'.$lang['SILVER'].'" alt="" /> ';
|
||||
}
|
||||
}
|
||||
|
||||
$template->assign_block_vars('t', array(
|
||||
'FORUM_ID' => $forum_id,
|
||||
'TOPIC_ID' => $topic_id,
|
||||
|
@ -506,7 +493,7 @@ foreach ($topic_rowset as $topic)
|
|||
'VIEWS' => $topic['topic_views'],
|
||||
'TOR_STALED' => ($forum_data['allow_reg_tracker'] && !($t_type == POST_ANNOUNCE || $t_type == POST_STICKY || $topic['tor_size'])),
|
||||
'TOR_FROZEN' => isset($topic['tor_status']) ? ((!IS_AM) ? isset($bb_cfg['tor_frozen'][$topic['tor_status']]) : '') : '',
|
||||
'TOR_TYPE' => $is_gold,
|
||||
'TOR_TYPE' => is_gold($topic['tor_type']),
|
||||
|
||||
'TOR_STATUS_ICON' => isset($topic['tor_status']) ? $bb_cfg['tor_icons'][$topic['tor_status']] : '',
|
||||
'TOR_STATUS_TEXT' => isset($topic['tor_status']) ? $lang['TOR_STATUS_NAME'][$topic['tor_status']] : '',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue