1
wizanda
!!!!!!Bug fix for xoopscodes.php for 2.0.13.2, ok in newer versions!!!!
  • 2006/5/4 14:49

  • wizanda

  • Home away from home

  • Posts: 1585

  • Since: 2004/3/21


Ok I have just spent the last day or so spring cleaning my site with tidy and firefox.

I noticed in the pm and new shoutbox I am about to release, that there was an error in xoopscodes with displaying more smilies.

Although this is fixed in later versions of xoops, as it is only a slight problem of removing an alt from a, with out a reason.
Then thats it fixed, here is the code for everyone to have:

include/xoopscodes.php


// $Id: xoopscodes.php,v 1.13.1 2004/12/26 19:11:51 Onokazu Exp $
//  ------------------------------------------------------------------------ //
//                XOOPS - PHP Content Management System                      //
//                    Copyright (c) 2000 XOOPS.org                           //
//                                                    //
//  ------------------------------------------------------------------------ //
//  This program is free software; you can redistribute it and/or modify     //
//  it under the terms of the GNU General Public License as published by     //
//  the Free Software Foundation; either version 2 of the License, or        //
//  (at your option) any later version.                                      //
//                                                                           //
//  You may not change or alter any portion of this comment or credits       //
//  of supporting developers from this source code or any supporting         //
//  source code which is considered copyrighted (c) material of the          //
//  original comment or credit authors.                                      //
//                                                                           //
//  This program is distributed in the hope that it will be useful,          //
//  but WITHOUT ANY WARRANTY; without even the implied warranty of           //
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            //
//  GNU General Public License for more details.                             //
//                                                                           //
//  You should have received a copy of the GNU General Public License        //
//  along with this program; if not, write to the Free Software              //
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
//  ------------------------------------------------------------------------ //
// Author: Kazumi Ono (AKA onokazu)                                          //
// URL: https://xoops.org/ http://www.xoopscube.jp/  http://www.myweb.ne.jp/  //
// Project: The XOOPS Project (
https://xoops.org/)                        //
// ------------------------------------------------------------------------- //

