ExpireDiff-Talk

Summary: Talk page for ExpireDiff.
Maintainer: Petko (original author: Pm)
Users: +2 (View / Edit)

This space is for User-contributed commentary and notes. Please include your name and a date along with your comment.

Comments

Shouldn't this be also password protectable? Klonk

I made a little modification to add a pwd parameter to pass to the action, you have to encode your password into the expirediff.php file. I use it on my site. Here is the code I added to the original recipe:

<?php

if ($action=='expirediff') {

  # Added code START

  # Change ABC to the password you like
  SDV($MyPwd,'ABC');
  $InputPwd = @$_REQUEST['pwd'];
if (! $MyPwd == $InputPwd ) { Abort("Wrong password!!"); }

  # Added code END

  Lock(2);
.......

SteveAgl

Starting with version 2.0.beta50, you can password-protect the action with

$HandleAuth['expirediff'] = 'edit';

or

$HandleAuth['expirediff'] = 'admin';

to require the edit or admin password respectively.

-Hagan

(:table border=0:)

!

I found out that some changes to expirediff.php are necessary to have password-protection via $HandleAuth['expirediff'] work properly:

  • Change the Line function HandleExpireDiff($pagename) {
    to the following: function HandleExpireDiff($pagename, $auth = 'edit') {
  • Change the Line $page = RetrieveAuthPage($pagename, "edit");
    to the following: $page = RetrieveAuthPage($pagename, $auth);

--floozy

floozy,
That didn't quite work because you could expired the diff without having edit privileges. I made some similar changes that should work. Specifically,
  • Added a line SDV($HandleAuth['expirediff'], 'edit');
  • Changed the Line function HandleExpireDiff($pagename) {
    to the following: function HandleExpireDiff($pagename, $auth) {
  • Changed the Line $page = RetrieveAuthPage($pagename, "edit");
    to the following: $page = RetrieveAuthPage($pagename, $auth);
Thanks! --Hagan

You may also add the following code to your local/config.php in order to add the ExpireDiff feature to the end of the history pages:

...
include_once('cookbook/expirediff.php');
...
if ($action == 'diff') {
  $ExpireDiffFmt = <<<_EOT_
<div id='wikiexpire'>
  <form action='\$PageUrl' method='post'>
    <input type='hidden' name='action' value='expirediff' />
    <input type='hidden' name='n' value='\$FullName' />
    <p>Expire difference(s) older than
      <input type='text' name='keepdays' value='7' /> day(s)</p>
    <input type='submit' />
  </form>
</div>
_EOT_;
  $HandleDiffFmt = array(&$PageStartFmt, &$PageDiffFmt,
                         'function:PrintDiff',
                         &$ExpireDiffFmt, &$PageEndFmt);
}
...

-- Dfaure

  • Thank you Dfaure for this setting, it works great. I'd also like to add that, thanks to Dfaure's inclusion of <div id='wikiexpire'>, you can style this in your history pages by adding this to your skin's .css file:
#wikiexpire {
border: 1px solid #aaaaaa;
background-color: #dddddd;
padding: 2px 2px 2px 2px;
font-weight: bold;
}

You can change the above styling, just like any other css styling, to suit your skin. --Ian MacGregor

Talk page for the ExpireDiff recipe (users).