shrek Wrote:nope. that didn't work either
is this wrong too ?
\[center\](.*?)\[/center\]
<center>$1</center>
coz this doesn't work either..
I tested on my board and it worked successfully.
And actually, you can just use
hello!
[align=center][/align]
to center the words.
lol. i found out why that url code wont work. because regular expression is wrong.
the code should be ; \[url=(.*?)\](.*?)\[\/url\] .
thanks everyone. it works now
But there is already an url mycode
CraKteR Wrote:But there is already an url mycode
Apparently he wants support for [url="http://example.com"] but MyBB doesn't support the quotes...
NOTICE NOTICE.
Guys. I find this topice just now.
Many of you,dont note to security in Custom Tags. When you'r creating a custom tag that have some variables INSIDE of html tags, for example <a href="XXXXX" title="YYYYY">blab blab</a> you should not that XX and YY have some conditions for security reasons. they sould not have " because if so they will exploit by XSS techniques by bad guys. Also if they have [ there is a chance that nested tags became a danger of XSS hacking for your board.
So a safe custom tage have such conditions :
we wana make a tag for tooltip, so we should use <span title="XXXX">blab blab</a>
RegExp:
\[tooltip=([^"[]+?)\](.*)\[/tooltip]
Replacement:
<span title="$1">$2</span>
and works well and more secure.
WDZ Wrote:CraKteR Wrote:But there is already an url mycode
Apparently he wants support for [url="http://example.com"] but MyBB doesn't support the quotes...
It supports, but bad support! in fact it is converted this way: <a href="
"http://example.com"" >blabblab</a>
and you know, it is a bad html, it can be worse if you hit by an attacker.
a good Regexp for your purpose is:
\[url=(["']?)([^"'[]+?)\\1\](.*?)\[\/url\]
<a href="$2">$3</a>
it will support:
[u rl="blab"]xx[/url]
[u rl='blab']xx[/url]
[u rl=blab]xx[/url]
but not support: {you may not do that by mybb standard.}
[url="bl"ab"]xx[/url]
[url="bl'ab"]xx[/url]
[url=blab"]xx[/url]
[url="blab]xx[/url]
[url="bl[ab"]xx[/url]
NOTE NOTE: it is not still completely safe against XSS:
[url="javascript:alert(1)"]xx[/url]
but there is a chance that this code if have not a trick agains fixjavascript() function of mybb, became safe...
Quote:Ah, so in the next release, my javascript will work?
That change is in 1.2.1 for your information - so you should be able to use Javascript in your custom MyCode.
Is it possible to, say, insert PHP code into a MyCode so that, for example, I could use the PHP function rand() and have the output of that function be output. When I try to set this up how it ought to look just as a script I get weird answers.
Like...
<?php $var = rand(1,20) ?> $var
I would
think based on how it
looks like this works that should just put the number that was gotten from the random, but what I get is just
Quote:$var
.
Am I just not getting something about PHP and/or HTML or is this something more to do with how MyCode works?
Hey, how do you add the Custom MyCode links to the Posting Pages?
Like say, Underneath the Smilies. I just made one to insert YouTube videos.
I think I made a better way for flash files, this supports width and height and is less confusing. its like this.
[flash width=WIDTH height=HEIGHT]FLASH URL[/flash]
Expression:
\[flash width\=(.*?) height\=(.*?)\](.*?)\[/flash\]
Replacement:
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0" width="$1" height="$2">
<param name="movie" value="$3">
<param name="quality" value="high">
<embed src="$3" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="$1" height="$2">
</embed>
</object>
If that doesn't work then I don't know what will.
And for Youtube Videos.
[youtube]YouTube ID Tag eg: GHfasidfs-dfu[/youtube]
The Id tag is that little jumbled up piece of text that appears at the end of the youtube Url.
Extension:
\[youtube\](.*?)\[/youtube\]
Replacement:
<object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/$1"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/$1" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object>
How would I add mycode that would find [!HA] and replace it with a picture, like
www.mysite.com/HA.png?
Thnx
Skilly