Gazelle/sections/artist/takeedit.php
What.CD 6273679d49 86 changes from Wed Jul 27 01:50:24 2011 -0400 to Tue Aug 9 12:47:47 2011 -0400
fix typo I introduced in schedule.php
Print to LAB_CHAN if sphinx connection fails
nice bitcoin display
Corrects [#] tag for Mono  [hateradio]
bitcoin donation
Fix torrent unbookmarking
upgraded sphinxapi.php to r2876 as the site is running r2902
Added options to block Tor, Opera Turbo and Opera Mini
check for stale cache
vanity house  [clone00]
bookmark almost anything  [patapper]
new torrent edit flags  [rattvis]
permissions stuff from patappatch c
[BBCode] new [important] tag  [DutchDude]
Fixed images flowing past their boxes  [hateradio]
[BBCode] Tag for ordered lists.  [hateradio]
finally fixed that annoying textarea-resizing thing
renamed temporary tables

fixes http://what.cd/forums.php?action=viewthread&threadid=137432&page=1#post3408738
implements http://what.cd/forums.php?action=viewthread&threadid=122832
fixes http://what.cd/forums.php?action=viewthread&threadid=136553
fixes http://what.cd/forums.php?action=viewthread&threadid=112967
implements http://what.cd/forums.php?action=viewthread&threadid=110395
2011-08-09 21:03:28 +00:00

58 lines
1.9 KiB
PHP

<?
/*********************************************************************\
The page that handles the backend of the 'edit artist' function.
\*********************************************************************/
authorize();
if(!$_REQUEST['artistid'] || !is_number($_REQUEST['artistid'])) {
error(404);
}
if(!check_perms('site_edit_wiki')) { error(403); }
// Variables for database input
$UserID = $LoggedUser['ID'];
$ArtistID = $_REQUEST['artistid'];
if ( check_perms('artist_edit_vanityhouse') ) {
$VanityHouse = ( isset($_POST['vanity_house']) ? 1 : 0 );
}
if($_GET['action'] == 'revert') { // if we're reverting to a previous revision
authorize();
$RevisionID=$_GET['revisionid'];
if(!is_number($RevisionID)) { error(0); }
} else { // with edit, the variables are passed with POST
$Body = db_string($_POST['body']);
$Summary = db_string($_POST['summary']);
$Image = db_string($_POST['image']);
// Trickery
if(!preg_match("/^".IMAGE_REGEX."$/i", $Image)) {
$Image = '';
}
}
// Insert revision
if(!$RevisionID) { // edit
$DB->query("INSERT INTO wiki_artists (PageID, Body, Image, UserID, Summary, Time)
VALUES ('$ArtistID', '$Body', '$Image', '$UserID', '$Summary', '".sqltime()."')");
} else { // revert
$DB->query("INSERT INTO wiki_artists (PageID, Body, Image, UserID, Summary, Time)
SELECT '$ArtistID', Body, Image, '$UserID', 'Reverted to revision $RevisionID', '".sqltime()."'
FROM wiki_artists WHERE RevisionID='$RevisionID'");
}
$RevisionID=$DB->inserted_id();
// Update artists table (technically, we don't need the RevisionID column, but we can use it for a join which is nice and fast)
$DB->query("UPDATE artists_group
SET
". ( isset($VanityHouse) ? "VanityHouse='$VanityHouse'," : '' ) ."
RevisionID='$RevisionID'
WHERE ArtistID='$ArtistID'");
// There we go, all done!
$Cache->delete_value('artist_'.$ArtistID); // Delete artist cache
header('Location: artist.php?id='.$ArtistID);
?>