$db = NewADOConnection($GLOBALS['DSN']); if (!empty($_GET['relinqush'])) { $db->Execute("UPDATE user SET rights = REPLACE(rights,'ticketmod','') WHERE user_id = {$USER->user_id}"); //reload the user object $_SESSION['user'] = new GeographUser($USER->user_id); header("Location: /profile.php?edit=1"); } if (isset($_GET['gridimage_ticket_id'])) { require_once 'geograph/gridimage.class.php'; require_once 'geograph/gridsquare.class.php'; require_once 'geograph/gridimagetroubleticket.class.php'; //user may have an expired session, or playing silly buggers, //either way, we want to check for admin status on the session $gridimage_ticket_id = intval($_GET['gridimage_ticket_id']); $hours = isset($_GET['hours']) && is_numeric($_GET['hours']) ? intval($_GET['hours']) : 24; $ticket = new GridImageTroubleTicket($gridimage_ticket_id); if ($ticket->isValid()) { $ticket->setDefer("DATE_ADD(NOW(), INTERVAL {$hours} HOUR)"); echo "Ticket Deferred for {$hours} hours"; } else { echo "FAIL"; } exit; } if (!empty($_GET['Submit'])) { //if changing state, release locks $db->Execute("DELETE FROM gridimage_moderation_lock WHERE user_id = {$USER->user_id}"); header("Location: /admin/tickets.php?" . str_replace('Submit=' . $_GET['Submit'], '', $_SERVER['QUERY_STRING'])); exit; } #############################
$status = $db->Quote($status); $db->Execute("REPLACE INTO moderation_log SET user_id = {$USER->user_id}, gridimage_id = {$gridimage_id}, new_status={$status}, old_status='{$image->moderation_status}',created=now(),type = 'dummy'"); print "classification {$status} recorded"; } else { echo "NOT LOGGED IN"; } } else { //we really need this not be interupted ignore_user_abort(TRUE); set_time_limit(3600); $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");
} } else { $ok = false; $error['photographer_gridref'] = $sq->errormsg; } } $view_direction = intval(trim(stripslashes($_POST['view_direction']))); $use6fig = intval(trim(stripslashes($_POST['use6fig']))); ///////////////////////////////////////////////////////////// // STEP 2 - change control if ($ok) { //we really need this not be interupted ignore_user_abort(TRUE); set_time_limit(3600); //create new change control object $ticket = new GridImageTroubleTicket(); $ticket->setSuggester($USER->user_id, $USER->realname); if ($isadmin && !empty($_REQUEST['mod'])) { $ticket->setModerator($USER->user_id); } if (!empty($_REQUEST['type'])) { $ticket->setType($_REQUEST['type']); } $ticket->setPublic(isset($_REQUEST['public']) ? $_REQUEST['public'] : 'everyone'); $ticket->setImage($_REQUEST['id']); $ticket->setNotes($updatenote); if (strlen($imageclassother)) { $imageclass = $imageclassother; } //attach the various field changes $ticket->updateField("title1", $image->title1, $title, $moderated["title"]);
} switch ($status) { case $MESSAGES['moderation']['geograph'] . ($user_status = ''): 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 {
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(); }