From 69455d2763e7d42bc6c1aec1a5a4380ae3d28bea Mon Sep 17 00:00:00 2001 From: Git Date: Tue, 5 Jun 2012 08:00:11 +0000 Subject: [PATCH] Empty commit --- sections/ajax/checkprivate.php | 24 ++++++++++++++++++++++++ sections/ajax/index.php | 3 +++ sections/torrents/details.php | 1 + static/functions/browse.js | 7 +++++++ static/functions/musicbrainz.js | 4 ++-- 5 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 sections/ajax/checkprivate.php diff --git a/sections/ajax/checkprivate.php b/sections/ajax/checkprivate.php new file mode 100644 index 00000000..596db97d --- /dev/null +++ b/sections/ajax/checkprivate.php @@ -0,0 +1,24 @@ +query("SELECT File FROM torrents_files WHERE TorrentID='$TorrentID'"); +if($DB->record_count() == 0) { + echo('Torrent not found.'); + die(); +} +list($Contents) = $DB->next_record(MYSQLI_NUM, array(0)); +$Contents = unserialize(base64_decode($Contents)); +$Tor = new TORRENT($Contents, true); // New TORRENT object +$Private = $Tor->make_private(); + +if ($Private) { + echo 'Private'; +} else { + echo 'Public'; +} +?> \ No newline at end of file diff --git a/sections/ajax/index.php b/sections/ajax/index.php index aebd5445..73831e23 100644 --- a/sections/ajax/index.php +++ b/sections/ajax/index.php @@ -34,6 +34,9 @@ require(SERVER_ROOT.'/sections/ajax/stats.php'); break; + case 'checkprivate': + include('checkprivate.php'); + break; // things not yet used on the site case 'torrentgroup': require('torrentgroup.php'); diff --git a/sections/torrents/details.php b/sections/torrents/details.php index 6d32db92..c8075045 100644 --- a/sections/torrents/details.php +++ b/sections/torrents/details.php @@ -571,6 +571,7 @@ function filelist($Str) { (View Downloadlist) (View Snatchlist) + (Check Private Flag) (View Filelist) diff --git a/static/functions/browse.js b/static/functions/browse.js index caa33666..55afebc5 100644 --- a/static/functions/browse.js +++ b/static/functions/browse.js @@ -186,3 +186,10 @@ function ToggleEditionRows() { $('#edition_label').toggle(); $('#edition_catalogue').toggle(); } + +function check_private(TorrentID) { + $('#checkprivate-'+TorrentID).raw().innerHTML = "Checking..."; + ajax.get('ajax.php?action=checkprivate&torrentid=' + TorrentID,function(response){ + $('#checkprivate-'+TorrentID).raw().innerHTML = response; + }); +} \ No newline at end of file diff --git a/static/functions/musicbrainz.js b/static/functions/musicbrainz.js index 78f58661..631ecf91 100644 --- a/static/functions/musicbrainz.js +++ b/static/functions/musicbrainz.js @@ -36,8 +36,8 @@ $(document).ready(function() { jQuery('#results1').show(); jQuery('#results2').show(); $searched = true; - var $artist_encoded = encodeURI($artist); - var $album_encoded = encodeURI($album); + var $artist_encoded = encodeURIComponent($artist); + var $album_encoded = encodeURIComponent($album); $.ajax({ type: "GET", url : "http://www.musicbrainz.org/ws/2/release-group/?query=artist:%22" + $artist_encoded + "%22%20AND%20releasegroup:%22" + $album_encoded + "%22",