Subversion Repositories Applications.papyrus

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
831 florian 1
<?php
2
 
3
if(!defined("PHORUM")) return;
4
 
5
function phorum_mod_replace ($data)
6
{
7
    $PHORUM=$GLOBALS["PHORUM"];
8
 
9
    if(isset($PHORUM["mod_replace"])){
10
 
11
        foreach($data as $key => $message){
12
 
13
            if(isset($message["body"])){
14
 
15
                $body=$message["body"];
16
 
17
                foreach($PHORUM["mod_replace"] as $entry){
18
 
19
                    $entry["replace"]=str_replace(array("<", ">"), array("<", ">"), $entry["replace"]);
20
 
21
                    if($entry["pcre"]){
22
                        $body=preg_replace("/$entry[search]/is", $entry["replace"], $body);
23
                    } else {
24
                        $body=str_replace($entry["search"], "$entry[replace]", $body);
25
                    }
26
 
27
                }
28
 
29
                $data[$key]["body"]=$body;
30
            }
31
        }
32
 
33
    }
34
 
35
    return $data;
36
 
37
}
38
 
39
?>