Commit f4a0e178 authored by Richard Mansfield's avatar Richard Mansfield Committed by Gerrit Code Review
Browse files

Merge "Check value of static variable in group_current_group (bug #887002)"

parents 90c14f3a 79cf0eb2
......@@ -1647,16 +1647,13 @@ function group_param_userid($userid) {
function group_current_group() {
static $group;
// This function sometimes gets called by the smarty function
// during the execution of a GroupNotFound exception. This
// variable prevents a 2nd exception from being thrown. Perhaps
// better achieved with a global in the exception handler?
static $dying;
if (isset($group)) {
return $group;
}
if (defined('GROUP') && !$dying) {
if (defined('GROUP')) {
$group = get_record_select('group', 'id = ? AND deleted = 0', array(GROUP), '*, ' . db_format_tsfield('ctime'));
if (!$group) {
$dying = 1;
throw new GroupNotFoundException(get_string('groupnotfound', 'group', GROUP));
}
}
......
......@@ -436,11 +436,12 @@ EOF;
}
if (defined('GROUP')) {
require_once('group.php');
$group = group_current_group();
$smarty->assign('GROUP', $group);
if (!defined('NOGROUPMENU')) {
$smarty->assign('SUBPAGENAV', group_get_menu_tabs());
$smarty->assign('PAGEHEADING', $group->name);
if ($group = group_current_group()) {
$smarty->assign('GROUP', $group);
if (!defined('NOGROUPMENU')) {
$smarty->assign('SUBPAGENAV', group_get_menu_tabs());
$smarty->assign('PAGEHEADING', $group->name);
}
}
}
......
Supports Markdown
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