Esempio n. 1
0
function ribcage_donate_download_thanks()
{
    global $release, $artist, $wp_query;
    $release = get_release_by_slug($wp_query->query_vars['release_slug'], FALSE, FALSE);
    $artist = get_artist($release['release_artist']);
    $load = ribcage_load_template('download-thanks.php');
}
Esempio n. 2
0
	public function _artist() {
		global $user;

		if ($user->is('artist')) {
			$sql = 'SELECT a.ub
				FROM _artists_auth t
				INNER JOIN _artists a ON a.ub = t.ub
				WHERE t.user_id = ?';
			if ($artist_ary = sql_rowset(sql_filter($sql, $user->d('user_id')), false, 'ub')) {
				$sql_where = sql_filter('WHERE ub IN (??)', implode(',', $artist_ary));
			}
		}

		$artist = request_var('a', '');
		$module = request_var('module', '');
		$url = s_link('acp', array('artist_select', 'r' => $module));

		if (empty($artist)) {
			redirect($url);
		}

		if (!$this->object = get_artist($artist, true)) {
			fatal_error();
		}

		v_style(array(
			'ARTIST_SELECT' => $url,
			'ARTIST_NAME' => $this->object['name'])
		);

		return;
	}
Esempio n. 3
0
/**
 * Displays thank you message to the user returning from PayPal
 *
 * @author Alex Andrews <*****@*****.**>
 * @return void
 */
function ribcage_donate_download_thanks()
{
    global $release, $artist, $wp_query;
    $release = get_release_by_slug($wp_query->query_vars['release_slug'], FALSE, FALSE);
    if (is_wp_error($release)) {
        ribcage_404();
    }
    $artist = get_artist($release['release_artist']);
    if (is_wp_error($artist)) {
        ribcage_404();
    }
    if ($release["release_slug"] === 'christmas-koto') {
        $load = ribcage_load_template('download-thanks-koto.php');
    } else {
        $load = ribcage_load_template('download-thanks.php');
    }
}
Esempio n. 4
0
/**
 * Manages artists - adds, deletes, edits.
 *
 * @author Alex Andrews <*****@*****.**>
 * @return void
 **/
function ribcage_manage_artists()
{
    global $artists;
    global $artist;
    $index = false;
    // If we aren't on an artist page then we are on the index page.
    if (isset($_REQUEST['artist'])) {
        $artist_id = (int) $_REQUEST['artist'];
    } elseif (isset($_REQUEST['page']) && $_REQUEST['page'] == 'add_artist') {
        $index = false;
    } else {
        $index = true;
    }
    register_column_headers('ribcage-manage-artist', array('cb' => '<input type="checkbox" />', 'artist' => 'Artist'));
    if (isset($_REQUEST['ribcage_action'])) {
        global $wpdb;
        // Refactor, this is a terrible place for this to do this.
        if ($_REQUEST['ribcage_action'] !== 'add') {
            check_admin_referer('manage_artists');
        } else {
            check_admin_referer('add_artist');
        }
        unset($_POST['_wpnonce']);
        unset($_POST['_wp_http_referer']);
        unset($_POST['Submit']);
        //split apart associative array into different parts to prepare for implodes
        $post_keys = array_keys($_POST);
        $post_vals = array_values($_POST);
        //construct field name list and vals to post
        $string_keys = implode($post_keys, ",");
        $string_vals = "'" . implode($post_vals, "','") . "'";
        $wpdb->show_errors();
        switch ($_REQUEST['ribcage_action']) {
            case 'edit':
                $sql = "UPDATE " . $wpdb->prefix . "ribcage_artists\n\t\t\t\t\t\tSET ";
                $i = 0;
                foreach ($post_keys as $field) {
                    $sql .= $field . "='" . $post_vals[$i] . "', ";
                    $i++;
                }
                $sql .= " artist_id = " . $artist_id . " \n\t\t\t\t\t\tWHERE artist_id = " . $artist_id;
                $results = $wpdb->query($sql);
                $wpdb->hide_errors();
                $artist = get_artist($artist_id);
                $message = 'updated';
                break;
            case 'add':
                $sql = "INSERT INTO " . $wpdb->prefix . "ribcage_artists\n\t\t\t\t\t\t({$string_keys})\n\t\t\t\t\t\tVALUES\n\t\t\t\t\t\t({$string_vals})";
                $results = $wpdb->query($sql);
                $wpdb->hide_errors();
                $artist = get_artist_by_slug($_POST['artist_slug']);
                $message = 'added';
                break;
            case 'delete':
                $del_artist = get_artistname_by_id($_REQUEST['artist']);
                delete_artist($_REQUEST['artist']);
                $message = "{$del_artist} deleted";
                $index = 1;
                break;
        }
        echo '<div id="message" class="updated fade"><p><strong>Artist ' . $message . '.</strong></p></div>';
    }
    if (!$index) {
        if (isset($_REQUEST['artist'])) {
            $artist = get_artist($_REQUEST['artist']);
        }
        ?>
	<div class="wrap">
			<div id="icon-options-general" class="icon32"><br /></div>
		<?php 
        if ($_REQUEST['page'] == 'add_artist') {
            ?>
			<h2>Add Artist</h2>
			<form action="<?php 
            echo str_replace('%7E', '~', $_SERVER['REQUEST_URI']);
            ?>
&ribcage_action=add" method="post" id="ribcage_edit_artist" name="edit_artist">
			<?php 
            wp_nonce_field('add_artist');
            ?>
		<?php 
        }
        ?>
		<?php 
        if (isset($_REQUEST['artist'])) {
            ?>
			<h2>Managing <?php 
            artist_name();
            ?>
</h2>
			<form action="<?php 
            echo str_replace('%7E', '~', $_SERVER['REQUEST_URI']);
            ?>
&ribcage_action=edit" method="post" id="ribcage_edit_artist" name="edit_artist">
			<?php 
            wp_nonce_field('manage_artists');
            ?>
		<?php 
        }
        ?>
					<table class="form-table">             
						<tr valign="top">
							<th scope="row"><label for="artist_name">Name</label></th> 
							<td>
								<input type="text" value="<?php 
        artist_name();
        ?>
" name="artist_name" id="artist_name" class="regular-text"/>												
							</td> 
						</tr>
						<tr valign="top">
							<th scope="row">Sort Name</th> 
							<td>
								<input type="text" value="<?php 
        artist_name_sort();
        ?>
" name="artist_name_sort" id="artist_name_sort" class="regular-text" />
								<span class="description">The name of the artist to be alphabetized. For example, 'Butterfly, The'.</span>
							</td> 
						</tr>
						<tr valign="top">
							<th scope="row">Artist Slug</th> 
							<td>
								<input type="text" style="width:320px;" class="regular-text code" value="<?php 
        artist_slug();
        ?>
" name="artist_slug" id="artist_slug" /><span class="description">The URL you want for the artist - for example <a href="<?php 
        echo home_url();
        ?>
/artists/artist_slug</span>
							</td> 
						</tr>
						<tr valign="top">
							<th scope="row">Signup Date</th> 
							<td>
								<input type="text" style="width:100px;" class="regular-text code" value="<?php 
        echo $artist['artist_signed'];
        ?>
" name="artist_signed" id="artist_signed" maxlength="50" /><span class="description">The date the artist signed for your label</span>
							</td> 
						</tr>
						<tr valign="top">
							<th scope="row">Creative Commons license</th> 
							<td>
								<?php 
        echo ribcage_cc_dropdown($artist_license_val);
        ?>
							</td> 
						</tr>
						<tr valign="top">
							<th scope="row">Artist's Music Brainz ID</th> 
							<td>
								<input type="text" style="width:320px;" class="regular-text code" value="<?php 
        artist_musicbrainz();
        ?>
" name="artist_mbid" id="artist_mbid" maxlength="50" />
							</td> 
						</tr>
						<tr valign="top">
							<th scope="row">Website URL</th> 
							<td>
								<input type="text" style="width:320px;" class="regular-text code" value="<?php 
        artist_website_link();
        ?>
" name="artist_link_website" id="artist_link_website" maxlength="200" />
							</td> 
						</tr>
						<tr valign="top">
							<th scope="row">MySpace URL</th> 
							<td>
								<input type="text" style="width:320px;" class="regular-text code" value="<?php 
        artist_myspace_link();
        ?>
" name="artist_link_myspace" id="artist_link_myspace" maxlength="200" />
							</td> 
						</tr>
						<tr valign="top">
							<th scope="row">Facebook URL</th> 
							<td>
								<input type="text" style="width:320px;" class="regular-text code" value="<?php 
        artist_facebook_link();
        ?>
" name="artist_link_facebook" id="artist_link_facebook" maxlength="200" />
							</td> 
						</tr>
						<tr valign="top">
							<th scope="row">Artist Biography</th> 
							<td>
								<textarea rows="5" cols="50" name="artist_bio" id="artist_bio" class="regular-text"><?php 
        echo $artist['artist_bio'];
        ?>
</textarea>
							</td> 
						</tr>
						<tr valign="top">
							<th scope="row">Short One Paragraph Description of Artist</th> 
							<td>
								<textarea rows="5" cols="50" name="artist_blurb_tiny" id="artist_blurb_tiny" class="regular-text"><?php 
        echo $artist['artist_blurb_tiny'];
        ?>
</textarea>
							</td> 
						</tr>
						<tr valign="top">
							<th scope="row">Artist Picture 1</th> 
							<td>
								<input type="text" style="width:320px;" class="regular-text code" value="<?php 
        artist_picture_1();
        ?>
" name="artist_picture_1" id="artist_picture_1" maxlength="200" />
							</td> 
						</tr>
						<tr valign="top">
							<th scope="row">Artist Picture 2</th> 
							<td>
								<input type="text" style="width:320px;" class="regular-text code" value="<?php 
        artist_picture_2();
        ?>
" name="artist_picture_2" id="artist_picture_2" maxlength="200" />
							</td> 
						</tr>
						<tr valign="top">
							<th scope="row">Artist Picture 3</th> 
							<td>
								<input type="text" style="width:320px;" class="regular-text code" value="<?php 
        artist_picture_3();
        ?>
" name="artist_picture_3" id="artist_picture_3" maxlength="200" />
							</td> 
						</tr>
						<tr valign="top">
							<th scope="row">Artist Picture HQ Zipfile URL</th> 
							<td>
								<input type="text" style="width:320px;" class="regular-text code" value="<?php 
        echo $artist_picture_zip_val;
        ?>
" name="artist_picture_zip" id="artist_picture_zip" maxlength="200" />
							</td> 
						</tr>
					</table>
					<p class="submit">
						<input type="submit" name="Submit" class="button-primary" value="Save Changes" />
					</p>
			</form>
	</div>
<?php 
    } else {
        ?>
	<?php 
        $artists = list_artists_blurb();
        $alt = 0;
        ?>
	<div class="wrap">
		<div id="icon-plugins" class="icon32"><br /></div>
		<h2>Manage Artists</h2>
			<form action="<?php 
        echo str_replace('%7E', '~', $_SERVER['REQUEST_URI']);
        ?>
" method="post" id="ribcage_manage_artists" name="manage_artists"> 
				<table class="widefat post fixed" cellspacing="0">
						<thead>
						<tr>
						<?php 
        print_column_headers('ribcage-manage-artist');
        ?>
			
						</tr>
						</thead>
						<tfoot>
						<tr>			
						<?php 
        print_column_headers('ribcage-manage-artist', FALSE);
        ?>
	
						</tr>
						</tfoot>            
						<tbody>
							<?php 
        while (have_artists()) {
            the_artist();
            ?>
							<?php 
            $manage_link = wp_nonce_url('?page=ribcage&artist=' . artist_id(false), 'manage_artists');
            $delete_link = wp_nonce_url('?page=ribcage&artist=' . artist_id(false) . '&ribcage_action=delete', 'manage_artists');
            ?>
							<?php 
            echo $alt % 2 ? '<tr valign="top" class="">' : '<tr valign="top" class="alternate">';
            ++$alt;
            ?>
		
							<th scope="row" class="check-column"><input type="checkbox" name="artistcheck[]" value="2" /></th>
							<td class="column-name">
								<strong><a class="row-title" href="?page=manage_artists&artist=<?php 
            artist_id();
            ?>
" title="<?php 
            artist_name();
            ?>
" ><?php 
            artist_name();
            ?>
</strong></a><br /><div class="row-actions"><span class='edit'><a href="<?php 
            echo $manage_link;
            ?>
">Edit</a> | </span><span class='delete'><a class='submitdelete' href='<?php 
            echo $delete_link;
            ?>
' onclick="if ( confirm('You are about to delete \'<?php 
            artist_name();
            ?>
\'\n  \'Cancel\' to stop, \'OK\' to delete.') ) { return true;}return false;">Delete</a></span></div></td>
							</tr>
							<?php 
        }
        ?>
						</tbody>
					</table>
			</form>
	</div>
	<?php 
    }
}
Esempio n. 5
0
function generate_torrent_json($Caption, $Tag, $Details, $Limit)
{
    global $LoggedUser, $Categories;
    $results = array();
    foreach ($Details as $Detail) {
        list($TorrentID, $GroupID, $GroupName, $GroupCategoryID, $TorrentTags, $Format, $Encoding, $Media, $Scene, $HasLog, $HasCue, $LogScore, $Year, $GroupYear, $RemasterTitle, $Snatched, $Seeders, $Leechers, $Data) = $Detail;
        $Artist = display_artists(get_artist($GroupID), false, true);
        $TruncArtist = substr($Artist, 0, strlen($Artist) - 3);
        $TagList = array();
        if ($TorrentTags != '') {
            $TorrentTags = explode(' ', $TorrentTags);
            foreach ($TorrentTags as $TagKey => $TagName) {
                $TagName = str_replace('_', '.', $TagName);
                $TagList[] = $TagName;
            }
        }
        // Append to the existing array.
        $results[] = array('torrentId' => $TorrentID, 'groupId' => $GroupID, 'artist' => $TruncArtist, 'groupName' => $GroupName, 'groupCategory' => $GroupCategoryID, 'groupYear' => $GroupYear, 'remasterTitle' => $RemasterTitle, 'format' => $Format, 'encoding' => $Encoding, 'hasLog' => $HasLog, 'hasCue' => $HasCue, 'media' => $Media, 'scene' => $Scene, 'year' => $Year, 'tags' => $TagList, 'snatched' => $Snatched, 'seeders' => $Seeders, 'leechers' => $Leechers, 'data' => $Data);
    }
    return array('caption' => $Caption, 'tag' => $Tag, 'limit' => $Limit, 'results' => $results);
}
Esempio n. 6
0
			}
		}
		
		$Tags = implode(", ", $Request['Tags']);
	}
}

