############################################################################### # ManageTemplates.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. # ############################################################################### $managetemplatesplver = 'YaBB 2.4 $Revision$'; if ($GLOBAL::ACTION eq 'detailedversion') { return 1; } &LoadLanguage('Templates'); sub ModifyTemplate { &is_admin_or_gmod; my ($fulltemplate, $line); if ($FORM{'templatefile'}) { $templatefile = $FORM{'templatefile'} } elsif ($INFO{'templatefile'}) { $templatefile = $INFO{'templatefile'} } else { $templatefile = "default/default.html"; } opendir(TMPLDIR, $templatesdir); @temptemplates = readdir(TMPLDIR); closedir(TMPLDIR); $templs = ""; foreach $file (@temptemplates) { if (-e "$templatesdir/$file/$file.html") { push(@templates, $file); } else { next; } } foreach $name (sort @templates) { $selected = ""; if (-e "$templatesdir/$name/$name.html") { $cmp_templatefile = "$name/$name.html"; if ($cmp_templatefile eq $templatefile) { $selected = qq~ selected="selected"~; } $templs .= qq~\n~; $selected = ""; } elsif (-e "$templatesdir/$name/$name.htm") { $cmp_templatefile = "$name/$name.htm"; if ($cmp_templatefile eq $templatefile) { $selected = qq~ selected="selected"~; } $templs .= qq~\n~; $selected = ""; } $cmp_boardfile = "$name/BoardIndex.template"; $cmp_messagefile = "$name/MessageIndex.template"; $cmp_displayfile = "$name/Display.template"; $cmp_helpfile = "$name/HelpCentre.template"; $cmp_mycenterfile = "$name/MyCenter.template"; if (-e "$templatesdir/$name/BoardIndex.template") { $ext = "BoardIndex"; if ($cmp_boardfile eq $templatefile) { $selected = qq~ selected="selected"~; } $templs .= qq~\n~; $selected = ""; } if (-e "$templatesdir/$name/MessageIndex.template") { $ext = "MessageIndex"; if ($cmp_messagefile eq $templatefile) { $selected = qq~ selected="selected"~; } $templs .= qq~\n~; $selected = ""; } if (-e "$templatesdir/$name/Display.template") { $ext = "Display"; if ($cmp_displayfile eq $templatefile) { $selected = qq~ selected="selected"~; } $templs .= qq~\n~; $selected = ""; } if (-e "$templatesdir/$name/HelpCentre.template") { $ext = "HelpCentre"; if ($cmp_helpfile eq $templatefile) { $selected = qq~ selected="selected"~; } $templs .= qq~\n~; $selected = ""; } if (-e "$templatesdir/$name/MyCenter.template") { $ext = "MyCenter"; if ($cmp_mycenterfile eq $templatefile) { $selected = qq~ selected="selected"~; } $templs .= qq~\n~; $selected = ""; } } foreach $line (&read_DBorFILE(0,'',$templatesdir,split(/\./, $templatefile))) { $line =~ s~[\r\n]~~g; $line =~ s~ ~ ~g; $line =~ s~&~&~g; &FromHTML($line); $fulltemplate .= qq~$line\n~; } $yymain .= qq~
$templ_txt{'52'} - $templatefile
~; $yytitle = "$admin_txt{'216'}"; $action_area = "modtemp"; &AdminTemplate; } sub ModifyTemplate2 { &is_admin_or_gmod; $FORM{'template'} =~ tr/\r//d; $FORM{'template'} =~ s~\A\n~~; $FORM{'template'} =~ s~\n\Z~~; if ($FORM{'filename'}) { $templatefile = $FORM{'filename'}; } else { $templatefile = "default.html"; } &write_DBorFILE(0,'',$templatesdir,split(/\./, $templatefile),("$FORM{'template'}\n")); $yySetLocation = qq~$adminurl?action=modtemp;templatefile=$templatefile~; &redirectexit; } sub ModifyStyle { &is_admin_or_gmod; my ($fullcss, $line, $csstype); $admincs = 0; if ($FORM{'cssfile'}) { $cssfile = $FORM{'cssfile'}; $csstype = qq~$forumstylesdir~; } elsif ($FORM{'admcssfile'}) { $cssfile = $FORM{'admcssfile'}; $csstype = qq~$adminstylesdir~; $admincs = 1; } else { $cssfile = "default.css"; $csstype = qq~$forumstylesdir~; } opendir(TMPLDIR, "$forumstylesdir"); @styles = readdir(TMPLDIR); closedir(TMPLDIR); $forumcss = qq~\n~; foreach $file (sort @styles) { ($name, $ext) = split(/\./, $file); $selected = ""; if ($ext eq 'css') { if ($file eq $cssfile && !$admincs) { $selected = qq~ selected="selected"~; } $forumcss .= qq~\n~; } } opendir(TMPLDIR, "$adminstylesdir"); @astyles = readdir(TMPLDIR); closedir(TMPLDIR); $admincss = qq~\n~; foreach $file (sort @astyles) { ($name, $ext) = split(/\./, $file); $selected = ""; if ($ext eq 'css') { if ($file eq $cssfile && $admincs) { $selected = qq~ selected="selected"~; } $admincss .= qq~\n~; } } foreach $line (&read_DBorFILE(0,'',$csstype,split(/\./, $cssfile))) { $line =~ s~[\r\n]~~g; $line =~ s~ ~ ~g; $line =~ s~&~&~g; &FromHTML($line); $fullcss .= qq~$line\n~; } $yymain .= qq~
$templ_txt{'51'} - $cssfile  
$templ_txt{'1'}




~; $yytitle = $templ_txt{'1'}; $action_area = "modcss"; &AdminTemplate; } sub ModifyStyle2 { &is_admin_or_gmod; $FORM{'css'} =~ tr/\r//d; $FORM{'css'} =~ s~\A\n~~; $FORM{'css'} =~ s~\n\Z~~; if ($FORM{'filename'}) { $cssfile = $FORM{'filename'}; } else { $cssfile = "default.css"; } if ($FORM{'type'}) { &write_DBorFILE(0,'',$adminstylesdir,split(/\./, $cssfile),("$FORM{'css'}\n")); } else { &write_DBorFILE(0,'',$forumstylesdir,split(/\./, $cssfile),("$FORM{'css'}\n")); } $yySetLocation = qq~$adminurl?action=modcss;cssfile=$cssfile~; &redirectexit; } sub ModifyCSS { &is_admin_or_gmod; if ($INFO{'templateset'}) { $thistemplate = $INFO{'templateset'}; } else { $thistemplate = "$template"; } while (($curtemplate, $value) = each(%templateset)) { if ($curtemplate eq $thistemplate) { $akttemplate = $curtemplate; } } ($aktstyle, $aktimages, $akthead, $aktboard, $aktmessage, $aktdisplay) = split(/\|/, $templateset{"$akttemplate"}); my ($fullcss, $line); if ($INFO{'cssfile'}) { $cssfile = $INFO{'cssfile'}; } else { $cssfile = "$aktstyle.css"; } $tempimages = qq~$forumstylesurl/$aktimages~; my $istabbed = 0; opendir(TMPLDIR, "$forumstylesdir"); @styles = readdir(TMPLDIR); closedir(TMPLDIR); $forumcss = ""; $imgdirs = ""; foreach $file (sort @styles) { ($name, $ext) = split(/\./, $file); $selected = ""; if ($ext eq 'css') { if ($file eq $cssfile) { $selected = qq~ selected="selected"~; $viewcss = $name; } $forumcss .= qq~\n~; } } $stylestr = ""; foreach $style_sgl (&read_DBorFILE(0,'',$forumstylesdir,split(/\./, $cssfile))) { $style_sgl =~ s/[\n\r]//g; $style_sgl =~ s/\A\s*//; $style_sgl =~ s/\s*\Z//; $style_sgl =~ s/\t//g; $style_sgl =~ s/\.\/default/$forumstylesurl\/default/g; $style_sgl =~ s/\.\/$viewcss/$forumstylesurl\/$viewcss/g; $style_sgl =~ s/\.\.\/\.\.\/Buttons/$yyhtml_root\/Buttons/g; $stylestr .= qq~$style_sgl ~; } $stylestr =~ s/\s{2,}/ /g; my ($selstyl, $selhidden, $postsstyle, $seperatorstyle, $bodycontainerstyle, $bodystyle, $containerstyle, $titlestyle, $titlestyle_a, $categorystyle, $categorystyle_a, $window1style, $window2style, $inputstyle, $textareastyle, $selectstyle, $quotestyle, $codestyle, $editbgstyle, $highlightstyle,$gen_fontsize); $gen_fontsize = qq~~; $gen_fontface = qq~~; $gen_borderweigth = qq~~; $gen_borderstyle = qq~~; if ($stylestr =~ /body/) { $bodystyle = $stylestr; $bodystyle =~ s/.*?(body\s*?\{.+?\}).*/$1/ig; $selstyl .= qq~\n~; } if ($stylestr =~ /\#container/) { $containerstyle = $stylestr; $containerstyle =~ s/.*?(\#container.*?\{.+?\}).*/$1/ig; $selstyl .= qq~\n~; } if ($stylestr =~ /\.tabmenu/) { $istabbed = 1; } if ($stylestr =~ /\.tabtitle/ && $istabbed) { $tabtitlestyle = $stylestr; $tabtitlestyle =~ s/.*?(\.tabtitle\s*?\{.+?\}).*/$1/ig; $tabtitlestyle = $tabtitlestyle; $selstyl .= qq~\n~; if ($stylestr =~ /\.tabtitle a/) { $tabtitlestyle_a = $stylestr; $tabtitlestyle_a =~ s/.*?(\.tabtitle a\s*?\{.+?\}).*/$1/ig; $selstyl .= qq~\n~; } } $buttonstyle = $stylestr; $buttonstyle =~ s/.*?(\.buttontext\s*?\{.+?\}).*/$1/ig; $selstyl .= qq~\n~; $prevtext = $buttonstyle; $prevtext =~ s/\.buttontext\s*?\{(.+?)\}/$1/ig; $drawtxtpos = $prevtext; $drawtxtpos =~ m/.*?top\s*?\:\s*?(\d{1,2})px.*/i; $viewtxty = $1; $viewtxty .= "px"; $drawpos4 = ($1 * 5) + 213; $drawpos4 .= "px"; $buttonleftstyle = $stylestr; $buttonleftstyle =~ s/.*?(\.buttonleft\s*?\{.+?\}).*/$1/ig; $buttonleftbg = qq~\n~; $buttonbg = $buttonleftstyle; $buttonbg =~ s~.*?($yyhtml_root/Buttons/)(.*?)\.(.*)~$2~g; $prevleft = $buttonleftstyle; $prevleft =~ s/\.buttonleft\s*?\{(.+?)\}/$1/ig; $buttonrightstyle = $stylestr; $buttonrightstyle =~ s/.*?(\.buttonright\s*?\{.+?\}).*/$1/ig; $buttonrightbg = qq~\n~; $prevright = $buttonrightstyle; $prevright =~ s/\.buttonright\s*?\{(.+?)\}/$1/ig; $buttonimagestyle = $stylestr; $buttonimagestyle =~ s/.*?(\.buttonimage\s*?\{.+?\}).*/$1/ig; $buttonimagebg = qq~\n~; $previmage = $buttonimagestyle; $previmage =~ s/\.buttonimage\s*?\{(.+?)\}/$1/ig; $drawimgpos = $previmage; $drawimgpos =~ m/.*?background\-position\s*?\:\s*?(\d{1,2})px\s*?(\d{1,2})px.*/i; $viewimgy = $2; $viewimgy .= "px"; $drawpos1 = ($2 * 5) + 213; $drawpos1 .= "px"; $viewimgx = $1; $viewimgx .= "px"; $drawpos2 = $1 + 213; $drawpos2 .= "px"; $drawimgwd = $previmage; $drawimgwd =~ m/.*?padding\s*?\:\s*?\d{1,2}px\s*?\d{1,2}px\s*?\d{1,2}px\s*?(\d{1,2})px.*/i; $viewimgpad = $1; $viewimgpad .= "px"; $drawpos3 = $1 + 213; $drawpos3 .= "px"; if ($stylestr =~ /\.seperator/) { $seperatorstyle = $stylestr; $seperatorstyle =~ s/.*?(\.seperator\s*?\{.+?\}).*/$1/ig; $selstyl .= qq~\n~; } if ($stylestr =~ /\.bordercolor/) { $bordercolorstyle = $stylestr; $bordercolorstyle =~ s/.*?(\.bordercolor\s*?\{.+?\}).*/$1/ig; $selstyl .= qq~\n~; } if ($stylestr =~ /\.hr/) { $hrstyle = $stylestr; $hrstyle =~ s/.*?(\.hr\s*?\{.+?\}).*/$1/ig; $selstyl .= qq~\n~; } if ($stylestr =~ /\.titlebg/) { $titlestyle = $stylestr; $titlestyle =~ s/.*?(\.titlebg\s*?\{.+?\}).*/$1/ig; $titlestyle = $titlestyle; $selstyl .= qq~\n~; if ($stylestr =~ /\.titlebg a/) { $titlestyle_a = $stylestr; $titlestyle_a =~ s/.*?(\.titlebg a\s*?\{.+?\}).*/$1/ig; $selstyl .= qq~\n~; } } if ($stylestr =~ /\.catbg/) { $categorystyle = $stylestr; $categorystyle =~ s/.*?(\.catbg\s*?\{.+?\}).*/$1/ig; $categorystyle = $categorystyle; $selstyl .= qq~\n~; if ($stylestr =~ /\.catbg a/) { $categorystyle_a = $stylestr; $categorystyle_a =~ s/.*?(\.catbg a\s*?\{.+?\}).*/$1/ig; $selstyl .= qq~\n~; } } if ($stylestr =~ /\.windowbg/) { $window1style = $stylestr; $window1style =~ s/.*?(\.windowbg\s*?\{.+?\}).*/$1/ig; $selstyl .= qq~\n~; } if ($stylestr =~ /\.windowbg2/) { $window2style = $stylestr; $window2style =~ s/.*?(\.windowbg2.*?\{.+?\}).*/$1/ig; $windowcol2 = $window2style; $windowcol2 =~ s/.*?(\#[a-f0-9]{3,6}).*/$1/i; $selstyl .= qq~\n~; } if ($stylestr =~ /\.message/) { $postsstyle = $stylestr; $postsstyle =~ s/.*?(\.message\s*?\{.+?\}).*/$1/ig; $selstyl .= qq~\n~; if ($stylestr =~ /\.message a/) { $postsstyle_a = $stylestr; $postsstyle_a =~ s/.*?(\.message a\s*?\{.+?\}).*/$1/ig; $selstyl .= qq~\n~; } } if ($stylestr =~ /input/) { $inputstyle = $stylestr; $inputstyle =~ s/.*?(input\s*?\{.+?\}).*/$1/ig; $selstyl .= qq~\n~; } if ($stylestr =~ /button/) { $buttonstyle = $stylestr; $buttonstyle =~ s/.*?(button\s*?\{.+?\}).*/$1/ig; $selstyl .= qq~\n~; } if ($stylestr =~ /textarea/) { $textareastyle = $stylestr; $textareastyle =~ s/.*?(textarea\s*?\{.+?\}).*/$1/ig; $selstyl .= qq~\n~; } if ($stylestr =~ /select/) { $selectstyle = $stylestr; $selectstyle =~ s/.*?(select\s*?\{.+?\}).*/$1/ig; $selstyl .= qq~\n~; } if ($stylestr =~ /.quote/) { $quotestyle = $stylestr; $quotestyle =~ s/.*?(\.quote\s*?\{.+?\}).*/$1/ig; $selstyl .= qq~\n~; $message = qq~\[quote\]$templ_txt{'53'}\[/quote\]~; if ($enable_ubbc) { if (!$yyYaBBCloaded) { require "$sourcedir/YaBBC.pl"; } &DoUBBC; } $aquote = $message; } if ($stylestr =~ /.code/) { $codestyle = $stylestr; $codestyle =~ s/.*?(\.code\s*?\{.+?\}).*/$1/ig; $selstyl .= qq~\n~; $message = qq~\[code\]$templ_txt{'54'}\[/code\]~; if ($enable_ubbc) { if (!$yyYaBBCloaded) { require "$sourcedir/YaBBC.pl"; } &DoUBBC; } $acode = $message; } if ($stylestr =~ /.editbg/) { $editbgstyle = $stylestr; $editbgstyle =~ s/.*?(\.editbg\s*?\{.+?\}).*/$1/ig; $selstyl .= qq~\n~; $message = qq~\[edit\]$templ_txt{'55'}\[/edit\]~; if ($enable_ubbc) { if (!$yyYaBBCloaded) { require "$sourcedir/YaBBC.pl"; } &DoUBBC; } $aedit = $message; } if ($stylestr =~ /.highlight/) { $highlightstyle = $stylestr; $highlightstyle =~ s/.*?(\.highlight\s*?\{.+?\}).*/$1/ig; $selstyl .= qq~\n~; $message = qq~\[highlight\]$templ_txt{'56'}\[/highlight\]~; if ($enable_ubbc) { if (!$yyYaBBCloaded) { require "$sourcedir/YaBBC.pl"; } &DoUBBC; } $ahighlight = $message; } if ($stylestr =~ /\.bodycontainer/) { $bodycontainerstyle = 1; } $yymain .= qq~
$templ_txt{'51'} - $viewcss  
~; $thisbutton = ""; opendir(DIR, "$htmldir/Buttons"); @contents = readdir(DIR); closedir(DIR); $optbuttons = ""; $x = 1; foreach $line (sort @contents){ ($name, $extension) = split (/\./, $line); ($tmpname, $tmpside) = split (/\_/, $name); $checked = ""; if ($name eq $buttonbg) { $checked = qq~ checked = "checked"~; } if (($extension =~ /gif/i || $extension =~ /png/i) && $tmpside eq "left") { $bleft = qq~_left.$extension~; $bright = qq~_right.$extension~; $thisbutton .= qq~
~; $thisbutton .= qq~
~; $thisbutton .= qq~
\n~; $x++; } } $yymain .= qq~ \n~; $viewstylestart = qq~Test Styles ~; $viewstyle = qq~
~; if ($containerstyle) { $viewstyle .= qq~
~; } if ($istabbed) { $tabsep = qq~~; $tabfill = qq~~; $tabtime = &timeformat($date, 1); $viewstyle .= qq~
$gen_fontface $gen_fontsize bold italic

$gen_borderstyle $gen_borderweigth
                       
$templ_txt{'buttontext'}
$templ_txt{'buttondescription'}

$img_txt{'103'}
$templ_txt{'moveicon1'}
$templ_txt{'moveicon2'}
$templ_txt{'iconspace'}
$templ_txt{'movetext'}
$thisbutton
$buttonleftbg $buttonrightbg $buttonimagebg
 
  $tabfill$img_txt{'103'}$tabfill $tabsep$tabfill$img_txt{'119'}$tabfill $tabsep$tabfill$img_txt{'182'}$tabfill $tabsep$tabfill$img_txt{'331'}$tabfill $tabsep$tabfill$img_txt{'mycenter'}$tabfill $tabsep$tabfill$img_txt{'108'}$tabfill $tabsep  

 
~; } if ($containerstyle) { $viewstyle .= qq~ $templ_txt{'64'}

~; } if ($bodycontainerstyle) { $viewstyle .= qq~
~; } if ($seperatorstyle) { $viewstyle .= qq~
~; } if ($istabbed) { $viewstyle .= qq~
  $templ_txt{'tabtitle'} $templ_txt{'tabtitlea'}

~; } $viewstyle .= qq~
$templ_txt{'30'} $templ_txt{'30a'}
~; if ($seperatorstyle) { $viewstyle .= qq~
~; } $viewstyle .= qq~
~; if ($seperatorstyle) { $viewstyle .= qq~
~; } $viewstyle .= qq~
$templ_txt{'31'} $templ_txt{'31a'}
~; $menusep = qq~~; $viewstyleleft = qq~style="height: 20px; border: 0px; margin: 1px 1px; background-position: top left; background-repeat: no-repeat; text-decoration: none; font-size: 18px; vertical-align: top; display: inline-block;"~; $viewstyleright = qq~style="height: 20px; border: 0px; margin: 0px; background-position: top right; background-repeat: no-repeat; text-decoration: none; font-size: 18px; vertical-align: top; display: inline-block;"~; $viewstyleimage = qq~height: 20px; border: 0px; margin: 0px; background-repeat: no-repeat; vertical-align: top; text-decoration: none; font-size: 18px; display: inline-block;~; $viewstyletext = qq~style="height: 20px; border: 0px; margin: 0px; padding: 0px; text-align: left; text-decoration: none; vertical-align: top; white-space: nowrap; display: inline-block;"~; $viewstyle .= qq~
$templ_txt{'buttontext'}
~; $viewstyle .= qq~
$templ_txt{'32'} $templ_txt{'33'}

$templ_txt{'65'}

   
  $aquote $acode $aedit
$ahighlight
~; if ($seperatorstyle) { $viewstyle .= qq~
~; } if ($bodycontainerstyle) { $viewstyle .= qq~
~; } if($istabbed) { $viewstyle .= qq~
~; } if ($containerstyle) { $viewstyle .= qq~
~; } $viewstyle .= qq~

~; $viewstylestart =~ s~[\n\r]~~g; &ToHTML($viewstylestart); $stylestr =~ s~[\n\r]~~g; &ToHTML($stylestr); $viewstyle =~ s~[\n\r]~~g; &ToHTML($viewstyle); if ($viewcss eq "default") { $savecss = ""; } else { $savecss = $viewcss; } $yymain .= qq~
~; $yytitle = $templ_txt{'1'}; $action_area = "modcss"; &AdminTemplate; } sub ModifyCSS2 { &is_admin_or_gmod; if ($FORM{'button'} == 1) { $yySetLocation = qq~$adminurl?action=modcss;cssfile=$FORM{'cssfile'}~; &redirectexit; } elsif ($FORM{'button'} == 2) { $style_name = $FORM{'savecssas'}; if ($style_name eq "default") { require "$admindir/Menudef.pl"; &SetMenu; #&fatal_error("no_delete_default"); } if ($style_name !~ m^\A[0-9a-zA-Z_\.\#\%\-\:\+\?\$\&\~\.\,\@/]+\Z^ || $style_name eq "") { &fatal_error("invalid_template"); } $style_cnt = $FORM{'stylelink'}; &FromHTML($style_cnt); $style_cnt =~ s~(\*\/)~$1\n~g; $style_cnt =~ s~(\{)~$1\n~g; $style_cnt =~ s~(\})~$1\n~g; $style_cnt =~ s~(\;)~$1\n~g; @style_arr = split(/\n/, $style_cnt); my @temp; foreach $style_sgl (@style_arr) { $style_sgl =~ s~\A\s+?~~g; if ($style_sgl =~ m~\;+\Z~) { $style_sgl = qq~\t$style_sgl~; } $style_sgl =~ s/$forumstylesurl/\./g; $style_sgl =~ s/$yyhtml_root/\.\.\/\.\./g; push(@temp, "$style_sgl\n"); } &write_DBorFILE(0,'',$forumstylesdir,$style_name,'css',@temp); $yySetLocation = qq~$adminurl?action=modcss;cssfile=$style_name.css~; &redirectexit; } elsif ($FORM{'button'} == 3) { $style_name = $FORM{'cssfile'}; if ($style_name eq "default.css") { &fatal_error("no_delete_default"); } &delete_DBorFILE("$forumstylesdir/$style_name"); $yySetLocation = qq~$adminurl?action=modcss;cssfile=default.css~; &redirectexit; } } sub ModifySkin { &is_admin_or_gmod; if ($INFO{'templateset'}) { $thistemplate = $INFO{'templateset'}; } else { $thistemplate = "$template"; } foreach my $curtemplate (sort{ $templateset{$a} cmp $templateset{$b} } keys %templateset) { $selected = ""; if ($curtemplate eq $thistemplate) { $selected = qq~ selected="selected"~; $akttemplate = $curtemplate; } $templatesel .= qq~\n~; } ($aktstyle, $aktimages, $akthead, $aktboard, $aktmessage, $aktdisplay, $aktmycenter, $aktmenutype) = split(/\|/, $templateset{$akttemplate}); $thisimagesdir = "$forumstylesurl/$aktimages"; my ($fullcss, $line); if ($INFO{'cssfile'}) { $cssfile = $INFO{'cssfile'}; } else { $cssfile = "$aktstyle.css"; } if ($INFO{'imgfolder'}) { $imgfolder = $INFO{'imgfolder'}; } else { $imgfolder = "$aktimages"; } if ($INFO{'headfile'}) { $headfile = $INFO{'headfile'}; } else { $headfile = "$akthead.html"; } if ($INFO{'boardfile'}) { $boardfile = $INFO{'boardfile'}; } else { $boardfile = "$aktboard/BoardIndex.template"; } if ($INFO{'messagefile'}) { $messagefile = $INFO{'messagefile'}; } else { $messagefile = "$aktmessage/MessageIndex.template"; } if ($INFO{'displayfile'}) { $displayfile = $INFO{'displayfile'}; } else { $displayfile = "$aktdisplay/Display.template"; } if ($INFO{'mycenterfile'}) { $mycenterfile = $INFO{'mycenterfile'}; } else { $mycenterfile = "$aktmycenter/MyCenter.template"; } if ($INFO{'menutype'} ne '') { $UseMenuType = $INFO{'menutype'}; } else { $UseMenuType = $MenuType; if ($aktmenutype ne '') { $UseMenuType = $aktmenutype; } } if ($INFO{'selsection'}) { $selectedsection = $INFO{'selsection'}; } else { $selectedsection = "vboard"; } my ($boardsel, $messagesel, $displaysel); if ($selectedsection eq "vboard") { $boardsel = qq~ checked="checked"~; } elsif ($selectedsection eq "vmessage") { $messagesel = qq~ checked="checked"~; } elsif ($selectedsection eq "vdisplay") { $displaysel = qq~ checked="checked"~; } else { $mycentersel = qq~ checked="checked"~; } opendir(TMPLDIR, "$forumstylesdir"); @styles = readdir(TMPLDIR); closedir(TMPLDIR); $forumcss = ""; $imgdirs = ""; foreach $file (sort @styles) { ($name, $ext) = split(/\./, $file); $selected = ""; if ($ext eq 'css') { if ($file eq $cssfile) { $selected = qq~ selected="selected"~; $viewcss = $name; } $forumcss .= qq~\n~; } if (-d "$forumstylesdir/$file" && $file =~ m^\A[0-9a-zA-Z_\#\%\-\:\+\?\$\&\~\,\@/]+\Z^) { if ($imgfolder eq $file) { $imgdirs .= qq~~; $viewimg = $file; } else { $imgdirs .= qq~~; } } } foreach $line (&read_DBorFILE(0,'',$forumstylesdir,split(/\./, $cssfile))) { $line =~ s~[\r\n]~~g; &FromHTML($line); $fullcss .= qq~$line\n~; } opendir(TMPLDIR, "$templatesdir"); @temptemplates = readdir(TMPLDIR); closedir(TMPLDIR); foreach $tmpfile (@temptemplates) { if (-d "$templatesdir/$tmpfile") { push(@templates, $tmpfile); } else { next; } } if ($UseMenuType == 0) { $menutype0 = ' selected="selected" '; } elsif ($UseMenuType == 1) { $menutype1 = ' selected="selected" '; } elsif ($UseMenuType == 2) { $menutype2 = ' selected="selected" '; } $fullcss =~ s/\s{2,}/ /g; require "$vardir/Menu$UseMenuType.def"; $boardtemplates = ""; $messagetemplates = ""; $displaytemplates = ""; $headtemplates = ""; foreach $name (sort @templates) { opendir(TMPLSDIR, "$templatesdir/$name"); @templatefiles = readdir(TMPLSDIR); closedir(TMPLSDIR); foreach $file (@templatefiles) { if ($file eq "index.html") { next; } $thefile = qq~$name/$file~; ($section, $ext) = split(/\./, $file); $hselected = ""; if ($ext eq 'html') { if ($file eq $headfile) { $hselected = qq~ selected="selected"~; $viewhead = $name; } $headtemplates .= qq~\n~; } $bselected = ""; $mselected = ""; $dselected = ""; $myselected = ""; if ($section eq 'BoardIndex') { if ($thefile eq $boardfile) { $bselected = qq~ selected="selected"~; $viewboard = $name; } $boardtemplates .= qq~\n~; } elsif ($section eq 'MessageIndex') { if ($thefile eq $messagefile) { $mselected = qq~ selected="selected"~; $viewmessage = $name; } $messagetemplates .= qq~\n~; } elsif ($section eq 'Display') { if ($thefile eq $displayfile) { $dselected = qq~ selected="selected"~; $viewdisplay = $name; } $displaytemplates .= qq~\n~; } elsif ($section eq 'MyCenter') { if ($thefile eq $mycenterfile) { $myselected = qq~ selected="selected"~; $viewmycenter = $name; } $mycentertemplates .= qq~\n~; } } } foreach $line (&read_DBorFILE(0,'',"$templatesdir/$viewhead",$viewhead,'html')) { $line =~ s~[\r\n]~~g; $fulltemplate .= qq~$line\n~; } $tabsep = qq~~; $tabfill = qq~~; $tempforumurl = $mbname; $temptitle = qq~Template Config~; $tempnewstitle = qq~$templ_txt{'68'}: ~; $tempnews = qq~$templ_txt{'84'}~; $tempstyles = qq~~; $tempimages = qq~$forumstylesurl/$viewimg~; $tempimagesdir = qq~$forumstylesdir/$viewimg~; $tempmenu = qq~$tabfill$img_txt{'103'}$tabfill~; $tempmenu .= qq~$tabsep$tabfill$img_txt{'119'}$tabfill~; $tempmenu .= qq~$tabsep$tabfill$img_txt{'331'}$tabfill~; $tempmenu .= qq~$tabsep$tabfill$img_txt{'mycenter'}$tabfill~; $tempmenu .= qq~$tabsep$tabfill$img_txt{'108'}$tabfill$tabsep~; $tempmenu =~ s~img src\=\"$imagesdir\/(.+?)\"~&TmpImgLoc($1, $tempimages, $tempimagesdir)~eisg; $temp21menu = qq~$img{'home'}$menusep$img{'help'}$menusep$img{'search'}$menusep$img{'memberlist'}$menusep$img{'profile'}$menusep$img{'notification'}$menusep$img{'logout'}~; $temp21menu =~ s~img src\=\"$imagesdir\/(.+?)\"~&TmpImgLoc($1, $tempimages, $tempimagesdir)~eisg; $rssbutton = qq~~; $tempuname = qq~$templ_txt{'69'} ${$uid.$username}{'realname'}, ~; $tempuim = qq~$templ_txt{'70'} 0 $templ_txt{'71'}.~; $temptime = &timeformat($date, 1); my $tempsearchbox = qq~~; $tempsearchbox .= qq~~; $tempforumjump = &jumpto(1); $fulltemplate =~ s/({|<)yabb charset(}|>)/$yycharset/g; $fulltemplate =~ s/({|<)yabb title(}|>)/$temptitle/g; $fulltemplate =~ s/({|<)yabb style(}|>)/$tempstyles/g; $fulltemplate =~ s/({|<)yabb images(}|>)/$tempimages/g; $fulltemplate =~ s/({|<)yabb uname(}|>)/$tempuname/g; $fulltemplate =~ s/({|<)yabb boardlink(}|>)/$tempforumurl/g; $fulltemplate =~ s/({|<)yabb navigation(}|>)//g; $fulltemplate =~ s/({|<)yabb searchbox(}|>)/$tempsearchbox/g; $fulltemplate =~ s/({|<)yabb im(}|>)/$tempuim/g; $fulltemplate =~ s/({|<)yabb time(}|>)/$temptime/g; $fulltemplate =~ s/({|<)yabb langChooser(}|>)//g; $fulltemplate =~ s/({|<)yabb menu(}|>)/$temp21menu/g; $fulltemplate =~ s/({|<)yabb tabmenu(}|>)/$tempmenu/g; $fulltemplate =~ s/({|<)yabb rss(}|>)/$rssbutton/g; $fulltemplate =~ s/({|<)yabb news(}|>)/$tempnews/g; $fulltemplate =~ s/({|<)yabb newstitle(}|>)/$tempnewstitle/g; $fulltemplate =~ s/({|<)yabb copyright(}|>)//g; $fulltemplate =~ s/({|<)yabb debug(}|>)//g; $fulltemplate =~ s/({|<)yabb forumjump(}|>)/$tempforumjump/g; $fulltemplate =~ s/({|<)yabb freespace(}|>)//g; $fulltemplate =~ s/({|<)yabb navback(}|>)//g; $fulltemplate =~ s/({|<)yabb admin_alert(}|>)//g; $fulltemplate =~ s/({|<)yabb tabadd(}|>)//g; $fulltemplate =~ s/({|<)yabb addtab(}|>)//g; if ($selectedsection eq "vboard") { $boardtempl = &BoardTempl($viewboard, $tempimages, $tempimagesdir); $fulltemplate =~ s/({|<)yabb main(}|>)/$boardtempl/g; } elsif ($selectedsection eq "vmessage") { $messagetempl = &MessageTempl($viewmessage, $tempimages, $tempimagesdir); $fulltemplate =~ s/({|<)yabb main(}|>)/$messagetempl/g; } elsif ($selectedsection eq "vdisplay") { $displaytempl = &DisplayTempl($viewdisplay, $tempimages, $tempimagesdir); $fulltemplate =~ s/({|<)yabb main(}|>)/$displaytempl/g; } elsif ($selectedsection eq "vmycenter") { $mycentertempl = &MyCenterTempl($viewmycenter, $tempimages, $tempimagesdir); $fulltemplate =~ s/({|<)yabb main(}|>)/$mycentertempl/g; } $fulltemplate =~ s~img src\=\"$tempimages\/(.+?)\"~&TmpImgLoc($1, $tempimages, $tempimagesdir)~eisg; $fulltemplate =~ s/.+?<\/a>//g; $fulltemplate =~ s/.+?<\/a>//g; $fulltemplate =~ s~[\n\r]~~g; &ToHTML($fulltemplate); $yymain .= qq~
$templ_txt{'6'}
~; unless ($akttemplate eq "Forum default") { $yymain .= qq~ ~; } $yymain .= qq~
$templ_txt{'11'}
$templ_txt{'7'}











~; $yytitle = $templ_txt{'6'}; $action_area = "modskin"; &AdminTemplate; } sub ModifySkin2 { &is_admin_or_gmod; $formattemp = $FORM{'templateset'}; &formatTempname; if ($FORM{'button'} == 1) { $yySetLocation = qq~$adminurl?action=modskin;templateset=$formattemp;cssfile=$FORM{'cssfile'};imgfolder=$FORM{'imgfolder'};headfile=$FORM{'headfile'};boardfile=$FORM{'boardfile'};messagefile=$FORM{'messagefile'};displayfile=$FORM{'displayfile'};mycenterfile=$FORM{'mycenterfile'};menutype=$FORM{'menutype'};selsection=$FORM{'selsection'}~; } elsif ($FORM{'button'} == 2) { $template_name = $FORM{'saveas'}; if ($template_name eq "default") { &fatal_error("no_delete_default"); } if ($template_name !~ m^\A[0-9a-zA-Z_\ \.\#\%\-\:\+\?\$\&\~\.\,\@/]+\Z^ || $template_name eq "") { &fatal_error("invalid_template"); } ($template_css, undef, undef) = split(/\./, $FORM{'cssfile'}); $template_images = $FORM{'imgfolder'}; ($template_head, undef) = split(/\./, $FORM{'headfile'}); ($template_board, undef) = split(/\//, $FORM{'boardfile'}); ($template_message, undef) = split(/\//, $FORM{'messagefile'}); ($template_display, undef) = split(/\//, $FORM{'displayfile'}); ($template_mycenter, undef) = split(/\//, $FORM{'mycenterfile'}); ($template_menutype, undef) = split(/\//, $FORM{'menutype'}); $formattemp = $FORM{'saveas'}; &formatTempname; &UpdateTemplates($template_name, "save"); $yySetLocation = qq~$adminurl?action=modskin;templateset=$formattemp;cssfile=$FORM{'cssfile'};imgfolder=$FORM{'imgfolder'};headfile=$FORM{'headfile'};boardfile=$FORM{'boardfile'};messagefile=$FORM{'messagefile'};displayfile=$FORM{'displayfile'};mycenterfile=$FORM{'mycenterfile'};menutype=$FORM{'menutype'};selsection=$FORM{'selsection'}~; } elsif ($FORM{'button'} == 3) { $template_name = $FORM{'templateset'}; if ($template_name eq "default") { &fatal_error("no_delete_default"); } if ($template_name eq "Forum default") { &fatal_error("no_delete_default"); } &UpdateTemplates($template_name, "delete"); $yySetLocation = qq~$adminurl?action=modskin~; } else { $yySetLocation = qq~$adminurl?action=modskin;templateset=$formattemp~; } &redirectexit; } sub formatTempname { $formattemp =~ s~\%~%25~g; $formattemp =~ s~\#~%23~g; $formattemp =~ s~\+~%2B~g; $formattemp =~ s~\,~%2C~g; $formattemp =~ s~\-~%2D~g; $formattemp =~ s~\.~%2E~g; $formattemp =~ s~\@~%40~g; $formattemp =~ s~\^~%5E~g; } sub TmpImgLoc { if (!&checkfor_DBorFILE("$_[2]/$_[0]")) { $thisimgloc = qq~img src="$forumstylesurl/default/$_[0]"~; } else { $thisimgloc = qq~img src="$_[1]/$_[0]"~; } $thisimgloc; } sub BoardTempl { &LoadLanguage('BoardIndex'); my $tmpimagesdir = $imagesdir; $imagesdir = qq~$_[1]~; require "$templatesdir/$_[0]/BoardIndex.template"; if (&checkfor_DBorFILE("$vardir/mostlog.txt")) { @mostentries = &read_DBorFILE(0,'',$vardir,'mostlog','txt'); ($mostmemb, $datememb) = split(/\|/, $mostentries[0]); ($mostguest, $dateguest) = split(/\|/, $mostentries[1]); ($mostusers, $dateusers) = split(/\|/, $mostentries[2]); ($mostbots, $datebots) = split(/\|/, $mostentries[3]); chomp($datememb, $dateguest, $dateusers, $datebots); $themostmembdate = &timeformat($datememb); $themostguestdate = &timeformat($dateguest); $themostuserdate = &timeformat($dateusers); $themostbotsdate = &timeformat($datebots); $themostuser = $mostusers; $themostmemb = $mostmemb; $themostguest = $mostguest; $themostbots = $mostbots; } else { $themostmembdate = &timeformat($date); $themostguestdate = &timeformat($date); $themostuserdate = &timeformat($date); $themostbotsdate = &timeformat($date); $themostuser = 23; $themostmemb = 12; $themostguest = 19; $themostbots = 4; } $grpcolors = ""; ($title, undef, undef, $color, $noshow) = split(/\|/, $Group{'Administrator'}, 5); my $admcolor = qq~$color~; if ($color && $noshow != 1) { $grpcolors .= qq~
lllll $title
~; } ($title, undef, undef, $color, $noshow) = split(/\|/, $Group{'Global Moderator'}, 5); if ($color && $noshow != 1) { $grpcolors .= qq~
lllll $title
~; } foreach $nopostamount (sort { $a <=> $b } keys %NoPost) { ($title, undef, undef, $color, $noshow) = split(/\|/, $NoPost{$nopostamount}, 5); if ($color && $noshow != 1) { $grpcolors .= qq~
lllll $title
~; } } foreach $postamount (sort { $b <=> $a } keys %Post) { ($title, undef, undef, $color, $noshow) = split(/\|/, $Post{$postamount}, 5); if ($color && $noshow != 1) { $grpcolors .= qq~
lllll $title
~; } } my $latestmemberlink = qq~$boardindex_txt{'201'}
${$uid.$username}{'realname'}.
~; my $tempims = qq~$boardindex_txt{'795'} 2 $boardindex_txt{'796'} $boardindex_imtxt{'24'} 2 $boardindex_imtxt{'26'}.~; my $tempforumurl = $mbname; my $tempnew = qq~~; my $tempcurboard = $templ_txt{'77'}; my $tempcurboardurl = qq~javascript:;~; my $tempboardanchor = $templ_txt{'78'}; my $tempbddescr = $templ_txt{'79'}; my $tempshowmods = qq~$boardindex_txt{'63'}: $templ_txt{'74'}
$boardindex_txt{'63a'}: $templ_txt{'74a'}~; my $templastposttme = &timeformat($date); my $templastpostlink = qq~$img{'lastpost'} $templastposttme~; my $templastposter = qq~${$uid.$username}{'realname'}~; my $tmplasttopiclink = qq~$templ_txt{'80'}~; $tempcatlink = qq~ $templ_txt{'81'}~; my $templatecat = $catheader; $templatecat =~ s/({|<)yabb catlink(}|>)/$tempcatlink/g; my $tmptemplateblock = $templatecat; my $templastpostdate = &timeformat($date); $templastpostdate = qq~($templastpostdate).
~; my $temprecentposts = qq~$boardindex_txt{'791'} $boardindex_txt{'792'} $boardindex_txt{'793'}~; my $tempguestson = qq~$boardindex_txt{'141'}: 2~; my $tempbotson = qq~$boardindex_txt{'143'}: 3~; my $tempbotlist = qq~Googlebot (1), MSN Search (2)~; my $tempuserson = qq~$boardindex_txt{'142'}: 1~; my $tempusers = qq~${$uid.$username}{'realname'}
~; my $tempmembercount = qq~2~; my $tempboardpic = qq~ $tempcurboard~; for ($i = 1; $i < 3; $i++) { my $templateblock = $boardblock; $templateblock =~ s/({|<)yabb new(}|>)/$tempnew/g; $templateblock =~ s/({|<)yabb boardanchor(}|>)/$tempboardanchor/g; $templateblock =~ s/({|<)yabb boardurl(}|>)/$tempcurboardurl/g; $templateblock =~ s/({|<)yabb boardpic(}|>)/$tempboardpic/g; $templateblock =~ s/({|<)yabb boardname(}|>)/$tempcurboard $i/g; $templateblock =~ s/({|<)yabb boarddesc(}|>)/$tempbddescr/g; $templateblock =~ s/({|<)yabb moderators(}|>)/$tempshowmods/g; $templateblock =~ s/({|<)yabb threadcount(}|>)/$i/g; $templateblock =~ s/({|<)yabb messagecount(}|>)/$i/g; $templateblock =~ s/({|<)yabb lastpostlink(}|>)/$templastpostlink/g; $templateblock =~ s/({|<)yabb lastposter(}|>)/$templastposter/g; $templateblock =~ s/({|<)yabb lasttopiclink(}|>)/$tmplasttopiclink/g; $tmptemplateblock .= $templateblock; } $tmptemplateblock .= $catfooter; $boardindex_template =~ s/({|<)yabb pollshowcase(}|>)//; $boardindex_template =~ s/({|<)yabb catsblock(}|>)/$tmptemplateblock/g; $collapselink = qq~$menusep$img{'collapse'}~; $expandlink = qq~$menusep$img{'expand'}~; $markalllink = qq~$menusep$img{'markallread'}~; my $templasttopiclink = qq~$boardindex_txt{'236'} $templ_txt{'80'}~; $boardhandellist =~ s/({|<)yabb collapse(}|>)/$collapselink/g; $boardhandellist =~ s/({|<)yabb expand(}|>)//g; $boardhandellist =~ s/({|<)yabb markallread(}|>)/$markalllink/g; $boardhandellist =~ s/\Q$menusep//i; $boardindex_template =~ s/({|<)yabb boardhandellist(}|>)/$boardhandellist/g; $boardindex_template =~ s/({|<)yabb catimage(}|>)//g; $boardindex_template =~ s~img src\=\"$tmpimagesdir\/(.+?)\"~&TmpImgLoc($1, $_[1], $_[2])~eisg; $boardindex_template =~ s/({|<)yabb newmsg start(}|>)//g; $boardindex_template =~ s/({|<)yabb newmsg icon(}|>)//g; $boardindex_template =~ s/({|<)yabb newmsg(}|>)//g; $boardindex_template =~ s/({|<)yabb newmsg end(}|>)//g; $boardindex_template =~ s/({|<)yabb totaltopics(}|>)/3/g; $boardindex_template =~ s/({|<)yabb totalmessages(}|>)/3/g; $boardindex_template =~ s/({|<)yabb lastpostlink(}|>)/$templasttopiclink/g; $boardindex_template =~ s/({|<)yabb lastpostdate(}|>)/$templastpostdate/g; $boardindex_template =~ s/({|<)yabb recentposts(}|>)/$temprecentposts/g; $boardindex_template =~ s/({|<)yabb mostusers(}|>)/$themostuser/g; $boardindex_template =~ s/({|<)yabb mostmembers(}|>)/$themostmemb/g; $boardindex_template =~ s/({|<)yabb mostguests(}|>)/$themostguest/g; $boardindex_template =~ s/({|<)yabb mostbots(}|>)/$themostbots/g; $boardindex_template =~ s/({|<)yabb mostusersdate(}|>)/$themostuserdate/g; $boardindex_template =~ s/({|<)yabb mostmembersdate(}|>)/$themostmembdate/g; $boardindex_template =~ s/({|<)yabb mostguestsdate(}|>)/$themostguestdate/g; $boardindex_template =~ s/({|<)yabb mostbotsdate(}|>)/$themostbotsdate/g; $boardindex_template =~ s/({|<)yabb groupcolors(}|>)/$grpcolors/g; $boardindex_template =~ s/({|<)yabb membercount(}|>)/$tempmembercount/g; $boardindex_template =~ s/({|<)yabb latestmember(}|>)/$latestmemberlink/g; $boardindex_template =~ s/({|<)yabb ims(}|>)/$tempims/g; $boardindex_template =~ s/({|<)yabb users(}|>)/$tempuserson/g; $boardindex_template =~ s/({|<)yabb onlineusers(}|>)/$tempusers/g; $boardindex_template =~ s/({|<)yabb guests(}|>)/$tempguestson/g; $boardindex_template =~ s/({|<)yabb onlineguests(}|>)//g; $boardindex_template =~ s/({|<)yabb bots(}|>)/$tempbotson/g; $boardindex_template =~ s/({|<)yabb onlinebots(}|>)/$tempbotlist/g; $boardindex_template =~ s/({|<)yabb caldisplay(}|>)/$cal_display/g; $boardindex_template =~ s/({|<)yabb sharedlogin(}|>)//g; $boardindex_template =~ s/({|<)yabb selecthtml(}|>)//g; $boardindex_template =~ s~img src\=\"$_[1]\/(.+?)\"~&TmpImgLoc($1, $_[1], $_[2])~eisg; $imagesdir = $tmpimagesdir; $boardindex_template; } sub MessageTempl { &LoadLanguage('MessageIndex'); my $tmpimagesdir = $imagesdir; $imagesdir = "$_[1]"; require "$templatesdir/$_[0]/MessageIndex.template"; my $tempcatnm = $templ_txt{'72'}; my $tempboardnm = $templ_txt{'73'}; my $tempmodslink = qq~($messageindex_txt{'298'}: $templ_txt{'74'} - $messageindex_txt{'298a'}: $templ_txt{'74a'})~; my $tempbdescrip = $templ_txt{'79'}; my $temppageindextgl = qq~~; my $temppageindex = qq~ $messageindex_txt{'139'}: 1~; my $tempthreadpic = qq~~; my $tempmicon = qq~~; my $tempnew = qq~~; my $tempmsublink = $templ_txt{'83'}; my $tempmname = ${$uid.$username}{'realname'}; my $templastpostlink = qq~ $templ_txt{'82'}~; my $templastposter = $tempmname; my $tempyabbicons = qq~ $messageindex_txt{'457'}
$messageindex_txt{'454'} x $messageindex_txt{'454a'}
$messageindex_txt{'455'} x $messageindex_txt{'454a'}
$messageindex_txt{'456'}
$messageindex_txt{'845'} ~; my $tempyabbadminicons .= qq~ $messageindex_txt{'458'}
$messageindex_txt{'459'}
$messageindex_txt{'460'}
$messageindex_txt{'461'}
$messageindex_txt{'779a'}
$messageindex_txt{'779b'}
$messageindex_txt{'779'}
$messageindex_txt{'780'} ~; $notify_board = qq~$menusep$img{'notify'}~; $markalllink = qq~$menusep$img{'markboardread'}~; $postlink = qq~$menusep$img{'newthread'}~; $polllink = qq~$menusep$img{'createpoll'}~; $bdpic = qq~ $templ_txt{'72'} ~; $message_permalink = $messageindex_txt{'10'}; $temp_attachment = qq~$messageindex_txt{'5'}~; $messageindex_template =~ s/({|<)yabb home(}|>)/$mbname/g; $messageindex_template =~ s/({|<)yabb category(}|>)/$tempcatnm/g; $messageindex_template =~ s/({|<)yabb board(}|>)/$tempboardnm/g; $messageindex_template =~ s/({|<)yabb moderators(}|>)/$tempmodslink/g; $messageindex_template =~ s/({|<)yabb sortsubject(}|>)/$sort_subject/g; $messageindex_template =~ s/({|<)yabb sortstarter(}|>)/$sort_starter/g; $messageindex_template =~ s/({|<)yabb sortanswer(}|>)/$sort_answer/g; $messageindex_template =~ s/({|<)yabb sortlastpostim(}|>)/$sort_lastpostim/g; $messageindex_template =~ s/({|<)yabb bdpicture(}|>)/$bdpic/g; $messageindex_template =~ s/({|<)yabb threadcount(}|>)/1/g; $messageindex_template =~ s/({|<)yabb messagecount(}|>)/2/g; $boarddescription =~ s/({|<)yabb boarddescription(}|>)/$tempbdescrip/g; $messageindex_template =~ s/({|<)yabb description(}|>)/$boarddescription/g; $messageindex_template =~ s/({|<)yabb colspan(}|>)/7/g; $messageindex_template =~ s/({|<)yabb pageindex top(}|>)/$temppageindex1/g; $messageindex_template =~ s/({|<)yabb pageindex bottom(}|>)/$temppageindex1/g; $topichandellist =~ s/({|<)yabb notify button(}|>)/$notify_board/g; $topichandellist =~ s/({|<)yabb markall button(}|>)/$markalllink/g; $topichandellist =~ s/({|<)yabb new post button(}|>)/$postlink/g; $topichandellist =~ s/({|<)yabb new poll button(}|>)/$polllink/g; $topichandellist =~ s/\Q$menusep//i; $messageindex_template =~ s/({|<)yabb topichandellist(}|>)/$topichandellist/g; $messageindex_template =~ s/({|<)yabb pageindex(}|>)/$temppageindex/g; $messageindex_template =~ s/({|<)yabb pageindex toggle(}|>)/$temppageindextgl/g; $messageindex_template =~ s/({|<)yabb admin column(}|>)//g; my $tempbar = $threadbar; $tempbar =~ s/({|<)yabb admin column(}|>)//g; $tempbar =~ s/({|<)yabb threadpic(}|>)/$tempthreadpic/g; $tempbar =~ s/({|<)yabb icon(}|>)/$tempmicon/g; $tempbar =~ s/({|<)yabb new(}|>)/$tempnew/g; $tempbar =~ s/({|<)yabb poll(}|>)//g; $tempbar =~ s/({|<)yabb favorite(}|>)//g; $tempbar =~ s/({|<)yabb subjectlink(}|>)/$tempmsublink/g; $tempbar =~ s/({|<)yabb pages(}|>)//g; $tempbar =~ s/({|<)yabb attachmenticon(}|>)/$temp_attachment/g; $tempbar =~ s/({|<)yabb starter(}|>)/$tempmname/g; $tempbar =~ s/({|<)yabb replies(}|>)/2/g; $tempbar =~ s/({|<)yabb views(}|>)/12/g; $tempbar =~ s/({|<)yabb lastpostlink(}|>)/$templastpostlink/g; $tempbar =~ s/({|<)yabb lastposter(}|>)/$templastposter/g; if ($accept_permalink == 1) { $tempbar =~ s/({|<)yabb permalink(}|>)/$message_permalink/g; } else { $tempbar =~ s/({|<)yabb permalink(}|>)//g; } $tmptempbar .= $tempbar; $messageindex_template =~ s/({|<)yabb threadblock(}|>)/$tmptempbar/g; $messageindex_template =~ s/({|<)yabb modupdate(}|>)//g; $messageindex_template =~ s/({|<)yabb modupdateend(}|>)//g; $messageindex_template =~ s/({|<)yabb stickyblock(}|>)//g; $messageindex_template =~ s/({|<)yabb adminfooter(}|>)//g; $messageindex_template =~ s/({|<)yabb icons(}|>)/$tempyabbicons/g; $messageindex_template =~ s/({|<)yabb admin icons(}|>)/$tempyabbadminicons/g; $messageindex_template =~ s/({|<)yabb access(}|>)//g; $messageindex_template =~ s~img src\=\"$tmpimagesdir\/(.+?)\"~&TmpImgLoc($1, $_[1], $_[2])~eisg; $messageindex_template =~ s~img src\=\"$_[1]\/(.+?)\"~&TmpImgLoc($1, $_[1], $_[2])~eisg; $imagesdir = $tmpimagesdir; $messageindex_template; } sub DisplayTempl { &LoadLanguage('Display'); my $tmpimagesdir = $imagesdir; $imagesdir = $_[1]; require "$templatesdir/$_[0]/Display.template"; ($title, $stars, $starpic, $color, $noshow, $viewperms, $topicperms, $replyperms, $pollperms, $attachperms) = split(/\|/, $Group{"Administrator"}); my $template_home = qq~$mbname~; my $tempcatnm = $templ_txt{'72'}; my $tempboardnm = $templ_txt{'73'}; my $tempmodslink = qq~($display_txt{'298'}: $templ_txt{'74'} - $display_txt{'298a'}: $templ_txt{'74a'})~; my $template_prev = $display_txt{'768'}; my $template_next = $display_txt{'767'}; my $temppageindextgl = qq~~; my $temppageindex1 = qq~ $display_txt{'139'}: 1~; my $replybutton = qq~$menusep$img{'reply'}~; my $pollbutton = qq~$menusep$img{'addpoll'}~; my $notify = qq~$menusep$img{'notify'}~; my $template_sendtopic = qq~$menusep$img{'sendtopic'}~; my $template_print = qq~$menusep$img{'print'}~; my $template_threadimage = qq~~; my $threadurl = $templ_txt{'75'}; my $template_alertmod = qq~$menusep$img{'alertmod'}~; my $template_quote = qq~$menusep$img{'quote'}~; my $template_modify = qq~$menusep$img{'modify'}~; my $template_split = qq~$menusep$img{'admin_split'}~; my $template_delete = qq~$menusep$img{'delete'}~; my $memberinfo = qq~$title~; my $usernamelink = qq~${$uid.$username}{'realname'}
~; for (1 .. 5) { $star .= qq(*); } my $msub = $templ_txt{'76'}; my $msgimg = qq~~; my $messdate = &timeformat($date); my $template_postinfo = qq~$display_txt{'21'}: ${$uid.$username}{'postcount'}
~; my $template_usertext = qq~${$uid.$username}{'usertext'}
~; my $avatar = qq~~; my $message = qq~$templ_txt{'65'}
$templ_txt{'66'}~; my $template_email = qq~$menusep$img{'email_sm'}~; my $template_pm = qq~$menusep$img{'message_sm'}~; my $ipimg = qq~~; my $template_remove = qq~$menusep$img{'admin_rem'}~; my $template_splice = qq~$menusep$img{'admin_move_split_splice'}~; my $template_lock = qq~$menusep$img{'admin_lock'}~; my $template_hide = qq~$menusep$img{'hide'}~; my $template_sticky = qq~$menusep$img{'admin_sticky'}~; $online = qq~$maintxt{'60'}~; for ($i = 0; $i < 2; $i++) { my $outblock = $messageblock; my $posthandelblock = $posthandellist; my $contactblock = $contactlist; if ($i == 0) { $css = qq~windowbg~; $counterwords = ""; } else { $css = qq~windowbg2~; $counterwords = "$display_txt{'146'} #$i"; } $posthandelblock =~ s/({|<)yabb modalert(}|>)/$template_alertmod/g; $posthandelblock =~ s/({|<)yabb quote(}|>)/$template_quote/g; $posthandelblock =~ s/({|<)yabb modify(}|>)/$template_modify/g; $posthandelblock =~ s/({|<)yabb split(}|>)/$template_split/g; $posthandelblock =~ s/({|<)yabb delete(}|>)/$template_delete/g; $posthandelblock =~ s/({|<)yabb admin(}|>)/$template_admin/g; $posthandelblock =~ s/\Q$menusep//i; $contactblock =~ s/({|<)yabb email(}|>)/$template_email/g; $contactblock =~ s/({|<)yabb profile(}|>)//g; $contactblock =~ s/({|<)yabb pm(}|>)/$template_pm/g; $contactblock =~ s/({|<)yabb www(}|>)//g; $contactblock =~ s/({|<)yabb aim(}|>)/$menusep$img{'aim'}/g; $contactblock =~ s/({|<)yabb yim(}|>)/$menusep$img{'yim'}/g; $contactblock =~ s/({|<)yabb icq(}|>)//g; $contactblock =~ s/({|<)yabb msn(}|>)/$menusep$img{'msn'}/g; $contactblock =~ s/({|<)yabb gtalk(}|>)//g; $contactblock =~ s/({|<)yabb skype(}|>)//g; $contactblock =~ s/({|<)yabb myspace(}|>)/$myspacead/g; $contactblock =~ s/({|<)yabb facebook(}|>)/$facebookad/g; $contactblock =~ s/({|<)yabb addbuddy(}|>)//g; $contactblock =~ s/\Q$menusep//i; $outblock =~ s/({|<)yabb images(}|>)/$tmpimagesdir/g; $outblock =~ s/({|<)yabb messageoptions(}|>)//g; $outblock =~ s/({|<)yabb memberinfo(}|>)/$memberinfo/g; $outblock =~ s/({|<)yabb userlink(}|>)/$usernamelink/g; $outblock =~ s/({|<)yabb stars(}|>)/$star/g; $outblock =~ s/({|<)yabb subject(}|>)/$msub/g; $outblock =~ s/({|<)yabb msgimg(}|>)/$msgimg/g; $outblock =~ s/({|<)yabb msgdate(}|>)/$messdate/g; $outblock =~ s/({|<)yabb replycount(}|>)/$counterwords/g; $outblock =~ s/({|<)yabb count(}|>)//g; $outblock =~ s/({|<)yabb att(}|>)//g; $outblock =~ s/({|<)yabb css(}|>)/$css/g; $outblock =~ s/({|<)yabb gender(}|>)//g; $outblock =~ s/({|<)yabb ext_prof(}|>)/$template_ext_prof/g; $outblock =~ s/({|<)yabb location(}|>)//g; $outblock =~ s/({|<)yabb isbuddy(}|>)//g; $outblock =~ s/({|<)yabb useronline(}|>)/$online/g; $outblock =~ s/({|<)yabb postinfo(}|>)/$template_postinfo/g; $outblock =~ s/({|<)yabb usertext(}|>)/$template_usertext/g; $outblock =~ s/({|<)yabb userpic(}|>)/$avatar/g; $outblock =~ s/({|<)yabb message(}|>)/$message/g; $outblock =~ s/({|<)yabb showatt(}|>)//g; $outblock =~ s/({|<)yabb showatthr(}|>)//g; $outblock =~ s/({|<)yabb modified(}|>)//g; $outblock =~ s/({|<)yabb signature(}|>)//g; $outblock =~ s/({|<)yabb signaturehr(}|>)//g; $outblock =~ s/({|<)yabb ipimg(}|>)/$ipimg/g; $outblock =~ s/({|<)yabb ip(}|>)//g; $outblock =~ s/({|<)yabb permalink(}|>)//g; $outblock =~ s/({|<)yabb posthandellist(}|>)/$posthandelblock/g; $outblock =~ s/({|<)yabb contactlist(}|>)/$contactblock/g; $tempoutblock .= $outblock; } $threadhandellist =~ s/({|<)yabb reply(}|>)/$replybutton/g; $threadhandellist =~ s/({|<)yabb poll(}|>)/$template_poll/g; $threadhandellist =~ s/({|<)yabb notify(}|>)/$template_notify/g; $threadhandellist =~ s/({|<)yabb favorite(}|>)/$template_favorite/g; $threadhandellist =~ s/({|<)yabb sendtopic(}|>)/$template_sendtopic/g; $threadhandellist =~ s/({|<)yabb print(}|>)/$template_print/g; $threadhandellist =~ s/({|<)yabb markunread(}|>)//g; $threadhandellist =~ s/\Q$menusep//i; $adminhandellist =~ s/({|<)yabb remove(}|>)/$template_remove/g; $adminhandellist =~ s/({|<)yabb splice(}|>)/$template_splice/g; $adminhandellist =~ s/({|<)yabb lock(}|>)/$template_lock/g; $adminhandellist =~ s/({|<)yabb hide(}|>)/$template_hide/g; $adminhandellist =~ s/({|<)yabb sticky(}|>)/$template_sticky/g; $adminhandellist =~ s/({|<)yabb multidelete(}|>)/$template_multidelete/g; $adminhandellist =~ s/\Q$menusep//i; $display_template =~ s/({|<)yabb pollmain(}|>)//g; $display_template =~ s/({|<)yabb topicviewers(}|>)//g; $display_template =~ s/({|<)yabb home(}|>)/$template_home/g; $display_template =~ s/({|<)yabb category(}|>)/$tempcatnm/g; $display_template =~ s/({|<)yabb board(}|>)/$tempboardnm/g; $display_template =~ s/({|<)yabb moderators(}|>)/$tempmodslink/g; $display_template =~ s/({|<)yabb prev(}|>)/$template_prev/g; $display_template =~ s/({|<)yabb next(}|>)/$template_next/g; $display_template =~ s/({|<)yabb pageindex toggle(}|>)/$temppageindextgl/g; $display_template =~ s/({|<)yabb pageindex top(}|>)/$temppageindex1/g; $display_template =~ s/({|<)yabb pageindex bottom(}|>)/$temppageindex1/g; $display_template =~ s/({|<)yabb threadhandellist(}|>)/$threadhandellist/g; $display_template =~ s/({|<)yabb threadimage(}|>)/$template_threadimage/g; $display_template =~ s/({|<)yabb threadurl(}|>)/$threadurl/g; $display_template =~ s/({|<)yabb views(}|>)/12/g; $display_template =~ s/({|<)yabb multistart(}|>)//g; $display_template =~ s/({|<)yabb multiend(}|>)//g; $display_template =~ s/({|<)yabb postsblock(}|>)/$tempoutblock/g; $display_template =~ s/({|<)yabb adminhandellist(}|>)/$adminhandellist/g; $display_template =~ s/({|<)yabb forumselect(}|>)//g; $display_template =~ s~img src\=\"$tmpimagesdir\/(.+?)\"~&TmpImgLoc($1, $_[1], $_[2])~eisg; $display_template =~ s~img src\=\"$_[1]\/(.+?)\"~&TmpImgLoc($1, $_[1], $_[2])~eisg; $imagesdir = $tmpimagesdir; $display_template; } sub MyCenterTempl { &LoadLanguage('InstantMessage'); &LoadLanguage('MyCenter'); my $tmpimagesdir = $imagesdir; $imagesdir = $_[1]; require "$templatesdir/$_[0]/MyCenter.template"; $tabsep = qq~~; $tabfill = qq~~; if ($PM_level == 1 || ($PM_level == 2 && $staff) || ($PM_level == 3 && ($iamadmin || $iamgmod))) { $yymcmenu .= qq~$tabsep$tabfill$mc_menus{'messages'}$tabfill ~; } $yymcmenu .= qq~$tabsep$tabfill$mc_menus{'profile'}$tabfill~; $yymcmenu .= qq~$tabsep$tabfill$mc_menus{'posts'}$tabfill~; $yymcmenu .= qq~$tabsep~; $mycenter_template =~ s/{yabb mcviewmenu}/$MCViewMenu/g; $mycenter_template =~ s/{yabb mcmenu}/$yymcmenu/g; $mycenter_template =~ s/{yabb mcpmmenu}/$MCPmMenu/g; $mycenter_template =~ s/{yabb mcprofmenu}/$MCProfMenu/g; $mycenter_template =~ s/{yabb mcpostsmenu}/$MCPostsMenu/g; $mycenter_template =~ s/{yabb mcglobformstart}/$MCGlobalFormStart/g; $mycenter_template =~ s/{yabb mcglobformend}/ ($MCGlobalFormStart ? "<\/form>" : "") /e; $mycenter_template =~ s/{yabb mcextrasmilies}/$MCExtraSmilies/g; $mycenter_template =~ s/{yabb mccontent}/$MCContent/g; $mycenter_template =~ s/{yabb mctitle}/$mctitle/g; $mycenter_template =~ s/{yabb selecthtml}/$selecthtml/g; $mycenter_template =~ s~img src\=\"$tmpimagesdir\/(.+?)\"~&TmpImgLoc($1, $_[1], $_[2])~eisg; $mycenter_template =~ s~img src\=\"$_[1]\/(.+?)\"~&TmpImgLoc($1, $_[1], $_[2])~eisg; $imagesdir = $tmpimagesdir; $mycenter_template; } sub UpdateTemplates { my ($tempelement, $tempjob) = @_; if ($tempjob eq "new") { # update to new style from very old versions require "$templatesdir/$tempelement/$tempelement.cfg"; if ($template_name !~ m^\A[0-9a-zA-Z_\´\ \.\#\%\-\:\+\?\$\&\~\.\,\@/]+\Z^ || $template_name eq "") { $template_name = "Invalid template_name in $tempelement.cfg"; } my $testname = $template_name; my $i = 1; while (my ($curtemplate, $value) = each(%templateset)) { if (lc $curtemplate eq lc $testname) { $testname = qq~$template_name ($i)~; $i++; } } if ($template_css) { $templateset{"$testname"} = "$tempelement"; } else { $templateset{"$testname"} = "default"; } if ($template_images) { $templateset{"$testname"} .= "|$tempelement"; } else { $templateset{"$testname"} .= "|default"; } if ($template_head) { $templateset{"$testname"} .= "|$tempelement"; } else { $templateset{"$testname"} .= "|default"; } if ($template_board) { $templateset{"$testname"} .= "|$tempelement"; } else { $templateset{"$testname"} .= "|default"; } if ($template_message) { $templateset{"$testname"} .= "|$tempelement"; } else { $templateset{"$testname"} .= "|default"; } if ($template_display) { $templateset{"$testname"} .= "|$tempelement"; } else { $templateset{"$testname"} .= "|default"; } if ($template_mycenter) { $templateset{"$testname"} .= "|$tempelement"; } else { $templateset{"$testname"} .= "|default"; } if ($template_menutype) { $templateset{"$testname"} .= "|$tempelement"; } else { $templateset{"$testname"} .= "|"; } &delete_DBorFILE("$templatesdir/$tempelement/$tempelement.cfg"); return; } elsif ($tempjob eq "save") { $templateset{"$tempelement"} = "$template_css"; $templateset{"$tempelement"} .= "|$template_images"; $templateset{"$tempelement"} .= "|$template_head"; $templateset{"$tempelement"} .= "|$template_board"; $templateset{"$tempelement"} .= "|$template_message"; $templateset{"$tempelement"} .= "|$template_display"; $templateset{"$tempelement"} .= "|$template_mycenter"; $templateset{"$tempelement"} .= "|$template_menutype"; } elsif ($tempjob eq "delete") { delete $templateset{$tempelement}; } require "$admindir/NewSettings.pl"; &SaveSettingsTo('Settings.pl'); } 1;