} else { if (!empty($_GET['unban']) && is_numeric($_GET['unban'])) { // Validate id $comment = new Comment($_GET['unban']); if ($comment->found) { $comment->Approve('approve'); $message = 'Comment has been unbanned'; $message_type = 'success'; } } else { if (!empty($_GET['ban']) && is_numeric($_GET['ban'])) { // Validate id $comment = new Comment($_GET['ban']); if ($comment->found) { $comment->Update(array('status' => 'banned')); Flag::FlagDecision($comment->comment_id, 'comment', true); $message = 'Comment has been banned'; $message_type = 'success'; } } } } } ### Determine which type (status) of record to display $status = !empty($_GET['status']) ? $_GET['status'] : 'approved'; switch ($status) { case 'pending': $query_string['status'] = 'pending'; $header = 'Pending Comments'; $page_title = 'Pending Comments'; break;
// Validate status if (!empty($_POST['status']) && !ctype_space($_POST['status'])) { $data['status'] = htmlspecialchars(trim($_POST['status'])); } else { $errors['status'] = 'Invalid status'; } // Update video if no errors were made if (empty($errors)) { // Perform addional actions based on status change if ($data['status'] != $video->status) { // Handle "Approve" action if ($data['status'] == 'approved') { $video->Approve('approve'); } else { if ($data['status'] == 'banned') { Flag::FlagDecision($video->video_id, 'video', true); } } } $video->Update($data); $message = 'Video has been updated.'; $message_type = 'success'; } else { $message = 'The following errors were found. Please correct them and try again.'; $message .= '<br /><br /> - ' . implode('<br /> - ', $errors); $message_type = 'error'; } } // Output Header include 'header.php'; ?>
$message_type = 'success'; } break; case 'comment': $comment = new Comment($_GET['ban']); if ($comment->found) { Flag::FlagDecision($comment->comment_id, $type, true); $comment->Update(array('status' => 'banned')); $message = 'Comment has been banned'; $message_type = 'success'; } break; } } else { if (!empty($_GET['dismiss']) && is_numeric($_GET['dismiss'])) { Flag::FlagDecision($_GET['dismiss'], $type, false); $message = 'Flags has been dismissed'; $message_type = 'success'; } } ### Determine which type (account status) of members to display switch ($type) { case 'member': $query_string['status'] = 'member'; $header = 'Flagged Members'; $page_title = 'Flagged Members'; break; case 'video': $query_string['status'] = 'video'; $header = 'Flagged Videos'; $page_title = 'Flagged Videos';
} ### Update User if no errors were found if (empty($errors)) { // Perform addional actions based on status change if ($data['status'] != $user->status) { switch ($data['status']) { // Handle "Approve" action case 'active': $user->UpdateContentStatus('active'); $user->Approve('approve'); break; // Handle "Ban" action // Handle "Ban" action case 'banned': $user->UpdateContentStatus('banned'); Flag::FlagDecision($user->user_id, 'user', true); break; // Handle "Pending" or "New" action // Handle "Pending" or "New" action case 'new': case 'pending': $user->UpdateContentStatus($data['status']); break; } } if (isset($data['password'])) { $data['password'] = md5($data['password']); } $message = 'Member has been updated.'; $message_type = 'success'; $user->Update($data);