#!/usr/bin/perl # TmNetWiki version 0.4 (September 11, 2002) # Copyright (C) 2002 Adam Brate # # Based on the GPLed UseModWiki 0.92 # Copyright (C) 2000-2001 Clifford A. Adams # or # Based on the GPLed AtisWiki 0.3 (C) 1998 Markus Denker # # ...which was based on # the LGPLed CVWiki CVS-patches (C) 1997 Peter Merel # and The Original WikiWikiWeb (C) Ward Cunningham # (code reused with permission) # Email and ThinLine options by Jim Mahoney # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the # Free Software Foundation, Inc. # 59 Temple Place, Suite 330 # Boston, MA 02111-1307 USA package Wiki::special; use strict; use base 'Exporter'; use Wiki::consts; #if ($^V and $^V gt v5.6.0) { # our @EXPORT; #else { use vars qw(@EXPORT); #} @EXPORT = qw( DoOtherRequest DoUnlock DoMaintain DoShowVersion ); $OtherCode = ""; # Comment next line to always compile (slower) #$OtherCode = <<'#END_OF_OTHER_CODE'; use Wiki::utility; use Wiki::edit; use Wiki::error; use Wiki::index; use Wiki::links; use Wiki::editprefs; use Wiki::admin; use Wiki::login; use Wiki::search; #use Wiki::unlock; #use Wiki::version; #use Wiki::maintain; sub DoOtherRequest { my ($id, $action, $text, $search); $action = &GetParam("action", ""); $id = &GetParam("id", ""); if ($action ne "") { $action = lc($action); if ($action eq "edit") { &DoEdit($id, 0, 0, "", 0) if &ValidIdOrDie($id); } elsif ($action eq "unlock") { &DoUnlock(); } elsif ($action eq "index") { &DoIndex(); } elsif ($action eq "links") { &DoLinks(); } elsif ($action eq "quotes") { print $q->header; print &Wiki::quotes::GetQuote; } elsif ($action eq "users") { print $q->header; print &Wiki::users::GetUsers; } elsif ($action eq "maintain") { &DoMaintain(); } elsif ($action eq "pagelock") { &DoPageLock(); } elsif ($action eq "editlock") { &DoEditLock(); } elsif ($action eq "editprefs") { &DoEditPrefs(); } elsif ($action eq "editbanned") { &DoEditBanned(); } elsif ($action eq "editlinks") { &DoEditLinks(); } elsif ($action eq "login") { &DoEnterLogin(); } elsif ($action eq "newlogin") { $UserID = 0; &DoEditPrefs(); # Also creates new ID } elsif ($action eq "version") { &DoShowVersion(); } else { # Later improve error reporting &ReportError(Ts('Invalid action parameter %s', $action)); } return; } if (&GetParam("edit_prefs", 0)) { &DoUpdatePrefs(); return; } if (&GetParam("edit_ban", 0)) { &DoUpdateBanned(); return; } if (&GetParam("enter_login", 0)) { &DoLogin(); return; } if (&GetParam("edit_links", 0)) { &DoUpdateLinks(); return; } $search = &GetParam("search", ""); if (($search ne "") || (&GetParam("dosearch", "") ne "")) { &DoSearch($search); return; } # Handle posted pages if (&GetParam("oldtime", "") ne "") { $id = &GetParam("title", ""); &DoPost() if &ValidIdOrDie($id); return; } # Later improve error message &ReportError(T('Invalid URL.')); } #package Wiki::unlock; #use strict; #use base 'Exporter'; use Wiki::translate; use Wiki::template; use Wiki::lock; #@EXPORT = qw(DoUnlock); # Note: all diff and recent-list operations should be done within locks. sub DoUnlock { my $LockMessage = T('Normal Unlock.'); print &GetHeader('', T('Removing edit lock'), ''); print '

', T('This operation may take several seconds...'), "\n"; if (&ForceReleaseLock('main')) { $LockMessage = T('Forced Unlock.'); } # Later display status of other locks? &ForceReleaseLock('cache'); &ForceReleaseLock('diff'); &ForceReleaseLock('index'); print "

$LockMessage

"; print &GetCommonFooter(); } #package Wiki::maintain; #use strict; #use base 'Exporter'; use Wiki::template; use Wiki::translate; use Wiki::user; use Wiki::lock; use Wiki::page; use Wiki::text; use Wiki::keep; use Wiki::file; use Wiki::error; use Wiki::admin; #@EXPORT = qw(DoMaintain); sub DoMaintain { my ($name, $fname, $data); print &GetHeader('', T('Maintenance on all pages'), ''); print "
"; $fname = "$DataDir/maintain"; if (!&UserIsAdmin()) { if ((-f $fname) && ((-M $fname) < 0.5)) { print T('Maintenance not done.'), ' '; print T('(Maintenance can only be done once every 12 hours.)'); print ' ', T('Remove the "maintain" file or wait.'); print &GetCommonFooter(); return; } } &RequestLock() or die(T('Could not get maintain-lock')); foreach $name (&AllPagesList()) { &OpenPage($name); &OpenDefaultText(); &ExpireKeepFile(); print ".... " if ($name =~ m|/|); print &GetPageLink($name), "
\n"; } &WriteStringToFile($fname, "Maintenance done at " . &TimeToText($Now)); &ReleaseLock(); # Do any rename/deletion commands # (Must be outside lock because it will grab its own lock) $fname = "$DataDir/editlinks"; if (-f $fname) { $data = &ReadFileOrDie($fname); print '
', T('Processing rename/delete commands:'), "
\n"; &UpdateLinksList($data, 1, 1); # Always update RC and links unlink("$fname.old"); rename($fname, "$fname.old"); } print &GetCommonFooter(); } #package Wiki::version; #use strict; use base 'Exporter'; # use Wiki::template; #@EXPORT = qw(DoShowVersion); sub DoShowVersion { print &GetHeader("", "Displaying Wiki Version", ""); print "

UseModWiki version 0.92

\n"; print &GetCommonFooter(); } #END_OF_OTHER_CODE 1;