2 include("t_config.php");
6 <title>Revert changes</title>
7 <link rel="stylesheet" type="text/css" href="t_config.css">
9 <body bgcolor="#ffffff" text="#000000">
10 <h1>RevertChanges</h1>
14 if (($do = $_REQUEST["proceed"]) || ($_REQUEST["list"])) {
17 echo "<b>Warning</b>: running in <i>dummy mode</i> (--no-act), nothing will happen, all following messages are lies:\n<br><br>\n";
21 $m_author = $_REQUEST["match_author"];
22 $m_time = $_REQUEST["time_slice"] * 3600;
23 $action = $_REQUEST["action"];
24 ($depth = $_REQUEST["version_depth"] - 1) or ($depth = 0);
27 $result = ewiki_db::GETALL(array("id", "author", "lastmodified"));
28 while ($row = $result->get()) {
32 #-- which versions to check
33 $verZ = $row["version"];
34 if ($action=="lastonly") {
45 for ($ver=$verA; $ver<=$verZ; $ver++) {
47 #-- load current $ver database entry
49 $row = ewiki_db::GET($id, $ver);
53 if (stristr($row["author"], $m_author) && ($row["lastmodified"] + $m_time > time())) {
55 #-- delete multiple versions
56 if ($action=="allsince") {
60 ewiki_db::DELETE($id, $ver);
65 #-- or just the affected one
69 ewiki_db::DELETE($id, $ver);
85 If someone garbaged lots of pages in your Wiki, you may want to
86 automatically revert those changes, by making this script delete any
87 page versions that carry a certain string in the {author} field
88 (usually the IP address or host name).<br><br>
89 <form action="<?php echo $PHP_SELF; ?>" method="GET">
90 {author} field pattern <input name="match_author" size="30" value="127.127.127.127:">
92 <small>This must be a fixed string (you cannot use * or regex), at
93 best use the attackers` IP address or host name, but don't include
94 the port number (because it increased with every http access).
97 changes within the last <input name="time_slice" size="4" value="72"> hours
100 <select name="action" size="3">
101 <option selected value="lastonly">delete only if it was the last change</option>
102 <option value="allsince">version diving, also delete changes made after</option>
103 <option value="the">version diving, but only purge the affected one</option>
106 delete the last <input name="version_depth" size="2" value="5"> versions at max
108 <input type="submit" name="list" value="--no-act">
109 <input type="submit" name="proceed" value="revert changes">