Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

function getServerURL() does not work

2014-04-06
2014-04-06
  • Jan Zumwalt
    Jan Zumwalt
    2014-04-06

    I have not tried this file manager on my webhost yet but I do most my development on localhost.
    The file manager does not work under my XAMPP because of one offending routine.
    Here is a fix that allows it to work under XAMPP.
    The "function getServerURL()" is located at approximately line 100.

    The author of "PHP File Manager" may want to consider revising the code to make it more universal.

    /* +--------------------------------------------------------------------+
       |                   routine modified by Jan Zumwalt                  |
       +--------------------------------------------------------------------+ */    
        function getServerURL() {
           // $url = ($_SERVER["HTTPS"] == "on")?"https://":"http://";   
           if ( isset( $_SERVER["HTTPS"] ) && strtolower( $_SERVER["HTTPS"] ) == "on" ) {
              $url = "https://";
           }else{
              $url = "http://";
           }
    
           // $url .= $_SERVER["SERVER_NAME"]; // $_SERVER["HTTP_HOST"] is equivalent
           if (isset( $_SERVER["HTTP_HOST"] )) {
              $url .= $_SERVER["HTTP_HOST"];
           }elseif (isset( $_SERVER["SERVER_NAME"] )) {
              $url .= $_SERVER["SERVER_NAME"];
           }else{
              $url .= "localhost";
           } 
    
            if ($_SERVER["SERVER_PORT"] != "80") $url .= ":".$_SERVER["SERVER_PORT"];
            return $url;
        }
    
     
    Last edit: Jan Zumwalt 2014-04-06