webServerID() public static method

PHP string list built from the PHP 'configure' script.
See also: php_sapi_name()
public static webServerID ( ) : string
return string A web server identification string.
Esempio n. 1
0
 /**
  * Returns a URL to be used for downloading, that takes into account any
  * special browser quirks (i.e. IE's broken filename handling).
  *
  * @param string $filename  The filename of the download data.
  * @param array $params     Any additional parameters needed.
  * @param string $url       The URL to alter. If none passed in, will use
  *                          the file 'view.php' located in the current
  *                          module's base directory.
  *
  * @return string  The download URL.
  */
 function downloadUrl($filename, $params = array(), $url = null)
 {
     global $browser;
     $horde_url = false;
     if (is_null($url)) {
         global $registry;
         $url = Util::addParameter(Horde::url($registry->get('webroot', 'horde') . '/services/download/'), 'module', $registry->getApp());
         $horde_url = true;
     }
     /* Add parameters. */
     if (!is_null($params)) {
         $url = Util::addParameter($url, $params);
     }
     /* If we are using the default Horde download link, add the
      * filename to the end of the URL. Although not necessary for
      * many browsers, this should allow every browser to download
      * correctly. */
     if ($horde_url) {
         $url = Util::addParameter($url, 'fn', '/' . rawurlencode($filename));
     } elseif ($browser->hasQuirk('break_disposition_filename')) {
         /* Some browsers will only obtain the filename correctly
          * if the extension is the last argument in the query
          * string and rest of the filename appears in the
          * PATH_INFO element. */
         $filename = rawurlencode($filename);
         /* Get the webserver ID. */
         $server = Horde::webServerID();
         /* Get the name and extension of the file.  Apache 2 does
          * NOT support PATH_INFO information being passed to the
          * PHP module by default, so disable that
          * functionality. */
         if ($server != 'apache2') {
             if ($pos = strrpos($filename, '.')) {
                 $name = '/' . preg_replace('/\\./', '%2E', substr($filename, 0, $pos));
                 $ext = substr($filename, $pos);
             } else {
                 $name = '/' . $filename;
                 $ext = '';
             }
             /* Enter the PATH_INFO information. */
             if ($pos = strpos($url, '?')) {
                 $url = substr($url, 0, $pos) . $name . substr($url, $pos);
             } else {
                 $url .= $name;
             }
         }
         /* Append the extension, if it exists. */
         if ($server == 'apache2' || !empty($ext)) {
             $url = Util::addParameter($url, 'fn_ext', '/' . $filename);
         }
     }
     return $url;
 }