Merged Nicolas' changes from MDL-8582 into HEAD.
authormoodler <moodler>
Wed, 28 Feb 2007 06:25:22 +0000 (06:25 +0000)
committermoodler <moodler>
Wed, 28 Feb 2007 06:25:22 +0000 (06:25 +0000)
99 files changed:
admin/handlevirus.php
admin/mnet/enr_course_enrol.php
admin/mnet/enr_courses.php
admin/oacleanup.php
admin/process_email.php
admin/register.php
admin/roles/assign.php
admin/roles/override.php
admin/roles/tabs.php
auth/cas/forbidden.php
auth/cas/login.php
auth/mnet/auth.php
backup/backup.php
backup/restore_check.html
backup/restorelib.php
backup/try.php
blocks/admin/block_admin.php
blocks/course_list/block_course_list.php
course/category.php
course/delete.php
course/edit.php
course/grade.php
course/grades.php
course/groups.php
course/import/activities/index.php
course/import/groups/index.php
course/importstudents.php
course/index.php
course/info.php
course/lib.php
course/pending.php
course/recent.php
course/report/log/index.php
course/report/log/lib.php
course/report/outline/index.php
course/report/participation/index.php
course/report/stats/index.php
course/report/stats/report.php
course/scales.php
course/search.php
course/user.php
enrol/authorize/enrol.php
enrol/authorize/locallib.php
enrol/database/enrol.php
enrol/imsenterprise/importnow.php
enrol/mnet/allowed_courses.php
enrol/paypal/ipn.php
files/index.php
grade/exceptions.php
grade/lib.php
group/assign.php
group/group.php
group/grouping.php
group/groupui/index.php
group/groupui/printgrouping.php
group/index.php
lib/accesslib.php
lib/db/mysql.php
lib/db/postgres7.php
lib/moodlelib.php
lib/questionlib.php
lib/simpletest/testweblib.php [new file with mode: 0644]
lib/weblib.php
message/index.php
mod/assignment/lib.php
mod/chat/gui_header_js/index.php
mod/chat/gui_sockets/index.php
mod/choice/view.php
mod/data/edit.php
mod/data/view.php
mod/forum/discuss.php
mod/forum/index.php
mod/forum/lib.php
mod/forum/post.php
mod/forum/user.php
mod/glossary/export.php
mod/glossary/print.php
mod/glossary/showentry.php
mod/hotpot/index.php
mod/hotpot/report.php
mod/hotpot/review.php
mod/hotpot/view.php
mod/lams/index.php
mod/lesson/index.php
mod/resource/index.php
mod/resource/type/file/resource.class.php
mod/resource/type/repository/resource.class.php
mod/scorm/player.php
mod/scorm/report.php
mod/scorm/view.php
mod/survey/report.php
mod/workshop/assess.php
question/category_class.php
user/edit.php
user/editadvanced.php
user/profile/definelib.php
user/profile/index.php
user/tabs.php
user/view.php

