]> git.mxchange.org Git - mailer.git/blobdiff - inc/functions.php
Wernis extension can now contact the API
[mailer.git] / inc / functions.php
index d675eca81b5abe6dba65c639bbfbf7f4d6f1f816..161c73c35ddfcfc3d13ea97a30b85670b6587434 100644 (file)
@@ -1718,12 +1718,25 @@ function ADD_EMAIL_NAV($PAGES, $offset, $show_form, $colspan, $return=false) {
 
 //
 function MXCHANGE_OPEN($script) {
+       // Compile the script name
+       $script = COMPILE_CODE($script);
+
+       // Use default SERVER_URL by default... ;) So?
+       $url = SERVER_URL;
+       if (substr($script, 0, 7) == "http://") {
+               // Use the hostname from script URL as new hostname
+               $url = substr($script, 7);
+               $extract = explode("/", $url);
+               $url = $extract[0];
+               // Done extracting the URL :)
+       }
+
        // Extract host name
-       $host = str_replace("http://", "", SERVER_URL);
+       $host = str_replace("http://", "", $url);
        if (ereg("/", $host)) $host = substr($host, 0, strpos($host, "/"));
 
        // Generate relative URL
-       $script = substr(SERVER_URL, (strpos(SERVER_URL, $host) + strlen($host)))."/".basename($script);
+       $script = substr($script, (strlen($url) + 7));
        if (substr($script, 0, 1) == "/") $script = substr($script, 1);
 
        // Open connection