1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-02 04:40:44 +02:00

A proper handling of RFC3986 network-path references

This commit is contained in:
SecretR
2016-01-15 13:50:41 +02:00
parent d29949cbd3
commit a609a899cc
2 changed files with 10 additions and 5 deletions

View File

@@ -2684,8 +2684,15 @@ class e_parse extends e_parser
break; break;
} }
$hasCDN = strpos($url, '//') === 0;
foreach($tmp as $key=>$val) foreach($tmp as $key=>$val)
{ {
// Fix - don't break the CDN '//cdn.com' URLs
if ($hasCDN && $val == '/') {
continue;
}
$len = strlen($val); $len = strlen($val);
if(substr($url, 0, $len) == $val) if(substr($url, 0, $len) == $val)
{ {

View File

@@ -803,8 +803,6 @@ class e_jsmanager
// ie. e107 Core Minimum: JS similar to e107 v1.0 should be loaded "e_js.php" (no framwork dependency) // ie. e107 Core Minimum: JS similar to e107 v1.0 should be loaded "e_js.php" (no framwork dependency)
// with basic functions like SyncWithServerTime() and expandit(), externalLinks() etc. // with basic functions like SyncWithServerTime() and expandit(), externalLinks() etc.
if(empty($file_path)) if(empty($file_path))
{ {
return $this; return $this;
@@ -883,7 +881,7 @@ class e_jsmanager
{ {
case 'core': case 'core':
// added direct CDN support // added direct CDN support
$file_path = (strpos($file_path, 'http') !== 0 ? '{e_WEB_JS}' : '').trim($file_path, '/')."|{$pre}|{$post}"; $file_path = (strpos($file_path, 'http') !== 0 && strpos($file_path, '//') !== 0 ? '{e_WEB_JS}'.trim($file_path, '/') : $file_path)."|{$pre}|{$post}";
$registry = &$this->_e_jslib_core; $registry = &$this->_e_jslib_core;
break; break;
@@ -901,7 +899,7 @@ class e_jsmanager
case 'core_css': //FIXME - core CSS should point to new e_WEB/css; add one more case - js_css -> e_WEB/jslib/ case 'core_css': //FIXME - core CSS should point to new e_WEB/css; add one more case - js_css -> e_WEB/jslib/
// added direct CDN support // added direct CDN support
$file_path = $runtime_location.'|'.(strpos($file_path, 'http') !== 0 ? '{e_WEB_JS}' : '').trim($file_path, '/')."|{$pre}|{$post}"; $file_path = $runtime_location.'|'.(strpos($file_path, 'http') !== 0 && strpos($file_path, '//') !== 0 ? '{e_WEB_JS}'.trim($file_path, '/') : $file_path)."|{$pre}|{$post}";
if(!isset($this->_e_css['core'])) $this->_e_css['core'] = array(); if(!isset($this->_e_css['core'])) $this->_e_css['core'] = array();
$registry = &$this->_e_css['core']; $registry = &$this->_e_css['core'];
$runtime = true; $runtime = true;