| @@ -104,36 +104,8 @@ | ||
| 104 | 104 | $this->path = $file_path; |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | /** |
| 108 | - * Whether the file is a real video inside the uploads directory. | |
| 109 | - * | |
| 110 | - * @since 4.0.2 | |
| 111 | - * | |
| 112 | - * @param string $file_path file path. | |
| 113 | - * | |
| 114 | - * @return bool | |
| 115 | - */ | |
| 116 | - private function is_allowed_path( $file_path ) { | |
| 117 | - $real_file = $file_path ? realpath( $file_path ) : false; | |
| 118 | - if ( ! $real_file || ! is_file( $real_file ) ) { | |
| 119 | - return false; | |
| 120 | - } | |
| 121 | - | |
| 122 | - $uploads = wp_get_upload_dir(); | |
| 123 | - $real_uploads = ! empty( $uploads['basedir'] ) ? realpath( $uploads['basedir'] ) : false; | |
| 124 | - if ( ! $real_uploads ) { | |
| 125 | - return false; | |
| 126 | - } | |
| 127 | - | |
| 128 | - $real_file = wp_normalize_path( $real_file ); | |
| 129 | - $real_uploads = trailingslashit( wp_normalize_path( $real_uploads ) ); | |
| 130 | - $is_allowed = 0 === strpos( $real_file, $real_uploads ); | |
| 131 | - | |
| 132 | - return (bool) apply_filters( 'tutor_video_stream_is_allowed_path', $is_allowed, $real_file ); | |
| 133 | - } | |
| 134 | - | |
| 135 | - /** | |
| 136 | 108 | * Open stream |
| 137 | 109 | * |
| 138 | 110 | * @since 1.0.0 |
| 139 | 111 | * |
| @@ -237,13 +209,8 @@ | ||
| 237 | 209 | * |
| 238 | 210 | * @return void |
| 239 | 211 | */ |
| 240 | 212 | public function start() { |
| 241 | - if ( ! $this->is_allowed_path( $this->path ) ) { | |
| 242 | - status_header( 403 ); | |
| 243 | - exit; | |
| 244 | - } | |
| 245 | - | |
| 246 | 213 | $this->open(); |
| 247 | 214 | $this->set_header(); |
| 248 | 215 | $this->stream(); |
| 249 | 216 | $this->end(); |