|
Joined: Jun 2006
Posts: 33
newbie
|
newbie
Joined: Jun 2006
Posts: 33 |
I am putting together a regional geocaching forum, and i would like to allow my users to show their geocaching.com stats image in their signatures. A typical image is like this (mine): http://img.geocaching.com/stats/img...uid=8386c231-1288-4c0f-93ae-0accf136bd15The default behavior of ubbthreads is to disallow images without an image extension. In a similar request made by someone else here back in October, Rick said: I'll have to put in an option. Right now it checks to see if the image is being generated by a script as a security precaution.
If you're comfortable with regex, it's blocked on line 639 of libs/bbcode.inc.php. I'm not particularly comfortable with regular expressions, but that code currently reads: function handle_img($url, $align="", $bypass_filter = false) {
if ($this->total_images >= $this->image_limit || (!$bypass_filter && !preg_match('#^[^\[\'"\]]+?\.(gif|png|jpg|jpeg)$#i', $url))) {
if ($align != "") {
return sprintf('[img:%s]%s[/img]', $align, $url);
} else {
return sprintf('[img]%s[/img]', $url);
}
}
I don't know if $bypass_filter was inserted after that October post or not, but changing it to true does allow images without extensions. I do not, however find where that option can be changed except by hacking the file, nor am I sure that it is not causing some other problem (besides the possible security issue) when I do. What can anyone tell me about this?
|
|
|
|
Joined: Jun 2006
Posts: 16,299 Likes: 116
|
Joined: Jun 2006
Posts: 16,299 Likes: 116 |
You could just build a custom tag for the geocache image via the CP (Tools & Info -> Content Rebuilder -> Custom Tag Editor)
|
|
|
|
Joined: Jun 2006
Posts: 33
newbie
|
newbie
Joined: Jun 2006
Posts: 33 |
Hmm. OK, I'm not sure what all I'm going to need for the markup in order to embed the image. New stuff for me. When I use: <img src="http://img.geocaching.com/stats/img.aspx?txt=View+my+profile&uid=\\1"> and enter the uid all I get is the uid between my beginning and ending tags.
|
|
|
|
Joined: Jun 2006
Posts: 33
newbie
|
newbie
Joined: Jun 2006
Posts: 33 |
OK, just had to keep plugging away at it. The following worked, displaying the image and linking it to the geocaching profile. Your examples over at UBBDev were most helpful. <?php
$export_tags = array (
0 =>
array (
'tag' => 'GeoStat',
'descrip' => 'Geocaching Stats',
'prompt' => 'Your Geocaching.com uid, like xxxxxx-xxxx-xxxx-xxxx-xxxxx',
'regex' => '([a-f0-9-]+)',
'markup' => '<a href=\\"http://www.geocaching.com/profile/?guid=\\\\1"><img src=\\"http://img.geocaching.com/stats/img.aspx?txt=View+my+profile&uid=\\\\1">',
),
);
?>
|
|
|
|
Joined: Jun 2006
Posts: 33
newbie
|
newbie
Joined: Jun 2006
Posts: 33 |
Of course I spoke too soon the GeoStat tag works within the body of a message, but not in signatures, which is where I particularly wanted to use it. I was able to work around that by commenting out the lines in html.inc.php that disallow custom tags in a signature. Since this is the only custom tag I have enabled it shouldn't be an issue.
|
|
|
|
Joined: Jun 2006
Posts: 16,299 Likes: 116
|
Joined: Jun 2006
Posts: 16,299 Likes: 116 |
Looks good Don; glad my examples proved useful .
|
|
|
Bots
by Outdoorking - 04/13/2024 5:08 PM
|
|
|
|
|
|
|
|