Passing html

Permalink Browser Info Environment
Hi,

I can't seem to pass any html to the posting. It all gets stripped away. I'm using the following code:
$posting_type = array($pkgName, 'test_post', 'Updated Something', 'updated something %1$s', 1, 2);
$posting = '<a href="#">Hello World</a>';
...
$wall->postAndPossiblyRegister($uID, $posting, $posting_type);


Am I implementing this wrong?

Thanks!

Type: Discussion
Status: New
waynethorley
View Replies:
jshannon replied on at Permalink Reply
jshannon
Hi.

No. The stripping is intentional for security reasons.
waynethorley replied on at Permalink Reply
waynethorley
Ahh ok. So no way to stick an img tag in there?
jshannon replied on at Permalink Reply
jshannon
Not by calling postAndPossiblyRegister(), which you can think of as a "simple shortcut" method.

AddWithType() does take an option (array('sanitizeData' => false)) that will prevent the stripping of any tags.

If you'd like to use that, you basically have to recreate the postAndPossiblyRegister() functionality, which is only a few lines (see /controller.php):

public function postAndPossiblyRegister($uID, $data, $arrPostingType) {
        Loader::model('postings', 'lerteco_wall');
        $type = new LWPostingType();
        call_user_func_array(array($type, 'LoadOrUpdateOrRegister'), $arrPostingType);
        $post = new LWPosting();
        $post->AddWithType($type, $uID, $data);
    }


When you call $post->AddWithType() you would pass the array as the fourth option:

$post->AddWithType($type, $uID, $data, array('sanitizeData' => false));


**** Note that if you do this it's very important that you sanitize the data in some other way. *****

concrete5 Environment Information

Browser User-Agent String

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You have not specified a license for this support ticket. You must have a valid license assigned to a support ticket to request a refund.