if($NewRequest && !empty($_GET['artistid']) && is_number($_GET['artistid'])) {
	$DB->query("SELECT Name FROM artists_group WHERE artistid = ".$_GET['artistid']." LIMIT 1");
	list($ArtistName) = $DB->next_record();
	$ArtistForm = array(
		1 => array(array('name' => trim($ArtistName))),
		2 => array()
	);
} elseif($NewRequest && !empty($_GET['groupid']) && is_number($_GET['groupid'])) {
	$ArtistForm = get_artist($_GET['groupid']);
	$DB->query("SELECT tg.Name, 
					tg.Year, 
					tg.ReleaseType, 
					GROUP_CONCAT(t.Name SEPARATOR ', ') 
				FROM torrents_group AS tg 
					JOIN torrents_tags AS tt ON tt.GroupID=tg.ID
					JOIN tags AS t ON t.ID=tt.TagID
				WHERE tg.ID = ".$_GET['groupid']);
	list($Title, $Year, $ReleaseType, $Tags) = $DB->next_record();
}

show_header(($NewRequest ? "Create a request" : "Edit a request"), 'requests');
show_message();
?>
<div class="thin">
Esempio n. 7
0
	}
} else { // If we're reading from cache
	$TorrentDetails=$TorrentCache[0];
	$TorrentList=$TorrentCache[1];
}

// Group details
list($WikiBody, $WikiImage, $GroupID, $GroupName, $GroupYear, $GroupRecordLabel, $GroupCatalogueNumber, $ReleaseType, $GroupCategoryID,
	$GroupTime, $TorrentTags, $TorrentTagIDs, $TorrentTagUserIDs, $TagPositiveVotes, $TagNegativeVotes) = array_shift($TorrentDetails);

$DisplayName=$GroupName;
$AltName=$GroupName; // Goes in the alt text of the image
$Title=$GroupName; // goes in <title>
$WikiBody = $Text->full_format($WikiBody);

$Artists = get_artist($GroupID);

if($Artists) {
	$DisplayName = display_artists($Artists, true).$DisplayName;
	$AltName = display_artists($Artists, false).$AltName;
	$Title = $AltName;
}

if($GroupYear>0) {
	$DisplayName.=' ['.$GroupYear.']';
	$AltName.=' ['.$GroupYear.']';
}
if($GroupCategoryID == 1) {
	$DisplayName.=' ['.$ReleaseTypes[$ReleaseType].']';
	$AltName.=' ['.$ReleaseTypes[$ReleaseType].']';
}
Esempio n. 8
0
    /**
     * Displays recent releases widget.
     */
    public function widget($args, $instance)
    {
        global $releases, $release, $artist;
        extract($args);
        $releases = list_recent_releases_blurb('16');
        $artists = list_artists_blurb();
        ?>
	        <?php 
        echo $before_widget;
        ?>
	            <?php 
        echo $before_title . 'Recent Releases' . $after_title;
        ?>
				<div class="textwidget" align="left">
	            <?php 
        while (have_releases()) {
            the_release();
            ?>
	
				<?php 
            $artist = get_artist($release['release_artist']);
            ?>
				<div class="artist_slug">
					<a class="slug" href="<?php 
            echo home_url();
            ?>
/artists/<?php 
            artist_slug();
            ?>
/<?php 
            release_slug();
            ?>
"><img src="<?php 
            release_cover_tiny();
            ?>
" alt="<?php 
            release_title();
            ?>
" /></a>
					<div class="artist_slug_info">
						<ul class="artist_slug_main">
							<li class="artist"><a href="<?php 
            echo home_url();
            ?>
/artists/<?php 
            artist_slug();
            ?>
/"><?php 
            artist_name();
            ?>
</a><h2><a href="<?php 
            echo home_url();
            ?>
/artists/<?php 
            artist_slug();
            ?>
/<?php 
            release_slug();
            ?>
"><?php 
            release_title();
            ?>
</a></h2></li>
						</ul>
						<ul class="artist_slug_meta">
							<li class="more"><a href="<?php 
            echo home_url();
            ?>
/artists/<?php 
            artist_slug();
            ?>
/<?php 
            release_slug();
            ?>
">More</a></li>
							<li class="listen"><a href="javascript:popUp('<?php 
            release_player_link();
            ?>
')">Listen</a></li>
						<?php 
            if (release_physical()) {
                ?>
							<li class="download"><a href="<?php 
                echo home_url();
                ?>
/download/<?php 
                release_slug();
                ?>
/">Free Download</a></li>
							<li class="last buy"><a href="<?php 
                echo home_url();
                ?>
/buy/<?php 
                release_product_id();
                ?>
">Buy</a></li>
						<?php 
            } else {
                ?>
							<li class="last download"><a href="<?php 
                echo home_url();
                ?>
/download/<?php 
                release_slug();
                ?>
/">Free Download</a></li>
						<?php 
            }
            ?>
						</ul>
					</div> <!-- end div.artist_slug_info -->
					<div class="clear"></div>
				</div> <!-- end div.artist_slug -->
				<?php 
        }
        ?>
				<div class="clear"></div>
				<p class="more_link"><a href="<?php 
        echo home_url();
        ?>
/releases/">more releases &rsaquo;</a></p>
			</div>
	        <?php 
        echo $after_widget;
        ?>
	<?php 
    }
Esempio n. 9
0
/**
 * Administration panel for adding a release.
 *
 * @return void
 */
