Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Inconsistent use of $defaultimagesdir $imagesdir (Read 2617 times)
Monni
Senior Member
****
Offline


Min izāmō

Posts: 413
Location: Kaarina, Finland
Joined: Jul 16th, 2014
Gender: Male
Re: Inconsistent use of $defaultimagesdir $imagesdir
Reply #3 - Oct 12th, 2014 at 3:13pm
Print Post  
I think it's case of newbie developer eating full box of ibuprofen because of evil headache...
  
Back to top
IP Logged
 
Dandello
Forum Administrator
*****
Offline


I love YaBB 2.7!

Posts: 1759
Location: The Land of YaBB
Joined: Feb 12th, 2014
Gender: Female
Re: Inconsistent use of $defaultimagesdir $imagesdir
Reply #2 - Oct 12th, 2014 at 3:04pm
Print Post  
I need to check on the smilies - the ImgLoc function checks image locations when the code is
Code (HTML)
Select All
<img src= 

for the image. But it doesn't catch background image calls. I don't remember exactly and have to double check if it catches smiley locations. (Some of this code may be from before the ImgLoc function was added - whenever that was. It's a case of fresh eyes seeing inconsistencies and asking good questions.)
  

Perfection is not possible. Excellence, however, is excellent.
Back to top
WWW  
IP Logged
 
Monni
Senior Member
****
Offline


Min izāmō

Posts: 413
Location: Kaarina, Finland
Joined: Jul 16th, 2014
Gender: Male
Re: Inconsistent use of $defaultimagesdir $imagesdir
Reply #1 - Oct 12th, 2014 at 2:57pm
Print Post  
Code
Select All
Index: cgi-bin/yabb2/Admin/Smilies.pm
===================================================================
--- cgi-bin/yabb2/Admin/Smilies.pm	(revision 1592)
+++ cgi-bin/yabb2/Admin/Smilies.pm	(working copy)
@@ -180,6 +180,18 @@
         else {
             $down = qq~<img src="$imagesdir/smiley_down.gif" alt="" />~;
         }
+        if ( $SmilieURL[$i] =~ /\//ixsm )
+        {
+            $SmileyURL = $SmilieURL[$i];
+        }
+        else {
+            $SmileyURL = qq~$yyhtml_root/Templates/Forum/$usestyle/$SmilieURL[$i]~;
+            if ( !-e ("$htmldir/Templates/Forum/$usestyle/$SmilieURL[$i]")
+            )
+            {
+                $SmileyURL = qq~$yyhtml_root/Templates/Forum/default/$SmilieURL[$i]~;
+            }
+        }
         $yymain .= qq~<tr>
     <td class="windowbg2 center"><input type="radio" name="showinbox" value="$SmilieDescription[$i]"~
           . ( $showinbox eq $SmilieDescription[$i] ? ' checked="checked"' : q{} )
@@ -188,19 +200,13 @@
     <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>
+        <div class="small bold">$admin_txt{'current_img'}: <a href="$SmileyURL" target="_blank">$SmilieURL[$i]</a></div>
     </td>
     <td class="windowbg2 center"><input type="text" name="sdescr[$i]" value="$SmilieDescription[$i]" /></td>
     <td class="windowbg2 center"><input type="checkbox" name="smbox[$i]" value="1"~
           . ( $SmilieLinebreak[$i] eq '<br />' ? ' checked="checked"' : q{} )
           . q~ /></td>
-    <td class="windowbg2 center"><img src="~
-          . (
-              $SmilieURL[$i] =~ /\//ixsm
-            ? $SmilieURL[$i]
-            : qq~$imagesdir/$SmilieURL[$i]~
-          )
-          . qq~" alt="" /></td>
+    <td class="windowbg2 center"><img src="$SmileyURL" alt="" /></td>
     <td class="windowbg2 center"><input type="checkbox" name="delbox[$i]" value="1" /></td>
     <td class="windowbg2 center">$up $down</td>
   </tr>~;
 

  
Back to top
IP Logged
 
Monni
Senior Member
****
Offline


Min izāmō

Posts: 413
Location: Kaarina, Finland
Joined: Jul 16th, 2014
Gender: Male
Inconsistent use of $defaultimagesdir $imagesdir
Oct 12th, 2014 at 2:35pm
Print Post  
Code
Select All
Index: cgi-bin/yabb2/Sources/DoSmilies.pm
===================================================================
--- cgi-bin/yabb2/Sources/DoSmilies.pm	(revision 1592)
+++ cgi-bin/yabb2/Sources/DoSmilies.pm	(working copy)
@@ -28,7 +28,7 @@
     $i                 = 0;
     while ( $SmilieURL[$i] ) {
         if ( $SmilieURL[$i] =~ /\//ixsm ) { $tmpurl = $SmilieURL[$i]; }
-        else { $tmpurl = qq~$defaultimagesdir/$SmilieURL[$i]~; }
+        else { $tmpurl = qq~$imagesdir/$SmilieURL[$i]~; }
         if ( $i && ( $i / 10 ) == int( $i / 10 ) ) {
             $moresmilieslist .= q~<br />~;
         }
@@ -101,7 +101,7 @@
             }
             else { $smiliescolor = $my_smiliebg_b; }
             if ( $SmilieURL[$i] =~ /\//ixsm ) { $tmpurl = $SmilieURL[$i]; }
-            else { $tmpurl = qq~$defaultimagesdir/$SmilieURL[$i]~; }
+            else { $tmpurl = qq~$imagesdir/$SmilieURL[$i]~; }

             $smilieslist .= $my_smilie_window_td;
             $smilieslist =~ s/{yabb smiliescolor}/$smiliescolor/gsm;
Index: cgi-bin/yabb2/Sources/InstantMessage.pm
===================================================================
--- cgi-bin/yabb2/Sources/InstantMessage.pm	(revision 1592)
+++ cgi-bin/yabb2/Sources/InstantMessage.pm	(working copy)
@@ -771,7 +771,7 @@
     if ( $showadded == 2 ) {
         while ( $SmilieURL[$i] ) {
             if ( $SmilieURL[$i] =~ /\//ism ) { $tmpurl = $SmilieURL[$i]; }
-            else { $tmpurl = qq~$defaultimagesdir/$SmilieURL[$i]~; }
+            else { $tmpurl = qq~$imagesdir/$SmilieURL[$i]~; }
             $smilie_url_array .= qq~"$tmpurl", ~;
             $tmpcode = $SmilieCode[$i];
             $tmpcode =~ s/\&quot;/"+'"'+"/gsm;    # "'
Index: cgi-bin/yabb2/Sources/Post.pm
===================================================================
--- cgi-bin/yabb2/Sources/Post.pm	(revision 1592)
+++ cgi-bin/yabb2/Sources/Post.pm	(working copy)
@@ -987,7 +987,7 @@
                     if ( $SmilieURL[$i] =~ /\//ism ) {
                         $tmpurl = $SmilieURL[$i];
                     }
-                    else { $tmpurl = qq~$defaultimagesdir/$SmilieURL[$i]~; }
+                    else { $tmpurl = qq~$imagesdir/$SmilieURL[$i]~; }
                     $smilie_url_array .= qq~"$tmpurl", ~;
                     $tmpcode = $SmilieCode[$i];
                     $tmpcode =~ s/\&quot;/"+'"'+"/gxsm;
 



Not sure if these need check if file actually exists in current theme.
  
Back to top
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint