$id['id'] = array(); $id['tags'] = array(); $id['hash'] = array(); $search_tag = isset($_GET['q']) ? $_GET['q'] : ''; $pagenum = isset($_GET["pagenum"]) ? abs($_GET['pagenum'] - 1) : 0; $limit = $pics * $pagenum; if (!empty($search_tag)) { $search_tags = explode(" ", $search_tag); sort($search_tags); $search_tags = array_unique($search_tags); $title = htmlspecialchars(implode(' ', $search_tags), ENT_QUOTES); $search_tags = array_map('mysql_real_escape_string', $search_tags); $find_colors = "WHERE 1=1"; $count = count($search_tags); for ($i = 0; $i < $count; $i++) { if (iscolor($search_tags[$i])) { $find_colors .= " AND (i.primary_color = '" . $search_tags[$i] . "' OR i.secondary_color = '" . $search_tags[$i] . "' OR i.tertiary_color = '" . $search_tags[$i] . "')"; unset($search_tags[$i]); } } if (!empty($search_tags)) { $search_tag = "HAVING LOCATE('" . implode("', tags) > 0 AND LOCATE('", $search_tags) . "', tags) > 0 "; } else { $search_tag = ""; } } $page_title = "Viewing " . $title . " - " . SITE_NAME; $sql = "SELECT SQL_CALC_FOUND_ROWS i.id, i.hash, group_concat(t.tag " . $tags_id . " separator ',') AS tags, group_concat(t.count separator ',') AS counts, group_concat(t.type separator ',') AS types FROM `images` i LEFT OUTER JOIN `image_tags` s ON i.id = s.image_id LEFT OUTER JOIN `tags` t ON s.tag_id = t.id " . $find_colors . " GROUP BY i.id " . $search_tag . "ORDER BY i.id DESC LIMIT " . $limit . ", " . $pics; $get = mysql_query($sql); $sql = ""; while ($run = mysql_fetch_assoc($get)) {
$tag_feed = '<link rel="alternate" type="application/rss+xml" title="' . SITE_NAME . ' Feed For: ' . $search_tag . '" href="' . BASE_URL . '/feed/" />'; unset($search_tags[$i]); break; case eregi('parent:', $search_tags[$i]): $parent_post = str_replace('parent:', '', $search_tags[$i]); $find_colors .= " AND i.parent_post = " . $parent_post; unset($search_tags[$i]); break; case eregi('fav:', $search_tags[$i]): $fav_user = str_replace('fav:', '', $search_tags[$i]); $faves = "`favourites` f LEFT OUTER JOIN"; $faves_join = "ON `f`.`image_id` = `i`.`id`"; $find_colors .= " AND f.user_id = " . $fav_user; unset($search_tags[$i]); break; case iscolor($search_tags[$i]): $find_colors .= " AND (i.primary_color = '" . $search_tags[$i] . "')"; // OR i.secondary_color = '" . $search_tags[$i] . "' OR i.tertiary_color = '" . $search_tags[$i] . "')"; $tag_feed = '<link rel="alternate" type="application/rss+xml" title="' . SITE_NAME . ' Feed For: ' . $search_tag . '" href="' . BASE_URL . '/feed/" />'; unset($search_tags[$i]); break; } } if (!empty($search_tags)) { $search_tag = "HAVING FIND_IN_SET('" . implode("', tags) > 0 AND FIND_IN_SET('", $search_tags) . "', tags) > 0 "; } else { $search_tag = ""; } } if (!isset($order)) { $order = "ORDER BY i.id DESC";
{ if ($pos + 8 >= strlen($text)) { return false; } if ($text[$pos] == "`" && $text[$pos + 1] == "#") { $c1 = substr($text, $pos + 2, 2); $c2 = substr($text, $pos + 4, 2); $c3 = substr($text, $pos + 6, 2); $ret = array(hexdec($c1), hexdec($c2), hexdec($c3)); return $ret; } return false; } $col = $color_header_text; for ($i = 0; $i < $namelen; ++$i) { while ($c = iscolor($name, $i)) { $col = imagecolorallocate($image, $c[0], $c[1], $c[2]); $i += 8; } if ($i >= $namelen) { break; } $char = $name[$i]; list($cw) = get_text_metrics("./fonts/lucon.ttf", 10, 0, $char); imagettftext($image, 10, 0, $x, $y, $col, "./fonts/lucon.ttf", $char); $x += $cw + 1; } $box = imagettfbbox(10, 0, "./fonts/lucon.ttf", SITE_NAME); imagettftext($image, 10, 0, $image_width - ($box[2] + 7), 15, $color_header_text, "./fonts/lucon.ttf", SITE_NAME); $icon = imagecreatefromjpeg(GAME_ICON); imagecopy($image, $icon, $image_width - ($box[2] + 5) - 21, 2, 0, 0, 17, 17);