function ribcage_add_release()
{
    global $release, $artist, $tracks, $track;
    ?>
	<div class="wrap">
	<div id="icon-options-general" class="icon32"><br /></div>
	<?php 
    if (isset($_POST['release'])) {
        $release = $_POST['release'];
        $release = stripslashes($release);
        $release = unserialize($release);
    }
    unset($_POST['release']);
    unset($_POST['Submit']);
    // Stage 4 - Add the release to the database.
    if (isset($_REQUEST['ribcage_action']) && $_REQUEST['ribcage_action'] == 'add_release' && $_REQUEST['ribcage_step'] == '4') {
        ?>
		<h2>Add Release - Adding To Database</h2>
		<?php 
        // Load everything we have so far.
        $release = get_transient('ribcage_temp_data');
        $release = unserialize($release);
        $tracks = get_transient('ribcage_temp_tracks');
        $tracks = unserialize($tracks);
        // Correct the data we have here with additions from the previous form.
        foreach ($_POST as $key => $var) {
            if (preg_match("/^track_stream_/", $key)) {
                $number = str_replace('track_stream_', '', $key);
                $number = $number - 1;
                $tracks[$number]['track_stream'] = $var;
                continue;
            }
            $release[$key] = $var;
        }
        // Save all of this just in case we have a problem.
        set_transient('ribcage_temp_data', serialize($release), 60 * 60);
        set_transient('ribcage_temp_tracks', serialize($release), 60 * 60);
        // Checks on the data so far.
        foreach ($tracks as $track) {
            if (false === @file_get_contents($track['track_stream'])) {
                $errors[] = '<p>The streaming file for the track ' . $track['track_title'] . ' does not exist at <code>' . $track['track_stream'] . '</code>.</p>';
                //$fatal_error = true;
            }
        }
        $formats = array('mp3', 'ogg', 'flac');
        foreach ($formats as $format) {
            if ($release["release_{$format}"]) {
                if (!file_exists(ABSPATH . $release["release_{$format}"])) {
                    $errors[] = '<p>The file you set for the ' . $format . ' downloads does not exist at <code>' . $release["release_{$format}"] . '</code>.</p>';
                    $missing_uploads = true;
                }
            }
        }
        if ($release["release_one_sheet"]) {
            if (!file_exists(ABSPATH . $release["release_one_sheet"])) {
                $errors[] = '<p>The file you set for the one sheet does not exist at <code>' . $release["release_one_sheet"] . '</code>.</p>';
                $missing_uploads = 1;
            }
        }
        foreach ($formats as $format) {
            if ($release["release_torrent_{$format}"]) {
                if (false === @file_get_contents($release["release_torrent_{$format}"], 0, null, 0, 1)) {
                    $errors[] = '<p>The file you set for the ' . $format . ' torrent does not exist at <code>' . $release["release_torrent_{$format}"] . '</code>.</p>';
                }
            }
        }
        $sizes = array('tiny', 'large', 'huge');
        foreach ($sizes as $size) {
            if ($release["release_cover_image_{$size}"]) {
                if (false === @file_get_contents($release["release_cover_image_{$size}"], 0, null, 0, 1)) {
                    $errors[] = '<p>The ' . $size . ' cover image does not exist at <code>' . $release["release_cover_image_{$size}"] . '</code>.</p>';
                    $missing_uploads = true;
                }
                $check_images = true;
            }
        }
        if (!$check_images) {
            $errors[] = '<p>No cover images have been set!</p>';
        }
        if ($missing_uploads) {
            $errors[] = "<p>We've got missing files here, don't forget to upload them!</p>";
        }
        // Show errors.
        if (is_array($errors)) {
            ?>
			<h3>Errors</h3>
			<p>The following errors have been found in what you have entered.</p> 
			<?php 
            foreach ($errors as $error) {
                print $error;
            }
            // TODO Set some kind of flag to remind the user that their are incomplete elements of the release.
            if ($fatal_error) {
                ?>
				<p>There are too many errors to continue, please go back and correct them.</p>
				<p class="submit">
					<input type="submit" name="Submit" class="button-primary" value="Back" />
				</p>
				<?php 
                return;
            }
        }
        ?>
		<p>Added <?php 
        release_title();
        ?>
 to the database.</p>
		<?php 
        global $wpdb;
        $wpdb->show_errors();
        // Add release to database
        $string_keys = implode(array_keys($release), ",");
        $string_values = "'" . implode(array_values($release), "','") . "'";
        $sql = "INSERT INTO " . $wpdb->prefix . "ribcage_releases\n\t\t\t\t\t({$string_keys})\n\t\t\t\t\tVALUES\n\t\t\t\t\t({$string_values})";
        //echo $sql;
        $results = $wpdb->query($sql);
        // Add tracks to database
        foreach ($tracks as $tr) {
            $tr['track_title'] = mysql_real_escape_string($tr['track_title']);
            $string_keys = implode(array_keys($tr), ",");
            $string_values = "'" . implode(array_values($tr), "','") . "'";
            $sql = " \n\t\t\tINSERT INTO wp_ribcage_tracks \n\t\t\t({$string_keys})\n\t\t\tVALUES\n\t\t\t({$string_values})\n\t\t\t";
            //echo $sql;
            $results = $wpdb->query($sql);
        }
        delete_transient('ribcage_temp_tracks');
        delete_transient('ribcage_temp_data');
        delete_transient('ribcage_allow_download');
        delete_transient('ribcage_allow_torrent');
        $wpdb->hide_errors();
        if (!$release['release_mbid']) {
            echo "<p>Don't forget to add the release to <a href=\"http://musicbrainz.org\">MusicBrainz</a>. It will make your life a lot easier!</p>";
        }
        return 0;
    } elseif (isset($_REQUEST['ribcage_action']) && $_REQUEST['ribcage_action'] == 'add_release' && $_REQUEST['ribcage_step'] == '3') {
        // Load everything up of any interest. By now we should have a fair bit.
        $release = get_transient('ribcage_temp_data');
        $release = unserialize($release);
        $allow_download = get_transient('ribcage_allow_download');
        $allow_torrent = get_transient('ribcage_allow_torrent');
        // Set the tracks from the previous stage $_POST
        $total_tracks = $release['release_tracks_no'];
        $t = 1;
        $artist = get_artist($release['release_artist']);
        $artist_slug = $artist['artist_slug'];
        while (count($tracks) != $total_tracks) {
            $tracks[] = array('track_number' => $_POST["track_number_{$t}"], 'track_title' => $_POST["track_title_{$t}"], 'track_time' => $_POST["track_time_{$t}"], 'track_release_id' => $release['release_id'], 'track_mbid' => $_POST["track_mbid_{$t}"], 'track_slug' => ribcage_slugize($_POST["track_title_{$t}"]), 'track_stream' => get_option('siteurl') . get_option('ribcage_file_location') . 'audio' . ribcage_slugize($_POST['track_title_$t']) . "/{$artist_slug}/" . ribcage_slugize($release['release_title']) . '/stream/' . str_pad($t, 2, "0", STR_PAD_LEFT) . '.mp3');
            $t++;
        }
        set_transient('ribcage_temp_tracks', serialize($tracks), 60 * 60);
        ?>
		<h2>Add Release - Upload Files</h2>
		<form action="<?php 
        echo str_replace('%7E', '~', $_SERVER['REQUEST_URI']);
        ?>
&ribcage_action=add_release&ribcage_step=4" method="post" id="ribcage_add_release" name="add_release">
		<?php 
        if ($allow_download == 1) {
            ?>
		<h3>Downloads</h3>
		<p>At the moment Ribcage has no facility to upload downloads for your release. But it has made the following guess as to where your downloads might be - please check them.</p>
		<table class="form-table">             
		<?php 
            if ($release['release_mp3']) {
                ?>
			<tr valign="top">
				<th scope="row"><label for="release_mp3">.zip Location For MP3</label></th> 
				<td>
				<input type="text" style="width:480px;" class="regular-text code" value="<?php 
                print $release['release_mp3'];
                ?>
" name="release_mp3" id="release_mp3" maxlength="200" />
				</td> 
			</tr>
			<?php 
            }
            if ($release['release_ogg']) {
                ?>
			<tr valign="top">
				<th scope="row"><label for="release_ogg">.zip Location For Ogg</label></th> 
				<td>
				<input type="text" style="width:480px;" class="regular-text code" value="<?php 
                print $release['release_ogg'];
                ?>
" name="release_ogg" id="release_ogg" maxlength="200" />
				</td> 
			</tr>
			<?php 
            }
            if ($release['release_flac']) {
                ?>
			<tr valign="top">
				<th scope="row"><label for="release_ogg">.zip Location For Flac</label></th> 
				<td>
				<input type="text" style="width:480px;" class="regular-text code" value="<?php 
                print $release['release_flac'];
                ?>
" name="release_flac" id="release_flac" maxlength="200" />
				</td> 
			</tr>
			<?php 
            }
        } else {
            unset($release['release_mp3']);
            unset($release['release_ogg']);
            unset($release['release_flac']);
        }
        ?>
		</table>
		<?php 
        if ($allow_torrent == 1) {
            ?>
		<h3>Torrents</h3>
		<p>The locations of your torrents for those downloads.</p>
		<table class="form-table">
			<tr valign="top">
				<th scope="row"><label for="release_torrent_mp3">Torrent For MP3</label></th> 
				<td>
				<input type="text" style="width:480px;" class="regular-text code" value="<?php 
            print $release['release_torrent_mp3'];
            ?>
" name="release_torrent_mp3" id="release_torrent_mp3" maxlength="200" />
				</td> 
			</tr>
			<tr valign="top">
				<th scope="row"><label for="release_torrent_ogg">Torrent For Ogg</label></th> 
				<td>
				<input type="text" style="width:480px;" class="regular-text code" value="<?php 
            print $release['release_torrent_ogg'];
            ?>
" name="release_torrent_ogg" id="release_torrent_ogg" maxlength="200" />
				</td> 
			</tr>
			<tr valign="top">
				<th scope="row"><label for="release_torrent_flac">Torrent For Flac</label></th> 
				<td>
				<input type="text" style="width:480px;" class="regular-text code" value="<?php 
            print $release['release_torrent_flac'];
            ?>
" name="release_torrent_flac" id="release_torrent_flac" maxlength="200" />
				</td> 
			</tr>
		</table>
		<?php 
        } else {
            unset($release['release_torrent_mp3']);
            unset($release['release_torrent_ogg']);
            unset($release['release_torrent_flac']);
        }
        ?>
		<h3>Streams</h3>
		<p>The following is our guess where the files to stream your release are located.</p>
		<table width="800px"> 
			<thead>
			<tr>
				<td>No</td>
				<td>Track Name</td>
				<td>Stream Location</td>		
			</tr>
			</thead>
			<?php 
        $track_count = 1;
        ?>
			<?php 
        while (have_tracks()) {
            the_track();
            ?>
			<tr>
				<th scope="row">
					<?php 
            track_no();
            ?>
				</th>
				<td>
					<?php 
            track_title();
            ?>
				</td>
				<td>
					<input type="text" style="width:500px;" class="regular-text" value="<?php 
            echo $track['track_stream'];
            ?>
" name="track_stream_<?php 
            echo $track_count;
            ?>
" id="track_stream_<?php 
            echo $track_count;
            ?>
" maxlength="200" />											
				</td>
			</tr>
			<?php 
            $track_count++;
            ?>
			<?php 
        }
        ?>
		</table>
		<h3>Artwork</h3>
		<p>The following is our guess where the images for the artwork for your release are located.</p>
		<table class="form-table">
			<tr valign="top">
				<th scope="row"><label for="release_cover_image_tiny">Tiny Cover Image</label></th> 
				<td>
				<input type="text" style="width:480px;" class="regular-text code" value="<?php 
        print $release['release_cover_image_tiny'];
        ?>
" name="release_cover_image_tiny" id="release_cover_image_tiny" maxlength="200" />
				</td> 
			</tr>
			<tr valign="top">
				<th scope="row"><label for="release_cover_image_large">Large Cover Image</label></th> 
				<td>
				<input type="text" style="width:480px;" class="regular-text code" value="<?php 
        print $release['release_cover_image_large'];
        ?>
" name="release_cover_image_large" id="release_cover_image_large" maxlength="200" />
				</td> 
			</tr>
			<tr valign="top">
				<th scope="row"><label for="release_cover_image_huge">Huge Cover Image</label></th> 
				<td>
				<input type="text" style="width:480px;" class="regular-text code" value="<?php 
        print $release['release_cover_image_huge'];
        ?>
" name="release_cover_image_huge" id="release_cover_image_huge" maxlength="200" />
				</td> 
			</tr>
		</table>
		<h3>Press</h4>
		<p>Release One Sheet  <input type="text" style="width:480px;" class="regular-text code" value="<?php 
        print $release['release_one_sheet'];
        ?>
" name="release_one_sheet" id="release_one_sheet" maxlength="200" /></p>
		<p class="submit">
			<input type="submit" name="Submit" class="button-primary" value="Next" />
		</p>
		</form>
		<?php 
        set_transient('ribcage_temp_data', serialize($release), 60 * 60);
    } elseif (isset($_REQUEST['ribcage_action']) && $_REQUEST['ribcage_action'] == 'add_release') {
        // Get the tracks that have been set, if we have been sent any.
        $tracks = get_transient('ribcage_temp_tracks');
        $tracks = unserialize($tracks);
        if (!$tracks) {
            $track_count = 0;
            while ($track_count < $_POST['release_tracks_no']) {
                $track_count++;
                $tracks[] = array('track_title' => '', 'track_time' => '', 'track_release_id' => $release['release_id'], 'track_mbid' => '', 'track_slug' => '', 'track_number' => $track_count, 'track_stream' => '');
            }
        }
        $artist = get_artist($_POST['release_artist']);
        $release['release_artist'] = $_POST['release_artist'];
        $release['release_tracks'] = $tracks;
        set_transient('ribcage_allow_download', $_POST['allow_download'], 60 * 60);
        set_transient('ribcage_allow_torrent', $_POST['allow_torrent'], 60 * 60);
        unset($_POST['allow_download']);
        unset($_POST['allow_torrent']);
        // Whack all the inputed variables into $release
        foreach ($_POST as $key => $var) {
            $release[$key] = $var;
        }
        // If we don't have any data from Musicbrainz then this is the time to guess some stuff.
        $test = get_transient('ribcage_got_mb');
        if ($test != 1) {
            $artist = get_artist($release['release_artist']);
            $artist_slug = $artist['artist_slug'];
            $release = array_merge($release, array('release_cover_image_tiny' => get_option('siteurl') . get_option('ribcage_image_location') . 'covers/tiny/' . $release['release_slug'] . '.jpg', 'release_cover_image_large' => get_option('siteurl') . get_option('ribcage_image_location') . 'covers/large/' . $release['release_slug'] . '.jpg', 'release_cover_image_huge' => get_option('siteurl') . get_option('ribcage_image_location') . 'covers/huge/' . $release['release_slug'] . '.jpg', 'release_mp3' => get_option('ribcage_file_location') . $artist_slug . '/' . $release['release_slug'] . '/download/zip/' . $release['release_slug'] . '-mp3.zip', 'release_ogg' => get_option('ribcage_file_location') . $artist_slug . '/' . $release['release_slug'] . '/download/zip/' . $release['release_slug'] . '-ogg.zip', 'release_flac' => get_option('ribcage_file_location') . $artist_slug . '/' . $release['release_slug'] . '/download/zip/' . $release['release_slug'] . '-flac.zip', 'release_torrent_mp3' => '', 'release_torrent_ogg' => '', 'release_torrent_flac' => '', 'release_one_sheet' => get_option('siteurl') . get_option('ribcage_file_location') . 'pdf/onesheets/' . $release['release_slug'] . '.pdf'));
        }
        ?>
		<h2>Add Release - Track Details</h2>
		<p>Please check the following details for <?php 
        artist_name();
        ?>
 - <?php 
        release_title();
        ?>
.</p>
		<?php 
        ribcage_tracks_form();
        ?>
		</div>
		<?php 
        // Dump this because we already have tracks save in $tracks, hased in the database as ribcage_temp_tracks.
        unset($release['release_tracks']);
        // Save data.
        $saved_temp = unserialize(get_transient('ribcage_temp_data'));
        if ($saved_temp) {
            $temp = array_merge($release, $saved_temp);
            $temp = serialize($temp);
        } else {
            $temp = serialize($release);
        }
        set_transient('ribcage_temp_data', $temp, 60 * 60);
        return 0;
    } else {
        if (isset($_POST['lookup']) && $_POST['lookup'] != '') {
            ?>
		<h2>Add Release - Release Details</h2> <?php 
            if ($_POST['lookup'] == 'Lookup') {
                $mbid = $_POST['musicbrainz_id'];
                $result = mb_get_release($mbid);
                if (is_wp_error($result)) {
                    ?>
				<?php 
                    switch ($result->get_error_code()) {
                        case 'mb_not_found':
                            ?>
						<p>Ribcage could not find a release with a MBID of <?php 
                            echo $mbid;
                            ?>
 in the Musicbrainz database.</p>
						<p>Please enter the release manually, but don't forget to add it to Musicbrainz afterwards.</p>
						<?php 
                            break;
                        case 'artist_not_found':
                            ?>
						// TODO Find out if we don't have this artist.
						<p><?php 
                            echo $artist;
                            ?>
 is not an artist in the Ribcage database. Yet.</p>
						<p>You need to <a href="admin.php?page=add_artist">add an artist</a> before you can add their releases.</p>
						<?php 
                            return 1;
                            break;
                    }
                    ?>
				</div>
				<?php 
                }
                $artist_slug = $artist['artist_slug'];
                // Let people know we got some interesting things from Musicbrainz.
                set_transient('ribcage_got_mb', '1', 60 * 60);
                // Guess some things about our release.
                $release = array_merge($release, array('release_cover_image_tiny' => get_option('siteurl') . get_option('ribcage_image_location') . 'covers/tiny/' . $release['release_slug'] . '.jpg', 'release_cover_image_large' => get_option('siteurl') . get_option('ribcage_image_location') . 'covers/large/' . $release['release_slug'] . '.jpg', 'release_cover_image_huge' => get_option('siteurl') . get_option('ribcage_image_location') . 'covers/huge/' . $release['release_slug'] . '.jpg', 'release_mp3' => get_option('ribcage_file_location') . $artist_slug . '/' . $release['release_slug'] . '/download/zip/' . $release['release_slug'] . '-mp3.zip', 'release_ogg' => get_option('ribcage_file_location') . $artist_slug . '/' . $release['release_slug'] . '/download/zip/' . $release['release_slug'] . '-ogg.zip', 'release_flac' => get_option('ribcage_file_location') . $artist_slug . '/' . $release['release_slug'] . '/download/zip/' . $release['release_slug'] . '-flac.zip', 'release_torrent_mp3' => '', 'release_torrent_ogg' => '', 'release_torrent_flac' => '', 'release_one_sheet' => get_option('siteurl') . get_option('ribcage_file_location') . 'pdf/onesheets/' . $release['release_slug'] . '.pdf'));
            }
            $tracks = serialize($release['release_tracks']);
            // Stage 1 - Add the details of the release or correct those from Musicbrainz
            ribcage_release_form();
            // Anything else goes in a transient until further notice.
            if ($release) {
                set_transient('ribcage_temp_tracks', $tracks, 60 * 60);
                $temp = array('release_mbid' => $release['release_mbid'], 'release_physical_cat_no' => $release['release_physical_cat_no'], 'release_cover_image_tiny' => $release['release_cover_image_tiny'], 'release_cover_image_large' => $release['release_cover_image_large'], 'release_cover_image_huge' => $release['release_cover_image_huge'], 'release_mp3' => $release['release_mp3'], 'release_ogg' => $release['release_ogg'], 'release_flac' => $release['release_flac'], 'release_one_sheet' => $release['release_one_sheet']);
                $temp = serialize($temp);
                set_transient('ribcage_temp_data', $temp, 60 * 60);
            }
        } else {
            // Clear the memory decks, in case we have a half finished transaction.
            delete_transient('ribcage_temp_tracks');
            delete_transient('ribcage_temp_data');
            delete_transient('ribcage_allow_download');
            delete_transient('ribcage_allow_torrent');
            ?>
		<h2>Add Release - Musicbrainz Lookup</h2>
		<form method="post" action="<?php 
            echo str_replace('%7E', '~', $_SERVER['REQUEST_URI']);
            ?>
">
		<p>Please enter the <a href="http://musicbrainz.org">Musicbrainz</a> ID and Ribcage will lookup the release and fill in the details automtically. This should be the Musicbrainz ID of the specific release, not the release group.</p> 
		<p>If your release does not have a Musicbrainz ID, or if you wish to enter the release entirely manually, click on Skip.</p>
		<p>Adding a track to Musicbrainz and then adding it to Ribcage makes it so you only have to type out the details of your release once. It also means that details of your release will be available on a central database, accessible to all.</p>
		<table class="form-table">
		<tr valign="top">
		<th scope="row"><label for="musicbrainz_id">Musicbrainz ID</label></th>
		<td><input type="text" name="musicbrainz_id" value="bce40d0a-6b5f-4d75-97c7-916d67d584f6" class="regular-text code"/></td>
		</tr>
		</table>
		<p class="submit">
		<input type="submit" name="lookup" class="button-primary" value="<?php 
            _e('Lookup');
            ?>
" /><input type="submit" name="lookup" class="button-secondary" value="<?php 
            _e('Skip');
            ?>
" />
		</p>
		</form>
	<?php 
        }
    }
    ?>
	</div>
	<?php 
}
Esempio n. 10
0
/**
 * Runs the whole of Ribcage.
 * A filter on the template that tries to find out if we are on a Ribcage page and responds accordingly.
 *
 * @author Alex Andrews <*****@*****.**>
 * @return void
 */
