]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-16892 Fixed bug in accesslib role_fix_names method. Merging from MOODLE_19_STABLE
authornicolasconnault <nicolasconnault>
Mon, 20 Oct 2008 13:47:08 +0000 (13:47 +0000)
committernicolasconnault <nicolasconnault>
Mon, 20 Oct 2008 13:47:08 +0000 (13:47 +0000)
admin/roles/manage.html
backup/restore_form.html
lib/accesslib.php

index 930d417b1cc6e2a4a64fb5f28d1551293f0adb29..22c08364a67ce8d8e55620345a18e940c3fb906b 100755 (executable)
@@ -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>
     </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');
index e8a01a01ac64087e967a01c22756c6d964093b6d..efe6cc33f8c0784789000f0c68df1fe18d1417eb 100644 (file)
@@ -208,7 +208,7 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
      * if user has course:create in any category, we show
      *      newcourse
      */
-     
+
     // Non-cached - get accessinfo
     if (isset($USER->access)) {
         $accessinfo = $USER->access;
@@ -531,7 +531,7 @@ function selectItemInCheckboxByName(formId, checkName, checked ) {
             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>";
@@ -663,7 +663,7 @@ if ($info->backup_moodle_version < 2006092801) {
             $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
@@ -673,7 +673,7 @@ if ($info->backup_moodle_version < 2006092801) {
                 $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
@@ -714,9 +714,9 @@ echo ('</table>'); // end of role mappings table
 
 /**
  * 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, $DB;
@@ -726,13 +726,13 @@ function restore_samerole($roleid, $rolefromxml) {
 
     // First guess, try let's use the id
     if (restore_is_samerole($roleid, $rolefromxml)) {
-        return $DB->get_record('role', array('id'=>$roleid)); 
+        return $DB->get_record('role', array('id'=>$roleid));
     }
 
     // Second guess, try the shortname
     $testroleid = $DB->get_field('role', 'id', array('shortname'=>$rolefromxml->shortname));
     if ($testroleid && restore_is_samerole($testroleid, $rolefromxml)) {
-        return $DB->get_record('role', array('id'=>$testroleid)); 
+        return $DB->get_record('role', array('id'=>$testroleid));
     }
 
     // Finally, search all other roles. In orter to speed things up, we exclude the ones we have
@@ -770,7 +770,7 @@ function restore_is_samerole($testroleid, $rolefromxml) {
     global $DB;
 
     // Load the role definition from the databse.
-    $rolefromdb = $DB->get_records('role_capabilities', array('roleid'=>$testroleid), '', 'capability,permission'); 
+    $rolefromdb = $DB->get_records('role_capabilities', array('roleid'=>$testroleid), '', 'capability,permission');
     if (!$rolefromdb) {
         return false;
     }
index 847897e27e519f7d4abeaa0d1f664882453d0c8c..5498074c5d36ec5cb031a25ab54de5b7c2f45def 100755 (executable)
@@ -5136,7 +5136,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;
 }