Commit 8053afeb authored by Cecilia Vela Gurovic's avatar Cecilia Vela Gurovic Committed by Robert Lyon

Bug 1800961: php foreach should only be used on arrays

trying to use any other type of variable will
throw an exception.
Also, block types and view types should not be
nested in the template

behatnotneeded

Change-Id: I1ea1e3fc9e7ba7734e1b5712467678c001806e65
(cherry picked from commit b7c58854)
parent e81c2a2a
......@@ -206,10 +206,12 @@ function site_statistics($full=false) {
ORDER BY blocks DESC",
array(), 0, $maxblocktypes
);
foreach ($blocktypecounts as $blocktype) {
safe_require('blocktype', $blocktype->blocktype);
$classname = generate_class_name('blocktype', $blocktype->blocktype);
$blocktype->title = $classname::get_title();
if (is_array($blocktypecounts)) {
foreach ($blocktypecounts as $blocktype) {
safe_require('blocktype', $blocktype->blocktype);
$classname = generate_class_name('blocktype', $blocktype->blocktype);
$blocktype->title = $classname::get_title();
}
}
$smarty->assign('blocktypecounts', $blocktypecounts);
......
......@@ -8,7 +8,8 @@
<li class="list-group-item">{$item->title}: {$item->blocks}</li>
{/foreach}
</ul>
{if $viewtypes}
{/if}
{if $viewtypes}
<h4>{str tag=viewsbytype section=admin}</h4>
<div class="panel-body">
<canvas class="graphcanvas" id="sitestatsviewtypesgraph"></canvas>
......@@ -20,5 +21,4 @@
{/literal}
</script>
</div>
{/if}
{/if}
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