Merge remote-tracking branch 'mike/master' into dev

This commit is contained in:
Mario Vavti 2017-11-03 23:08:04 +01:00
commit a899ce1c22
3 changed files with 41 additions and 4 deletions

View File

@ -57,12 +57,21 @@ class Cloud extends \Zotlabs\Web\Controller {
$auth->observer = $ob_hash;
}
// if we arrived at this path with any query parameters in the url, build a clean url without
// them and redirect.
// @fixme if the filename has an ampersand in it AND there are query parameters,
// this may not do the right thing.
$_SERVER['QUERY_STRING'] = str_replace(array('?f=', '&f='), array('', ''), $_SERVER['QUERY_STRING']);
$_SERVER['QUERY_STRING'] = strip_zids($_SERVER['QUERY_STRING']);
if((strpos($_SERVER['QUERY_STRING'],'?') !== false) || (strpos($_SERVER['QUERY_STRING'],'&') !== false && strpos($_SERVER['QUERY_STRING'],'&') === false)) {
$path = z_root();
if(argc()) {
foreach(\App::$argv as $a) {
$path .= '/' . $a;
}
}
goaway($path);
}
$_SERVER['REQUEST_URI'] = str_replace(array('?f=', '&f='), array('', ''), $_SERVER['REQUEST_URI']);
$_SERVER['REQUEST_URI'] = strip_zids($_SERVER['REQUEST_URI']);
$rootDirectory = new \Zotlabs\Storage\Directory('/', $auth);

View File

@ -75,6 +75,9 @@ function photo_upload($channel, $observer, $args) {
$imagedata = @file_get_contents($tmp_name);
@unlink($tmp_name);
}
else {
$imagedata = @file_get_contents($args['os_syspath']);
}
}
else {
$imagedata = @file_get_contents($args['os_syspath']);

View File

@ -89,10 +89,35 @@ function strip_zids($s) {
return preg_replace('/[\?&]zid=(.*?)(&|$)/ism','$2',$s);
}
function strip_owt($s) {
return preg_replace('/[\?&]owt=(.*?)(&|$)/ism','$2',$s);
}
function strip_zats($s) {
return preg_replace('/[\?&]zat=(.*?)(&|$)/ism','$2',$s);
}
function strip_auth_query_params() {
$_SERVER['QUERY_STRING'] = str_replace(array('?f=', '&f='), array('', ''), $_SERVER['QUERY_STRING']);
$_SERVER['QUERY_STRING'] = strip_zids($_SERVER['QUERY_STRING']);
$_SERVER['QUERY_STRING'] = strip_owt($_SERVER['QUERY_STRING']);
$_SERVER['REQUEST_URI'] = str_replace(array('?f=', '&f='), array('', ''), $_SERVER['REQUEST_URI']);
$_SERVER['REQUEST_URI'] = strip_zids($_SERVER['REQUEST_URI']);
$_SERVER['REQUEST_URI'] = strip_owt($_SERVER['REQUEST_URI']);
$_ENV['QUERY_STRING'] = str_replace(array('?f=', '&f='), array('', ''), $_ENV['QUERY_STRING']);
$_ENV['QUERY_STRING'] = strip_zids($_ENV['QUERY_STRING']);
$_ENV['QUERY_STRING'] = strip_owt($_ENV['QUERY_STRING']);
$_ENV['REQUEST_URI'] = str_replace(array('?f=', '&f='), array('', ''), $_ENV['REQUEST_URI']);
$_ENV['REQUEST_URI'] = strip_zids($_ENV['REQUEST_URI']);
$_ENV['REQUEST_URI'] = strip_owt($_ENV['REQUEST_URI']);
}
/**
* zidify_callback() and zidify_links() work together to turn any HTML a tags with class="zrl" into zid links