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 @@
+
+require(SERVER_ROOT.'/classes/class_torrent.php');
+$TorrentID = $_GET['torrentid'];
+if (!is_number($TorrentID)) {
+ echo('Invalid TorrentID');
+ die();
+}
+
+$DB->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) {
if(check_perms('site_view_torrent_snatchlist')) { ?>
(View Downloadlist)
(View Snatchlist)
+ (Check Private Flag)
} ?>
(View Filelist)
if($Reported) { ?>
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",