###############################################################################
# Settings_Advanced.pm #
# $Date: 01 Sep 2026 $ #
###############################################################################
# YaBB: Yet another Bulletin Board #
# Open-Source Community Software for Webmasters #
# Version: YaBBForum 3.2 #
# Packaged: 01 Sep 2026 #
# Distributed by: https://yabbforum.nz #
# =========================================================================== #
# Copyright (c) 2000-2026 YaBB (yabbforum.nz) - All Rights Reserved. #
# Software by: The YaBB Development Team #
# with assistance from the YaBB community. #
###############################################################################
use CGI::Carp qw(fatalsToBrowser);
use English '-no_match_vars';
our $VERSION = '3.2';
$settings_advancedpmver = 'YaBBForum 3.2';
if ( $action eq 'detailedversion' ) { return 1; }
my $uploaddiriscorrect = qq~$admin_txt{'164'}~;
if ( -w $uploaddir && -d $uploaddir ) {
$uploaddiriscorrect =
qq~$admin_txt{'163'}~;
}
my $pmUploadDirIsCorrect = qq~$admin_txt{'164'}~;
if ( -w $pmuploaddir && -d $pmuploaddir ) {
$pmUploadDirIsCorrect =
qq~$admin_txt{'163'}~;
}
require Admin::ManageBoards;
# Needed for attachment settings
# Setting for gzip, if it is available
my $compressgzip =
( -e "$backupprogbin/gzip" && open GZIP, '| gzip -f' )
? qq~\n ~
: q{};
# Setting for Compress::Zlib, if it's available
my $compresszlib;
eval { require Compress::Zlib; Compress::Zlib::memGzip('test'); };
if ( !$@ ) {
$compresszlib =
qq~\n ~;
}
# RSS Defaults
if ( $rss_disabled eq q{} ) { $rss_disabled = 0; }
if ( $rss_limit eq q{} ) { $rss_limit = 10; }
if ( $rss_message eq q{} ) { $rss_message = 1; }
# Who is Where Defaults
if ($Show_OnlineBar eq q{}) {
$Show_OnlineBar = 1;
if ( $Show_DirectMessage eq q{} ) { $Show_DirectMessage = 1; }
if ( $Allow_Hide_Directmessage eq q{} ) { $Allow_Hide_Directmessage = 1; }
if ( $Show_WhosOn eq q{} ) { $Show_WhosOn = 1; }
if ( $adminwho eq q{} ) { $adminwho = 1; }
if ( $whotime eq q{} ) { $whotime = 60; }
## figure out if print whoson tab to AdvancedTabs ##
$whoiswheretabif = 0;
foreach(@AdvancedTabs) {
if( $_ =~ /^whoson/ ) { $whoiswheretabif = 1; }
}
if ( $whoiswheretabif == 0 ) {
push(@AdvancedTabs, "whoson");
require "$admindir/NewSettings.pm";
SaveSettingsTo('Settings.pm', %settings);
$yySetLocation = qq~$adminurl?action=newsettings;page=advanced~;
redirectexit();
}
}
if ( ischecked2($checkspace) == 1) {
$checklabel = qq~$admin_txt{'checkspace'} Disk Space Functions $admin_txt{'checkspace2'}~;
}
else { $checklabel = qq~$admin_txt{'checkspace'}~ ;
}
# List of settings
@settings = (
{
name => $settings_txt{'permarss'},
id => 'permarss',
items => [
# Permalinks
{ header => $admin_txt{'24'}, },
{
description =>
qq~~,
input_html =>
qq~~,
name => 'accept_permalink',
validate => 'boolean',
},
{
description =>
qq~~,
input_html =>
qq~~,
name => 'symlink',
validate => 'text,null',
depends_on => ['accept_permalink'],
},
{
description =>
qq~~,
input_html =>
qq~~,
name => 'perm_domain',
validate => 'text,null',
depends_on => ['accept_permalink'],
},
# RSS
{ header => $settings_txt{'rss'}, },
{
description =>
qq~~,
input_html =>
qq~~,
name => 'rss_disabled',
validate => 'boolean',
},
{
description => qq~~,
input_html =>
qq~~,
name => 'rss_limit',
validate => 'number',
depends_on => ['!rss_disabled'],
},
{
description =>
qq~~,
input_html =>
qq~~,
name => 'showauthor',
validate => 'boolean',
depends_on => ['!rss_disabled'],
},
{
description =>
qq~~,
input_html =>
qq~~,
name => 'rssemail',
validate => 'text,null',
depends_on => ['showauthor'],
},
{
description => qq~~,
input_html =>
qq~~,
name => 'showdate',
validate => 'boolean',
depends_on => ['!rss_disabled'],
},
{
description =>
qq~~,
input_html => qq~
~,
name => 'rss_message',
validate => 'number',
depends_on => ['!rss_disabled'],
},
],
},
{
name => $settings_txt{'email'},
id => 'email',
items => [
# Email
{ header => $settings_txt{'email'}, },
{
description =>
qq~~,
input_html => qq~
~,
name => 'mailtype',
validate => 'number',
},
{
description =>
qq~~,
input_html =>
qq~~,
name => 'mailprog',
validate => 'text,null',
},
{
description =>
qq~~,
input_html =>
qq~~,
name => 'smtp_server',
validate => 'text,null',
},
{
description =>
qq~~,
input_html => qq~
~,
name => 'smtp_auth_required',
validate => 'number',
},
{
description => qq~~,
input_html =>
qq~~,
name => 'authuser',
validate => 'text,null',
},
{
description => qq~~,
input_html =>
qq~~,
name => 'authpass',
validate => 'text,null',
},
{
description =>
qq~~,
input_html =>
qq~~,
name => 'webmaster_email',
validate => 'text',
},
{
description =>
qq~~,
input_html =>
qq~~,
},
# New Member Notification
{ header => $admin_txt{'366'}, },
{
description =>
qq~~,
input_html =>
qq~~,
name => 'new_member_notification',
validate => 'boolean',
},
{
description =>
qq~~,
input_html =>
qq~~,
name => 'new_member_notification_mail',
validate => 'text,null',
depends_on => ['new_member_notification']
},
# New Member Notification
{ header => $admin_txt{'600'}, },
{
description =>
qq~~,
input_html =>
qq~~,
name => 'sendtopicmail',
validate => 'number',
},
],
},
{
name => $settings_txt{'attachments'},
id => 'attachments',
items => [
{ header => $settings_txt{'post_attachments'}, },
{
description =>
qq~$edit_paths_txt{'20'}
$settings_txt{'changeinpaths'}~,
input_html => $uploaddir, # Non-changable setting
},
{
description => $settings_txt{'uploaddircorrect'},
input_html => $uploaddiriscorrect
, # This is tested to see if it's valid at the top of the file.
},
{
description => $fatxt{'17'},
input_html =>
qq~ ~,
name => 'allowattach',
validate => 'number',
},
{
description =>
qq~~,
input_html =>
qq~~,
name => 'allowguestattach',
validate => 'boolean',
depends_on => ['allowattach!=0'],
},
{
description =>
qq~~,
input_html =>
qq~~,
name => 'amdisplaypics',
validate => 'boolean',
depends_on => ['allowattach!=0'],
},
{
description => qq~~,
input_html =>
qq~~,
name => 'checkext',
validate => 'boolean',
depends_on => ['allowattach!=0'],
},
{
description => qq~~,
input_html =>
q~~,
name => 'extensions',
validate => 'text',
depends_on => [ 'allowattach!=0', 'checkext' ],
},
{
description => qq~~,
input_html =>
qq~ KB~,
name => 'limit',
validate => 'number',
depends_on => ['allowattach!=0'],
},
{
description => qq~~,
input_html =>
qq~ KB~,
name => 'dirlimit',
validate => 'number',
depends_on => ['allowattach!=0'],
},
{
description => qq~~,
input_html => qq~
~,
name => 'overwrite',
validate => 'number',
depends_on => ['allowattach!=0'],
},
{ header => $settings_txt{'pm_attachments'}, },
{
description =>
qq~$edit_paths_txt{'20a'}
$settings_txt{'changeinpaths'}~,
input_html => $pmuploaddir, # Non-changable setting
},
{
description => $settings_txt{'pmuploaddircorrect'},
input_html => $pmUploadDirIsCorrect
, # This is tested to see if it's valid at the top of the file.
},
{
description => qq~~,
input_html =>
qq~ ~,
name => 'allowAttachIM',
validate => 'number',
},
{
description => qq~~,
input_html => q~~,
name => 'pmAttachGroups',
validate => 'text,null',
depends_on => ['allowAttachIM!=0'],
},
{
description =>
qq~~,
input_html =>
qq~~,
name => 'pmDisplayPics',
validate => 'boolean',
depends_on => ['allowAttachIM!=0'],
},
{
description => qq~~,
input_html =>
qq~~,
name => 'pmCheckExt',
validate => 'boolean',
depends_on => ['allowAttachIM!=0'],
},
{
description => qq~~,
input_html =>
q~~,
name => 'pmAttachExt',
validate => 'text',
depends_on => [ 'allowAttachIM!=0', 'pmCheckExt' ],
},
{
description => qq~~,
input_html =>
qq~ KB~,
name => 'pmFileLimit',
validate => 'number',
depends_on => ['allowAttachIM!=0'],
},
{
description => qq~~,
input_html =>
qq~ KB~,
name => 'pmDirLimit',
validate => 'number',
depends_on => ['allowAttachIM!=0'],
},
{
description => qq~~,
input_html => qq~
~,
name => 'pmFileOverwrite',
validate => 'number',
depends_on => ['allowAttachIM!=0'],
},
],
},
{
name => $settings_txt{'images'},
id => 'images',
items => [
{ header => $admin_txt{'471'}, },
{
description =>
qq~~,
input_html =>
qq~ pixel~,
name => 'max_avatar_width',
validate => 'number',
},
{
description =>
qq~~,
input_html =>
qq~ pixel~,
name => 'max_avatar_height',
validate => 'number',
},
{
description =>
qq~~,
input_html =>
qq~~,
name => 'fix_avatar_img_size',
validate => 'boolean',
},
{
description => qq~~,
input_html => qq~ pixel~,
name => 'max_avatarml_width',
validate => 'number',
},
{
description => qq~~,
input_html => qq~ pixel~,
name => 'max_avatarml_height',
validate => 'number',
},
{
description => qq~~,
input_html => qq~~,
name => 'fix_avatarml_img_size',
validate => 'boolean',
},
{
description =>
qq~~,
input_html =>
qq~ pixel~,
name => 'max_post_img_width',
validate => 'number',
},
{
description =>
qq~~,
input_html =>
qq~ pixel~,
name => 'max_post_img_height',
validate => 'number',
},
{
description =>
qq~~,
input_html =>
qq~~,
name => 'fix_post_img_size',
validate => 'boolean',
},
{
description =>
qq~~,
input_html =>
qq~ pixel~,
name => 'max_signat_img_width',
validate => 'number',
},
{
description =>
qq~~,
input_html =>
qq~ pixel~,
name => 'max_signat_img_height',
validate => 'number',
},
{
description =>
qq~~,
input_html =>
qq~~,
name => 'fix_signat_img_size',
validate => 'boolean',
},
{
description =>
qq~~,
input_html =>
qq~ pixel~,
name => 'max_attach_img_width',
validate => 'number',
},
{
description =>
qq~~,
input_html =>
qq~ pixel~,
name => 'max_attach_img_height',
validate => 'number',
},
{
description =>
qq~~,
input_html =>
qq~~,
name => 'fix_attach_img_size',
validate => 'boolean',
},
{
description =>
qq~~,
input_html =>
qq~ pixel~,
name => 'max_brd_img_width',
validate => 'number',
},
{
description =>
qq~~,
input_html =>
qq~ pixel~,
name => 'max_brd_img_height',
validate => 'number',
},
{
description =>
qq~~,
input_html =>
qq~~,
name => 'fix_brd_img_size',
validate => 'boolean',
},
{
description =>
qq~~,
input_html => qq~
~,
name => 'img_greybox',
validate => 'number',
},
]
},
{
name => $settings_txt{'advanced'},
id => 'advanced',
items => [
# Who is Where < #
{
header => $whosetting{'1'},
},
{
description =>
qq~~,
input_html =>
qq~~,
name => 'Show_OnlineBar',
validate => 'number',
},
{
description => qq~~,
input_html => q~~,
name => 'onlopt',
validate => 'text,null',
depends_on => ['$Show_OnlineBar==2'],
},
{
description =>
qq~~,
input_html =>
qq~~,
name => 'Show_DirectMessage',
validate => 'boolean',
},
{
description =>
qq~~,
input_html =>
qq~~,
name => 'Allow_Hide_Directmessage',
validate => 'boolean',
},
{
description =>
qq~~,
input_html =>
qq~~,
name => 'Show_WhosOn',
validate => 'boolean',
},
{
description =>
qq~~,
input_html =>
qq~~,
name => 'adminwho',
validate => 'boolean',
},
{
description =>
qq~~,
input_html =>
qq~~,
name => 'whotime',
validate => 'number',
},
# Who is Where > #
{ header => $settop_txt{'5'}, },
{
description => qq~~,
input_html => qq~
~,
name => 'gzcomp',
validate => 'number',
},
{
description => qq~~,
input_html =>
qq~~,
name => 'gzforce',
validate => 'boolean',
depends_on => ['gzcomp!=0'],
},
{
description =>
qq~~,
input_html =>
qq~~,
name => 'cachebehaviour',
validate => 'boolean',
},
{
description =>
qq~~,
input_html =>
qq~~,
name => 'enableclicklog',
validate => 'boolean',
},
{
description =>
qq~~,
input_html =>
qq~~,
name => 'ClickLogTime',
validate => 'number',
depends_on => ['enableclicklog'],
},
{
description =>
qq~~,
input_html =>
qq~~,
name => 'max_log_days_old',
validate => 'number',
},
{
description =>
qq~~,
input_html =>
qq~~,
name => 'maxrecentdisplay',
validate => 'fullnumber',
},
{
description =>
qq~~,
input_html =>
qq~~,
name => 'maxrecentdisplay_t',
validate => 'fullnumber',
},
{
description =>
qq~~,
input_html =>
qq~~,
name => 'maxsearchdisplay',
validate => 'fullnumber',
},
{
description =>
qq~~,
input_html =>
qq~~,
name => 'OnlineLogTime',
validate => 'number',
},
{
description =>
qq~~,
input_html =>
qq~~,
name => 'lastonlineinlink',
validate => 'boolean',
},
{ header => $errorlog{'25'}, },
{
description =>
qq~~,
input_html =>
qq~~,
name => 'elenable',
validate => 'boolean',
},
{
description =>
qq~~,
input_html =>
qq~~,
name => 'elrotate',
validate => 'boolean',
depends_on => ['elenable'],
},
{
description => qq~~,
input_html =>
qq~~,
name => 'elmax',
validate => 'number',
depends_on => [ 'elenable', 'elrotate' ],
},
{ header => $settings_txt{'debug'}, },
{
description =>
qq~~,
input_html => qq~
~,
name => 'debug',
validate => 'number',
},
{ header => $settings_txt{'files'}, },
{
description =>
qq~~,
input_html => qq~
~,
name => 'use_flock',
validate => 'boolean',
},
{
description =>
qq~~,
input_html =>
qq~~,
name => 'faketruncation',
validate => 'boolean',
},
{ header => $settings_txt{'freedisk2'}, },
{
description =>
qq~~,
input_html =>
qq~~,
name => 'checkspace',
validate => 'boolean',
},
],
},
);
# Routine to save them
sub SaveSettings {
my %settings = @_;
$settings{'extensions'} =~ s/[^\ A-Za-z0-9_]//gsm;
@ext = split /\s+/xsm, $settings{'extensions'};
$settings{'pmAttachExt'} =~ s/[^\ A-Za-z0-9_]//gsm;
@pmAttachExt = split /\s+/xsm, $settings{'pmAttachExt'};
SaveSettingsTo('Settings.pm', %settings);
return;
}
sub ischecked2 {
my ($inp) = @_;
# Return a ref so we can be used like ${ischecked($var)} inside a string
if ($inp == 1 ) { return 1 ;}
return;
}
1;