1 (edited by zoluti 2009-11-01 06:53:30)

Topic: How do I add/authorize Flash objects?

First off, many thanks to Dr Patnaik for htmLawed. I'm a newbie here, so pardon me if I have posted this in the wrong place.

So I went through the Authorizing Flash objects topic, but am still unable to embed videos (add flash objects) and as the topic was closed, I'm posting this topic out here.  I've removed the safe mode option ('safe' => 0) and modified the config portion of my code as mentioned in the above thread but to no avail.

Following is the class (it's for a CMS that uses htmLawed together with Inspekt). I've been told that I need to tinker with the following snippet of code. As I'm not a programmer, I'd be glad if someone could help/tell me which lines of the following code do I need to change and with what.

class getHtmLawed extends AccessorAbstract {

   /**
    * a function to filter HTML
    *
    * @return string
    */
    protected function inspekt($text)
    {
        $config = array('safe' => 1);
        
        require_once(EXTENSIONS . 'htmLawed/htmLawed.php');
        
        if (!get_magic_quotes_gpc()) {
            return htmLawed($text, $config);
        }
        else 
        {
            return htmLawed(stripslashes($text), $config);
        }
        return false;
   }
}  

I've modified the 'config' portion of the above class like this:

$config = array(
 'comments'=>0,
 'cdata'=>0,
 'deny_attribute'=>'on*',
 'elements'=>'*-applet-iframe-embed-script', // object, embed allowed
 'schemes'=>'class:clsid; href: aim, feed, file, ftp, gopher, http, https, irc, mailto, news, nntp, sftp, ssh, telnet; style: nil; *:file, http, https' // clsid allowed in class
);

I'd be very grateful if someone could help out.
Again, many thanks for htmLawed.

2

Re: How do I add/authorize Flash objects?

The code in the posting you refer to had an error: 'class' instead of 'classid' in 'schemes.' I have corrected that now.

Let me know if this fixes the issue.

3

Re: How do I add/authorize Flash objects?

Thanks for the reply. So in the above code, I change

'schemes'=>'class:clsid;

to

'schemes'=>'class:class;

?

4

Re: How do I add/authorize Flash objects?

'schemes'=>'class:clsid;

to

'schemes'=>'classid:clsid;

5

Re: How do I add/authorize Flash objects?

Hi Dr. Patnaik, the CMS in question is a new one, Hotaru CMS (http://hotarucms.org), and with the advice here, I got YouTube videos working. Here's the code for an example video:

<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/zXqHfHN9dJs&hl=en&fs=1&"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/zXqHfHN9dJs&hl=en&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object>

Here are the configuration settings that worked for me. Note that I removed "embed" from "elements" in the code posted by zoluti above:

       

$config = array(
         'comments'=>0,
         'cdata'=>0,
         'deny_attribute'=>'on*',
         'elements'=>'*-applet-iframe-script', // object, embed allowed
         'schemes'=>'classid:clsid; href: aim, feed, file, ftp, gopher, http, https, irc, mailto, news, nntp, sftp, ssh, telnet; style: nil; *:file, http, https' // clsid allowed in classid
        );

Hotaru CMS is open source under the GNU General Public Licence v.3, but please let me know if there are any issues regarding our use of htmLawed in it.

Thanks again,
Nick.

6

Re: How do I add/authorize Flash objects?

Thanks Nick, it works fine now.  Dr Patnaik, many thanks for helping out.