F:\WEBSITES\testbed\zipped\yabb_svn_new\branches\2.5.2\cgi-bin\yabb2\Admin\Smilies.pl F:\WEBSITES\testbed\zipped\yabb_svn_new\trunk\cgi-bin\yabb2\Admin\Smilies.pm
############################################################################### ###############################################################################
# Smilies.pl                                                                  # # Smilies.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;
  our $VERSION = '2.6.12';
   
$smiliesplver = 'YaBB 2.5.2 $Revision: 1.0 $'; our $smiliespmver = 'YaBB 2.6.12 $Revision: 1651 $';
if ($action eq 'detailedversion') { return 1; } if ( $action eq 'detailedversion' ) { return 1; }
   
sub SmiliePanel {  $admin_images = "$yyhtml_root/Templates/Admin/default"; 
   &is_admin_or_gmod;  
   if    ($smiliestyle eq 1) { $ss1    = " selected='selected'"; }  
   elsif ($smiliestyle eq 2) { $ss2    = " selected='selected'"; }  
   if    ($showadded   eq 1) { $sa1    = " selected='selected'"; }  
   elsif ($showadded   eq 2) { $sa2    = " selected='selected'"; }  
   elsif ($showadded   eq 3) { $sa3    = " selected='selected'"; }  
   elsif ($showadded   eq 4) { $sa4    = " selected='selected'"; }  
   if    ($showsmdir   eq 1) { $ssm1   = " selected='selected'"; }  
   elsif ($showsmdir   eq 2) { $ssm2   = " selected='selected'"; }  
   elsif ($showsmdir   eq 3) { $ssm3   = " selected='selected'"; }  
   elsif ($showsmdir   eq 4) { $ssm4   = " selected='selected'"; }  
   if    ($detachblock eq 1) { $dblock = " checked='checked'"; }  
   if    ($removenormalsmilies) { $remnosmi = " checked='checked'"; }  
   opendir(DIR, "$smiliesdir");  
   @contents = readdir(DIR);  
   closedir(DIR);  
   $smilieslist = "";  
   
   foreach $line (sort { uc($a) cmp uc($b) } @contents) {  
       ($name, $extension) = split(/\./, $line);  
       if ($extension =~ /gif/i || $extension =~ /jpg/i || $extension =~ /jpeg/i || $extension =~ /png/i) {  
           if ($line !~ /banner/i) {  
               $smilieslist .= qq~<tr>  
   <td class="windowbg2" width="5%" align="center"><input type="radio" name="showinbox" value="$name"~ . ($showinbox eq $name ? ' checked="checked"' : '') . qq~ /></td>  
   <td class="windowbg2" width="21%" align="center">[smiley=$line]</td>  
   <td class="windowbg2" width="21%" align="center">$line</td>  
   <td class="windowbg2" width="21%" align="center">$name</td>  
   <td class="windowbg2" colspan="4" width="32%" align="center"><img src="$smiliesurl/$line" alt="$name" title="$name" /></td>  
 </tr>~;  
           }  
       }  
   }  
   $yymain .= qq~  
<form action="$adminurl?action=addsmilies" method="post">  
<table border="0" width="98%" cellspacing="1" cellpadding="4" class="bordercolor" align="center">  
 <tr>  
   <td class="titlebg" colspan="8"><b>&nbsp;<img src="$imagesdir/grin.gif" alt="" />&nbsp;$asmtxt{'11'}</b></td>  
 </tr><tr>  
   <td class="catbg" width="5%" align="center"><b>$smiltxt{'22'}</b></td>  
   <td class="catbg" width="20%" align="center"><b>$asmtxt{'02'}</b></td>  
   <td class="catbg" width="20%" align="center"><b>$asmtxt{'03'}</b></td>  
   <td class="catbg" width="20%" align="center"><b>$asmtxt{'04'}</b></td>  
   <td class="catbg" width="15%" align="center"><b>$asmtxt{'05'}</b></td>  
   <td class="catbg" width="10%" align="center"><b>$asmtxt{'06'}</b></td>  
   <td class="catbg" width="5%" align="center"><b>$asmtxt{'07'}</b></td>  
   <td class="catbg" width="5%" align="center"><b>$asmtxt{'12'}</b></td>  
 </tr>~;  
   
   $i = 0;  sub SmiliePanel { 
   foreach (@SmilieURL) {     is_admin_or_gmod(); 
       if ($i != 0) {     if    ( $smiliestyle == 1 ) { $ss1 = q{ selected="selected"}; } 
           $up = qq~<a href="$adminurl?action=smiliemove;index=$i;moveup=1"><img src="$imagesdir/smiley_up.gif" border="0" alt="$asmtxt{'13'}" title="$asmtxt{'13'}" /></a>~;     elsif ( $smiliestyle == 2 ) { $ss2 = q{ selected="selected"}; } 
       } else {     @sa = (); 
           $up = qq~<img src="$imagesdir/smiley_up.gif" border="0" alt="" />~;     foreach my $i ( 1 .. 4 ) { 
       }         if ( $showadded == $i ) { 
       if ($SmilieURL[$i + 1]) {             $sa[$i] = q{ selected="selected"}; 
           $down = qq~<a href="$adminurl?action=smiliemove;index=$i;movedown=1"><img src="$imagesdir/smiley_down.gif" border="0" alt="$asmtxt{'14'}" title="$asmtxt{'14'}" /></a>~;         } 
       } else {     } 
           $down = qq~<img src="$imagesdir/smiley_down.gif" border="0" alt="" />~;     @ssm = (); 
       }     foreach my $i ( 1 .. 4 ) { 
       $yymain .= qq~<tr>         if ( $showsmdir == $i ) { 
   <td class="windowbg2" width="5%" align="center"><input type="radio" name="showinbox" value="$SmilieDescription[$i]"~ . ($showinbox eq $SmilieDescription[$i] ? ' checked="checked"' : '') . qq~ /></td>             $ssm[$i] = q{ selected="selected"}; 
   <td class="windowbg2" width="20%" align="center"><input type="text" name="scd[$i]" value="$SmilieCode[$i]" /></td>         } 
   <td class="windowbg2" width="20%" align="center"><input type="text" name="smimg[$i]" value="$SmilieURL[$i]" /></td>     } 
   <td class="windowbg2" width="20%" align="center"><input type="text" name="sdescr[$i]" value="$SmilieDescription[$i]" /></td>     if ( $detachblock == 1 )  { $dblock   = q{ checked="checked"}; } 
   <td class="windowbg2" width="15%" align="center"><input type="checkbox" name="smbox[$i]" value="1"~ . ($SmilieLinebreak[$i] eq "<br />" ? " checked='checked'" : "") . qq~ /></td>     if ($removenormalsmilies) { $remnosmi = q{ checked="checked"}; } 
   <td class="windowbg2" width="10%" align="center"><img src="~ . ($SmilieURL[$i] =~ /\//i ? $SmilieURL[$i] : qq~$imagesdir/$SmilieURL[$i]~) . qq~" alt="" /></td>     opendir DIR, "$htmldir/Smilies"; 
   <td class="windowbg2" width="5%" align="center"><input type="checkbox" name="delbox[$i]" value="1" /></td>     @contents = readdir DIR; 
   <td class="windowbg2" width="5%" align="center">$up $down</td>     closedir DIR; 
 </tr>~;     $smilieslist = q{}; 
       $i++;  
   }     foreach my $line ( sort { uc($a) cmp uc $b } @contents ) { 
   $yymain .= qq~<tr>         my ( $name, $extension ) = split /\./xsm, $line; 
   <td class="titlebg" colspan="8"><b>&nbsp;<img src="$imagesdir/grin.gif" alt="" />&nbsp;$asmtxt{'08'}</b></td>         if (   $extension =~ /gif/ism 
 </tr>~;             || $extension =~ /jpg/ism 
   $inew = 0;             || $extension =~ /jpeg/ism 
   while ($inew <= "5") {             || $extension =~ /png/ism ) 
       $yymain .= qq~<tr>         { 
   <td class="windowbg2" width="5%" align="center">&nbsp;</td>             if ( $line !~ /banner/ism ) { 
   <td class="windowbg2" width="20%" align="center"><input type="text" name="scd[$i]" /></td>                 $smilieslist .= qq~<tr> 
   <td class="windowbg2" width="20%" align="center"><input type="text" name="smimg[$i]" /></td>     <td class="windowbg2 center"> 
   <td class="windowbg2" width="20%" align="center"><input type="text" name="sdescr[$i]" /></td>         <input type="radio" name="showinbox" value="$name"~ 
   <td class="windowbg2" width="15%" align="center"><input type="checkbox" name="smbox[$i]" value="1" /></td>                   . ( $showinbox eq $name ? ' checked="checked"' : q{} ) 
   <td class="windowbg2" width="20%" align="center" colspan="3"></td>                   . qq~ /></td> 
     <td class="windowbg2 center">[smiley=$line]</td>
     <td class="windowbg2 center">$line</td>
     <td class="windowbg2 center">$name</td>
     <td class="windowbg2 center" colspan="4"><img src="$yyhtml_root/Smilies/$line" alt="$name" title="$name" /></td>
 </tr>~;  </tr>~;
       $i++;             } 
       $inew++;         } 
       if ($inew == 5) {     } 
           $yymain .= qq~<tr>     $yymain .= qq~ 
   <td colspan="8" class="titlebg"><b>&nbsp;<img src="$imagesdir/grin.gif" alt="" />&nbsp;$smiltxt{'2'}</b></td>  <form action="$adminurl?action=addsmilies" method="post" enctype="multipart/form-data" accept-charset="$yymycharset"> 
 </tr><tr>  <div class="bordercolor rightboxdiv"> 
   <td class="catbg" width="5%" align="center"><b>$smiltxt{'22'}</b></td>  <table class="border-space pad-cell" style="margin-bottom: .5em;"> 
   <td class="catbg" width="21%" align="center"><b>$asmtxt{'02'}</b></td>     <colgroup> 
   <td class="catbg" width="21%" align="center"><b>$asmtxt{'03'}</b></td>         <col style="width: 5%" /> 
   <td class="catbg" width="21%" align="center"><b>$asmtxt{'04'}</b></td>         <col span="3" style="width: 20%" /> 
   <td class="catbg" colspan="4" width="32%" align="center"><b>$asmtxt{'06'}</b></td>         <col style="width: 15%" /> 
 </tr>$smilieslist<tr>         <col style="width: 10%" /> 
   <td class="titlebg" colspan="8" height="22"><b>&nbsp;<img src="$imagesdir/grin.gif" alt="" />&nbsp;$smiltxt{'3'}</b><br /></td>         <col span="2" style="width: 5%" /> 
 </tr><tr>     </colgroup> 
   <td class="windowbg2" colspan="4"><label for="removenormalsmilies"><b>$smiltxt{'24'}</b></label></td>     <tr> 
   <td class="windowbg2" colspan="4" align="right"><input type="checkbox" name="removenormalsmilies" id="removenormalsmilies" value="1"$remnosmi /></td>        <td class="titlebg" colspan="8" style="height:22px">&nbsp;<img src="$imagesdir/grin.gif" alt="" /><b>&nbsp;$smiltxt{'3'}</b><br /></td>
 </tr><tr>    </tr><tr>
   <td class="windowbg2" colspan="4"><label for="smiliestyle"><b>$smiltxt{'4'}</b></label></td>         <td class="windowbg2" colspan="4"><label for="removenormalsmilies">$smiltxt{'24'}</label></td> 
   <td class="windowbg2" colspan="4" align="right">         <td class="windowbg2" colspan="4"><input type="checkbox" name="removenormalsmilies" id="removenormalsmilies" value="1"$remnosmi /></td> 
     <select name="smiliestyle" id="smiliestyle">     </tr><tr> 
       <option value="1"$ss1>$smiltxt{'5'}</option>         <td class="windowbg2" colspan="4"><label for="smiliestyle">$smiltxt{'4'}</label></td> 
       <option value="2"$ss2>$smiltxt{'6'}</option>         <td class="windowbg2" colspan="4"> 
     </select>             <select name="smiliestyle" id="smiliestyle"> 
                 <option value="1"$ss1>$smiltxt{'5'}</option>
                 <option value="2"$ss2>$smiltxt{'6'}</option>
             </select>
         </td>
     </tr><tr>
         <td class="windowbg2" colspan="4"><label for="showadded">$smiltxt{'7'}</label></td>
         <td class="windowbg2" colspan="4">
             <select name="showadded" id="showadded">
                 <option value="1"$sa[1]>$smiltxt{'8'}</option>
                 <option value="2"$sa[2]>$smiltxt{'9'}</option>
                 <option value="3"$sa[3]>$smiltxt{'10'}</option>
                 <option value="4"$sa[4]>$smiltxt{'11'}</option>
             </select>
         </td>
     </tr><tr>
         <td class="windowbg2" colspan="4"><label for="showsmdir">$smiltxt{'2'}</label></td>
         <td class="windowbg2" colspan="4">
             <select name="showsmdir" id="showsmdir">
                 <option value="1"$ssm[1]>$smiltxt{'8'}</option>
                 <option value="2"$ssm[2]>$smiltxt{'9'}</option>
                 <option value="3"$ssm[3]>$smiltxt{'10'}</option>
                 <option value="4"$ssm[4]>$smiltxt{'11'}</option>
             </select>
         </td>
     </tr><tr>
         <td class="windowbg2" colspan="4"><label for="detachblock">$smiltxt{'12'}<br /> $smiltxt{'13'}</label></td>
         <td class="windowbg2" colspan="4"><input type="checkbox" name="detachblock" id="detachblock" value="1"$dblock /></td>
     </tr><tr>
         <td class="windowbg2" colspan="4"><label for="winwidth">$smiltxt{'14'}</label></td>
         <td class="windowbg2" colspan="4"><input type="text" size="10" name="winwidth" id="winwidth" value="$winwidth" /></td>
     </tr><tr>
         <td class="windowbg2" colspan="4"><label for="winheight">$smiltxt{'15'}</label></td>
         <td class="windowbg2" colspan="4"><input type="text" size="10" name="winheight" id="winheight" value='$winheight' /></td>
     </tr><tr>
         <td class="windowbg2" colspan="4"><label for="showinbox">$smiltxt{'23'}</label></td>
         <td class="windowbg2" colspan="4"><input type="radio" name="showinbox" id="showinbox" value=""~
               . ( !$showinbox ? ' checked="checked"' : q{} ) . qq~ /></td>
     </tr><tr>
         <td class="windowbg2" colspan="4">$smiltxt{'18'}</td>
         <td class="windowbg2" colspan="4">$yyhtml_root/Smilies</td>
     </tr><tr>
         <td class="windowbg2" colspan="4"><label for="popback">$smiltxt{'20'}</label></td>
         <td class="windowbg2" colspan="4">
         #<input type="text" size="10" name="popback" id="popback" value="$popback" onkeyup="previewColor(this.value);" />
             <span id="popback_color" style="background-color: #$popback;">&nbsp; &nbsp; &nbsp;</span> <img src="$admin_images/palette1.gif" style="cursor: pointer; vertical-align: top;" onclick="window.open('$scripturl?action=palette;task=templ', '', 'height=308,width=302,menubar=no,toolbar=no,scrollbars=no')" alt="" />
             <script type="text/javascript">
             function previewColor(color) {
                 color = color.replace(/\x23/, '');
                 document.getElementById('popback_color').style.background = '#' + color;
                 document.getElementsByName("popback")[0].value = color;
             }
             </script>
         </td>
     </tr><tr>
         <td class="windowbg2" colspan="4"><label for="poptext">$smiltxt{'19'}</label></td>
         <td class="windowbg2" colspan="4">
         #<input type="text" size="10" name="poptext" id="poptext" value="$poptext" onkeyup="previewColor_0(this.value);"/>
             <span id="poptext_color" style="background-color: #$poptext;">&nbsp; &nbsp; &nbsp;</span> <img src="$admin_images/palette1.gif" style="cursor: pointer; vertical-align: top;" onclick="window.open('$scripturl?action=palette;task=templ_0', '', 'height=308,width=302,menubar=no,toolbar=no,scrollbars=no')" alt="" />
             <script type="text/javascript">
             function previewColor_0(color) {
                 color = color.replace(/\x23/, '');
                 document.getElementById('poptext_color').style.background = '#' + color;
                 document.getElementsByName("poptext")[0].value = color;
             }
             </script>
         </td>
     </tr><tr>
         <td class="titlebg" colspan="8">&nbsp;<img src="$imagesdir/grin.gif" alt="" /><b>&nbsp;$asmtxt{'11'}</b></td>
     </tr><tr>
         <td class="catbg center small">$smiltxt{'22'}</td>
         <td class="catbg center small">$asmtxt{'02'}</td>
         <td class="catbg center small">$asmtxt{'03'}</td>
         <td class="catbg center small">$asmtxt{'04'}</td>
         <td class="catbg center small">$asmtxt{'05'}</td>
         <td class="catbg center small">$asmtxt{'06'}</td>
         <td class="catbg center small">$asmtxt{'07'}</td>
         <td class="catbg center small">$asmtxt{'12'}</td>
     </tr>~;
   
     $i = 0;
     my $add_smiley = 1;
     foreach (@SmilieURL) {
         if ( $i != 0 ) {
             $up =
  qq~<a href="$adminurl?action=smiliemove;index=$i;moveup=1"><img src="$imagesdir/smiley_up.gif" alt="$asmtxt{'13'}" title="$asmtxt{'13'}" /></a>~;
         }
         else {
             $up = qq~<img src="$imagesdir/smiley_up.gif" alt="" />~;
         }
         if ( $SmilieURL[ $i + 1 ] ) {
             $down =
  qq~<a href="$adminurl?action=smiliemove;index=$i;movedown=1"><img src="$imagesdir/smiley_down.gif" alt="$asmtxt{'14'}" title="$asmtxt{'14'}" /></a>~;
         }
         else {
             $down = qq~<img src="$imagesdir/smiley_down.gif" alt="" />~;
         }
         $yymain .= qq~<tr>
     <td class="windowbg2 center"><input type="radio" name="showinbox" value="$SmilieDescription[$i]"~
           . ( $showinbox eq $SmilieDescription[$i] ? ' checked="checked"' : q{} )
           . qq~ /></td>
     <td class="windowbg2 center"><input type="text" name="scd[$i]" value="$SmilieCode[$i]" /></td>
     <td class="windowbg2 center" style="white-space: nowrap;">
         <input type="file" name="smimg[$i]" id="smimg[$i]" size="35" />
         <input type="hidden" name="cur_smimg[$i]" value="$SmilieURL[$i]" /> <span class="cursor small bold" title="$admin_txt{'remove_file'}" onclick="document.getElementById('smimg[$i]').value='';">X</span>
         <div class="small bold">$admin_txt{'current_img'}: <a href="$yyhtml_root/Templates/Forum/default/$SmilieURL[$i]" target="_blank">$SmilieURL[$i]</a></div>
   </td>    </td>
 </tr><tr>     <td class="windowbg2 center"><input type="text" name="sdescr[$i]" value="$SmilieDescription[$i]" /></td> 
   <td class="windowbg2" colspan="4"><label for="showadded"><b>$smiltxt{'7'}</b></label></td>     <td class="windowbg2 center"><input type="checkbox" name="smbox[$i]" value="1"~ 
   <td class="windowbg2" colspan="4" align="right">           . ( $SmilieLinebreak[$i] eq '<br />' ? ' checked="checked"' : q{} ) 
     <select name="showadded" id="showadded">           . q~ /></td> 
       <option value="1"$sa1>$smiltxt{'8'}</option>     <td class="windowbg2 center"><img src="~ 
       <option value="2"$sa2>$smiltxt{'9'}</option>           . ( 
       <option value="3"$sa3>$smiltxt{'10'}</option>               $SmilieURL[$i] =~ /\//ixsm 
       <option value="4"$sa4>$smiltxt{'11'}</option>             ? $SmilieURL[$i] 
     </select>             : qq~$imagesdir/$SmilieURL[$i]~ 
           )
           . qq~" alt="" /></td>
     <td class="windowbg2 center"><input type="checkbox" name="delbox[$i]" value="1" /></td>
     <td class="windowbg2 center">$up $down</td>
   </tr>~;
         $i++;
         $add_smiley++;
     }
     my $added_smilies = $i;
     $yymain .= qq~<tr>
     <td class="titlebg" colspan="8">&nbsp;<img src="$imagesdir/grin.gif" alt="" /><b>&nbsp;$asmtxt{'08'}</b></td>
   </tr><tr>
     <td class="windowbg2 center">&nbsp;</td>
     <td class="windowbg2 center"><input type="text" name="scd[$i]" /></td>
     <td class="windowbg2 center" style="white-space: nowrap;"><input type="file" name="smimg[$i]" id="smimg[$i]" size="35" /> <span class="cursor small bold" title="$admin_txt{'remove_file'}" onclick="document.getElementById('smimg[$i]').value='';">X</span></td>
     <td class="windowbg2 center"><input type="text" name="sdescr[$i]" /></td>
     <td class="windowbg2 center"><input type="checkbox" name="smbox[$i]" value="1" /></td>
     <td class="windowbg2 center" colspan="3">
         <img src="$imagesdir/cat_expand.png" alt="$smiltxt{'25'}" title="$smiltxt{'25'}" class="cursor" style="visibility: visible;" id="add_smiley$i" onclick="addSmilies($add_smiley);" />
         <img src="$imagesdir/cat_collapse.png" alt="" style="visibility: hidden;" /> <!-- Used only for alignment purposes -->
   </td>    </td>
 </tr><tr>   </tr>~; 
   <td class="windowbg2" colspan="4"><label for="showsmdir"><b>$smiltxt{'2'}</b></label></td>     for ( 1 .. 4 ) { 
   <td class="windowbg2" colspan="4" align="right">         $i++; 
     <select name="showsmdir" id="showsmdir">         $add_smiley++; 
       <option value="1"$ssm1>$smiltxt{'8'}</option>         $yymain .= qq~<tr id="add_smilies$i" style="display: none;"> 
       <option value="2"$ssm2>$smiltxt{'9'}</option>     <td class="windowbg2 center">&nbsp;</td> 
       <option value="3"$ssm3>$smiltxt{'10'}</option>     <td class="windowbg2 center"><input type="text" name="scd[$i]" id="scd[$i]" /></td> 
       <option value="4"$ssm4>$smiltxt{'11'}</option>     <td class="windowbg2 center" style="white-space: nowrap;"><input type="file" name="smimg[$i]" id="smimg[$i]" size="35" /> <span class="cursor small bold" title="$admin_txt{'remove_file'}" onclick="document.getElementById('smimg[$i]').value='';">X</span></td> 
     </select>     <td class="windowbg2 center"><input type="text" name="sdescr[$i]" id="sdescr[$i]" /></td> 
     <td class="windowbg2 center"><input type="checkbox" name="smbox[$i]" id="smbox[$i]" value="1" /></td>
     <td class="windowbg2 center" colspan="3">
         <img src="$imagesdir/cat_expand.png" alt="$smiltxt{'25'}" title="$smiltxt{'25'}" class="cursor" style="visibility: visible;" id="add_smiley$i" onclick="addSmilies($add_smiley);" />
         <img src="$imagesdir/cat_collapse.png" alt="$smiltxt{'26'}" title="$smiltxt{'26'}" class="cursor" style="visibility: visible;" id="col_smiley$i" onclick="removeSmilies($i);" />
   </td>    </td>
   </tr>~;
  }
     $yymain .= qq~<tr>
     <td class="titlebg" colspan="8">&nbsp;<img src="$imagesdir/grin.gif" alt="" /><b>&nbsp;$smiltxt{'2'}</b></td>
 </tr><tr>  </tr><tr>
   <td class="windowbg2" colspan="4"><label for="detachblock"><b>$smiltxt{'12'}</b><br /> $smiltxt{'13'}</label></td>     <td class="catbg center small">$smiltxt{'22'}</td> 
   <td class="windowbg2" colspan="4" align="right"><input type="checkbox" name="detachblock" id="detachblock" value="1"$dblock /></td>     <td class="catbg center small">$asmtxt{'02'}</td> 
 </tr><tr>     <td class="catbg center small">$asmtxt{'03'}</td> 
   <td class="windowbg2" colspan="4"><label for="winwidth"><b>$smiltxt{'14'}</b></label></td>     <td class="catbg center small">$asmtxt{'04'}</td> 
   <td class="windowbg2" colspan="4" align="right"><input type="text" size="10" name="winwidth" id="winwidth" value="$winwidth" /></td>     <td class="catbg center small" colspan="4">$asmtxt{'06'}</td> 
 </tr><tr>   </tr>$smilieslist 
   <td class="windowbg2" colspan="4"><label for="winheight"><b>$smiltxt{'15'}</b></label></td>  
   <td class="windowbg2" colspan="4" align="right"><input type="text" size="10" name="winheight" id="winheight" value='$winheight' /></td>  
 </tr><tr>  
   <td class="windowbg2" colspan="4"><label for="showinbox"><b>$smiltxt{'23'}</b></label></td>  
   <td class="windowbg2" colspan="4" align="right"><input type="radio" name="showinbox" id="showinbox" value=""~ . (!$showinbox ? ' checked="checked"' : '') . qq~ /></td>  
 </tr><tr>  
   <td class="windowbg2" colspan="4"><b>$smiltxt{'18'}</b></td>  
   <td class="windowbg2" colspan="4" align="left">$smiliesurl</td>  
 </tr><tr>  
   <td class="windowbg2" colspan="4"><label for="popback"><b>$smiltxt{'20'}</b></label></td>  
   <td class="windowbg2" colspan="4" align="right">#<input type="text" size="10" name="popback" id="popback" value="$popback" /></td>  
 </tr><tr>  
   <td class="windowbg2" colspan="4"><label for="poptext"><b>$smiltxt{'19'}</b></label></td>  
   <td class="windowbg2" colspan="4" align="right">#<input type="text" size="10" name="poptext" id="poptext" value="$poptext" /></td>  
 </tr><tr>  
   <td class="catbg" align="center" colspan="8">  
   <input type="submit" value="$asmtxt{'09'}" class="button" />&nbsp;<input type="reset" value="$asmtxt{'10'}" class="button" /></td>  
 </tr>  
</table> </table>
  </div>
  <div class="bordercolor rightboxdiv">
  <table class="border-space pad-cell">
     <tr>
         <th class="titlebg">$admin_img{'prefimg'} $admin_txt{'10'}</th>
     </tr><tr>
         <td class="catbg center">
             <input type="hidden" name="smimg_count" value="$i" />
             <input type="submit" value="$asmtxt{'09'}" class="button" />&nbsp;<input type="reset" value="$asmtxt{'10'}" class="button" />
         </td>
     </tr>
  </table>
  </div>
  <script type="text/javascript">
  sm_added = $added_smilies + 1;
   
  function addSmilies(addsm_id) {
     var cursm_id = addsm_id - 1;
     var sm_count = $i;
     document.getElementById('add_smilies' + addsm_id).style.display = 'table-row';
     document.getElementById('add_smiley' + cursm_id).style.visibility = 'hidden';
     if (addsm_id != sm_added) {
         document.getElementById('col_smiley' + cursm_id).style.visibility =' hidden';
     }
     if (addsm_id == sm_count) {
         document.getElementById('add_smiley' + sm_count).style.visibility = 'hidden';
     }
  }
  function removeSmilies(remsm_id) {
     var prevsm_id = remsm_id - 1;
     document.getElementById('add_smilies' + remsm_id).style.display = 'none';
     document.getElementById('add_smiley' + prevsm_id).style.visibility = 'visible';
     if (remsm_id != sm_added) {
         document.getElementById('col_smiley' + prevsm_id).style.visibility = 'visible';
     }
     sm_elements = ["scd","smimg","sdescr"];
     for (var i=0; i<sm_elements.length; i++) {
         document.getElementById(sm_elements[i] + '[' + remsm_id + ']').value = '';
     }
     document.getElementById('smbox[' + remsm_id + ']').checked = false;
  }
  </script>
</form> </form>
~; ~;
   
           $yytitle     = "$asmtxt{'01'}";    $yytitle     = "$asmtxt{'01'}";
           $action_area = "smilies";     $action_area = 'smilies'; 
           &AdminTemplate;     AdminTemplate(); 
       }  
   }  
   
     return;
} }
   
