Sniper_E wrote:@ Krupski - Your codes gave errors.
CoC's codes worked perfect.

We have a winner!
I think you may have gotten errors because the file 'root/includes/acp/acp_bbcodes.php' has an error in it and because I should have used "{TEXT}" instead of "{URL}".
Here's the ORIGINAL part (from version 3.07-PL1) (approximately at line 411):
- Code: Select all
'TEXT' => array(
'!(.*?)!es' => "str_replace(array(\"\\r\\n\", '\\\"', '\\'', '(', ')'), array(\"\\n\", '\"', ''', '(', ')'), trim('\$1'))"
),
The escaped quotes and backslashes are done wrong. Also, the single quote character is handled wrong.
This is how I changed the part above to fix it:
- Code: Select all
'TEXT' => array(
'!(.*?)!es' => "str_replace(array('\\r\\n', '\"', '\'', '(', ')'), array('\\n', '"', ''', '(', ')'), trim('\$1'))"
),
I have also totally re-done my Video BBCode so that it can handle Youtube or Photobucket by using the large "Embed" strings they provide. The BBCode supports lines that typically look like this:
From YouTube (called "EMBED"):- Code: Select all
<object width="640" height="505"><param name="movie" value="http://www.youtube.com/v/2dHG8jf3Mew&hl=en_US&fs=1&"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/2dHG8jf3Mew&hl=en_US&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="505"></embed></object>
From PhotoBucket (called "HTML Code"):- Code: Select all
<embed width="600" height="361" type="application/x-shockwave-flash" allowFullscreen="true" allowNetworking="all" wmode="transparent" src="http://static.photobucket.com/player.swf?file=http://vid0006.photobucket.com/albums/0006/pbhomepage/mommynolove.flv&sr=1">
Here's the BBCode to support both formats shown above:
BBCode Usage:
- Code: Select all
[Video]{TEXT}[/Video]
HTML Replacement:
- Code: Select all
<script type="text/javascript" />
<!--hide from old browsers
var n=0;
var str='{TEXT}';
var src=[/<br \/>/g, /</g, />/g, /&/g, /"/g, /"/g, /'/g, /(/g, /)/g];
var dst=["\n", "<", ">", "&", "\"", "\"", "\'", "(", ")"];
for(n=0; n<src.length; n++) { str=str.replace(src[n], dst[n]); }
if((str.toLowerCase(str).search('application/x-shockwave-flash') | str.toLowerCase(str).search('<embed')) < 0)
{ alert('Error: You may only use the <embed> version of video code!'); } else { document.write(str); }
//-->
</script />
Help line:
- Code: Select all
Embed YouTube or Photobucket: [Video]<embed> code[/Video]
Note: The "document.write() call COULD be a security risk by allowing a user to embed other HTML code which is why the script explicitly checks for "application/x-shockwave-flash" and "<embed" in the string and fails if they are not found.
Whether or not a clever person could write malicious code AND embed a dummy "application/x-shockwave-flash" and "<embed" string in it to trick the script I do not know... that's up to smarter people than me to decide.
Anyway, take a look into the ''root/includes/acp/acp_bbcodes.php' file and see if you agree that the original is wrong and if my fix is right. I had problems with single quotes transforming into "\\'" and messing up contractions, as well as the presence of single quotes simply causing video uploads to fail (I think because the PHP code saw the inline single quote as a mistaken string terminator). ???
Hopefully this helps someone.
(edit to add): The canned line
'Error: You may only use the <embed> version of video code!' in the script above COULD be replaced with
'{L_ERR_EMBED_ONLY}' IF the following line is
ADDED to
'/root/language/your_language/common.php':
Find:- Code: Select all
'ERR_CONNECTING_SERVER'
Add on a new line AFTER:- Code: Select all
'ERR_EMBED_ONLY' => 'Error: You may only use the <embed> version of video code!',
Obviously the error message string would be in the language desired.
(end of edit)-- Roger