diff options
author | Andreas Gohr <andi@splitbrain.org> | 2006-11-10 14:41:18 +0100 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2006-11-10 14:41:18 +0100 |
commit | 122b469f774df8026a8a6182d2bc026ae1a06e2b (patch) | |
tree | be18b55d7475654234f9de2cd9b6fbe42bceb9fe /lib | |
parent | 168f9feebfac547ac832cdc2561a85158f9bed2d (diff) | |
download | rpg-122b469f774df8026a8a6182d2bc026ae1a06e2b.tar.gz rpg-122b469f774df8026a8a6182d2bc026ae1a06e2b.tar.bz2 |
revert manager GUI updates
darcs-hash:20061110134118-7ad00-097d4a23980d0eda38116ee6e05e79e5f8882cc2.gz
Diffstat (limited to 'lib')
-rw-r--r-- | lib/plugins/revert/admin.php | 100 | ||||
-rw-r--r-- | lib/plugins/revert/lang/en/intro.txt | 4 | ||||
-rw-r--r-- | lib/plugins/revert/lang/en/lang.php | 10 |
3 files changed, 77 insertions, 37 deletions
diff --git a/lib/plugins/revert/admin.php b/lib/plugins/revert/admin.php index 9e2a290dc..879cd961c 100644 --- a/lib/plugins/revert/admin.php +++ b/lib/plugins/revert/admin.php @@ -25,7 +25,7 @@ class admin_plugin_revert extends DokuWiki_Admin_Plugin { return array( 'author' => 'Andreas Gohr', 'email' => 'andi@splitbrain.org', - 'date' => '2005-09-04', + 'date' => '2005-11-10', 'name' => 'Revert Manager', 'desc' => 'Allows you to mass revert recent edits', 'url' => 'http://wiki.splitbrain.org/plugin:revert', @@ -49,63 +49,88 @@ class admin_plugin_revert extends DokuWiki_Admin_Plugin { * output appropriate html */ function html() { - print $this->plugin_locale_xhtml('intro'); - if(is_array($_REQUEST['revert'])) $this->_revert($_REQUEST['revert']); + echo $this->plugin_locale_xhtml('intro'); + $this->_searchform(); - echo '<form method="post">'; - echo '<input type="text" name="filter" class="edit" />'; - echo '<input type="submit" class="button" />'; - echo '</form>'; + if(is_array($_REQUEST['revert'])){ + $this->_revert($_REQUEST['revert']); + }elseif(isset($_REQUEST['filter'])){ + $this->_list($_REQUEST['filter']); + } + } - $this->_list($_REQUEST['filter']); + /** + * Display the form for searching spam pages + */ + function _searchform(){ + global $lang; + echo '<form action="" method="post">'; + echo '<label>'.$this->getLang('filter').': </label>'; + echo '<input type="text" name="filter" class="edit" value="'.hsc($_REQUEST['filter']).'" />'; + echo '<input type="submit" class="button" value="'.$lang['btn_search'].'" />'; + echo ' <span>'.$this->getLang('note').'</span>'; + echo '</form><br /><br />'; } + /** + * Start the reversion process + */ function _revert($revert){ global $conf; - echo '<hr /><div>'; + + echo '<hr /><br />'; + echo '<p>'.$this->getLang('revstart').'</p>'; + + echo '<ul>'; foreach($revert as $id){ global $REV; $old = getRevisions($id, 0, 1); $REV = $old[0]; if($REV){ saveWikiText($id,rawWiki($id,$REV),'old revision restored',false); - echo "$id reverted to $REV<br />"; + printf('<li><div class="li">'.$this->getLang('reverted').'</div></li>',$id,$REV); }else{ saveWikiText($id,'','',false); - echo "$id removed<br />"; + printf('<li><div class="li">'.$this->getLang('removed').'</div></li>',$id,$REV); } @set_time_limit(10); flush(); } - echo '</div><hr />'; + echo '</ul>'; + + echo '<p>'.$this->getLang('revstop').'</p>'; } + /** + * List recent edits matching the given filter + */ function _list($filter){ global $conf; - echo '<form method="post">'; + echo '<hr /><br />'; + echo '<form action="" method="post">'; + echo '<input type="hidden" name="filter" value="'.hsc($filter).'" />'; $recents = getRecents(0,800); - print '<ul>'; + echo '<ul>'; + + $cnt = 0; foreach($recents as $recent){ if($filter){ if(strpos(rawWiki($recent['id']),$filter) === false) continue; } - + $cnt++; $date = date($conf['dformat'],$recent['date']); - print ($recent['type']==='e') ? '<li class="minor">' : '<li>'; - print '<div class="li">'; + echo ($recent['type']==='e') ? '<li class="minor">' : '<li>'; + echo '<div class="li">'; + echo '<input type="checkbox" name="revert[]" value="'.hsc($recent['id']).'" checked="checked" id="revert__'.$cnt.'" />'; + echo '<label for="revert__'.$cnt.'">'.$date.'</label> '; - print '<input type="checkbox" name="revert[]" value="'.hsc($recent['id']).'" checked=checked />'; - - - print $date.' '; - - print '<a href="'.wl($recent['id'],"do=diff").'">'; + echo '<a href="'.wl($recent['id'],"do=diff").'">'; $p = array(); $p['src'] = DOKU_BASE.'lib/images/diff.png'; $p['width'] = 15; @@ -113,10 +138,10 @@ class admin_plugin_revert extends DokuWiki_Admin_Plugin { $p['title'] = $lang['diff']; $p['alt'] = $lang['diff']; $att = buildAttributes($p); - print "<img $att />"; - print '</a> '; + echo "<img $att />"; + echo '</a> '; - print '<a href="'.wl($recent['id'],"do=revisions").'">'; + echo '<a href="'.wl($recent['id'],"do=revisions").'">'; $p = array(); $p['src'] = DOKU_BASE.'lib/images/history.png'; $p['width'] = 12; @@ -124,25 +149,26 @@ class admin_plugin_revert extends DokuWiki_Admin_Plugin { $p['title'] = $lang['btn_revs']; $p['alt'] = $lang['btn_revs']; $att = buildAttributes($p); - print "<img $att />"; - print '</a> '; + echo "<img $att />"; + echo '</a> '; - print html_wikilink(':'.$recent['id'],$conf['useheading']?NULL:$recent['id']); - print ' – '.htmlspecialchars($recent['sum']); + echo html_wikilink(':'.$recent['id'],$conf['useheading']?NULL:$recent['id']); + echo ' – '.htmlspecialchars($recent['sum']); - print ' <span class="user">'; - print $recent['user'].' '.$recent['ip']; - print '</span>'; + echo ' <span class="user">'; + echo $recent['user'].' '.$recent['ip']; + echo '</span>'; - print '</div>'; - print '</li>'; + echo '</div>'; + echo '</li>'; @set_time_limit(10); flush(); } - print '</ul>'; + echo '</ul>'; + + echo '<input type="submit" class="button" value="'.$this->getLang('revert').'" />'; - echo '<input type="submit">'; echo '</form>'; } diff --git a/lib/plugins/revert/lang/en/intro.txt b/lib/plugins/revert/lang/en/intro.txt index 813891017..e3db66b81 100644 --- a/lib/plugins/revert/lang/en/intro.txt +++ b/lib/plugins/revert/lang/en/intro.txt @@ -1,2 +1,6 @@ ====== Revert Manager ====== +This page helps you with the automatic reversion of a spam attack. +To find a list of spammy pages first enter a search string (eg. a +spam URL), then confirm that the found pages are really spam and +revert the edits. diff --git a/lib/plugins/revert/lang/en/lang.php b/lib/plugins/revert/lang/en/lang.php index 8df31508c..aac5f3188 100644 --- a/lib/plugins/revert/lang/en/lang.php +++ b/lib/plugins/revert/lang/en/lang.php @@ -13,4 +13,14 @@ $lang['menu'] = 'Revert Manager'; // custom language strings for the plugin +$lang['filter'] = 'Search spammy pages'; +$lang['note'] = 'Note: this search is case sensitive'; +$lang['revert'] = 'Revert selected edits'; +$lang['reverted'] = '%s reverted to revision %s'; +$lang['removed'] = '%s removed'; +$lang['revstart'] = 'Reversion process started. This can take a long time. If the + script times out before finishing, you need to revert in smaller + chunks.'; +$lang['revstop'] = 'Reversion process finished successful.'; + //Setup VIM: ex: et ts=4 enc=utf-8 : |