############################################################################### # 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
|
|
|
|
$templ_txt{'1'}
|
~;
$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'}
|
~;
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'}
$templ_txt{'81'}~;
my $templatecat = $catheader;
$templatecat =~ s/({|<)yabb catlink(}|>)/$tempcatlink/g;
my $tmptemplateblock = $templatecat;
my $templastpostdate = &timeformat($date);
$templastpostdate = qq~($templastpostdate).
~;
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~
~;
$message_permalink = $messageindex_txt{'10'};
$temp_attachment = qq~
~;
$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~~;
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'}
~;
my $messdate = &timeformat($date);
my $template_postinfo = qq~$display_txt{'21'}: ${$uid.$username}{'postcount'}
~;
my $message = qq~$templ_txt{'65'}
~;
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;