/*
*  displayes xoopsCode buttons and target textarea to which xoopscodes are inserted
*  $textarea_id is a unique id of the target textarea
*/
function xoopsCodeTarea($textarea_id$cols=60$rows=15$suffix=null)
{
    
$hiddentext = isset($suffix) ? 'xoopsHiddenText'.trim($suffix) : 'xoopsHiddenText';
    
//Hack for url, email ...., the anchor is for having a link on [_More...]
    
echo ".XOOPS_URL."/images/url.gif' alt='url' onmouseover='style.cursor="hand"' onclick='xoopsCodeUrl("$textarea_id", "".htmlspecialchars(_ENTERURL, ENT_QUOTES)."", "".htmlspecialchars(_ENTERWEBTITLE, ENT_QUOTES)."");'/> .XOOPS_URL."/images/email.gif' alt='email' onmouseover='style.cursor="hand"' onclick='xoopsCodeEmail("$textarea_id", "".htmlspecialchars(_ENTEREMAIL, ENT_QUOTES)."");' /> .XOOPS_URL."/images/imgsrc.gif' alt='imgsrc' onmouseover='style.cursor="hand"' onclick='xoopsCodeImg("$textarea_id", "".htmlspecialchars(_ENTERIMGURL, ENT_QUOTES)."", "".htmlspecialchars(_ENTERIMGPOS, ENT_QUOTES)."", "".htmlspecialchars(_IMGPOSRORL, ENT_QUOTES)."", "".htmlspecialchars(_ERRORIMGPOS, ENT_QUOTES)."");' /> .XOOPS_URL."/images/image.gif' alt='image' onmouseover='style.cursor="hand"' onclick='openWithSelfMain("".XOOPS_URL."/imagemanager.php?target=".$textarea_id."","imgmanager",400,430);' /> .XOOPS_URL."/images/code.gif' alt='code' onmouseover='style.cursor="hand"' onclick='xoopsCodeCode("$textarea_id", "".htmlspecialchars(_ENTERCODE, ENT_QUOTES)."");' /> .XOOPS_URL."/images/quote.gif' alt='quote' onmouseover='style.cursor="hand"' onclick='xoopsCodeQuote("$textarea_id");'/>n";

    
$sizearray = array("xx-small""x-small""small""medium""large""x-large""xx-large");
    echo 
".$textarea_id."Size' onchange='setVisible("xoopsHiddenText");setElementSize("".$hiddentext."",this.options[this.selectedIndex].value);'>n";
    echo 
""._SIZE."n";
    foreach ( 
$sizearray as $size ) {
        echo 
"$size'>$sizen";
    }
    echo 
"n";

    
$fontarray = array("Arial""Courier""Georgia""Helvetica""Impact""Verdana");
    echo 
".$textarea_id."Font' onchange='setVisible("xoopsHiddenText");setElementFont("".$hiddentext."",this.options[this.selectedIndex].value);'>n";
    echo 
""._FONT."n";
    foreach ( 
$fontarray as $font ) {
        echo 
"$font'>$fontn";
    }
    echo 
"n";

    
$colorarray = array("00""33""66""99""CC""FF");
    echo 
".$textarea_id."Color' onchange='setVisible("xoopsHiddenText");setElementColor("".$hiddentext."",this.options[this.selectedIndex].value);'>n";
    echo 
""._COLOR."n";
    foreach ( 
$colorarray as $color1 ) {
        foreach ( 
$colorarray as $color2 ) {
            foreach ( 
$colorarray as $color3 ) {
                echo 
".$color1.$color2.$color3."' style='background-color:#".$color1.$color2.$color3.";color:#".$color1.$color2.$color3.";'>#".$color1.$color2.$color3."n";
            }
        }
    }
    echo 
".$hiddentext."'>"._EXAMPLE."n";

    echo 
"n";
    
//Hack smilies move for bold, italic ...
    
$areacontent = isset( $GLOBALS[$textarea_id] ) ? $GLOBALS[$textarea_id] : '';
    echo 
".XOOPS_URL."/images/bold.gif' alt='bold' onmouseover='style.cursor="hand"' onclick='setVisible("".$hiddentext."");makeBold("".$hiddentext."");' /> .XOOPS_URL."/images/italic.gif' alt='italic' onmouseover='style.cursor="hand"' onclick='setVisible("".$hiddentext."");makeItalic("".$hiddentext."");' /> .XOOPS_URL."/images/underline.gif' alt='underline' onmouseover='style.cursor="hand"' onclick='setVisible("".$hiddentext."");makeUnderline("".$hiddentext."");'/> .XOOPS_URL."/images/linethrough.gif' alt='linethrough' onmouseover='style.cursor="hand"' onclick='setVisible("".$hiddentext."");makeLineThrough("".$hiddentext."");' /> .$textarea_id."Addtext' size='20' /> $textarea_id", "".$hiddentext."", "".htmlspecialchars(_ENTERTEXTBOX, ENT_QUOTES)."")' value='"._ADD."' />.$textarea_id."' name='".$textarea_id."' cols='$cols' rows='$rows'>".$areacontent."n";
    
//Fin du hack
}

/*
*  Displays smilie image buttons used to insert smilie codes to a target textarea in a form
* $textarea_id is a unique of the target textarea
*/
function xoopsSmilies($textarea_id)
{
    
$myts =& MyTextSanitizer::getInstance();
    
$smiles =& $myts->getSmileys();
    if (empty(
$smileys)) {
        
$db =& Database::getInstance();
        if (
$result $db->query('SELECT * FROM '.$db->prefix('smiles').' WHERE display=1')) {
            while (
$smiles $db->fetchArray($result)) {
            
//hack smilies move for the smilies !!
                
echo ".XOOPS_UPLOAD_URL."/".htmlspecialchars($smiles['smile_url'])."' border='0' onmouseover='style.cursor="hand"' alt='' onclick='xoopsCodeSmilie("".$textarea_id."", " ".$smiles['code']." ");' />";
            
//fin du hack
            
}
        }
    } else {
        
$count count($smiles);
        for (
$i 0$i $count$i++) {
            if (
$smiles[$i]['display'] == 1) {
            
//hack bis
                
echo ".XOOPS_UPLOAD_URL."/".$myts->oopsHtmlSpecialChars($smiles['smile_url'])."' border='0' alt='' onclick='xoopsCodeSmilie("".$textarea_id."", " ".$smiles[$i]['code']." ");' onmouseover='style.cursor="hand"' />";
            
//fin du hack
            
}
        }
    }
    
//hack for more
    
echo "hand"'  onclick='openWithSelfMain("".XOOPS_URL."/misc.php?action=showpopups&type=smilies&target=".$textarea_id."","smilies",300,475);'>"._MORE."";
}  
//fin du hack
?>



p.s the error is also still on xoops.org, what do I do, as I become a better programmer, and can help more? When I find things like this?

Login

Who's Online

259 user(s) are online (130 user(s) are browsing Support Forums)


Members: 0


Guests: 259


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits