Commit 123ef468 authored by Robert Lyon's avatar Robert Lyon Committed by Gerrit Code Review

Merge "Bug 1812910: Needs to use is_array() before count() in PHP 7.2" into 18.04_STABLE

parents 426f61d8 98ee2ce6
......@@ -59,7 +59,7 @@ $smarty = smarty(array('adminusersearch', 'adminexportqueue','paginator'), array
setpageicon($smarty, 'icon-users');
$smarty->assign('search', $search);
$smarty->assign('limit', $limit);
$smarty->assign('institutions', $institutions);
$smarty->assign('institutions', !empty($institutions) ? $institutions : array());
$smarty->assign('results', $html);
$smarty->assign('pagination', $pagination['html']);
$smarty->assign('columns', $columns);
......
......@@ -34,6 +34,7 @@ $MANDATORYFIELDS = array(
);
$MEMBERS = array(); // Store the members
$GROUPS = array(); // Map gid to group shortnames
$UPDATES = array(); // During validation, remember which group already exist
$form = array(
'name' => 'uploadcsv',
......
......@@ -46,6 +46,10 @@ $users = get_records_sql_assoc('
$ph
);
if (empty($users)) {
// None of the userids are valid
throw new InvalidArgumentException("Trying to access invalid user(s)");
}
// Display the number of users filtered out due to institution permissions. This is not an
// exception, because the logged in user might be an admin in one institution, and staff in
// another.
......
......@@ -167,7 +167,7 @@ $smarty = smarty(array('adminexportqueue', 'paginator'), array(), array('ascendi
setpageicon($smarty, 'icon-user');
$smarty->assign('search', $search);
$smarty->assign('limit', $limit);
$smarty->assign('institutions', $institutions);
$smarty->assign('institutions', !empty($institutions) ? $institutions : array());
$smarty->assign('results', $html);
$smarty->assign('pagination', $pagination['html']);
$smarty->assign('columns', $columns);
......
......@@ -3,28 +3,28 @@
{if $icon}<div id="profile-icon">{$icon|safe}</div>{/if}
{foreach from=$sections key=sectionname item=section}
{if count($section)}
<div class="profileinfo">
<h3>{str tag=$sectionname section=artefact.internal}</h3>
<table>
{foreach from=$section key=title item=value}
{if $title == 'socialprofile'}
{foreach from=$value item=profile}
<tr>
<th>{$profile.label|safe}:</th>
<td>{$profile.link|safe}</td>
</tr>
{/foreach}
{else}
<tr>
<th>{str tag=$title section=artefact.internal}:</th>
<td>{$value|safe}</td>
</tr>
{if is_array($section) && count($section)}
<div class="profileinfo">
<h3>{str tag=$sectionname section=artefact.internal}</h3>
<table>
{foreach from=$section key=title item=value}
{if $title == 'socialprofile'}
{foreach from=$value item=profile}
<tr>
<th>{$profile.label|safe}:</th>
<td>{$profile.link|safe}</td>
</tr>
{/foreach}
{else}
<tr>
<th>{str tag=$title section=artefact.internal}:</th>
<td>{$value|safe}</td>
</tr>
{/if}
{/foreach}
</table>
</div>
{/if}
{/foreach}
</table>
</div>
{/if}
{/foreach}
{include file="export:html:footer.tpl"}
......@@ -111,14 +111,14 @@
</option>
{/if}
{if $moderator && $otherforums && (count($otherforums) > 0)}
{if $moderator && !empty($otherforums) && (count($otherforums) > 0)}
<option value="moveto">
{str tag="Moveto" section="interaction.forum"}
</option>
{/if}
</select>
{if $moderator && $otherforums && (count($otherforums) > 0)}
{if $moderator && !empty($otherforums) && (count($otherforums) > 0)}
<select name="newforum" id="otherforums" class="hidden form-control select">
{foreach from=$otherforums item=otherforum}
<option value="{$otherforum->id}">
......
......@@ -38,9 +38,9 @@
{str section='module.multirecipientnotification' tag='touser'}:
</span>
<span class="username">
{if count($item->tousr) > 0}
{if is_array($item->tousr) && count($item->tousr) > 0}
{assign var="tousr" value=$item->tousr[0]}
{if count($tousr['username']) > 0}
{if is_array($tousr['username']) && count($tousr['username']) > 0}
{$tousr['username']|truncate:$maxnamestrlength}
{else}
{$tousr['display']|truncate:$maxnamestrlength}
......@@ -67,7 +67,7 @@
<strong>
{str section='module.multirecipientnotification' tag='touser'}:
</strong>
{if count($item->tousr) > 1}
{if is_array($item->tousr) && count($item->tousr) > 1}
<span>
{foreach from=$item->tousr item=tousr key=break}
{if ($tousr['link'])}<a href="{$tousr['link']}">{/if}
......
......@@ -63,7 +63,7 @@
{/if}
</div>
<!-- TAGS -->
{if $record->tags|count gt 0}
{if is_array($record->tags) && count($record->tags) > 0}
<div class="tags"><strong>{str tag=tags section=search.elasticsearch}:</strong>
{foreach from=$record->tags item=tag name=tags}
<a href="{$WWWROOT}search/elasticsearch/index.php?query={$tag}&tagsonly=true">{$tag}</a>{if !$.foreach.tags.last}, {/if}
......@@ -73,7 +73,7 @@
</div>
<!-- RESUMEITEMS -->
<div class="col-md-4">
{if $record->resumeitems|count gt 0}
{if is_array($record->resumeitems) && count($record->resumeitems) > 0}
<strong>{str tag=contains section=search.elasticsearch}:</strong>
<ul>
{foreach from=$record->resumeitems key=rid item=resume}
......@@ -85,9 +85,9 @@
{/if}
<!-- VIEWS -->
{if $record->views|count gt 0}
{if is_array($record->views) && count($record->views) > 0}
<div class="usedon">
{if $record->views|count gt 1}
{if count($record->views) > 1}
<strong>{str tag=usedonpages section=search.elasticsearch}:</strong>
<ul class="list-group list-unstyled">
{foreach from=$record->views key=id item=view}
......
......@@ -28,7 +28,7 @@
{/if}
</div>
<!-- TAGS -->
{if $record->tags|count gt 0}
{if is_array($record->tags) && count($record->tags) > 0}
<div class="tags"><strong>{str tag=tags section=search.elasticsearch}:</strong>
{foreach from=$record->tags item=tag name=tags}
<a href="{$WWWROOT}search/elasticsearch/index.php?query={$tag}&tagsonly=true">{$tag}</a>{if !$.foreach.tags.last}, {/if}
......@@ -37,7 +37,7 @@
{/if}
</div>
<!-- VIEWS -->
{if $record->views|count gt 0}
{if is_array($record->views) && count($record->views) > 0}
<div class="col-md-4">
<div class="usedon">
{if $record->views}
......
......@@ -38,7 +38,7 @@
{/if}
</div>
<!-- TAGS -->
{if $record->tags|count gt 0}
{if is_array($record->tags) && count($record->tags) > 0}
<div class="tags">
<strong>{str tag=tags section=search.elasticsearch}:</strong>
{foreach from=$record->tags item=tag name=tags}
......
......@@ -27,7 +27,7 @@
{/if}
</div>
<!-- TAGS -->
{if $record->tags|count gt 0}
{if is_array($record->tags) && count($record->tags) > 0}
<div class="tags"><strong>{str tag=tags section=search.elasticsearch}:</strong>
{foreach from=$record->tags item=tag name=tags}
<a href="{$WWWROOT}search/elasticsearch/index.php?query={$tag}&tagsonly=true">{$tag}</a>{if !$.foreach.tags.last}, {/if}
......
{if count($items) > 0}
{if $itemcount}
{foreach from=$items item=view}
<tr class="{cycle values='r0,r1'}">
<td class="sv"><a href="{$view->url}">{$view->title}</a>{if $view->collection} <span class="text-small text-midtone">({str tag='nviews' section='view' arg1=$view->viewcount})</span>{/if}</td>
......
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