Recent Topics

1 Jan 26, 2009 16:44    

My b2evolution Version: 2.x

I was wondering if guest users or any user for that matter can embed pics in a comment? I have tried as a guest, user and admin and each says a character in the pic url is not allowed. This must be a permissions thing but I guess I don't know how to configure it.

2 Jan 26, 2009 16:55

Any chance of the full error ?

¥

3 Jan 26, 2009 17:12

Cannot post comment, please correct these errors:
Illegal tag: a

4 Jan 26, 2009 17:14

I'm trying to embed the pictures from photobucket and I'm using their provided links for blogs.

5 Jan 26, 2009 17:51

You can't use the <a> tag in comments by default, otherwise you;d get bitch slapped by spammers.

You can change that by editing a core file though ;)

¥

6 Jan 26, 2009 19:36

If I remove the <a> tag then it tells me the <img> tag is invalid. It keeps going down the list until I stip in to the point where all it shows is something like this in the post src="http://i617.photobucket.com/albums/tt251/kmizike/duncan_blg.jpg" border="0" alt="Photobucket">
and no picture just the link mumbo jumbo. Is there something I need to install that supports embedding pics?

7 Jan 26, 2009 20:04

Looks like all HTML is excluded from comments.

8 Jan 26, 2009 20:12

Is there a configuration change I need to make. I'm at a complete loss at the moment.

9 Jan 26, 2009 20:23

There's nothing I can see in the Admin section that would allow you to turn this on for comments. It looks like you would need to start hacking the code that is called when you try to save the a comment - need an expert to tell you where that is though (and how to do it).

[EDIT] Looks like it's calling htsrv/comment_post.php

10 Jan 26, 2009 20:48

Chris of Arabia wrote:

[EDIT] Looks like it's calling htsrv/comment_post.php

...but after that it dives right into the weeds and I haven't been able to track where it's checking for HTML code.

11 Jan 26, 2009 20:51

you need to hack /inc/xhtml_validator/_xhtml.dtd.inc.php ( approx 499 ) and make it look like this

$comments_allowed_tags += array
(
	'pre' => $C_E_Flow,
	'ins' => $C_E_Flow,
	'del' => $C_E_Flow,
	'a' => $C_E_a_content,  // Allowing this will call for a whole lot of comment spam!!!

You'll probably want to add img there as well ;)

¥

12 Jan 26, 2009 20:59

Glad someone came up with that, I could have wandered the code forests for weeks and only succeeded in finding the gingerbread house...

13 Jan 26, 2009 21:04

bugger, do you know how long I've spent looking fruitlessly for the gingerbread house? :'(

I wouldn't mind, but I'm not exactly fond of ginger :-S

¥

14 Jan 26, 2009 21:08

Mmmmm... chocolate ginger [sneaks off to fridge]

15 Jan 26, 2009 21:09

Just you wait until you next come back to blackpool :|

mmmmm ... chocolate :P

¥

16 Jan 26, 2009 21:30

ok here is that entire section of _xhtml.dtd.inc.php. I tried to make a few changes and I added the 'pre' and 'img' command but then it gave me an error saying img cannot have " " for alt src and something else. I'm new at this so....

$comments_allowed_tags += array
(
'ins' => $C_E_Flow,
'del' => $C_E_Flow,
// 'a' => $C_E_a_content, // Allowing this will call for a whole lot of comment spam!!!
'span' => $C_E_Iinline,
'bdo' => $C_E_Iinline,
'br' => '',
'em' => $C_E_Iinline,
'strong' => $C_E_Iinline,
'dfn' => $C_E_Iinline,
'code' => $C_E_Iinline,
'samp' => $C_E_Iinline,
'kbd' => $C_E_Iinline,
'var' => $C_E_Iinline,
'cite' => $C_E_Iinline,
'abbr' => $C_E_Iinline,
'acronym' => $C_E_Iinline,
'q' => $C_E_Iinline,
'sub' => $C_E_Iinline,
'sup' => $C_E_Iinline,
'tt' => $C_E_Iinline,
'i' => $C_E_Iinline,
'b' => $C_E_Iinline,
'big' => $C_E_Iinline,
'small' => $C_E_Iinline,
);

17 Jan 27, 2009 00:00

remove the first "//" from the last line of this bit

$comments_allowed_tags += array
(
'ins' Arrow $C_E_Flow,
'del' Arrow $C_E_Flow,
// 'a' Arrow $C_E_a_content, // Allowing this will call for a whole lot of comment spam!!! 

That'll allow <a> ;)

¥

18 Jan 27, 2009 16:13

I hate to be a pain in the you know what but when I remove the first 2 // this is the error I get:

Cannot post comment, please correct these errors:
Tag <a> may not have attribute target="..."
Illegal tag: img
[Back to comment editing]

Here is the exact link I'm pasting from photobucket:

<a href="http://s617.photobucket.com/albums/tt251/kmizike/?action=view&current=duncan_blg.jpg" target="_blank"><img src="http://i617.photobucket.com/albums/tt251/kmizike/duncan_blg.jpg" border="0" alt="Photobucket"></a>

19 Jan 27, 2009 17:00

thats a normal link. must be the code obviously.

20 Jan 27, 2009 18:24

target is not a valid xhtml attribute, just remove it from your link ;)

¥

21 Jan 27, 2009 18:52

so it works without the target?

22 Jan 27, 2009 19:08

It should do - _blank should send the image out into a new window, which I don't think is what is wanted in this instance. The only attribute an img tag needs is src to tell it where to find the image. The rest is erm... :oops: just window dressing.

23 Jan 27, 2009 19:10

Ok it still doesn't work and I'm gonna just say screw it or find someone to customize it for me. I want people to be able to come on and post pictures freely without any stupid BS, thanks for the help.

24 Jan 27, 2009 19:21

All you should need is the img part of that code to post the picture, thus:

<img src="http://i617.photobucket.com/albums/tt251/kmizike/duncan_blg.jpg">

The rest is just wrapping a hyperlink round the image to link it back to Photobucket.

So long as you've added the 'img' tag to the /inc/xhtml_validator/_xhtml.dtd.inc.php file, it should work. What does that section of code look like now, because if you just want to show the picture, you shouldn't need the 'a' tag activating in there.

25 Jan 27, 2009 19:35

This is what is says when I put in exactly what you have type:

Cannot post comment, please correct these errors:
Tag <img> may not have attribute src="..."

If I try it this way:

<img src="http://i617.photobucket.com/albums/tt251/kmizike/duncan_blg.jpg" alt="Me" title="Me" />

I get this error:

Cannot post comment, please correct these errors:
Tag <img> may not have attribute src="..."
Tag <img> may not have attribute alt="..."
Tag <img> may not have attribute title="..

26 Jan 27, 2009 19:36

Where and/or how do I change tag attributes?

27 Jan 27, 2009 19:43

Chris of Arabia wrote:

The rest is erm... :oops: just window dressing.

alt tags are pretty useful if you're using a screenreader ;)

Same file, add the last line ;)

/**
 * Array showing allowed attributes for tags.
 * @global array
 */
$comments_allowed_attributes = array
(
	'div' => $C_A_attrs,
	'img' => $C_A_attrs.' title alt style id class src',

And I'm guessing you're also going to want to change this line ( try without first ) ;)

$C_E_inline = 'a img '.$C_E_special.' '.$C_E_fontstyle.' '.$C_E_phrase;

¥

*edit*
Of course, the last line should read 'img' & not 'div' :P .. corrected post ;)

