X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Flibs%2Frewrite_functions.php;h=1db2b7ce21878bf22e54022665c51a59380e9471;hb=ca11996eb52fa0a1ec45d6ab10f5331c4a54a116;hp=3c3bbbf8d4005656be3bc0ee2c02e76871ee0a09;hpb=263a089d8a499e0e26d0af9e7aa7639f88b8ca60;p=mailer.git diff --git a/inc/libs/rewrite_functions.php b/inc/libs/rewrite_functions.php index 3c3bbbf8d4..1db2b7ce21 100644 --- a/inc/libs/rewrite_functions.php +++ b/inc/libs/rewrite_functions.php @@ -14,11 +14,10 @@ * $Date:: $ * * $Tag:: 0.2.1-FINAL $ * * $Author:: $ * - * Needs to be in all Files and every File needs "svn propset * - * svn:keywords Date Revision" (autoprobset!) at least!!!!!! * * -------------------------------------------------------------------- * * Copyright (c) 2003 - 2009 by Roland Haeder * - * For more information visit: http://www.mxchange.org * + * Copyright (c) 2009 - 2012 by Mailer Developer Team * + * For more information visit: http://mxchange.org * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * @@ -42,26 +41,27 @@ if (!defined('__SECURITY')) { } // Rewrite links in HTML for better SEO (ugly part of mx!) -function rewriteLinksInCode ($HTML) { - // Skip rewriting for configured modules - if (eregi(getModule(), getConfig('rewrite_skip')) !== false) return $HTML; +function rewriteLinksInCode ($code) { + // Skip rewriting for configured or empty modules + if ((getModule() == '') || (isInStringIgnoreCase(getModule(), getConfig('rewrite_skip')) !== false)) { + return $code; + } // END - if // Generate target URL - $target = '{?URL?}/cms/'; - - // Convert modules.php?module=... - $output = str_replace(getConfig('URL') . '/modules.php?module=', $target, $HTML); + $target = getUrl() . '/cms/'; // Convert modules.php?module=... - $output = str_replace('{?URL?}/modules.php?module=', $target, $output); + foreach (array(getUrl(), '{?URL?}') as $rewrite) { + $code = str_replace($rewrite . '/modules.php?module=', $target, $code); + } // END - foreach // Do we have an URL linked to mxchange.org? - if (eregi(getConfig('SERVER_URL'), $output)) { + if (isInStringIgnoreCase(getServerUrl(), $code)) { // Convert URLs from my server - $output = str_replace('{?URL?}/modules.php?module=', getConfig('SERVER_URL') . '/cms/', $output); + $code = str_replace('{?URL?}/modules.php?module=', getServerUrl() . '/cms/', $code); // Convert URLs from my server - $output = str_replace(getConfig('URL') . '/modules.php?module=', getConfig('SERVER_URL') . '/cms/', $output); + $code = str_replace(getUrl() . '/modules.php?module=', getServerUrl() . '/cms/', $code); } // END - if // Strip slashes as above for the main URL @@ -71,19 +71,19 @@ function rewriteLinksInCode ($HTML) { $action = $target . '$1/act/'; // Convert &|&action=... - $output = preg_replace('/' . $target2 . '(.*)&action=/i', $action, $output); + $code = preg_replace('/' . $target2 . '(.*)&action=/i', $action, $code); // "The same procedure as last variable"... now for &what= - $what = $target.'$1/wht/'; - $output = preg_replace('/' . $target2 . '(.*)&what=/i', $what, $output); + $what = $target . '$1/wht/'; + $code = preg_replace('/' . $target2 . '(.*)&what=/i', $what, $code); // Repair missed &what=??? entries - while (preg_match("/&what=(.*)\/(.*)\/(.*)/i", $output)) { - $output = preg_replace("/&what=(.*)\/(.*)\/(.*)/i", "/wht/\$1/\$2/\$3", $output); + while (preg_match("/&what=(.*)\/(.*)\/(.*)/i", $code)) { + $code = preg_replace("/&what=(.*)\/(.*)\/(.*)/i", "/wht/\$1/\$2/\$3", $code); } // END - while // Return rewritten code - return $output; + return $code; } // [EOF]