X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Flibs%2Frewrite_functions.php;h=9ff0ff623bbf59d4e341498777938a7ede5d7c68;hp=121f0c4579a3e063d6840658856b46b0f1bb0a25;hb=ee0625c4882bb462985c504abf65a3ef0e7bf1eb;hpb=face72cb9a435049e8d17196c1fa8434982701b4 diff --git a/inc/libs/rewrite_functions.php b/inc/libs/rewrite_functions.php index 121f0c4579..9ff0ff623b 100644 --- a/inc/libs/rewrite_functions.php +++ b/inc/libs/rewrite_functions.php @@ -42,40 +42,35 @@ if (!defined('__SECURITY')) { require($INC); } -// +// Rewrite links in HTML for better SEO (ugly part of mx!) function REWRITE_LINKS ($HTML) { - // Skip rewriting for the admin area (which search engine may enter here???) - if (ereg($GLOBALS['module'], getConfig('rewrite_skip'))) return $HTML; - - // Strip slashes with double-backslashes for the preg_replace() function - $URL = str_replace("/", "\\/", constant('URL')); + // Skip rewriting for configured modules + if (eregi($GLOBALS['module'], getConfig('rewrite_skip')) !== false) return $HTML; // 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)) { - // Strip slashes with double-backslashes for the preg_replace() function - $URL = str_replace("/", "\\/", constant('SERVER_URL')); - // 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 - $target2 = str_replace("/", "\\/", $target); + $target2 = preg_quote($target, "/"); // Action variable $act = $target."\$1/act/"; // Convert &|&action=... - $output = preg_replace("/".$target2."(.*)&action=/i", $act, $output); + $output = preg_replace("/" . $target2 . "(.*)&action=/i", $act, $output); // "The same procedure as last variable"... now for &what= $wht = $target."\$1/wht/"; - $output = preg_replace("/".$target2."(.*)&what=/i", $wht, $output); + $output = preg_replace("/" . $target2 . "(.*)&what=/i", $wht, $output); // Repair missed &what=??? entries while (preg_match("/&what=(.*)\/(.*)\/(.*)/i", $output)) {