2011-03-28 14:21:28 +00:00
|
|
|
<?
|
|
|
|
/**************************************************************************
|
|
|
|
Artists Switch Center
|
|
|
|
|
2013-02-22 08:00:24 +00:00
|
|
|
This page acts as a switch that includes the real artist pages (to keep
|
2011-03-28 14:21:28 +00:00
|
|
|
the root less cluttered).
|
|
|
|
|
2013-02-22 08:00:24 +00:00
|
|
|
enforce_login() is run here - the entire artist pages are off limits for
|
|
|
|
non members.
|
2012-11-14 08:00:19 +00:00
|
|
|
****************************************************************************/
|
2011-03-28 14:21:28 +00:00
|
|
|
|
|
|
|
// Width and height of similar artist map
|
|
|
|
define('WIDTH', 585);
|
|
|
|
define('HEIGHT', 400);
|
|
|
|
|
|
|
|
enforce_login();
|
2012-11-14 08:00:19 +00:00
|
|
|
if (!empty($_POST['action'])) {
|
2011-03-28 14:21:28 +00:00
|
|
|
switch ($_POST['action']) {
|
|
|
|
case 'edit':
|
2012-11-14 08:00:19 +00:00
|
|
|
require(SERVER_ROOT . '/sections/artist/takeedit.php');
|
2011-03-28 14:21:28 +00:00
|
|
|
break;
|
|
|
|
case 'download':
|
2012-11-14 08:00:19 +00:00
|
|
|
require(SERVER_ROOT . '/sections/artist/download.php');
|
2011-03-28 14:21:28 +00:00
|
|
|
break;
|
|
|
|
case 'rename':
|
2012-11-14 08:00:19 +00:00
|
|
|
require(SERVER_ROOT . '/sections/artist/rename.php');
|
2011-03-28 14:21:28 +00:00
|
|
|
break;
|
|
|
|
case 'add_similar':
|
2012-11-14 08:00:19 +00:00
|
|
|
require(SERVER_ROOT . '/sections/artist/add_similar.php');
|
2011-03-28 14:21:28 +00:00
|
|
|
break;
|
|
|
|
case 'add_alias':
|
2012-11-14 08:00:19 +00:00
|
|
|
require(SERVER_ROOT . '/sections/artist/add_alias.php');
|
2011-03-28 14:21:28 +00:00
|
|
|
break;
|
2012-04-02 08:00:21 +00:00
|
|
|
case 'change_artistid':
|
2012-11-14 08:00:19 +00:00
|
|
|
require(SERVER_ROOT . '/sections/artist/change_artistid.php');
|
2012-04-02 08:00:21 +00:00
|
|
|
break;
|
2012-10-27 08:00:09 +00:00
|
|
|
case 'reply':
|
|
|
|
authorize();
|
|
|
|
|
2012-11-14 08:00:19 +00:00
|
|
|
if (!isset($_POST['artistid']) || !isset($_POST['body']) || !is_number($_POST['artistid']) || trim($_POST['body']) === '') {
|
2012-10-27 08:00:09 +00:00
|
|
|
error(0);
|
|
|
|
}
|
2012-11-14 08:00:19 +00:00
|
|
|
if ($LoggedUser['DisablePosting']) {
|
2013-05-05 08:00:31 +00:00
|
|
|
error('Your posting privileges have been removed.');
|
2012-10-27 08:00:09 +00:00
|
|
|
}
|
2012-11-14 08:00:19 +00:00
|
|
|
|
2012-10-27 08:00:09 +00:00
|
|
|
$ArtistID = $_POST['artistid'];
|
2012-11-14 08:00:19 +00:00
|
|
|
if (!$ArtistID) {
|
|
|
|
error(404);
|
|
|
|
}
|
|
|
|
|
2013-05-05 08:00:31 +00:00
|
|
|
$DB->query("
|
|
|
|
SELECT
|
|
|
|
CEIL((
|
|
|
|
SELECT COUNT(ID)+1
|
|
|
|
FROM artist_comments AS ac
|
|
|
|
WHERE ac.ArtistID='" . db_string($ArtistID) . "'
|
|
|
|
)/" . TORRENT_COMMENTS_PER_PAGE . "
|
|
|
|
) AS Pages");
|
2012-10-27 08:00:09 +00:00
|
|
|
list($Pages) = $DB->next_record();
|
2012-11-14 08:00:19 +00:00
|
|
|
|
2013-05-05 08:00:31 +00:00
|
|
|
$DB->query("
|
|
|
|
INSERT INTO artist_comments (ArtistID,AuthorID,AddedTime,Body)
|
|
|
|
VALUES ('" . db_string($ArtistID) . "', '" . db_string($LoggedUser['ID']) . "','" . sqltime() . "','" . db_string($_POST['body']) . "')");
|
2012-11-14 08:00:19 +00:00
|
|
|
$PostID = $DB->inserted_id();
|
|
|
|
|
|
|
|
$CatalogueID = floor((TORRENT_COMMENTS_PER_PAGE * $Pages - TORRENT_COMMENTS_PER_PAGE) / THREAD_CATALOGUE);
|
|
|
|
$Cache->begin_transaction('artist_comments_' . $ArtistID . '_catalogue_' . $CatalogueID);
|
2012-10-27 08:00:09 +00:00
|
|
|
$Post = array(
|
2012-11-14 08:00:19 +00:00
|
|
|
'ID' => $PostID,
|
|
|
|
'AuthorID' => $LoggedUser['ID'],
|
|
|
|
'AddedTime' => sqltime(),
|
|
|
|
'Body' => $_POST['body'],
|
|
|
|
'EditedUserID' => 0,
|
|
|
|
'EditedTime' => '0000-00-00 00:00:00',
|
|
|
|
'Username' => ''
|
|
|
|
);
|
2012-10-27 08:00:09 +00:00
|
|
|
$Cache->insert('', $Post);
|
|
|
|
$Cache->commit_transaction(0);
|
2012-11-14 08:00:19 +00:00
|
|
|
$Cache->increment('artist_comments_' . $ArtistID);
|
|
|
|
|
|
|
|
header('Location: artist.php?id=' . $ArtistID . '&page=' . $Pages);
|
2012-10-27 08:00:09 +00:00
|
|
|
break;
|
|
|
|
case 'warn' :
|
2012-11-14 08:00:19 +00:00
|
|
|
include(SERVER_ROOT . '/sections/artist/warn.php');
|
|
|
|
break;
|
|
|
|
case 'take_warn' :
|
|
|
|
include(SERVER_ROOT . '/sections/artist/take_warn.php');
|
|
|
|
break;
|
|
|
|
case 'concert_thread':
|
|
|
|
include(SERVER_ROOT . '/sections/artist/concert_thread.php');
|
|
|
|
break;
|
|
|
|
case 'take_concert_thread':
|
|
|
|
include(SERVER_ROOT . '/sections/artist/take_concert_thread.php');
|
|
|
|
break;
|
|
|
|
default:
|
2012-10-30 08:00:18 +00:00
|
|
|
error(0);
|
|
|
|
}
|
2012-11-14 08:00:19 +00:00
|
|
|
} elseif (!empty($_GET['action'])) {
|
|
|
|
switch ($_GET['action']) {
|
2012-10-30 08:00:18 +00:00
|
|
|
case 'get_post':
|
2012-11-14 08:00:19 +00:00
|
|
|
if (!$_GET['post'] || !is_number($_GET['post'])) {
|
|
|
|
error(0);
|
|
|
|
}
|
|
|
|
$DB->query("SELECT Body FROM artist_comments WHERE ID='" . db_string($_GET['post']) . "'");
|
2012-10-30 08:00:18 +00:00
|
|
|
list($Body) = $DB->next_record(MYSQLI_NUM);
|
|
|
|
echo trim($Body);
|
|
|
|
break;
|
2012-11-14 08:00:19 +00:00
|
|
|
|
2012-10-30 08:00:18 +00:00
|
|
|
case 'delete_comment':
|
|
|
|
authorize();
|
2012-11-14 08:00:19 +00:00
|
|
|
|
2012-10-30 08:00:18 +00:00
|
|
|
// Quick SQL injection check
|
2012-11-14 08:00:19 +00:00
|
|
|
if (!$_GET['postid'] || !is_number($_GET['postid'])) {
|
|
|
|
error(0);
|
|
|
|
}
|
|
|
|
|
2012-10-30 08:00:18 +00:00
|
|
|
// Make sure they are moderators
|
2012-11-14 08:00:19 +00:00
|
|
|
if (!check_perms('site_moderate_forums')) {
|
|
|
|
error(403);
|
|
|
|
}
|
|
|
|
|
2012-10-30 08:00:18 +00:00
|
|
|
// Get topicid, forumid, number of pages
|
2013-05-05 08:00:31 +00:00
|
|
|
$DB->query("
|
|
|
|
SELECT
|
|
|
|
ArtistID,
|
|
|
|
CEIL(COUNT(ac.ID)/" . TORRENT_COMMENTS_PER_PAGE . ") AS Pages,
|
|
|
|
CEIL(SUM(IF(ac.ID<=" . $_GET['postid'] . ",1,0))/" . TORRENT_COMMENTS_PER_PAGE . ") AS Page
|
2012-10-30 08:00:18 +00:00
|
|
|
FROM artist_comments AS ac
|
2013-05-05 08:00:31 +00:00
|
|
|
WHERE ac.ArtistID=(
|
|
|
|
SELECT ArtistID
|
|
|
|
FROM artist_comments
|
|
|
|
WHERE ID=" . $_GET['postid'] . "
|
|
|
|
)
|
2012-10-30 08:00:18 +00:00
|
|
|
GROUP BY ac.ArtistID");
|
2012-11-14 08:00:19 +00:00
|
|
|
list($ArtistID, $Pages, $Page) = $DB->next_record();
|
|
|
|
|
2012-10-30 08:00:18 +00:00
|
|
|
// $Pages = number of pages in the thread
|
|
|
|
// $Page = which page the post is on
|
|
|
|
// These are set for cache clearing.
|
2012-11-14 08:00:19 +00:00
|
|
|
|
|
|
|
$DB->query("DELETE FROM artist_comments WHERE ID='" . db_string($_GET['postid']) . "'");
|
|
|
|
|
2012-10-30 08:00:18 +00:00
|
|
|
//We need to clear all subsequential catalogues as they've all been bumped with the absence of this post
|
2012-11-14 08:00:19 +00:00
|
|
|
$ThisCatalogue = floor((TORRENT_COMMENTS_PER_PAGE * $Page - TORRENT_COMMENTS_PER_PAGE) / THREAD_CATALOGUE);
|
|
|
|
$LastCatalogue = floor((TORRENT_COMMENTS_PER_PAGE * $Pages - TORRENT_COMMENTS_PER_PAGE) / THREAD_CATALOGUE);
|
|
|
|
for ($i = $ThisCatalogue; $i <= $LastCatalogue; $i++) {
|
|
|
|
$Cache->delete('artist_comments_' . $ArtistID . '_catalogue_' . $i);
|
2012-10-30 08:00:18 +00:00
|
|
|
}
|
2012-11-14 08:00:19 +00:00
|
|
|
|
2012-10-30 08:00:18 +00:00
|
|
|
// Delete thread info cache (eg. number of pages)
|
2012-11-14 08:00:19 +00:00
|
|
|
$Cache->delete('artist_comments_' . $ArtistID);
|
|
|
|
|
2012-10-30 08:00:18 +00:00
|
|
|
break;
|
2012-11-14 08:00:19 +00:00
|
|
|
|
2012-10-27 08:00:09 +00:00
|
|
|
case 'takeedit_post':
|
|
|
|
authorize();
|
|
|
|
|
2013-05-27 08:00:58 +00:00
|
|
|
include(SERVER_ROOT . '/classes/text.class.php'); // Text formatting class
|
2012-10-27 08:00:09 +00:00
|
|
|
$Text = new TEXT;
|
2012-11-14 08:00:19 +00:00
|
|
|
|
2012-10-27 08:00:09 +00:00
|
|
|
// Quick SQL injection check
|
2012-11-14 08:00:19 +00:00
|
|
|
if (!$_POST['post'] || !is_number($_POST['post'])) {
|
|
|
|
error(0);
|
|
|
|
}
|
|
|
|
|
2012-10-27 08:00:09 +00:00
|
|
|
// Mainly
|
2013-05-05 08:00:31 +00:00
|
|
|
$DB->query("
|
|
|
|
SELECT
|
|
|
|
ac.Body,
|
|
|
|
ac.AuthorID,
|
|
|
|
ac.ArtistID,
|
|
|
|
ac.AddedTime
|
2012-10-27 08:00:09 +00:00
|
|
|
FROM artist_comments AS ac
|
2012-11-14 08:00:19 +00:00
|
|
|
WHERE ac.ID='" . db_string($_POST['post']) . "'");
|
|
|
|
list($OldBody, $AuthorID, $ArtistID, $AddedTime) = $DB->next_record();
|
|
|
|
|
2013-05-05 08:00:31 +00:00
|
|
|
$DB->query("
|
|
|
|
SELECT ceil(COUNT(ID) / " . TORRENT_COMMENTS_PER_PAGE . ") AS Page
|
|
|
|
FROM artist_comments
|
|
|
|
WHERE ArtistID = $ArtistID
|
|
|
|
AND ID <= $_POST[post]");
|
2012-10-27 08:00:09 +00:00
|
|
|
list($Page) = $DB->next_record();
|
2012-11-14 08:00:19 +00:00
|
|
|
|
|
|
|
if ($LoggedUser['ID'] != $AuthorID && !check_perms('site_moderate_forums')) {
|
|
|
|
error(404);
|
|
|
|
}
|
|
|
|
if ($DB->record_count() == 0) {
|
|
|
|
error(404);
|
|
|
|
}
|
|
|
|
|
2012-10-27 08:00:09 +00:00
|
|
|
// Perform the update
|
2013-05-05 08:00:31 +00:00
|
|
|
$DB->query("
|
|
|
|
UPDATE artist_comments
|
|
|
|
SET
|
|
|
|
Body = '" . db_string($_POST['body']) . "',
|
|
|
|
EditedUserID = '" . db_string($LoggedUser['ID']) . "',
|
|
|
|
EditedTime = '" . sqltime() . "'
|
2012-11-14 08:00:19 +00:00
|
|
|
WHERE ID='" . db_string($_POST['post']) . "'");
|
|
|
|
|
2012-10-27 08:00:09 +00:00
|
|
|
// Update the cache
|
2012-11-14 08:00:19 +00:00
|
|
|
$CatalogueID = floor((TORRENT_COMMENTS_PER_PAGE * $Page - TORRENT_COMMENTS_PER_PAGE) / THREAD_CATALOGUE);
|
|
|
|
$Cache->begin_transaction('artist_comments_' . $ArtistID . '_catalogue_' . $CatalogueID);
|
|
|
|
|
2012-10-27 08:00:09 +00:00
|
|
|
$Cache->update_row($_POST['key'], array(
|
2012-11-14 08:00:19 +00:00
|
|
|
'ID' => $_POST['post'],
|
|
|
|
'AuthorID' => $AuthorID,
|
|
|
|
'AddedTime' => $AddedTime,
|
|
|
|
'Body' => $_POST['body'],
|
|
|
|
'EditedUserID' => db_string($LoggedUser['ID']),
|
|
|
|
'EditedTime' => sqltime(),
|
|
|
|
'Username' => $LoggedUser['Username']
|
2012-10-27 08:00:09 +00:00
|
|
|
));
|
|
|
|
$Cache->commit_transaction(0);
|
2012-11-14 08:00:19 +00:00
|
|
|
|
2013-05-05 08:00:31 +00:00
|
|
|
$DB->query("
|
|
|
|
INSERT INTO comments_edits (Page, PostID, EditUser, EditTime, Body)
|
|
|
|
VALUES ('artist', " . db_string($_POST['post']) . ", " . db_string($LoggedUser['ID']) . ", '" . sqltime() . "', '" . db_string($OldBody) . "')");
|
2012-11-14 08:00:19 +00:00
|
|
|
|
2012-10-27 08:00:09 +00:00
|
|
|
// This gets sent to the browser, which echoes it in place of the old body
|
|
|
|
echo $Text->full_format($_POST['body']);
|
|
|
|
break;
|
2012-11-14 08:00:19 +00:00
|
|
|
|
2011-03-28 14:21:28 +00:00
|
|
|
case 'edit':
|
2012-11-14 08:00:19 +00:00
|
|
|
require(SERVER_ROOT . '/sections/artist/edit.php');
|
2011-03-28 14:21:28 +00:00
|
|
|
break;
|
|
|
|
case 'delete':
|
2012-11-14 08:00:19 +00:00
|
|
|
require(SERVER_ROOT . '/sections/artist/delete.php');
|
2011-03-28 14:21:28 +00:00
|
|
|
break;
|
|
|
|
case 'revert':
|
2012-11-14 08:00:19 +00:00
|
|
|
require(SERVER_ROOT . '/sections/artist/takeedit.php');
|
2011-03-28 14:21:28 +00:00
|
|
|
break;
|
|
|
|
case 'history':
|
2012-11-14 08:00:19 +00:00
|
|
|
require(SERVER_ROOT . '/sections/artist/history.php');
|
2011-03-28 14:21:28 +00:00
|
|
|
break;
|
|
|
|
case 'vote_similar':
|
2012-11-14 08:00:19 +00:00
|
|
|
require(SERVER_ROOT . '/sections/artist/vote_similar.php');
|
2011-03-28 14:21:28 +00:00
|
|
|
break;
|
|
|
|
case 'delete_similar':
|
2012-11-14 08:00:19 +00:00
|
|
|
require(SERVER_ROOT . '/sections/artist/delete_similar.php');
|
2011-03-28 14:21:28 +00:00
|
|
|
break;
|
|
|
|
case 'similar':
|
2012-11-14 08:00:19 +00:00
|
|
|
require(SERVER_ROOT . '/sections/artist/similar.php');
|
2011-03-28 14:21:28 +00:00
|
|
|
break;
|
|
|
|
case 'similar_bg':
|
2012-11-14 08:00:19 +00:00
|
|
|
require(SERVER_ROOT . '/sections/artist/similar_bg.php');
|
2011-03-28 14:21:28 +00:00
|
|
|
break;
|
|
|
|
case 'notify':
|
2012-11-14 08:00:19 +00:00
|
|
|
require(SERVER_ROOT . '/sections/artist/notify.php');
|
2011-03-28 14:21:28 +00:00
|
|
|
break;
|
|
|
|
case 'notifyremove':
|
2012-11-14 08:00:19 +00:00
|
|
|
require(SERVER_ROOT . '/sections/artist/notifyremove.php');
|
2011-03-28 14:21:28 +00:00
|
|
|
break;
|
|
|
|
case 'delete_alias':
|
2012-11-14 08:00:19 +00:00
|
|
|
require(SERVER_ROOT . '/sections/artist/delete_alias.php');
|
2011-03-28 14:21:28 +00:00
|
|
|
break;
|
2012-04-02 08:00:21 +00:00
|
|
|
case 'change_artistid':
|
2012-11-14 08:00:19 +00:00
|
|
|
require(SERVER_ROOT . '/sections/artist/change_artistid.php');
|
2012-04-02 08:00:21 +00:00
|
|
|
break;
|
2011-03-28 14:21:28 +00:00
|
|
|
default:
|
|
|
|
error(0);
|
2012-11-14 08:00:19 +00:00
|
|
|
break;
|
2011-03-28 14:21:28 +00:00
|
|
|
}
|
|
|
|
} else {
|
2012-11-14 08:00:19 +00:00
|
|
|
if (!empty($_GET['id'])) {
|
|
|
|
|
|
|
|
include (SERVER_ROOT . '/sections/artist/artist.php');
|
|
|
|
|
2011-03-28 14:21:28 +00:00
|
|
|
} elseif (!empty($_GET['artistname'])) {
|
2012-06-02 08:00:16 +00:00
|
|
|
$NameSearch = str_replace('\\', '\\\\', trim($_GET['artistname']));
|
2013-06-18 08:00:48 +00:00
|
|
|
$DB->query("
|
|
|
|
SELECT ArtistID, Name
|
|
|
|
FROM artists_alias
|
|
|
|
WHERE Name LIKE '" . db_string($NameSearch) . "'");
|
2012-11-14 08:00:19 +00:00
|
|
|
if ($DB->record_count() == 0) {
|
|
|
|
if (isset($LoggedUser['SearchType']) && $LoggedUser['SearchType']) {
|
|
|
|
header('Location: torrents.php?action=advanced&artistname=' . urlencode($_GET['artistname']));
|
2011-03-28 14:21:28 +00:00
|
|
|
} else {
|
2012-11-14 08:00:19 +00:00
|
|
|
header('Location: torrents.php?searchstr=' . urlencode($_GET['artistname']));
|
2011-03-28 14:21:28 +00:00
|
|
|
}
|
|
|
|
die();
|
|
|
|
}
|
2012-05-18 13:35:17 +00:00
|
|
|
list($FirstID, $Name) = $DB->next_record(MYSQLI_NUM, false);
|
2012-11-14 08:00:19 +00:00
|
|
|
if ($DB->record_count() == 1 || !strcasecmp($Name, $NameSearch)) {
|
|
|
|
header('Location: artist.php?id=' . $FirstID);
|
2012-05-18 13:35:17 +00:00
|
|
|
die();
|
|
|
|
}
|
2012-11-14 08:00:19 +00:00
|
|
|
while (list($ID, $Name) = $DB->next_record(MYSQLI_NUM, false)) {
|
|
|
|
if (!strcasecmp($Name, $NameSearch)) {
|
|
|
|
header('Location: artist.php?id=' . $ID);
|
2012-05-18 13:35:17 +00:00
|
|
|
die();
|
|
|
|
}
|
|
|
|
}
|
2012-11-14 08:00:19 +00:00
|
|
|
header('Location: artist.php?id=' . $FirstID);
|
2012-05-18 13:35:17 +00:00
|
|
|
die();
|
2011-03-28 14:21:28 +00:00
|
|
|
} else {
|
|
|
|
header('Location: torrents.php');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|