Changeset - 0e5a369b205f
[Not reviewed]
default
0 1 0
Nathan Brink (binki) - 13 years ago 2012-11-28 00:10:27
ohnobinki@ohnopublishing.net
Avoid creating links with extraneous forward-slashes in them, so that people end up at http://slatepermutate.org/ instead of http://slatepermutate.org//.
1 file changed with 3 insertions and 3 deletions:
0 comments (0 inline, 0 general)
inc/class.page.php
Show inline comments
 
@@ -723,25 +723,25 @@ class page
 
	  if (isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] != 80)
 
	    {
 
	      if ($_SERVER['SERVER_PORT'] == 443 || !empty($_SERVER['HTTPS']))
 
		$proto .= 's';
 
	      if ($_SERVER['SERVER_PORT'] != 433)
 
		$port = $_SERVER['SERVER_PORT'];
 
	    }
 
	  
 
	  $base_uri = $proto . '://' . $host;
 
	  if ($port !== NULL)
 
	    $base_uri .= ':' . $port;
 
	  list($base_request_uri) = explode('?', $_SERVER['REQUEST_URI'], 2);
 
	  $base_uri .= substr($base_request_uri, 0, strrpos($base_request_uri, '/')) . '/';
 
	  $base_uri .= rtrim(substr($base_request_uri, 0, strrpos($base_request_uri, '/')), '/') . '/';
 
	}
 

	
 
    if (empty($base_uri) && empty($uri))
 
      return './';
 

	
 
    return $base_uri . $uri;
 
  }
 

	
 
  /**
 
   * \brief
 
   *   Resolve an SSL address for a static asset.
 
   *
 
@@ -927,28 +927,28 @@ class page
 
   *   The URL used to access the schedule. You must call
 
   *   htmlentities() on this string if it is to be inserted into an
 
   *   XHTML document.
 
   */
 
  public function gen_share_url($id)
 
  {
 
    global $clean_urls, $short_url_base;
 

	
 
    if ($clean_urls && isset($short_url_base)) {
 
      return $this->add_trailing_slash($short_url_base) . $id;
 
    }
 
    elseif ($clean_urls) {
 
      return 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['REQUEST_URI']) . '/' . $id;
 
      return 'http://' . $_SERVER['HTTP_HOST'] . $this->add_trailing_slash(dirname($_SERVER['REQUEST_URI'])) . '' . $id;
 
    }
 
    else {
 
      return 'http://' . $_SERVER['HTTP_HOST']  . dirname($_SERVER['REQUEST_URI']) . '/process.php?s=' . $id;
 
      return 'http://' . $_SERVER['HTTP_HOST']  . $this->add_trailing_slash(dirname($_SERVER['REQUEST_URI'])) . 'process.php?s=' . $id;
 
    }
 
  }
 

	
 
  /**
 
   * \brief
 
   *   Generate special code to close a self-closing XHTML/HTML
 
   *   element.
 
   *
 
   * \return
 
   *   A string containing the correct self-closing chars. For
 
   *   example, this would be ' /' for XHTML.
 
   */
0 comments (0 inline, 0 general)