Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixing situation where WP redirects if 'http://' is included in the f…

…ile path.
  • Loading branch information...
commit 3b0fd5d0320bed3204f0b3fb304bea8f629e920d 1 parent a627def
@ericmann authored
Showing with 7 additions and 3 deletions.
  1. +3 −2 includes/openfile.php
  2. +4 −1 lib/class.publication-markup.php
View
5 includes/openfile.php
@@ -2,13 +2,14 @@
if ( ! isset($_GET['file']) )
die();
-if ( strpos( $_GET['file'], (isset($_SERVER['HTTPS']) ? 'https://' : 'http://') . $_SERVER['SERVER_NAME'] ) === false )
+if ( strpos( $_GET['file'], (isset($_SERVER['HTTPS']) ? 'https|' : 'http|') . $_SERVER['SERVER_NAME'] ) === false )
die();
require_once('../lib/class.mimetype.php');
$mime = new mimetype();
-$fPath = $_GET['file'];
+$fPath = str_replace('http|', 'http://', $_GET['file']);
+$fPath = str_replace('https|', 'https://', $fPath);
$fType = $mime->getType( $fPath );
$fName = basename($fPath);
View
5 lib/class.publication-markup.php
@@ -15,6 +15,9 @@ public function __construct() {
$this->summary = get_post_meta( $this->ID, 'wpa_doc_desc', true );
$this->uri = get_post_meta( $this->ID, 'wpa_upload_doc', true );
+ $this->uri = str_replace('http://', 'http|', $this->uri);
+ $this->uri = str_replace('https://', 'https|', $this->uri);
+
$tags = wp_get_post_tags( $this->ID );
if ( count( $tags ) > 0 ) {
$this->keywords = '';
@@ -86,7 +89,7 @@ public function get_the_link() {
$uri = apply_filters( 'wpa-uri', $this->uri, $this->ID );
- if ( 'http://' == $uri || '' == $uri )
+ if ( 'http|' == $uri || '' == $uri )
return '';
return $downloadroot . $uri;
Please sign in to comment.
Something went wrong with that request. Please try again.