Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

4907: $user_role contains boolean not array when current user is not …

…te author of a course
  • Loading branch information...
commit 46b0f00abcfef53524ef22d7e0e9776718c58801 1 parent 28b9907
TJ authored
Showing with 3 additions and 3 deletions.
  1. +3 −3 themes/default/home/index_course.tmpl.php
View
6 themes/default/home/index_course.tmpl.php
@@ -67,17 +67,17 @@
?>
<li class="course">
-<?php if (isset($user_role) && array_key_exists('role', $user_role) && $user_role['role'] == TR_USERROLE_AUTHOR) {?>
+<?php if (isset($user_role) && is_array($user_role) && array_key_exists('role', $user_role) && $user_role['role'] == TR_USERROLE_AUTHOR) {?>
<img src="<?php echo TR_BASE_HREF; ?>themes/<?php echo $_SESSION['prefs']['PREF_THEME']; ?>/images/my_own_course.gif" alt="<?php echo _AT('my_authoring_course'); ?>" title="<?php echo _AT('my_authoring_course'); ?>" />
<?php } else {?>
<img src="<?php echo TR_BASE_HREF; ?>themes/<?php echo $_SESSION['prefs']['PREF_THEME']; ?>/images/others_course.png" alt="<?php echo _AT('others_course'); ?>" title="<?php echo _AT('others_course'); ?>" />
<?php } ?>
<a href="<?php echo TR_BASE_HREF; ?>home/course/index.php?_course_id=<?php echo $row['course_id']; ?>"><?php echo Utility::highlightKeywords($row['title'], $keywords); ?></a>
-<?php if (isset($user_role) && array_key_exists('role', $user_role) && $user_role['role'] == TR_USERROLE_VIEWER) {?>
+<?php if (isset($user_role) && is_array($user_role) && array_key_exists('role', $user_role) && $user_role['role'] == TR_USERROLE_VIEWER) {?>
<a href="<?php echo TR_BASE_HREF; ?>home/<?php echo $caller_url; ?>action=remove<?php echo SEP; ?>cid=<?php echo $row['course_id']; ?>">
<img src="<?php echo TR_BASE_HREF; ?>themes/<?php echo $_SESSION['prefs']['PREF_THEME']; ?>/images/bookmark_remove.png" alt='<?php echo htmlspecialchars(_AT('remove_from_list')); ?>' title='<?php echo htmlspecialchars(_AT('remove_from_list')); ?>' border="0" />
</a>
-<?php } if (isset($user_role) && array_key_exists('role', $user_role) && $user_role['role'] == NULL && array_key_exists('user_id', $_SESSION) && $_SESSION['user_id']>0) {?>
+<?php } if (isset($user_role) && is_array($user_role) && array_key_exists('role', $user_role) && $user_role['role'] == NULL && array_key_exists('user_id', $_SESSION) && $_SESSION['user_id']>0) {?>
<a href="<?php echo TR_BASE_HREF; ?>home/<?php echo $caller_url; ?>action=add<?php echo SEP; ?>cid=<?php echo $row['course_id'];?>">
<img src="<?php echo TR_BASE_HREF; ?>themes/<?php echo $_SESSION['prefs']['PREF_THEME']; ?>/images/bookmark_add.png" alt="<?php echo htmlspecialchars(_AT('add_into_list')); ?>" title="<?php echo htmlspecialchars(_AT('add_into_list')); ?>" border="0" />
</a>
Please sign in to comment.
Something went wrong with that request. Please try again.