function mail_and_del($commentID, $reason)
{
    global $wpbl_options;
    $info = '';
    // harvest information - if necessary
    if (in_array('harvestinfo', $wpbl_options)) {
        $info = harvest($commentID);
    }
    // send e-mail first since details won't be there after delete :p
    if (in_array('sendmail', $wpbl_options)) {
        wpbl_notify($commentID, $reason, $info);
    }
    if (wp_set_comment_status($commentID, 'delete')) {
        return true;
    } else {
        return false;
    }
}
Ejemplo n.º 2
0
<?php

require_once 'component.inc';
require_once 'navigation2.inc';
require_once 'GradeHarvester.php';
/**
 * Upload grades to peerweb.
 */
$gradeSet = array();
$showInput = true;
$event = '';
if (isset($_POST['event'])) {
    $_SESSION['event'] = $event = pg_escape_string($_POST['event']);
}
if (isset($_POST['grades']) && isset($_POST['event'])) {
    $_SESSION['gradeSet'] = $gradeSet = harvest($_POST['grades']);
    $showInput = count($gradeSet) === 0;
} else {
    if (isset($_POST['grade']) && isset($_POST['cand']) && isset($_POST['commit'])) {
        $gc = count($_POST['grade']);
        $gradeSet = array();
        for ($c = 0; $c < $gc; $c++) {
            $gradeSet[$_POST['cand'][$c]] = $_POST['grade'][$c];
        }
        $cands = implode(',', array_keys($gradeSet));
        $trans_id = $dbConn->transactionStart("enter grades for  {$event}");
        $sql = "delete from exam_grades where event = '{$event}' and snummer " . "in ({$cands}) and trans_id in (select trans_id from transaction where operator={$peer_id});\n";
        $resultSet = $dbConn->Execute($sql);
        foreach ($gradeSet as $can => $grad) {
            $sql = "insert into exam_grades (snummer,event,grade,trans_id) values ({$can},'{$event}',{$grad},{$trans_id});\n";
            $resultSet = $dbConn->Execute($sql);
Ejemplo n.º 3
0
 foreach ($delete_comments as $comment) {
     // Check the permissions on each
     $comment = intval($comment);
     $post_id = $wpdb->get_var("SELECT comment_post_ID FROM {$tablecomments} WHERE comment_ID = {$comment}");
     if ($post_id) {
         $authordata = get_userdata($wpdb->get_var("SELECT post_author FROM {$tableposts} WHERE ID = {$post_id}"));
     } else {
         $authordata = get_userdata($user_ID);
     }
     if ($user_level > $authordata->user_level or $user_login == $authordata->user_login) {
         // harvest information before deleting if this is a delete & add operation
         if (!empty($deladd)) {
             if (!empty($info)) {
                 $info .= '<br />';
             }
             $info .= harvest($comment);
         }
         // delete the comment
         $wpdb->query("DELETE FROM {$tablecomments} WHERE comment_ID = {$comment}");
         ++$i;
     }
 }
 echo "<p><strong>" . sprintf(_('%s comments deleted.'), $i);
 // was this an add & delete operation - if so, add search item & harvested items to blacklist
 if ($deladd != '') {
     // the search item is only added for IP or regex searches
     if ($rb_search > 0 && !empty($search)) {
         if ($rb_search == 1) {
             $answer = "IP : {$search} ";
             $search = sanctify($search);
             $sql = "INSERT INTO {$tableblacklist} (regex,regex_type) VALUES ('{$search}','ip')";
            $action = '';
        }
    }
}
$cnt = 0;
$add = '';
switch ($action) {
    case 'deladd':
    case 'delete':
        foreach ($delete_comments as $comment) {
            // first get the details and add it to blacklist - if necessary
            if ($action == 'deladd') {
                if (!empty($add)) {
                    $add .= '<br />';
                }
                $add .= harvest($comment);
            }
            // $action == 'deladd'
            wp_set_comment_status($comment, 'delete');
            ++$cnt;
        }
        break;
    case 'approve':
        foreach ($delete_comments as $comment) {
            wp_set_comment_status($comment, 'approve');
            ++$cnt;
        }
        break;
}
if ($cnt != 0) {
    echo "<div class='updated'>\n<p>";
Ejemplo n.º 5
0
<?php

// require("connection.php");
include "models.php";
if (isset($_POST['addSlot'])) {
    addSlot();
}
if (isset($_POST['addPlantName'])) {
    addPlantType($_POST['plantName']);
}
if (isset($_POST['plantIt'])) {
    plantIt($_POST['Plant']);
}
if (isset($_GET['harvest'])) {
    harvest($_GET['slotid']);
}
?>
<html>
	<head>
		
	</head>
	<body>
		<div id="addPlantType" class="modal hide">
			<div class="modalbody">
				<a href="" class="close right">close</a>
				<form action="index.php" method="post">
					<input type="text" name="plantName" placeholder="Enter Plant Name">
					<input type="submit" name="addPlantName" value="Add">
				</form>
			</div>
		</div>