############################################################################### # AdminEdit.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. # ############################################################################### $admineditplver = 'YaBB 2.4 $Revision$'; if ($GLOBAL::ACTION eq 'detailedversion') { return 1; } &LoadLanguage('Register'); sub GmodSettings { &is_admin; &LoadLanguage('GModPrivileges'); if (!-e ("$vardir/gmodsettings.txt")) { &GmodSettings2; } require "$vardir/gmodsettings.txt"; if ($gmod_newfile eq '') { &GmodSettings2; } @scriptlines = &read_DBorFILE(0,'',$vardir,'gmodsettings','txt'); $startread = 0; $counter = 0; foreach $scriptline (@scriptlines) { chomp $scriptline; if (substr($scriptline, 0, 1) eq "'") { $scriptline =~ s/newsettings\;page\=//; $scriptline =~ /\"(.*?)\"/; $allow = $1; $scriptline =~ /\'(.*?)\'/; $actionfound = $1; push(@actfound, $actionfound); push(@allowed, $allow); $counter++; } } $column = int($counter / 2); $counter = 0; $a = 0; foreach $actfound (@actfound) { $checked = ''; if ($allowed[$a] eq 'on') { $checked = ' checked="checked"'; } $dismenu .= qq~\n 
~; $counter++; $a++; if ($counter > $column + 1) { $dismenu .= qq~~; $counter = 0; } } if ($allow_gmod_admin) { $gmod_selected_a = ' checked="checked"'; } if ($allow_gmod_profile) { $gmod_selected_p = ' checked="checked"'; if ($allow_gmod_aprofile) { $gmod_selected_ap = ' checked="checked"'; } } else { $gmod_selected_ap = ' disabled="disabled"'; } $yymain .= qq~
$gmod_settings{'1'}





