Skip to content

Commit

Permalink
fix enable second icon display error + tag padding
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaomlove committed Mar 19, 2022
1 parent 0578aa3 commit b926b4d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion app/Repositories/TagRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function renderSpan(Collection $tagKeyById, array $renderIdArr = [], $wit
foreach ($renderIdArr as $tagId) {
$value = $tagKeyById->get($tagId);
if ($value) {
$item = "<span style=\"background-color:{$value->color};color:white;border-radius:15%\">{$value->name}</span> ";
$item = "<span style=\"background-color:{$value->color};color:white;padding: 1px 2px\">{$value->name}</span> ";
if ($withFilterLink) {
$html .= sprintf('<a href="torrents.php?tag_id=%s">%s</a>', $tagId, $item);
} else {
Expand Down
15 changes: 8 additions & 7 deletions include/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -2241,7 +2241,7 @@ function get_cat_folder($cat = 101)
// $caticonrow = get_category_icon_row($CURUSER['caticon']);
/**
* @since v1.6
* use setting, not user's caticon, that filed make no sense!
* use setting, not user's caticon, that field make no sense!
*/
$caticonrow = get_category_icon_row($catrow['icon_id'] ?: 1);
$path = sprintf('category/%s/%s', trim($catmode, '/'), trim($caticonrow['folder'], '/'));
Expand Down Expand Up @@ -3199,7 +3199,7 @@ function torrenttable($rows, $variant = "torrent") {
if (isset($row["category"])) {
print(return_category_image($row["category"], "?"));
if ($has_secondicon){
print(get_second_icon($row, "pic/".$catimgurl."additional/"));
print(get_second_icon($row));
}
}
else
Expand Down Expand Up @@ -3910,7 +3910,7 @@ function get_category_row($catid = NULL)
}
}

function get_second_icon($row, $catimgurl) //for CHDBits
function get_second_icon($row) //for CHDBits
{
global $CURUSER, $Cache;
$source=$row['source'];
Expand All @@ -3920,18 +3920,19 @@ function get_second_icon($row, $catimgurl) //for CHDBits
$processing=$row['processing'];
$team=$row['team'];
$audiocodec=$row['audiocodec'];
if (!$sirow = $Cache->get_value('secondicon_'.$source.'_'.$medium.'_'.$codec.'_'.$standard.'_'.$processing.'_'.$team.'_'.$audiocodec.'_content')){
$cacheKey = 'secondicon_'.$source.'_'.$medium.'_'.$codec.'_'.$standard.'_'.$processing.'_'.$team.'_'.$audiocodec.'_content';
if (!$sirow = $Cache->get_value($cacheKey)){
$res = sql_query("SELECT * FROM secondicons WHERE (source = ".sqlesc($source)." OR source=0) AND (medium = ".sqlesc($medium)." OR medium=0) AND (codec = ".sqlesc($codec)." OR codec = 0) AND (standard = ".sqlesc($standard)." OR standard = 0) AND (processing = ".sqlesc($processing)." OR processing = 0) AND (team = ".sqlesc($team)." OR team = 0) AND (audiocodec = ".sqlesc($audiocodec)." OR audiocodec = 0) LIMIT 1");
$sirow = mysql_fetch_array($res);
if (!$sirow)
$sirow = 'not allowed';
$Cache->cache_value('secondicon_'.$source.'_'.$medium.'_'.$codec.'_'.$standard.'_'.$processing.'_'.$team.'_'.$audiocodec.'_content', $sirow, 116400);
$Cache->cache_value($cacheKey, $sirow, 600);
}
$catimgurl = get_cat_folder($row['category']);
if ($sirow == 'not allowed')
return "<img src=\"pic/cattrans.gif\" style=\"background-image: url(pic/". $catimgurl. "additional/notallowed.png);\" alt=\"" . $sirow["name"] . "\" alt=\"Not Allowed\" />";
return "<img src=\"pic/cattrans.gif\" style=\"background-image: url(pic/". $catimgurl. "/additional/notallowed.png);\" title=\"Not Allowed\" alt=\"Not Allowed\" />";
else {
return "<img".($sirow['class_name'] ? " class=\"".$sirow['class_name']."\"" : "")." src=\"pic/cattrans.gif\" style=\"background-image: url(pic/". $catimgurl. "additional/". $sirow['image'].");\" alt=\"" . $sirow["name"] . "\" title=\"".$sirow['name']."\" />";
return "<img".($sirow['class_name'] ? " class=\"".$sirow['class_name']."\"" : "")." src=\"pic/cattrans.gif\" style=\"background-image: url(pic/". $catimgurl. "/additional/". $sirow['image'].");\" alt=\"" . $sirow["name"] . "\" title=\"".$sirow['name']."\" />";
}
}

Expand Down

0 comments on commit b926b4d

Please sign in to comment.