Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MDL-16892 Fixed bug in accesslib role_fix_names method

  • Loading branch information...
commit 1f02086d55507b7860433c22fd546eaec2bb5d4f 1 parent 44c6419
nicolasconnault authored
View
6 admin/roles/manage.html
@@ -24,7 +24,7 @@
<?php if ($action == 'view') { ?>
<tr valign="top">
<td align="right"><?php print_string('name') ?>:</td>
- <td><?php p($role->name); ?></td>
+ <td><?php p(format_string($role->name)); ?></td>
</tr>
<tr valign="top">
<td align="right"><?php print_string('shortname') ?>:</td>
@@ -32,11 +32,11 @@
</tr>
<tr valign="top">
<td align="right"><?php print_string('description') ?>:</td>
- <td><?php p($role->description); $usehtmleditor = false; ?></td>
+ <td><?php p(format_text($role->description, FORMAT_HTML)); $usehtmleditor = false; ?></td>
</tr>
<tr valign="top">
<td align="right"><?php print_string('legacytype', 'role') ?>:</td>
- <td><?php
+ <td><?php
$usehtmleditor = false;
if (empty($role->legacytype)) {
print_string('none');
View
18 backup/restore_form.html
@@ -206,7 +206,7 @@
* if user has course:create in any category, we show
* newcourse
*/
-
+
// Non-cached - get accessinfo
if (isset($USER->access)) {
$accessinfo = $USER->access;
@@ -529,7 +529,7 @@
echo "<input type=\"hidden\" id=\"menurestore_site_files\" name=\"restore_site_files\" value=\"0\" />";
}
echo "</td></tr>";
-
+
// do you want grade histories to be restored?
if (empty($CFG->disablegradehistory)) {
echo "<tr>";
@@ -661,7 +661,7 @@
$mappableroles = $siteroleschoicearray;
echo ('<tr><td align="right">');
- echo '<label for="menuroles_'.$roleid.'">'.$role->name." (".($role->shortname).")".'</label>';
+ echo '<label for="menuroles_'.$roleid.'">'.format_string($role->name)." (".($role->shortname).")".'</label>';
echo ('</td><td align="left">');
/// first, we see if any exact role definition is found
@@ -671,7 +671,7 @@
$matchrole = $samerole->id;
// if an exact role is found, it does not matter whether this user can assign this role or not,
// this will be presented as a valid option regardless
- $mappableroles[$samerole->id] = $allroles[$samerole->id]->name." (". $allroles[$samerole->id]->shortname.")";
+ $mappableroles[$samerole->id] = format_string($allroles[$samerole->id]->name)." (". $allroles[$samerole->id]->shortname.")";
} else {
// no exact role found, let's try to match shortname
// this is useful in situations where basic roles differ slightly in definition
@@ -712,9 +712,9 @@
/**
* Look for a role in the database with exactly the same definition as the one in the backup file.
- *
+ *
* @param integer $roleid the id that the role in the backup files had on the old server.
- * @param object $role the rest of the definition of the role from the backup file.
+ * @param object $role the rest of the definition of the role from the backup file.
*/
function restore_samerole($roleid, $rolefromxml) {
global $CFG;
@@ -724,13 +724,13 @@
// First guess, try let's use the id
if (restore_is_samerole($roleid, $rolefromxml)) {
- return get_record('role', 'id', $roleid);
+ return get_record('role', 'id', $roleid);
}
// Second guess, try the shortname
$testroleid = get_field('role', 'id', 'shortname', $rolefromxml->shortname);
if ($testroleid && restore_is_samerole($testroleid, $rolefromxml)) {
- return get_record('role', 'id', $testroleid);
+ return get_record('role', 'id', $testroleid);
}
// Finally, search all other roles. In orter to speed things up, we exclude the ones we have
@@ -765,7 +765,7 @@
*/
function restore_is_samerole($testroleid, $rolefromxml) {
// Load the role definition from the databse.
- $rolefromdb = get_records('role_capabilities', 'roleid', $testroleid, '', 'capability,permission');
+ $rolefromdb = get_records('role_capabilities', 'roleid', $testroleid, '', 'capability,permission');
if (!$rolefromdb) {
return false;
}
View
2  lib/accesslib.php
@@ -5212,7 +5212,7 @@ function role_fix_names($roleoptions, $context, $rolenamedisplay=ROLENAME_ALIAS)
}
}
foreach ($roleoptions as $rid => $name) {
- $roleoptions[$rid] = strip_tags($name);
+ $roleoptions[$rid] = strip_tags(format_string($name));
}
return $roleoptions;
}

0 comments on commit 1f02086

Please sign in to comment.
Something went wrong with that request. Please try again.