sub AddSmilies { sub AddSmilies {
   &is_admin_or_gmod;     is_admin_or_gmod(); 
   
   $smiliestyle = $FORM{'smiliestyle'};  
   $showadded = $FORM{'showadded'};  
   $showsmdir = $FORM{'showsmdir'};  
   $detachblock = $FORM{'detachblock'};  
   $winwidth = $FORM{'winwidth'};  
   $winheight = $FORM{'winheight'};  
   $popback = $FORM{'popback'};  
   $popback =~ s/[^a-f0-9]//ig;  
   $poptext = $FORM{'poptext'};  
   $poptext =~ s/[^a-f0-9]//ig;  
   $showinbox = $FORM{'showinbox'};  
   $removenormalsmilies = $FORM{'removenormalsmilies'};  
   
   @SmilieURL = ();  
   @SmilieCode = ();  
   @SmilieDescription = ();  
   @SmilieLinebreak = ();  
   my $tempA = 0;  
   while (exists $FORM{"scd[$tempA]"}) {  
       unless ($FORM{"delbox[$tempA]"} || !$FORM{"smimg[$tempA]"}) {  
           push(@SmilieURL, $FORM{"smimg[$tempA]"});  
   
           &ToHTML($FORM{"scd[$tempA]"});  
           $FORM{"scd[$tempA]"} =~ s/\$/&#36;/g;  
           $FORM{"scd[$tempA]"} =~ s/\@/&#64;/g;  
           push(@SmilieCode, $FORM{"scd[$tempA]"});  
   
           &ToHTML($FORM{"sdescr[$tempA]"});  
           $FORM{"sdescr[$tempA]"} =~ s/\$/&#36;/g;  
           $FORM{"sdescr[$tempA]"} =~ s/\@/&#64;/g;  
           push(@SmilieDescription, $FORM{"sdescr[$tempA]"});  
   
           push(@SmilieLinebreak, ($FORM{"smbox[$tempA]"} ? "<br />" : ""));  
       }  
       ++$tempA;  
   }  
   
   require "$admindir/NewSettings.pl";     $smiliestyle = $FORM{'smiliestyle'}; 
   &SaveSettingsTo('Settings.pl');     $showadded   = $FORM{'showadded'}; 
     $showsmdir   = $FORM{'showsmdir'};
   $yySetLocation = qq~$adminurl?action=smilies~;     $detachblock = $FORM{'detachblock'}; 
   &redirectexit;     $winwidth    = $FORM{'winwidth'}; 
     $winheight   = $FORM{'winheight'};
     $popback     = $FORM{'popback'};
     $popback =~ s/[^a-f0-9]//igxsm;
     $poptext = $FORM{'poptext'};
     $poptext =~ s/[^a-f0-9]//igxsm;
     $showinbox           = $FORM{'showinbox'};
     $removenormalsmilies = $FORM{'removenormalsmilies'};
     $count_smimg = $FORM{'smimg_count'};
   
     if ( $winwidth  eq q{} ) { fatal_error('invalid_value', "$smiltxt{'14'}"); }
     if ( $winheight eq q{} ) { fatal_error('invalid_value', "$smiltxt{'15'}"); }
     if ( $popback   eq q{} ) { fatal_error('invalid_value', "$smiltxt{'20'}"); }
     if ( $poptext   eq q{} ) { fatal_error('invalid_value', "$smiltxt{'19'}"); }
   
     @SmilieURL         = ();
     @SmilieCode        = ();
     @SmilieDescription = ();
     @SmilieLinebreak   = ();
     my $temp_a = 0;
     for ( 1 .. $count_smimg ) {
         if ( $FORM{"scd[$temp_a]"} ne q{} || $FORM{"smimg[$temp_a]"} ne q{} || $FORM{"sdescr[$temp_a]"} ne q{} ) {
             if ( $FORM{"scd[$temp_a]"} eq q{} ) { fatal_error('', $smiltxt{'error_code'}); }
             if ( $FORM{"smimg[$temp_a]"} eq q{} && $FORM{"cur_smimg[$temp_a]"} eq q{} ) { fatal_error(q{}, $smiltxt{'error_image'}); }
             if ( $FORM{"sdescr[$temp_a]"} eq q{} ) { fatal_error('', $smiltxt{'error_desc'}); }
         }
         if ( $FORM{"delbox[$temp_a]"} != 1 && $FORM{"sdescr[$temp_a]"} ne q{} && ( $FORM{"smimg[$temp_a]"} ne q{} || $FORM{"cur_smimg[$temp_a]"} ne q{} ) ) {
             if ( $FORM{"smimg[$temp_a]"} ne q{} ) {
                 $FORM{"smimg[$temp_a]"} = UploadFile("smimg[$temp_a]", 'Templates/Forum/default', 'png jpg jpeg gif', '100', '0');
             }
             else {
                 $FORM{"smimg[$temp_a]"} = $FORM{"cur_smimg[$temp_a]"};
             }
             push @SmilieURL, $FORM{"smimg[$temp_a]"};
   
             ToHTML( $FORM{"scd[$temp_a]"} );
             $FORM{"scd[$temp_a]"} =~ s/\$/&\x2336;/gxsm;
             $FORM{"scd[$temp_a]"} =~ s/\@/&\x2364;/gxsm;
             push @SmilieCode, $FORM{"scd[$temp_a]"};
   
             ToHTML( $FORM{"sdescr[$temp_a]"} );
             $FORM{"sdescr[$temp_a]"} =~ s/\$/&\x2336;/gxsm;
             $FORM{"sdescr[$temp_a]"} =~ s/\@/&\x2364;/gxsm;
             push @SmilieDescription, $FORM{"sdescr[$temp_a]"};
   
             push @SmilieLinebreak, ( $FORM{"smbox[$temp_a]"} ? '<br />' : q{} );
         }
         if ( $FORM{"delbox[$temp_a]"} == 1 && $FORM{"cur_smimg[$temp_a]"} !~ /^(exclamation|question).png$/) {
             unlink "$htmldir/Templates/Forum/default/$FORM{\"cur_smimg[$temp_a]\"}";
         }
         ++$temp_a;
     }
   
     require Admin::NewSettings;
     SaveSettingsTo('Settings.pm');
   
     $yySetLocation = qq~$adminurl?action=smilies~;
     redirectexit();
     return;
} }
   
