]> git.mxchange.org Git - mailer.git/blobdiff - inc/libs/rewrite_functions.php
More rewrites, and output-mode fixed (we should documentate this)
[mailer.git] / inc / libs / rewrite_functions.php
index 467e6babfbbdcf8649ce0c3eb170973201098eb2..c7ed9f91f5c66374cb3ba9162f3e1e3a7f07213d 100644 (file)
@@ -17,7 +17,7 @@
  * Needs to be in all Files and every File needs "svn propset           *
  * svn:keywords Date Revision" (autoprobset!) at least!!!!!!            *
  * -------------------------------------------------------------------- *
- * Copyright (c) 2003 - 2008 by Roland Haeder                           *
+ * Copyright (c) 2003 - 2009 by Roland Haeder                           *
  * For more information visit: http://www.mxchange.org                  *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
 
 // Some security stuff...
 if (!defined('__SECURITY')) {
-       $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), '/inc') + 4) . '/security.php';
-       require($INC);
+       die();
 }
 
 // Rewrite links in HTML for better SEO (ugly part of mx!)
 function rewriteLinksInCode ($HTML) {
        // Skip rewriting for configured modules
-       if (eregi($GLOBALS['module'], getConfig('rewrite_skip')) !== false) return $HTML;
+       if (eregi(getModule(), getConfig('rewrite_skip')) !== false) return $HTML;
 
        // Generate target URL
-       $target = "{!URL!}/cms/";
+       $target = '{?URL?}/cms/';
 
        // Convert modules.php?module=...
-       $output = str_replace(constant('URL') . "/modules.php?module=", $target, $HTML);
+       $output = str_replace(getConfig('URL') . '/modules.php?module=', $target, $HTML);
 
        // Convert modules.php?module=...
-       $output = str_replace("{!URL!}/modules.php?module=", $target, $output);
+       $output = str_replace('{?URL?}/modules.php?module=', $target, $output);
 
        // Do we have an URL linked to mxchange.org?
-       if (eregi(constant('SERVER_URL'), $output)) {
+       if (eregi(getConfig('SERVER_URL'), $output)) {
                // Convert URLs from my server
-               $output = str_replace("{!URL!}/modules.php?module=", constant('SERVER_URL')."/cms/", $output);
+               $output = str_replace('{?URL?}/modules.php?module=', getConfig('SERVER_URL') . '/cms/', $output);
 
                // Convert URLs from my server
-               $output = str_replace(constant('URL') . "/modules.php?module=", constant('SERVER_URL')."/cms/", $output);
+               $output = str_replace(getConfig('URL') . '/modules.php?module=', getConfig('SERVER_URL') . '/cms/', $output);
        } // END - if
 
        // Strip slashes as above for the main URL
        $target2 = preg_quote($target, '/');
 
        // Action variable
-       $act = $target."\$1/act/";
+       $action = $target."\$1/act/";
 
        // Convert &|&action=...
-       $output = preg_replace('/' . $target2 . "(.*)&action=/i", $act, $output);
+       $output = preg_replace('/' . $target2 . '(.*)&action=/i', $action, $output);
 
        // "The same procedure as last variable"... now for &what=
-       $wht = $target."\$1/wht/";
-       $output = preg_replace('/' . $target2 . "(.*)&what=/i", $wht, $output);
+       $what = $target."\$1/wht/";
+       $output = preg_replace('/' . $target2 . '(.*)&what=/i', $what, $output);
 
        // Repair missed &what=??? entries
        while (preg_match("/&what=(.*)\/(.*)\/(.*)/i", $output)) {
@@ -86,5 +85,6 @@ function rewriteLinksInCode ($HTML) {
        // Return rewritten code
        return $output;
 }
-//
+
+// [EOF]
 ?>