1
RamteamJax
HTML Signature. Possible ?
  • 2014/1/2 17:52

  • RamteamJax

  • Just popping in

  • Posts: 47

  • Since: 2012/6/17


Hi.

I run a couple of websites using the infmamous (but in my opinion best CMS I've ever worked with) Xoops CMS and I've got a question.

I'm involved with a team of DJ's (mainly techno and tech house) and run a dedicated website including an online radiostream with all of our sets and released tracks.

Now, I'm willing to offer our members the option to post their Soundcloud and Mixcloud profiles in their signature, but I need to enable HTML for that.

I cannot find any option to allow this. Could anyone tell me how to do this ? Or, if so, why it's not possible/supported ?

Thanks in advance.

Cheers,
Jax

2
Mamba
Re: HTML Signature. Possible ?
  • 2014/1/7 16:42

  • Mamba

  • Moderator

  • Posts: 11409

  • Since: 2004/4/23


Quote:
Now, I'm willing to offer our members the option to post their Soundcloud and Mixcloud profiles in their signature, but I need to enable HTML for that.

I cannot find any option to allow this. Could anyone tell me how to do this ? Or, if so, why it's not possible/supported ?

I am not sure about it, but I don't think, it's possible. You can only do it with BBCodes.
I don't know the reason, but I assume, it was to avoid security risk - people could post some nasty HTML code and compromise the whole Website.
Support XOOPS => DONATE
Use 2.5.11 | Docs | Modules | Bugs

3
RamteamJax
Re: HTML Signature. Possible ?
  • 2014/1/8 12:55

  • RamteamJax

  • Just popping in

  • Posts: 47

  • Since: 2012/6/17


hmm yah, ok.
We've never had any issue on an 'underground' (meaning: private) tech site running legal vBulletin software. Barely everyone uses html signatures over there.

4
redheadedrod
Re: HTML Signature. Possible ?

A solution will require modifying the current code. Without looking at it I believe it is "sanitized" which means all HTML code is stripped out before saving it to the database.

I was supposed to do some major work with Profiile but due to a variety of issues I have not been able to do what I have planned. Once I have my computers back up and running properly I will see what I can do but I can't promise anything at this stage. When I look at it I can see what I can do with these fields.

Rodney

5
iHackCode
Re: HTML Signature. Possible ?

XOOPS BBCode for SoundCloud. (parts were taken from http://blog.soundcloud.com/2009/07/28/soundcloud-player-in-forums-5-step-guide-for-soundcloud-bb-code/)

*Download the soundcloud image for the text editor.

download http://bit.ly/tV7mm (from step 3 in the soundcloud blog) save it as soundcloud.png and upload it to yourdomain.com/images/form

*Go to your site and create a folder called soundcloud in:
yourdomain.com/class/textsanitizer

so it looks like
yourdomain.com/class/textsanitizer/soundcloud


* add two files to it

index.html
<script>history.go(-1);script>


soundcloud.php

class MytsSoundcloud extends MyTextSanitizerExtension
{
    function 
encode($textarea_id)
    {
        
$config parent::loadConfigdirname(__FILE__) );
        
$code "{$this->image_path}/soundcloud.png' alt='SoundCloud' onclick='xoopsCodeSoundCloud("{$textarea_id}","" . htmlspecialchars('Enter SoundCloud Profile URL', ENT_QUOTES) . "");'  onmouseover='style.cursor="hand"'/> ";
        
$javascript = <<            function xoopsCodeSoundCloud(id, enterSoundCloud)
            {
                var selection = xoopsGetSelect(id);
                if (selection.length > 0) {
                    var text = selection;
                } else {
                    var text = prompt(enterSoundCloud, "");
                }
                
                var domobj = xoopsGetElementById(id);
                xoopsInsertText(domobj, "[soundcloud]"+text+"[/soundcloud]");
                domobj.focus();
            }
EOH;

        return array(
$code$javascript);
    }

    function 
load(&$ts)
    {
        
$ts->patterns[] = "/[soundcloud](http[s]?://[^"'<>]*)(.*)[/soundcloud]/esU";
        $ts->replacements[] = __CLASS__ . "::decode('
\1\2')";
    }

    function decode($url)
    {
        $config = parent::loadConfig(dirname(__FILE__));
        if (!preg_match("/^http://(www.)?soundcloud.com/(.*)/i", $url, $matches)) {
            trigger_error("Not matched: {$url}", E_USER_WARNING);
            return "";
        }
        
        $code = '
<object height="81" width="100%"><param name="movie" value="http://player.soundcloud.com/player.swf?url='.$url.'&g=bb">';
        $code .= '
param><param name="allowscriptaccess" value="always">param>';
        $code .= '
<embed allowscriptaccess="always" height="81" src="http://player.soundcloud.com/player.swf?url='.$url.'&g=bb" type="application/x-shockwave-flash" width="100%">embed>object>';
        $code .= '
<a href="'.$url.'">'.$url.'a>';
        
        return $code;
    }
}
?>


I also included the soundcloud.php file here ->> https://gist.github.com/ihackcode/d46633276fe128d1ffc0

*edit this file yourdomain.com/class/textsanitizer/config.php

enable the soundcloud bbcode in the extensions array by adding this line

"soundcloud" => 1,

Example of including the element in the array
"extensions" => array(
        
"iframe" => 0,
        
"image" => 1,
        
"flash" => 1,
        
"youtube" => 1,
        
"mp3" => 0,
        
"wmp" => 0,
        
// If other module is used, please modify the following detection and 'link' in /wiki/config.php
        
"wiki" => is_dir(XOOPS_ROOT_PATH '/modules/mediawiki/'),
        
"mms" => 0,
        
"rtsp" => 0,
        
"soundcloud" => 1,
        
"ul" => 1,
        
"li" => 1),



now you should be able to use the SoundCloud bbcode.


6
geekwright
Re: HTML Signature. Possible ?

I've got a soft spot for DJ's and Musicians.

Just added your soundcloud tags to 2.5.7.

As to why straight HTML gets filtered out, it is possible to cause all sorts of mischief with that. It has to be limited to use safely, otherwise a site can be hacked fairly easily. It should be possible to apply HTMLPurifier to make accepting HTML safe, but currently, XOOPS relies on BB Code to keep things under control.

7
Cesagonchu
Re: HTML Signature. Possible ?

Thank you iHackCode and geekwright!

Login

Who's Online

466 user(s) are online (364 user(s) are browsing Support Forums)


Members: 0


Guests: 466


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