mirror of
https://github.com/WhatCD/Gazelle.git
synced 2024-12-13 19:06:27 +00:00
Empty commit
This commit is contained in:
parent
1d1ca10600
commit
1fed668f74
@ -1,38 +0,0 @@
|
|||||||
<?
|
|
||||||
define('LASTFM_API_URL', 'http://ws.audioscrobbler.com/2.0/?method=');
|
|
||||||
class LastFM {
|
|
||||||
|
|
||||||
public static function get_artist_events($ArtistID, $Artist, $Limit = 15) {
|
|
||||||
global $Cache;
|
|
||||||
$ArtistEvents = $Cache->get_value('artist_events_'.$ArtistID);
|
|
||||||
if(empty($ArtistEvents)) {
|
|
||||||
$ArtistEvents = self::lastfm_request("artist.getEvents", array("artist" => $Artist, "limit" => $Limit));
|
|
||||||
$Cache->cache_value('artist_events_'.$ArtistID, $ArtistEvents, 432000);
|
|
||||||
}
|
|
||||||
return $ArtistEvents;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static function lastfm_request($Method, $Args) {
|
|
||||||
if (!defined('LASTFM_API_KEY')) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
$Url = LASTFM_API_URL.$Method;
|
|
||||||
if(is_array($Args)) {
|
|
||||||
foreach ($Args as $Key => $Value) {
|
|
||||||
$Url .= "&".$Key."=".urlencode($Value);
|
|
||||||
}
|
|
||||||
$Url .= "&format=json&api_key=".LASTFM_API_KEY;
|
|
||||||
|
|
||||||
$Curl=curl_init();
|
|
||||||
curl_setopt($Curl,CURLOPT_HEADER,0);
|
|
||||||
curl_setopt($Curl,CURLOPT_CONNECTTIMEOUT,30);
|
|
||||||
curl_setopt($Curl,CURLOPT_RETURNTRANSFER,1);
|
|
||||||
curl_setopt($Curl,CURLOPT_URL,$Url);
|
|
||||||
$Return=curl_exec($Curl);
|
|
||||||
curl_close($Curl);
|
|
||||||
return json_decode($Return, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -424,12 +424,6 @@ CREATE TABLE `ip_bans` (
|
|||||||
KEY `ToIP` (`ToIP`)
|
KEY `ToIP` (`ToIP`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||||
|
|
||||||
CREATE TABLE `lastfm_users` (
|
|
||||||
`ID` int(10) unsigned NOT NULL,
|
|
||||||
`Username` varchar(20) NOT NULL,
|
|
||||||
PRIMARY KEY (`ID`)
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
|
||||||
|
|
||||||
CREATE TABLE `library_contest` (
|
CREATE TABLE `library_contest` (
|
||||||
`UserID` int(10) NOT NULL,
|
`UserID` int(10) NOT NULL,
|
||||||
`TorrentID` int(10) NOT NULL,
|
`TorrentID` int(10) NOT NULL,
|
||||||
|
@ -90,6 +90,10 @@
|
|||||||
include('managers/recommend_alter.php');
|
include('managers/recommend_alter.php');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 'recommend_restore':
|
||||||
|
include('managers/recommend_restore.php');
|
||||||
|
break;
|
||||||
|
|
||||||
case 'email_blacklist':
|
case 'email_blacklist':
|
||||||
include('managers/eb.php');
|
include('managers/eb.php');
|
||||||
break;
|
break;
|
||||||
|
15
sections/tools/managers/recommend_restore.php
Normal file
15
sections/tools/managers/recommend_restore.php
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?
|
||||||
|
//******************************************************************************//
|
||||||
|
//--------------- Restore all VH-recommended torrents to NL -------------------//
|
||||||
|
//---- For use after resetting the FL/NL database (after sitewide freeleech) ---//
|
||||||
|
authorize();
|
||||||
|
|
||||||
|
if(!check_perms('site_manage_recommendations')){
|
||||||
|
error(403);
|
||||||
|
}
|
||||||
|
|
||||||
|
$DB->query("SELECT GroupID FROM torrents_recommended");
|
||||||
|
$ToNL = $DB->next_record();
|
||||||
|
Torrents::freeleech_groups($ToNL, 2, 3);
|
||||||
|
?>
|
||||||
|
Done
|
@ -60,16 +60,8 @@ function checked($Checked) {
|
|||||||
|
|
||||||
View::show_header($Username.' > Settings','user,jquery,jquery-ui,release_sort,password_validate,validate,push_settings');
|
View::show_header($Username.' > Settings','user,jquery,jquery-ui,release_sort,password_validate,validate,push_settings');
|
||||||
|
|
||||||
$DB->query("SELECT PushService, PushOptions FROM
|
|
||||||
users_push_notifications WHERE UserID = '$LoggedUser[ID]'");
|
|
||||||
|
|
||||||
list($PushService, $PushOptions) = $DB->next_record(MYSQLI_NUM, false);
|
|
||||||
|
|
||||||
if ($PushOptions) {
|
|
||||||
$PushOptions = unserialize($PushOptions);
|
|
||||||
} else {
|
|
||||||
$PushOptions = array();
|
|
||||||
}
|
|
||||||
echo $Val->GenerateJS('userform');
|
echo $Val->GenerateJS('userform');
|
||||||
?>
|
?>
|
||||||
<div class="thin">
|
<div class="thin">
|
||||||
@ -293,6 +285,8 @@ function checked($Checked) {
|
|||||||
<p class="min_padding">If changing this field, you must enter your current password in the "Current password" field before saving your changes.</p>
|
<p class="min_padding">If changing this field, you must enter your current password in the "Current password" field before saving your changes.</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<!-- -->
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td class="label"><strong>Info</strong></td>
|
<td class="label"><strong>Info</strong></td>
|
||||||
<td><?php $textarea = new TEXTAREA_PREVIEW('info', 'info', display_str($Info), 50, 8); ?></td>
|
<td><?php $textarea = new TEXTAREA_PREVIEW('info', 'info', display_str($Info), 50, 8); ?></td>
|
||||||
|
@ -228,32 +228,7 @@
|
|||||||
$DownloadAlt = (isset($_POST['downloadalt']))? 1:0;
|
$DownloadAlt = (isset($_POST['downloadalt']))? 1:0;
|
||||||
$UnseededAlerts = (isset($_POST['unseededalerts']))? 1:0;
|
$UnseededAlerts = (isset($_POST['unseededalerts']))? 1:0;
|
||||||
|
|
||||||
if(isset($_POST['pushnotifications'])) {
|
|
||||||
if($_POST['pushnotifications'] == 1) {
|
|
||||||
$Options['PushService'] = "nma";
|
|
||||||
$Options['PushKey'] = $_POST['pushkey'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$Options['PushService'] = "0";
|
|
||||||
}
|
|
||||||
|
|
||||||
if(is_numeric($_POST['pushservice'])) {
|
|
||||||
$CanInsert = true;
|
|
||||||
if($_POST['pushservice'] == 0) {
|
|
||||||
$DB->query("SELECT PushService FROM users_push_notifications WHERE UserID = '$LoggedUser[ID]'");
|
|
||||||
if($DB->record_count() == 0) {
|
|
||||||
$CanInsert = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if($CanInsert) {
|
|
||||||
$PushService = db_string($_POST['pushservice']);
|
|
||||||
$PushOptions = array("PushKey" => trim($_POST['pushkey']), "PushUsername" => trim($_POST['pushusername']), "PushFilters" => array_flip($_POST['pushfilters']));
|
|
||||||
$PushOptions = db_string(serialize($PushOptions));
|
|
||||||
$DB->query("INSERT INTO users_push_notifications (UserID, PushService, PushOptions) VALUES ('$LoggedUser[ID]', '$PushService', '$PushOptions')
|
|
||||||
ON DUPLICATE KEY UPDATE PushService = '$PushService', PushOptions = '$PushOptions'");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Information on how the user likes to download torrents is stored in cache
|
// Information on how the user likes to download torrents is stored in cache
|
||||||
if($DownloadAlt != $LoggedUser['DownloadAlt']) {
|
if($DownloadAlt != $LoggedUser['DownloadAlt']) {
|
||||||
$Cache->delete_value('user_'.$LoggedUser['torrent_pass']);
|
$Cache->delete_value('user_'.$LoggedUser['torrent_pass']);
|
||||||
|
@ -152,7 +152,9 @@ function check_paranoia_here($Setting) {
|
|||||||
$Badges.=($Enabled == '1' || $Enabled == '0' || !$Enabled) ? '': '<img src="'.STATIC_SERVER.'common/symbols/disabled.png" alt="Banned" />';
|
$Badges.=($Enabled == '1' || $Enabled == '0' || !$Enabled) ? '': '<img src="'.STATIC_SERVER.'common/symbols/disabled.png" alt="Banned" />';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
View::show_header($Username,'user,bbcode,requests');
|
View::show_header($Username,'user,bbcode,requests');
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<div class="thin">
|
<div class="thin">
|
||||||
<h2><?=$Username?></h2>
|
<h2><?=$Username?></h2>
|
||||||
|
171
static/functions/lastfm.js
Normal file
171
static/functions/lastfm.js
Normal file
@ -0,0 +1,171 @@
|
|||||||
|
//skipfile
|
||||||
|
(function ($) {
|
||||||
|
var TAB_COUNT = 0;
|
||||||
|
var topArtistsLoaded = false;
|
||||||
|
var topAlbumsLoaded = false;
|
||||||
|
var topTracksLoaded = false;
|
||||||
|
var tasteometerLoaded = false;
|
||||||
|
var username;
|
||||||
|
$(document).ready(function () {
|
||||||
|
init();
|
||||||
|
});
|
||||||
|
|
||||||
|
function init() {
|
||||||
|
username = $('#lastfm_username').text();
|
||||||
|
$('#tabs').children('a').each(function () {
|
||||||
|
var i = TAB_COUNT;
|
||||||
|
$(this).click(function () {
|
||||||
|
switchTo(i);
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
TAB_COUNT++;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function getTopArtists(div) {
|
||||||
|
if (!topArtistsLoaded) {
|
||||||
|
div.html('Loading...');
|
||||||
|
ajax.get('user.php?action=lastfm_top_artists&username=' + username, function (response) {
|
||||||
|
var json = JSON.parse(response);
|
||||||
|
if (json != null && json['error']) {
|
||||||
|
div.html(json['message']);
|
||||||
|
}
|
||||||
|
else if (json == null) {
|
||||||
|
div.html("Error");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var j = json['topartists']['artist'];
|
||||||
|
var html = '<strong>Top Artists</strong><ul class="nobullet">';
|
||||||
|
for (var i = 0; i < j.length; i++) {
|
||||||
|
html += '<li><a href="torrents.php?searchstr=' + j[i]['name'] + '">' + j[i]['name'] + '</a></li>'
|
||||||
|
}
|
||||||
|
html += '</ul>';
|
||||||
|
div.html(html);
|
||||||
|
topArtistsLoaded = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getTopAlbums(div) {
|
||||||
|
if (!topAlbumsLoaded) {
|
||||||
|
div.html('Loading...');
|
||||||
|
ajax.get('user.php?action=lastfm_top_albums&username=' + username, function (response) {
|
||||||
|
var json = JSON.parse(response);
|
||||||
|
if (json != null && json['error']) {
|
||||||
|
div.html(json['message']);
|
||||||
|
}
|
||||||
|
else if (json == null) {
|
||||||
|
div.html("Error");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var j = json['topalbums']['album'];
|
||||||
|
var html = '<strong>Top Albums</strong><ul class="nobullet">';
|
||||||
|
for (var i = 0; i < j.length; i++) {
|
||||||
|
html += '<li><a href="torrents.php?searchstr=' + j[i]['name'] + '">' + j[i]['name'] + '</a> - <a href="torrents.php?searchstr=' + j[i]['artist']['name'] + '">' + j[i]['artist']['name'] + '</a></li>'
|
||||||
|
}
|
||||||
|
html += '</ul>';
|
||||||
|
div.html(html);
|
||||||
|
topAlbumsLoaded = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getTopTracks(div) {
|
||||||
|
if (!topTracksLoaded) {
|
||||||
|
div.html('Loading...');
|
||||||
|
if (json != null && json['error']) {
|
||||||
|
div.html(json['message']);
|
||||||
|
}
|
||||||
|
else if (json == null) {
|
||||||
|
div.html("Error");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ajax.get('user.php?action=lastfm_top_tracks&username=' + username, function (response) {
|
||||||
|
var json = JSON.parse(response);
|
||||||
|
var j = json['toptracks']['track'];
|
||||||
|
if (j != null) {
|
||||||
|
var html = '<strong>Top Tracks</strong><ul class="nobullet">';
|
||||||
|
for (var i = 0; i < j.length; i++) {
|
||||||
|
html += '<li><a href="torrents.php?searchstr=' + j[i]['name'] + '">' + j[i]['name'] + '</a> - <a href="torrents.php?searchstr=' + j[i]['artist']['name'] + '">' + j[i]['artist']['name'] + '</a></li>'
|
||||||
|
}
|
||||||
|
html += '</ul>';
|
||||||
|
div.html(html);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
div.html('Error');
|
||||||
|
}
|
||||||
|
topTracksLoaded = true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getTasteometer(div) {
|
||||||
|
if (!tasteometerLoaded) {
|
||||||
|
div.html('Loading...');
|
||||||
|
ajax.get('user.php?action=lastfm_compare_users&username=' + username, function (response) {
|
||||||
|
var json = JSON.parse(response);
|
||||||
|
if (json != null && json['error']) {
|
||||||
|
div.html(json['message']);
|
||||||
|
}
|
||||||
|
else if (json == null) {
|
||||||
|
div.html("Error, do you have your Last.FM username set in settings?");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var j = json['comparison']['result'];
|
||||||
|
var a = j['artists']['artist'];
|
||||||
|
console.log(a);
|
||||||
|
var compatibility = Math.round(j['score'] * 100);
|
||||||
|
var html = '<strong>Tasteometer</strong><br/>Compatibility: ' + compatibility + '% <ul class="nobullet">';
|
||||||
|
for (var i = 0; i < a.length; i++) {
|
||||||
|
html += '<li><a href="torrents.php?searchstr=' + a[i]['name'] + '">' + a[i]['name'] + '</li>'
|
||||||
|
}
|
||||||
|
html += '</ul>';
|
||||||
|
div.html(html);
|
||||||
|
tasteometerLoaded = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function switchTo(tab) {
|
||||||
|
var i = 0;
|
||||||
|
$('#tabs').children('a').each(function () {
|
||||||
|
if (i != tab) {
|
||||||
|
$(this).css('font-weight', '');
|
||||||
|
} else {
|
||||||
|
$(this).css('font-weight', 'bold');
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
});
|
||||||
|
i = 0;
|
||||||
|
$('#contents_div').children('div').each(function () {
|
||||||
|
if (i != tab) {
|
||||||
|
$(this).hide();
|
||||||
|
} else {
|
||||||
|
$(this).show();
|
||||||
|
switch (tab) {
|
||||||
|
case 1:
|
||||||
|
getTopArtists($(this));
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
getTopAlbums($(this));
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
getTopTracks($(this));
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
getTasteometer($(this));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
})(jQuery);
|
Loading…
Reference in New Issue
Block a user