Commit ce458f04 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Don't link view tags unless the view owner == logged in user


Signed-off-by: default avatarRichard Mansfield <richardm@catalyst.net.nz>
parent 3f160dbc
......@@ -20,11 +20,12 @@
* @return Internationalized string
*/
function smarty_function_list_tags($params, &$smarty) {
global $USER;
if (empty($params['tags']) || !is_array($params['tags'])) {
return '';
}
if (empty($params['owntags'])) {
if (empty($params['owner']) || $params['owner'] != $USER->get('id')) {
return join(', ', array_map('hsc', $params['tags']));
}
......
......@@ -1739,6 +1739,7 @@ class View {
global $USER;
$userid = $USER->get('id');
$owner = null;
if ($groupid) {
$count = count_records('view', 'group', $groupid);
......@@ -1764,6 +1765,7 @@ class View {
WHERE v.owner = ' . $userid . '
AND v.type != \'profile\'
ORDER BY v.title, v.id', '', $offset, $limit);
$owner = $userid;
}
if ($viewdata) {
......@@ -1797,6 +1799,7 @@ class View {
$index[$viewdata[$i]->id] = $i;
$data[$i]['id'] = $viewdata[$i]->id;
$data[$i]['title'] = $viewdata[$i]->title;
$data[$i]['owner'] = $owner;
$data[$i]['description'] = $viewdata[$i]->description;
if (!empty($viewdata[$i]->submitgroupid)) {
$data[$i]['submittedto'] = get_string('viewsubmittedtogroup', 'view',
......
......@@ -32,7 +32,7 @@
<div class="videsc">{$view.description}</div>
{/if}
{if $view.tags}
<div class="tags">{str tag=tags}: {list_tags owntags=true tags=$view.tags}</div>
<div class="tags">{str tag=tags}: {list_tags owner=$view.owner tags=$view.tags}</div>
{/if}
</div>
<div class="vi">
......
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