From: mjollnir_ Date: Wed, 10 Sep 2008 16:46:23 +0000 (+0000) Subject: MDL-16423 - make the button object more robust by detecting errors better X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=d1581fc53b26e10afe63a1a6c5942e09418b7199;p=moodle.git MDL-16423 - make the button object more robust by detecting errors better --- diff --git a/lib/portfoliolib.php b/lib/portfoliolib.php index e0672347f3..fc3cb35a24 100644 --- a/lib/portfoliolib.php +++ b/lib/portfoliolib.php @@ -144,6 +144,12 @@ class portfolio_add_button { } $formats = call_user_func(array($this->callbackclass, 'supported_formats')); } + $allformats = portfolio_supported_formats(); + foreach ($formats as $f) { + if (!array_key_exists($f, $allformats)) { + throw new portfolio_button_exception('invalidformat', 'portfolio', $f); + } + } $this->formats = $formats; }