Zitat:
Zitat von funky123 Hallo GIGALinux!
Danke für deine antwort. Ja so einen Massen Spam Killer währe eine feine Sache! Ich habe gerade nachgesehen auf dem Server befindet sich kein wp-inst Verzeichnis mehr, scheinbar hat mein Vorgänger das nach der Installation entfernt? Benötige ich das wp-inst Verzeichnis?
Danke!
Schöne Grüsse |
Nein, das sagt mir nur, wie alt die Installation ist. Da das Verzeichnis nicht da ist, kann man nach einem
Backup (WICHTIG: Datenbank & Dateien), einfach die die alten Datein mit den neuen überschreiben, den Mainblog upgraden (Einfach aufrufen), dann über Site Admin ->
Upgrade alle weiteren Blogs upgraden. Ist ähnlich, wie bei einem normalem WordPress.
So, hier mein Mass Spam Killer basiert auf dem, aus der Standard dt. WordPress Installation (GPL 3.0):
PHP-Code:
<?php
function cjd_get_spam_count() {
global $wpdb;
if (isset($_POST['action']) && ('nuked' == $_POST['action'])):
return 0;
else:
return $wpdb->get_var("SELECT COUNT(comment_ID) FROM $wpdb->comments WHERE comment_approved = 'spam'");
endif;
}
function cjd_delete_add_manage_page() {
$spam_count = "Spam (" . cjd_get_spam_count() . ")";
add_submenu_page("edit-comments.php", $spam_count, $spam_count, 2, "spam", "cjd_admin_page");
}
function cjd_admin_page() {
global $wpdb, $comment;
if ( (isset($_POST['submit'])) && ('deleted' == $_POST['action']) ) {
$i = 0;
foreach ($_POST['not_spam'] as $comment) :
$comment = (int) $comment;
$wpdb->query("UPDATE $wpdb->comments SET comment_approved = '1' WHERE comment_ID = '$comment' AND comment_approved = 'spam'");
++$i;
endforeach;
echo '<div class="updated"><p>' . sprintf(__('Na bitte, geht doch: %s mal entspammt!'), $i) . "</p></div>";
}
if ('nuked' == $_POST['action']) {
$nuked = $wpdb->query("DELETE FROM $wpdb->comments WHERE comment_approved = 'spam'");
if (isset($nuked)){
echo '<div class="updated"><p>';
if ($nuked) {
echo __("alles platt gemacht, Rowwwr!");
}
echo "</p></div>";
}
}
?>
<div class="wrap">
<h2>Und so geht's:</h2>
<p>Entweder Du benutzt den <strong>Massenspam Killer</strong> und macht alle Einträge auf einmal platt,<br />
oder du nimmst den <strong>Entspammer</strong> und wählst die Spamkommentare einzeln aus.</p>
</div>
<div class="wrap">
<h2>Massenspam Killer</h2>
<?php
$spam_count = cjd_get_spam_count();
if (0 == $spam_count)
{
_e('<p align="center"><strong>Glückwunsch</strong> -- Ein spamfreies Blog!</p>');
echo '</div>';
} else {
_e('<p>Der Massenspam Killer kann alle Einträge in der Datenbank rückstandsfrei löschen, die mit Spam gebrandmarkt wurden. <br />Feine Sache, aber Achtung, die Aktion ist hinterher nicht mehr rückgängig zu machen!</p>');
?>
<form method="post" action="edit-comments.php?page=spam&action=nuked" name="form1">
<input type="hidden" name="action" value="nuked" />
In der Datenbank lungern gerade <strong><?php echo $spam_count; ?></strong> Kommentare, die als Spam markiert sind.
<p><input type="submit" name="Submit" value="Bitte sofort alle gnadenlos plattmachen!" /> </p>
</form>
</div>
<div class="wrap">
<h2>Entspammer</h2>
<?php _e('<p>Mit diesem unglaublichen Entspammer kann ein geliebter Beitrag von lästigen Parasiten befreit werden.
<br />Dazu einfach einen Haken an alle fiesen Kommentare machen, die entfernt werden sollen.
<br />Anschließend braucht man nur noch auf die göttliche Taste klicken.</p>')?>
<?php
$comments = $wpdb->get_results("SELECT *, COUNT(*) AS count FROM $wpdb->comments WHERE comment_approved = 'spam' GROUP BY comment_author_IP");
if ($comments) {
?>
<form method="post" action="edit-comments.php?page=spam" name="form2">
<input type="hidden" name="action" value="deleted" />
<table width="100%" cellpadding="3" cellspacing="3">
<tr>
<th scope="col"><?php _e('Spam?') ?></th>
<th scope="col"><?php _e('Name') ?></th>
<th scope="col"><?php _e('eMail') ?></th>
<th scope="col"><?php _e('Adresse') ?></th>
<? if ( is_site_admin() ) { ?><th scope="col"><?php _e('IP') ?></th><? } ?>
<th scope="col"><?php _e('Kommentare') ?></th>
</tr>
<?php
foreach($comments as $comment) {
$comment_date = mysql2date(get_settings("date_format") . " @ " . get_settings("time_format"), $comment->comment_date);
$post_title = $wpdb->get_var("SELECT post_title FROM $wpdb->posts WHERE ID='$comment->comment_post_ID'");
?>
<?php
$bgcolor = '';
$class = ('alternate' == $class) ? '' : 'alternate';
?>
<tr class='<?php echo $class; ?>'>
<td align="center"><input type="checkbox" name="not_spam[]" value="<?php comment_ID(); ?>" /></td>
<td><?php comment_author() ?></td>
<td align="center">
<?php comment_author_email_link() ?>
</td>
<td align="center"><?php comment_author_url_link() ?></td>
<? if ( is_site_admin() ) { ?><td align="center"><a href="http://ws.arin.net/cgi-bin/whois.pl?queryinput=<?php comment_author_IP() ?>"><?php comment_author_IP() ?></a></td><? } ?>
<td align="center"><?php echo $comment->count ?></td>
</tr>
<?php
}
}
?>
</table>
<br />
<input type="submit" name="submit" value="Herr, entspamme mich!" />
</form>
</div>
<?php
}
}
add_action('admin_menu', 'cjd_delete_add_manage_page');
?>
Einfach eine Datei (z.B. mass-spam-killer.php) mit diesem Code in
wp-
content/mu-plugins/ anlegen.
Gruß Dennis