sub SmilieMove { sub SmilieMove {
   &is_admin_or_gmod;     is_admin_or_gmod(); 
   
   if (exists $INFO{'index'}) {  
       for (my $i = 0; $i < @SmilieURL; $i++) {  
           if ($i == $INFO{'index'} &&  
               (($INFO{'movedown'} && $i >= 0           && $i < $#SmilieURL) ||  
                ($INFO{'moveup'}   && $i <= $#SmilieURL && $i > 0))) {  
               my $j = $INFO{'moveup'} ? $i - 1 : $i + 1;  
   
               my $moveit = $SmilieURL[$i];  
               $SmilieURL[$i] = $SmilieURL[$j];  
               $SmilieURL[$j] = $moveit;  
   
               $moveit = $SmilieCode[$i];  
               $SmilieCode[$i] = $SmilieCode[$j];  
               $SmilieCode[$j] = $moveit;  
   
               $moveit = $SmilieDescription[$i];  
               $SmilieDescription[$i] = $SmilieDescription[$j];  
               $SmilieDescription[$j] = $moveit;  
   
               $moveit = $SmilieLinebreak[$i];  
               $SmilieLinebreak[$i] = $SmilieLinebreak[$j];  
               $SmilieLinebreak[$j] = $moveit;  
               last;  
           }  
       }  
   }  
   
   require "$admindir/NewSettings.pl";  
   &SaveSettingsTo('Settings.pl');  
   
   $yySetLocation = qq~$adminurl?action=smilies~;     if ( exists $INFO{'index'} ) { 
   &redirectexit;         for my $i ( 0 .. ( @SmilieURL - 1 ) ) { 
             if (
                 $i == $INFO{'index'}
                 && (   ( $INFO{'movedown'} && $i >= 0 && $i < $#SmilieURL )
                     || ( $INFO{'moveup'} && $i <= $#SmilieURL && $i > 0 ) )
               )
             {
                 my $j = $INFO{'moveup'} ? $i - 1 : $i + 1;
   
                 my $moveit = $SmilieURL[$i];
                 $SmilieURL[$i] = $SmilieURL[$j];
                 $SmilieURL[$j] = $moveit;
   
                 $moveit         = $SmilieCode[$i];
                 $SmilieCode[$i] = $SmilieCode[$j];
                 $SmilieCode[$j] = $moveit;
   
                 $moveit                = $SmilieDescription[$i];
                 $SmilieDescription[$i] = $SmilieDescription[$j];
                 $SmilieDescription[$j] = $moveit;
   
                 $moveit              = $SmilieLinebreak[$i];
                 $SmilieLinebreak[$i] = $SmilieLinebreak[$j];
                 $SmilieLinebreak[$j] = $moveit;
                 last;
             }
         }
     }
   
     require Admin::NewSettings;
     SaveSettingsTo('Settings.pm');
   
     $yySetLocation = qq~$adminurl?action=smilies~;
     redirectexit();
     return;
} }
   
1; 1;