🚑 fix(geticon) Produce clear PHP error when icon is not found

issue #6073
parent 8943aa4d
<?php
/*
This code is part of FusionDirectory (http://www.fusiondirectory.org/)
Copyright (C) 2013-2016 FusionDirectory
Copyright (C) 2013-2020 FusionDirectory
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -39,7 +39,11 @@ if (!isset($_GET['context']) || !isset($_GET['icon']) || !isset($_GET['size']))
trigger_error('Missing information in query string: '.$_SERVER['QUERY_STRING']);
exit;
}
$src = IconTheme::findThemeIcon($theme, $_GET['context'], $_GET['icon'], $_GET['size']);
$src = IconTheme::findThemeIcon($theme, $_GET['context'], $_GET['icon'], $_GET['size']);
if ($src === NULL) {
trigger_error('Could not find icon for '.$_SERVER['QUERY_STRING']);
exit;
}
header("Content-Type: image/png");
if (isset($_GET['disabled']) && $_GET['disabled']) {
......
......@@ -227,6 +227,7 @@ class IconTheme
static public function findThemeIcon ($theme, $context, $icon, $size)
{
if (!isset($_SESSION[static::$session_var])) {
trigger_error('Error: no theme found in session');
die('Error: no theme found in session');
}
if (isset($_SESSION[static::$session_var][$theme])) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment