# -*- mode:cperl -*-
$BracketWiki = 1;
$SiteName = 'Odd Wiki';
$RcDefault = 7;
$SisterSiteLogoUrl = "http://www.emacswiki.org/pics/%s.png";
# make InterMap and friends editable
$StrangeBannedContent = 'BannedRegexps';
%LockOnCreation = ('BannedContent' => 1,
'BannedHosts' => 1,
'BannedRegexps' => 1, );
# this line is parsed by the maintenance job!
$AdminPass="*secret*";
$MultiUrlLimit=10;
$UploadAllowed=1;
$CalendarOnEveryPage = 0;
$InstanceThrottleLimit = 10;
$StaticDir = '/var/www/alex/communitywiki.org/files';
$StaticUrl = '/files/';
$InvisibleCookieParameters{css} = 1;
umask(002); # all users have read (4) and execute (1) permissions
sub MyRules {
if (m/\G<br>/gc) {
return '<br />';
} elsif (pos == 0 and m/\G\#/gc) { # for any sort of script
my $pos = length($_); # fake matching entire file
pos = $pos;
return $q->pre($_);
# } elsif (m/\G<chat>/gc) {
# return '<div id="peekko"></div>';
}
return undef;
}
push(@MyAdminCode, \&MyMaintenanceReports);
sub MyMaintenanceReports {
my ($id, $menuref, $restref) = @_;
my $ns = $NamespaceCurrent||$NamespacesMain;
push(@$menuref,
$q->a({-href=>"/maintenance/$ns.html"},
'Maintenance Report'),
$q->a({-href=>"/maintenance/$ns-despam.html"},
'Despamming Report'));
}
push(@MyAdminCode, \&MyCssInstall);
sub MyCssInstall {
my ($id, $menuref, $restref) = @_;
push(@$menuref, ScriptLink('action=css', T('Install CSS')))
if $NamespaceCurrent;
}
*GetCss=*MyGetCss;
sub MyGetCss {
my $css = GetParam('css', '');
if ($css) {
# cookie
$css =~ s/".*//; # prevent javascript injection
foreach my $sheet (split(/\s+/, $css)) {
return qq(<link type="text/css" rel="stylesheet" href="$sheet" />);
}
} elsif ($IndexHash{$StyleSheetPage}
and GetPageContent($StyleSheetPage) !~ /^\s*$/) {
# css page exists and has content
$css = "$ScriptName?action=browse;id=" . UrlEncode($StyleSheetPage);
return qq(<link type="text/css" rel="stylesheet" href="$css;raw=1;mime-type=text/css" />);
} else {
# default
return qq(<link type="text/css" rel="stylesheet" href="/blue.css" />);
}
}
push @MyInitVariables, \&InitPageVariables;
sub InitPageVariables {
my $id = GetId();
if ($IndexHash{CommentsPrefix}) {
$CommentsPrefix = GetPageContent('CommentsPrefix');
$CommentsPrefix =~ s/\n/ /;
$CommentsPrefix = FreeToNormal($CommentsPrefix);
$CommentsPrefix .= '_';
$CommentsPrefix = undef if $CommentsPrefix =~ /^$DeletedPage/;
}
# $HtmlHeaders = '<script src="http://peekko.com/chat/ajax/peekko.js"></script>';
# $HtmlHeaders .= '<link rel="alternate" type="application/rss+xml" title="'
# . QuoteHtml($SiteName) . '" href="' . $ScriptName . '?action=rss" />';
# $HtmlHeaders .= '<link rel="alternate" type="application/rss+xml" title="'
# . QuoteHtml("$SiteName: $id") . '" href="' . $ScriptName . '?action=rss;rcidonly=' . $id . '" />'
# if $id;
if ($IndexHash{logo}) {
my $logo = GetPageContent('logo');
if (TextIsFile($logo)) {
$LogoUrl = 'logo';
} elsif ($logo =~ /^$FullUrlPattern$/) {
$LogoUrl = $logo;
}
}
}
push @MyInitVariables, \&OldWikiWarning;
sub OldWikiWarning {
my ($status, $data) = ReadFile("/home/alex/oddwiki/page/S/Status.pg");
if ($status) {
my %data = ParseData($data);
my $text = $data{text};
if ($text =~ /\* $NamespaceCurrent:HomePage .* will be deleted/) {
$Message .= $q->p("This wiki was last modified more than half a year ago and will be deleted eventually!");
}
}
}
@Debugging = (sub {
print GetPageContent('SideBar');
});
@QuestionaskerQuestions =
(["What is 18 + 5?" => sub { shift =~ /^\s*(185|23|twenty[- ]?three|42)\s*$/i }],
);