Einzelnen Beitrag anzeigen

Benutzerbild von Zacherl
Zacherl

Registriert seit: 3. Sep 2004
4.629 Beiträge
 
Delphi 10.2 Tokyo Starter
 
#4

Re: [PHP] Hide BBCode parsen

  Alt 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
Projekte:
- GitHub (Profil, zyantific)
- zYan Disassembler Engine ( Zydis Online, Zydis GitHub)
  Mit Zitat antworten Zitat