function ribcage_init()
{
    global $wp_query;
    global $artists, $artist, $current_artist;
    global $releases, $release, $current_release;
    global $tracks, $track, $current_track;
    global $reviews, $review, $current_review;
    global $product;
    wp_enqueue_script('ribcage-player-popup', plugins_url('js/player.js', __FILE__), null, '3.0');
    // Add our streams.
    add_filter('wp_head', 'ribcage_release_feeds');
    if (is_ribcage_page() == 0) {
        return;
    }
    $GLOBALS['ribcage_page'] = TRUE;
    // Add our bits to the page title in the header ans elsewhere.
    add_filter('wp_title', 'ribcage_page_title', 10, 3);
    // Donate IPN from Paypal
    if (isset($wp_query->query_vars['ribcage_donate_ipn'])) {
        ribcage_donate_ipn();
    }
    // Artist Index
    if (isset($wp_query->query_vars['artist_index'])) {
        $artists = list_artists_blurb();
        $artist = $artists[$current_artist];
        $wp_query->query_vars['pagename'] = 'artists';
        $load = ribcage_load_template('artist-index.php');
    }
    // Individual Artist (including bio, contact et al)
    if (isset($wp_query->query_vars['artist_slug'])) {
        $artist = get_artist_by_slug($wp_query->query_vars['artist_slug']);
        if (is_wp_error($artist)) {
            ribcage_404();
        }
        $wp_query->query_vars['pagename'] = $wp_query->query_vars['artist_slug'];
        if (is_artist_page()) {
            switch ($wp_query->query_vars['artist_page']) {
                case 'press':
                    $releases = list_artist_releases($artist['artist_id'], TRUE);
                    $load = ribcage_load_template('press.php');
                    break;
                case 'bio':
                    $load = ribcage_load_template('bio.php');
                    break;
                case 'feed':
                    $releases = list_artist_releases($artist['artist_id']);
                    $load = ribcage_load_template('feeds/artist-rss2.php');
                    break;
                default:
                    $release = get_release_by_slug($wp_query->query_vars['artist_page']);
                    if (is_wp_error($release)) {
                        ribcage_404();
                    }
                    $tracks = $release['release_tracks'];
                    $reviews = $release['release_reviews'];
                    $load = ribcage_load_template('release.php');
            }
        } else {
            $releases = list_artist_releases($artist['artist_id']);
            $load = ribcage_load_template('artist.php');
        }
    }
    // Releases Index
    if (isset($wp_query->query_vars['release_index']) or isset($wp_query->query_vars['release_feed'])) {
        $releases = list_recent_releases_blurb();
        $artists = list_artists_blurb();
        $wp_query->query_vars['pagename'] = 'releases';
        if (isset($wp_query->query_vars['release_feed'])) {
            $load = ribcage_load_template('feeds/release-rss2.php');
        } else {
            $load = ribcage_load_template('release-index.php');
        }
    }
    // Downloads
    if (isset($wp_query->query_vars['ribcage_download'])) {
        // Download whole release.
        if (isset($wp_query->query_vars['release_slug']) && isset($wp_query->query_vars['format'])) {
            // Re-direct them to donate at Paypal
            if ($wp_query->query_vars['format'] == 'donate') {
                $release = get_release_by_slug($wp_query->query_vars['release_slug'], FALSE, FALSE);
                if (is_wp_error($release)) {
                    ribcage_404();
                }
                $artist = get_artist($release['release_artist']);
                if (is_wp_error($artist)) {
                    ribcage_404();
                }
                ribcage_donate();
            } else {
                if ($wp_query->query_vars['format'] == 'back') {
                    ribcage_donate_download_thanks();
                } else {
                    if ($wp_query->query_vars['format'] == 'skip') {
                        $release = get_release_by_slug($wp_query->query_vars['release_slug'], FALSE, FALSE);
                        if (is_wp_error($release)) {
                            ribcage_404();
                        }
                        $artist = get_artist($release['release_artist']);
                        if (is_wp_error($artist)) {
                            ribcage_404();
                        }
                        $load = ribcage_load_template('download.php');
                    } else {
                        $release = get_release_by_slug($wp_query->query_vars['release_slug'], FALSE, FALSE);
                        if (is_wp_error($release)) {
                            ribcage_404();
                        }
                        $artist = get_artist($release['release_artist']);
                        if (is_wp_error($artist)) {
                            ribcage_404();
                        }
                        $load = ribcage_load_template('post-download.php');
                    }
                }
            }
        } else {
            if (isset($wp_query->query_vars['track_slug'])) {
                $load = download_track($wp_query->query_vars['track_slug'], $wp_query->query_vars['format']);
            } else {
                if (isset($wp_query->query_vars['release_slug'])) {
                    $release = get_release_by_slug($wp_query->query_vars['release_slug'], FALSE, FALSE);
                    if (is_wp_error($release)) {
                        ribcage_404();
                    }
                    $artist = get_artist($release['release_artist']);
                    if (is_wp_error($artist)) {
                        ribcage_404();
                    }
                    // Special case for Matthew Jenning's Christmas Koto
                    if ($release["release_slug"] === 'christmas-koto') {
                        $load = ribcage_load_template('koto-nag.php');
                        die;
                    }
                    // If we haven't seen the user before, then nag them about the download.
                    if (!isset($_COOKIE["ask_donate"])) {
                        setcookie("ask_donate", "1", time() + 3600);
                        $load = ribcage_load_template('nag.php');
                    } else {
                        if (isset($_COOKIE["ask_donate"])) {
                            $random = rand(1, 8);
                            if ($random == 5) {
                                $load = ribcage_load_template('nag.php');
                            } else {
                                $load = ribcage_load_template('download.php');
                            }
                        }
                    }
                    // If the user has just got back from Paypal congratulate them on their brillance and given them
                    // the download. Maybe lower the chance of a nag?
                }
            }
        }
    }
    // Streams
    if (isset($wp_query->query_vars['ribcage_stream'])) {
        // Stream whole release.
        if (isset($wp_query->query_vars['release_slug'])) {
            $load = stream_release($wp_query->query_vars['release_slug'], $wp_query->query_vars['stream_format']);
        }
        // Stream individual track.
        if (isset($wp_query->query_vars['track_slug'])) {
            $load = stream_track($wp_query->query_vars['track_slug']);
        }
    }
    if (isset($wp_query->query_vars['ribcage_player'])) {
        if ($wp_query->query_vars['release_slug'] == 'stats') {
            ribcage_log_play();
        } else {
            $load = show_player($wp_query->query_vars['release_slug']);
        }
    }
    // Purchases
    if (isset($wp_query->query_vars['ribcage_buy']) && isset($wp_query->query_vars['ribcage_product_id'])) {
        // Lookup the item they are looking for in the database.
        $product = get_product($wp_query->query_vars['ribcage_product_id']);
        if (is_wp_error($product)) {
            ribcage_404();
        }
        // Some products are associated with releases, some are not.
        if (isset($product['product_related_release'])) {
            $release = get_release($product['product_related_release']);
            $artist = get_artist($release['release_artist']);
        }
        // Set this so the feeds at the bottom of the page show up for the artist.
        $wp_query->query_vars['artist_slug'] = true;
        if (isset($wp_query->query_vars['ribcage_buy_mode'])) {
            switch ($wp_query->query_vars['ribcage_buy_mode']) {
                // Send them to Paypal
                case 'go-ww':
                case 'go-uk':
                    ribcage_buy_process();
                    break;
                    // They just got back from Paypal and it was a success. Thank them for it.
                // They just got back from Paypal and it was a success. Thank them for it.
                case 'thanks':
                    $load = ribcage_load_template('thanks.php');
                    break;
                    // We are recieving an IPN ping from Paypal.
                // We are recieving an IPN ping from Paypal.
                case 'ipn':
                    ribcage_buy_ipn();
                    break;
                    // They cancelled.
                // They cancelled.
                case 'cancel':
                    echo "Cancelled";
                    break;
            }
        } else {
            $load = ribcage_load_template('buy.php');
        }
    }
    // Did we get an error by the end of all this? If so let the user know.
    if (is_wp_error($load)) {
        echo $load->get_error_message();
    }
    // Don't output anything else.
    die;
}
Esempio n. 11
0
            break;
        default:
            //Si aucun corresponds
            header('Location: administration.php');
            exit;
            break;
    }
    $html .= '<input type="hidden" name="id" value="' . $id . '">';
    $html .= '<input type="hidden" name="type" value="' . $mdify . '">';
    $html .= '<button type="submit" class="btn btn-success" name="modifierChamp">Sauvegarder</button>';
    $html .= "</form>";
}
if (isset($_REQUEST['v'])) {
    switch ($_REQUEST['v']) {
        case 'a':
            get_artist();
            break;
        case 's':
            get_schedule();
            break;
        case 'u':
            get_user();
            break;
        case 'c':
            get_comment();
        default:
            get_comment();
            //Par défaut on affiche la gestion des commentaires
            break;
    }
} else {
    $type = $_GET['type'];
}
// Check for the path elements
$path = $_SERVER[PATH_INFO];
if ($path != null) {
    $path_params = spliti("/", $path);
}
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
    // GET Request
    set_headers($type);
    if ($path_params[1] != null) {
        if ($path_params[1] == "artists") {
            if ($path_params[2] != null) {
                render_result(get_artist("tracks", $path_params[2]), "artists", $type);
            } else {
                render_result(get_artist("tracks"), "artists", $type);
            }
        } else {
            if ($path_params[2] != null) {
                $rowtitles = get_row_titles("tracks");
                // get rows of gd-table tracks
                if (in_array($path_params[2], $rowtitles)) {
                    render_result(get_track($path_params[1], $path_params[2]), "tracks", $type);
                    /* render explicit info of track given by id */
                } elseif ($path_params[2] == "audio") {
                    get_audio_data($path_params[1]);
                    /* deliver binary audio-data of track given by id */
                } else {
                    render_result(get_track($path_params[1]), "tracks", $type);
                    /* render all infos of track given by id (if wrong info is ordered) */
                }
    $type = $_GET['type'];
}
// Check for the path elements
$path = $_SERVER[PATH_INFO];
if ($path != null) {
    $path_params = spliti("/", $path);
}
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
    // GET Request
    set_headers($type);
    if ($path_params[1] != null) {
        if ($path_params[1] == "artists") {
            if ($path_params[2] != null) {
                render_result(get_artist("album", $path_params[2]), "artists", $type);
            } else {
                render_result(get_artist("album"), "artists", $type);
            }
        } else {
            if ($path_params[2] != null) {
                $rowtitles = get_row_titles("album");
                // get rows of gd-table album
                if (in_array($path_params[2], $rowtitles)) {
                    render_result(get_album($path_params[1], $path_params[2]), "albums", $type);
                    /* render explicit info of album given by cddbid */
                } elseif ($path_params[2] == "tracks") {
                    render_result(get_track(null, null, $path_params[1]), "albums", $type);
                    /* render tracklist from album given by cddbid */
                } else {
                    render_result(get_album($path_params[1]), "albums", $type);
                    /* render all infos of album given by cddbid (if wrong info is ordered) */
                }
Esempio n. 14
0
/**
 * Gets a release from Musicbrainz then puts the values of it into the global $release variable.
 * Uses a simple XML get to avoid the bloat of loading huge Musicbrainz object infested libraries.
 *
 * @author Alex Andrews <*****@*****.**>
 * @param string $mbid Musicbrainz ID to get.
 * @return array The details of the release.
 */
function mb_get_release($mbid)
{
    global $release, $artist;
    $request_url = "http://musicbrainz.org/ws/1/release/{$mbid}?type=xml&inc=release-events+tracks+artist";
    $xml = simplexml_load_file($request_url);
    if (!$xml) {
        return new WP_Error('ribcage-not-found', __("The MBID {$mbid} couldn't be found in the Musicbrainz database."));
    }
    $xml = object_to_array($xml);
    $release_physical = NULL;
    $release_physical_id = NULL;
    if (count($xml['release']['release-event-list']['event']) > 1) {
        foreach ($xml['release']['release-event-list']['event'] as $release_event) {
            if ($release_event['@attributes']['format'] == 'Digital') {
                $release_id = cat_to_release_id($release_event['@attributes']['catalog-number']);
                $release_date = $release_event['@attributes']['date'];
            } elseif ($release_event['@attributes']['format'] == 'CD') {
                // I'm assuming here that you aren't going to have loads of release events for CDs etc, but just one.
                $release_physical = 1;
                $release_physical_id = cat_to_release_id($release_event['@attributes']['catalog-number']);
            }
        }
    } else {
        $release_id = cat_to_release_id($xml['release']['release-event-list']['event']['@attributes']['catalog-number']);
        $release_date = $xml['release']['release-event-list']['event']['@attributes']['date'];
    }
    $release_artist_id = slug_to_artist_id(ribcage_slugize($xml['release']['artist']['name']));
    $release_slug = ribcage_slugize($xml['release']['title']);
    $artist_slug = ribcage_slugize($xml['release']['artist']['name']);
    $artist = get_artist($release_artist_id);
    // If we can't put anything in the artist, then the artist is actually not in the database. Bail out.
    if (!$artist) {
        $artist = $xml['release']['artist']['name'];
        return new WP_Error('ribcage-artist-not-found', __("Sorry, {$artist} is not in the Ribcage database"));
    }
    $track_no = 1;
    $total_time = 0;
    // Add tracks to $release
    foreach ($xml['release']['track-list']['track'] as $track) {
        $total_time = $total_time + $track['duration'];
        $tracks[] = array('track_title' => $track['title'], 'track_time' => miliseconds_to_sql($track['duration']), 'track_release_id' => $release_id, 'track_mbid' => $track['@attributes']['id'], 'track_slug' => ribcage_slugize($track['title']), 'track_number' => $track_no, 'track_stream' => 'http://recordsonribs.com/files/audio/' . $artist_slug . '/' . $release_slug . '/stream/' . str_pad($track_no, 2, "0", STR_PAD_LEFT) . '.mp3');
        ++$track_no;
    }
    $release = array('release_id' => $release_id, 'release_tracks_no' => $track_no - 1, 'release_artist' => $release_artist_id, 'release_date' => $release_date, 'release_title' => $xml['release']['title'], 'release_slug' => $release_slug, 'release_time' => miliseconds_to_sql($total_time), 'release_mbid' => $xml['release']['@attributes']['id'], 'release_physical' => $release_physical, 'release_physical_cat_no' => $release_physical_id, 'release_tracks' => $tracks);
    return $release;
}
Esempio n. 15
0
			$Nothing = false;
?>
		<div class="head colhead">
			You have snatched the following of <?php 
echo $Username2;
?>
's uploads:
		</div>
		<div class='pad'>
			<ul>
<? 
			while(list($TorrentID, $Media, $Format, $Encoding, $GroupID, $GroupName) = $DB->next_record()) {
				$Extra = $Format." / ".$Encoding." / ".$Media;
?>
				<li><?php 
echo display_artists(get_artist($GroupID), true, false);
?>
 - <a href="torrents.php?id=<?php 
echo $GroupID;
?>
"><?php 
echo $GroupName;
?>
</a> [<a href="torrents.php?id=<?php 
echo $GroupID;
?>
&amp;torrentid=<?php 
echo $TorrentID;
?>
"><?php 
echo $Extra;
Esempio n. 16
0
/**
 * Outputs a number of recent albums in an unordered list of various kinds.
 *
 * @author Alex Andrews <*****@*****.**>
 * @param int $amount The number of recent albums you want to output.
 * @param string $mode Different formats: 'list' simple list, 'covers' list of covers, similar to the sidebar widget.
 * @param bool $nav_bar Displays a navigation bar for each release.
 * @param string $css An optional css marker to put in the style of each element.
 */
function ribcage_albums($amount = 5, $mode = 'list', $nav_bar = TRUE, $css = NULL)
{
    global $releases, $release;
    global $artist;
    if ($releases == NULL) {
        $releases = list_recent_releases_blurb($amount);
    }
    ?>
	<ul class="ribcage albums<?php 
    if (isset($css)) {
        print " {$css}";
    }
    ?>
">
	<?php 
    while (have_releases()) {
        the_release();
        ?>
	<?php 
        $artist = get_artist($release['release_artist']);
        ?>
		<li class="ribcage albums<?php 
        if (isset($css)) {
            print " {$css}";
        }
        ?>
 <?php 
        release_slug();
        ?>
">
			<ul class="ribcage albums<?php 
        if (isset($css)) {
            print " {$css}";
        }
        ?>
 <?php 
        release_slug();
        ?>
">
				<?php 
        if ($mode == 'covers') {
            ?>
				<li class="album_cover"><a class="ribcage albums album_cover" href="<a href="<?php 
            echo home_url();
            ?>
/artists/<?php 
            artist_slug();
            ?>
/<?php 
            release_slug();
            ?>
"><img src="<?php 
            release_cover_tiny();
            ?>
" alt="<?php 
            release_title();
            ?>
" /></a></li>
				<?php 
        }
        ?>
				<li class="artist"><a href="<?php 
        echo home_url();
        ?>
/artists/<?php 
        artist_slug();
        ?>
/"><?php 
        artist_name();
        ?>
</a></li>
				<li class="title"><a href="<?php 
        echo home_url();
        ?>
/artists/<?php 
        artist_slug();
        ?>
/<?php 
        release_slug();
        ?>
"><?php 
        release_title();
        ?>
</a></li>
				<?php 
        if ($nav_bar) {
            ?>
				<li class="nav">
					<ul class="nav">
						<li class="more"><a href="<?php 
            echo home_url();
            ?>
/artists/<?php 
            artist_slug();
            ?>
/<?php 
            release_slug();
            ?>
">More</a></li>
						<li class="listen"><a href="javascript:popUp('<?php 
            release_player_link();
            ?>
')">Listen</a></li>
						<?php 
            if (release_physical()) {
                ?>
						<li class="download"><a href="<?php 
                echo home_url();
                ?>
/download/<?php 
                release_slug();
                ?>
/">Download</a></li>
							<li class="last buy"><a href="<?php 
                echo home_url();
                ?>
/buy/<?php 
                release_product_id();
                ?>
">Buy</a></li>
						<?php 
            } else {
                ?>
						<li class="last download"><a href="<?php 
                echo home_url();
                ?>
/download/<?php 
                release_slug();
                ?>
/">Download</a></li>
						<?php 
            }
            ?>
					</ul>
				</li>
				<?php 
        }
        ?>
			</ul>
		</li>
	<?php 
    }
    ?>
	</ul>
	<?php 
}
Esempio n. 17
0
		tg.Name AS Title,
		tg.Year,
		tg.RecordLabel,
		tg.CatalogueNumber,
		tg.WikiImage AS Image,
		tg.WikiBody AS GroupDescription,
		tg.ReleaseType
		FROM torrents_group AS tg
		LEFT JOIN torrents AS t ON t.GroupID = tg.ID
		WHERE tg.ID=".$_GET['groupid']."
		GROUP BY tg.ID");
	
	list($Properties) = $DB->to_array(false,MYSQLI_BOTH);
	$UploadForm = $Categories[$Properties['CategoryID']-1];
	$Properties['CategoryName'] = $Categories[$Properties['CategoryID']-1];
	$Properties['Artists'] = get_artist($_GET['groupid']);
	
	$DB->query("SELECT 
		GROUP_CONCAT(tags.Name SEPARATOR ', ') AS TagList 
		FROM torrents_tags AS tt JOIN tags ON tags.ID=tt.TagID
		WHERE tt.GroupID='$_GET[groupid]'");
	
	list($Properties['TagList']) = $DB->next_record();
}

if(!empty($_GET['requestid']) && is_number($_GET['requestid'])) {
	include(SERVER_ROOT.'/sections/requests/functions.php');	
	$DB->query("SELECT
		r.ID AS RequestID,
		r.CategoryID,
		r.Title AS Title,
Esempio n. 18
0
function ribcage_manage_artists($value = '')
{
    if (isset($_REQUEST['artist'])) {
        global $wpdb;
        $artist_id = (int) $_REQUEST['artist'];
        $hidden_field_name = 'ribcage_artist_edit';
        $button_name = 'Edit Artist';
        if ($_POST[$hidden_field_name] == 'M') {
            // an artist is posted
            //slice off two variables at the end to prepare for implodes
            array_pop($_POST);
            // hidden var
            array_pop($_POST);
            // submit button var
            //split apart associative array into different parts to prepare for implodes
            $post_keys = array_keys($_POST);
            $post_vals = array_values($_POST);
            //construct field name list and vals to post
            $string_keys = implode($post_keys, ",");
            $string_vals = "'" . implode($post_vals, "','") . "'";
            $wpdb->show_errors();
            //construct query
            $sql = "UPDATE " . $wpdb->prefix . "ribcage_artists\n\t\t\t\tSET ";
            $i = 0;
            foreach ($post_keys as $field) {
                $sql .= $field . "='" . $post_vals[$i] . "', ";
                $i++;
            }
            $sql .= " artist_id = " . $artist_id . " \n\t\t\t\tWHERE artist_id = " . $artist_id;
            #		echo "<pre>$sql</pre>"; exit();
            $results = $wpdb->query($sql);
            $wpdb->hide_errors();
            //display snazzy update fade thing when they are added
            echo <<<EOT
\t\t\t<div id="message" class="updated fade"><p><strong>Artist updated.</strong></p></div>
EOT;
        }
        $artist = get_artist($_REQUEST['artist']);
        $artist_name_val = $artist['artist_name'];
        $artist_name_sort_val = $artist['artist_name_sort'];
        $artist_slug_val = $artist['artist_slug'];
        $artist_mbid_val = $artist['artist_mbid'];
        $artist_signed_val = $artist['artist_signed'];
        $artist_license_val = $artist['artist_license'];
        $artist_bio_val = $artist['artist_bio'];
        $artist_picture1_val = $artist['artist_picture1'];
        $artist_picture2_val = $artist['artist_picture2'];
        $artist_picture3_val = $artist['artist_picture3'];
        $artist_picturezip_val = $artist['artist_picturezip'];
        $artist_contact_email_val = $artist['artist_contact_email'];
        $artist_contact_phone_val = $artist['artist_contact_phone'];
        $artist_blurb_tiny_val = $artist['artist_blurb_tiny'];
        $artist_blurb_short_val = $artist['artist_blurb_short'];
        $artist_link_website_val = $artist['artist_link_website'];
        $artist_link_myspace_val = $artist['artist_link_myspace'];
        $artist_link_facebook_val = $artist['artist_link_facebook'];
        ?>
	<div class="wrap">
		<h2>Manage <em><?php 
        echo $artist['artist_name'];
        ?>
</em> (#<?php 
        echo $artist['artist_id'];
        ?>
)</h2>
			<form action="<?php 
        echo str_replace('%7E', '~', $_SERVER['REQUEST_URI']);
        ?>
" method="post" id="ribcage_edit_artist" name="edit_artist"> 
				<fieldset>
					<legend>Artist info</legend>
					<table class="optiontable">                     
						<tr valign="top">
							<th scope="row"><strong>Name: </strong></th> 
							<td>
								<input type="text" style="width:320px;" class="cleardefault" value="<?php 
        echo $artist_name_val;
        ?>
" name="artist_name" id="artist_name" maxlength="200" />												
							</td> 
						</tr>
						<tr valign="top">
							<th scope="row"><strong>Sort Name: </strong></th> 
							<td>
								<input type="text" style="width:320px;" class="cleardefault" value="<?php 
        echo $artist_name_sort_val;
        ?>
" name="artist_name_sort" id="artist_name_sort" />
							</td> 
						</tr>
						<tr valign="top">
							<th scope="row"><strong>Artist Slug: </strong></th> 
							<td>
								<input type="text" style="width:320px;" class="cleardefault" value="<?php 
        echo $artist_slug_val;
        ?>
" name="artist_slug" id="artist_slug" />
							</td> 
						</tr>
						<!--<tr valign="top">
							<th scope="row"><strong>Starting hits: </strong></th> 
							<td>
								<input type="text" style="width:100px;" class="cleardefault" value="<?php 
        echo $artist_hits_val;
        ?>
" name="artist_hits" id="artist_hits" maxlength="50" />
							</td> 
						</tr>-->
						<tr valign="top">
							<th scope="row"><strong>Artist's Music Brainz ID: </strong></th> 
							<td>
								<input type="text" style="width:320px;" class="cleardefault" value="<?php 
        echo $artist_mbid_val;
        ?>
" name="artist_mbid" id="artist_mbid" maxlength="50" />
							</td> 
						</tr>
						<tr valign="top">
							<th scope="row"><strong>Signup Date: </strong></th> 
							<td>
								<input type="text" style="width:100px;" class="cleardefault" value="<?php 
        echo $artist_signed_val;
        ?>
" name="artist_signed" id="artist_signed" maxlength="50" />
							</td> 
						</tr>
						<tr valign="top">
							<th scope="row"><strong>Creative Commons license: </strong></th> 
							<td>
								<?php 
        echo ribcage_cc_dropdown($artist_license_val);
        ?>
							</td> 
						</tr>
						<tr valign="top">
							<th scope="row"><strong>Artist Biography: </strong></th> 
							<td>
								<textarea rows="5" cols="50" name="artist_bio" id="artist_bio"><?php 
        echo $artist_bio_val;
        ?>
</textarea>
							</td> 
						</tr>
						<tr valign="top">
							<th scope="row"><strong>Artist Picture 1: </strong></th> 
							<td>
								<input type="text" style="width:320px;" class="cleardefault" value="<?php 
        echo $artist_picture_1_val;
        ?>
" name="artist_picture_1" id="artist_picture_1" maxlength="200" />
							</td> 
						</tr>
						<tr valign="top">
							<th scope="row"><strong>Artist Picture 2: </strong></th> 
							<td>
								<input type="text" style="width:320px;" class="cleardefault" value="<?php 
        echo $artist_picture_2_val;
        ?>
" name="artist_picture_2" id="artist_picture_2" maxlength="200" />
							</td> 
						</tr>
						<tr valign="top">
							<th scope="row"><strong>Artist Picture 3: </strong></th> 
							<td>
								<input type="text" style="width:320px;" class="cleardefault" value="<?php 
        echo $artist_picture_3_val;
        ?>
" name="artist_picture_3" id="artist_picture_3" maxlength="200" />
							</td> 
						</tr>
						<tr valign="top">
							<th scope="row"><strong>Artist Picture HQ Zipfile URL: </strong></th> 
							<td>
								<input type="text" style="width:320px;" class="cleardefault" value="<?php 
        echo $artist_picture_zip_val;
        ?>
" name="artist_picture_zip" id="artist_picture_zip" maxlength="200" />
							</td> 
						</tr>
						<tr valign="top">
							<th scope="row"><strong>Artist E-mail: </strong></th> 
							<td>
								<input type="text" style="width:320px;" class="cleardefault" value="<?php 
        echo $artist_contact_email_val;
        ?>
" name="artist_contact_email" id="artist_contact_email" maxlength="150" />
							</td> 
						</tr>
						<tr valign="top">
							<th scope="row"><strong>Artist Phone: </strong></th> 
							<td>
								<input type="text" style="width:100px;" class="cleardefault" value="<?php 
        echo $artist_contact_phone_val;
        ?>
" name="artist_contact_phone" id="artist_contact_phone" maxlength="20" />
							</td> 
						</tr>
						<tr valign="top">
							<th scope="row"><strong>One-sentence Description of Artist: </strong></th> 
							<td>
								<input type="text" style="width:320px;" class="cleardefault" value="<?php 
        echo $artist_blurb_tiny_val;
        ?>
" name="artist_blurb_tiny" id="artist_blurb_tiny" maxlength="255" />
							</td> 
						</tr>
						<tr valign="top">
							<th scope="row"><strong>One-paragraph Description of Artist: </strong></th> 
							<td>
								<textarea rows="5" cols="50" name="artist_blurb_short" id="artist_blurb_short"><?php 
        echo $artist_blurb_short_val;
        ?>
</textarea>
							</td> 
						</tr>
						<tr valign="top">
							<th scope="row"><strong>Website URL: </strong></th> 
							<td>
								<input type="text" style="width:320px;" class="cleardefault" value="<?php 
        echo $artist_link_website_val;
        ?>
" name="artist_link_website" id="artist_link_website" maxlength="200" />
							</td> 
						</tr>
						<tr valign="top">
							<th scope="row"><strong>MySpace URL: </strong></th> 
							<td>
								<input type="text" style="width:320px;" class="cleardefault" value="<?php 
        echo $artist_link_myspace_val;
        ?>
" name="artist_link_myspace" id="artist_link_myspace" maxlength="200" />
							</td> 
						</tr>
						<tr valign="top">
							<th scope="row"><strong>Facebook URL: </strong></th> 
							<td>
								<input type="text" style="width:320px;" class="cleardefault" value="<?php 
        echo $artist_link_facebook_val;
        ?>
" name="artist_link_facebook" id="artist_link_facebook" maxlength="200" />
							</td> 
						</tr>
						<tr>
							<th scope="row"></th> 
							<td>
							<p class="submit">													
								<input type="submit" class="btn" name="save" style="padding:5px 30px 5px 30px;" value="<?php 
        echo $button_name;
        ?>
" />
								<input type="hidden" name="<?php 
        echo $hidden_field_name;
        ?>
" value="M">
							</p>
							</td>
						</tr>
					</table>

				</fieldset>
			</form>
	</div>
<?php 
    } else {
        ?>
	<div class="wrap">
		<h2>Manage Artists</h2>
			<form action="<?php 
        echo str_replace('%7E', '~', $_SERVER['REQUEST_URI']);
        ?>
" method="post" id="ribcage_manage_artists" name="manage_artists"> 
				<fieldset>
					<legend>Here's your label's Artists. Take care of them!</legend>
					<table class="optiontable">
						<thead>
						<tr valign="top">
							<td>#</td>
							<td>Name</td>
							<td>Sort Name</td>
							<td>Picture</td>
						</tr>
						</thead>                     
						<tbody>
							<?php 
        $artists = list_artists_blurb();
        foreach ($artists as $artist) {
            ?>
						<tr valign="top">
							<td><?php 
            echo $artist['artist_id'];
            ?>
</td>
							<td><a href="?page=manage_artists&amp;artist=<?php 
            echo $artist['artist_id'];
            ?>
">
								<?php 
            echo $artist['artist_name'];
            ?>
</a></td>
							<td><?php 
            echo $artist['artist_name_sort'];
            ?>
</td>
							<td><?php 
            echo $artist['artist_thumb'];
            ?>
</td>
						</tr>
							<?php 
        }
        ?>
						</tbody>
					</table>
				</fieldset>
			</form>
	</div>
	<?php 
    }
}
Esempio n. 19
0
					t.Format,
					t.Encoding,
					IF(t.RemasterYear=0,tg.Year,t.RemasterYear),
					tg.ID AS GroupID,
					tg.Name,
					tg.WikiImage,
					tg.CategoryID
					FROM torrents AS t
					INNER JOIN torrents_group AS tg ON tg.ID=t.GroupID
					WHERE t.ID='".db_string($TorrentID)."'");
				if($DB->record_count() < 1) {
					header('Location: log.php?search='.$TorrentID);
					die();
				}
				$Info = array($DB->next_record(MYSQLI_NUM, array(4,5,6)));
				$Info['Artists'] = display_artists(get_artist($Info[0][4]), false, true);
				$Cache->cache_value('torrent_download_'.$TorrentID, $Info, 0);
			}
			if(!is_array($Info[0])) {
				error(404);
			}
			list($Media,$Format,$Encoding,$Year,$GroupID,$Name,$Image, $CategoryID) = array_shift($Info); // used for generating the filename
			$Artists = $Info['Artists'];
			
			//Stupid Recent Snatches On User Page
			if($CategoryID == '1' && $Image != "") {
				$RecentSnatches = $Cache->get_value('recent_snatches_'.$UserID);
				if(is_array($RecentSnatches)) {
					array_pop($RecentSnatches);
					array_unshift($RecentSnatches, array('ID'=>$GroupID,'Name'=>$Name,'Artist'=>$Artists,'WikiImage'=>$Image));
				} else {
Esempio n. 20
0
function generate_torrent_table($Caption, $Tag, $Details, $Limit) {
	global $LoggedUser,$Categories;
?>
		<h3>Top <?php 
echo $Limit . ' ' . $Caption;
?>
<?	if(empty($_GET['advanced'])){ ?> 
		<small>
			- [<a href="top10.php?type=torrents&amp;limit=100&amp;details=<?php 
echo $Tag;
?>
">Top 100</a>]
			- [<a href="top10.php?type=torrents&amp;limit=250&amp;details=<?php 
echo $Tag;
?>
">Top 250</a>]
		</small>
<?	} ?> 
		</h3>
	<table class="border">
	<tr class="colhead">
		<td class="center" style="width:15px;"></td>
		<td></td>
		<td><strong>Name</strong></td>
		<td style="text-align:right"><strong>Data</strong></td>
		<td style="text-align:right"><img src="static/styles/<?php 
echo $LoggedUser['StyleName'];
?>
/images/snatched.png" alt="Snatches" title="Snatches" /></td>
		<td style="text-align:right"><img src="static/styles/<?php 
echo $LoggedUser['StyleName'];
?>
/images/seeders.png" alt="Seeders" title="Seeders" /></td>
		<td style="text-align:right"><img src="static/styles/<?php 
echo $LoggedUser['StyleName'];
?>
/images/leechers.png" alt="Leechers" title="Leechers" /></td>
		<td style="text-align:right"><strong>Peers</strong></td>
	</tr>
<?
	// 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 />
<?
		return;
	}
	$Rank = 0;

	foreach ($Details as $Detail) {
		list($TorrentID,$GroupID,$GroupName,$GroupCategoryID,$TorrentTags,
			$Format,$Encoding,$Media,$Scene,$HasLog,$HasCue,$LogScore,$Year,$GroupYear,
			$RemasterTitle,$Snatched,$Seeders,$Leechers,$Data) = $Detail;

		// highlight every other row
		$Rank++;
		$Highlight = ($Rank % 2 ? 'a' : 'b');

		// generate torrent's title
		$DisplayName='';
		
		$Artists = get_artist($GroupID);
		
		if(!empty($Artists)) {
			$DisplayName = display_artists($Artists, true, true);
		}
		
		$DisplayName.= "<a href='torrents.php?id=$GroupID&amp;torrentid=$TorrentID'  title='View Torrent'>$GroupName</a>";

		if($GroupCategoryID==1 && $GroupYear>0) {
			$DisplayName.= " [$GroupYear]";
		}

		// append extra info to torrent title
		$ExtraInfo='';
		$AddExtra='';
		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($ExtraInfo!='') {
			$ExtraInfo = "- [$ExtraInfo]";
		}
		
		$TagList=array();
		
		$PrimaryTag = '';
		if($TorrentTags!='') {
			$TorrentTags=explode(' ',$TorrentTags);
			foreach ($TorrentTags as $TagKey => $TagName) {
				$TagName = str_replace('_','.',$TagName);
				$TagList[]='<a href="torrents.php?taglist='.$TagName.'">'.$TagName.'</a>';
			}
			$PrimaryTag = $TorrentTags[0];
			$TagList = implode(', ', $TagList);
			$TorrentTags='<br /><div class="tags">'.$TagList.'</div>';
		}

		// print row
?>
	<tr class="group_torrent row<?php 
echo $Highlight;
?>
">
		<td style="padding:8px;text-align:center;"><strong><?php 
echo $Rank;
?>
</strong></td>
		<td class="center cats_col"><div title="<?php 
echo ucfirst(str_replace('_', ' ', $PrimaryTag));
?>
" class="cats_<?php 
echo strtolower(str_replace(array('-', ' '), array('', ''), $Categories[$GroupCategoryID - 1]));
?>
 tags_<?php 
echo str_replace('.', '_', $PrimaryTag);
?>
"></div></td>
		<td>
		<span>[<a href="torrents.php?action=download&amp;id=<?php 
echo $TorrentID;
?>
&amp;authkey=<?php 
echo $LoggedUser['AuthKey'];
?>
&amp;torrent_pass=<?php 
echo $LoggedUser['torrent_pass'];
?>
" title="Download">DL</a>]</span>
			<strong><?php 
echo $DisplayName;
?>
</strong> <?php 
echo $ExtraInfo;
?>
			<?php 
echo $TorrentTags;
?>
		</td>
		<td style="text-align:right" class="nobr"><?php 
echo get_size($Data);
?>
</td>
		<td style="text-align:right"><?php 
echo number_format((double) $Snatched);
?>
</td>
		<td style="text-align:right"><?php 
echo number_format((double) $Seeders);
?>
</td>
		<td style="text-align:right"><?php 
echo number_format((double) $Leechers);
?>
</td>
		<td style="text-align:right"><?php 
echo number_format($Seeders + $Leechers);
?>
</td>
	</tr>
<?
	}
?>
	</table><br />
<?
}
Esempio n. 21
0
?>
</pubDate>
	<generator>http://wordpress.org/?v=<?php 
bloginfo_rss('version');
?>
</generator>
	<language><?php 
echo get_option('rss_language');
?>
</language>
	<?php 
while (have_releases()) {
    the_release();
    ?>
	<?php 
    $artist = get_artist($release['release_artist']);
    ?>
	<item>
		<title><?php 
    artist_name();
    ?>
 - <?php 
    release_title();
    ?>
</title>
		<link><a href="<?php 
    echo home_url();
    ?>
/artists/<?php 
    artist_slug();
    ?>
Esempio n. 22
0
    /**
     * Adds a widget for recent releases, the quantity of which is defined by an option.
     *
     * @author Alexander Andrews
     **/
    function recent_releases($args)
    {
        global $releases, $release, $artist;
        extract($args);
        $releases = list_recent_releases_blurb('5');
        $artists = list_artists_blurb();
        ?>
	        <?php 
        echo $before_widget;
        ?>
	            <?php 
        echo $before_title . 'Recent Releases' . $after_title;
        ?>
				<div class="textwidget" align="left">
	            <?php 
        while (have_releases()) {
            the_release();
            ?>
	
				<?php 
            $artist = get_artist($release['release_artist']);
            ?>
				<div style="margin-bottom:25px;font-size:12px;"><a href="<?php 
            echo get_option('siteurl');
            ?>
/artists/<?php 
            artist_slug();
            ?>
/<?php 
            release_slug();
            ?>
"><img src="<?php 
            release_cover_tiny();
            ?>
" align="right" style="margin-left: 10px; border: 1px solid #000;" height="65px" width="65px" alt="<?php 
            release_title();
            ?>
" /></a>		
				<a href="<?php 
            echo get_option('siteurl');
            ?>
/artists/<?php 
            artist_slug();
            ?>
/" style="font-size:12px;"><?php 
            artist_name();
            ?>
</a> - <a href="<?php 
            echo get_option('siteurl');
            ?>
/artists/<?php 
            artist_slug();
            ?>
/<?php 
            release_slug();
            ?>
" style="font-size:12px;"><?php 
            release_title();
            ?>
</a><br />
				<div style="font-size:9px;">
				<a href="<?php 
            echo get_option('siteurl');
            ?>
/artists/<?php 
            artist_slug();
            ?>
/<?php 
            release_slug();
            ?>
" style="font-size:11px;color:black;">More</a> - <a href="javascript:popUp('<?php 
            release_player_link();
            ?>
')" style="font-size:11px;color:black;">Listen</a> - <a href="<?php 
            echo get_option('siteurl');
            ?>
/download/<?php 
            release_slug();
            ?>
/" style="font-size:11px;color:black;">Download</a><?php 
            if (release_physical()) {
                ?>
 - <a href="<?php 
                get_option('siteurl');
                ?>
/buy/<?php 
                release_product_id();
                ?>
" style="font-size:11px;color:black;">Buy</a><?php 
            }
            ?>
				</div>
				</div>
				<?php 
        }
        ?>
				<p><a href="<?php 
        echo get_option('siteurl');
        ?>
/releases/">More Releases...</a></p>
			</div>
	        <?php 
        echo $after_widget;
        ?>
	<?php 
    }