Revision history for DeleteSpamAction
Revision [19144]
Last edited on 2008-01-28 00:14:03 by CharlesNepote [Modified links pointing to docs server]No Differences
Additions:
Ok, this is the translated (with very minor additions) version of the admin action to delete spam from [[http://www.wikini.net/wakka.php?wiki=DiscussionsActionDAdministrationEraseSpam Wikini]] that GmBowen linked to on the ProgrammingHelp in RichardBerg's request for help fixing his site after a spambot attack.
I've changed all the actual variables and documentation to English, and added a couple of order by clauses to clean up the display page. Other than that, it's all [[http://www.wikini.net/wakka.php?wiki=CharlesNepote his]].
Caveat: I haven't been able to try this out all the way; it loads the first form (where you input the IP or username of the spammer) and the second page listing all the page revisions attributed to that IP or username just fine, but I haven't tested it any further because the only installation I have up right now is live. :\ Maybe it could be tried on the beta site?
There's **no** authentication to make sure it's an admin doing the deleting, so I would suggest using it only on a secured page where you're the only person with access to it, and then I'd delete the function and action page when you're done.
~&The following should do this:
~&just enwrap the whole action after the comment with:
~&%%(php)
if ($this->IsAdmin())
{
%% and %%(php)
}
else
{
echo 'Sorry, but because of security reasons, this action is only available for admins.';
}
%% I just wonder if it is faster to add if(!GetUser) to the if to close out "not logged-in users" in the first point and making IsAdmin needless in this case? --NilsLindenberg
~~& Cool, thanks, good to know. :) --MovieLady
But hey, it's a starting point! :)
Save this as actions/deletespam.php (up to you, I suppose *g*)
%%(php)
<?php
// Charles Népote 2005
// License GPL.
// Version 0.1 du 22/01/2005.
// Translated to English and minor changes by MovieLady 1/23/2005
echo "\n<!-- == Action erase spam ============================= -->\n";
echo "<style type=\"text/css\">",
"p { margin: 0; }",
".action_erasespam { background-color: yellow; }",
"</style>\n";
// Display the form to enter the spammer's ID or IP address
if(!isset($_REQUEST['spammer']))
{
echo "<div class=\"action_erasespam\">\n",
"<form method=\"get\" action=\"". $this->Href() . "\" name=\"selection\">\n",
"<fieldset>\n",
"<legend>Revert spammed pages to previous version</legend>\n",
"<input type=\"hidden\" name=\"wiki\" value=\"" . $this->GetPageTag() . "\" />\n",
"<p>Name of the user: <input name=\"spammer\" /> ",
"<button value=\"Valider\">Submit</button></p>\n",
"</fieldset>\n",
"</form>\n",
"</div>\n";
}
// Results page and form to select which histories to erase
// added order by time ascending to the sql statement to clean up the display list --ML
else if(!isset($_REQUEST['erase']))
{
// Select all the current pages revised by this user
$request =
"select *
from ".$this->config["table_prefix"]."pages
where user = '" . $_REQUEST['spammer'] . "' and latest = 'Y' order by time asc";
$pagesFromSpammer = $this->LoadAll($request);
// Display the list of pages that have been vandalized
echo "<div class=\"action_erasespam\">\n";
echo "<p>Clean up the pages vandalized by " . $_REQUEST['spammer'] . "</p>\n";
echo "<form method=\"get\" action=\"". $this->Href() . "\">\n",
"<input type=\"hidden\" name=\"wiki\" value=\"" . $this->GetPageTag() . "\" />\n";
foreach ($pagesFromSpammer as $i => $page)
{
echo "<p><input name=\"" . $page["tag"] . "\" type=\"checkbox\">",
"(", $page["time"], ") ",
"(",$this->ComposeLinkToPage($page["tag"], "revisions", "history", 0),") ",
$this->ComposeLinkToPage($page["tag"], "", "", 0),
" . . . . ",$this->Format($page["user"]),"</p>\n" ;
}
echo "<input type=\"hidden\" name=\"spammer\" value=\"" . $_REQUEST['spammer'] . "\" />\n";
echo "<input type=\"hidden\" name=\"erase\" value=\"yes\" />\n";
echo "<p><button value=\"Valider\">Delete the selected page revisions</button></p>\n";
echo "</form>\n";
echo "</div>\n";
}
//
else
{
$deletedPages = "";
// Select all the current pages revised by this user
// added order by time ascending to the sql statement to clean up the display list --ML
$request1 =
"select *
from ".$this->config["table_prefix"]."pages
where user = '" . $_REQUEST['spammer'] . "' and latest = 'Y' order by time asc";
$pagesFromSpammer = $this->LoadAll($request1);
// For each selected page
foreach ($pagesFromSpammer as $i => $page)
{
// If the box is checked (marking that version of the page as having been spammed)
if (isset($_REQUEST[$page["tag"]]))
{
$requestPageBefore =
"select * " .
"from " . $this->config["table_prefix"] . "pages " .
"where tag = '" . $page["tag"] . "' " .
"and time < '" . $page["time"] . "' " .
"order by `time` desc limit 1";
$pageBefore = $this->LoadSingle($requestPageBefore);
if (!empty($pageBefore))
{
// Delete the selected page history
$requestDelete =
"delete from " . $this->config["table_prefix"] . "pages " .
"where id = '" . $page["id"] . "' and tag = '" . $page["tag"] . "' " .
"limit 1";
$this->Query($requestDelete);
//echo "$$$$$$$$$$$$$$";
$deletedPages .= $page["tag"] . " ";
// Make the previous revision the latest version
$makeLatest =
"update " . $this->config["table_prefix"] . "pages " .
"set latest = 'Y' where id = '" . $pageBefore["id"] . "' and tag = '" . $page["tag"] . "' " .
"limit 1";
$this->Query($makeLatest);
}
}
}
echo "<div class=\"action_erasespam\">\n";
echo "Pages deleted : ", $this->Format($deletedPages), "\n";
echo "</div>\n\n";
}
?>
%%
Ok, now in /wakka.php, you need to add the following (after backing up the file!):
%%(php)
function ComposeLinkToPage($tag, $method = "", $text = "", $track = 1)
{
if (!$text) $text = $tag;
$text = htmlentities($text);
if ($_SESSION["linktracking"] && $track)
$this->TrackLinkTo($tag);
return '<a href="'.$this->href($method, $tag).'">'.$text.'</a>';
}
%%
I added it right after where "function Link" closed and before the commented out "function ""PregPageLink""" - it was about line 475.
So, there's the jumping off point.
~&Looking through the code, one thing I note is that this will only "catch" and clear **current** pages that are spammed/defaced; if they have been changed by someone else afterwards already, they will remain in the archive... I was thinking of a different approach (without this problem) but a "jumping off point" like this will certainly help. Thanks for the contribution, MovieLady! --JavaWoman
~~& (Welcome. *g*) Yep, it does. If you changed the where clauses to grab pages where latest = 'N', you could delete the $makelatest statement and then have a separate action to delete only spammed history, rather than the active pages. Kind of a pain to have them separated like that, but it could work until something is written from scratch to combine the two. :) --MovieLady
~~~& Thinking about it, though (and talking to myself *g*), I think all you'd need would be an if/else statement around the $makelatest command - if latest = 'Y' make the previous version the active page, else don't. --MovieLady
~~~~& And probably should separate the pages in the display list by whether they're history or the latest version of the page, so that it's visibly obvious to the admin which is which. -- MovieLady
~~&Offtopic: We do need a "page in work flag" :) --NilsLindenberg
~~~&Yes :) --JavaWoman
Ahem, I published a 0.5 version with much improvements. I will think about your remarks. I plan to finish the action in about 2 or 3 weeks ; with :
- [done] a reporting page where the action log automatically who done what : ex :
- (2005-01-27 18:35:41) This pages have been cleaned by CharlesNepote [SPAM from aa.bb.ru linking on porn sites] : DeleteSpamAction, SandBox.
- (note this is very important to prevent abuses if there are other admins)
- [done] possibility to add a comment in the log
- [done] possibility to choose the log page :
- from a parameter : ""{{erasespam logpage="SpamReport"}}""
- or, by default, the current page
- possibility to list pages between two dates
- possibility to clean older versions of a page
- and so on
-- CharlesNepote
----
==== To do list ====
(Some of which is already done, but needs a little adjusting or testing)
1) Encorporate the admin-access-only code
1) Expand this so it:
a) brings up //all// of the pages that have been altered by the user
a) marks them as current or previous version, and
i) if it's a history page, just delete it
i) if it's the most recent version of the page, delete the page and mark the previous version of the page as the current version
1) Add a tick box that selects all the pages for ease of mass spam removal
----
CategoryUserContributions
I've changed all the actual variables and documentation to English, and added a couple of order by clauses to clean up the display page. Other than that, it's all [[http://www.wikini.net/wakka.php?wiki=CharlesNepote his]].
Caveat: I haven't been able to try this out all the way; it loads the first form (where you input the IP or username of the spammer) and the second page listing all the page revisions attributed to that IP or username just fine, but I haven't tested it any further because the only installation I have up right now is live. :\ Maybe it could be tried on the beta site?
There's **no** authentication to make sure it's an admin doing the deleting, so I would suggest using it only on a secured page where you're the only person with access to it, and then I'd delete the function and action page when you're done.
~&The following should do this:
~&just enwrap the whole action after the comment with:
~&%%(php)
if ($this->IsAdmin())
{
%% and %%(php)
}
else
{
echo 'Sorry, but because of security reasons, this action is only available for admins.';
}
%% I just wonder if it is faster to add if(!GetUser) to the if to close out "not logged-in users" in the first point and making IsAdmin needless in this case? --NilsLindenberg
~~& Cool, thanks, good to know. :) --MovieLady
But hey, it's a starting point! :)
Save this as actions/deletespam.php (up to you, I suppose *g*)
%%(php)
<?php
// Charles Népote 2005
// License GPL.
// Version 0.1 du 22/01/2005.
// Translated to English and minor changes by MovieLady 1/23/2005
echo "\n<!-- == Action erase spam ============================= -->\n";
echo "<style type=\"text/css\">",
"p { margin: 0; }",
".action_erasespam { background-color: yellow; }",
"</style>\n";
// Display the form to enter the spammer's ID or IP address
if(!isset($_REQUEST['spammer']))
{
echo "<div class=\"action_erasespam\">\n",
"<form method=\"get\" action=\"". $this->Href() . "\" name=\"selection\">\n",
"<fieldset>\n",
"<legend>Revert spammed pages to previous version</legend>\n",
"<input type=\"hidden\" name=\"wiki\" value=\"" . $this->GetPageTag() . "\" />\n",
"<p>Name of the user: <input name=\"spammer\" /> ",
"<button value=\"Valider\">Submit</button></p>\n",
"</fieldset>\n",
"</form>\n",
"</div>\n";
}
// Results page and form to select which histories to erase
// added order by time ascending to the sql statement to clean up the display list --ML
else if(!isset($_REQUEST['erase']))
{
// Select all the current pages revised by this user
$request =
"select *
from ".$this->config["table_prefix"]."pages
where user = '" . $_REQUEST['spammer'] . "' and latest = 'Y' order by time asc";
$pagesFromSpammer = $this->LoadAll($request);
// Display the list of pages that have been vandalized
echo "<div class=\"action_erasespam\">\n";
echo "<p>Clean up the pages vandalized by " . $_REQUEST['spammer'] . "</p>\n";
echo "<form method=\"get\" action=\"". $this->Href() . "\">\n",
"<input type=\"hidden\" name=\"wiki\" value=\"" . $this->GetPageTag() . "\" />\n";
foreach ($pagesFromSpammer as $i => $page)
{
echo "<p><input name=\"" . $page["tag"] . "\" type=\"checkbox\">",
"(", $page["time"], ") ",
"(",$this->ComposeLinkToPage($page["tag"], "revisions", "history", 0),") ",
$this->ComposeLinkToPage($page["tag"], "", "", 0),
" . . . . ",$this->Format($page["user"]),"</p>\n" ;
}
echo "<input type=\"hidden\" name=\"spammer\" value=\"" . $_REQUEST['spammer'] . "\" />\n";
echo "<input type=\"hidden\" name=\"erase\" value=\"yes\" />\n";
echo "<p><button value=\"Valider\">Delete the selected page revisions</button></p>\n";
echo "</form>\n";
echo "</div>\n";
}
//
else
{
$deletedPages = "";
// Select all the current pages revised by this user
// added order by time ascending to the sql statement to clean up the display list --ML
$request1 =
"select *
from ".$this->config["table_prefix"]."pages
where user = '" . $_REQUEST['spammer'] . "' and latest = 'Y' order by time asc";
$pagesFromSpammer = $this->LoadAll($request1);
// For each selected page
foreach ($pagesFromSpammer as $i => $page)
{
// If the box is checked (marking that version of the page as having been spammed)
if (isset($_REQUEST[$page["tag"]]))
{
$requestPageBefore =
"select * " .
"from " . $this->config["table_prefix"] . "pages " .
"where tag = '" . $page["tag"] . "' " .
"and time < '" . $page["time"] . "' " .
"order by `time` desc limit 1";
$pageBefore = $this->LoadSingle($requestPageBefore);
if (!empty($pageBefore))
{
// Delete the selected page history
$requestDelete =
"delete from " . $this->config["table_prefix"] . "pages " .
"where id = '" . $page["id"] . "' and tag = '" . $page["tag"] . "' " .
"limit 1";
$this->Query($requestDelete);
//echo "$$$$$$$$$$$$$$";
$deletedPages .= $page["tag"] . " ";
// Make the previous revision the latest version
$makeLatest =
"update " . $this->config["table_prefix"] . "pages " .
"set latest = 'Y' where id = '" . $pageBefore["id"] . "' and tag = '" . $page["tag"] . "' " .
"limit 1";
$this->Query($makeLatest);
}
}
}
echo "<div class=\"action_erasespam\">\n";
echo "Pages deleted : ", $this->Format($deletedPages), "\n";
echo "</div>\n\n";
}
?>
%%
Ok, now in /wakka.php, you need to add the following (after backing up the file!):
%%(php)
function ComposeLinkToPage($tag, $method = "", $text = "", $track = 1)
{
if (!$text) $text = $tag;
$text = htmlentities($text);
if ($_SESSION["linktracking"] && $track)
$this->TrackLinkTo($tag);
return '<a href="'.$this->href($method, $tag).'">'.$text.'</a>';
}
%%
I added it right after where "function Link" closed and before the commented out "function ""PregPageLink""" - it was about line 475.
So, there's the jumping off point.
~&Looking through the code, one thing I note is that this will only "catch" and clear **current** pages that are spammed/defaced; if they have been changed by someone else afterwards already, they will remain in the archive... I was thinking of a different approach (without this problem) but a "jumping off point" like this will certainly help. Thanks for the contribution, MovieLady! --JavaWoman
~~& (Welcome. *g*) Yep, it does. If you changed the where clauses to grab pages where latest = 'N', you could delete the $makelatest statement and then have a separate action to delete only spammed history, rather than the active pages. Kind of a pain to have them separated like that, but it could work until something is written from scratch to combine the two. :) --MovieLady
~~~& Thinking about it, though (and talking to myself *g*), I think all you'd need would be an if/else statement around the $makelatest command - if latest = 'Y' make the previous version the active page, else don't. --MovieLady
~~~~& And probably should separate the pages in the display list by whether they're history or the latest version of the page, so that it's visibly obvious to the admin which is which. -- MovieLady
~~&Offtopic: We do need a "page in work flag" :) --NilsLindenberg
~~~&Yes :) --JavaWoman
Ahem, I published a 0.5 version with much improvements. I will think about your remarks. I plan to finish the action in about 2 or 3 weeks ; with :
- [done] a reporting page where the action log automatically who done what : ex :
- (2005-01-27 18:35:41) This pages have been cleaned by CharlesNepote [SPAM from aa.bb.ru linking on porn sites] : DeleteSpamAction, SandBox.
- (note this is very important to prevent abuses if there are other admins)
- [done] possibility to add a comment in the log
- [done] possibility to choose the log page :
- from a parameter : ""{{erasespam logpage="SpamReport"}}""
- or, by default, the current page
- possibility to list pages between two dates
- possibility to clean older versions of a page
- and so on
-- CharlesNepote
----
==== To do list ====
(Some of which is already done, but needs a little adjusting or testing)
1) Encorporate the admin-access-only code
1) Expand this so it:
a) brings up //all// of the pages that have been altered by the user
a) marks them as current or previous version, and
i) if it's a history page, just delete it
i) if it's the most recent version of the page, delete the page and mark the previous version of the page as the current version
1) Add a tick box that selects all the pages for ease of mass spam removal
----
CategoryUserContributions
Deletions:
I've changed all the actual variables and documentation to English, and added a couple of order by clauses to clean up the display page. Other than that, it's all [[http://www.wikini.net/wakka.php?wiki=CharlesNepote his]].
Caveat: I haven't been able to try this out all the way; it loads the first form (where you input the IP or username of the spammer) and the second page listing all the page revisions attributed to that IP or username just fine, but I haven't tested it any further because the only installation I have up right now is live. :\ Maybe it could be tried on the beta site?
There's **no** authentication to make sure it's an admin doing the deleting, so I would suggest using it only on a secured page where you're the only person with access to it, and then I'd delete the function and action page when you're done.
~
Additions:
Ok, this is the translated (with very minor additions) version of the admin action to delete spam from [[http://www.wikini.net/wakka.php?wiki=DiscussionsActionDAdministrationEraseSpam Wikini]] that GmBowen linked to on the ProgrammingHelp in RichardBerg's request for help fixing his site after a spambot attack.
I've changed all the actual variables and documentation to English, and added a couple of order by clauses to clean up the display page. Other than that, it's all [[http://www.wikini.net/wakka.php?wiki=CharlesNepote his]].
Caveat: I haven't been able to try this out all the way; it loads the first form (where you input the IP or username of the spammer) and the second page listing all the page revisions attributed to that IP or username just fine, but I haven't tested it any further because the only installation I have up right now is live. :\ Maybe it could be tried on the beta site?
There's **no** authentication to make sure it's an admin doing the deleting, so I would suggest using it only on a secured page where you're the only person with access to it, and then I'd delete the function and action page when you're done.
~
I've changed all the actual variables and documentation to English, and added a couple of order by clauses to clean up the display page. Other than that, it's all [[http://www.wikini.net/wakka.php?wiki=CharlesNepote his]].
Caveat: I haven't been able to try this out all the way; it loads the first form (where you input the IP or username of the spammer) and the second page listing all the page revisions attributed to that IP or username just fine, but I haven't tested it any further because the only installation I have up right now is live. :\ Maybe it could be tried on the beta site?
There's **no** authentication to make sure it's an admin doing the deleting, so I would suggest using it only on a secured page where you're the only person with access to it, and then I'd delete the function and action page when you're done.
~
Deletions:
I've changed all the actual variables and documentation to English, and added a couple of order by clauses to clean up the display page. Other than that, it's all [[http://www.wikini.net/wakka.php?wiki=CharlesNepote his]].
Caveat: I haven't been able to try this out all the way; it loads the first form (where you input the IP or username of the spammer) and the second page listing all the page revisions attributed to that IP or username just fine, but I haven't tested it any further because the only installation I have up right now is live. :\ Maybe it could be tried on the beta site?
There's **no** authentication to make sure it's an admin doing the deleting, so I would suggest using it only on a secured page where you're the only person with access to it, and then I'd delete the function and action page when you're done.
~&The following should do this:
~&just enwrap the whole action after the comment with:
~&%%(php)
if ($this->IsAdmin())
{
%% and %%(php)
}
else
{
echo 'Sorry, but because of security reasons, this action is only available for admins.';
}
%% I just wonder if it is faster to add if(!GetUser) to the if to close out "not logged-in users" in the first point and making IsAdmin needless in this case? --NilsLindenberg
~~& Cool, thanks, good to know. :) --MovieLady
But hey, it's a starting point! :)
Save this as actions/deletespam.php (up to you, I suppose *g*)
%%(php)
<?php
// Charles Népote 2005
// License GPL.
// Version 0.1 du 22/01/2005.
// Translated to English and minor changes by MovieLady 1/23/2005
echo "\n<!-- == Action erase spam ============================= -->\n";
echo "<style type=\"text/css\">",
"p { margin: 0; }",
".action_erasespam { background-color: yellow; }",
"</style>\n";
// Display the form to enter the spammer's ID or IP address
if(!isset($_REQUEST['spammer']))
{
echo "<div class=\"action_erasespam\">\n",
"<form method=\"get\" action=\"". $this->Href() . "\" name=\"selection\">\n",
"<fieldset>\n",
"<legend>Revert spammed pages to previous version</legend>\n",
"<input type=\"hidden\" name=\"wiki\" value=\"" . $this->GetPageTag() . "\" />\n",
"<p>Name of the user: <input name=\"spammer\" /> ",
"<button value=\"Valider\">Submit</button></p>\n",
"</fieldset>\n",
"</form>\n",
"</div>\n";
}
// Results page and form to select which histories to erase
// added order by time ascending to the sql statement to clean up the display list --ML
else if(!isset($_REQUEST['erase']))
{
// Select all the current pages revised by this user
$request =
"select *
from ".$this->config["table_prefix"]."pages
where user = '" . $_REQUEST['spammer'] . "' and latest = 'Y' order by time asc";
$pagesFromSpammer = $this->LoadAll($request);
// Display the list of pages that have been vandalized
echo "<div class=\"action_erasespam\">\n";
echo "<p>Clean up the pages vandalized by " . $_REQUEST['spammer'] . "</p>\n";
echo "<form method=\"get\" action=\"". $this->Href() . "\">\n",
"<input type=\"hidden\" name=\"wiki\" value=\"" . $this->GetPageTag() . "\" />\n";
foreach ($pagesFromSpammer as $i => $page)
{
echo "<p><input name=\"" . $page["tag"] . "\" type=\"checkbox\">",
"(", $page["time"], ") ",
"(",$this->ComposeLinkToPage($page["tag"], "revisions", "history", 0),") ",
$this->ComposeLinkToPage($page["tag"], "", "", 0),
" . . . . ",$this->Format($page["user"]),"</p>\n" ;
}
echo "<input type=\"hidden\" name=\"spammer\" value=\"" . $_REQUEST['spammer'] . "\" />\n";
echo "<input type=\"hidden\" name=\"erase\" value=\"yes\" />\n";
echo "<p><button value=\"Valider\">Delete the selected page revisions</button></p>\n";
echo "</form>\n";
echo "</div>\n";
}
//
else
{
$deletedPages = "";
// Select all the current pages revised by this user
// added order by time ascending to the sql statement to clean up the display list --ML
$request1 =
"select *
from ".$this->config["table_prefix"]."pages
where user = '" . $_REQUEST['spammer'] . "' and latest = 'Y' order by time asc";
$pagesFromSpammer = $this->LoadAll($request1);
// For each selected page
foreach ($pagesFromSpammer as $i => $page)
{
// If the box is checked (marking that version of the page as having been spammed)
if (isset($_REQUEST[$page["tag"]]))
{
$requestPageBefore =
"select * " .
"from " . $this->config["table_prefix"] . "pages " .
"where tag = '" . $page["tag"] . "' " .
"and time < '" . $page["time"] . "' " .
"order by `time` desc limit 1";
$pageBefore = $this->LoadSingle($requestPageBefore);
if (!empty($pageBefore))
{
// Delete the selected page history
$requestDelete =
"delete from " . $this->config["table_prefix"] . "pages " .
"where id = '" . $page["id"] . "' and tag = '" . $page["tag"] . "' " .
"limit 1";
$this->Query($requestDelete);
//echo "$$$$$$$$$$$$$$";
$deletedPages .= $page["tag"] . " ";
// Make the previous revision the latest version
$makeLatest =
"update " . $this->config["table_prefix"] . "pages " .
"set latest = 'Y' where id = '" . $pageBefore["id"] . "' and tag = '" . $page["tag"] . "' " .
"limit 1";
$this->Query($makeLatest);
}
}
}
echo "<div class=\"action_erasespam\">\n";
echo "Pages deleted : ", $this->Format($deletedPages), "\n";
echo "</div>\n\n";
}
?>
%%
Ok, now in /wakka.php, you need to add the following (after backing up the file!):
%%(php)
function ComposeLinkToPage($tag, $method = "", $text = "", $track = 1)
{
if (!$text) $text = $tag;
$text = htmlentities($text);
if ($_SESSION["linktracking"] && $track)
$this->TrackLinkTo($tag);
return '<a href="'.$this->href($method, $tag).'">'.$text.'</a>';
}
%%
I added it right after where "function Link" closed and before the commented out "function ""PregPageLink""" - it was about line 475.
So, there's the jumping off point.
~&Looking through the code, one thing I note is that this will only "catch" and clear **current** pages that are spammed/defaced; if they have been changed by someone else afterwards already, they will remain in the archive... I was thinking of a different approach (without this problem) but a "jumping off point" like this will certainly help. Thanks for the contribution, MovieLady! --JavaWoman
~~& (Welcome. *g*) Yep, it does. If you changed the where clauses to grab pages where latest = 'N', you could delete the $makelatest statement and then have a separate action to delete only spammed history, rather than the active pages. Kind of a pain to have them separated like that, but it could work until something is written from scratch to combine the two. :) --MovieLady
~~~& Thinking about it, though (and talking to myself *g*), I think all you'd need would be an if/else statement around the $makelatest command - if latest = 'Y' make the previous version the active page, else don't. --MovieLady
~~~~& And probably should separate the pages in the display list by whether they're history or the latest version of the page, so that it's visibly obvious to the admin which is which. -- MovieLady
~~&Offtopic: We do need a "page in work flag" :) --NilsLindenberg
~~~&Yes :) --JavaWoman
Ahem, I published a 0.5 version with much improvements. I will think about your remarks. I plan to finish the action in about 2 or 3 weeks ; with :
- [done] a reporting page where the action log automatically who done what : ex :
- (2005-01-27 18:35:41) This pages have been cleaned by CharlesNepote [SPAM from aa.bb.ru linking on porn sites] : DeleteSpamAction, SandBox.
- (note this is very important to prevent abuses if there are other admins)
- [done] possibility to add a comment in the log
- [done] possibility to choose the log page :
- from a parameter : ""{{erasespam logpage="SpamReport"}}""
- or, by default, the current page
- possibility to list pages between two dates
- possibility to clean older versions of a page
- and so on
-- CharlesNepote
----
==== To do list ====
(Some of which is already done, but needs a little adjusting or testing)
1) Encorporate the admin-access-only code
1) Expand this so it:
a) brings up //all// of the pages that have been altered by the user
a) marks them as current or previous version, and
i) if it's a history page, just delete it
i) if it's the most recent version of the page, delete the page and mark the previous version of the page as the current version
1) Add a tick box that selects all the pages for ease of mass spam removal
----
CategoryUserContributions
Additions:
Ahem, I published a 0.5 version with much improvements. I will think about your remarks. I plan to finish the action in about 2 or 3 weeks ; with :
- [done] a reporting page where the action log automatically who done what : ex :
- (2005-01-27 18:35:41) This pages have been cleaned by CharlesNepote [SPAM from aa.bb.ru linking on porn sites] : DeleteSpamAction, SandBox.
- (note this is very important to prevent abuses if there are other admins)
- [done] possibility to add a comment in the log
- [done] possibility to choose the log page :
- from a parameter : ""{{erasespam logpage="SpamReport"}}""
- or, by default, the current page
- possibility to list pages between two dates
- possibility to clean older versions of a page
- and so on
- [done] a reporting page where the action log automatically who done what : ex :
- (2005-01-27 18:35:41) This pages have been cleaned by CharlesNepote [SPAM from aa.bb.ru linking on porn sites] : DeleteSpamAction, SandBox.
- (note this is very important to prevent abuses if there are other admins)
- [done] possibility to add a comment in the log
- [done] possibility to choose the log page :
- from a parameter : ""{{erasespam logpage="SpamReport"}}""
- or, by default, the current page
- possibility to list pages between two dates
- possibility to clean older versions of a page
- and so on
Deletions:
- [done] a reporting page where the action log automatically who done what : ex : (2005-01-27 18:35:41) This pages have been ++washed++ ''cleaned'' by CharlesNepote : DeleteSpamAction, SandBox.
(note this is very important to prevent abuses if there are other admins)
- possibility to list pages between two dates
- and so on
Revision [5348]
Edited on 2005-01-28 18:05:22 by GmBowen [updated release info of action from wikini]Additions:
Ahem, I published a 0.3 version ''(now at 0.4)--gmb'' with much improvments. I will think about your remarks. I plan to finish the action in about 2 or 3 weeks ; with :
- [done] a reporting page where the action log automatically who done what : ex : (2005-01-27 18:35:41) This pages have been ++washed++ ''cleaned'' by CharlesNepote : DeleteSpamAction, SandBox.
- [done] a reporting page where the action log automatically who done what : ex : (2005-01-27 18:35:41) This pages have been ++washed++ ''cleaned'' by CharlesNepote : DeleteSpamAction, SandBox.
Deletions:
- [done] a reporting page where the action log automatically who done what : ex : (2005-01-27 18:35:41) This pages have been washed by CharlesNepote : DeleteSpamAction, SandBox.
Additions:
Ahem, I published a 0.3 version with much improvments. I will think about your remarks. I plan to finish the action in about 2 or 3 weeks ; with :
- [done] a reporting page where the action log automatically who done what : ex : (2005-01-27 18:35:41) This pages have been washed by CharlesNepote : DeleteSpamAction, SandBox.
(note this is very important to prevent abuses if there are other admins)
- possibility to list pages between two dates
- and so on
-- CharlesNepote
- [done] a reporting page where the action log automatically who done what : ex : (2005-01-27 18:35:41) This pages have been washed by CharlesNepote : DeleteSpamAction, SandBox.
(note this is very important to prevent abuses if there are other admins)
- possibility to list pages between two dates
- and so on
-- CharlesNepote
Additions:
==== To do list ====
(Some of which is already done, but needs a little adjusting or testing)
1) Encorporate the admin-access-only code
1) Expand this so it:
a) brings up //all// of the pages that have been altered by the user
a) marks them as current or previous version, and
i) if it's a history page, just delete it
i) if it's the most recent version of the page, delete the page and mark the previous version of the page as the current version
1) Add a tick box that selects all the pages for ease of mass spam removal
(Some of which is already done, but needs a little adjusting or testing)
1) Encorporate the admin-access-only code
1) Expand this so it:
a) brings up //all// of the pages that have been altered by the user
a) marks them as current or previous version, and
i) if it's a history page, just delete it
i) if it's the most recent version of the page, delete the page and mark the previous version of the page as the current version
1) Add a tick box that selects all the pages for ease of mass spam removal
Additions:
~~~~& And probably should separate the pages in the display list by whether they're history or the latest version of the page, so that it's visibly obvious to the admin which is which. -- MovieLady
Additions:
~~& (Welcome. *g*) Yep, it does. If you changed the where clauses to grab pages where latest = 'N', you could delete the $makelatest statement and then have a separate action to delete only spammed history, rather than the active pages. Kind of a pain to have them separated like that, but it could work until something is written from scratch to combine the two. :) --MovieLady
~~~& Thinking about it, though (and talking to myself *g*), I think all you'd need would be an if/else statement around the $makelatest command - if latest = 'Y' make the previous version the active page, else don't. --MovieLady
~~~& Thinking about it, though (and talking to myself *g*), I think all you'd need would be an if/else statement around the $makelatest command - if latest = 'Y' make the previous version the active page, else don't. --MovieLady
Deletions:
~~~~& Thinking about it, though (and talking to myself *g*), I think all you'd need would be an if/else statement around the $makelatest command - if latest = 'Y' make the previous version the active page, else don't. --MovieLady
Additions:
~~~~& Thinking about it, though (and talking to myself *g*), I think all you'd need would be an if/else statement around the $makelatest command - if latest = 'Y' make the previous version the active page, else don't. --MovieLady
Additions:
// Charles Népote 2005
Deletions:
Additions:
~~& Cool, thanks, good to know. :) --MovieLady
Save this as actions/deletespam.php (up to you, I suppose *g*)
// Charles N�pote 2005
// Select all the current pages revised by this user
// Select all the current pages revised by this user
~~~& (Welcome. *g*) Yep, it does. If you changed the where clauses to grab pages where latest = 'N', you could delete the $makelatest statement and then have a separate action to delete only spammed history, rather than the active pages. Kind of a pain to have them separated like that, but it could work until something is written from scratch to combine the two. :) --MovieLady
Save this as actions/deletespam.php (up to you, I suppose *g*)
// Charles N�pote 2005
// Select all the current pages revised by this user
// Select all the current pages revised by this user
~~~& (Welcome. *g*) Yep, it does. If you changed the where clauses to grab pages where latest = 'N', you could delete the $makelatest statement and then have a separate action to delete only spammed history, rather than the active pages. Kind of a pain to have them separated like that, but it could work until something is written from scratch to combine the two. :) --MovieLady
Deletions:
// Charles Népote 2005
// Select all the pages revised by this user
// Select all the pages revised by this user
Additions:
%% and %%(php)
%% I just wonder if it is faster to add if(!GetUser) to the if to close out "not logged-in users" in the first point and making IsAdmin needless in this case? --NilsLindenberg
~~&Offtopic: We do need a "page in work flag" :) --NilsLindenberg
~~~&Yes :) --JavaWoman
%% I just wonder if it is faster to add if(!GetUser) to the if to close out "not logged-in users" in the first point and making IsAdmin needless in this case? --NilsLindenberg
~~&Offtopic: We do need a "page in work flag" :) --NilsLindenberg
~~~&Yes :) --JavaWoman
Deletions:
~&I just wonder if it is faster to add if(!GetUser) to the if to close out "not logged-in users" in the first point and making IsAdmin needless in this case? --NilsLindenberg
~~&Offtopi: We do need a "page in work flag" :) --NilsLindenberg
Additions:
~&The following should do this:
~&just enwrap the whole action after the comment with:
~&%%(php)
if ($this->IsAdmin())
~&and
~&%%(php)
echo 'Sorry, but because of security reasons, this action is only available for admins.';
~&I just wonder if it is faster to add if(!GetUser) to the if to close out "not logged-in users" in the first point and making IsAdmin needless in this case? --NilsLindenberg
~~&Offtopi: We do need a "page in work flag" :) --NilsLindenberg
----
CategoryUserContributions
~&just enwrap the whole action after the comment with:
~&%%(php)
if ($this->IsAdmin())
~&and
~&%%(php)
echo 'Sorry, but because of security reasons, this action is only available for admins.';
~&I just wonder if it is faster to add if(!GetUser) to the if to close out "not logged-in users" in the first point and making IsAdmin needless in this case? --NilsLindenberg
~~&Offtopi: We do need a "page in work flag" :) --NilsLindenberg
----
CategoryUserContributions
Deletions:
Additions:
~&Looking through the code, one thing I note is that this will only "catch" and clear **current** pages that are spammed/defaced; if they have been changed by someone else afterwards already, they will remain in the archive... I was thinking of a different approach (without this problem) but a "jumping off point" like this will certainly help. Thanks for the contribution, MovieLady! --JavaWoman
Deletions:
Additions:
So, there's the jumping off point.
~&Looking through the code, one thing I note is that this will only "catch" and clear **current** pages that are spammed/defaced; if they have been changed by someone else afterwards already, they will remain in the archive... I was thinking of a different appraoch (without this problem) but a "jumping off point like this will certainly help. Thanks for the contribution, MovieLady! --JavaWoman
~&Looking through the code, one thing I note is that this will only "catch" and clear **current** pages that are spammed/defaced; if they have been changed by someone else afterwards already, they will remain in the archive... I was thinking of a different appraoch (without this problem) but a "jumping off point like this will certainly help. Thanks for the contribution, MovieLady! --JavaWoman
Deletions:
Additions:
// Translated to English and minor changes by MovieLady 1/23/2005
Deletions:
Additions:
Ok, this is the translated (with very minor additions) version of the admin action to delete spam from [[http://www.wikini.net/wakka.php?wiki=DiscussionsActionDAdministrationEraseSpam Wikini]] that GmBowen linked to on the ProgrammingHelp in RichardBerg's request for help fixing his site after a spambot attack.
I've changed all the actual variables and documentation to English, and added a couple of order by clauses to clean up the display page. Other than that, it's all [[http://www.wikini.net/wakka.php?wiki=CharlesNepote his]].
I've changed all the actual variables and documentation to English, and added a couple of order by clauses to clean up the display page. Other than that, it's all [[http://www.wikini.net/wakka.php?wiki=CharlesNepote his]].