$status2 = $db->Quote($status); $db->Execute("INSERT INTO moderation_log SET user_id = {$USER->user_id}, gridimage_id = {$gridimage_id}, new_status={$status2}, old_status='{$image->moderation_status}',created=now(),type = 'real'"); $info = $image->setModerationStatus($status, $USER->user_id); echo $info; if ($status == 'rejected') { $ticket = new GridImageTroubleTicket(); $ticket->setSuggester($USER->user_id); $ticket->setModerator($USER->user_id); $ticket->setPublic('everyone'); $ticket->setImage($gridimage_id); if (!empty($_GET['comment'])) { $ticket->setNotes("Auto-generated ticket, as a result of Moderation. Rejecting this image because: " . stripslashes($_GET['comment'])); } else { $ticket->setNotes("Auto-generated ticket, as a result of Moderation. Please leave a comment to explain the reason for rejecting this image."); } $status = $ticket->commit('open'); echo " <a href=\"/editimage.php?id={$gridimage_id}\"><B>View Ticket</b></a>"; } //clear caches involving the image $smarty->clear_cache('view.tpl', "{$gridimage_id}_0_0"); $smarty->clear_cache('view.tpl', "{$gridimage_id}_0_1"); $smarty->clear_cache('view.tpl', "{$gridimage_id}_1_0"); $smarty->clear_cache('view.tpl', "{$gridimage_id}_1_1"); //clear the users profile cache $smarty->clear_cache('profile.tpl', "{$image->user_id}_0"); $smarty->clear_cache('profile.tpl', "{$image->user_id}_1"); $memcache->name_delete('us', $image->user_id); } } else { echo "FAIL"; }
$ticket->updateField("title1", $image->title1, $title, $moderated["title"]); $ticket->updateField("comment1", $image->comment1, $comment, $moderated["comment"]); $ticket->updateField("title2", $image->title2, $title2, $moderated["title2"]); $ticket->updateField("comment2", $image->comment2, $comment2, $moderated["comment2"]); $ticket->updateField("imageclass", $image->imageclass, $imageclass, $moderated["imageclass"]); $ticket->updateField("imagetaken", $image->imagetaken, $imagetaken, $moderated["imagetaken"]); $ticket->updateField("grid_reference", $image->subject_gridref, $grid_reference, $moderated["grid_reference"]); $ticket->updateField("photographer_gridref", $image->photographer_gridref, $photographer_gridref, $moderated["photographer_gridref"]); $ticket->updateField("view_direction", $image->view_direction, $view_direction, $moderated["view_direction"]); $ticket->updateField("use6fig", $image->use6fig, $use6fig, $moderated["use6fig"]); //finalise the change ticket if (!empty($_REQUEST['mod'])) { switch ($_REQUEST['mod']) { //owner has choosen to notify a modeator case 'pending': $status = $ticket->commit('pending'); break; //a modwerator wants to close the ticket //a modwerator wants to close the ticket case 'apply': $status = $ticket->commit('closed'); break; //a modwerator wants to own the ticket //a modwerator wants to own the ticket case 'assign': $status = $ticket->commit('open'); break; default: $status = $ticket->commit(); break; }
case $MESSAGES['moderation']['supplemental']: $user_status = 'accepted'; break; case $MESSAGES['moderation']['reject']: $user_status = 'rejected'; break; default: echo "UNKNOWN STATUS"; exit; } if ($user_status == 'rejected' || $image->moderation_status != 'pending' || $db->getOne("SELECT COUNT(*) FROM gridsquare_moderation_lock WHERE gridsquare_id = {$image->gridsquare_id} AND lock_obtained > DATE_SUB(NOW(),INTERVAL 1 HOUR)")) { $ticket = new GridImageTroubleTicket(); $ticket->setSuggester($USER->user_id); $ticket->setImage($gridimage_id); $ticket->setNotes("Auto-generated ticket, as a result of Self Moderation. Please leave a comment (in the reply box just below this message) to explain the reason for suggesting '{$status}'."); $status = $ticket->commit('pending'); } $db->Query("update gridimage set user_status = '{$user_status}' where gridimage_id={$gridimage_id}"); header("Location:/editimage.php?id={$gridimage_id}"); exit; } else { echo "UNABLE TO MODERATE"; } } else { echo "FAIL"; } } else { echo "NOT LOGGED IN"; } exit; }
function setCredit($realname) { global $USER; if (!$this->isValid()) { return "Invalid image"; } $db = $this->_getDB(); $db->Execute(sprintf("update gridimage set realname = %s where gridimage_id=%d", $db->Quote($realname), $this->gridimage_id)); $ticket = new GridImageTroubleTicket(); $ticket->setSuggester($USER->user_id); $ticket->setPublic('everyone'); ## dont thing any case for this to be anon, its either a mod or the owner $ticket->setImage($this->gridimage_id); #$ticket->setNotes("Credit changed to '$realname'"); $ticket->updateField("realname", $this->realname, $realname, false); $status = $ticket->commit('closed'); $this->realname = $realname; $this->updateCachedTables(); }