$gmod_settings{'4'}
$dismenu
~; $yytitle = "$gmod_settings{'1'}"; $action_area = "gmodaccess"; &AdminTemplate; } sub EditBots { &is_admin_or_gmod; my ($line); $yymain .= qq~
$admin_txt{'18'}

$admin_txt{'19'}




~; $yytitle = "$admin_txt{'18'}"; $action_area = "editbots"; &AdminTemplate; } sub EditBots2 { &is_admin_or_gmod; &write_DBorFILE(0,'',$vardir,'bots','hosts',(map { "$_\n"; } sort { (split(/\|/, $a))[1] cmp (split(/\|/, $b))[1] } split(/[\n\r]+/, $FORM{'bots'}))); $yySetLocation = qq~$adminurl?action=editbots~; &redirectexit; } sub SetCensor { &is_admin_or_gmod; my ($censorlanguage, $line); if ($FORM{'censorlanguage'}) { $censorlanguage = $FORM{'censorlanguage'} } else { $censorlanguage = $lang; } opendir(LNGDIR, $langdir); my @lfilesanddirs = readdir(LNGDIR); close(LNGDIR); foreach my $fld (sort {lc($a) cmp lc($b)} @lfilesanddirs) { if (-d "$langdir/$fld" && $fld =~ m^\A[0-9a-zA-Z_\#\%\-\:\+\?\$\&\~\,\@/]+\Z^ && -e "$langdir/$fld/Main.lng") { if ($censorlanguage eq $fld) { $drawnldirs .= qq~~; } else { $drawnldirs .= qq~~; } } } $yymain .= qq~
$admin_txt{'135'}
$templs{'7'}







~; $yytitle = "$admin_txt{'135'}"; $action_area = "setcensor"; &AdminTemplate; } sub SetCensor2 { # don't use &FromChars() here!!! &is_admin_or_gmod; $FORM{'censored'} =~ tr/\r//d; $FORM{'censored'} =~ s~\A[\s\n]+~~; $FORM{'censored'} =~ s~[\s\n]+\Z~~; $FORM{'censored'} =~ s~\n\s*\n~\n~g; if ($FORM{'censorlanguage'}) { $censorlanguage = $FORM{'censorlanguage'}; } else { $censorlanguage = $lang; } my @lines = split(/\n+/, $FORM{'censored'}); &write_DBorFILE(0,'',"$langdir/$censorlanguage",'censor','txt',(map { "$_\n" } grep { /.+[=~].+/ } @lines)); $yySetLocation = qq~$adminurl?action=setcensor~; $action_area = "setcensor"; &redirectexit; } sub SetReserve { my (@reserved, @reservecfg, $i); &is_admin_or_gmod; @reserved = &read_DBorFILE(0,'',$vardir,'reserve','txt'); @reservecfg = &read_DBorFILE(0,'',$vardir,'reservecfg','txt'); for (my $i = 0; $i < @reservecfg; $i++) { chomp $reservecfg[$i]; if($reservecfg[$i]) { $reservecheck[$i] = qq~ checked="checked"~; } } $yymain .= qq~
$admin_txt{'341'}

$admin_txt{'699'}


$admin_txt{'342'}







~; $yytitle = "$admin_txt{'341'}"; $action_area = "setreserve"; &AdminTemplate; } sub SetReserve2 { &is_admin_or_gmod; $FORM{'reserved'} =~ tr/\r//d; $FORM{'reserved'} =~ s~\A[\s\n]+~~; $FORM{'reserved'} =~ s~[\s\n]+\Z~~; $FORM{'reserved'} =~ s~\n\s*\n~\n~g; &write_DBorFILE(0,'',$vardir,'reserve','txt',($FORM{'reserved'})); my $matchword = $FORM{'matchword'} eq 'checked' ? 'checked' : ''; my $matchcase = $FORM{'matchcase'} eq 'checked' ? 'checked' : ''; my $matchuser = $FORM{'matchuser'} eq 'checked' ? 'checked' : ''; my $matchname = $FORM{'matchname'} eq 'checked' ? 'checked' : ''; &write_DBorFILE(0,'',$vardir,'reservecfg','txt',("$matchword\n","$matchcase\n","$matchuser\n","$matchname\n")); $yySetLocation = qq~$adminurl~; &redirectexit; } sub ModifyAgreement { &is_admin_or_gmod; opendir(LNGDIR, $langdir); my @lfilesanddirs = readdir(LNGDIR); close(LNGDIR); my $agreementlanguage = $FORM{'agreementlanguage'} || $INFO{'agreementlanguage'} || $lang; foreach my $fld (sort {lc($a) cmp lc($b)} @lfilesanddirs) { if (-d "$langdir/$fld" && $fld =~ m^\A[0-9a-zA-Z_\#\%\-\:\+\?\$\&\~\,\@/]+\Z^ && -e "$langdir/$fld/Main.lng") { if ($agreementlanguage eq $fld) { $drawnldirs .= qq~~; } else { $drawnldirs .= qq~~; } } } my ($line,$fullagreement); foreach $line (&read_DBorFILE(0,'',"$langdir/$agreementlanguage",'agreement','txt')) { $line =~ tr/[\r\n]//d; &FromHTML($line); $fullagreement .= qq~$line\n~; } $yymain .= qq~
$admin_txt{'764'}




$templs{'8'}



~; $yytitle = "$admin_txt{'764'}"; $action_area = "modagreement"; &AdminTemplate; } sub ModifyAgreement2 { &is_admin_or_gmod; if ($FORM{'agreementlanguage'}) { $agreementlanguage = $FORM{'agreementlanguage'}; } else { $agreementlanguage = $lang; } $FORM{'agreement'} =~ tr/\r//d; $FORM{'agreement'} =~ s~\A\n+~~; $FORM{'agreement'} =~ s~\n+\Z~~; &write_DBorFILE(0,'',"$langdir/$agreementlanguage",'agreement','txt',($FORM{'agreement'})); $FORM{'agreement'} =~ s/\n/
\n/g; &write_DBorFILE(0,'',"$helpfile/$agreementlanguage/User/",'user00_agreement','help',(qq^\$SectionName = "$register_txt{'764a'}"; ### Section 1 ############################################# \$SectionSub1 = "$register_txt{'764a'}"; \$SectionBody1 = qq~

$FORM{'agreement'}

~; ############################################# 1;^)); $yySetLocation = $FORM{'destination'} ? qq~$adminurl?action=$FORM{'destination'}~ : qq~$adminurl?action=modagreement;agreementlanguage=$FORM{'agreementlanguage'}~; &redirectexit; } sub GmodSettings2 { &is_admin; # modstyle is set the same as modcss as modcss is useless without it. $mynewsettings = $FORM{'main'} || $FORM{'advanced'} || $FORM{'news'} || $FORM{'security'}|| $FORM{'antispam'}; $FORM{'viewmembers'} = "on" if $FORM{'deletemultimembers'} eq 'on' || $FORM{'addmember'} eq 'on'; my $filler = q~ ~; my $setfile = << "EOF"; ### Gmod Related Setttings ### \$allow_gmod_admin = "$FORM{'allow_gmod_admin'}"; # \$allow_gmod_profile = "$FORM{'allow_gmod_profile'}"; # \$allow_gmod_aprofile = "$FORM{'allow_gmod_aprofile'}"; # \$gmod_newfile = "on"; # ### Areas Gmods can Access ### %gmod_access = ( 'ext_admin',"$FORM{'ext_admin'}", 'newsettings;page=main',"$FORM{'main'}", 'newsettings;page=advanced', "$FORM{'advanced'}", 'editbots',"$FORM{'editbots'}", 'newsettings;page=news',"$FORM{'news'}", 'smilies',"$FORM{'smilies'}", 'setcensor',"$FORM{'setcensor'}", 'modagreement',"$FORM{'modagreement'}", 'referer_control',"$FORM{'referer_control'}", 'newsettings;page=security',"$FORM{'security'}", 'setup_guardian',"$FORM{'setup_guardian'}", 'newsettings;page=antispam',"$FORM{'antispam'}", 'managecats',"$FORM{'managecats'}", 'manageboards',"$FORM{'manageboards'}", 'helpadmin',"$FORM{'helpadmin'}", 'editemailtemplates',"$FORM{'editemailtemplates'}", 'addmember',"$FORM{'addmember'}", 'viewmembers',"$FORM{'viewmembers'}", 'deletemultimembers',"$FORM{'deletemultimembers'}", 'modmemgr',"$FORM{'modmemgr'}", 'mailing',"$FORM{'mailing'}", 'ipban',"$FORM{'ipban'}", 'setreserve',"$FORM{'setreserve'}", 'modskin',"$FORM{'modskin'}", 'modcss',"$FORM{'modcss'}", 'modtemp',"$FORM{'modtemp'}", 'clean_log',"$FORM{'clean_log'}", 'boardrecount',"$FORM{'boardrecount'}", 'rebuildmesindex',"$FORM{'rebuildmesindex'}", 'rebuildmemlist',"$FORM{'rebuildmemlist'}", 'rebuildmemhist',"$FORM{'rebuildmemhist'}", 'rebuildnotifications',"$FORM{'rebuildnotifications'}", 'deleteoldthreads',"$FORM{'deleteoldthreads'}", 'manageattachments',"$FORM{'manageattachments'}", 'detailedversion',"$FORM{'detailedversion'}", 'stats',"$FORM{'stats'}", 'showclicks',"$FORM{'showclicks'}", 'errorlog',"$FORM{'errorlog'}", 'view_reglog',"$FORM{'view_reglog'}", 'modlist',"$FORM{'modlist'}", ); %gmod_access2 = ( admin => "$FORM{'allow_gmod_admin'}", newsettings => "$mynewsettings", newsettings2 => "$mynewsettings", eventcal_set => "$FORM{'eventcal_set'}", eventcal_set2 => "$FORM{'eventcal_set'}", eventcal_set3 => "$FORM{'eventcal_set'}", deleteattachment => "$FORM{'manageattachments'}", manageattachments2 => "$FORM{'manageattachments'}", removeoldattachments => "$FORM{'manageattachments'}", removebigattachments => "$FORM{'manageattachments'}", rebuildattach => "$FORM{'manageattachments'}", remghostattach => "$FORM{'manageattachments'}", profile => "$FORM{'allow_gmod_profile'}", profile2 => "$FORM{'allow_gmod_profile'}", profileAdmin => "$FORM{'allow_gmod_aprofile'}", profileAdmin2 => "$FORM{'allow_gmod_aprofile'}", profileContacts => "$FORM{'allow_gmod_profile'}", profileContacts2 => "$FORM{'allow_gmod_profile'}", profileIM => "$FORM{'allow_gmod_profile'}", profileIM2 => "$FORM{'allow_gmod_profile'}", profileOptions => "$FORM{'allow_gmod_profile'}", profileOptions2 => "$FORM{'allow_gmod_profile'}", ext_edit => "$FORM{'ext_admin'}", ext_edit2 => "$FORM{'ext_admin'}", ext_create => "$FORM{'ext_admin'}", ext_reorder => "$FORM{'ext_admin'}", ext_convert => "$FORM{'ext_admin'}", myprofileAdmin => "$FORM{'allow_gmod_aprofile'}", myprofileAdmin2 => "$FORM{'allow_gmod_aprofile'}", delgroup => "$FORM{'modmemgr'}", editgroup => "$FORM{'modmemgr'}", editAddGroup2 => "$FORM{'modmemgr'}", modmemgr2 => "$FORM{'modmemgr'}", assigned => "$FORM{'modmemgr'}", assigned2 => "$FORM{'modmemgr'}", reordercats => "$FORM{'managecats'}", reordercats2 => "$FORM{'managecats'}", modifycatorder => "$FORM{'managecats'}", modifycat => "$FORM{'managecats'}", createcat => "$FORM{'managecats'}", catscreen => "$FORM{'managecats'}", addcat => "$FORM{'managecats'}", addcat2 => "$FORM{'managecats'}", modskin => "$FORM{'modskin'}", modskin2 => "$FORM{'modskin'}", modcss => "$FORM{'modcss'}", modcss2 => "$FORM{'modcss'}", modstyle => "$FORM{'modcss'}", modstyle2 => "$FORM{'modcss'}", modtemplate2 => "$FORM{'modtemp'}", modtemp2 => "$FORM{'modtemp'}", modifyboard => "$FORM{'manageboards'}", addboard => "$FORM{'manageboards'}", addboard2 => "$FORM{'manageboards'}", reorderboards => "$FORM{'manageboards'}", reorderboards2 => "$FORM{'manageboards'}", boardscreen => "$FORM{'manageboards'}", smilieput => "$FORM{'smilies'}", smilieindex => "$FORM{'smilies'}", smiliemove => "$FORM{'smilies'}", addsmilies => "$FORM{'smilies'}", addmember => "$FORM{'addmember'}", addmember2 => "$FORM{'addmember'}", ml => "$FORM{'viewmembers'}", deletemultimembers => "$FORM{'deletemultimembers'}", mailmultimembers => "$FORM{'mailing'}", mailing2 => "$FORM{'mailing'}", activate => "$FORM{'view_reglog'}", admin_descision => "$FORM{'view_reglog'}", apr_regentry => "$FORM{'view_reglog'}", del_regentry => "$FORM{'view_reglog'}", rej_regentry => "$FORM{'view_reglog'}", view_regentry => "$FORM{'view_reglog'}", clean_reglog => "$FORM{'view_reglog'}", cleanerrorlog => "$FORM{'errorlog'}", deleteerror => "$FORM{'errorlog'}", modagreement2 => "$FORM{'modagreement'}", advsettings2 => "$FORM{'advsettings'}", referer_control2 => "$FORM{'referer_control'}", removeoldthreads => "$FORM{'deleteoldthreads'}", ipban2 => "$FORM{'ipban'}", ipban3 => "$FORM{'ipban'}", setcensor2 => "$FORM{'setcensor'}", setreserve2 => "$FORM{'setreserve'}", editbots2 => "$FORM{'editbots'}", ); 1; EOF $setfile =~ s~(.+\;)\s+(\#.+$)~$1 . substr( $filler, 0, (70-(length $1)) ) . $2 ~gem; $setfile =~ s~(.{64,}\;)\s+(\#.+$)~$1 . "\n " . $2~gem; $setfile =~ s~^\s\s\s+(\#.+$)~substr( $filler, 0, 70 ) . $1~gem; &write_DBorFILE(0,'',$vardir,'gmodsettings','txt',($setfile)); $yySetLocation = qq~$adminurl~; &redirectexit; } sub EditPaths { # Simple output of env variables, for troubleshooting if ($ENV{'SCRIPT_FILENAME'} ne "") { $support_env_path = $ENV{'SCRIPT_FILENAME'}; # replace \'s with /'s for Windows Servers $support_env_path =~ s~\\~/~g; # Remove Setupl.pl and cgi - and also nph- for buggy IIS. $support_env_path =~ s~(nph-)?AdminIndex.(pl|cgi)~~ig; } elsif ($ENV{'PATH_TRANSLATED'} ne "") { $support_env_path = $ENV{'PATH_TRANSLATED'}; # replace \'s with /'s for Windows Servers $support_env_path =~ s~\\~/~g; # Remove Setupl.pl and cgi - and also nph- for buggy IIS. $support_env_path =~ s~(nph-)?AdminIndex.(pl|cgi)~~ig; } $yymain .= qq~
$edit_paths_txt{'33'}
$edit_paths_txt{'34'}

$support_env_path



 $edit_paths_txt{'1'}
$edit_paths_txt{'2'}










 


$edit_paths_txt{'21'}
 


~; $yytitle = "$edit_paths_txt{'1'}"; $action_area = "editpaths"; &AdminTemplate; } sub EditPaths2 { &LoadCookie; # Load the user's cookie (or set to guest) &LoadUserSettings; if (!$iamadmin) { &fatal_error("no_access"); } $lastsaved = $FORM{'lastsaved'}; $lastdate = $FORM{'lastdate'}; $boardurl = $FORM{'boardurl'}; $boarddir = $FORM{'boarddir'}; $htmldir = $FORM{'htmldir'}; $uploaddir = $FORM{'uploaddir'}; $uploadurl = $FORM{'uploadurl'}; $yyhtml_root = $FORM{'yyhtml_root'}; $datadir = $FORM{'datadir'}; $boardsdir = $FORM{'boardsdir'}; $memberdir = $FORM{'memberdir'}; $sourcedir = $FORM{'sourcedir'}; $admindir = $FORM{'admindir'}; $vardir = $FORM{'vardir'}; $langdir = $FORM{'langdir'}; $helpfile = $FORM{'helpfile'}; $templatesdir = $FORM{'templatesdir'}; #$forumstylesdir = $FORM{'forumstylesdir'}; #$forumstylesurl = $FORM{'forumstylesurl'}; #$adminstylesdir = $FORM{'adminstylesdir'}; #$adminstylesurl = $FORM{'adminstylesurl'}; $facesdir = $FORM{'facesdir'}; $facesurl = $FORM{'facesurl'}; #$smiliesdir = $FORM{'smiliesdir'}; #$smiliesurl = $FORM{'smiliesurl'}; #$modimgdir = $FORM{'modimgdir'}; #$modimgurl = $FORM{'modimgurl'}; my $filler = q~ ~; my $setfile = << "EOF"; ############################################################################### # Paths.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. # ############################################################################### \$lastsaved = "$lastsaved"; \$lastdate = "$lastdate"; ########## Directories ########## \$boardurl = "$boardurl"; # URL of your board's folder (without trailing '/') \$boarddir = "$boarddir"; # The server path to the board's folder (usually can be left as '.') \$boardsdir = "$boardsdir"; # Directory with board data files \$datadir = "$datadir"; # Directory with messages \$memberdir = "$memberdir"; # Directory with member files \$sourcedir = "$sourcedir"; # Directory with YaBB source files \$admindir = "$admindir"; # Directory with YaBB admin source files \$vardir = "$vardir"; # Directory with variable files \$langdir = "$langdir"; # Directory with Language files and folders \$helpfile = "$helpfile"; # Directory with Help files and folders \$templatesdir = "$templatesdir"; # Directory with template files and folders \$htmldir = "$htmldir"; # Base Path for all public-html files and folders \$facesdir = "$facesdir"; # Base Path for all avatar files \$uploaddir = "$uploaddir"; # Base Path for all attachment files ########## URL's ########## \$yyhtml_root = "$yyhtml_root"; # Base URL for all html/css files and folders \$facesurl = "$facesurl"; # Base URL for all avatar files \$uploadurl = "$uploadurl"; # Base URL for all attachment files ########## Old Path Settings ########## ########## The following variables are deprecated! ########## ########## Don't use them for new code! ########## \$forumstylesdir = \$htmldir . "/Templates/Forum"; # Directory with forum style files and folders \$adminstylesdir = \$htmldir . "/Templates/Admin"; # Directory with admin style files and folders \$smiliesdir = \$htmldir . "/Smilies"; # Base Path for all smilie files \$modimgdir = \$htmldir . "/ModImages"; # Base Path for all mod images \$forumstylesurl = \$yyhtml_root . "/Templates/Forum"; # Default Forum Style Directory \$adminstylesurl = \$yyhtml_root . "/Templates/Admin"; # Default Admin Style Directory \$smiliesurl = \$yyhtml_root . "/Smilies"; # Base URL for all smilie files \$modimgurl = \$yyhtml_root . "/ModImages"; # Base URL for all mod images 1; EOF $setfile =~ s~(.+\;)\s+(\#.+$)~$1 . substr( $filler, 0, (70-(length $1)) ) . $2 ~gem; $setfile =~ s~(.{64,}\;)\s+(\#.+$)~$1 . "\n " . $2~gem; $setfile =~ s~^\s\s\s+(\#.+$)~substr( $filler, 0, 70 ) . $1~gem; &write_DBorFILE(0,'','./','Paths','pl',($setfile)); $yySetLocation = qq~$adminurl~; &redirectexit; } 1;