summary refs log tree commit diff stats
path: root/includes/bbcode.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/bbcode.php')
-rwxr-xr-xincludes/bbcode.php10
1 files changed, 6 insertions, 4 deletions
diff --git a/includes/bbcode.php b/includes/bbcode.php index e4b3d7f..40533a3 100755 --- a/includes/bbcode.php +++ b/includes/bbcode.php
@@ -68,8 +68,9 @@ class BBCode
68 while (strpos($to_parse, '[' . $name . ']') !== FALSE) 68 while (strpos($to_parse, '[' . $name . ']') !== FALSE)
69 { 69 {
70 $bbcode_uid = unique_id(); 70 $bbcode_uid = unique_id();
71 $to_parse = substr_replace($to_parse, '[' . $name . ':' . $bbcode_uid . ']', strpos($to_parse, '[' . $name . ']'), strlen($name) + 2); 71 $bbpos = strpos($to_parse, '[' . $name . ']');
72 $to_parse = substr_replace($to_parse, '[/' . $name . ':' . $bbcode_uid . ']', strpos($to_parse, '[/' . $name . ']'), strlen($name) + 3); 72 $to_parse = substr_replace($to_parse, '[' . $name . ':' . $bbcode_uid . ']', $bbpos, strlen($name) + 2);
73 $to_parse = substr_replace($to_parse, '[/' . $name . ':' . $bbcode_uid . ']', strpos(substr($to_parse, $bbpos), '[/' . $name . ']') + $bbpos, strlen($name) + 3);
73 74
74 $value = str_replace('{CONTENT}', '\1', $value); 75 $value = str_replace('{CONTENT}', '\1', $value);
75 $to_parse = preg_replace('/\[' . $name . ':' . $bbcode_uid . '\](.*)\[\/' . $name . ':' . $bbcode_uid . '\]/', $value, $to_parse); 76 $to_parse = preg_replace('/\[' . $name . ':' . $bbcode_uid . '\](.*)\[\/' . $name . ':' . $bbcode_uid . '\]/', $value, $to_parse);
@@ -81,8 +82,9 @@ class BBCode
81 while (strpos($to_parse, '[' . $name . '=') !== FALSE) 82 while (strpos($to_parse, '[' . $name . '=') !== FALSE)
82 { 83 {
83 $bbcode_uid = unique_id(); 84 $bbcode_uid = unique_id();
84 $to_parse = substr_replace($to_parse, '[' . $name . ':' . $bbcode_uid . '=', strpos($to_parse, '[' . $name . '='), strlen($name) + 2); 85 $bbpos = strpos($to_parse, '[' . $name . '=');
85 $to_parse = substr_replace($to_parse, '[/' . $name . ':' . $bbcode_uid . ']', strpos($to_parse, '[/' . $name . ']'), strlen($name) + 3); 86 $to_parse = substr_replace($to_parse, '[' . $name . ':' . $bbcode_uid . '=', $bbpos, strlen($name) + 2);
87 $to_parse = substr_replace($to_parse, '[/' . $name . ':' . $bbcode_uid . ']', strpos(substr($to_parse, $bbpos), '[/' . $name . ']') + $bbpos, strlen($name) + 3);
86 88
87 $value = str_replace('{PARAM}', '\1', $value); 89 $value = str_replace('{PARAM}', '\1', $value);
88 $value = str_replace('{CONTENT}', '\2', $value); 90 $value = str_replace('{CONTENT}', '\2', $value);