Mahor rewrite:
[mailer.git] / inc / libs / rewrite_functions.php
index 13f9a3b48691528698b81342cea670b074b08462..5a1929e6a2bd25f80e2b48a0441f192389980628 100644 (file)
@@ -38,12 +38,11 @@ if (!defined('__SECURITY')) {
 }
 
 //
-function REWRITE_LINKS($HTML)
-{
+function REWRITE_LINKS ($HTML) {
        global $_CONFIG;
 
        // Skip rewriting for the admin area (which search engine may enter here???)
-       if (ereg($GLOBALS['module'], $_CONFIG['rewrite_skip'])) return $HTML;
+       if (ereg($GLOBALS['module'], getConfig('rewrite_skip'))) return $HTML;
 
        // Strip slashes with double-backslashes for the preg_replace() function
        $URL = str_replace("/", "\\/", URL);
@@ -54,12 +53,11 @@ function REWRITE_LINKS($HTML)
        // Convert modules.php?module=...
        $test = preg_replace("/".$URL."\\/modules.php\\?module=/i", $target, $HTML);
 
-       if (eregi(SERVER_URL, $test))
-       {
+       if (eregi(SERVER_URL, $test)) {
                // Konvert URLs from my server
                $URL = str_replace("/", "\\/", SERVER_URL);
                $test = preg_replace("/".$URL."\\/modules.php\\?module=/i", SERVER_URL."/cms/", $test);
-       }
+       } // END - if
 
        // Strip slashes as above for the main URL
        $target2 = str_replace("/", "\\/", $target);
@@ -75,17 +73,15 @@ function REWRITE_LINKS($HTML)
        $target2 = str_replace("/", "\\/", $target);
        $test = preg_replace("/".$target2."(.*)&what=/i", $wht, $test);
 
-       if ((EXT_IS_ACTIVE("rallye")) && (eregi("rallye=", $test)))
-       {
+       if ((EXT_IS_ACTIVE("rallye")) && (eregi("rallye=", $test))) {
                // Replace data when rallye extension is active
                // Add more if you need more like these entries
                $REPLACE = array("rallye", "activate", "auto", "notify", "sub");
-               foreach ($REPLACE as $var)
-               {
+               foreach ($REPLACE as $var) {
                        // This will replace "&var=" to "/var/"
                        $test = preg_replace("/&".$var."=/i", "/".$var."/", $test);
-               }
-       }
+               } // END - foreach
+       } // END - if
 
        // Simple from->to replacements
        $REPLACE = array(
@@ -93,28 +89,24 @@ function REWRITE_LINKS($HTML)
                'replace' => array("u"   , "url", "page", "offset", "m"  , "b"  , "s"  , "h")
        );
 
-       if ((EXT_IS_ACTIVE("admins")) && (eregi("admin=", $test)))
-       {
+       if ((EXT_IS_ACTIVE("admins")) && (eregi("admin=", $test))) {
                // Replace &admin= with "/aid/"
                $REPLACE['search'][]  = "admin";
                $REPLACE['replace'][] = "aid";
-       }
+       } // END - if
 
        // Replace all array elements through
-       foreach ($REPLACE['search'] as $k => $v)
-       {
-               if (eregi("$v=", $test))
-               {
+       foreach ($REPLACE['search'] as $k => $v) {
+               if (eregi("$v=", $test)) {
                        // Replace &u_id= with /u/
                        $test = preg_replace("/&".$v."=/i", "/".$REPLACE['replace'][$k]."/", $test);
-               }
-       }
+               } // END - if
+       } // END - foreach
 
        // Repair missed &what=??? entries
-       while (preg_match("/&what=(.*)\/(.*)\/(.*)/i", $test))
-       {
+       while (preg_match("/&what=(.*)\/(.*)\/(.*)/i", $test)) {
                $test = preg_replace("/&what=(.*)\/(.*)\/(.*)/i", "/wht/\$1/\$2/\$3", $test);
-       }
+       } // END - while
 
        // Return rewritten code
        return $test;