index f2b20e2..7a09c1e 100644 (file)
@@ -40,7 +40,7 @@ while(!feof($fd)) {
     
     $user = get_record("user","id",$log->userid);
     $course = get_record("course","id",$log->course);
-    $subject = get_string('virusfoundsubject','moodle',$site->fullname);
+    $subject = get_string('virusfoundsubject','moodle',format_string($site->fullname));
     $a->date = userdate($log->time);
 
     $a->action = $action;
@@ -78,7 +78,7 @@ function notify_admins_unknown($file,$a) {
     global $site;
 
     $admins = get_admins();
-    $subject = get_string('virusfoundsubject','moodle',$site->fullname);
+    $subject = get_string('virusfoundsubject','moodle',format_string($site->fullname));
     $body = get_string('virusfoundlateradminnolog','moodle',$a);
     foreach ($admins as $admin) {
         email_to_user($admin,$admin,$subject,$body);
index 906e228..94af92e 100644 (file)
@@ -258,7 +258,7 @@ $strsearchresults = get_string('searchresults');
 admin_externalpage_print_header($adminroot);
 
 print_box('<strong>' . s($mnet_peer->name) . ' : ' 
-          . s($course->shortname) .' '. s($course->fullname) 
+          . format_string($course->shortname) .' '. format_string($course->fullname) 
           . '</strong><br />'
           . get_string("enrolcourseenrol_desc", "mnet"));
 
index 079668f..f1157db 100644 (file)
             . "host={$mnethost}&amp;courseid={$course->id}&amp;sesskey={$USER->sesskey}";
         print ('<tr>'
                . "<td>$icon</td>"
-               . "<td><a href=\"$link\">".s($course->fullname). "</a></td>"
+               . "<td><a href=\"$link\">".format_string($course->fullname). "</a></td>"
                . '</tr><tr>'
                . '<td></td>'
-               . '<td>'.s($course->shortname). ' - ' .s($course->cat_name).'</td>'
+               . '<td>'.format_string($course->shortname). ' - ' .format_string($course->cat_name).'</td>'
                . '</tr><tr>'
                . '<td></td>'
                . "<td align=\"left\" >{$course->summary}</td>"
index bc60369..78ac48f 100644 (file)
@@ -99,7 +99,7 @@ function online_assignment_cleanup($output=false) {
 
                         /// grab the section record
                         if (!($section = get_record('course_sections', 'id', $newsection))) {
-                            if ($output) echo 'Serious error: Cannot retrieve section: '.$newsection.' for course: '.$course->fullname.'<br />';
+                            if ($output) echo 'Serious error: Cannot retrieve section: '.$newsection.' for course: '. format_string($course->fullname) .'<br />';
                             continue;
                         }
 
index 77f72c3..8e5091a 100755 (executable)
@@ -16,8 +16,8 @@ if ($_ENV['RECIPIENT'] == $CFG->noreplyaddress) {
     }
     
     $site = get_site();
-    $subject = get_string('noreplybouncesubject','moodle',$site->fullname);
-    $body = get_string('noreplybouncemessage','moodle',$site->fullname)."\n\n";
+    $subject = get_string('noreplybouncesubject','moodle',format_string($site->fullname));
+    $body = get_string('noreplybouncemessage','moodle',format_string($site->fullname))."\n\n";
     
     $fd = fopen('php://stdin','r');
     if ($fd) {
index 6f5c34c..cc142fe 100644 (file)
@@ -34,7 +34,7 @@
     $strregistration = get_string("registration");
     $strregistrationinfo = get_string("registrationinfo");
 
-    print_header("$site->shortname: $strregistration", "$site->fullname"
+    print_header("$site->shortname: $strregistration", $site->fullname
                  "<a href=\"../$CFG->admin/index.php\">$stradministration</a> -> $strregistration");
 
     print_heading($strregistration);
index 24d3a38..11d1c26 100755 (executable)
 
         /// site header
         } else {
-            print_header("$course->fullname: $fullname", "$course->fullname",
+            print_header("$course->fullname: $fullname", $course->fullname,
                         "<a href=\"$CFG->wwwroot/user/view.php?id=$userid&amp;course=$courseid\">$fullname</a> -> $straction", "", "", true, "&nbsp;", navmenu($course));
         }
 
index a52124f..b94ea7e 100755 (executable)
 
         /// site header
         } else {
-            print_header("$course->fullname: $fullname", "$course->fullname",
+            print_header("$course->fullname: $fullname", $course->fullname,
                         "<a href=\"$CFG->wwwroot/user/view.php?id=$userid&amp;course=$course->id\">$fullname</a> -> $straction", "", "", true, "&nbsp;", navmenu($course));
         }
         $showroles = 1;
index a69baa0..f240896 100755 (executable)
@@ -31,7 +31,7 @@ if ($currenttab != 'update') {
                 $streditcoursesettings = get_string("editcoursesettings");
     
                 $course = get_record('course', 'id', $context->instanceid);
-                print_header($streditcoursesettings, "$course->fullname",
+                print_header($streditcoursesettings, $course->fullname,
                         "<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a> -> $straction");
             }                        
             break;
index ce1b8b2..918261e 100644 (file)
@@ -10,7 +10,7 @@
     $loginsite = get_string("loginsite");
     $errormsg = get_string("auth_cas_invalidcaslogin", "auth");
 
-    print_header("$site->fullname: $loginsite", "$site->fullname", $loginsite);
+    print_header("$site->fullname: $loginsite", $site->fullname, $loginsite);
     include("forbidden.html");
     print_footer();
     exit;
index d2148b6..7551bc8 100644 (file)
@@ -143,12 +143,12 @@ defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.');
             if ($ldapauth->config->expiration == 1) {
                     $days2expire = $ldapauth->password_expire($USER->username);
                     if (intval($days2expire) > 0 && intval($days2expire) < intval($CFG->{$USER->auth.'_expiration_warning'})) {
-                        print_header("$site->fullname: $loginsite", "$site->fullname", $loginsite, $focus, "", true, "<div align=\"right\">$langmenu</div>");
+                        print_header("$site->fullname: $loginsite", $site->fullname, $loginsite, $focus, "", true, "<div align=\"right\">$langmenu</div>");
                         notice_yesno(get_string('auth_passwordwillexpire', 'auth', $days2expire), $passwordchangeurl, $urltogo);
                         print_footer();
                         exit;
                     } elseif (intval($days2expire) < 0 ) {
-                        print_header("$site->fullname: $loginsite", "$site->fullname", $loginsite, $focus, "", true, "<div align=\"right\">$langmenu</div>");
+                        print_header("$site->fullname: $loginsite", $site->fullname, $loginsite, $focus, "", true, "<div align=\"right\">$langmenu</div>");
                         notice_yesno(get_string('auth_passwordisexpired', 'auth'), $passwordchangeurl, $urltogo);
                         print_footer();
                         exit;
@@ -247,12 +247,12 @@ defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.');
         if ($ldapauth->config->expiration == 1) {
                 $days2expire = $ldapauth->password_expire($USER->username);
                 if (intval($days2expire) > 0 && intval($days2expire) < intval($CFG->{$USER->auth.'_expiration_warning'})) {
-                    print_header("$site->fullname: $loginsite", "$site->fullname", $loginsite, $focus, "", true, "<div class=\"langmenu\">$langmenu</div>");
+                    print_header("$site->fullname: $loginsite", $site->fullname, $loginsite, $focus, "", true, "<div class=\"langmenu\">$langmenu</div>");
                     notice_yesno(get_string('auth_passwordwillexpire', 'auth', $days2expire), $passwordchangeurl, $urltogo);
                     print_footer();
                     exit;
                 } elseif (intval($days2expire) < 0 ) {
-                    print_header("$site->fullname: $loginsite", "$site->fullname", $loginsite, $focus, "", true, "<div class=\"langmenu\">$langmenu</div>");
+                    print_header("$site->fullname: $loginsite", $site->fullname, $loginsite, $focus, "", true, "<div class=\"langmenu\">$langmenu</div>");
                     notice_yesno(get_string('auth_passwordisexpired', 'auth'), $passwordchangeurl, $urltogo);
                     print_footer();
                     exit;
@@ -302,7 +302,7 @@ defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.');
         $show_instructions = false;
     }
 
-    print_header("$site->fullname: $loginsite", "$site->fullname", $loginsite, $focus, "", true, "<div align=\"right\">$langmenu</div>");
+    print_header("$site->fullname: $loginsite", $site->fullname, $loginsite, $focus, "", true, "<div align=\"right\">$langmenu</div>");
     include($CFG->dirroot.'/auth/cas/index_form.html');
     print_footer();
 
index 9c8c07a..338a9b2 100644 (file)
@@ -271,7 +271,7 @@ class auth_plugin_mnet
                 list($code, $message) = array_map('trim',explode(':', $errormessage, 2));
                 if($code == 702) {
                     $site = get_site();
-                    print_error('mnet_session_prohibited','mnet', $remotewwwroot, $site->fullname);
+                    print_error('mnet_session_prohibited','mnet', $remotewwwroot, format_string($site->fullname));
                     exit;
                 }
                 $message .= "ERROR $code:<br/>$errormessage<br/>";
index f87a6d4..d6a8265 100644 (file)
@@ -78,7 +78,7 @@
             print_heading(get_string("choosecourse"));
             print_simple_box_start("center");
             foreach ($courses as $course) {
-                echo '<a href="backup.php?id='.$course->id.'">'.s($course->fullname).' ('.s($course->shortname).')</a><br />'."\n";
+                echo '<a href="backup.php?id='.$course->id.'">'.format_string($course->fullname).' ('.format_string($course->shortname).')</a><br />'."\n";
             }
             print_simple_box_end();
         } else {
     }
 
     //Print form     
-    print_heading("$strcoursebackup: $course->fullname ($course->shortname)");
+    print_heading(format_string("$strcoursebackup: $course->fullname ($course->shortname)"));
     print_simple_box_start("center");
 
     //Adjust some php variables to the execution of this script
index d28cf70..065df0a 100644 (file)
                 } else {
                     $optdimmed = '';
                 }
-                echo "<a $optdimmed href=\"restore.php?course_id=$course->id&launch=check&id=$id&file=$file\">".s($course->fullname).' ('.s($course->shortname).')</a><br />'."\n";
+                echo "<a $optdimmed href=\"restore.php?course_id=$course->id&launch=check&id=$id&file=$file\">".format_string($course->fullname).' ('.format_string($course->shortname).')</a><br />'."\n";
             }
             print_simple_box_end();
         } else {
index 57a4aef..e4fbc72 100644 (file)
                     echo "<li>".get_string("usingexistingcourse"); 
                     echo "<ul>";
                     echo "<li>".get_string("from").": ".$course_header->course_fullname." (".$course_header->course_shortname.")".'</li>';
-                    echo "<li>".get_string("to").": ".$course->fullname." (".$course->shortname.")".'</li>';
+                    echo "<li>".get_string("to").": ". format_string($course->fullname) ." (".format_string($course->shortname).")".'</li>';
                     if (($restore->deleting)) {
                         echo "<li>".get_string("deletingexistingcoursedata").'</li>';
                     } else {
index 01e025a..92960c0 100644 (file)
 
     $courses = get_records("course");
     foreach ($courses as $course) {
-        echo "Start course ".$course->fullname;
+        echo "Start course ". format_string($course->fullname);
         $preferences = schedule_backup_course_configure($course);
         if ($preferences && $status) {
             $status = schedule_backup_course_execute($preferences);
         }
         if ($status && $preferences) {
-            echo "End course ".$course->fullname." OK\n\n";
+            echo "End course ". format_string($course->fullname)." OK\n\n";
         } else {
-            echo "End course ".$course->fullname." FAIL\n\n";
+            echo "End course ". format_string($course->fullname)." FAIL\n\n";
         }
     }
 ?>
index b0b7c5f..4ef0a88 100644 (file)
@@ -164,10 +164,10 @@ class block_admin extends block_list {
 
         if (empty($course->metacourse) && ($course->id!==SITEID)) {
             if (has_capability('moodle/legacy:guest', $context, NULL, false)) {   // Are a guest now
-                $this->content->items[]='<a href="enrol.php?id='.$this->instance->pageid.'">'.get_string('enrolme', '', s($course->shortname)).'</a>';
+                $this->content->items[]='<a href="enrol.php?id='.$this->instance->pageid.'">'.get_string('enrolme', '', format_string($course->shortname)).'</a>';
                 $this->content->icons[]='<img src="'.$CFG->pixpath.'/i/user.gif" class="icon" alt="" />';
             } else if (has_capability('moodle/role:unassignself', $context, NULL, false)) {  // Have some role
-                $this->content->items[]='<a href="unenrol.php?id='.$this->instance->pageid.'">'.get_string('unenrolme', '', s($course->shortname)).'</a>';
+                $this->content->items[]='<a href="unenrol.php?id='.$this->instance->pageid.'">'.get_string('unenrolme', '', format_string($course->shortname)).'</a>';
                 $this->content->icons[]='<img src="'.$CFG->pixpath.'/i/user.gif" class="icon" alt="" />';
             }
         }
index df9b145..ba7329c 100644 (file)
@@ -44,8 +44,8 @@ class block_course_list extends block_list {
                         continue;
                     }
                     $linkcss = $course->visible ? "" : " class=\"dimmed\" ";
-                    $this->content->items[]="<a $linkcss title=\"" . s($course->shortname) . "\" ".
-                               "href=\"$CFG->wwwroot/course/view.php?id=$course->id\">" . s($course->fullname) . "</a>";
+                    $this->content->items[]="<a $linkcss title=\"" . format_string($course->shortname) . "\" ".
+                               "href=\"$CFG->wwwroot/course/view.php?id=$course->id\">" . format_string($course->fullname) . "</a>";
                     $this->content->icons[]=$icon;
                 }
                 $this->title = get_string('mycourses');
@@ -65,7 +65,7 @@ class block_course_list extends block_list {
             if (count($categories) > 1 || (count($categories) == 1 && count_records('course') > 200)) {     // Just print top level category links
                 foreach ($categories as $category) {
                     $linkcss = $category->visible ? "" : " class=\"dimmed\" ";
-                    $this->content->items[]="<a $linkcss href=\"$CFG->wwwroot/course/category.php?id=$category->id\">" . s($category->name) . "</a>";
+                    $this->content->items[]="<a $linkcss href=\"$CFG->wwwroot/course/category.php?id=$category->id\">" . format_string($category->name) . "</a>";
                     $this->content->icons[]=$icon;
                 }
                 $this->content->icons[] = '';
@@ -83,14 +83,18 @@ class block_course_list extends block_list {
                 if ($courses) {
                     foreach ($courses as $course) {
                         $linkcss = $course->visible ? "" : " class=\"dimmed\" ";
-                        $this->content->items[]="<a $linkcss title=\"".s($course->shortname)."\" ".
-                                   "href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->fullname</a>";
+
+                        $this->content->items[]="<a $linkcss title=\""
+                                   . format_string($course->shortname)."\" ".
+                                   "href=\"$CFG->wwwroot/course/view.php?id=$course->id\">" 
+                                   .  format_string($course->fullname) . "</a>";
                         $this->content->icons[]=$icon;
                     }
                 /// If we can update any course of the view all isn't hidden, show the view all courses link
                     if (has_capability('moodle/course:update', get_context_instance(CONTEXT_SYSTEM)) || empty($CFG->block_course_list_hideallcourseslink)) {
                         $this->content->icons[] = '';
-                        $this->content->items[] = "&nbsp;&nbsp;&nbsp;<a href=\"$CFG->wwwroot/course/index.php\">".get_string("fulllistofcourses")."</a>...";
+                        $this->content->items[] = "&nbsp;&nbsp;&nbsp;<a href=\"$CFG->wwwroot/course/index.php\">"
+                            .get_string("fulllistofcourses")."</a>...";
                     }
                     $this->get_remote_courses();
                 } else {
@@ -123,8 +127,9 @@ class block_course_list extends block_list {
             $this->content->items[] = get_string('remotecourses','mnet');
             $this->content->icons[] = '';
             foreach ($courses as $course) {
-                $this->content->items[]="<a title=\"$course->shortname\" ".
-                    "href=\"{$CFG->wwwroot}/auth/mnet/jump.php?hostid={$course->hostid}&amp;wantsurl=/course/view.php?id={$course->remoteid}\">$course->fullname</a>";
+                $this->content->items[]="<a title=\"" . format_string($course->shortname) . "\" ".
+                    "href=\"{$CFG->wwwroot}/auth/mnet/jump.php?hostid={$course->hostid}&amp;wantsurl=/course/view.php?id={$course->remoteid}\">" 
+                    . format_string($course->fullname) . "</a>";
                 $this->content->icons[]=$icon;
             }
             // if we listed courses, we are done
index 25facca..f3dd905 100644 (file)
                 }
                 $catlinkcss = $subcategory->visible ? "" : " class=\"dimmed\" ";
                 echo '<a '.$catlinkcss.' href="category.php?id='.$subcategory->id.'">'.
-                     $subcategory->name.'</a><br />';
+                     format_string($subcategory->name).'</a><br />';
             }
         }
         if (!$firstentry) {
 
             $linkcss = $acourse->visible ? "" : ' class="dimmed" ';
             echo '<tr>';
-            echo '<td><a '.$linkcss.' href="view.php?id='.$acourse->id.'">'.$acourse->fullname.'</a></td>';
+            echo '<td><a '.$linkcss.' href="view.php?id='.$acourse->id.'">'. format_string($acourse->fullname) .'</a></td>';
             if ($creatorediting) {
                 echo "<td>";
                 if (has_capability('moodle/course:update', $coursecontext)) {
         echo '<form id="renameform" action="category.php" method="post">';
         echo '<input type="hidden" name="id" value="'.$category->id.'" />';
         echo '<input type="hidden" name="sesskey" value="'.$USER->sesskey.'" />';
-        echo '<input type="text" size="30" name="rename" value="'.s($category->name).'" alt="'.$strrename.'" />';
+        echo '<input type="text" size="30" name="rename" value="'.format_string($category->name).'" alt="'.$strrename.'" />';
         echo '<input type="submit" value="'.$strrename.'" />';
         echo "</form>";
         echo "<br />";
index 2063d93..658a188 100644 (file)
@@ -37,7 +37,8 @@
                      "<a href=\"category.php?id=$course->category\">$category->name</a> -> ".
                      "$strdeletecheck");
 
-        notice_yesno("$strdeletecoursecheck<br /><br />$course->fullname ($course->shortname)", 
+        notice_yesno("$strdeletecoursecheck<br /><br />" . format_string($course->fullname) . 
+                     " (" . format_string($course->shortname) . ")", 
                      "delete.php?id=$course->id&amp;delete=".md5($course->timemodified)."&amp;sesskey=$USER->sesskey", 
                      "category.php?id=$course->category");
 
@@ -57,7 +58,7 @@
 
     add_to_log(SITEID, "course", "delete", "view.php?id=$course->id", "$course->fullname (ID $course->id)");
 
-    $strdeletingcourse = get_string("deletingcourse", "", $course->shortname);
+    $strdeletingcourse = get_string("deletingcourse", "", format_string($course->shortname));
 
     print_header("$site->shortname: $strdeletingcourse", $site->fullname, 
                  "<a href=\"../$CFG->admin/index.php\">$stradministration</a> -> ".
@@ -70,7 +71,7 @@
     delete_course($course->id);
     fix_course_sortorder(); //update course count in catagories
 
-    print_heading( get_string("deletedcourse", "", $course->shortname) );
+    print_heading( get_string("deletedcourse", "", format_string($course->shortname)) );
 
     print_continue("category.php?id=$course->category");
 
index 61ff051..771003d 100644 (file)
@@ -102,11 +102,11 @@ if (!empty($course)) {
     $strcategories = get_string("categories");
 
     if (!empty($course)) {
-        print_header($streditcoursesettings, "$course->fullname",
+        print_header($streditcoursesettings, $course->fullname,
                      "<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a>
                       -> $streditcoursesettings", $editform->focus());
     } else {
-        print_header("$site->shortname: $straddnewcourse", "$site->fullname",
+        print_header("$site->shortname: $straddnewcourse", $site->fullname,
                      "<a href=\"$CFG->wwwroot/$CFG->admin/index.php\">$stradministration</a> -> ".
                      "<a href=\"index.php\">$strcategories</a> -> $straddnewcourse", $editform->focus());
     }
index 733b1ac..4818237 100644 (file)
@@ -87,7 +87,7 @@
 
 /// OK, we have all the data, now present it to the user
 
-    print_header("$course->shortname: $strgrades", "$course->fullname"
+    print_header("$course->shortname: $strgrades", $course->fullname
                  "<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a> 
                   -> $strgrades");
     
index 53efe95..64c9307 100644 (file)
@@ -31,7 +31,7 @@
 /// Get a list of all students
     if ($currentgroup) {
         if (!$students = get_group_students($currentgroup, "u.lastname ASC")) {
-            print_header("$course->shortname: $strgrades", "$course->fullname"
+            print_header("$course->shortname: $strgrades", $course->fullname
                      "<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a> 
                       -> $strgrades");
             setup_and_print_groups($course, $groupmode, "grades.php?id=$course->id");
@@ -41,7 +41,7 @@
         }
     } else {
         if (!$students = get_course_students($course->id, "u.lastname ASC")) {
-            print_header("$course->shortname: $strgrades", "$course->fullname"
+            print_header("$course->shortname: $strgrades", $course->fullname
                      "<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a> 
                       -> $strgrades");
             notice(get_string("nostudentsyet"), "$CFG->wwwroot/course/view.php?id=$course->id");
     
     } else {  // Just print the web page
 
-        print_header("$course->shortname: $strgrades", "$course->fullname"
+        print_header("$course->shortname: $strgrades", $course->fullname
                      "<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a> 
                       -> $strgrades");
     
index 5419d1d..98f15c5 100644 (file)
@@ -61,7 +61,7 @@
     $strgroupmemberssee = get_string('groupmemberssee');
     $strparticipants = get_string('participants');
 
-    print_header("$course->shortname: $strgroups", "$course->fullname"
+    print_header("$course->shortname: $strgroups",  $course->fullname
                  "<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a> ".
                  "-> <a href=\"$CFG->wwwroot/user/index.php?id=$course->id\">$strparticipants</a> ".
                  "-> $strgroups", "", "", true, '', user_login_string($course, $USER));
index 4c312d8..8364871 100644 (file)
@@ -54,7 +54,7 @@
         }
     }
     
-    print_header("$course->shortname: $strimportactivities", "$course->fullname"
+    print_header("$course->shortname: $strimportactivities", $course->fullname
                  "<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a> ".
                  "-> <a href=\"$CFG->wwwroot/course/import.php?id=$course->id\">".get_string('import')."</a> ".
                  "-> $strimportactivities");
index 3d32f24..6fa3f6f 100755 (executable)
@@ -40,7 +40,7 @@
 
 /// Print the header
 
-    print_header("$course->shortname: $strimportgroups", "$course->fullname"
+    print_header("$course->shortname: $strimportgroups", $course->fullname
                  "<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a> ".
                  "-> <a href=\"$CFG->wwwroot/course/import.php?id=$course->id\">".get_string('import')."</a> ".
                  "-> $strimportgroups");
index a49fd17..d182dde 100644 (file)
@@ -44,7 +44,7 @@
     $strshowall = get_string("showall");
 
     print_header("$course->shortname: $strassigncourses",
-                 "$site->fullname",
+                 $site->fullname,
                  "<a href=\"view.php?id=$course->id\">$course->shortname</a> -> $strassigncourses",
                  "searchtext");
 
index b45ba8a..338d3bf 100644 (file)
             $newcategory->name = $form->addcategory;
             $newcategory->sortorder = 999;
             if (!insert_record('course_categories', $newcategory)) {
-                notify("Could not insert the new category '" . s($newcategory->name) . "'");
+                notify("Could not insert the new category '" . format_string($newcategory->name) . "'");
             } else {
-                notify(get_string('categoryadded', '', s($newcategory->name)));
+                notify(get_string('categoryadded', '', format_string($newcategory->name)));
             }
         }
     }
                 
                 /// Finally delete the category itself
                 if (delete_records('course_categories', 'id', $deletecat->id)) {
-                    notify(get_string('categorydeleted', '', s($deletecat->name)));
+                    notify(get_string('categorydeleted', '', format_string($deletecat->name)));
                 }
             }
             else {
-                $strdeletecategorycheck = get_string('deletecategorycheck','', s($deletecat->name));
+                $strdeletecategorycheck = get_string('deletecategorycheck','', format_string($deletecat->name));
                 notice_yesno($strdeletecategorycheck,
                              "index.php?delete=$delete&amp;sure=".md5($deletecat->timemodified)."&amp;sesskey=$USER->sesskey",
                              "index.php?sesskey=$USER->sesskey");
@@ -353,7 +353,7 @@ function print_category_edit($category, $displaylist, $parentslist, $depth=-1, $
         $linkcss = $category->visible ? '' : ' class="dimmed" ';
         echo '<a '.$linkcss.' title="'.$str->edit.'" '.
              ' href="category.php?id='.$category->id.'&amp;categoryedit=on&amp;sesskey='.sesskey().'">'.
-             s($category->name).'</a>';
+             format_string($category->name).'</a>';
         echo '</td>';
 
         echo '<td class="count">'.$category->coursecount.'</td>';
index 11afb81..c30390b 100644 (file)
@@ -30,7 +30,7 @@
 
     print_header(get_string("summaryof", "", $course->fullname));
 
-    echo "<h3 align=\"center\">$course->fullname<br />($course->shortname)</h3>";
+    echo "<h3 align=\"center\">" . format_string($course->fullname) . "<br />(" . format_string($course->shortname) . ")</h3>";
 
     echo "<center>";
     if ($course->guest) {
index be47798..42314fa 100644 (file)
@@ -988,7 +988,7 @@ function print_overview($courses) {
         if (empty($course->visible)) {
             $linkcss = 'class="dimmed"';
         }
-        print_heading('<a title="'.$course->fullname.'" '.$linkcss.' href="'.$CFG->wwwroot.'/course/view.php?id='.$course->id.'">'.$course->fullname.'</a>');
+        print_heading('<a title="'. format_string($course->fullname).'" '.$linkcss.' href="'.$CFG->wwwroot.'/course/view.php?id='.$course->id.'">'. format_string($course->fullname).'</a>');
         if (array_key_exists($course->id,$htmlarray)) {
             foreach ($htmlarray[$course->id] as $modname => $html) {
                 echo $html;
@@ -1534,7 +1534,7 @@ function rebuild_course_cache($courseid=0) {
         foreach ($courses as $course) {
             $modinfo = serialize(get_array_of_activities($course->id));
             if (!set_field("course", "modinfo", $modinfo, "id", $course->id)) {
-                notify("Could not cache module information for course '$course->fullname'!");
+                notify("Could not cache module information for course '" . format_string($course->fullname) . "'!");
             }
         }
     }
@@ -1557,9 +1557,9 @@ function make_categories_list(&$list, &$parents, $category=NULL, $path="") {
 
     if ($category) {
         if ($path) {
-            $path = $path.' / '.s($category->name);
+            $path = $path.' / '.format_string($category->name);
         } else {
-            $path = s($category->name);
+            $path = format_string($category->name);
         }
         $list[$category->id] = $path;
     } else {
@@ -1678,7 +1678,7 @@ function print_category_info($category, $depth, $files = false) {
 
         echo '<td valign="top" class="category image">'.$catimage.'</td>';
         echo '<td valign="top" class="category name">';
-        echo '<a '.$catlinkcss.' href="'.$CFG->wwwroot.'/course/category.php?id='.$category->id.'">'.$category->name.'</a>';
+        echo '<a '.$catlinkcss.' href="'.$CFG->wwwroot.'/course/category.php?id='.$category->id.'">'. format_string($category->name).'</a>';
         echo '</td>';
         echo '<td class="category info">&nbsp;</td>';
         echo '</tr>';
@@ -1688,7 +1688,7 @@ function print_category_info($category, $depth, $files = false) {
                 $linkcss = $course->visible ? '' : ' class="dimmed" ';
                 echo '<tr><td valign="top">&nbsp;';
                 echo '</td><td valign="top" class="course name">';
-                echo '<a '.$linkcss.' href="'.$CFG->wwwroot.'/course/view.php?id='.$course->id.'">'.$course->fullname.'</a>';
+                echo '<a '.$linkcss.' href="'.$CFG->wwwroot.'/course/view.php?id='.$course->id.'">'. format_string($course->fullname).'</a>';
                 echo '</td><td align="right" valign="top" class="course info">';
                 if ($course->guest ) {
                     echo '<a title="'.$strallowguests.'" href="'.$CFG->wwwroot.'/course/view.php?id='.$course->id.'">';
@@ -1724,7 +1724,7 @@ function print_category_info($category, $depth, $files = false) {
         }
 
         echo '<td valign="top" class="category name">';
-        echo '<a '.$catlinkcss.' href="'.$CFG->wwwroot.'/course/category.php?id='.$category->id.'">'.$category->name.'</a>';
+        echo '<a '.$catlinkcss.' href="'.$CFG->wwwroot.'/course/category.php?id='.$category->id.'">'. format_string($category->name).'</a>';
         echo '</td>';
         echo '<td valign="top" class="category number">';
         if ($category->coursecount) {
@@ -1791,7 +1791,7 @@ function print_course($course) {
     echo '<div class="info">';
     echo '<div class="name"><a title="'.get_string('entercourse').'"'.
          $linkcss.' href="'.$CFG->wwwroot.'/course/view.php?id='.$course->id.'">'.
-         $course->fullname.'</a></div>';   
+         format_string($course->fullname).'</a></div>';   
     
     /// first find all roles that are supposed to be displayed
     if ($managerroles = get_config('', 'coursemanager')) {
@@ -1946,10 +1946,10 @@ function print_remote_course($course, $width="100%") {
     echo '<div class="info">';
     echo '<div class="name"><a title="'.get_string('entercourse').'"'.
          $linkcss.' href="'.$url.'">'
-        . s($course->fullname) .'</a><br />'
-        . s($course->hostname) . ' : '
-        . s($course->cat_name) . ' : ' 
-        . s($course->shortname). '</div>';   
+        .  format_string($course->fullname) .'</a><br />'
+        . format_string($course->hostname) . ' : '
+        . format_string($course->cat_name) . ' : ' 
+        . format_string($course->shortname). '</div>';   
     echo '</div><div class="summary">';
     $options = NULL;
     $options->noclean = true;
@@ -2336,7 +2336,7 @@ function make_editing_buttons($mod, $absolute=false, $moveselect=true, $indent=-
  */
 function course_format_name ($course,$max=100) {
 
-    $str = $course->shortname.': '.$course->fullname;
+    $str = $course->shortname.': '. $course->fullname;
     if (strlen($str) <= $max) {
         return $str;
     }
index c8655b4..0f86538 100644 (file)
             //do not output raw html from request, quote html entities using s()!!
             $table->data[] = array(((!empty($course->password)) ? 
                                     '<img hspace="1" alt="'.$strrequireskey.'" class="icon" src="'.$CFG->pixpath.'/i/key.gif" />' : ''),
-                                   s($course->shortname),s($course->fullname),fullname($requester),
-                                   s($course->summary),s($course->reason),
+                                   format_string($course->shortname),format_string($course->fullname),fullname($requester),
+                                   format_string($course->summary),format_string($course->reason),
                                    '<a href="pending.php?approve='.$course->id.'&amp;sesskey='.sesskey().'">'.get_string('approve').'</a> | '
                                    .'<a href="pending.php?reject='.$course->id.'&amp;sesskey='.sesskey().'">'.get_string('reject').'</a>');
         }
index 173a7b9..af2f60f 100644 (file)
             $dateinfo = userdate($date, get_string("strftimedaydate"));
 
         if ($course->id != SITEID) {
-            print_header("$course->shortname: $strrecentactivity", "$course->fullname",
+            print_header("$course->shortname: $strrecentactivity", $course->fullname,
                          "<a href=\"view.php?id=$course->id\">$course->shortname</a> ->
                           <a href=\"recent.php?id=$course->id\">$strrecentactivity</a> -> $userinfo, $dateinfo", "", $meta);
         } else {
-            print_header("$course->shortname: $strrecentactivity", "$course->fullname",
+            print_header("$course->shortname: $strrecentactivity", $course->fullname,
                          "<a href=\"recent.php?id=$course->id\">$strrecentactivity</a> -> $userinfo, $dateinfo", "", $meta);
         }
 
-        print_heading("$course->fullname: $userinfo, $dateinfo (".usertimezone().")", '', 3);
+        print_heading(format_string($course->fullname) . ": $userinfo, $dateinfo (".usertimezone().")", '', 3);
         $advancedfilter = 1;
         print_recent_selector_form($course, $advancedfilter, $user, $date, $modname, $modid, $modaction, $selectedgroup, $sortby);
 
         }
 
         if ($course->id != SITEID) {
-            print_header("$course->shortname: $strrecentactivity", "$course->fullname",
+            print_header("$course->shortname: $strrecentactivity", $course->fullname,
                      "<a href=\"view.php?id=$course->id\">$course->shortname</a> -> $strrecentactivity", "", $meta);
         } else {
-            print_header("$course->shortname: $strrecentactivity", "$course->fullname",
+            print_header("$course->shortname: $strrecentactivity", $course->fullname,
                      "$strrecentactivity", "", $meta);
         }
 
index 8943b2c..8d7edcc 100644 (file)
@@ -86,7 +86,7 @@
                                   <a href=\"index.php?id=$course->id\">$strlogs</a> -> $userinfo, $dateinfo", '');
                 }
 
-                print_heading("$course->fullname: $userinfo, $dateinfo (".usertimezone().")");
+                print_heading(format_string($course->fullname) . ": $userinfo, $dateinfo (".usertimezone().")");
                 print_mnet_log_selector_form($hostid, $course, $user, $date, $modname, $modid, $modaction, $group, $showcourses, $showusers, $logformat);
                 
                 if($hostid == $CFG->mnet_localhost_id) {
index 380fcfa..67fe479 100644 (file)
@@ -335,7 +335,7 @@ function print_log_selector_form($course, $selecteduser=0, $selecteddate='today'
         if ($ccc = get_records("course", "", "", "fullname","id,fullname,category")) {
             foreach ($ccc as $cc) {
                 if ($cc->category) {
-                    $courses["$cc->id"] = "$cc->fullname";
+                    $courses["$cc->id"] = $cc->fullname;
                 } else {
                     $courses["$cc->id"] = " $cc->fullname (Site)";
                 }
index 01752e3..c4c45fd 100644 (file)
     $strtodaylogs      = get_string("todaylogs");
     $strreports        = get_string("reports");
 
-    print_header("$course->shortname: $stractivityreport", "$course->fullname",
+    print_header("$course->shortname: $stractivityreport", $course->fullname,
                  "<a href=\"../../view.php?id=$course->id\">$course->shortname</a> ->
                   <a href=\"../../report.php?id=$course->id\">$strreports</a> ->
                   $stractivityreport");
 
-    print_heading("$course->fullname");
+    print_heading(format_string($course->fullname));
 
     echo "<table cellpadding=\"10\" align=\"center\"><tr>";
     echo "<td>$stractivityreport: </td>";
index 818ac25..5220203 100644 (file)
     $strallactions    = get_string('allactions');
     $strreports       = get_string('reports');
 
-    $strnav = "<a href=\"../../view.php?id=$course->id\">$course->shortname</a> -> 
+    $strnav = "<a href=\"../../view.php?id=$course->id\">" . format_string($course->shortname) . "</a> -> 
                <a href=\"../../report.php?id=$course->id\">$strreports</a> -> ". $strparticipation;
     
-    print_header("$course->shortname: $strparticipation", "$course->fullname",
+    print_header("$course->shortname: $strparticipation", $course->fullname,
                  "<a href=\"../../view.php?id=$course->id\">$course->shortname</a> ->
                   <a href=\"../../report.php?id=$course->id\">$strreports</a> ->
                   $strparticipation");
index ddf11eb..187e815 100644 (file)
 
     $menu = report_stats_mode_menu($course, $mode, $time, "$CFG->wwwroot/course/report/stats/index.php");
 
-    $crumb = "<a href=\"../../view.php?id=$course->id\">$course->shortname</a> ->
+    $crumb = "<a href=\"../../view.php?id=$course->id\">" . format_string($course->shortname) . "</a> ->
               <a href=\"../../report.php?id=$course->id\">$strreports</a> ->
               $strstats";
 
-    print_header("$course->shortname: $strstats", "$course->fullname"
+    print_header("$course->shortname: $strstats", $course->fullname
                   $crumb, '', '', true, '&nbsp;', $menu);
     
     
index f3159a8..5cf737e 100644 (file)
 
             $stats = stats_fix_zeros($stats,$param->timeafter,$param->table,(!empty($param->line2)));
 
-            print_heading($course->shortname.' - '.get_string('statsreport'.$report)
+            print_heading(format_string($course->shortname).' - '.get_string('statsreport'.$report)
                     .((!empty($user)) ? ' '.get_string('statsreportforuser').' ' .fullname($user,true) : '')
                     .((!empty($roleid)) ? ' '.get_field('role','name','id',$roleid) : ''));
 
index 5838d96..efbe8cf 100644 (file)
         //        $scales_site_uses = site_scale_used($scale->id,$courses);
         $scalemenu = make_menu_from_list($scale->scale);
 
-        print_header("$course->shortname: $strscales", "$course->fullname",
+        print_header("$course->shortname: $strscales", $course->fullname,
                  "$course->shortname -> $strscales -> $scale->name", "", "", true, "&nbsp;", "&nbsp;");
 
         close_window_button();
         }
 
         //Print out the headers
-        print_header("$course->shortname: $strscales", "$course->fullname",
+        print_header("$course->shortname: $strscales", $course->fullname,
                  "<a href=\"view.php?id=$course->id\">$course->shortname</a>".
                  " -> <a href=\"scales.php?id=$course->id\">$strscales</a>".
                  " -> ".get_string("editinga","",$strscale), $focus);
 
 /// Print out the main page
 
-    print_header("$course->shortname: $strscales", "$course->fullname"
+    print_header("$course->shortname: $strscales", $course->fullname
                  "<a href=\"view.php?id=$course->id\">$course->shortname</a> 
                   -> $strscales");
 
index d8b1667..dc1944c 100644 (file)
                 }
 
                 echo "<tr>";
-                echo "<td><a $linkcss href=\"view.php?id=$course->id\">$course->fullname</a></td>";
+                echo "<td><a $linkcss href=\"view.php?id=$course->id\">" . format_string($course->fullname) . "</a></td>";
                 echo "<td>".$displaylist[$course->category]."</td>";
                 echo "<td align=\"center\">";
                 
index 1c084ef..653573d 100644 (file)
     $fullname          = fullname($user, true);
 
     if ($course->id != SITEID) {
-        print_header("$course->shortname: $stractivityreport ($mode)", "$course->fullname",
+        print_header("$course->shortname: $stractivityreport ($mode)", $course->fullname,
                  "<a href=\"../course/view.php?id=$course->id\">$course->shortname</a> ->
                   <a href=\"../user/index.php?id=$course->id\">$strparticipants</a> ->
                   <a href=\"../user/view.php?id=$user->id&amp;course=$course->id\">$fullname</a> -> 
                   $stractivityreport -> $strmode");
     } else {
-        print_header("$course->shortname: $stractivityreport ($mode)", "$course->fullname",
+        print_header("$course->shortname: $stractivityreport ($mode)", $course->fullname,
                  "<a href=\"../user/view.php?id=$user->id&amp;course=$course->id\">$fullname</a> -> 
                   $stractivityreport -> $strmode");
     }
index 1e6883d..42fb074 100755 (executable)
@@ -258,7 +258,7 @@ class enrolment_plugin_authorize
                 $a->user = fullname($USER);
                 email_to_user($paymentmanager,
                               $USER,
-                              get_string("enrolmentnew", '', $course->shortname),
+                              get_string("enrolmentnew", '', format_string($course->shortname)),
                               get_string('enrolmentnewuser', '', $a));
             }
             if (!empty($CFG->enrol_mailadmins)) {
@@ -269,7 +269,7 @@ class enrolment_plugin_authorize
                 foreach ($admins as $admin) {
                     email_to_user($admin,
                                   $USER,
-                                  get_string("enrolmentnew", '', $course->shortname),
+                                  get_string("enrolmentnew", '', format_string($course->shortname)),
                                   get_string('enrolmentnewuser', '', $a));
                 }
             }
index 86cc78a..42443da 100644 (file)
@@ -242,7 +242,7 @@ function authorize_print_order_details($orderno)
     $table->data[] = array("<b>$authstrs->amount:</b>", "$order->currency $order->amount");
     if (empty($cmdcapture) and empty($cmdrefund) and empty($cmdvoid) and empty($cmddelete)) {
         $color = authorize_get_status_color($status->status);
-        $table->data[] = array("<b>$strs->course:</b>", $course->shortname);
+        $table->data[] = array("<b>$strs->course:</b>", format_string($course->shortname));
         $table->data[] = array("<b>$strs->status:</b>", "<font style='color:$color'>" . $authstrs->{$status->status} . "</font>");
         if ($order->paymentmethod == AN_METHOD_CC) {
             $table->data[] = array("<b>$authstrs->nameoncard:</b>", $order->ccname);
@@ -287,7 +287,7 @@ function authorize_print_order_details($orderno)
                     }
                     else {
                         $table->data[] = array("<b><font color='red'>$strs->error:</font></b>",
-                        "Error while trying to enrol ".fullname($user)." in '$course->shortname'");
+                        "Error while trying to enrol ".fullname($user)." in '" . format_string($course->shortname) . "'");
                     }
                 }
                 else {
index 3d99bc3..b3d017d 100644 (file)
@@ -283,9 +283,9 @@ function sync_enrolments($role = null) {
         if ($to_prune) {
             foreach ($to_prune as $role_assignment) {
                 if (role_unassign($role->id, $role_assignment->userid, 0, $role_assignment->contextid)){
-                    print "Unassigned {$role->shortname} assignment #{$role_assignment->id} for course {$course->id} ({$course->shortname}); user {$role_assignment->userid}\n";
+                    print "Unassigned {$role->shortname} assignment #{$role_assignment->id} for course {$course->id} (" . format_string($course->shortname) . "); user {$role_assignment->userid}\n";
                 } else {
-                    print "Failed to unassign {$role->shortname} assignment #{$role_assignment->id} for course {$course->id} ({$course->shortname}); user {$role_assignment->userid}\n";
+                    print "Failed to unassign {$role->shortname} assignment #{$role_assignment->id} for course {$course->id} (" . format_string($course->shortname) . "); user {$role_assignment->userid}\n";
                 }
             }
         }
@@ -325,9 +325,9 @@ function sync_enrolments($role = null) {
             }
             
             if (role_assign($role->id, $userid, 0, $context->id, 0, 0, 0, 'database')){
-                print "Assigned role {$role->shortname} to user {$userid} in course {$course->id} ({$course->shortname})\n";
+                print "Assigned role {$role->shortname} to user {$userid} in course {$course->id} (" . format_string($course->shortname) . ")\n";
             } else {
-                print "Failed to assign role {$role->shortname} to user {$userid} in course {$course->id} ({$course->shortname})\n";
+                print "Failed to assign role {$role->shortname} to user {$userid} in course {$course->id} (" . format_string($course->shortname) . ")\n";
             }
 
         } // end foreach member
index b04bc5c..a5af41d 100644 (file)
@@ -10,7 +10,7 @@ if (!$site = get_site()) {
 /// get language strings
 $str = get_strings(array('enrolments', 'users', 'administration', 'settings'));
 
-print_header("$site->shortname: $str->enrolments", "$site->fullname",
+print_header("$site->shortname: $str->enrolments", $site->fullname,
               "<a href=\"../../$CFG->admin/index.php\">$str->administration</a> -> 
                $str->enrolments -> IMS import");
 
index 9612667..176e596 100644 (file)
@@ -155,7 +155,7 @@ if (count($categories) < 1) {
                            getElementById('allowedcoursesform').addcategories.selectedIndex=-1;" >
           <?php
               foreach ($allowedcategories as $category) {
-                  echo "<option value=\"$category->id\"> $category->name </option>\n";
+                  echo "<option value=\"$category->id\"> " . format_string($category->name) . " </option>\n";
               }
           ?>
           </select>
@@ -176,7 +176,7 @@ if (count($categories) < 1) {
                            getElementById('allowedcoursesform').removecategories.selectedIndex=-1;">
           <?php
             foreach ($potentialcategories as $category) {
-                echo "<option value=\"$category->id\"> $category->name </option>\n";
+                echo "<option value=\"$category->id\"> " . format_string($category->name) . " </option>\n";
             }
         ?>
         </select>
@@ -212,7 +212,7 @@ if (count($courses) < 1) {
                            getElementById('allowedcoursesform').addcourses.selectedIndex=-1;">
           <?php
               foreach ($allowedcourses as $course) {
-                  echo "<option value=\"$course->id\"> $course->shortname </option>\n";
+                  echo "<option value=\"$course->id\"> " . format_string($course->shortname) . " </option>\n";
               }
           ?>
           </select>
@@ -233,7 +233,7 @@ if (count($courses) < 1) {
                            getElementById('allowedcoursesform').removecourses.selectedIndex=-1;">
           <?php
             foreach ($potentialcourses as $course) {
-                echo "<option value=\"$course->id\"> $course->shortname </option>\n";
+                echo "<option value=\"$course->id\"> " . format_string($course->shortname) . " </option>\n";
             }
         ?>
         </select>
index 2052db5..5c6beca 100644 (file)
                 $teacher = get_teacher($course->id);
 
                 if (!empty($CFG->enrol_mailstudents)) {
-                    $a->coursename = "$course->fullname";
+                    $a->coursename = $course->fullname;
                     $a->profileurl = "$CFG->wwwroot/user/view.php?id=$user->id";
                     email_to_user($user, $teacher, get_string("enrolmentnew", '', $course->shortname),
                                   get_string('welcometocoursetext', '', $a));
                 }
 
                 if (!empty($CFG->enrol_mailteachers)) {
-                    $a->course = "$course->fullname";
+                    $a->course = $course->fullname;
                     $a->user = fullname($user);
                     email_to_user($teacher, $user, get_string("enrolmentnew", '', $course->shortname),
                                   get_string('enrolmentnewuser', '', $a));
                 }
 
                 if (!empty($CFG->enrol_mailadmins)) {
-                    $a->course = "$course->fullname";
+                    $a->course = $course->fullname;
                     $a->user = fullname($user);
                     $admins = get_admins();
                     foreach ($admins as $admin) {
index a9c0574..b6b9143 100644 (file)
                 }
 
             } else {
-                print_header("$course->shortname: $strfiles", "$course->fullname",
+                print_header("$course->shortname: $strfiles", $course->fullname,
                              "<a href=\"../course/view.php?id=$course->id\">$course->shortname".
                              "</a> -> $fullnav", $formfield);
             }
index 90657b3..3378296 100644 (file)
@@ -16,7 +16,7 @@
 
     $group = get_current_group($course->id);
     
-    print_header("$course->shortname: ".get_string('grades'), "$course->fullname", grade_nav($course, $action));
+    print_header("$course->shortname: ".get_string('grades'), $course->fullname, grade_nav($course, $action));
 
     grade_preferences_menu($action, $course, $group);
 
index d4a1ae7..4422b0b 100644 (file)
@@ -2362,7 +2362,8 @@ function grade_set_grade_weights() {
                 }
             }
             else {
-                echo  '<center><font color="red">'.get_string('nonumericweight','grades').$category->name.': "'.$submitted_category.'"</font></center><br />';
+                echo  '<center><font color="red">'.get_string('nonumericweight','grades').
+                        format_string($category->name) .': "'.$submitted_category.'"</font></center><br />';
             }
         }
     }
@@ -2403,7 +2404,7 @@ function grade_display_grade_weights() {
             if ($category->name == UNCATEGORISED) {
                 $category->name = get_string(UNCATEGORISED, 'grades');
             }
-            echo  '<tr><td align="center" class="generalboxcontent">'.$category->name.'</td>';
+            echo  '<tr><td align="center" class="generalboxcontent">'. format_string($category->name) .'</td>';
             echo  '<td align="center" class="generalboxcontent"><input type="text" size="5" name="'.$form_catname.'" value="'.$val.'" /></td>';
             echo  '<td align="center" class="generalboxcontent"><input type="text" size="5" name="drop_x_lowest'.$form_catname.'" value="'.$category->drop_x_lowest.'" /></td>';
             echo  '<td align="center" class="generalboxcontent"><input type="text" size="5" name="bonus_points'.$form_catname.'" value="'.$category->bonus_points.'" /></td>';
@@ -2701,10 +2702,10 @@ function grade_category_select($id_selected = 0) {
                 $category->name = get_string('uncategorised', 'grades');
             }
             if ($category->id == $id_selected) {
-                echo  '<option value="'.$category->id.'" selected="selected">'.$category->name.'</option>';
+                echo  '<option value="'.$category->id.'" selected="selected">'. format_string($category->name) .'</option>';
             }
             else {
-                echo  '<option value="'.$category->id.'">'.$category->name.'</option>';
+                echo  '<option value="'.$category->id.'">'. format_string($category->name) .'</option>';
             }
         }
     }
index 1887152..38416ed 100644 (file)
@@ -78,7 +78,7 @@ if ($success) {
     $groupname = groups_get_group_displayname($groupid);
 
     print_header("$course->shortname: $strgroups", 
-                 "$course->fullname"
+                 $course->fullname
                  "<a href=\"$CFG->wwwroot/course/view.php?id=$courseid\">$course->shortname</a> ".
                  "-> <a href=\"$CFG->wwwroot/user/index.php?id=$courseid\">$strparticipants</a> ".
                  "-> $strgroups", '', '', true, '', user_login_string($course, $USER));
index a2bf058..6408fc0 100644 (file)
@@ -139,7 +139,7 @@ if ($success) {
 /// Print the page and form
 
     print_header("$course->shortname: ". $strheading,
-                 "$course->fullname"
+                 $course->fullname
                  "<a href=\"$CFG->wwwroot/course/view.php?id=$courseid\">$course->shortname</a> ".
                  "-> <a href=\"$CFG->wwwroot/user/index.php?id=$courseid\">$strparticipants</a> ".
                  "-> $strgroups", '', '', true, '', user_login_string($course, $USER));
index 16cebb6..0ea021b 100644 (file)
@@ -104,7 +104,7 @@ if ($success) {
 /// Print the page and form
 
     print_header("$course->shortname: $strgroups", 
-                 "$course->fullname"
+                 $course->fullname
                  "<a href=\"$CFG->wwwroot/course/view.php?id=$courseid\">$course->shortname</a> ".
                  "-> <a href=\"$CFG->wwwroot/user/index.php?id=$courseid\">$strparticipants</a> ".
                  "-> $strgroups", '', '', true, '', user_login_string($course, $USER));
index 4761d55..48f3181 100644 (file)
@@ -48,7 +48,7 @@ if (!$error) {
        $strparticipants = get_string('participants');
        // Print the page and form
        print_header("$course->shortname: $strgroups", 
-                 "$course->fullname"
+                 $course->fullname
                     "<a href=\"$CFG->wwwroot/course/view.php?id=$courseid\">$course->shortname</a> ".
                     "-> <a href=\"$CFG->wwwroot/user/index.php?id=$courseid\">$strparticipants</a> ".
                     "-> $strgroups", "", "", true, '', user_login_string($course, $USER));
index 34da1bf..726f60a 100644 (file)
@@ -38,7 +38,7 @@ if ($success) {
        // Print the page and form
        $strgroups = get_string('groups');
        $strparticipants = get_string('participants');
-       print_header("$course->shortname: $strgroups", "$course->fullname"
+       print_header("$course->shortname: $strgroups", $course->fullname
                     "<a href=\"$CFG->wwwroot/course/view.php?id=$courseid\">$course->shortname</a> ".
                     "-> <a href=\"$CFG->wwwroot/user/index.php?id=$courseid\">$strparticipants</a> ".
                     "-> <a href=\"$CFG->wwwroot/group/groupui/index.php?id=$courseid\">$strgroups</a>".
index 58cb20f..276a6de 100644 (file)
@@ -145,7 +145,7 @@ if ($success) {
     $strparticipants = get_string('participants');
 
     print_header("$course->shortname: $strgroups home", //TODO: home
-                 "$course->fullname"
+                 $course->fullname
                  "<a href=\"$CFG->wwwroot/course/view.php?id=$courseid\">$course->shortname</a> ".
                  "-> <a href=\"$CFG->wwwroot/user/index.php?id=$courseid\">$strparticipants</a> ".
                  "-> $strgroups", '', '', true, '', user_login_string($course, $USER));
@@ -154,7 +154,7 @@ if ($success) {
     //TODO: eventually we'll implement all buttons, meantime hide the ones we haven't finised.
     $shownotdone  = false;
     
-    print_heading($course->shortname.' '.$strgroups, 'center', 3);
+    print_heading(format_string($course->shortname) .' '.$strgroups, 'center', 3);
 ?>
 <form id="groupeditform" action="index.php" method="post">
     <div>
index a04ca0d..33bed77 100755 (executable)
@@ -2511,13 +2511,13 @@ function print_context_name($context) {
 
         case CONTEXT_COURSECAT: // Coursecat -> coursecat or site
             if ($category = get_record('course_categories', 'id', $context->instanceid)) {
-                $name = get_string('category').': '.$category->name;
+                $name = get_string('category').': '. format_string($category->name);
             }
             break;
 
         case CONTEXT_COURSE: // 1 to 1 to course cat
             if ($course = get_record('course', 'id', $context->instanceid)) {
-                $name = get_string('course').': '.$course->fullname;
+                $name = get_string('course').': '. format_string($course->fullname);
             }
             break;
 
index 4ceeabb..d42ba5e 100644 (file)
@@ -126,7 +126,7 @@ function main_upgrade($oldversion=0) {
                     $mod->instance = $news->id;
                     $mod->section = 0;
                     if (! $mod->coursemodule = add_course_module($mod) ) {
-                        notify("Could not add a new course module to the course '$course->fullname'");
+                        notify("Could not add a new course module to the course '" . format_string($course->fullname) . "'");
                         return false;
                     }
                     if (! $sectionid = add_mod_to_section($mod) ) {
@@ -144,7 +144,7 @@ function main_upgrade($oldversion=0) {
                     $mod->instance = $social->id;
                     $mod->section = 0;
                     if (! $mod->coursemodule = add_course_module($mod) ) {
-                        notify("Could not add a new course module to the course '$course->fullname'");
+                        notify("Could not add a new course module to the course '" . format_string($course->fullname) . "'");
                         return false;
                     }
                     if (! $sectionid = add_mod_to_section($mod) ) {
@@ -169,7 +169,7 @@ function main_upgrade($oldversion=0) {
                 $modinfo = serialize(get_array_of_activities($course->id));
 
                 if (!set_field("course", "modinfo", $modinfo, "id", $course->id)) {
-                    notify("Could not cache module information for course '$course->fullname'!");
+                    notify("Could not cache module information for course '" . format_string($course->fullname) . "'!");
                 }
             }
         }
@@ -199,7 +199,7 @@ function main_upgrade($oldversion=0) {
                 $modinfo = serialize(get_array_of_activities($course->id));
 
                 if (!set_field("course", "modinfo", $modinfo, "id", $course->id)) {
-                    notify("Could not cache module information for course '$course->fullname'!");
+                    notify("Could not cache module information for course '" . format_string($course->fullname) . "'!");
                 }
             }
         }
@@ -286,7 +286,7 @@ function main_upgrade($oldversion=0) {
                 $modinfo = serialize(get_array_of_activities($course->id));
 
                 if (!set_field("course", "modinfo", $modinfo, "id", $course->id)) {
-                    notify("Could not cache module information for course '$course->fullname'!");
+                    notify("Could not cache module information for course '" . format_string($course->fullname) . "'!");
                 }
             }
         }
@@ -506,7 +506,7 @@ function main_upgrade($oldversion=0) {
 
         if ($courses = get_records_select("course", "category > 0")) {
             foreach ($courses as $course) {
-                notify("Processing $course->fullname ...", "green");
+                notify("Processing " . format_string($course->fullname) . " ...", "green");
                 flush();
                 if ($users = get_records_select("user_teachers", "course = '$course->id'",
                                                 "id", "id, userid, timeaccess")) {
index 41ffe24..22fe33a 100644 (file)
@@ -63,7 +63,7 @@ function main_upgrade($oldversion=0) {
                 $modinfo = serialize(get_array_of_activities($course->id));
 
                 if (!set_field("course", "modinfo", $modinfo, "id", $course->id)) {
-                    notify("Could not cache module information for course '$course->fullname'!");
+                    notify("Could not cache module information for course '" . format_string($course->fullname) . "'!");
                 }
             }
         }
@@ -255,7 +255,7 @@ function main_upgrade($oldversion=0) {
 
         if ($courses = get_records_select("course", "category > 0")) {
             foreach ($courses as $course) {
-                notify("Processing $course->fullname ...", "green");
+                notify("Processing " . format_string($course->fullname) . " ...", "green");
                 flush();
                 if ($users = get_records_select("user_teachers", "course = '$course->id'", 
                                                 "id", "id, userid, timeaccess")) {
index 17bc719..09c3752 100644 (file)
@@ -1752,7 +1752,7 @@ function require_login($courseorid=0, $autologinguest=true, $cm=null) {
                 case 1:    /// Guests always allowed 
                     if (!has_capability('moodle/course:view', $context)) {    // Prohibited by capability
                         print_header_simple();
-                        notice(get_string('guestsnotallowed', '', $COURSE->fullname), "$CFG->wwwroot/login/index.php");
+                        notice(get_string('guestsnotallowed', '', format_string($COURSE->fullname)), "$CFG->wwwroot/login/index.php");
                     }
                     if (!empty($cm) and !$cm->visible) { // Not allowed to see module, send to course page
                         redirect($CFG->wwwroot.'/course/view.php?id='.$cm->course, 
@@ -1773,9 +1773,9 @@ function require_login($courseorid=0, $autologinguest=true, $cm=null) {
                 default:    /// Guests not allowed
                     print_header_simple('', '', get_string('loggedinasguest'));
                     if (empty($USER->switchrole[$context->id])) {  // Normal guest
-                        notice(get_string('guestsnotallowed', '', $COURSE->fullname), "$CFG->wwwroot/login/index.php");
+                        notice(get_string('guestsnotallowed', '', format_string($COURSE->fullname)), "$CFG->wwwroot/login/index.php");
                     } else {
-                        notify(get_string('guestsnotallowed', '', $COURSE->fullname));
+                        notify(get_string('guestsnotallowed', '', format_string($COURSE->fullname)));
                         echo '<div class="notifyproblem">'.switchroles_form($COURSE->id).'</div>';
                         print_footer($COURSE);
                         exit;
@@ -3663,7 +3663,7 @@ function email_welcome_message_to_user($course, $user=NULL) {
     }
 
     if (!empty($course->welcomemessage)) {
-        $subject = get_string('welcometocourse', '', $course->fullname);
+        $subject = get_string('welcometocourse', '', format_string($course->fullname));
 
         $a->coursename = $course->fullname;
         $a->profileurl = "$CFG->wwwroot/user/view.php?id=$USER->id&course=$course->id";
index 2713996..b4b311e 100644 (file)
@@ -495,7 +495,7 @@ function question_delete_course($course, $feedback=true) {
                     if (!isset($course->shortname)) {
                         $course->shortname = 'id=' . $course->id;
                     }
-                    $concat->name = get_string('savedfromdeletedcourse', 'quiz', $course->shortname);
+                    $concat->name = get_string('savedfromdeletedcourse', 'quiz', format_string($course->shortname));
                     $concat->info = $concat->name;
                     $concat->publish = 1;
                     $concat->stamp = make_unique_id_code();
diff --git a/lib/simpletest/testweblib.php b/lib/simpletest/testweblib.php
new file mode 100644 (file)
index 0000000..9506311
--- /dev/null
@@ -0,0 +1,33 @@
+<?php
+/**
+ * Unit tests for (some of) ../weblib.php.
+ *
+ * @copyright &copy; 2006 The Open University
+ * @author T.J.Hunt@open.ac.uk
+ * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
+ * @package moodlecore
+ */
+
+/** */
+require_once(dirname(__FILE__) . '/../../config.php');
+
+global $CFG;
+require_once($CFG->libdir . '/simpletestlib.php');
+require_once($CFG->libdir . '/weblib.php');
+
+class web_test extends UnitTestCase {
+
+    function setUp() {
+    }
+
+    function tearDown() {
+    }
+
+    function test_format_string() {
+        $this->assertEqual(format_string("& &&&&& &&"), "&amp; &amp;&amp;&amp;&amp;&amp; &amp;&amp;");        
+        $this->assertEqual(format_string("ANother & &&&&& Category"), "ANother &amp; &amp;&amp;&amp;&amp;&amp; Category");
+        $this->assertEqual(format_string("ANother & &&&&& Category", true), "ANother &amp; &amp;&amp;&amp;&amp;&amp; Category");
+        $this->assertEqual(format_string("Nick's Test Site & Other things", true), "Nick's Test Site &amp; Other things");
+    }    
+}
+?>
index 3f0f7c7..e53d70e 100644 (file)
@@ -1410,7 +1410,10 @@ function format_title($string, $plaintext=true, $courseid=null) {
 function format_string ($string, $striplinks = false, $courseid=NULL ) {
 
     global $CFG, $COURSE;
-
+    
+    // First replace all ampersands not followed html entity code
+    $string = preg_replace("/\&(?![a-z0-9]{1,8};)/", "&amp;", $string);
+    
     //We'll use a in-memory cache here to speed up repeated strings
     static $strcache = false;
 
@@ -1436,7 +1439,8 @@ function format_string ($string, $striplinks = false, $courseid=NULL ) {
 
     //Store to cache
     $strcache[$md5] = $string;
-
+       
+        
     return $string;
 }
 
@@ -2032,7 +2036,9 @@ function print_header ($title='', $heading='', $navigation='', $focus='',
                        $usexml=false, $bodytags='', $return=false) {
 
     global $USER, $CFG, $THEME, $SESSION, $ME, $SITE, $COURSE;
-
+    
+    $heading = format_string($heading); // Fix for MDL-8582
+    
 /// This makes sure that the header is never repeated twice on a page
     if (defined('HEADER_PRINTED')) {
         debugging('print_header() was called more than once - this should not happen.  Please check the code for this page closely. Note: error() and redirect() are now safe to call after print_header().');
@@ -2222,7 +2228,8 @@ function print_header ($title='', $heading='', $navigation='', $focus='',
     $bodytags .= ' class="'.$pageclass.'" id="'.$pageid.'"';
 
     ob_start();
-    $title = s($title); // fix for MDL-8582
+
+    $title = format_string($title); // fix for MDL-8582
     include($CFG->header);
     $output = ob_get_contents();
     ob_end_clean();
@@ -2317,10 +2324,10 @@ function print_header_simple($title='', $heading='', $navigation='', $focus='',
 
     $shortname ='';
     if ($COURSE->id != SITEID) {
-        $shortname = '<a href="'.$CFG->wwwroot.'/course/view.php?id='. $COURSE->id .'">'. s($COURSE->shortname) .'</a> ->';
+        $shortname = '<a href="'.$CFG->wwwroot.'/course/view.php?id='. $COURSE->id .'">'. $COURSE->shortname .'</a> ->';
     }
 
-    $output = print_header(s($COURSE->shortname) .': '. s($title), s($COURSE->fullname) .' '. s($heading), $shortname.' '. $navigation, $focus, $meta,
+    $output = print_header($COURSE->shortname .': '. $title, $COURSE->fullname .' '. $heading, $shortname.' '. $navigation, $focus, $meta,
                            $cache, $button, $menu, $usexml, $bodytags, true);
 
     if ($return) {
@@ -2358,7 +2365,7 @@ function print_footer($course=NULL, $usercourse=NULL, $return=false) {
             $home  = true;
         } else {
             $homelink = '<div class="homelink"><a '.$CFG->frametarget.' href="'.$CFG->wwwroot.
-                        '/course/view.php?id='.$course->id.'">'.s($course->shortname).'</a></div>';
+                        '/course/view.php?id='.$course->id.'">'.format_string($course->shortname).'</a></div>';
             $home  = false;
         }
     } else {
@@ -2813,16 +2820,47 @@ function print_navigation ($navigation, $separator=0, $return=false) {
     }
 
     if ($navigation) {
-        //Accessibility: breadcrumb links now in a list, &raquo; replaced with a 'silent' character.
-        $nav_text = get_string('youarehere','access');
-        $output .= '<h2 class="accesshide">'.$nav_text."</h2><ul>\n";
+        
+        if (!is_array($navigation)) {
+            $ar = explode('->', $navigation);
+            $navigation = array();
+            
+            foreach ($ar as $a) {
+                if (strpos($a, '</a>') === false) {
+                    $navigation[trim(format_string($a))] = '';
+                } else {
+                    if (preg_match('/<a.*href="([^"]*)">(.*)<\/a>/', $a, $matches)) {                  
+                        $navigation[trim(format_string($matches[2]))] = $matches[1];
+                    }
+                }
+            }
+        }
+
         if (! $site = get_site()) {
+            $site = new object();
             $site->shortname = get_string('home');
         }
-
-        $navigation = "<li>$separator ". str_replace('->', "</li>\n<li>$separator", $navigation) ."</li>\n";
-        $output .= '<li class="first"><a '.$CFG->frametarget.' onclick="this.target=\''.$CFG->framename.'\'" href="'. $CFG->wwwroot.((!has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID)) && !empty($USER->id) && !empty($CFG->mymoodleredirect) && !isguest())
-                                                                       ? '/my' : '') .'/">'. $site->shortname ."</a></li>\n". $navigation;
+        
+        //Accessibility: breadcrumb links now in a list, &raquo; replaced with a 'silent' character.
+        $nav_text = get_string('youarehere','access');
+        $output .= '<h2 class="accesshide">'.$nav_text."</h2><ul>\n";
+        
+        $output .= '<li class="first"><a '.$CFG->frametarget.' onclick="this.target=\''.$CFG->framename.'\'" href="'
+               .$CFG->wwwroot.((!has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM, SITEID))
+                                 && !empty($USER->id) && !empty($CFG->mymoodleredirect) && !isguest())
+                                 ? '/my' : '') .'/">'. format_string($site->shortname) ."</a></li>\n";
+        
+        
+        foreach ($navigation as $title=>$url) {
+            $title = strip_tags(format_string($title));
+            if (empty($url)) {
+                $output .= '<li class="first">'."$separator $title</li>\n";
+            } else {
+                $output .= '<li class="first">' . $separator  . ' <a '.$CFG->frametarget.' onclick="this.target=\''.$CFG->framename.'\'" href="'
+                           .$url.'">'."$title</a></li>\n";
+            }
+        }    
+        
         $output .= "</ul>\n";
     }
 
@@ -5730,4 +5768,4 @@ function frametarget() {
 }
 
 // vim:autoindent:expandtab:shiftwidth=4:tabstop=4:tw=140:
-?>
\ No newline at end of file
+?>
index 7f12d43..10f2ba5 100644 (file)
 
 /// Header on this page
     if ($tab == 'contacts') {
-        print_header(get_string('messages', 'message').' - '.$SITE->fullname, '', '', '', 
+        print_header(get_string('messages', 'message').' - '.format_string($SITE->fullname), '', '', '', 
                 '<meta http-equiv="refresh" content="'. $CFG->message_contacts_refresh .'; url=index.php" />');
     } else {
-        print_header(get_string('messages', 'message').' - '.$SITE->fullname);
+        print_header(get_string('messages', 'message').' - '.format_string($SITE->fullname));
     }
 
     echo '<table cellspacing="2" cellpadding="2" border="0" align="center" width="95%">';
index fa274b1..a2d82cf 100644 (file)
@@ -1763,7 +1763,7 @@ function assignment_cron () {
             course_setup($course);
 
             if (!has_capability('moodle/course:view', get_context_instance(CONTEXT_COURSE, $submission->course), $user->id)) {
-                echo fullname($user)." not an active participant in $course->shortname\n";
+                echo fullname($user)." not an active participant in " . format_string($course->shortname) . "\n";
                 continue;
             }
 
index 712a7a4..65e4d86 100644 (file)
@@ -64,7 +64,7 @@
  <head>
   <meta http-equiv="content-type" content="text/html; charset=utf-8" />
   <title>
-   <?php echo "$strchat: $course->shortname: ".format_string($chat->name,true)."$groupname" ?>
+   <?php echo "$strchat: " . format_string($course->shortname) . ": ".format_string($chat->name,true)."$groupname" ?>
   </title>
  </head>
  <frameset cols="*,200" border="5" framespacing="no" frameborder="yes" marginwidth="2" marginheight="1">
index 220b370..33ca929 100644 (file)
@@ -59,7 +59,7 @@
  <head>
   <meta http-equiv="content-type" content="text/html; charset=utf-8" />
   <title>
-   <?php echo "$strchat: $course->shortname: ".format_string($chat->name,true)."$groupname" ?>
+   <?php echo "$strchat: " . format_string($course->shortname) . ": ".format_string($chat->name,true)."$groupname" ?>
   </title>
  </head>
  <frameset cols="*,200" border="5" framespacing="no" frameborder="yes" marginwidth="2" marginheight="1">
index 30ef203..5673836 100644 (file)
             echo '<p align="center">'. get_string('noguestchoose', 'choice') .'</p>';
             echo '<div class="continuebutton">';
             print_single_button($CFG->wwwroot.'/course/enrol.php?id='.$course->id, NULL, 
-                                get_string('enrolme', '', $course->shortname), 'post', $CFG->framename);
+                                get_string('enrolme', '', format_string($course->shortname)), 'post', $CFG->framename);
             echo '</div>'."\n";
             print_simple_box_end();
 
index e2b884a..6253d4a 100755 (executable)
@@ -96,7 +96,7 @@
     if (!empty($CFG->enablerssfeeds) && !empty($CFG->data_enablerssfeeds) && $data->rssarticles > 0) {
         $rsspath = rss_get_url($course->id, $USER->id, 'data', $data->id);
         $meta .= '<link rel="alternate" type="application/rss+xml" ';
-        $meta .= 'title ="'.$course->shortname.': %fullname%" href="'.$rsspath.'" />';
+        $meta .= 'title ="'. format_string($course->shortname) .': %fullname%" href="'.$rsspath.'" />';
     }
     if ($data->csstemplate) {
         $meta .= '<link rel="stylesheet" type="text/css" href="'.$CFG->wwwroot.'/mod/data/css.php?d='.$data->id.'" /> ';
index 69e95ec..6ca69d8 100755 (executable)
     if (!empty($CFG->enablerssfeeds) && !empty($CFG->data_enablerssfeeds) && $data->rssarticles > 0) {
         $rsspath = rss_get_url($course->id, $USER->id, 'data', $data->id);
         $meta .= '<link rel="alternate" type="application/rss+xml" ';
-        $meta .= 'title ="'.$course->shortname.': %fullname%" href="'.$rsspath.'" />';
+        $meta .= 'title ="'. format_string($course->shortname) .': %fullname%" href="'.$rsspath.'" />';
     }
     if ($data->csstemplate) {
         $meta .= '<link rel="stylesheet" type="text/css" href="'.$CFG->wwwroot.'/mod/data/css.php?d='.$data->id.'" /> ';
index b9f8175..9736f6c 100644 (file)
     $searchform = forum_search_form($course);
 
     if ($course->id != SITEID) {
-        print_header("$course->shortname: ".format_string($discussion->name), "$course->fullname",
+        print_header("$course->shortname: ".format_string($discussion->name), $course->fullname,
                      "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->
                       $navmiddle $navtail", "", "", true, $searchform, navmenu($course, $cm));
     } else {
-        print_header("$course->shortname: ".format_string($discussion->name), "$course->fullname",
+        print_header("$course->shortname: ".format_string($discussion->name), $course->fullname,
                      "$navmiddle $navtail", "", "", true, $searchform, navmenu($course, $cm));
     }
 
index df7c92f..14bcff3 100644 (file)
         $returnto = forum_go_back_to("index.php?id=$course->id");
         if ($subscribe) {
             add_to_log($course->id, "forum", "subscribeall", "index.php?id=$course->id", $course->id);
-            redirect($returnto, get_string("nowallsubscribed", "forum", $course->shortname), 1);
+            redirect($returnto, get_string("nowallsubscribed", "forum", format_string($course->shortname)), 1);
         } else {
             add_to_log($course->id, "forum", "unsubscribeall", "index.php?id=$course->id", $course->id);
-            redirect($returnto, get_string("nowallunsubscribed", "forum", $course->shortname), 1);
+            redirect($returnto, get_string("nowallunsubscribed", "forum", format_string($course->shortname)), 1);
         }
     }
 
     /// Output the page
 
     if ($course->id != SITEID) {
-        print_header("$course->shortname: $strforums", "$course->fullname",
+        print_header("$course->shortname: $strforums", $course->fullname,
                     "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> -> $strforums",
                     "", "", true, $searchform, navmenu($course));
     } else {
-        print_header("$course->shortname: $strforums", "$course->fullname", "$strforums",
+        print_header("$course->shortname: $strforums", $course->fullname, "$strforums",
                     "", "", true, $searchform, navmenu($course));
     }
 
index 3a42cc2..e7db81a 100644 (file)
@@ -1726,7 +1726,7 @@ function forum_get_course_forum($courseid, $type) {
     $mod->instance = $forum->id;
     $mod->section = 0;
     if (! $mod->coursemodule = add_course_module($mod) ) {   // assumes course/lib.php is loaded
-        notify("Could not add a new course module to the course '$course->fullname'");
+        notify("Could not add a new course module to the course '" . format_string($course->fullname) . "'");
         return false;
     }
     if (! $sectionid = add_mod_to_section($mod) ) {   // assumes course/lib.php is loaded
index 1ef1150..b26815d 100644 (file)
     }
     if ($course->id != SITEID) {
         print_header("$course->shortname: $strdiscussionname ".
-                      format_string($toppost->subject), "$course->fullname",
+                      format_string($toppost->subject), $course->fullname,
                      "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->
                       $navmiddle $navtail", $mform_post->focus(), "", true, "", navmenu($course, $cm));
 
     } else {
         print_header("$course->shortname: $strdiscussionname ".
-                      format_string($toppost->subject), "$course->fullname",
+                      format_string($toppost->subject), $course->fullname,
                      "$navmiddle $navtail", $mform_post->focus(), "", true, "", navmenu($course, $cm));
 
     }
index a28e33a..4fb6749 100644 (file)
     $fullname        = fullname($user, has_capability('moodle/site:viewfullnames', $syscontext));
 
     if ($course->id != SITEID) {
-        print_header("$course->shortname: $fullname: $strmode", "$course->fullname",
+        print_header("$course->shortname: $fullname: $strmode", $course->fullname,
                  "<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a> ->
                   <a href=\"$CFG->wwwroot/user/index.php?id=$course->id\">$strparticipants</a> ->
                   <a href=\"$CFG->wwwroot/user/view.php?id=$user->id&amp;course=$course->id\">$fullname</a> -> 
                   $strforumposts -> $strmode");
     } else {
-        print_header("$course->shortname: $fullname: $strmode", "$course->fullname",
+        print_header("$course->shortname: $fullname: $strmode", $course->fullname,
                  "<a href=\"$CFG->wwwroot/user/view.php?id=$user->id&amp;course=$course->id\">$fullname</a> -> 
                   $strforumposts -> $strmode");
     }
index e27b601..305d42c 100644 (file)
@@ -43,7 +43,7 @@
         require_login($course->id);
     }
 
-    print_header("$course->shortname: ".format_string($glossary->name), "$course->fullname",
+    print_header("$course->shortname: ".format_string($glossary->name), $course->fullname,
         "$navigation <a href=\"index.php?id=$course->id\">$strglossaries</a> -> ".format_string($glossary->name),
         "", "", true, update_module_button($cm->id, $course->id, $strglossary),
         navmenu($course, $cm));
index d99bc3a..1aa8dae 100644 (file)
 
     $site = get_record("course","id",1);
     echo '<p align="right"><font size="-1">' . userdate(time()) . '</font></p>';
-    echo get_string("site") . ': <strong>' . $site->fullname . '</strong><br />';
-    echo get_string("course") . ': <strong>' . $course->fullname . ' ('. $course->shortname . ')</strong><br />';
+    echo get_string("site") . ': <strong>' . format_string($site->fullname) . '</strong><br />';
+    echo get_string("course") . ': <strong>' . format_string($course->fullname) . ' ('. format_string($course->shortname) . ')</strong><br />';
     echo get_string("modulename","glossary") . ': <strong>' . format_string($glossary->name, true) . '</strong>';
     if ( $allentries ) {
         foreach ($allentries as $entry) {
index febbd5b..a01affd 100644 (file)
 
         $CFG->framename = "newwindow";
         if ($course->id != SITEID) {
-            print_header(strip_tags("$course->shortname: $strglossaries $strsearch"), "$course->fullname",
+            print_header(strip_tags("$course->shortname: $strglossaries $strsearch"), $course->fullname,
             "<a target=\"newwindow\" href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a> -> $strglossaries -> $strsearch", "", "", true, "&nbsp;", "&nbsp;");
         } else {
-            print_header(strip_tags("$course->shortname: $strglossaries $strsearch"), "$course->fullname",
+            print_header(strip_tags("$course->shortname: $strglossaries $strsearch"), $course->fullname,
             "$strglossaries -> $strsearch", "", "", true, "&nbsp;", "&nbsp;");
         }
 
index 1d15ee6..04bd0e1 100644 (file)
@@ -34,9 +34,9 @@
 
     // Print the header
 
-    $title = "$course->shortname: $strmodulenameplural";
-    $heading = "$course->fullname";
-    $navigation = "$strmodulenameplural";
+    $title = format_string($course->shortname) . ": $strmodulenameplural";
+    $heading = $course->fullname;
+    $navigation = $strmodulenameplural;
     if ($course->id != SITEID) {
         $navigation = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> -> $navigation";
     }
index b4007f7..13883d8 100644 (file)
@@ -398,8 +398,8 @@ function hotpot_print_report_heading(&$course, &$cm, &$hotpot, &$mode) {
     $strmodulenameplural = get_string("modulenameplural", "hotpot");
     $strmodulename  = get_string("modulename", "hotpot");
 
-    $title = "$course->shortname: $hotpot->name";
-    $heading = "$course->fullname";
+    $title = format_string($course->shortname) . ": $hotpot->name";
+    $heading = $course->fullname;
 
     $navigation = "<a href=index.php?id=$course->id>$strmodulenameplural</a> -> ";
     $navigation .= "<a href=\"view.php?id=$cm->id\">$hotpot->name</a> -> ";
index 0f9357e..d0f7f39 100644 (file)
@@ -50,8 +50,8 @@
     $strmodulenameplural = get_string("modulenameplural", "hotpot");
     $strmodulename  = get_string("modulename", "hotpot");
     // print header
-    $title = "$course->shortname: $hotpot->name";
-    $heading = "$course->fullname";
+    $title = format_string($course->shortname) . ": $hotpot->name";
+    $heading = $course->fullname;
     $navigation = "<a href=\"index.php?id=$course->id\">$strmodulenameplural</a> -> ".get_string("review", "quiz");
     if ($course->id != SITEID) {
         $navigation = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> -> $navigation";
index 9e31573..375d9fa 100644 (file)
@@ -40,8 +40,8 @@
     // set nextpage (for error messages)
     $nextpage = "$CFG->wwwroot/course/view.php?id=$course->id";
     // header strings
-    $title = strip_tags($course->shortname.': '.$hotpot->name);
-    $heading = "$course->fullname";
+    $title = format_string($course->shortname.': '.$hotpot->name, true);
+    $heading = $course->fullname;
     $navigation = '<a '.$CFG->frametarget.' href="'.$CFG->wwwroot.'/mod/hotpot/index.php?id='.$course->id.'">'.get_string("modulenameplural", "hotpot")."</a> -> $hotpot->name";
     if ($course->id != SITEID) {
         $navigation = '<a '.$CFG->frametarget.' href="'.$CFG->wwwroot.'/course/view.php?id='.$course->id.'">'.$course->shortname.'</a> -> '.$navigation;
index 62399df..83d1ecb 100644 (file)
@@ -28,7 +28,7 @@
         $navigation = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->";
     }
 
-    print_header("$course->shortname: $strlamss", "$course->fullname", "$navigation $strlamss", "", "", true, "", navmenu($course));
+    print_header("$course->shortname: $strlamss", $course->fullname, "$navigation $strlamss", "", "", true, "", navmenu($course));
 
 /// Get all the appropriate data
 
index 10b9802..26c90cc 100644 (file)
@@ -36,7 +36,7 @@
         $navigation = '';
     }
 
-    print_header("$course->shortname: $strlessons", "$course->fullname", "$navigation $strlessons", "", "", true, "", navmenu($course));
+    print_header("$course->shortname: $strlessons", $course->fullname, "$navigation $strlessons", "", "", true, "", navmenu($course));
 
 /// Get all the appropriate data
 
index 22cd156..7f3ae9c 100644 (file)
@@ -27,7 +27,7 @@
     $strsummary = get_string("summary");
     $strlastmodified = get_string("lastmodified");
 
-    print_header("$course->shortname: $strresources", "$course->fullname", "$navigation $strresources", 
+    print_header("$course->shortname: $strresources", $course->fullname, "$navigation $strresources", 
                  "", "", true, "", navmenu($course));
 
     if (! $resources = get_all_instances_in_course("resource", $course)) {
index 0537b4f..a00c6f6 100644 (file)
@@ -354,7 +354,7 @@ function display() {
         echo "<html dir=\"ltr\">\n";
         echo '<head>';
         echo '<meta http-equiv="content-type" content="text/html; charset=utf-8" />';
-        echo "<title>{$course->shortname}: ".strip_tags(format_string($resource->name,true))."</title></head>\n";
+        echo "<title>" . format_string($course->shortname) . ": ".strip_tags(format_string($resource->name,true))."</title></head>\n";
         echo "<frameset rows=\"$CFG->resource_framesize,*\">";
         echo "<frame src=\"view.php?id={$cm->id}&amp;type={$resource->type}&amp;frameset=top\" title=\"".get_string('modulename','resource')."\"/>";
         if (!empty($localpath)) {  // Show it like this so we interpose some HTML
index d851076..75400a6 100644 (file)
@@ -347,7 +347,7 @@ function display() {
         echo "<html dir=\"ltr\">\n";
         echo '<head>';
         echo '<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />';
-        echo "<title>{$course->shortname}: ".strip_tags(format_string($resource->name,true))."</title></head>\n";
+        echo "<title>" . format_string($course->shortname) . ": ".strip_tags(format_string($resource->name,true))."</title></head>\n";
         echo "<frameset rows=\"$CFG->resource_framesize,*\">";
         echo "<frame src=\"view.php?id={$cm->id}&amp;type={$resource->type}&amp;frameset=top\" title=\"".get_string('modulename','resource')."\"/>";
         if (!empty($localpath)) {  // Show it like this so we interpose some HTML
index d2f6e68..d3918ab 100755 (executable)
@@ -61,7 +61,7 @@
     $pagetitle = strip_tags("$course->shortname: ".format_string($scorm->name));
 
     if (!$cm->visible and !has_capability('moodle/course:viewhiddenactivities', get_context_instance(CONTEXT_COURSE,$course->id))) {
-        print_header($pagetitle, "$course->fullname",
+        print_header($pagetitle, $course->fullname,
                  "$navigation <a $CFG->frametarget href=\"view.php?id=$cm->id\">".format_string($scorm->name,true)."</a>",
                  '', '', true, update_module_button($cm->id, $course->id, $strscorm), '', false);
         notice(get_string("activityiscurrentlyhidden"));
         $bodyscript = 'onunload="main.close();"';
     }
     $exitlink = '(<a href="'.$CFG->wwwroot.'/course/view.php?id='.$cm->course.'">'.get_string('exit','scorm').'</a>)&nbsp;';
-    print_header($pagetitle, "$course->fullname",
+    print_header($pagetitle, $course->fullname,
                  "$navigation <a $CFG->frametarget href=\"view.php?id=$cm->id\">".format_string($scorm->name,true)."</a>",
                  '', '', true, $exitlink.update_module_button($cm->id, $course->id, $strscorm), '', false, $bodyscript);
     if ($sco->scormtype == 'sco') {
index 7967a4c..136366d 100755 (executable)
         $strname  = get_string('name');
         if (empty($b)) {
             if (empty($a)) {
-                print_header("$course->shortname: ".format_string($scorm->name), "$course->fullname",
+                print_header("$course->shortname: ".format_string($scorm->name), $course->fullname,
                              "$navigation <a href=\"index.php?id=$course->id\">$strscorms</a>
                               -> <a href=\"view.php?id=$cm->id\">".format_string($scorm->name,true)."</a> -> $strreport",
                              '', '', true);
             } else {
-                print_header("$course->shortname: ".format_string($scorm->name), "$course->fullname",
+                print_header("$course->shortname: ".format_string($scorm->name), $course->fullname,
                              "$navigation <a href=\"index.php?id=$course->id\">$strscorms</a>
                               -> <a href=\"view.php?id=$cm->id\">".format_string($scorm->name,true)."</a>
                               -> <a href=\"report.php?id=$cm->id\">$strreport</a> -> $strattempt $attempt - ".fullname($userdata),
                              '', '', true);
             }
         } else {
-            print_header("$course->shortname: ".format_string($scorm->name), "$course->fullname",
+            print_header("$course->shortname: ".format_string($scorm->name), $course->fullname,
                      "$navigation <a href=\"index.php?id=$course->id\">$strscorms</a>
                       -> <a href=\"view.php?id=$cm->id\">".format_string($scorm->name,true)."</a>
                       -> <a href=\"report.php?id=$cm->id\">$strreport</a>
index ddbee26..1d547b1 100755 (executable)
@@ -66,7 +66,7 @@
     //
     // Print the page header
     //
-    print_header($pagetitle, "$course->fullname",
+    print_header($pagetitle, $course->fullname,
                  "$navigation <a $CFG->frametarget href=\"view.php?id=$cm->id\">".format_string($scorm->name,true)."</a>",
                  '', '', true, update_module_button($cm->id, $course->id, $strscorm), navmenu($course, $cm));
 
index f2abe24..113f107 100644 (file)
@@ -65,7 +65,7 @@
                        <a href=\"view.php?id=$cm->id\">".format_string($survey->name,true)."</a> -> ";
     }
 
-    print_header("$course->shortname: ".format_string($survey->name), "$course->fullname", "$navigation $strreport",
+    print_header("$course->shortname: ".format_string($survey->name), $course->fullname, "$navigation $strreport",
                  "", "", true,
                  update_module_button($cm->id, $course->id, $strsurvey), navmenu($course, $cm));
 
index 99d23b7..ebe11ac 100644 (file)
@@ -47,7 +47,7 @@
         echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Frameset//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd\">\n";
         echo "<html $direction>\n";
         echo "<head><meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\" />\n";
-        echo "<title>{$course->shortname}: ".format_string($workshop->name,true)."</title></head>\n";
+        echo "<title>" . format_string($course->shortname) . ": ".format_string($workshop->name,true)."</title></head>\n";
         echo "<frameset rows=\"50%,*\" border=\"10\">";
         echo "  <frame src=\"assess.php?id=$id&amp;sid=$sid&amp;frameset=top&amp;redirect=$redirect\" border=\"10\" />";
         echo "  <frame src=\"assess.php?id=$id&amp;sid=$sid&amp;frameset=bottom&amp;redirect=$redirect\" />";
index 68e5247..92cf485 100644 (file)
@@ -427,7 +427,7 @@ class question_category_object {
 
         $edittable->align['category'] =  "left";
         $edittable->wrap['category'] = "nowrap";
-        $row['category'] = '<input type="text" name="updatename" value="' . $category->name . '" size="15" />';
+        $row['category'] = '<input type="text" name="updatename" value="' . format_string($category->name) . '" size="15" />';
 
         $edittable->align['info'] =  "left";
         $edittable->wrap['info'] = "nowrap";
@@ -583,7 +583,7 @@ class question_category_object {
                 error("No such category $destcategoryid!", "category.php?id={$this->course->id}");
             }
             if (! set_field('question', 'category', $destcategoryid, 'category', $deletecat)) {
-                error("Error while moving questions from category '$category->name' to '$category2->name'", "category.php?id={$this->course->id}");
+                error("Error while moving questions from category '" . format_string($category->name) . "' to '$category2->name'", "category.php?id={$this->course->id}");
             }
 
         } else {
@@ -622,7 +622,7 @@ class question_category_object {
 
         /// Finally delete the category itself
         if (delete_records("question_categories", "id", $category->id)) {
-            notify(get_string("categorydeleted", "quiz", $category->name), 'notifysuccess');
+            notify(get_string("categorydeleted", "quiz", format_string($category->name)), 'notifysuccess');
         }
     }
 
index 26e01d9..10b5461 100644 (file)
                       -> <a href=\"view.php?id=$user->id&amp;course=$course->id\">$userfullname</a>
                       -> $streditmyprofile", "");
     } else {
-        print_header("$course->shortname: $streditmyprofile", "$course->fullname",
+        print_header("$course->shortname: $streditmyprofile", $course->fullname,
                      "<a href=\"view.php?id=$user->id&amp;course=$course->id\">$userfullname</a>
                       -> $streditmyprofile", "");
     }
index ec40bb6..91482f7 100644 (file)
                           -> <a href=\"view.php?id=$user->id&amp;course=$course->id\">$userfullname</a>
                           -> $streditmyprofile", "");
         } else {
-            print_header("$course->shortname: $streditmyprofile", "$course->fullname",
+            print_header("$course->shortname: $streditmyprofile", $course->fullname,
                          "<a href=\"view.php?id=$user->id&amp;course=$course->id\">$userfullname</a>
                           -> $streditmyprofile", "");
         }
index 5c1ae82..a936f27 100644 (file)
@@ -414,7 +414,7 @@ function profile_edit_category($id, $redirect, $adminroot) {
         if (empty($id)) {
             $strheading = get_string('profilecreatenewcategory', 'admin');
         } else {
-            $strheading = get_string('profileeditcategory', 'admin', $category->name);
+            $strheading = get_string('profileeditcategory', 'admin', format_string($category->name));
         }
 
         /// Print the page
index 9733825..f2946b5 100644 (file)
@@ -123,7 +123,7 @@ foreach ($categories as $category) {
         }
     }
 
-    print_heading($category->name.' '.profile_category_icons($category));
+    print_heading(format_string($category->name) .' '.profile_category_icons($category));
     if (count($table->data)) {
         print_table($table);
     } else {
index e960bc0..7aba3f3 100644 (file)
@@ -31,7 +31,7 @@
     if ($filtertype == 'site') {
 
         $site = get_site();
-        print_heading($site->fullname);
+        print_heading(format_string($site->fullname));
         
         if ($CFG->bloglevel >= 4) {
             if (has_capability('moodle/course:viewparticipants', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
@@ -49,7 +49,7 @@
     } else if ($filtertype == 'course' && $filterselect) {
 
         $course = get_record('course','id',$filterselect);
-        print_heading($course->fullname);
+        print_heading(format_string($course->fullname));
 
         if ($CFG->bloglevel >= 3) {
 
index 3994ad0..cb5680f 100644 (file)
                       <a href=\"index.php?id=$course->id\">$strparticipants</a> -> $fullname",
                       "", "", true, "&nbsp;", navmenu($course));
     } else {
-        print_header("$course->fullname: $strpersonalprofile: $fullname", "$course->fullname",
+        print_header("$course->fullname: $strpersonalprofile: $fullname", $course->fullname,
                      "$fullname", "", "", true, "&nbsp;", navmenu($course));
     }
 
         foreach ($mycourses as $mycourse) {
             if ($mycourse->visible and $mycourse->category) {
                 if ($mycourse->id != $course->id){
-                    $courselisting .= "<a href=\"$CFG->wwwroot/user/view.php?id=$user->id&amp;course=$mycourse->id\">$mycourse->fullname</a>, ";
+                    $courselisting .= "<a href=\"$CFG->wwwroot/user/view.php?id=$user->id&amp;course=$mycourse->id\">"
+                        . format_string($mycourse->fullname) . "</a>, ";
                 }
                 else {
-                    $courselisting .= "$mycourse->fullname, ";
+                    $courselisting .= format_string($mycourse->fullname) . ", ";
                 }
             }
             $shown++;