?> <div class="box box_image box_image_albumart box_albumart"><!-- .box_albumart deprecated --> <div class="head"><strong>Cover</strong></div> <div id="covers"> <div class="pad"> <?php if (!empty($Request['Image'])) { ?> <p align="center"><img style="width: 100%;" src="<?php echo ImageTools::process($Request['Image'], true); ?> " alt="<?php echo $FullName; ?> " onclick="lightbox.init('<?php echo ImageTools::process($Request['Image']); ?> ', 220);" /></p> <?php } else { ?> <p align="center"><img style="width: 100%;" src="<?php echo STATIC_SERVER; ?> common/noartwork/<?php echo $CategoryIcons[$Request['CategoryID'] - 1]; ?> " alt="<?php echo $CategoryName; ?> " class="tooltip" title="<?php
" class="tooltip <?php echo Format::css_category($GroupCategoryID); ?> <?php echo $TorrentTags->css_name(); ?> "> </div> </td> <td class="big_info"> <?php if ($LoggedUser['CoverArt']) { ?> <div class="group_image float_left clear"> <?php ImageTools::cover_thumb($WikiImage, $GroupCategoryID); ?> </div> <?php } ?> <div class="group_info clear"> <span> [ <a href="torrents.php?action=download&id=<?php echo $TorrentID; ?> &authkey=<?php echo $LoggedUser['AuthKey']; ?> &torrent_pass=<?php echo $LoggedUser['torrent_pass'];
// Validate the form if ($Properties['Remastered'] && !$Properties['RemasterYear']) { //Unknown Edit! if ($LoggedUser['ID'] == $UserID || check_perms('edit_unknowns')) { //Fine! } else { $Err = "You may not edit someone else's upload to unknown release."; } } // Strip out Amazon's padding $AmazonReg = '/(http:\\/\\/ecx.images-amazon.com\\/images\\/.+)(\\._.*_\\.jpg)/i'; $Matches = array(); if (preg_match($RegX, $Properties['Image'], $Matches)) { $Properties['Image'] = $Matches[1] . '.jpg'; } ImageTools::blacklisted($Properties['Image']); if ($Err) { // Show the upload form, with the data the user entered if (check_perms('site_debug')) { die($Err); } error($Err); } //******************************************************************************// //--------------- Make variables ready for database input ----------------------// // Shorten and escape $Properties for database input $T = array(); foreach ($Properties as $Key => $Value) { $T[$Key] = "'" . db_string(trim($Value)) . "'"; if (!$T[$Key]) { $T[$Key] = null;
$Err = 'You forgot to enter any bounty!'; } else { $Bounty = trim($_POST['amount']); if (!is_number($Bounty)) { $Err = 'Your entered bounty is not a number'; } elseif ($Bounty < 100 * 1024 * 1024) { $Err = 'Minimum bounty is 100 MB.'; } $Bytes = $Bounty; //From MB to B } } if (empty($_POST['image'])) { $Image = ''; } else { ImageTools::blacklisted($_POST['image']); if (preg_match('/' . IMAGE_REGEX . '/', trim($_POST['image'])) > 0) { $Image = trim($_POST['image']); } else { $Err = display_str($_POST['image']) . ' does not appear to be a valid link to an image.'; } } if (empty($_POST['description'])) { $Err = 'You forgot to enter a description.'; } else { $Description = trim($_POST['description']); } if ($CategoryName === 'Music') { if (empty($_POST['artists'])) { $Err = 'You did not enter any artists.'; } else {
public static function resizeImage($origin, $w, $h, $_options = array()) { $options = array_merge(array('resize' => self::PROPORTIONAL, 'destination' => $origin, 'action' => self::MOVE_ORIG_DEST, 'outputFormat' => self::SAME_AS_ORIGIN), $_options); if (!file_exists($origin)) { return false; } // read file $image_info = getimagesize($origin); $image_type = $image_info[2]; if ($image_info[0] > self::UPLOAD_MAX_WIDTH || $image_info[1] > self::UPLOAD_MAX_HEIGHT) { return "Exceeded maximum dimensions (" . self::UPLOAD_MAX_WIDTH . "x" . self::UPLOAD_MAX_HEIGHT . ")"; } if ($image_type == IMAGETYPE_JPEG) { $image = imagecreatefromjpeg($origin); $extOrig = 'jpg'; } elseif ($image_type == IMAGETYPE_GIF) { $image = imagecreatefromgif($origin); $extOrig = 'gif'; } elseif ($image_type == IMAGETYPE_PNG) { $image = imagecreatefrompng($origin); $extOrig = 'png'; } // destination file extension calculation $extDest = $options['outputFormat'] === self::SAME_AS_ORIGIN ? $extOrig : ImageTools::getExtension($options['destination']); // redimensionar $wimg = imagesx($image); $himg = imagesy($image); $resizeMode = $options['resize']; switch ($resizeMode) { case self::TO_HEIGHT: $ratio = $h / $himg; $height = $h; $width = $wimg * $ratio; break; case self::TO_WIDTH: $ratio = $w / $wimg; $width = $w; $height = $himg * $ratio; break; case self::EXACT_SIZE: $width = $w; $height = $h; break; case self::PROPORTIONAL: default: $ratioh = $h / $himg; $ratiow = $w / $wimg; $ratio = $ratioh > $ratiow ? $ratiow : $ratioh; $width = $wimg * $ratio; $height = $himg * $ratio; break; } // process $new_image = imagecreatetruecolor($width, $height); imagecopyresampled($new_image, $image, 0, 0, 0, 0, $width, $height, $wimg, $himg); imagedestroy($image); $destination = $options['destination']; if ($extDest == 'jpg' || $extDest == 'jpeg') { imagejpeg($new_image, $destination); } elseif ($extDest == 'gif') { imagegif($new_image, $destination); } elseif ($extDest == 'png') { imagepng($new_image, $destination); } chmod($destination, 0777); if ($options['action'] == self::MOVE_ORIG_DEST) { @unlink($origin); } imagedestroy($new_image); return true; }
private static function render_list($Url, $Name, $Image) { if (!empty($Image)) { $UseTooltipster = !isset(G::$LoggedUser['Tooltipster']) || G::$LoggedUser['Tooltipster']; $Image = ImageTools::process($Image); $Title = "title=\"<img class="large_tile" src="{$Image}" alt="" />\""; $Name = display_str($Name); ?> <li> <a class="tooltip_image" data-title-plain="<?php echo $Name; ?> " <?php echo $Title; ?> href="<?php echo $Url; echo $Name; ?> "><?php echo $Name; ?> </a> </li> <?php } }
} $UserID = $LoggedUser['ID']; $GroupID = db_string($_POST['groupid']); $Summaries = $_POST['summary']; $Images = $_POST['image']; $Time = sqltime(); if (!is_number($GroupID) || !$GroupID) { error(0); } if (count($Images) != count($Summaries)) { error('Missing an image or a summary'); } $Changed = false; for ($i = 0; $i < count($Images); $i++) { $Image = $Images[$i]; $Summary = $Summaries[$i]; if (ImageTools::blacklisted($Image, true) || !preg_match("/^" . IMAGE_REGEX . "\$/i", $Image)) { continue; } // sanitize inputs $Image = db_string($Image); $Summary = db_string($Summary); $DB->query("\n\t\tINSERT IGNORE INTO cover_art\n\t\t\t(GroupID, Image, Summary, UserID, Time)\n\t\tVALUES\n\t\t\t('{$GroupID}', '{$Image}', '{$Summary}', '{$UserID}', '{$Time}')"); if ($DB->affected_rows()) { $Changed = true; } } if ($Changed) { $Cache->delete_value("torrents_cover_art_{$GroupID}"); } header('Location: ' . $_SERVER['HTTP_REFERER']);
private static function to_html($Array) { global $SSL; self::$Levels++; /* * Hax prevention * That's the original comment on this. * Most likely this was implemented to avoid anyone nesting enough * elements to reach PHP's memory limit as nested elements are * solved recursively. * Original value of 10, it is now replaced in favor of * $MaximumNests. * If this line is ever executed then something is, infact * being haxed as the if before the block type switch for different * tags should always be limiting ahead of this line. * (Larger than vs. smaller than.) */ if (self::$Levels > self::$MaximumNests) { return $Block['Val']; // Hax prevention, breaks upon exceeding nests. } $Str = ''; foreach ($Array as $Block) { if (is_string($Block)) { $Str .= self::smileys($Block); continue; } if (self::$Levels < self::$MaximumNests) { switch ($Block['Type']) { case 'b': $Str .= '<strong>' . self::to_html($Block['Val']) . '</strong>'; break; case 'u': $Str .= '<span style="text-decoration: underline;">' . self::to_html($Block['Val']) . '</span>'; break; case 'i': $Str .= '<span style="font-style: italic;">' . self::to_html($Block['Val']) . "</span>"; break; case 's': $Str .= '<span style="text-decoration: line-through;">' . self::to_html($Block['Val']) . '</span>'; break; case 'important': $Str .= '<strong class="important_text">' . self::to_html($Block['Val']) . '</strong>'; break; case 'user': $Str .= '<a href="user.php?action=search&search=' . urlencode($Block['Val']) . '">' . $Block['Val'] . '</a>'; break; case 'artist': $Str .= '<a href="artist.php?artistname=' . urlencode(Format::undisplay_str($Block['Val'])) . '">' . $Block['Val'] . '</a>'; break; case 'rule': $Rule = trim(strtolower($Block['Val'])); if ($Rule[0] != 'r' && $Rule[0] != 'h') { $Rule = 'r' . $Rule; } $Str .= '<a href="rules.php?p=upload#' . urlencode(Format::undisplay_str($Rule)) . '">' . preg_replace('/[aA-zZ]/', '', $Block['Val']) . '</a>'; break; case 'torrent': $Pattern = '/(' . NONSSL_SITE_URL . '\\/torrents\\.php.*[\\?&]id=)?(\\d+)($|&|\\#).*/i'; $Matches = array(); if (preg_match($Pattern, $Block['Val'], $Matches)) { if (isset($Matches[2])) { $GroupID = $Matches[2]; $Groups = Torrents::get_groups(array($GroupID), true, true, false); if ($Groups[$GroupID]) { $Group = $Groups[$GroupID]; $Str .= Artists::display_artists($Group['ExtendedArtists']) . '<a href="torrents.php?id=' . $GroupID . '">' . $Group['Name'] . '</a>'; } else { $Str .= '[torrent]' . str_replace('[inlineurl]', '', $Block['Val']) . '[/torrent]'; } } } else { $Str .= '[torrent]' . str_replace('[inlineurl]', '', $Block['Val']) . '[/torrent]'; } break; case 'wiki': $Str .= '<a href="wiki.php?action=article&name=' . urlencode($Block['Val']) . '">' . $Block['Val'] . '</a>'; break; case 'tex': $Str .= '<img style="vertical-align: middle;" src="' . STATIC_SERVER . 'blank.gif" onload="if (this.src.substr(this.src.length - 9, this.src.length) == \'blank.gif\') { this.src = \'https://chart.googleapis.com/chart?cht=tx&chf=bg,s,FFFFFF00&chl=' . urlencode(mb_convert_encoding($Block['Val'], 'UTF-8', 'HTML-ENTITIES')) . '&chco=\' + hexify(getComputedStyle(this.parentNode, null).color); }" alt="' . $Block['Val'] . '" />'; break; case 'plain': $Str .= $Block['Val']; break; case 'pre': $Str .= '<pre>' . $Block['Val'] . '</pre>'; break; case 'code': $Str .= '<code>' . $Block['Val'] . '</code>'; break; case 'list': $Str .= "<{$Block['ListType']} class=\"postlist\">"; foreach ($Block['Val'] as $Line) { $Str .= '<li>' . self::to_html($Line) . '</li>'; } $Str .= '</' . $Block['ListType'] . '>'; break; case 'align': $ValidAttribs = array('left', 'center', 'right'); if (!in_array($Block['Attr'], $ValidAttribs)) { $Str .= '[align=' . $Block['Attr'] . ']' . self::to_html($Block['Val']) . '[/align]'; } else { $Str .= '<div style="text-align: ' . $Block['Attr'] . ';">' . self::to_html($Block['Val']) . '</div>'; } break; case 'color': case 'colour': $ValidAttribs = array('aqua', 'black', 'blue', 'fuchsia', 'green', 'grey', 'lime', 'maroon', 'navy', 'olive', 'purple', 'red', 'silver', 'teal', 'white', 'yellow'); if (!in_array($Block['Attr'], $ValidAttribs) && !preg_match('/^#[0-9a-f]{6}$/', $Block['Attr'])) { $Str .= '[color=' . $Block['Attr'] . ']' . self::to_html($Block['Val']) . '[/color]'; } else { $Str .= '<span style="color: ' . $Block['Attr'] . ';">' . self::to_html($Block['Val']) . '</span>'; } break; case 'headline': $text = self::to_html($Block['Val']); $raw = self::raw_text($Block['Val']); if (!in_array($Block['Attr'], self::$HeadlineLevels)) { $Str .= sprintf('%1$s%2$s%1$s', str_repeat('=', $Block['Attr'] + 1), $text); } else { $id = '_' . crc32($raw . self::$HeadlineID); if (self::$InQuotes === 0) { self::$Headlines[] = array($Block['Attr'], $raw, $id); } $Str .= sprintf('<h%1$d id="%3$s">%2$s</h%1$d>', $Block['Attr'] + 2, $text, $id); self::$HeadlineID++; } break; case 'inlinesize': case 'size': $ValidAttribs = array('1', '2', '3', '4', '5', '6', '7', '8', '9', '10'); if (!in_array($Block['Attr'], $ValidAttribs)) { $Str .= '[size=' . $Block['Attr'] . ']' . self::to_html($Block['Val']) . '[/size]'; } else { $Str .= '<span class="size' . $Block['Attr'] . '">' . self::to_html($Block['Val']) . '</span>'; } break; case 'quote': self::$NoImg++; // No images inside quote tags self::$InQuotes++; if (self::$InQuotes == self::$NestsBeforeHide) { //Put quotes that are nested beyond the specified limit in [hide] tags. $Str .= '<strong>Older quotes</strong>: <a href="javascript:void(0);" onclick="BBCode.spoiler(this);">Show</a>'; $Str .= '<blockquote class="hidden spoiler">'; } if (!empty($Block['Attr'])) { $Exploded = explode('|', self::to_html($Block['Attr'])); if (isset($Exploded[1]) && (is_numeric($Exploded[1]) || in_array($Exploded[1][0], array('a', 't', 'c', 'r')) && is_numeric(substr($Exploded[1], 1)))) { // the part after | is either a number or starts with a, t, c or r, followed by a number (forum post, artist comment, torrent comment, collage comment or request comment, respectively) $PostID = trim($Exploded[1]); $Str .= '<a href="#" onclick="QuoteJump(event, \'' . $PostID . '\'); return false;"><strong class="quoteheader">' . $Exploded[0] . '</strong> wrote: </a>'; } else { $Str .= '<strong class="quoteheader">' . $Exploded[0] . '</strong> wrote: '; } } $Str .= '<blockquote>' . self::to_html($Block['Val']) . '</blockquote>'; if (self::$InQuotes == self::$NestsBeforeHide) { //Close quote the deeply nested quote [hide]. $Str .= '</blockquote><br />'; // Ensure new line after quote train hiding } self::$NoImg--; self::$InQuotes--; break; case 'hide': $Str .= '<strong>' . ($Block['Attr'] ? $Block['Attr'] : 'Hidden text') . '</strong>: <a href="javascript:void(0);" onclick="BBCode.spoiler(this);">Show</a>'; $Str .= '<blockquote class="hidden spoiler">' . self::to_html($Block['Val']) . '</blockquote>'; break; case 'mature': if (G::$LoggedUser['EnableMatureContent']) { if (!empty($Block['Attr'])) { $Str .= '<strong class="mature" style="font-size: 1.2em;">Mature content:</strong><strong> ' . $Block['Attr'] . '</strong><br /> <a href="javascript:void(0);" onclick="BBCode.spoiler(this);">Show</a>'; $Str .= '<blockquote class="hidden spoiler">' . self::to_html($Block['Val']) . '</blockquote>'; } else { $Str .= '<strong>Use of the [mature] tag requires a description.</strong> The correct format is as follows: <strong>[mature=description] ...content... [/mature]</strong>, where "description" is a mandatory description of the post. Misleading descriptions will be penalized. For further information on our mature content policies, please refer to this <a href="wiki.php?action=article&id=1063">wiki</a>.'; } } else { $Str .= '<span class="mature_blocked" style="font-style: italic;"><a href="wiki.php?action=article&id=1063">Mature content</a> has been blocked. You can choose to view mature content by editing your <a href="user.php?action=edit&userid=' . G::$LoggedUser['ID'] . '">settings</a>.</span>'; } break; case 'img': if (self::$NoImg > 0 && self::valid_url($Block['Val'])) { $Str .= '<a rel="noreferrer" target="_blank" href="' . $Block['Val'] . '">' . $Block['Val'] . '</a> (image)'; break; } if (!self::valid_url($Block['Val'], '\\.(jpe?g|gif|png|bmp|tiff)')) { $Str .= '[img]' . $Block['Val'] . '[/img]'; } else { $LocalURL = self::local_url($Block['Val']); if ($LocalURL) { $Str .= '<img class="scale_image" onclick="lightbox.init(this, $(this).width());" alt="' . $Block['Val'] . '" src="' . $LocalURL . '" />'; } else { $Str .= '<img class="scale_image" onclick="lightbox.init(this, $(this).width());" alt="' . $Block['Val'] . '" src="' . ImageTools::process($Block['Val']) . '" />'; } } break; case 'aud': if (self::$NoImg > 0 && self::valid_url($Block['Val'])) { $Str .= '<a rel="noreferrer" target="_blank" href="' . $Block['Val'] . '">' . $Block['Val'] . '</a> (audio)'; break; } if (!self::valid_url($Block['Val'], '\\.(mp3|ogg|wav)')) { $Str .= '[aud]' . $Block['Val'] . '[/aud]'; } else { //TODO: Proxy this for staff? $Str .= '<audio controls="controls" src="' . $Block['Val'] . '"><a rel="noreferrer" target="_blank" href="' . $Block['Val'] . '">' . $Block['Val'] . '</a></audio>'; } break; case 'url': // Make sure the URL has a label if (empty($Block['Val'])) { $Block['Val'] = $Block['Attr']; $NoName = true; // If there isn't a Val for this } else { $Block['Val'] = self::to_html($Block['Val']); $NoName = false; } if (!self::valid_url($Block['Attr'])) { $Str .= '[url=' . $Block['Attr'] . ']' . $Block['Val'] . '[/url]'; } else { $LocalURL = self::local_url($Block['Attr']); if ($LocalURL) { if ($NoName) { $Block['Val'] = substr($LocalURL, 1); } $Str .= '<a href="' . $LocalURL . '">' . $Block['Val'] . '</a>'; } else { $Str .= '<a rel="noreferrer" target="_blank" href="' . $Block['Attr'] . '">' . $Block['Val'] . '</a>'; } } break; case 'inlineurl': if (!self::valid_url($Block['Attr'], '', true)) { $Array = self::parse($Block['Attr']); $Block['Attr'] = $Array; $Str .= self::to_html($Block['Attr']); } else { $LocalURL = self::local_url($Block['Attr']); if ($LocalURL) { $Str .= '<a href="' . $LocalURL . '">' . substr($LocalURL, 1) . '</a>'; } else { $Str .= '<a rel="noreferrer" target="_blank" href="' . $Block['Attr'] . '">' . $Block['Attr'] . '</a>'; } } break; } } } self::$Levels--; return $Str; }
$ArtistTable .= ob_get_clean(); ob_start(); ?> <li class="image_group_<?php echo $Artist['ArtistID']; ?> "> <a href="artist.php?id=<?php echo $Artist['ArtistID']; ?> "> <?php if ($Artist['Image']) { ?> <img class="tooltip" src="<?php echo ImageTools::process($Artist['Image'], true); ?> " alt="<?php echo $Artist['Name']; ?> " title="<?php echo $Artist['Name']; ?> " width="118" /> <?php } else { ?> <span style="width: 107px; padding: 5px;"><?php echo $Artist['Name']; ?> </span>
// Create Defined Thumbnail 2 if ($thumbnail2 = $album['Thumbnail2Size']) { $thumbnail2 = explode("x", $thumbnail2); if ($thumbnail2[0] > 0 && $thumbnail2[1] > 0) { $th2_pref_size = getPreferedSize($thumbnail2[0], $thumbnail2[1], $imagesize[0], $imagesize[1]); $thumbnail2_create = new ImageTools($upload_file_path); $thumbnail2_create->resizeNewByWidth($thumbnail2[0], $thumbnail2[1], $th2_pref_size[0], "#FFF"); $thumbnail2_create->save($album_path, "th2_{$new_name}", 100, true); } } // Create Defined Thumbnail 3 if ($thumbnail3 = $album['Thumbnail3Size']) { $thumbnail3 = explode("x", $thumbnail3); if ($thumbnail3[0] > 0 && $thumbnail3[1] > 0) { $th3_pref_size = getPreferedSize($thumbnail3[0], $thumbnail3[1], $imagesize[0], $imagesize[1]); $thumbnail3_create = new ImageTools($upload_file_path); $thumbnail3_create->resizeNewByWidth($thumbnail3[0], $thumbnail3[1], $th3_pref_size[0], "#FFF"); $thumbnail3_create->save($album_path, "th3_{$new_name}", 100, true); } } addImage($album_id, $upload_file_path); $last_id = mysql_insert_id(); $image = getImage($last_id); $image['errors'] = false; $image['thumbnailUrl'] = dirname($image['ImagePath']) . '/th_' . basename($image['ImagePath']); $json = json_encode($image); echo $json; } else { echo json_encode(array("errors" => "AlbumNotExists")); } } else {
</td> <td><?php echo time_diff($User['DonationTime']); ?> </td> <td style="word-wrap: break-word;"> <?php echo $User['IconMouseOverText']; ?> </td> <td style="word-wrap: break-word;"> <?php if (!empty($User['CustomIcon'])) { ?> <img src="<?php echo ImageTools::process($User['CustomIcon'], false, 'donoricon', $User['UserID']); ?> " width="15" height="13" alt="" /> <?php } ?> </td> <td style="word-wrap: break-word;"> <?php echo $User['CustomIconLink']; ?> </td> <td style="word-wrap: break-word;"> <?php echo $User['AvatarMouseOverText']; ?>
function generate_torrent_table($Caption, $Tag, $Details, $Limit) { global $LoggedUser, $Categories, $ReleaseTypes, $GroupBy; ?> <h3>Top <?php echo "{$Limit} {$Caption}"; if (empty($_GET['advanced'])) { ?> <small class="top10_quantity_links"> <?php switch ($Limit) { case 100: ?> - <a href="top10.php?details=<?php echo $Tag; ?> " class="brackets">Top 10</a> - <span class="brackets">Top 100</span> - <a href="top10.php?type=torrents&limit=250&details=<?php echo $Tag; ?> " class="brackets">Top 250</a> <?php break; case 250: ?> - <a href="top10.php?details=<?php echo $Tag; ?> " class="brackets">Top 10</a> - <a href="top10.php?type=torrents&limit=100&details=<?php echo $Tag; ?> " class="brackets">Top 100</a> - <span class="brackets">Top 250</span> <?php break; default: ?> - <span class="brackets">Top 10</span> - <a href="top10.php?type=torrents&limit=100&details=<?php echo $Tag; ?> " class="brackets">Top 100</a> - <a href="top10.php?type=torrents&limit=250&details=<?php echo $Tag; ?> " class="brackets">Top 250</a> <?php } ?> </small> <?php } ?> </h3> <table class="torrent_table cats numbering border"> <tr class="colhead"> <td class="center" style="width: 15px;"></td> <td class="cats_col"></td> <td>Name</td> <td style="text-align: right;">Size</td> <td style="text-align: right;">Data</td> <td style="text-align: right;" class="sign snatches"><img src="static/styles/<?php echo $LoggedUser['StyleName']; ?> /images/snatched.png" alt="Snatches" title="Snatches" class="tooltip" /></td> <td style="text-align: right;" class="sign seeders"><img src="static/styles/<?php echo $LoggedUser['StyleName']; ?> /images/seeders.png" alt="Seeders" title="Seeders" class="tooltip" /></td> <td style="text-align: right;" class="sign leechers"><img src="static/styles/<?php echo $LoggedUser['StyleName']; ?> /images/leechers.png" alt="Leechers" title="Leechers" class="tooltip" /></td> <td style="text-align: right;">Peers</td> </tr> <?php // Server is already processing a top10 query. Starting another one will make things slow if ($Details === false) { ?> <tr class="rowb"> <td colspan="9" class="center"> Server is busy processing another top list request. Please try again in a minute. </td> </tr> </table><br /> <?php return; } // in the unlikely event that query finds 0 rows... if (empty($Details)) { ?> <tr class="rowb"> <td colspan="9" class="center"> Found no torrents matching the criteria. </td> </tr> </table><br /> <?php return; } $Rank = 0; foreach ($Details as $Detail) { $GroupIDs[] = $Detail[1]; } $Artists = Artists::get_artists($GroupIDs); foreach ($Details as $Detail) { list($TorrentID, $GroupID, $GroupName, $GroupCategoryID, $WikiImage, $TagsList, $Format, $Encoding, $Media, $Scene, $HasLog, $HasCue, $LogScore, $Year, $GroupYear, $RemasterTitle, $Snatched, $Seeders, $Leechers, $Data, $ReleaseType, $Size) = $Detail; $IsBookmarked = Bookmarks::has_bookmarked('torrent', $GroupID); $IsSnatched = Torrents::has_snatched($TorrentID); // highlight every other row $Rank++; $Highlight = $Rank % 2 ? 'a' : 'b'; // generate torrent's title $DisplayName = ''; if (!empty($Artists[$GroupID])) { $DisplayName = Artists::display_artists($Artists[$GroupID], true, true); } $DisplayName .= "<a href=\"torrents.php?id={$GroupID}&torrentid={$TorrentID}\" class=\"tooltip\" title=\"View torrent\" dir=\"ltr\">{$GroupName}</a>"; if ($GroupCategoryID == 1 && $GroupYear > 0) { $DisplayName .= " [{$GroupYear}]"; } if ($GroupCategoryID == 1 && $ReleaseType > 0) { $DisplayName .= ' [' . $ReleaseTypes[$ReleaseType] . ']'; } // append extra info to torrent title $ExtraInfo = ''; $AddExtra = ''; if (empty($GroupBy)) { if ($Format) { $ExtraInfo .= $Format; $AddExtra = ' / '; } if ($Encoding) { $ExtraInfo .= $AddExtra . $Encoding; $AddExtra = ' / '; } // "FLAC / Lossless / Log (100%) / Cue / CD"; if ($HasLog) { $ExtraInfo .= $AddExtra . 'Log (' . $LogScore . '%)'; $AddExtra = ' / '; } if ($HasCue) { $ExtraInfo .= $AddExtra . 'Cue'; $AddExtra = ' / '; } if ($Media) { $ExtraInfo .= $AddExtra . $Media; $AddExtra = ' / '; } if ($Scene) { $ExtraInfo .= $AddExtra . 'Scene'; $AddExtra = ' / '; } if ($Year > 0) { $ExtraInfo .= $AddExtra . $Year; $AddExtra = ' '; } if ($RemasterTitle) { $ExtraInfo .= $AddExtra . $RemasterTitle; } if ($IsSnatched) { if ($GroupCategoryID == 1) { $ExtraInfo .= ' / '; } $ExtraInfo .= Format::torrent_label('Snatched!'); } if ($ExtraInfo != '') { $ExtraInfo = "- [{$ExtraInfo}]"; } } $TorrentTags = new Tags($TagsList); //Get report info, use the cache if available, if not, add to it. $Reported = false; $Reports = Torrents::get_reports($TorrentID); if (count($Reports) > 0) { $Reported = true; } // print row ?> <tr class="torrent row<?php echo $Highlight . ($IsBookmarked ? ' bookmarked' : '') . ($IsSnatched ? ' snatched_torrent' : ''); ?> "> <td style="padding: 8px; text-align: center;"><strong><?php echo $Rank; ?> </strong></td> <td class="center cats_col"><div title="<?php echo $TorrentTags->title(); ?> " class="tooltip <?php echo Format::css_category($GroupCategoryID); ?> <?php echo $TorrentTags->css_name(); ?> "></div></td> <td class="big_info"> <?php if ($LoggedUser['CoverArt']) { ?> <div class="group_image float_left clear"> <?php ImageTools::cover_thumb($WikiImage, $GroupCategoryID); ?> </div> <?php } ?> <div class="group_info clear"> <span><a href="torrents.php?action=download&id=<?php echo $TorrentID; ?> &authkey=<?php echo $LoggedUser['AuthKey']; ?> &torrent_pass=<?php echo $LoggedUser['torrent_pass']; ?> " title="Download" class="brackets tooltip">DL</a></span> <strong><?php echo $DisplayName; ?> </strong> <?php echo $ExtraInfo; if ($Reported) { ?> - <strong class="torrent_label tl_reported">Reported</strong><?php } if ($IsBookmarked) { ?> <span class="remove_bookmark float_right"> <a href="#" id="bookmarklink_torrent_<?php echo $GroupID; ?> " class="bookmarklink_torrent_<?php echo $GroupID; ?> brackets" onclick="Unbookmark('torrent', <?php echo $GroupID; ?> , 'Bookmark'); return false;">Remove bookmark</a> </span> <?php } else { ?> <span class="add_bookmark float_right"> <a href="#" id="bookmarklink_torrent_<?php echo $GroupID; ?> " class="bookmarklink_torrent_<?php echo $GroupID; ?> brackets" onclick="Bookmark('torrent', <?php echo $GroupID; ?> , 'Remove bookmark'); return false;">Bookmark</a> </span> <?php } ?> <div class="tags"><?php echo $TorrentTags->format(); ?> </div> </div> </td> <td class="number_column nobr"><?php echo Format::get_size($Size); ?> </td> <td class="number_column nobr"><?php echo Format::get_size($Data); ?> </td> <td class="number_column"><?php echo number_format((double) $Snatched); ?> </td> <td class="number_column"><?php echo number_format((double) $Seeders); ?> </td> <td class="number_column"><?php echo number_format((double) $Leechers); ?> </td> <td class="number_column"><?php echo number_format($Seeders + $Leechers); ?> </td> </tr> <?php } //foreach ($Details as $Detail) ?> </table><br /> <?php }
?> </a> </div> <div class="center pad"> <a href="torrents.php?id=<?php echo $FeaturedAlbum['GroupID']; ?> " class="tooltip" title="<?php echo Artists::display_artists($Artists, false, false); ?> - <?php echo $FeaturedAlbum['Name']; ?> "> <img src="<?php echo ImageTools::process($FeaturedAlbum['WikiImage'], true); ?> " alt="<?php echo Artists::display_artists($Artists, false, false); ?> - <?php echo $FeaturedAlbum['Name']; ?> " width="100%" /> </a> </div> <div class="center pad"> <a href="forums.php?action=viewthread&threadid=<?php echo $FeaturedAlbum['ThreadID']; ?> "><em>Read the interview with the artist, discuss here</em></a>
/** * Add Watermark as Image * * @param $image_path - Image path to place as watermark on image * @param $vertical_position - Set vertical position of the text that will be placed on image * @param $horizontal_position - Set horizonal position of the text that will be placed on image * @param $margin - Margin text by spacing from corners * @return void */ public function addWatermarkImage($image_path, $vertical_position, $horizontal_position, $margin = 5) { if (file_exists($image_path)) { $valid_vpositions = array(self::IMAGE_POSITION_TOP, self::IMAGE_POSITION_CENTER, self::IMAGE_POSITION_BOTTOM); $valid_hpositions = array(self::IMAGE_POSITION_LEFT, self::IMAGE_POSITION_CENTER, self::IMAGE_POSITION_RIGHT); $watermark = new ImageTools($image_path); if (in_array($vertical_position, $valid_vpositions, true) && in_array($horizontal_position, $valid_hpositions, true)) { $x_padd = 0; $y_padd = 0; $w_width = $watermark->getX(); $w_height = $watermark->getY(); $im_width = $this->getX(); $im_height = $this->getY(); // Set X-Position if ($horizontal_position == self::IMAGE_POSITION_LEFT) { $x_padd = $margin; } else { if ($horizontal_position == self::IMAGE_POSITION_CENTER) { $x_padd = floor($im_width / 2) - floor($w_width / 2); } else { $x_padd = $im_width - $w_width - $margin; } } // Set Y-Position if ($vertical_position == self::IMAGE_POSITION_CENTER) { $y_padd = floor($im_height / 2) - floor($w_height / 2); } else { if ($vertical_position == self::IMAGE_POSITION_BOTTOM) { $y_padd = $im_height - floor($w_height) - $margin; } else { $y_padd += $margin; } } imagecopy($this->im, $watermark->getIm(), $x_padd, $y_padd, 0, 0, imagesx($watermark->getIm()), imagesy($watermark->getIm())); //$watermark->destroy(); } else { $this->parseError("Invalid Watermark image position!"); } } else { $this->parseError("Invalid image path!"); } }
$Tags = display_str($TorrentTags->format()); $PlainTags = implode(', ', $TorrentTags->get_tags()); ?> <li class="image_group_<?php echo $GroupID; ?> "> <a href="torrents.php?id=<?php echo $GroupID; ?> "> <?php if ($WikiImage) { ?> <img class="tooltip_interactive" src="<?php echo ImageTools::process($WikiImage, true); ?> " alt="<?php echo $DisplayName; ?> " title="<?php echo $DisplayName; ?> <br /> <?php echo $Tags; ?> " data-title-plain="<?php echo "{$DisplayName} ({$PlainTags})"; ?> " width="118" /> <?php
/** * Generate HTML for a user's avatar or just return the avatar URL * @param unknown $Avatar * @param unknown $UserID * @param unknown $Username * @param unknown $Setting * @param number $Size * @param string $ReturnHTML * @return string */ public static function show_avatar($Avatar, $UserID, $Username, $Setting, $Size = 150, $ReturnHTML = True) { $Avatar = ImageTools::process($Avatar, false, 'avatar', $UserID); $Style = 'style="max-height: 400px;"'; $AvatarMouseOverText = ''; $SecondAvatar = ''; $Class = 'class="double_avatar"'; $EnabledRewards = Donations::get_enabled_rewards($UserID); if ($EnabledRewards['HasAvatarMouseOverText']) { $Rewards = Donations::get_rewards($UserID); $AvatarMouseOverText = $Rewards['AvatarMouseOverText']; } if (!empty($AvatarMouseOverText)) { $AvatarMouseOverText = "title=\"{$AvatarMouseOverText}\" alt=\"{$AvatarMouseOverText}\""; } else { $AvatarMouseOverText = "alt=\"{$Username}'s avatar\""; } if ($EnabledRewards['HasSecondAvatar'] && !empty($Rewards['SecondAvatar'])) { $SecondAvatar = ' data-gazelle-second-avatar="' . ImageTools::process($Rewards['SecondAvatar'], false, 'avatar2', $UserID) . '"'; } // case 1 is avatars disabled switch ($Setting) { case 0: if (!empty($Avatar)) { $ToReturn = $ReturnHTML ? "<div><img src=\"{$Avatar}\" width=\"{$Size}\" {$Style} {$AvatarMouseOverText}{$SecondAvatar} {$Class} /></div>" : $Avatar; } else { $URL = STATIC_SERVER . 'common/avatars/default.png'; $ToReturn = $ReturnHTML ? "<div><img src=\"{$URL}\" width=\"{$Size}\" {$Style} {$AvatarMouseOverText}{$SecondAvatar} /></div>" : $URL; } break; case 2: $ShowAvatar = true; // Fallthrough // Fallthrough case 3: switch (G::$LoggedUser['Identicons']) { case 0: $Type = 'identicon'; break; case 1: $Type = 'monsterid'; break; case 2: $Type = 'wavatar'; break; case 3: $Type = 'retro'; break; case 4: $Type = '1'; $Robot = true; break; case 5: $Type = '2'; $Robot = true; break; case 6: $Type = '3'; $Robot = true; break; default: $Type = 'identicon'; } $Rating = 'pg'; if (!$Robot) { $URL = 'https://secure.gravatar.com/avatar/' . md5(strtolower(trim($Username))) . "?s={$Size}&d={$Type}&r={$Rating}"; } else { $URL = 'https://robohash.org/' . md5($Username) . "?set=set{$Type}&size={$Size}x{$Size}"; } if ($ShowAvatar == true && !empty($Avatar)) { $ToReturn = $ReturnHTML ? "<div><img src=\"{$Avatar}\" width=\"{$Size}\" {$Style} {$AvatarMouseOverText}{$SecondAvatar} {$Class} /></div>" : $Avatar; } else { $ToReturn = $ReturnHTML ? "<div><img src=\"{$URL}\" width=\"{$Size}\" {$Style} {$AvatarMouseOverText}{$SecondAvatar} {$Class} /></div>" : $URL; } break; default: $URL = STATIC_SERVER . 'common/avatars/default.png'; $ToReturn = $ReturnHTML ? "<div><img src=\"{$URL}\" width=\"{$Size}\" {$Style} {$AvatarMouseOverText}{$SecondAvatar} {$Class}/></div>" : $URL; } return $ToReturn; }
$Group = Torrents::get_groups(array($C['GroupID']), true, true, false); extract(Torrents::array_group($Group[$C['GroupID']])); $Name = ''; $Name .= Artists::display_artists(array('1' => $Artists), false, true); $Name .= $GroupName; ?> <td> <a href="torrents.php?id=<?php echo $GroupID; ?> "> <img class="tooltip" title="<?php echo $Name; ?> " src="<?php echo ImageTools::process($C['WikiImage'], true); ?> " alt="<?php echo $Name; ?> " width="107" /> </a> </td> <?php } ?> </tr> </table> <?php $FirstCol = false; }
<div title="<?php echo $TorrentTags->title(); ?> " class="tooltip <?php echo Format::css_category($CategoryID); ?> <?php echo $TorrentTags->css_name(); ?> "></div> </td> <td class="big_info"> <? if ($LoggedUser['CoverArt']) { ?> <div class="group_image float_left clear"> <?php echo ImageTools::cover_thumb($GroupInfo['WikiImage'], $CategoryID); ?> </div> <? } ?> <div class="group_info clear"> <span> [ <a href="torrents.php?action=download&id=<?php echo $TorrentID; ?> &authkey=<?php echo $LoggedUser['AuthKey']; ?> &torrent_pass=<?php echo $LoggedUser['torrent_pass']; ?> " class="tooltip" title="Download">DL</a>
$dheight = (int) $dinfo['height'] * $calc; $paddingx = (int) ($width - $dwidth) / 2; $paddingy = (int) ($height - $dheight) / 2; imagecopyresampled($tim, $dim, $paddingx, $paddingy, 0, 0, $dwidth, $dheight, $dinfo['width'], $dinfo['height']); // 保存图片 if (!$save) { $save = $dst; unlink($dst); } $createfunc = 'image' . $dinfo['ext']; $createfunc($tim, $save); imagedestroy($dim); imagedestroy($tim); return true; } } /* echo '<pre>'; print_r(ImageTools::imageInfo('./fly.jpg')); echo '</pre>'; */ /* echo ImageTools::water('./motox.jpg', './fly.png', './temp/test01.jpg', 0)?'Ok':'Faild'; echo ImageTools::water('./motox.jpg', './fly.png', './temp/test02.jpg', 1)?'Ok':'Faild'; echo ImageTools::water('./motox.jpg', './fly.png', './temp/test03.jpg', 2)?'Ok':'Faild'; echo ImageTools::water('./motox.jpg', './fly.png', './temp/test04.jpg', 3)?'Ok':'Faild'; */ echo ImageTools::thumb('./motox.jpg', './temp/motox_thumb1.jpg', 200, 200) ? 'OK' : 'Faild'; echo ImageTools::thumb('./motox.jpg', './temp/motox_thumb2.jpg', 200, 300) ? 'OK' : 'Faild'; echo ImageTools::thumb('./motox.jpg', './temp/motox_thumb3.jpg', 300, 200) ? 'OK' : 'Faild'; echo '<h3>程序运行结束!</h3>';
if (check_perms('artist_edit_vanityhouse')) { $VanityHouse = isset($_POST['vanity_house']) ? 1 : 0; } if ($_GET['action'] === 'revert') { // if we're reverting to a previous revision authorize(); $RevisionID = $_GET['revisionid']; if (!is_number($RevisionID)) { error(0); } } else { // with edit, the variables are passed with POST $Body = db_string($_POST['body']); $Summary = db_string($_POST['summary']); $Image = db_string($_POST['image']); ImageTools::blacklisted($Image); // Trickery if (!preg_match("/^" . IMAGE_REGEX . "\$/i", $Image)) { $Image = ''; } } // Insert revision if (!$RevisionID) { // edit $DB->query("\n\t\tINSERT INTO wiki_artists\n\t\t\t(PageID, Body, Image, UserID, Summary, Time)\n\t\tVALUES\n\t\t\t('{$ArtistID}', '{$Body}', '{$Image}', '{$UserID}', '{$Summary}', '" . sqltime() . "')"); } else { // revert $DB->query("\n\t\tINSERT INTO wiki_artists (PageID, Body, Image, UserID, Summary, Time)\n\t\tSELECT '{$ArtistID}', Body, Image, '{$UserID}', 'Reverted to revision {$RevisionID}', '" . sqltime() . "'\n\t\tFROM wiki_artists\n\t\tWHERE RevisionID = '{$RevisionID}'"); } $RevisionID = $DB->inserted_id(); // Update artists table (technically, we don't need the RevisionID column, but we can use it for a join which is nice and fast)
?> </td> </tr> <?php } if ($Images) { ?> <tr> <td class="label">Relevant images:</td> <td colspan="3"> <?php $Images = explode(' ', $Images); foreach ($Images as $Image) { ?> <img style="max-width: 200px;" onclick="lightbox.init(this, 200);" src="<?php echo ImageTools::process($Image); ?> " alt="Relevant image" /> <?php } ?> </td> </tr> <?php } ?> <tr> <td class="label">User comment:</td> <td colspan="3"><?php echo Text::full_format($UserComment); ?>
WHERE Ended = 0'); $FeaturedMerch = $DB->next_record(MYSQLI_ASSOC); $Cache->cache_value('featured_merch', $FeaturedMerch, 0); } if ($FeaturedMerch != null) { ?> <div id="merchbox" class="box"> <div class="head colhead_dark"> <strong>Featured Product</strong> </div> <div class="center pad"> <a href="http://anonym.to/?<?php echo $FeaturedMerchURL . $FeaturedMerch['ProductID']; ?> "><img src="<?php echo ImageTools::process($FeaturedMerch['Image']); ?> " width="100%" alt="Featured Product Image" /></a> </div> <div class="center pad"> <a href="http://anonym.to/?<?php echo $FeaturedMerchURL . $FeaturedMerch['ProductID']; ?> "><em>Product Page</em></a> <?php if ($FeaturedMerch['ArtistID'] > 0) { $UserInfo = Users::user_info($FeaturedMerch['ArtistID']); ?> - Artist: <a href="user.php?id=<?php echo $FeaturedMerch['ArtistID']; ?>