| ############################################################################### |
| ############################################################################### |
| # AdvancedTabs.pl # |
| # AdvancedTabs.pm # |
| |
| # $Date: 01.05.16 $ # |
| ############################################################################### |
| ############################################################################### |
| # YaBB: Yet another Bulletin Board # |
| # YaBB: Yet another Bulletin Board # |
| # Open-Source Community Software for Webmasters # |
| # Open-Source Community Software for Webmasters # |
| # Version: YaBB 2.5.2 # |
| # Version: YaBB 2.6.12 # |
| # Packaged: October 21, 2012 # |
| # Packaged: January 5, 2016 # |
| # Distributed by: http://www.yabbforum.com # |
| # Distributed by: http://www.yabbforum.com # |
| # =========================================================================== # |
| # =========================================================================== # |
| # Copyright (c) 2000-2012 YaBB (www.yabbforum.com) - All Rights Reserved. # |
| # Copyright (c) 2000-2016 YaBB (www.yabbforum.com) - All Rights Reserved. # |
| # Software by: The YaBB Development Team # |
| # Software by: The YaBB Development Team # |
| # with assistance from the YaBB community. # |
| # with assistance from the YaBB community. # |
| ############################################################################### |
| ############################################################################### |
| |
| # use strict; |
| |
| # use warnings; |
| |
| no warnings qw(uninitialized once redefine); |
| |
| use CGI::Carp qw(fatalsToBrowser); |
| |
| our $VERSION = '2.6.12'; |
| |
| |
| $advancedtabsplver = 'YaBB 2.5.2 $Revision: 1.0 $'; |
| $advancedtabspmver = 'YaBB 2.6.12 $Revision: 1710 $'; |
| if ($action eq 'detailedversion') { return 1; } |
| if ( $action eq 'detailedversion' ) { return 1; } |
| |
| |
| sub AddNewTab { |
| sub AddNewTab { |
| &GetTexttab; |
| GetTexttab(); |
| |
| |
| $edittabs = qq~<option value="thefront">$tabmenu_txt{'tabfront'}</option>~; |
| $edittabs = qq~<option value="thefront">$tabmenu_txt{'tabfront'}</option>~; |
| foreach (@AdvancedTabs) { |
| foreach (@AdvancedTabs) { |
| $_ =~ /^([^\|]+)/; |
| $_ =~ /^([^\|]+)/xsm; |
| if ($texttab{$1}) { $edittabs .= qq~<option value="$1">$texttab{$1}</option>~; } |
| if ( $texttab{$1} ) { |
| } |
| $edittabs .= qq~<option value="$1">$texttab{$1}</option>~; |
| |
| } |
| $yyaddtab = qq~ |
| } |
| <br /> |
| |
| |
| $yyaddtab = qq~ |
| <script language="JavaScript1.2" type="text/javascript"> |
| <br /> |
| <!-- |
| <script type="text/javascript"> |
| function submittab() { |
| function submittab() { |
| if (window.submitted) return false; |
| if (window.submitted) return false; |
| window.submitted = true; |
| window.submitted = true; |
| return true; |
| return true; |
| } |
| } |
| |
| |
| function checkTab(theForm) { |
| function checkTab(theForm) { |
| var isError = 0; |
| var isError = 0; |
| var tabError = "$tabmenu_txt{'taberr'}\\n"; |
| var tabError = "$tabmenu_txt{'taberr'}\\n"; |
| |
| |
| if (theForm.tabtext.value == "") { tabError += "\\n- $tabmenu_txt{'texterr'}"; if(isError == 0) isError = 1; } |
| if (theForm.tabtext.value == "") { tabError += "\\n- $tabmenu_txt{'texterr'}"; if(isError == 0) isError = 1; } |
| if (theForm.taburl.value == "") { tabError += "\\n- $tabmenu_txt{'urlerr'}"; if(isError == 0) isError = 2; } |
| if (theForm.taburl.value == "") { tabError += "\\n- $tabmenu_txt{'urlerr'}"; if(isError == 0) isError = 2; } |
| if(isError >= 1) { |
| if(isError >= 1) { |
| alert(tabError); |
| alert(tabError); |
| if(isError == 1) theForm.tabtext.focus(); |
| if(isError == 1) theForm.tabtext.focus(); |
| else if(isError == 2) theForm.taburl.focus(); |
| else if(isError == 2) theForm.taburl.focus(); |
| else if(isError == 3) theForm.tabtext.focus(); |
| else if(isError == 3) theForm.tabtext.focus(); |
| return false; |
| return false; |
| } |
| } |
| return true |
| return true |
| } |
| } |
| //--> |
| </script>~ |
| </script> |
| . $brd_advanced_tabs; |
| |
| $yyaddtab =~ s/{yabb tabtext}/$tabmenu_txt{'tabtext'}/sm; |
| <form action="$scripturl?action=addtab2" method="post" name="addtabtext" style="font-size: 11px; display: inline;" onsubmit="if(!checkTab(this)) {return false} else {return submittab()}"> |
| $yyaddtab =~ s/{yabb taburl}/$tabmenu_txt{'taburl'}/sm; |
| <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| $yyaddtab =~ s/{yabb tabwin}/$tabmenu_txt{'tabwin'}/sm; |
| <tr> |
| $yyaddtab =~ s/{yabb tabview}/$tabmenu_txt{'tabview'}/sm; |
| <td class="tabmenuleft" width="40"> </td> |
| $yyaddtab =~ s/{yabb viewall}/$tabmenu_txt{'viewall'}/sm; |
| <td class="tabmenu" align="right" valign="middle" style="text-align: left; vertical-align: middle;"> |
| $yyaddtab =~ s/{yabb viewmem}/$tabmenu_txt{'viewmem'}/sm; |
| <span class="selected" style="cursor: auto; vertical-align: middle; padding-top: 1px; white-space: nowrap;"><label for="tabtext">$tabfill$tabmenu_txt{'tabtext'}</label> <input type="text" name="tabtext" id="tabtext" value="" size="10" class="small" style="vertical-align: middle;" /></span> |
| $yyaddtab =~ s/{yabb viewgm}/$tabmenu_txt{'viewgm'}/sm; |
| <span class="selected" style="cursor: auto; vertical-align: middle; padding-top: 1px; white-space: nowrap;"><label for="taburl">$tabfill$tabmenu_txt{'taburl'}</label> <input type="text" name="taburl" id="taburl" value="" size="25" class="small" style="vertical-align: middle;" /></span> |
| $yyaddtab =~ s/{yabb viewadm}/$tabmenu_txt{'viewadm'}/sm; |
| |
| $yyaddtab =~ s/{yabb tabinsert}/$tabmenu_txt{'tabinsert'}/sm; |
| <span class="selected" style="cursor: auto; vertical-align: middle; padding-top: 1px; white-space: nowrap;"><label for="tabwin">$tabfill$tabmenu_txt{'tabwin'}</label> <input type="checkbox" name="tabwin" id="tabwin" style="border: 0; padding: 0; margin: 0; background-color: transparent; vertical-align: middle;" /></span> |
| $yyaddtab =~ s/{yabb addtab}/$tabmenu_txt{'addtab'}/sm; |
| |
| $yyaddtab =~ s/{yabb edittabs}/$edittabs/sm; |
| <span class="selected" style="cursor: auto; vertical-align: middle; padding-top: 1px; white-space: nowrap;"><label for="showto">$tabfill$tabmenu_txt{'tabview'}</label> |
| |
| <select name="showto" id="showto" class="small" style="vertical-align: middle;"> |
| return $yyaddtab; |
| <option value="0" selected="selected">$tabmenu_txt{'viewall'}</option> |
| |
| <option value="1">$tabmenu_txt{'viewmem'}</option> |
| |
| <option value="2">$tabmenu_txt{'viewgm'}</option> |
| |
| <option value="3">$tabmenu_txt{'viewadm'}</option> |
| |
| </select> |
| |
| </span> |
| |
| <span class="selected" style="cursor: auto; vertical-align: middle; padding-top: 1px; white-space: nowrap;"><label for="addafter">$tabfill$tabmenu_txt{'tabinsert'}</label> |
| |
| <select name="addafter" id="addafter" class="small" style="vertical-align: middle;"> |
| |
| $edittabs |
| |
| </select> |
| |
| </span> |
| |
| <span class="selected" style="cursor: auto; vertical-align: middle; padding-top: 1px; white-space: nowrap;">$tabfill<input type="submit" value="$tabmenu_txt{'addtab'}" class="small" style="vertical-align: middle;" />$tabfill</span>$tabsep |
| |
| </td> |
| |
| </tr> |
| |
| </table> |
| |
| </form> |
| |
| ~; |
| |
| } |
| } |
| |
| |
| sub AddNewTab2 { |
| sub AddNewTab2 { |
| if ($iamadmin) { |
| if ($iamadmin) { |
| my $tabtext = $FORM{'tabtext'}; |
| my $tabtext = $FORM{'tabtext'}; |
| my $taburl = $FORM{'taburl'}; |
| my $taburl = $FORM{'taburl'}; |
| $taburl =~ s/"/\%22/g; |
| $taburl =~ s/\x22/\%22/gxsm; |
| my $tabwin = $FORM{'tabwin'} ? 1 : 0; |
| my $tabwin = $FORM{'tabwin'} ? 1 : 0; |
| my $tabview = $FORM{'showto'}; |
| my $tabview = $FORM{'showto'}; |
| my $tabafter = $FORM{'addafter'}; |
| my $tabafter = $FORM{'addafter'}; |
| my $tmpusernamereq = 0; |
| my $tmpusernamereq = 0; |
| |
| |
| if ($taburl !~ /^\http:\/\//) { $taburl = qq~http://$taburl~; } |
| #Carsten's fix - nice and neat/';# |
| |
| if ( $taburl !~ /[ht|f]tp[s]{0,1}:\/\//xsm ) { |
| if($taburl =~ /$boardurl\/$yyexec\.$yyaext/i && $taburl =~ /action\=(.*?)(\;|\Z)/i) { |
| $taburl = qq~http://$taburl~; |
| $taburl = 1; |
| } |
| $tabaction = $1; |
| if ( $taburl =~ /$boardurl\/$yyexec\.$yyaext/ixsm |
| $tmpisaction = 1; |
| && $taburl =~ /action\=(.*?)(\;|\Z)/ixsm ) |
| } elsif($taburl =~ /$boardurl\/AdminIndex\.$yyaext/i && $taburl =~ /action\=(.*?)(\;|\Z)/i) { |
| { |
| $taburl = 2; |
| $taburl = 1; |
| $tabaction = $1; |
| $tabaction = $1; |
| $tmpisaction = 1; |
| $tmpisaction = 1; |
| } else { |
| } |
| $tabaction = lc $tabtext; |
| elsif ($taburl =~ /$boardurl\/AdminIndex\.$yyaext/ixsm |
| $tabaction =~ s/ /\_/g; |
| && $taburl =~ /action\=(.*?)(\;|\Z)/ixsm ) |
| $tmpisaction = 0; |
| { |
| } |
| $taburl = 2; |
| $tabaction =~ s/\W/_/g; |
| $tabaction = $1; |
| map { &fatal_error('tabext',$tabaction) if $_ =~ /^$tabaction\|?/; } @AdvancedTabs; |
| $tmpisaction = 1; |
| |
| } |
| if ($taburl == 1 || $taburl == 2) { |
| else { |
| if ($FORM{'taburl'} =~ m/username\=/i) { $tmpusernamereq = 1; } |
| $tabaction = lc $tabtext; |
| $exttaburl = $FORM{'taburl'}; |
| $tabaction =~ s/ /\_/gsm; |
| $exttaburl =~ s/(.*?)\?(.*?)/$2/g; |
| $tmpisaction = 0; |
| $exttaburl =~ s/action\=(.*?)(\;|\Z)//i; |
| } |
| $exttaburl =~ s/username\=(.*?)(\;|\Z)//i; |
| $tabaction =~ s/\W/_/gxsm; |
| } else { |
| map { |
| $exttaburl = ""; |
| if ( $_ =~ /^$tabaction\|?/xsm ) |
| } |
| { |
| |
| fatal_error( 'tabext', $tabaction ); |
| &ToHTML($tabtext); |
| } |
| |
| } @AdvancedTabs; |
| opendir(DIR, $langdir); |
| |
| my @languages = readdir(DIR); |
| if ( $taburl == 1 || $taburl == 2 ) { |
| closedir(DIR); |
| if ( $FORM{'taburl'} =~ m/username\=/ixsm ) { $tmpusernamereq = 1; } |
| foreach $lngdir (@languages) { |
| $exttaburl = $FORM{'taburl'}; |
| next if $lngdir eq "." || $lngdir eq ".." || !-d "$langdir/$lngdir"; |
| $exttaburl =~ s/(.*?)\?(.*?)/$2/gxsm; |
| undef %tabtxt; |
| $exttaburl =~ s/action\=(.*?)(\;|\Z)//ixsm; |
| if (fopen(TABTXT, "$langdir/$lngdir/tabtext.txt")) { |
| $exttaburl =~ s/username\=(.*?)(\;|\Z)//ixsm; |
| %tabtxt = map /(.*)\t(.*)/, <TABTXT>; |
| } |
| fclose(TABTXT); |
| else { |
| } |
| $exttaburl = q{}; |
| $tabtxt{$tabaction} = $tabtext; |
| } |
| fopen(TABTXT, ">$langdir/$lngdir/tabtext.txt") || &fatal_error('file_not_open', "$langdir/$lngdir/tabtext.txt", 1); |
| |
| print TABTXT map "$_\t$tabtxt{$_}\n", keys %tabtxt; |
| ToHTML($tabtext); |
| fclose(TABTXT); |
| |
| } |
| opendir DIR, $langdir; |
| |
| my @languages = readdir DIR; |
| my @new_tabs_order; |
| closedir DIR; |
| if($tabafter eq "thefront") { |
| foreach my $lngdir (@languages) { |
| push(@new_tabs_order, qq~$tabaction|$taburl|$tmpisaction|$tmpusernamereq|$tabview|$tabwin|$exttaburl~); |
| next |
| } |
| if $lngdir eq q{.} || $lngdir eq q{..} || !-d "$langdir/$lngdir"; |
| foreach (@AdvancedTabs) { |
| undef %tabtxt; |
| push(@new_tabs_order, $_); |
| if ( fopen( TABTXT, "$langdir/$lngdir/tabtext.txt" ) ) { |
| if (/^$tabafter\|?/) { |
| %tabtxt = map { /(.*)\t(.*)/xsm } <TABTXT>; |
| push(@new_tabs_order, qq~$tabaction|$taburl|$tmpisaction|$tmpusernamereq|$tabview|$tabwin|$exttaburl~); |
| fclose(TABTXT); |
| } |
| } |
| } |
| $tabtxt{$tabaction} = $tabtext; |
| @AdvancedTabs = @new_tabs_order; |
| fopen( TABTXT, ">$langdir/$lngdir/tabtext.txt" ) |
| |
| or fatal_error( 'file_not_open', "$langdir/$lngdir/tabtext.txt", |
| require "$admindir/NewSettings.pl"; |
| 1 ); |
| &SaveSettingsTo('Settings.pl'); |
| print {TABTXT} map { "$_\t$tabtxt{$_}\n" } keys %tabtxt |
| } |
| or croak "$croak{'print'} TABTXT"; |
| |
| fclose(TABTXT); |
| $yySetLocation = $scripturl; |
| } |
| &redirectexit; |
| |
| |
| my @new_tabs_order; |
| |
| if ( $tabafter eq 'thefront' ) { |
| |
| push @new_tabs_order, |
| |
| qq~$tabaction|$taburl|$tmpisaction|$tmpusernamereq|$tabview|$tabwin|$exttaburl~; |
| |
| } |
| |
| foreach (@AdvancedTabs) { |
| |
| push @new_tabs_order, $_; |
| |
| if (/^$tabafter\|?/xsm) { |
| |
| push @new_tabs_order, |
| |
| qq~$tabaction|$taburl|$tmpisaction|$tmpusernamereq|$tabview|$tabwin|$exttaburl~; |
| |
| } |
| |
| } |
| |
| @AdvancedTabs = @new_tabs_order; |
| |
| |
| |
| require Admin::NewSettings; |
| |
| SaveSettingsTo('Settings.pm'); |
| |
| } |
| |
| |
| |
| $yySetLocation = $scripturl; |
| |
| redirectexit(); |
| |
| return; |
| } |
| } |
| |
| |
| sub EditTab { |
| sub EditTab { |
| $tabsave = qq~<img src="$imagesdir/tabsave.gif" border="0" alt="$tabmenu_txt{'savetab'}" title="$tabmenu_txt{'savetab'}" style="vertical-align: middle;" />~; |
| get_micon(); |
| $tabdel = qq~<img src="$imagesdir/tabdelete.gif" border="0" alt="$tabmenu_txt{'tabdel'}" title="$tabmenu_txt{'tabdel'}" style="vertical-align: middle;" />~; |
| GetTexttab(); |
| $tabstyle = qq~style="font-size: 11px; white-space: nowrap; cursor: auto;"~; |
| $tabsave = $micon{'tabsave'}; |
| |
| $tabdel = $micon{'tabdel'}; |
| $edittab{'home'} = qq~<span $tabstyle>$tabfill$img_txt{'103'}$tabfill</span>~; |
| %edittab= (); |
| $edittab{'help'} = qq~<span $tabstyle>$tabfill$img_txt{'119'}$tabfill</span>~; |
| my @tablist = qw(home help search ml eventcal birthdaylist admin revalidatesession login register guestpm mycenter logout); |
| $edittab{'search'} = qq~<span $tabstyle>$tabfill$img_txt{'182'}$tabfill</span>~; |
| ## Mod hook tablist ## |
| $edittab{'ml'} = qq~<span $tabstyle>$tabfill$img_txt{'331'}$tabfill</span>~; |
| ## End Mod hook tablist ## |
| $edittab{'admin'} = qq~<span $tabstyle>$tabfill$img_txt{'2'}$tabfill</span>~; |
| for (@tablist) { |
| $edittab{'revalidatesession'} = qq~<span $tabstyle>$tabfill$img_txt{'34a'}$tabfill</span>~; |
| $edittab{$_} = qq~<span class="tabstyle">$tabfill$texttab{$_}$tabfill</span>~; |
| $edittab{'login'} = qq~<span $tabstyle>$tabfill$img_txt{'34'}$tabfill</span>~; |
| } |
| $edittab{'register'} = qq~<span $tabstyle>$tabfill$img_txt{'97'}$tabfill</span>~; |
| |
| $edittab{'guestpm'} = qq~<span $tabstyle>$tabfill$img_txt{'pmadmin'}$tabfill</span>~; |
| my $selsize = 0; |
| $edittab{'mycenter'} = qq~<span $tabstyle>$tabfill$img_txt{'mycenter'}$tabfill</span>~; |
| my $isexttabs = 0; |
| $edittab{'logout'} = qq~<span $tabstyle>$tabfill$img_txt{'108'}$tabfill</span>~; |
| for my $i ( 0 .. $#AdvancedTabs ) { |
| |
| if ( $AdvancedTabs[$i] =~ /\|/xsm ) { |
| &GetTexttab; |
| my ( $tab_key, $tmptab_url, $isaction, $username_req, $tab_access, |
| |
| $dummy ) |
| my $selsize = 0; |
| = split /\|/xsm, $AdvancedTabs[$i], 6; |
| my $isexttabs = 0; |
| my $enc_key = $tab_key; |
| for (my $i = 0; $i < @AdvancedTabs; $i++) { |
| $enc_key =~ s/\&/%26/gxsm; |
| if ($AdvancedTabs[$i] =~ /\|/) { |
| $isexttabs++; |
| my ($tab_key, $tmptab_url, $isaction, $username_req, $tab_access, $dummy) = split(/\|/, $AdvancedTabs[$i], 6); |
| if ( !$tab_access |
| my $enc_key = $tab_key; |
| || ( $tab_access < 2 && !$iamguest ) |
| $enc_key =~ s~\&~%26~g; |
| || ( $tab_access < 3 && $iamgmod ) |
| $isexttabs++; |
| || $iamadmin ) |
| if (!$tab_access || ($tab_access < 2 && !$iamguest) || ($tab_access < 3 && $iamgmod) || $iamadmin) { |
| { |
| if ($tmptab_url == 1) { $tab_url = qq~$scripturl~; } |
| if ( $tmptab_url == 1 ) { $tab_url = qq~$scripturl~; } |
| elsif ($tmptab_url == 2) { $tab_url = qq~$boardurl/AdminIndex.$yyaext~; } |
| elsif ( $tmptab_url == 2 ) { |
| else { $tab_url = qq~$tmptab_url~; } |
| $tab_url = qq~$boardurl/AdminIndex.$yyaext~; |
| if ($isaction) { $tab_url .= qq~?action=$tab_key~; } |
| } |
| if ($username_req) { $tab_url .= qq~;username=$useraccount{$username}~; } |
| else { $tab_url = qq~$tmptab_url~; } |
| $inputlength = length($tabtxt{$tab_key}); |
| if ($isaction) { $tab_url .= qq~?action=$tab_key~; } |
| $edittab{$tab_key} = qq~<form action="$scripturl?action=edittab2;savetab=$enc_key" method="post" name="$tab_key$isexttabs" style="display: inline; white-space: nowrap;">~; |
| if ($username_req) { |
| $edittab{$tab_key} .= qq~<span $tabstyle>$tabfill~; |
| $tab_url .= qq~;username=$useraccount{$username}~; |
| $edittab{$tab_key} .= qq~<input type="text" name="$tab_key" id="$tab_key" value="$tabtxt{$tab_key}" size="$inputlength" class="small" style="font-size: 11px; border: 0; margin: 0; padding: 0; background-color: transparent; vertical-align: middle;" />$tabfill~; |
| } |
| $edittab{$tab_key} .= qq~<input type="image" src="$imagesdir/tabsave.gif" alt="$tabmenu_txt{'savetab'}" title="$tabmenu_txt{'savetab'}" style="background-color: transparent; border:0; vertical-align: middle;" />~; |
| $inputlength = length $tabtxt{$tab_key}; |
| $edittab{$tab_key} .= qq~ <a href="$scripturl?action=deletetab;deltab=$enc_key">$tabdel</a>~; |
| $edittab{$tab_key} = |
| $edittab{$tab_key} .= qq~$tabfill</span>~; |
| qq~<form action="$scripturl?action=edittab2;savetab=$enc_key" method="post" name="$tab_key$isexttabs" style="display: inline; white-space: nowrap;" accept-charset="$yymycharset">~; |
| $edittab{$tab_key} .= qq~</form>~; |
| $edittab{$tab_key} .= |
| $edittabs .= qq~<option value="$tab_key"~ . ($tab_key eq $INFO{"thetab"} ? ' selected="selected"' : '') . qq~>$texttab{$tab_key}</option>~; |
| qq~<input type="text" name="$tab_key" id="$tab_key" value="$tabtxt{$tab_key}" size="$inputlength" class="edittab" />~; |
| $edittabmenu .= $edittab{$tab_key} . $tabsep; |
| $edittab{$tab_key} .= |
| $selsize++; |
| qq~<input type="image" src="$micon_bg{'tabsave'}" alt="$tabmenu_txt{'savetab'}" title="$tabmenu_txt{'savetab'}" class="editttab_img" />~; |
| } |
| $edittab{$tab_key} .= |
| } elsif ($edittab{$AdvancedTabs[$i]}) { |
| qq~ <a href="$scripturl?action=deletetab;deltab=$enc_key" style="padding:0; margin:0">$tabdel</a>~; |
| $edittabs .= qq~<option value="$AdvancedTabs[$i]"~ . ($AdvancedTabs[$i] eq $INFO{"thetab"} ? ' selected="selected"' : '') . qq~>$texttab{$AdvancedTabs[$i]}</option>~; |
| $edittab{$tab_key} .= q~</form>~; |
| $edittabmenu .= $edittab{$AdvancedTabs[$i]} . $tabsep; |
| $edittabs .= |
| $selsize++; |
| qq~<option value="$tab_key"~ |
| } |
| . ( |
| } |
| $tab_key eq $INFO{'thetab'} ? ' selected="selected"' : q{} ) |
| if ($selsize > 11) { $selsize = 11; } |
| . qq~>$texttab{$tab_key}</option>~; |
| |
| $edittabmenu .= qq~<li>$edittab{$tab_key}</li>~; |
| $yyaddtab = qq~ |
| $selsize++; |
| <br /> |
| } |
| <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
| } |
| <tr> |
| elsif ( $edittab{ $AdvancedTabs[$i] } ) { |
| <td class="tabmenuleft" width="40" style="text-align: left; vertical-align: top;"> </td> |
| $edittabs .= qq~<option value="$AdvancedTabs[$i]"~ |
| <td class="tabmenu" style="text-align: left; vertical-align: top;"> |
| . ( |
| $edittabmenu |
| $AdvancedTabs[$i] eq $INFO{'thetab'} |
| </td> |
| ? ' selected="selected"' |
| <td class="tabmenuright" width="45" style="text-align: left; vertical-align: top;"> </td> |
| : q{} |
| <td class="rightbox" width="160" align="center" valign="middle"> |
| ) . qq~>$texttab{$AdvancedTabs[$i]}</option>~; |
| <b>$tabmenu_txt{'reordertab'}</b> |
| $edittabmenu .= qq~<li>$edittab{ $AdvancedTabs[$i] }</li>~; |
| </td> |
| $selsize++; |
| |
| } |
| </tr> |
| } |
| <tr> |
| if ( $selsize > 11 ) { $selsize = 11; } |
| <td colspan="3"> </td> |
| |
| <td width="160" align="center" valign="top" rowspan="3"> |
| $yyaddtab = $brd_advanced_tabs_edit; |
| <form action="$scripturl?action=reordertab" method="post" name="tabsorder" style="display: inline; white-space: nowrap;"> |
| $yyaddtab =~ s/{yabb edittabmenu}/$edittabmenu/sm; |
| <select name="ordertabs" class="small" size="$selsize" style="width: 130px;"> |
| $yyaddtab =~ s/{yabb reordertab}/$tabmenu_txt{'reordertab'}/sm; |
| $edittabs |
| $yyaddtab =~ s/{yabb selsize}/$selsize/sm; |
| </select><br /> |
| $yyaddtab =~ s/{yabb edittabs}/$edittabs/sm; |
| <input type="submit" value="$tabmenu_txt{'tableft'}" name="moveleft" style="font-size: 11px; width: 65px;" /><input type="submit" value="$tabmenu_txt{'tabright'}" name="moveright" style="font-size: 11px; width: 65px;" /> |
| $yyaddtab =~ s/{yabb edittabs}/$edittabs/sm; |
| </form> |
| $yyaddtab =~ s/{yabb tableft}/$tabmenu_txt{'tableft'}/sm; |
| </td> |
| $yyaddtab =~ s/{yabb tabright}/$tabmenu_txt{'tabright'}/sm; |
| </tr> |
| $yyaddtab =~ s/{yabb edittext1}/$tabmenu_txt{'edittext1'}/sm; |
| <tr> |
| $yyaddtab =~ s/{yabb tabsave}/$tabsave/sm; |
| <td width="40"> </td> |
| $yyaddtab =~ s/{yabb edittext2}/$tabmenu_txt{'edittext2'}/sm; |
| <td class="windowbg" style="text-align: left;"> |
| $yyaddtab =~ s/{yabb tabdel}/$tabdel/sm; |
| <div class="small" style="float: left; width: 98%; padding: 4px;"> |
| $yyaddtab =~ s/{yabb edittext3}/$tabmenu_txt{'edittext3'}/sm; |
| $tabmenu_txt{'edittext1'} $tabsave$tabmenu_txt{'edittext2'}$tabdel$tabmenu_txt{'edittext3'}<br /> |
| $yyaddtab =~ s/{yabb reordertext}/$tabmenu_txt{'reordertext'}/sm; |
| $tabmenu_txt{'reordertext'} |
| |
| </div> |
| undef %edittab; |
| |
| return; |
| </td> |
| |
| <td width="45"> </td> |
| |
| </tr> |
| |
| <tr> |
| |
| <td colspan="3" style="font-size: 50px; text-align: left; vertical-align: top;"> </td> |
| |
| </tr> |
| |
| </table> |
| |
| ~; |
| |
| undef %edittab; |
| |
| } |
| } |
| |
| |
| sub EditTab2 { |
| sub EditTab2 { |
| if($iamadmin) { |
| if ($iamadmin) { |
| $tosave = $INFO{'savetab'}; |
| $tosave = $INFO{'savetab'}; |
| $tosave =~ s~%26~&~g; |
| $tosave =~ s/%26/&/gxsm; |
| $tosavetxt = $FORM{$tosave}; |
| $tosavetxt = $FORM{$tosave}; |
| &ToHTML($tosavetxt); |
| ToHTML($tosavetxt); |
| $tab_lang = $language ? $language : $lang; |
| $tab_lang = $language ? $language : $lang; |
| fopen(TABTXT, "$langdir/$tab_lang/tabtext.txt") || &fatal_error('file_not_open', "$langdir/$tab_lang/tabtext.txt"); |
| fopen( TABTXT, "$langdir/$tab_lang/tabtext.txt" ) |
| %tabtxt = map /(.*)\t(.*)/, <TABTXT>; |
| or fatal_error( 'file_not_open', "$langdir/$tab_lang/tabtext.txt" ); |
| fclose(TABTXT); |
| %tabtxt = map { /(.*)\t(.*)/xsm } <TABTXT>; |
| $tabtxt{$tosave} = $tosavetxt; |
| fclose(TABTXT); |
| fopen(TABTXT, ">$langdir/$tab_lang/tabtext.txt") || &fatal_error('file_not_open', "$langdir/$tab_lang/tabtext.txt"); |
| $tabtxt{$tosave} = $tosavetxt; |
| print TABTXT map "$_\t$tabtxt{$_}\n", keys %tabtxt; |
| fopen( TABTXT, ">$langdir/$tab_lang/tabtext.txt" ) |
| fclose(TABTXT); |
| or fatal_error( 'file_not_open', "$langdir/$tab_lang/tabtext.txt" ); |
| } |
| print {TABTXT} map { "$_\t$tabtxt{$_}\n" } keys %tabtxt |
| |
| or croak "$croak{'print'} TABTXT"; |
| $yySetLocation = $scripturl; |
| fclose(TABTXT); |
| &redirectexit; |
| } |
| |
| |
| |
| $yySetLocation = $scripturl; |
| |
| redirectexit(); |
| |
| return; |
| } |
| } |
| |
| |
| sub ReorderTab { |
| sub ReorderTab { |
| my $moveitem = $FORM{'ordertabs'}; |
| my $moveitem = $FORM{'ordertabs'}; |
| if ($iamadmin) { |
| if ($iamadmin) { |
| if ($moveitem) { |
| if ($moveitem) { |
| if ($FORM{'moveleft'}) { |
| if ( $FORM{'moveleft'} ) { |
| for ($i = 0; $i < @AdvancedTabs; $i++) { |
| for my $i ( 0 .. $#AdvancedTabs ) { |
| if ($AdvancedTabs[$i] =~ /^$moveitem\|?/ && $i > 0) { |
| if ( $AdvancedTabs[$i] =~ /^$moveitem\|?/xsm && $i > 0 ) { |
| my $j = $i - 1; |
| my $j = $i - 1; |
| my $x = $AdvancedTabs[$i]; |
| my $x = $AdvancedTabs[$i]; |
| $AdvancedTabs[$i] = $AdvancedTabs[$j]; |
| $AdvancedTabs[$i] = $AdvancedTabs[$j]; |
| $AdvancedTabs[$j] = $x; |
| $AdvancedTabs[$j] = $x; |
| last; |
| last; |
| } |
| } |
| } |
| } |
| } elsif ($FORM{'moveright'}) { |
| } |
| for ($i = 0; $i < @AdvancedTabs; $i++) { |
| elsif ( $FORM{'moveright'} ) { |
| if ($AdvancedTabs[$i] =~ /^$moveitem\|?/ && $i < $#AdvancedTabs) { |
| for my $i ( 0 .. $#AdvancedTabs ) { |
| my $j = $i + 1; |
| if ( $AdvancedTabs[$i] =~ /^$moveitem\|?/xsm |
| my $x = $AdvancedTabs[$i]; |
| && $i < $#AdvancedTabs ) |
| $AdvancedTabs[$i] = $AdvancedTabs[$j]; |
| { |
| $AdvancedTabs[$j] = $x; |
| my $j = $i + 1; |
| last; |
| my $x = $AdvancedTabs[$i]; |
| } |
| $AdvancedTabs[$i] = $AdvancedTabs[$j]; |
| } |
| $AdvancedTabs[$j] = $x; |
| } |
| last; |
| } |
| } |
| |
| } |
| require "$admindir/NewSettings.pl"; |
| } |
| &SaveSettingsTo('Settings.pl'); |
| } |
| } |
| |
| |
| require Admin::NewSettings; |
| $yySetLocation = qq~$scripturl?action=edittab;thetab=$moveitem~; |
| SaveSettingsTo('Settings.pm'); |
| &redirectexit; |
| } |
| |
| |
| |
| $yySetLocation = qq~$scripturl?action=edittab;thetab=$moveitem~; |
| |
| redirectexit(); |
| |
| return; |
| } |
| } |
| |
| |
| sub DeleteTab { |
| sub DeleteTab { |
| if ($iamadmin) { |
| if ($iamadmin) { |
| my $todelete = $INFO{'deltab'}; |
| my $todelete = $INFO{'deltab'}; |
| $todelete =~ s~%26~&~g; |
| $todelete =~ s/%26/&/gxsm; |
| |
| |
| opendir(DIR, $langdir); |
| opendir DIR, $langdir; |
| @languages = readdir(DIR); |
| @languages = readdir DIR; |
| closedir(DIR); |
| closedir DIR; |
| foreach $lngdir (@languages) { |
| foreach my $lngdir (@languages) { |
| if ($lngdir eq "." || $lngdir eq ".." || !-d "$langdir/$lngdir" || !-e "$langdir/$lngdir/tabtext.txt") { next; } |
| if ( $lngdir eq q{.} |
| fopen(TABTXT, "$langdir/$lngdir/tabtext.txt") || &fatal_error('file_not_open', "$langdir/$lngdir/tabtext.txt"); |
| || $lngdir eq q{..} |
| %tabtxt = map /(.*)\t(.*)/, <TABTXT>; |
| || !-d "$langdir/$lngdir" |
| fclose(TABTXT); |
| || !-e "$langdir/$lngdir/tabtext.txt" ) |
| delete $tabtxt{$todelete}; |
| { |
| if (!%tabtxt) { |
| next; |
| unlink("$langdir/$lngdir/tabtext.txt"); |
| } |
| } else { |
| fopen( TABTXT, "$langdir/$lngdir/tabtext.txt" ) |
| fopen(TABTXT, ">$langdir/$lngdir/tabtext.txt"); |
| or fatal_error( 'file_not_open', "$langdir/$lngdir/tabtext.txt" ); |
| print TABTXT map "$_\t$tabtxt{$_}\n", keys %tabtxt; |
| %tabtxt = map { /(.*)\t(.*)/xsm } <TABTXT>; |
| fclose(TABTXT); |
| fclose(TABTXT); |
| } |
| delete $tabtxt{$todelete}; |
| } |
| if ( !%tabtxt ) { |
| |
| unlink "$langdir/$lngdir/tabtext.txt"; |
| my @new_tabs_order; |
| } |
| foreach (@AdvancedTabs) { |
| else { |
| if ($_ !~ /^$todelete\|?/) { push(@new_tabs_order, $_); } |
| fopen( TABTXT, ">$langdir/$lngdir/tabtext.txt" ); |
| } |
| print {TABTXT} map { "$_\t$tabtxt{$_}\n" } keys %tabtxt |
| @AdvancedTabs = @new_tabs_order; |
| or croak "$croak{'print'} TABTXT"; |
| require "$admindir/NewSettings.pl"; |
| fclose(TABTXT); |
| &SaveSettingsTo('Settings.pl'); |
| } |
| } |
| } |
| |
| |
| $yySetLocation = $scripturl; |
| my @new_tabs_order; |
| &redirectexit; |
| foreach (@AdvancedTabs) { |
| |
| if ( $_ !~ /^$todelete\|?/xsm ) { push @new_tabs_order, $_; } |
| |
| } |
| |
| @AdvancedTabs = @new_tabs_order; |
| |
| require Admin::NewSettings; |
| |
| SaveSettingsTo('Settings.pm'); |
| |
| } |
| |
| |
| |
| $yySetLocation = $scripturl; |
| |
| redirectexit(); |
| |
| return; |
| } |
| } |
| |
| |
| sub GetTexttab { |
| sub GetTexttab { |
| $texttab{'home'} = $img_txt{'103'}; |
| $texttab{'home'} = $img_txt{'103'}; |
| $texttab{'help'} = $img_txt{'119'}; |
| $texttab{'help'} = $img_txt{'119'}; |
| $texttab{'search'} = $img_txt{'182'}; |
| $texttab{'search'} = $img_txt{'182'}; |
| $texttab{'ml'} = $img_txt{'331'}; |
| $texttab{'ml'} = $img_txt{'331'}; |
| $texttab{'admin'} = $img_txt{'2'}; |
| $texttab{'eventcal'} = $img_txt{'eventcal'}; |
| $texttab{'revalidatesession'} = $img_txt{'34a'}; |
| $texttab{'birthdaylist'} = $img_txt{'birthdaylist'}; |
| $texttab{'login'} = $img_txt{'34'}; |
| $texttab{'admin'} = $img_txt{'2'}; |
| $texttab{'register'} = $img_txt{'97'}; |
| $texttab{'revalidatesession'} = $img_txt{'34a'}; |
| $texttab{'guestpm'} = $img_txt{'pmadmin'}; |
| $texttab{'login'} = $img_txt{'34'}; |
| $texttab{'mycenter'} = $img_txt{'mycenter'}; |
| $texttab{'register'} = $img_txt{'97'}; |
| $texttab{'logout'} = $img_txt{'108'}; |
| $texttab{'guestpm'} = $img_txt{'pmadmin'}; |
| |
| $texttab{'mycenter'} = $img_txt{'mycenter'}; |
| &GetTabtxt unless $tab_lang; |
| $texttab{'logout'} = $img_txt{'108'}; |
| foreach (keys %tabtxt) { $texttab{$_} = $tabtxt{$_}; } |
| ## Mod Hook GetTextTab ## |
| |
| ## End Mod Hook GetTextTab ## |
| |
| if ( !$tab_lang ) { GetTabtxt(); } |
| |
| foreach ( keys %tabtxt ) { $texttab{$_} = $tabtxt{$_}; } |
| |
| return; |
| } |
| } |
| |
| |
| 1; |
| 1; |
| |
| |