diff --git a/.gitignore b/.gitignore
index e9e8a466..c299b95d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,7 +4,7 @@ Thumbs.db
#
/.htaccess
-lua
+/lua
# composer
composer.lock
@@ -24,6 +24,7 @@ releases
tmp
config.local.php
+config2.local.php
# all custom templates
templates/*
diff --git a/system/libs/forum.php b/system/libs/forum.php
index c7d7c438..21c43fdf 100644
--- a/system/libs/forum.php
+++ b/system/libs/forum.php
@@ -230,6 +230,7 @@ class Forum
if(!is_int($rows / 2)) { $bgcolor = 'ABED25'; } else { $bgcolor = '23ED25'; } $rows++;
$text = str_ireplace('[code]'.$code.'[/code]', 'Code:
', $text);
}
+
$rows = 0;
while(stripos($text, '[quote]') !== false && stripos($text, '[/quote]') !== false )
{
@@ -237,11 +238,31 @@ class Forum
if(!is_int($rows / 2)) { $bgcolor = 'AAAAAA'; } else { $bgcolor = 'CCCCCC'; } $rows++;
$text = str_ireplace('[quote]'.$quote.'[/quote]', '', $text);
}
- $rows = 0;
- while(stripos($text, '[url]') !== false && stripos($text, '[/url]') !== false )
- {
- $url = substr($text, stripos($text, '[url]')+5, stripos($text, '[/url]') - stripos($text, '[url]') - 5);
- $text = str_ireplace('[url]'.$url.'[/url]', ''.$url.'', $text);
+
+ $tagsToParse = [
+ 'url' => function ($str) {
+ return ''.$str.'';
+ },
+ 'player' => function ($str) {
+ return generateLink(getPlayerLink($str, false), $str, true);
+ },
+ 'guild' => function ($str) {
+ return generateLink(getGuildLink($str, false), $str, true);
+ },
+ 'house' => function ($str) {
+ return generateLink(getHouseLink($str, false), $str, true);
+ }
+ ];
+
+ foreach ($tagsToParse as $tag => $callback) {
+ while(stripos($text, "[$tag]") !== false && stripos($text, "[/$tag]") !== false
+ && stripos($text, "[$tag]") < stripos($text, "[/$tag]"))
+ {
+ $length = strlen("[$tag]");
+ $substr = substr($text, stripos($text, "[$tag]") + $length, stripos($text, "[/$tag]") - stripos($text, "[$tag]") - $length);
+
+ $text = str_ireplace('[' . $tag . ']' . $substr . '[/' . $tag . ']', $callback($substr), $text);
+ }
}
$xhtml = false;
@@ -251,9 +272,6 @@ class Forum
'#\[u\](.*?)\[/u\]#si' => ($xhtml ? '\\1' : '\\1'),
'#\[s\](.*?)\[/s\]#si' => ($xhtml ? '\\1' : '\\1'),
- '#\[guild\](.*?)\[/guild\]#si' => urldecode(generateLink(getGuildLink('$1', false), '$1', true)),
- '#\[house\](.*?)\[/house\]#si' => urldecode(generateLink(getHouseLink('$1', false), '$1', true)),
- '#\[player\](.*?)\[/player\]#si' => urldecode(generateLink(getPlayerLink('$1', false), '$1', true)),
// TODO: [poll] tag
'#\[color=(.*?)\](.*?)\[/color\]#si' => ($xhtml ? '\\2' : '\\2'),