X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Flibs%2Frewrite_functions.php;h=467e6babfbbdcf8649ce0c3eb170973201098eb2;hb=fe3a4b3357f95127d6cfa1842b49a6f32e2483f9;hp=9ff0ff623bbf59d4e341498777938a7ede5d7c68;hpb=01f83d51f14714d153f21ea4c6fca0584e33c65c;p=mailer.git diff --git a/inc/libs/rewrite_functions.php b/inc/libs/rewrite_functions.php index 9ff0ff623b..467e6babfb 100644 --- a/inc/libs/rewrite_functions.php +++ b/inc/libs/rewrite_functions.php @@ -38,39 +38,45 @@ // Some security stuff... if (!defined('__SECURITY')) { - $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php"; + $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php'; require($INC); } // Rewrite links in HTML for better SEO (ugly part of mx!) -function REWRITE_LINKS ($HTML) { +function rewriteLinksInCode ($HTML) { // Skip rewriting for configured modules if (eregi($GLOBALS['module'], getConfig('rewrite_skip')) !== false) return $HTML; // Generate target URL - $target = constant('URL')."/cms/"; + $target = "{!URL!}/cms/"; // Convert modules.php?module=... - $output = str_replace("/" . constant('URL') . "/modules.php?module=", $target, $HTML); + $output = str_replace(constant('URL') . "/modules.php?module=", $target, $HTML); + + // Convert modules.php?module=... + $output = str_replace("{!URL!}/modules.php?module=", $target, $output); // Do we have an URL linked to mxchange.org? if (eregi(constant('SERVER_URL'), $output)) { // Convert URLs from my server - $output = str_replace("/" . constant('URL') . "/modules.php?module=", constant('SERVER_URL')."/cms/", $output); + $output = str_replace("{!URL!}/modules.php?module=", constant('SERVER_URL')."/cms/", $output); + + // Convert URLs from my server + $output = str_replace(constant('URL') . "/modules.php?module=", constant('SERVER_URL')."/cms/", $output); } // END - if // Strip slashes as above for the main URL - $target2 = preg_quote($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)) {