diff --git a/classes/class_lastfm.php b/classes/class_lastfm.php
deleted file mode 100644
index 40acb799..00000000
--- a/classes/class_lastfm.php
+++ /dev/null
@@ -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);
- }
- }
-}
-
-
\ No newline at end of file
diff --git a/gazelle.sql b/gazelle.sql
index 89d46797..91b23c4c 100644
--- a/gazelle.sql
+++ b/gazelle.sql
@@ -424,12 +424,6 @@ CREATE TABLE `ip_bans` (
KEY `ToIP` (`ToIP`)
) 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` (
`UserID` int(10) NOT NULL,
`TorrentID` int(10) NOT NULL,
diff --git a/sections/tools/index.php b/sections/tools/index.php
index 1819355b..d6243f19 100644
--- a/sections/tools/index.php
+++ b/sections/tools/index.php
@@ -89,6 +89,10 @@
case 'recommend_alter':
include('managers/recommend_alter.php');
break;
+
+ case 'recommend_restore':
+ include('managers/recommend_restore.php');
+ break;
case 'email_blacklist':
include('managers/eb.php');
diff --git a/sections/tools/managers/recommend_restore.php b/sections/tools/managers/recommend_restore.php
new file mode 100644
index 00000000..ab554015
--- /dev/null
+++ b/sections/tools/managers/recommend_restore.php
@@ -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
\ No newline at end of file
diff --git a/sections/user/edit.php b/sections/user/edit.php
index 38bdbeab..ff40019e 100644
--- a/sections/user/edit.php
+++ b/sections/user/edit.php
@@ -60,16 +60,8 @@ function checked($Checked) {
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');
?>
@@ -293,6 +285,8 @@ function checked($Checked) {
If changing this field, you must enter your current password in the "Current password" field before saving your changes.
+
+
Info |
|
diff --git a/sections/user/takeedit.php b/sections/user/takeedit.php
index cc9a5cfe..d9cac25e 100644
--- a/sections/user/takeedit.php
+++ b/sections/user/takeedit.php
@@ -228,32 +228,7 @@
$DownloadAlt = (isset($_POST['downloadalt']))? 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
if($DownloadAlt != $LoggedUser['DownloadAlt']) {
$Cache->delete_value('user_'.$LoggedUser['torrent_pass']);
diff --git a/sections/user/user.php b/sections/user/user.php
index 2d4f5ee8..841c5eeb 100644
--- a/sections/user/user.php
+++ b/sections/user/user.php
@@ -152,7 +152,9 @@ function check_paranoia_here($Setting) {
$Badges.=($Enabled == '1' || $Enabled == '0' || !$Enabled) ? '': '';
+
View::show_header($Username,'user,bbcode,requests');
+
?>
=$Username?>
diff --git a/static/functions/lastfm.js b/static/functions/lastfm.js
new file mode 100644
index 00000000..449e7fa8
--- /dev/null
+++ b/static/functions/lastfm.js
@@ -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 = '
Top Artists';
+ 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 = '
Top Albums';
+ 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 = '
Top Tracks';
+ 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 = '
TasteometerCompatibility: ' + compatibility + '%
';
+ 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);