]> git.mxchange.org Git - mailer.git/commitdiff
Rewritten to use str_replace() instead of preg_replace()
authorRoland Häder <roland@mxchange.org>
Tue, 10 Mar 2009 21:12:46 +0000 (21:12 +0000)
committerRoland Häder <roland@mxchange.org>
Tue, 10 Mar 2009 21:12:46 +0000 (21:12 +0000)
inc/libs/rewrite_functions.php

index fb52234bc95b3370a85d26136b0e0f529a3ef56a..9ff0ff623bbf59d4e341498777938a7ede5d7c68 100644 (file)
@@ -47,35 +47,30 @@ function REWRITE_LINKS ($HTML) {
        // Skip rewriting for configured modules
        if (eregi($GLOBALS['module'], getConfig('rewrite_skip')) !== false) return $HTML;
 
        // Skip rewriting for configured modules
        if (eregi($GLOBALS['module'], getConfig('rewrite_skip')) !== false) return $HTML;
 
-       // Strip slashes with double-backslashes for the preg_replace() function
-       $URL = str_replace('/', '\/', constant('URL'));
-
        // Generate target URL
        $target = constant('URL')."/cms/";
 
        // Convert modules.php?module=...
        // Generate target URL
        $target = constant('URL')."/cms/";
 
        // Convert modules.php?module=...
-       $output = preg_replace('/' . $URL . '\/modules.php\?module=/i', $target, $HTML);
+       $output = str_replace("/" . constant('URL') . "/modules.php?module=", $target, $HTML);
 
 
+       // Do we have an URL linked to mxchange.org?
        if (eregi(constant('SERVER_URL'), $output)) {
        if (eregi(constant('SERVER_URL'), $output)) {
-               // Strip slashes with double-backslashes for the preg_replace() function
-               $URL = str_replace('/', '\/', constant('SERVER_URL'));
-
                // Convert URLs from my server
                // Convert URLs from my server
-               $output = preg_replace('/' . $URL . '\/modules.php\?module=/i', constant('SERVER_URL')."/cms/", $output);
+               $output = str_replace("/" . constant('URL') . "/modules.php?module=", constant('SERVER_URL')."/cms/", $output);
        } // END - if
 
        // Strip slashes as above for the main URL
        } // END - if
 
        // Strip slashes as above for the main URL
-       $target2 = str_replace('/', '\/', $target);
+       $target2 = preg_quote($target, "/");
 
        // Action variable
        $act = $target."\$1/act/";
 
        // Convert &amp;|&action=...
 
        // Action variable
        $act = $target."\$1/act/";
 
        // Convert &amp;|&action=...
-       $output = preg_replace('/'.$target2."(.*)&amp;action=/i", $act, $output);
+       $output = preg_replace("/" . $target2 . "(.*)&amp;action=/i", $act, $output);
 
        // "The same procedure as last variable"... now for &amp;what=
        $wht = $target."\$1/wht/";
 
        // "The same procedure as last variable"... now for &amp;what=
        $wht = $target."\$1/wht/";
-       $output = preg_replace('/'.$target2."(.*)&amp;what=/i", $wht, $output);
+       $output = preg_replace("/" . $target2 . "(.*)&amp;what=/i", $wht, $output);
 
        // Repair missed &amp;what=??? entries
        while (preg_match("/&amp;what=(.*)\/(.*)\/(.*)/i", $output)) {
 
        // Repair missed &amp;what=??? entries
        while (preg_match("/&amp;what=(.*)\/(.*)\/(.*)/i", $output)) {