Changeset 1270 in ExiteCMS


Ignore:
Timestamp:
02/12/08 00:47:49 (4 years ago)
Author:
hverton
Message:

added automatic [wiki] bbcode creation to parsemessage()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/includes/forum_functions_include.php

    r1071 r1270  
    316316function parsemessage($rawmsg, $smileys=true) { 
    317317 
     318    global $settings, $db_prefix; 
     319     
    318320    // temp message storage 
    319321    $message = ""; 
     
    391393    } 
    392394 
    393     // parse the message, and convert all BBcode found 
     395    // detect and convert wikitags to wiki bbcodes if needed 
     396    if (isset($settings['wiki_forum_links'])  && $settings['wiki_forum_links']) { 
     397        // build the search and replace arrays 
     398        $search = array(); 
     399        $replace = array(); 
     400        $result = dbquery("SELECT DISTINCT tag FROM ".$db_prefix."wiki_pages"); 
     401        while ($data = dbarray($result)) { 
     402            $search[] = "\/b(".$data['tag'].")\b/is"; 
     403            $replace[] = "[wiki]\\1[/wiki]"; 
     404        } 
     405        $message = preg_replace($search, $replace, $message); 
     406    } 
     407    // parse the smileys in the message 
    394408    if ($smileys) $message = parsesmileys($message); 
     409    // page all ubbcode 
    395410    $message = parseubb($message); 
     411    // convert any newlines to html <br> 
    396412    $message = nl2br($message); 
    397413 
Note: See TracChangeset for help on using the changeset viewer.