Skip to content
Snippets Groups Projects
Commit e2c2bc70 authored by Tomasz Wolniewicz's avatar Tomasz Wolniewicz
Browse files

Merge branch 'master' of gitlab.software.geant.org:edugain/OT/edu-gain-technical-site-tw

parents f4705c35 575f0f72
No related branches found
No related tags found
1 merge request!22Master update
...@@ -18,7 +18,7 @@ define('DB_DATABASE','edugain'); ...@@ -18,7 +18,7 @@ define('DB_DATABASE','edugain');
// Validator locations // Validator locations
define('VALIDATOR_REQ','http://localhost:5000/validate?r='); define('VALIDATOR_REQ','http://localhost:5000/validate?r=');
define('VALIDATOR_TMP', '/srv/edugain.config/mds/tmp'); define('VALIDATOR_TMP', '/srv/edugain.tmp/validator');
// details of simpleSAMLphp for management login // details of simpleSAMLphp for management login
......
...@@ -121,7 +121,7 @@ class Validator { ...@@ -121,7 +121,7 @@ class Validator {
if (!isset($_REQUEST['entities'])) if (!isset($_REQUEST['entities']))
$this->params['validate'] = 1; $this->params['validate'] = 1;
} }
if (isset($_REQUEST['xmlout'])) if (isset($_REQUEST['xmlout']) || (!empty($_REQUEST['format']) && $_REQUEST['format'] == 'xml') )
$this->params['xmlout'] = $this->params['auto'] = $this->params['validate'] = 1; $this->params['xmlout'] = $this->params['auto'] = $this->params['validate'] = 1;
if (!isset($_REQUEST['oneentity'])) if (!isset($_REQUEST['oneentity']))
$this->params['entities'] = 1; $this->params['entities'] = 1;
......
...@@ -67,7 +67,12 @@ foreach ($_POST as $k=>$v) { ...@@ -67,7 +67,12 @@ foreach ($_POST as $k=>$v) {
fclose($fp); fclose($fp);
if ($suffix == 'svg') { if ($suffix == 'svg') {
$f = fopen($fileName, 'r'); $f = fopen($fileName, 'r');
$imageData = fread($f, filesize($fileName)); if ($f && filesize($fileName) > 0) {
$imageData = fread($f, filesize($fileName));
} else {
$imageData = "";
$result[] = 'ERROR: Could not download logo';
}
} }
} else { } else {
$fileName = '/tmp/testlogo'.bin2hex(openssl_random_pseudo_bytes(10)); $fileName = '/tmp/testlogo'.bin2hex(openssl_random_pseudo_bytes(10));
...@@ -99,15 +104,30 @@ foreach ($_POST as $k=>$v) { ...@@ -99,15 +104,30 @@ foreach ($_POST as $k=>$v) {
} else { } else {
$result[] = 'OKLOCAL'; $result[] = 'OKLOCAL';
} }
$skipcheck = false;
if ($suffix == 'svg') { if ($suffix == 'svg') {
$xmlget = simplexml_load_string($imageData); try {
$xmlattributes = $xmlget->attributes(); $xmlget = simplexml_load_string($imageData);
if ($xmlget !== false) {
$xmlattributes = $xmlget->attributes();
} else {
$result[] = "ERROR: not SVG image";
$xmlattributes = NULL;
$skipcheck = true;
}
} catch (Exception $e) {
$result[] = "ERROR: not SVG image";
$skipcheck = true;
}
if ($xmlattributes) {
$width = $xmlattributes->width; $width = $xmlattributes->width;
$height = $xmlattributes->height; $height = $xmlattributes->height;
$size = array($width, $hight); $size = array($width, $height);
}
} else { } else {
$size = getimagesize($fileName); $size = getimagesize($fileName);
} }
if (!$skipcheck) {
if ($size === false && !preg_match('/\.svg$/i', $limg)) { if ($size === false && !preg_match('/\.svg$/i', $limg)) {
$result[] = "ERROR: The downloaded logo does not seem to be a PNG, JPG, GIF, SVG or a generally accepted image file format. Therefore, it most probably will not be displayed by web browsers."; $result[] = "ERROR: The downloaded logo does not seem to be a PNG, JPG, GIF, SVG or a generally accepted image file format. Therefore, it most probably will not be displayed by web browsers.";
} }
...@@ -127,6 +147,7 @@ foreach ($_POST as $k=>$v) { ...@@ -127,6 +147,7 @@ foreach ($_POST as $k=>$v) {
if ($width && $height && isset($size[0]) && isset($size[1]) && round(10*$width/$height) != round(10*$size[0]/$size[1])) { if ($width && $height && isset($size[0]) && isset($size[1]) && round(10*$width/$height) != round(10*$size[0]/$size[1])) {
$result[] = "WARNING: Mismatching proportions (".$width.'px:'.$height."px=".round($width/$height,1)." in metadata vs ".$size[0].'px:'.$size[1].'px='.round($size[0]/$size[1],1)." actual). The logo will be displayed distorted by Discovery Services and Service Providers."; $result[] = "WARNING: Mismatching proportions (".$width.'px:'.$height."px=".round($width/$height,1)." in metadata vs ".$size[0].'px:'.$size[1].'px='.round($size[0]/$size[1],1)." actual). The logo will be displayed distorted by Discovery Services and Service Providers.";
} }
}
$res = array('result' => '', 'url' => ''); $res = array('result' => '', 'url' => '');
if ($remote != '') { if ($remote != '') {
$res['url'] = $remote; $res['url'] = $remote;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment