function get_torrent_info($TorrentID, $Return = true, $RevisionID = 0, $PersonalProperties = true, $ApiCall = false) { global $Cache, $DB; $GroupID = (int) torrentid_to_groupid($TorrentID); $GroupInfo = get_group_info($GroupID, $Return, $RevisionID, $PersonalProperties, $ApiCall); if ($GroupInfo) { foreach ($GroupInfo[1] as &$Torrent) { //Remove unneeded entries if ($Torrent['ID'] != $TorrentID) { unset($GroupInfo[1][$Torrent['ID']]); } if ($Return) { return $GroupInfo; } } } else { if ($Return) { return null; } } }
<?php authorize(); require SERVER_ROOT . '/sections/torrents/functions.php'; $GroupAllowed = array('WikiBody', 'WikiImage', 'ID', 'Name', 'Year', 'RecordLabel', 'CatalogueNumber', 'ReleaseType', 'CategoryID', 'Time', 'VanityHouse'); $TorrentAllowed = array('ID', 'Media', 'Format', 'Encoding', 'Remastered', 'RemasterYear', 'RemasterTitle', 'RemasterRecordLabel', 'RemasterCatalogueNumber', 'Scene', 'HasLog', 'HasCue', 'LogScore', 'FileCount', 'Size', 'Seeders', 'Leechers', 'Snatched', 'FreeTorrent', 'Time', 'Description', 'FileList', 'FilePath', 'UserID', 'Username'); $GroupID = (int) $_GET['id']; if ($GroupID == 0) { error('bad id parameter', true); } $TorrentCache = get_group_info($GroupID, true, 0); // http://stackoverflow.com/questions/4260086/php-how-to-use-array-filter-to-filter-array-keys function filter_by_key($input, $keys) { return array_intersect_key($input, array_flip($keys)); } $TorrentDetails = filter_by_key($TorrentCache[0][0], $GroupAllowed); $TorrentList = array(); foreach ($TorrentCache[1] as $Torrent) { $TorrentList[] = filter_by_key($Torrent, $TorrentAllowed); } header('Content-Type: text/plain; charset=utf-8'); print json_encode(array('status' => 'success', 'response' => array('group' => $TorrentDetails, 'torrents' => $TorrentList)));
{ return $Y['score'] - $X['score']; } header('Access-Control-Allow-Origin: *'); define('MAX_PERS_COLLAGES', 3); // How many personal collages should be shown by default define('MAX_COLLAGES', 5); // How many normal collages should be shown by default $GroupID = ceil($_GET['id']); if (!empty($_GET['revisionid']) && is_number($_GET['revisionid'])) { $RevisionID = $_GET['revisionid']; } else { $RevisionID = 0; } include SERVER_ROOT . '/sections/torrents/functions.php'; $TorrentCache = get_group_info($GroupID, true, $RevisionID); $TorrentDetails = $TorrentCache[0]; $TorrentList = $TorrentCache[1]; // Group details list($WikiBody, $WikiImage, $GroupID, $GroupName, $GroupYear, $GroupRecordLabel, $GroupCatalogueNumber, $ReleaseType, $GroupCategoryID, $GroupTime, $GroupVanityHouse, $TorrentTags, $TorrentTagIDs, $TorrentTagUserIDs, $TagPositiveVotes, $TagNegativeVotes, $GroupFlags) = array_values($TorrentDetails); $DisplayName = "<span dir=\"ltr\">{$GroupName}</span>"; $AltName = $GroupName; // Goes in the alt text of the image $Title = $GroupName; // goes in <title> $WikiBody = Text::full_format($WikiBody); $Artists = Artists::get_artist($GroupID); if ($Artists) { $DisplayName = Artists::display_artists($Artists, true) . "{$DisplayName}"; $AltName = display_str(Artists::display_artists($Artists, false)) . $AltName; $Title = $AltName;
function update_group_action() { global $params, $actions, $path, $l_add_user, $l_add_group, $l_group; global $cright_write_admin, $cgp_user; $id = $params['group_id']; if ($id > 0) { $g = get_group_info($id); // Allow public group handling only if write_admin right if ($g['privacy'] != 1) { $actions['group']['detailupdate']['Right'] = $cright_write_admin; $actions['group']['update']['Right'] = $cright_write_admin; $actions['group']['insert']['Right'] = $cright_write_admin; $actions['group']['check_delete']['Right'] = $cright_write_admin; $actions['group']['delete']['Right'] = $cright_write_admin; $actions['group']['sel_user_add']['Right'] = $cright_write_admin; $actions['group']['user_add']['Right'] = $cright_write_admin; $actions['group']['user_del']['Right'] = $cright_write_admin; $actions['group']['sel_group_add']['Right'] = $cright_write_admin; $actions['group']['group_add']['Right'] = $cright_write_admin; $actions['group']['group_del']['Right'] = $cright_write_admin; } // Detail Consult $actions['group']['detailconsult']['Url'] = "$path/group/group_index.php?action=detailconsult&group_id=$id"; $actions['group']['detailconsult']['Condition'][] = 'insert'; // If user has update right on the group if (check_group_update_rights($params, $g)) { // Detail Update $actions['group']['detailupdate']['Url'] = "$path/group/group_index.php?action=detailupdate&group_id=$id"; $actions['group']['detailupdate']['Condition'][] = 'insert'; // Check Delete $actions['group']['check_delete']['Url'] = "$path/group/group_index.php?action=check_delete&group_id=$id"; $actions['group']['check_delete']['Condition'][] = 'insert'; // Sel User add $actions['group']['sel_user_add']['Url'] = "$path/user/user_index.php?action=ext_get_ids&popup=1&ext_title=".urlencode($l_add_user)."&ext_action=user_add&ext_url=".urlencode($path.'/group/group_index.php')."&ext_id=$id&ext_target=$l_group"; $actions['group']['sel_user_add']['Condition'][] = 'insert'; // Sel group add : Groups selection $actions['group']['sel_group_add']['Url'] = "$path/group/group_index.php?action=ext_get_ids&popup=1&ext_title=".urlencode($l_add_group)."&ext_action=group_add&ext_url=".urlencode($path.'/group/group_index.php')."&ext_id=$id&ext_target=$l_group&child_res=1"; $actions['group']['sel_group_add']['Condition'][] = 'insert'; } else { // User does not have update rights $actions['group']['detailupdate']['Condition'] = array('None'); $actions['group']['check_delete']['Condition'] = array('None'); $actions['group']['sel_user_add']['Condition'] = array('None'); $actions['group']['sel_group_add']['Condition'] = array('None'); } } // Display admin menu only if no userdata defined if (empty($cgp_user['group']['category'])) { $actions['group']['admin']['Condition'] = array('None'); } }
<?php require SERVER_ROOT . '/sections/torrents/functions.php'; $GroupID = (int) $_GET['id']; if ($GroupID === 0) { error('bad id parameter', true); } $TorrentDetails = get_group_info($GroupID, true, 0, false); $TorrentDetails = $TorrentDetails[0]; $Image = $TorrentDetails['WikiImage']; if (!$Image) { // handle no artwork $Image = STATIC_SERVER . 'common/noartwork/' . $CategoryIcons[$TorrentDetails['CategoryID'] - 1]; } json_die("success", array('wikiImage' => $Image));
} } $Title = $Announce; $AnnounceSSL = "{$Announce} - " . site_url() . "torrents.php?id={$GroupID} / " . site_url() . "torrents.php?action=download&id={$TorrentID}"; $Announce .= " - " . site_url() . "torrents.php?id={$GroupID} / " . site_url() . "torrents.php?action=download&id={$TorrentID}"; $AnnounceSSL .= ' - ' . trim($Properties['TagList']); $Announce .= ' - ' . trim($Properties['TagList']); // ENT_QUOTES is needed to decode single quotes/apostrophes send_irc('PRIVMSG #' . NONSSL_SITE_URL . '-announce :' . html_entity_decode($Announce, ENT_QUOTES)); send_irc('PRIVMSG #' . NONSSL_SITE_URL . '-announce-ssl :' . html_entity_decode($AnnounceSSL, ENT_QUOTES)); $Debug->set_flag('upload: announced on irc'); // Manage notifications $UsedFormatBitrates = array(); if (!$IsNewGroup) { // maybe there are torrents in the same release as the new torrent. Let's find out (for notifications) $GroupInfo = get_group_info($GroupID, true, 0, false); $ThisMedia = display_str($Properties['Media']); $ThisRemastered = display_str($Properties['Remastered']); $ThisRemasterYear = display_str($Properties['RemasterYear']); $ThisRemasterTitle = display_str($Properties['RemasterTitle']); $ThisRemasterRecordLabel = display_str($Properties['RemasterRecordLabel']); $ThisRemasterCatalogueNumber = display_str($Properties['RemasterCatalogueNumber']); foreach ($GroupInfo[1] as $TorrentInfo) { if ($TorrentInfo['Media'] == $ThisMedia && $TorrentInfo['Remastered'] == $ThisRemastered && $TorrentInfo['RemasterYear'] == (int) $ThisRemasterYear && $TorrentInfo['RemasterTitle'] == $ThisRemasterTitle && $TorrentInfo['RemasterRecordLabel'] == $ThisRemasterRecordLabel && $TorrentInfo['RemasterCatalogueNumber'] == $ThisRemasterCatalogueNumber && $TorrentInfo['ID'] != $TorrentID) { $UsedFormatBitrates[] = array('format' => $TorrentInfo['Format'], 'bitrate' => $TorrentInfo['Encoding']); } } } // For RSS $Item = $Feed->item($Title, Text::strip_bbcode($Body), 'torrents.php?action=download&authkey=[[AUTHKEY]]&torrent_pass=[[PASSKEY]]&id=' . $TorrentID, $LoggedUser['Username'], 'torrents.php?id=' . $GroupID, trim($Properties['TagList'])); //Notifications
function writeAttendee($name, $value) { if (key_exists('state', $value)) { $value = array($value); } foreach ($value as $attendee) { $params = array(); $value = ''; if($attendee['state']) { $partstat = $attendee['state']; } else { $partstat = 'NEEDS-ACTION'; } switch($attendee['entity']) { case 'user' : if(!$this->attendees['user'][$attendee['id']]) { $this->attendees['user'][$attendee['id']] = get_user_info($attendee['id']); } $userInfo = $this->attendees['user'][$attendee['id']]; if(!$userInfo['email']) $userInfo['email'] = $this->noreply ; $value = 'MAILTO:'.$this->parseText($userInfo['email']); $params[] = 'CUTYPE=INDIVIDUAL'; $params[] = 'CN='.$this->parseText($userInfo['firstname'].' '.$userInfo['lastname']); $params[] = 'PARTSTAT='.$partstat; $params[] = $this->parseName('x-obm-id').'='.$attendee['id']; break; case 'resource' : if(!$this->attendees['resource'][$attendee['id']]) { $this->attendees['resource'][$attendee['id']] = get_entity_info($attendee['id'],'resource'); } $resourceInfo = $this->attendees['resource'][$attendee['id']]; $value = 'MAILTO:'.$this->parseText($this->noreply ); $params[] = 'CUTYPE=RESOURCE'; $params[] = 'CN='.$this->parseText($resourceInfo['label']); $params[] = 'PARTSTAT='.$partstat; $params[] = $this->parseName('x-obm-id').'='.$attendee['id']; break; case 'group' : if(!$this->attendees['group'][$attendee['id']]) { $this->attendees['group'][$attendee['id']] = get_group_info($attendee ['id']); } $groupInfo = $this->attendees['contact'][$attendee['id']]; if(!$groupInfo['email']) $groupInfo['email'] = $this->noreply ; $value = 'MAILTO:'.$this->parseText($groupInfo['email']); $params[] = 'CUTYPE=GROUP'; $params[] = 'CN='.$this->parseText($groupInfo['name']); $params[] = 'PARTSTAT='.$partstat; $params[] = $this->parseName('x-obm-id').'='.$attendee['id']; break; case 'task' : $mail = 'MAILTO:'.$this->parseText($this->noreply ); $params[] = 'CUTYPE=X-TASK'; $params[] = 'PARTSTAT=ACCEPTED'; $params[] = $this->parseName('x-obm-id').'='.$attendee['id']; break; case 'contact' : if(!$this->attendees['contact'][$attendee['id']]) { $this->attendees['contact'][$attendee['id']] = get_contact_from_ids(array($attendee['id'])); } $contactInfo = $this->attendees['contact'][$attendee['id']]; $params[] = 'CUTYPE=INDIVIDUAL'; if(!$contactInfo['entity'][ $attendee['id'] ]['email_address'])$contactInfo['entity'][ $attendee['id'] ]['email_address'] = $this->noreply ; $value = 'MAILTO:'.$this->parseText($contactInfo['entity'][ $attendee['id'] ]['email_address']); break; default: // Skip $params[]'less entities continue 2; // This 'continue' is catched by switch(). With '2' we reach our foreach(). } $property = $this->parseProperty($this->parseName($name).';'.implode(';',$params).':'.$value); $this->buffer .= $property."\r\n"; } }