function wprp_handle_reports() { global $wpdb, $wprp_message; // get Post PARAM $post_id = (int) $_POST['postID']; $report_as = $_POST['report_as']; $description = $_POST['description']; $ipaddress = get_ipaddress(); $nonce = $_POST['wpnonce']; // Get the Post $post = get_post($post_id); // Check for POST if (!$post_id || !$post) { echo "<strong>Invalid Post</strong>"; return; } // Security CHECK if (!wp_verify_nonce($nonce, $post_id)) { echo "<strong>Security Check Failed, Please Submit again...</strong>"; return; } include_once 'ReportPost.class.php'; $rp = new ReportPost($wpdb); if ($rp->add($post_id, $report_as, $description)) { $reported = true; } else { echo "! Sorry, Unable to Process your Request. Please contact Site Administrator via Email to Report this Issue"; } /* // tpValirable $reported=false; // Check for Existing Post Report $post_count=$wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM $wpdb->reportpost WHERE post_id=%s",$post_id)); if(is_numeric($post_count) && $post_count>0) { // Update the Description $result=$wpdb->query( $wpdb->prepare("UPDATE $wpdb->reportpost SET description=CONCAT(description,%s) WHERE post_id=%s"," <br />[".$ipaddress."] : ".$report_as." | ".$description,$post_id)); $reported=true; }else{ // Do Report! $result=$wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->reportpost(post_id,post_title,user_ip,description,stamp) VALUES(%s,%s,%s,%s,%s)",$post_id, $post->post_title, $ipaddress,"[".$ipaddress."] : ".$report_as." | ".$description,time())); $reported=true; // Send Mail $send_email=get_option("rp_send_email"); if($send_email==1) { // SEND EMAIL $mail_to=get_option("rp_email_address"); $mail_subject="[REPORT] : ".$post->post_title; $mail_body="Following Post has been Reported through ".get_option("blogname")."\n-----\n"; $mail_body.="POST ID: ".$post_id."\n"; $mail_body.="POST TITLE: ".$post->post_title."\n"; $mail_body.="Reported As: ".$report_as."\n"; $mail_body.="Description: \n".$description."\n"; $mail_body.="\n-----\nThank You"; $mail_header="From: Admin <".get_option("admin_email").">"; // Send mail // @ Prvent from Showing Any Error Message JUST in CASE @mail($mail_to,$mail_subject,$mail_body,$mail_header); } }*/ if ($reported) { // get thanks Option $thanksMsg = get_option('rp_thanks_msg'); if (empty($thanksMsg)) { $thanksMsg = "<strong>Thanks for Reporting [TITLE]</strong>"; } $thanksMsg = str_replace("[TITLE]", $post->post_title, $thanksMsg); echo $thanksMsg; echo "<br />Reported as : " . $report_as; if (!empty($description)) { echo "<br />Comments : " . $description; } } }
<?php // Get the Reports include_once "ReportPost.class.php"; global $wpdb; $wprp = new ReportPost($wpdb); // Handle Archive & DELETE if ($_SERVER['REQUEST_METHOD'] == 'POST') { //echo $current_user->ID; if (get_magic_quotes_gpc()) { $_POST = array_map('stripslashes_deep', $_POST); $_REQUEST = array_map('stripslashes_deep', $_REQUEST); } $selected = $_POST['reportID']; if ($selected && is_array($selected) && count($selected) > 0) { // If Archive if (isset($_POST['archiveit'])) { global $current_user; get_currentuserinfo(); $archive_c = $_POST['archive_c']; foreach ($selected as $archive) { if (!$wprp->archive($archive, $current_user->ID, $archive_c)) { echo "ERROR: " . $wprp->last_error; break; // EXIT LOOP } } } // DELETE if (isset($_POST['deleteit'])) { foreach ($selected as $archive) {
function wprp_right_now_table_end() { global $wpdb, $wprp; if ($wprp == NULL) { $wprp = new ReportPost($wpdb); $wprp->findReports('ORDER BY id DESC', 1, 'WHERE status=1'); } $class = $wprp->totalRows > 0 ? "class='wprp_wdg'" : ''; echo "<tr>"; echo "<td {$class}> {$wprp->totalRows}</td>"; echo "<td colspan=3 {$class}>New Reports</td>"; echo "</tr>"; }
global $wpdb; $old_table = $wpdb->prefix . "reportpost"; $upgrade_required = false; // IF UPGRADE REQUESTED if (isset($_POST['upgrade'])) { if (get_magic_quotes_gpc()) { $_POST = array_map('stripslashes_deep', $_POST); $_REQUEST = array_map('stripslashes_deep', $_REQUEST); } // Get current user // Get All OLD DATA global $wpdb; $data = $wpdb->get_results($wpdb->prepare("SELECT * FROM {$old_table}"), OBJECT); // Call Class include_once 'ReportPost.class.php'; $wprp = new ReportPost($wpdb); // Disable EMAIL FOR NOW $email_opt = get_option("rp_send_email"); update_option("rp_send_email", "0"); if ($data != NULL && is_array($data) && count($data) > 0) { foreach ($data as $report) { // Split Data $comments = $report->description; $comments = split("<br />", $comments); # Split Different Contents foreach ($comments as $comment) { $comment_array = split(":", $comment, 2); # GETS IP $IP = $comment_array[0]; $IP = str_replace(array("[", "]"), "", trim($IP)); $comment_array = split('\\|', $comment_array[1], 2);
if (!defined('WP_CONTENT_URL')) { define('WP_CONTENT_URL', get_option('siteurl') . '/wp-content'); } if (!defined('WP_PLUGIN_DIR')) { define('WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins'); } if (!defined('WP_PLUGIN_URL')) { define('WP_PLUGIN_URL', WP_CONTENT_URL . '/plugins'); } /* Variables */ $type = $_GET['type']; $id = $_GET['id']; /* Load Reports Class*/ include_once 'ReportPost.class.php'; global $wpdb; $wprp = new ReportPost($wpdb); $report = $wprp->findReports('ORDER BY id DESC', 1, "WHERE id=" . $id); if (count($report) <= 0) { die('Error! Unable to Load Details!'); } $report = $report[0]; $permalink = get_bloginfo('wpurl') . "/wp-admin/post.php?action=edit&post=" . $report->postID; //print_r($report); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Report Details</title> <style type="text/css"> html, body{