Registriert seit: 3. Sep 2004
4.629 Beiträge
Delphi 10.2 Tokyo Starter
|
Re: [PHP] Hide BBCode parsen
14. Sep 2006, 18:43
Habs jetzt so gelöst, fals es jemanden interessiert:
Code:
global $userdata;
preg_match_all("#\[show=(.*?)\](.*?)\[/show\]#si", $text, $matches, PREG_PATTERN_ORDER);
for($i=0; $i<count($matches[0]); $i++)
{
$hiddenquery = dbquery("SELECT post_author FROM ".DB_PREFIX."posts WHERE thread_id = '".$_GET['thread_id']."' AND post_author = '".$userdata['user_id']."'");
$hiddendata = dbarray($hiddenquery);
if ((strtolower($userdata['user_name']) == strtolower($matches[1][$i])) or ($userdata['user_id'] == $hiddendata['post_author']))
{
$text = str_replace($matches[0][$i], $matches[2][$i], $text);
}
else
{
if ($userdata['user_id'] == 1)
{
$text = str_replace($matches[0][$i], "<font color='red'>[" . $matches[1][$i] . ": " . $matches[2][$i] . "]</font>", $text);
}
else
{
$text = str_replace($matches[0][$i], '', $text);
}
}
}
Florian
|
|
Zitat
|