28 Jan 27, 2009 20:11

Ok I'm not real sure if I'm at the right spot. I am looking at lines 532-564 roughly and this is what I have:

/**
* Array showing allowed attributes for tags.
* @global array
*/
$comments_allowed_attributes = array
(
'p' => $C_A_attrs,
'ul' => $C_A_attrs,
'ol' => $C_A_attrs,
'li' => $C_A_attrs,
'dl' => $C_A_attrs,
'dt' => $C_A_attrs,
'dd' => $C_A_attrs,
'address' => $C_A_attrs,
'blockquote' => $C_A_attrs.' cite',
'ins' => $C_A_attrs.' cite datetime',
'del' => $C_A_attrs.' cite datetime',
'a' => $C_A_attrs.' charset type href hreflang rel rev shape coords',
'span' => $C_A_attrs,
'bdo' => $C_A_coreattrs.' lang xml:lang dir',
'br' => $C_A_coreattrs,
'em' => $C_A_attrs,
'strong' => $C_A_attrs,
'dfn' => $C_A_attrs,
'code' => $C_A_attrs,
'samp' => $C_A_attrs,
'kbd' => $C_A_attrs,
'var' => $C_A_attrs,
'cite' => $C_A_attrs,
'abbr' => $C_A_attrs,
'acronym' => $C_A_attrs,
'q' => $C_A_attrs.' cite',
'sub' => $C_A_attrs,
'sup' => $C_A_attrs,
'tt' => $C_A_attrs,
'i' => $C_A_attrs,
'b' => $C_A_attrs,
'big' => $C_A_attrs,
'small' => $C_A_attrs,
);

29 Jan 27, 2009 20:16

hehe, wonder if I've hacked mine in the past ? :P

Here's what I have, add the 'img' line anywhere after ( and before );

/**
 * Array showing allowed attributes for tags.
 * @global array
 */
$comments_allowed_attributes = array
(
	'div' => $C_A_attrs,
	'p' => $C_A_attrs,
	'ul' => $C_A_attrs,
	'ol' => $C_A_attrs,
	'li' => $C_A_attrs,
	'dl' => $C_A_attrs,
	'dt' => $C_A_attrs,
	'dd' => $C_A_attrs,
	'address' => $C_A_attrs,
	'blockquote' => $C_A_attrs.' cite',
	'ins' => $C_A_attrs.' cite datetime',
	'del' => $C_A_attrs.' cite datetime',
	'a' => $C_A_attrs.' charset type href hreflang rel rev shape coords',
	'span' => $C_A_attrs,
	'bdo' => $C_A_coreattrs.' lang xml:lang dir',
	'br' => $C_A_coreattrs,
	'em' => $C_A_attrs,
	'strong' => $C_A_attrs,
	'dfn' => $C_A_attrs,
	'code' => $C_A_attrs,
	'samp' => $C_A_attrs,
	'kbd' => $C_A_attrs,
	'var' => $C_A_attrs,
	'cite' => $C_A_attrs,
	'abbr' => $C_A_attrs,
	'acronym' => $C_A_attrs,
	'q' => $C_A_attrs.' cite',
	'sub' => $C_A_attrs,
	'sup' => $C_A_attrs,
	'tt' => $C_A_attrs,
	'i' => $C_A_attrs,
	'b' => $C_A_attrs,
	'big' => $C_A_attrs,
	'small' => $C_A_attrs,
);

¥

30 Jan 27, 2009 20:19

Looks right. Just add the img line Yabba showed above to the bottom of the list (though I don't believe the precise position matters), before the closing bracket

31 Jan 27, 2009 20:53

Ok thanks you guys its working good now. You both have been very helpful. I have a few more questions about b2evolution but they can wait awhile. Thanks again :D .

32 Jan 27, 2009 22:16

Always a bonus when we get it right :D

¥


Form is loading...