###############################################################################
# EditHelpCentre.pl #
###############################################################################
# YaBB: Yet another Bulletin Board #
# Open-Source Community Software for Webmasters #
# Version: YaBB 2.4 #
# Packaged: April 12, 2009 #
# Distributed by: http://www.yabbforum.com #
# =========================================================================== #
# Copyright (c) 2000-2009 YaBB (www.yabbforum.com) - All Rights Reserved. #
# Software by: The YaBB Development Team #
# with assistance from the YaBB community. #
# Sponsored by: Xnull Internet Media, Inc. - http://www.ximinc.com #
# Your source for web hosting, web design, and domains. #
###############################################################################
$edithelpcentreplver = 'YaBB 2.4 $Revision$';
if ($GLOBAL::ACTION eq 'detailedversion') { return 1; }
&LoadLanguage('HelpCentre');
$yytitle = $helptxt{'1'};
sub HelpEdit {
$page = $FORM{'page'};
$help_area = $INFO{'area'};
if ($page eq "user00_agreement") {
$yySetLocation = qq~$adminurl?action=modagreement;agreementlanguage=$language;destination=helpadmin~;
&redirectexit;
}
require "$helpfile/$language/$help_area/$page.help";
$SectionName =~ s/_/ /g;
$admin_list = qq~
|
|
~;
$a = 1;
while (${ SectionSub . $a }) {
${ SectionSub . $a } =~ s/_/ /g;
my $hmessage;
$hmessage = ${ SectionBody . $a };
$admin_list .= qq~
|
|
|
~;
$a++;
}
$yymain .= qq~
~;
$yytitle = "$helptxt{'7'}";
$action_area = "helpadmin";
&AdminTemplate;
}
sub HelpEdit2 {
$Area = $FORM{'area'};
$Page = $FORM{'page'};
$FORM{"SectionName"} =~ s/ /_/g;
$a = 1;
&read_DBorFILE(0,HELPORDER,"$helpfile/$language/$Area",$Page,'help');
print HELPORDER qq~\$SectionName = "$FORM{"SectionName"}";\n\n~;
while ($FORM{"SectionBody$a"}) {
$FORM{"SectionBody$a"} =~ tr/\r//d;
$FORM{"SectionBody$a"} =~ s/\cM//g;
$FORM{"SectionBody$a"} =~ s~\[([^\]]{0,30})\n([^\]]{0,30})\]~\[$1$2\]~g;
$FORM{"SectionBody$a"} =~ s~\[/([^\]]{0,30})\n([^\]]{0,30})\]~\[/$1$2\]~g;
$FORM{"SectionBody$a"} =~ s~(\w+://[^<>\s\n\"\]\[]+)\n([^<>\s\n\"\]\[]+)~$1\n$2~g;
$FORM{"SectionBody$a"} =~ s~\t~ \ \ \ ~g;
$FORM{"SectionBody$a"} =~ s~@~\\@~g;
$FORM{"SectionSub$a"} =~ s/ /_/g;
print HELPORDER qq~### Section $a\n~;
print HELPORDER qq~#############################################\n~;
print HELPORDER qq~\$SectionSub$a = "$FORM{"SectionSub$a"}";\n~;
print HELPORDER qq~\$SectionBody$a = qq\~$FORM{"SectionBody$a"}\~;\n~;
print HELPORDER qq~#############################################\n\n\n~;
$a++;
}
&write_DBorFILE(0,HELPORDER,"$helpfile/$language/$Area",$Page,'help',('1;'));
$yymain .= "$helptxt{'8'}";
$yytitle = "$helptxt{'7'}";
$yySetLocation = qq~$adminurl?action=helpadmin~;
&redirectexit;
}
sub HelpSet2 {
$UseHelp_Perms = $FORM{"UseHelp_Perms"} ? 1 : 0;
require "$admindir/NewSettings.pl";
&SaveSettingsTo('Settings.pl');
$yymain .= "$helptxt{'8'}";
$yytitle = "$helptxt{'7'}";
$yySetLocation = qq~$adminurl?action=helpadmin~;
&redirectexit;
}
sub MainAdmin {
my ($admin_list, $adminlist, $gmod_list, $gmodlist, $moderator_list, $moderatorlist, $user_list, $userlist);
$admincount = 0;
opendir(HELPDIR, "$helpfile/$language/Admin");
@contents = readdir(HELPDIR);
closedir(HELPDIR);
foreach $line (sort { uc($a) cmp uc($b) } @contents) {
($name, $extension) = split(/\./, $line);
if ($extension !~ /help/i) { next; }
$select = "";
if ($admincount == 0) { $select = qq~ selected="selected"~; }
$admin_list .= qq~~;
$admin_lst .= qq~$name\n~;
$admincount++;
}
if (!-e ("$vardir/Admin.helporder")) {
&write_DBorFILE(0,'',$vardir,'Admin','helporder',($admin_lst));
}
@adminorderlist = &read_DBorFILE(0,'',$vardir,'Admin','helporder');
foreach $line (@adminorderlist) {
chomp $line;
$adminlist .= "$line\n";
}
$gmodcount = 0;
opendir(HELPDIR, "$helpfile/$language/Gmod");
@contents = readdir(HELPDIR);
closedir(HELPDIR);
foreach $line (sort { uc($a) cmp uc($b) } @contents) {
($name, $extension) = split(/\./, $line);
if ($extension !~ /help/i) { next; }
$select = "";
if ($gmodcount == 0) { $select = qq~ selected="selected"~; }
$gmod_list .= qq~~;
$gmod_lst .= qq~$name\n~;
$gmodcount++;
}
if (!-e ("$vardir/Gmod.helporder")) {
&write_DBorFILE(0,'',$vardir,'Gmod','helporder',($gmod_lst));
}
@gmodorderlist = &read_DBorFILE(0,'',$vardir,'Gmod','helporder');
foreach $line (@gmodorderlist) {
chomp $line;
$gmodlist .= "$line\n";
}
$modcount = 0;
opendir(HELPDIR, "$helpfile/$language/Moderator");
@contents = readdir(HELPDIR);
closedir(HELPDIR);
foreach $line (sort { uc($a) cmp uc($b) } @contents) {
($name, $extension) = split(/\./, $line);
if ($extension !~ /help/i) { next; }
$select = "";
if ($modcount == 0) { $select = qq~ selected="selected"~; }
$moderator_list .= qq~~;
$moderator_lst .= qq~$name\n~;
$modcount++;
}
if (!-e ("$vardir/Moderator.helporder")) {
&write_DBorFILE(0,'',$vardir,'Moderator','helporder',($moderator_lst));
}
@modorderlist = &read_DBorFILE(0,'',$vardir,'Moderator','helporder');
foreach $line (@modorderlist) {
chomp $line;
$moderatorlist .= "$line\n";
}
$usercount = 0;
opendir(HELPDIR, "$helpfile/$language/User");
@contents = readdir(HELPDIR);
closedir(HELPDIR);
foreach $line (sort { uc($a) cmp uc($b) } @contents) {
($name, $extension) = split(/\./, $line);
if ($extension !~ /help/i) { next; }
$select = "";
if ($usercount == 0) { $select = qq~ selected="selected"~; }
$user_list .= qq~~;
$user_lst .= qq~$name\n~;
$usercount++;
}
if (!-e ("$vardir/User.helporder")) {
&write_DBorFILE(0,'',$vardir,'User','helporder',($user_lst));
}
@userorderlist = &read_DBorFILE(0,'',$vardir,'User','helporder');
foreach $line (@userorderlist) {
chomp $line;
$userlist .= qq~$line\n~;
}
if ($admincount < 4) { $admincount = 4; }
if ($gmodcount < 4) { $gmodcount = 4; }
if ($modcount < 4) { $modcount = 4; }
if ($usercount < 4) { $usercount = 4; }
my $perms_check = '';
if ($UseHelp_Perms == 1) {
$perms_check = qq~ checked='checked'~;
}
$yymain .= qq~
~;
$yytitle = "$helptxt{'7'}";
$action_area = "helpadmin";
&AdminTemplate;
}
sub SetOrderFile {
my $help_area = $INFO{'area'};
my %verify_hash = ();
$FORM{'order'} =~ s/\r//g;
$FORM{'testlst'} =~ s/\r//g;
$oldorder = $FORM{'testlst'};
$neworder = $FORM{'order'};
@oldorder = split(/\n/, $oldorder);
@neworder = split(/\n/, $neworder);
foreach (@oldorder) {
$_ =~ s/[\n\r]//g;
$verify_hash{"$_"}++;
}
$theorder = "";
foreach $order (@neworder) {
$order =~ s/[\n\r]//g;
if ($order eq "") { next; }
if (!(exists($verify_hash{$order}))) { next; }
$theorder .= "$order\n";
}
&write_DBorFILE(0,'',$vardir,$help_area,'helporder',($theorder));
$yytitle = "$helptxt{'7'}";
$yySetLocation = qq~$adminurl?action=helpadmin~;
&redirectexit;
}
1;