diff --git a/upload/includes/functions.php b/upload/includes/functions.php
index 9dc85f7ef..c8c7db0a6 100644
--- a/upload/includes/functions.php
+++ b/upload/includes/functions.php
@@ -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 = '
';
+ break;
+ case TOR_TYPE_SILVER:
+ $is_gold = '
';
+ break;
+ default:
+ $is_gold = '';
+ break;
+ }
+ }
+
+ return $is_gold;
}
\ No newline at end of file
diff --git a/upload/includes/ucp/viewtorrent.php b/upload/includes/ucp/viewtorrent.php
index 8456ace87..9a49233be 100644
--- a/upload/includes/ucp/viewtorrent.php
+++ b/upload/includes/ucp/viewtorrent.php
@@ -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 = '
';
- }
- elseif ($row['tor_type'] == TOR_TYPE_SILVER)
- {
- $is_gold = '
';
- }
- }
-
$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 : "$topic_title",
'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 = '
';
- }
- elseif ($row['tor_type'] == TOR_TYPE_SILVER)
- {
- $is_gold = '
';
- }
- }
-
$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 : "$topic_title",
'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 = '
';
- }
- elseif ($row['tor_type'] == TOR_TYPE_SILVER)
- {
- $is_gold = '
';
- }
- }
-
$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' : '-',
diff --git a/upload/tracker.php b/upload/tracker.php
index ae9dceb6d..a71ce7380 100644
--- a/upload/tracker.php
+++ b/upload/tracker.php
@@ -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 = '
';
- }
- elseif ($tor['tor_type'] == TOR_TYPE_SILVER)
- {
- $is_gold = '
';
- }
- }
-
$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']],
diff --git a/upload/viewforum.php b/upload/viewforum.php
index c58045016..44a4deaaf 100644
--- a/upload/viewforum.php
+++ b/upload/viewforum.php
@@ -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 = '
';
- }
- elseif ($topic['tor_type'] == TOR_TYPE_SILVER)
- {
- $is_gold = '
';
- }
- }
-
$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']] : '',