From 60a9a6ea67a878ac17c0d6dd60726cc0a35328e6 Mon Sep 17 00:00:00 2001
From: toyomoyo <toyomoyo>
Date: Wed, 7 Feb 2007 07:34:53 +0000
Subject: [PATCH] fix for some of the MDL-8425 issues

---
 admin/auth.php       | 10 +++----
 admin/enrol.php      |  4 ++-
 admin/modules.php    |  3 ++-
 admin/uploaduser.php | 10 +++----
 admin/user.php       |  9 +++----
 files/index.php      | 63 ++++++++++++++++++++++++++++++++++----------
 lib/adminlib.php     | 32 +++++++++++-----------
 theme/index.php      | 41 ++++++++++++++++------------
 8 files changed, 108 insertions(+), 64 deletions(-)

diff --git a/admin/auth.php b/admin/auth.php
index e092f8713e..0b40297840 100644
--- a/admin/auth.php
+++ b/admin/auth.php
@@ -227,11 +227,11 @@ $guestoptions[1] = get_string("show");
 
 echo '<hr />';
 print_heading(get_string('auth_common_settings', 'auth'));
-echo '<table cellspacing="0" cellpadding="5" border="0" align="center">';
+echo '<table cellspacing="0" cellpadding="5" border="0" style="margin-left:auto;margin-right:auto">';
 
 // User self registration
 echo "<tr valign=\"top\">\n";
-echo "<td align=\"right\" nowrap=\"nowrap\">\n";
+echo "<td align=\"right\" style=\"white-space:nowrap\">\n";
 print_string("selfregistration", "auth");
 echo ":</td>\n";
 echo "<td>\n";
@@ -243,7 +243,7 @@ echo "</td></tr>\n";
 
 // Login as guest button enabled
 echo "<tr valign=\"top\">\n";
-echo "<td align=\"right\" nowrap=\"nowrap\">\n";
+echo "<td style=\"white-space:nowrap;text-align:right\">\n";
 print_string("guestloginbutton", "auth");
 echo ":</td>\n";
 echo "<td>\n";
@@ -256,7 +256,7 @@ echo "</td></tr>\n";
 /// An alternate url for the login form. It means we can use login forms that are integrated
 /// into non-moodle pages
 echo "<tr valign=\"top\">\n";
-echo "<td algin=\"right\" nowrap=\"nowrap\">\n";
+echo "<td algin=\"right\" style=\"white-space:nowrap\">\n";
 print_string('alternateloginurl', 'auth');
 echo "</td>\n";
 echo "<td>\n";
@@ -272,7 +272,7 @@ echo "</table>\n";
 ////////////////////////////////////////////////////////////////////////////////
 
 
-echo '<center><input type="submit" value="'.get_string('savechanges').'" /></center>';
+echo '<div style="text-align:center"><input type="submit" value="'.get_string('savechanges').'" /></div>';
 echo '</form>';
 admin_externalpage_print_footer($adminroot);
 
diff --git a/admin/enrol.php b/admin/enrol.php
index b90ea29a01..7a3b4e9ab4 100644
--- a/admin/enrol.php
+++ b/admin/enrol.php
@@ -53,6 +53,7 @@
     print_simple_box(get_string('configenrolmentplugins', 'admin'), 'center', '700');
 
     echo "<form $CFG->frametarget id=\"enrolmenu\" method=\"post\" action=\"enrol.php\">";
+    echo "<div>";
     echo "<input type=\"hidden\" name=\"sesskey\" value=\"".$USER->sesskey."\" />";
 
     $table = new stdClass();
@@ -97,7 +98,8 @@
 
     print_table($table);
 
-    echo "<center><input type=\"submit\" value=\"".get_string("savechanges")."\" /></center>\n";
+    echo "<div style=\"text-align:center\"><input type=\"submit\" value=\"".get_string("savechanges")."\" /></div>\n";
+    echo "</div>";
     echo "</form>";
 
     admin_externalpage_print_footer($adminroot);
diff --git a/admin/modules.php b/admin/modules.php
index 43d606cc97..a86eedc50d 100644
--- a/admin/modules.php
+++ b/admin/modules.php
@@ -158,7 +158,8 @@
 
     foreach ($modulebyname as $modulename => $module) {
 
-        $icon = "<img src=\"$CFG->modpixpath/$module->name/icon.gif\" hspace=\"10\" class=\"icon\" alt=\"\" />";
+        // took out hspace="\10\", because it does not validate. don't know what to replace with.
+        $icon = "<img src=\"$CFG->modpixpath/$module->name/icon.gif\" class=\"icon\" alt=\"\" />";
 
         $delete = "<a href=\"modules.php?delete=$module->name&amp;sesskey=$USER->sesskey\">$strdelete</a>";
 
diff --git a/admin/uploaduser.php b/admin/uploaduser.php
index d0113c9de1..c8a4b3d9b4 100755
--- a/admin/uploaduser.php
+++ b/admin/uploaduser.php
@@ -374,13 +374,13 @@ print_heading_with_help($struploadusers, 'uploadusers');
 $noyesoptions = array( get_string('no'), get_string('yes') );
 
 $maxuploadsize = get_max_upload_file_size();
-echo '<center>';
-echo '<form method="post" enctype="multipart/form-data" action="uploaduser.php">'.
+echo '<div style="text-align:center">';
+echo '<form method="post" enctype="multipart/form-data" action="uploaduser.php"><div>'.
 $strfile.'&nbsp;<input type="hidden" name="MAX_FILE_SIZE" value="'.$maxuploadsize.'" />'.
 '<input type="hidden" name="sesskey" value="'.$USER->sesskey.'" />'.
 '<input type="file" name="userfile" size="30" />';
 print_heading(get_string('settings'));
-echo '<table>';
+echo '<table style="margin-left:auto;margin-right:auto">';
 echo '<tr><td>' . get_string('passwordhandling', 'auth') . '</td><td>';
 $passwordopts = array( 0 => get_string('infilefield', 'auth'),
         1 => get_string('createpasswordifneeded', 'auth'),
@@ -397,8 +397,8 @@ choose_from_menu($noyesoptions, 'allowrenames', $allowrenames);
 echo '</td></tr>';
 echo '</table><br />';
 echo '<input type="submit" value="'.$struploadusers.'" />';
-echo '</form><br />';
-echo '</center>';
+echo '</div></form><br />';
+echo '</div>';
 
 admin_externalpage_print_footer($adminroot);
 
diff --git a/admin/user.php b/admin/user.php
index bd0305ced4..f543ad4d93 100644
--- a/admin/user.php
+++ b/admin/user.php
@@ -213,7 +213,7 @@
 
     /// Bar of first initials
 
-    echo "<center><p align=\"center\">";
+    echo "<p style=\"text-align:center\">";
     echo get_string("firstname")." : ";
     if ($firstinitial) {
         echo " <a href=\"user.php?sort=firstname&amp;dir=ASC&amp;".
@@ -249,7 +249,6 @@
         }
     }
     echo "</p>";
-    echo "</center>";
 
     print_paging_bar($usercount, $page, $perpage,
             "user.php?sort=$sort&amp;dir=$dir&amp;perpage=$perpage&amp;firstinitial=$firstinitial&amp;lastinitial=$lastinitial&amp;search=".urlencode(stripslashes($search))."&amp;");
@@ -395,14 +394,14 @@
         echo "</p>";
     }
 
-    echo "<table class=\"searchbox\" align=\"center\" cellpadding=\"10\"><tr><td>";
-    echo "<form action=\"user.php\" method=\"get\">";
+    echo "<table class=\"searchbox\" style=\"margin-left:auto;margin-right:auto\" cellpadding=\"10\"><tr><td>";
+    echo "<form action=\"user.php\" method=\"get\"><fieldset class=\"invisiblefieldset\">";
     echo "<input type=\"text\" name=\"search\" value=\"".s($search, true)."\" size=\"20\" />";
     echo "<input type=\"submit\" value=\"$strsearch\" />";
     if ($search) {
         echo "<input type=\"button\" onclick=\"document.location='user.php';\" value=\"$strshowallusers\" />";
     }
-    echo "</form>";
+    echo "</fieldset></form>";
     echo "</td></tr></table>";
 
     if (has_capability('moodle/user:create', $sitecontext)) {
diff --git a/files/index.php b/files/index.php
index 1c6e43d1f1..a9c0574561 100644
--- a/files/index.php
+++ b/files/index.php
@@ -137,7 +137,7 @@
         }
 
 
-        echo "<table border=\"0\" align=\"center\" cellspacing=\"3\" cellpadding=\"3\" width=\"640\">";
+        echo "<table border=\"0\" style=\"margin-left:auto;margin-right:auto\" cellspacing=\"3\" cellpadding=\"3\" width=\"640\">";
         echo "<tr>";
         echo "<td colspan=\"2\">";
 
@@ -197,7 +197,8 @@
                 $strcancel = get_string("cancel");
 
                 echo "<p>$struploadafile ($strmaxsize) --> <b>$wdir</b></p>";
-                echo "<form enctype=\"multipart/form-data\" method=\"post\" action=\"index.php\">";                
+                echo "<form enctype=\"multipart/form-data\" method=\"post\" action=\"index.php\">";
+                echo "<div>";             
                 echo "<table><tr><td colspan=\"2\">";
                 echo ' <input type="hidden" name="choose" value="'.$choose.'" />';
                 echo " <input type=\"hidden\" name=\"id\" value=\"$id\" />";
@@ -214,6 +215,7 @@
                 echo " <input type=\"hidden\" name=\"wdir\" value=\"$wdir\" />";
                 echo " <input type=\"hidden\" name=\"action\" value=\"cancel\" />";
                 echo " <input type=\"submit\" value=\"$strcancel\" />";
+                echo "</div>";
                 echo "</form>";
             }
             html_footer();
@@ -317,6 +319,7 @@
                 echo "<p>$strrenamefileto:</p>";
                 echo "<table><tr><td>";
                 echo "<form action=\"index.php\" method=\"post\">";
+                echo "<fieldset class=\"invisiblefieldset\">";
                 echo ' <input type="hidden" name="choose" value="'.$choose.'" />';
                 echo " <input type=\"hidden\" name=\"id\" value=\"$id\" />";
                 echo " <input type=\"hidden\" name=\"wdir\" value=\"$wdir\" />";
@@ -325,14 +328,17 @@
                 echo " <input type=\"hidden\" name=\"sesskey\" value=\"$USER->sesskey\" />";
                 echo " <input type=\"text\" name=\"name\" size=\"35\" value=\"$file\" />";
                 echo " <input type=\"submit\" value=\"$strrename\" />";
+                echo "</fieldset>";
                 echo "</form>";
                 echo "</td><td>";
                 echo "<form action=\"index.php\" method=\"get\">";
+                echo "<fieldset class=\"invisiblefieldset\">";
                 echo ' <input type="hidden" name="choose" value="'.$choose.'" />';
                 echo " <input type=\"hidden\" name=\"id\" value=\"$id\" />";
                 echo " <input type=\"hidden\" name=\"wdir\" value=\"$wdir\" />";
                 echo " <input type=\"hidden\" name=\"action\" value=\"cancel\" />";
                 echo " <input type=\"submit\" value=\"$strcancel\" />";
+                echo "</fieldset>";
                 echo "</form>";
                 echo "</td></tr></table>";
             }
@@ -358,6 +364,7 @@
                 echo "<p>$strcreatefolder:</p>";
                 echo "<table><tr><td>";
                 echo "<form action=\"index.php\" method=\"post\">";
+                echo "<fieldset class=\"invisiblefieldset\">";
                 echo ' <input type="hidden" name="choose" value="'.$choose.'" />';
                 echo " <input type=\"hidden\" name=\"id\" value=\"$id\" />";
                 echo " <input type=\"hidden\" name=\"wdir\" value=\"$wdir\" />";
@@ -365,14 +372,17 @@
                 echo " <input type=\"text\" name=\"name\" size=\"35\" />";
                 echo " <input type=\"hidden\" name=\"sesskey\" value=\"$USER->sesskey\" />";
                 echo " <input type=\"submit\" value=\"$strcreate\" />";
+                echo "</fieldset>";
                 echo "</form>";
                 echo "</td><td>";
                 echo "<form action=\"index.php\" method=\"get\">";
+                echo "<fieldset class=\"invisiblefieldset\">";
                 echo ' <input type="hidden" name="choose" value="'.$choose.'" />';
                 echo " <input type=\"hidden\" name=\"id\" value=\"$id\" />";
                 echo " <input type=\"hidden\" name=\"wdir\" value=\"$wdir\" />";
                 echo " <input type=\"hidden\" name=\"action\" value=\"cancel\" />";
                 echo " <input type=\"submit\" value=\"$strcancel\" />";
+                echo "</fieldset>";
                 echo "</form>";
                 echo "</td></tr></table>";
             }
@@ -405,6 +415,7 @@
 
                 echo "<table><tr><td colspan=\"2\">";
                 echo "<form action=\"index.php\" method=\"post\">";
+                echo "<div>";
                 echo ' <input type="hidden" name="choose" value="'.$choose.'" />';
                 echo " <input type=\"hidden\" name=\"id\" value=\"$id\" />";
                 echo " <input type=\"hidden\" name=\"wdir\" value=\"$wdir\" />";
@@ -414,14 +425,17 @@
                 print_textarea($usehtmleditor, 25, 80, 680, 400, "text", $contents);
                 echo "</td></tr><tr><td>";
                 echo " <input type=\"submit\" value=\"".get_string("savechanges")."\" />";
+                echo "</div>";
                 echo "</form>";
                 echo "</td><td>";
                 echo "<form action=\"index.php\" method=\"get\">";
+                echo "<fieldset class=\"invisiblefieldset\">";
                 echo ' <input type="hidden" name="choose" value="'.$choose.'" />';
                 echo " <input type=\"hidden\" name=\"id\" value=\"$id\" />";
                 echo " <input type=\"hidden\" name=\"wdir\" value=\"$wdir\" />";
                 echo " <input type=\"hidden\" name=\"action\" value=\"cancel\" />";
                 echo " <input type=\"submit\" value=\"".get_string("cancel")."\" />";
+                echo "</fieldset>";
                 echo "</form>";
                 echo "</td></tr></table>";
 
@@ -463,6 +477,7 @@
                     echo "<p align=\"center\">".get_string("whattocallzip")."</p>";
                     echo "<table><tr><td>";
                     echo "<form action=\"index.php\" method=\"post\">";
+                    echo "<fieldset class=\"invisiblefieldset\">";
                     echo ' <input type="hidden" name="choose" value="'.$choose.'" />';
                     echo " <input type=\"hidden\" name=\"id\" value=\"$id\" />";
                     echo " <input type=\"hidden\" name=\"wdir\" value=\"$wdir\" />";
@@ -470,14 +485,17 @@
                     echo " <input type=\"text\" name=\"name\" size=\"35\" value=\"new.zip\" />";
                     echo " <input type=\"hidden\" name=\"sesskey\" value=\"$USER->sesskey\" />";
                     echo " <input type=\"submit\" value=\"".get_string("createziparchive")."\" />";
+                    echo "<fieldset>";
                     echo "</form>";
                     echo "</td><td>";
                     echo "<form action=\"index.php\" method=\"get\">";
+                    echo "<fieldset class=\"invisiblefieldset\">";
                     echo ' <input type="hidden" name="choose" value="'.$choose.'" />';
                     echo " <input type=\"hidden\" name=\"id\" value=\"$id\" />";
                     echo " <input type=\"hidden\" name=\"wdir\" value=\"$wdir\" />";
                     echo " <input type=\"hidden\" name=\"action\" value=\"cancel\" />";
                     echo " <input type=\"submit\" value=\"".get_string("cancel")."\" />";
+                    echo "</fieldset>";
                     echo "</form>";
                     echo "</td></tr></table>";
                 } else {
@@ -502,14 +520,16 @@
                     error(get_string("unzipfileserror","error"));
                 }
 
-                echo "<center><form action=\"index.php\" method=\"get\">";
+                echo "<div style=\"text-align:center\"><form action=\"index.php\" method=\"get\">";
+                echo "<fieldset class=\"invisiblefieldset\">";
                 echo ' <input type="hidden" name="choose" value="'.$choose.'" />';
                 echo " <input type=\"hidden\" name=\"id\" value=\"$id\" />";
                 echo " <input type=\"hidden\" name=\"wdir\" value=\"$wdir\" />";
                 echo " <input type=\"hidden\" name=\"action\" value=\"cancel\" />";
                 echo " <input type=\"submit\" value=\"$strok\" />";
+                echo "</fieldset>";
                 echo "</form>";
-                echo "</center>";
+                echo "</div>";
             } else {
                 displaydir($wdir);
             }
@@ -551,11 +571,13 @@
                     echo "</table>";
                 }
                 echo "<br /><center><form action=\"index.php\" method=\"get\">";
+                echo "<fieldset class=\"invisiblefieldset\">";
                 echo ' <input type="hidden" name="choose" value="'.$choose.'" />';
                 echo " <input type=\"hidden\" name=\"id\" value=\"$id\" />";
                 echo " <input type=\"hidden\" name=\"wdir\" value=\"$wdir\" />";
                 echo " <input type=\"hidden\" name=\"action\" value=\"cancel\" />";
                 echo " <input type=\"submit\" value=\"$strok\" />";
+                echo "</fieldset>";
                 echo "</form>";
                 echo "</center>";
             } else {
@@ -652,7 +674,7 @@ function print_cell($alignment='center', $text='&nbsp;', $class='') {
     if ($class) {
         $class = ' class="'.$class.'"';
     }
-    echo '<td align="'.$alignment.'" nowrap="nowrap"'.$class.'>'.$text.'</td>';
+    echo '<td align="'.$alignment.'" style="white-space:nowrap "'.$class.'>'.$text.'</td>';
 }
 
 function displaydir ($wdir) {
@@ -704,15 +726,17 @@ function displaydir ($wdir) {
 
 
     echo "<form action=\"index.php\" method=\"post\" id=\"dirform\">";
+    echo "<div>";
     echo '<input type="hidden" name="choose" value="'.$choose.'" />';
-    echo "<hr width=\"640\" align=\"center\" noshade=\"noshade\" size=\"1\" />";
+    // echo "<hr align=\"center\" noshade=\"noshade\" size=\"1\" />";
+    echo "<hr/>";
     echo "<table border=\"0\" cellspacing=\"2\" cellpadding=\"2\" width=\"640\" class=\"files\">";
     echo "<tr>";
-    echo "<th width=\"5\" scope=\"col\"></th>";
-    echo "<th align=\"left\" class=\"header name\" scope=\"col\">$strname</th>";
-    echo "<th align=\"right\" class=\"header size\" scope=\"col\">$strsize</th>";
-    echo "<th align=\"right\" class=\"header date\" scope=\"col\">$strmodified</th>";
-    echo "<th align=\"right\" class=\"header commands\" scope=\"col\">$straction</th>";
+    echo "<th scope=\"col\"></th>";
+    echo "<th class=\"header name\" scope=\"col\">$strname</th>";
+    echo "<th class=\"header size\" scope=\"col\">$strsize</th>";
+    echo "<th class=\"header date\" scope=\"col\">$strmodified</th>";
+    echo "<th class=\"header commands\" scope=\"col\">$straction</th>";
     echo "</tr>\n";
 
     if ($wdir != "/") {
@@ -772,7 +796,7 @@ function displaydir ($wdir) {
             echo "<tr class=\"file\">";
 
             print_cell("center", "<input type=\"checkbox\" name=\"file$count\" value=\"$fileurl\" />", 'checkbox');
-            echo "<td align=\"left\" nowrap=\"nowrap\" class=\"name\">";
+            echo "<td align=\"left\" style=\"white-space:nowrap\" class=\"name\">";
             if ($CFG->slasharguments) {
                 $ffurl = str_replace('//', '/', "/file.php/$id/$fileurl");
             } else {
@@ -810,7 +834,8 @@ function displaydir ($wdir) {
         }
     }
     echo "</table>";
-    echo "<hr width=\"640\" align=\"center\" noshade=\"noshade\" size=\"1\" />";
+    echo "<hr />";
+    //echo "<hr width=\"640\" align=\"center\" noshade=\"noshade\" size=\"1\" />";
 
     echo "<table border=\"0\" cellspacing=\"2\" cellpadding=\"2\" width=\"640\">";
     echo "<tr><td>";
@@ -827,46 +852,56 @@ function displaydir ($wdir) {
         choose_from_menu ($options, "action", "", "$strwithchosenfiles...", "javascript:getElementById('dirform').submit()");
     }
     echo "</td></tr></table>";
+    echo "</div>";
     echo "</form>";
     echo "<table border=\"0\" cellspacing=\"2\" cellpadding=\"2\" width=\"640\"><tr>";
     echo "<td align=\"center\">";
     if (!empty($USER->fileop) and ($USER->fileop == "move") and ($USER->filesource <> $wdir)) {
         echo "<form action=\"index.php\" method=\"get\">";
+        echo "<fieldset class=\"invisiblefieldset\">";
         echo ' <input type="hidden" name="choose" value="'.$choose.'" />';
         echo " <input type=\"hidden\" name=\"id\" value=\"$id\" />";
         echo " <input type=\"hidden\" name=\"wdir\" value=\"$wdir\" />";
         echo " <input type=\"hidden\" name=\"action\" value=\"paste\" />";
         echo " <input type=\"hidden\" name=\"sesskey\" value=\"$USER->sesskey\" />";
         echo " <input type=\"submit\" value=\"$strmovefilestohere\" />";
+        echo "</fieldset>";
         echo "</form>";
     }
     echo "</td>";
     echo "<td align=\"right\">";
         echo "<form action=\"index.php\" method=\"get\">";
+        echo "<fieldset class=\"invisiblefieldset\">";
         echo ' <input type="hidden" name="choose" value="'.$choose.'" />';
         echo " <input type=\"hidden\" name=\"id\" value=\"$id\" />";
         echo " <input type=\"hidden\" name=\"wdir\" value=\"$wdir\" />";
         echo " <input type=\"hidden\" name=\"action\" value=\"makedir\" />";
         echo " <input type=\"submit\" value=\"$strmakeafolder\" />";
+        echo "</fieldset>";
         echo "</form>";
     echo "</td>";
     echo "<td align=\"right\">";
         echo "<form action=\"index.php\" method=\"get\">"; //dummy form - alignment only
+        echo "<fieldset class=\"invisiblefieldset\">";
         echo " <input type=\"button\" value=\"$strselectall\" onclick=\"checkall();\" />";
         echo " <input type=\"button\" value=\"$strselectnone\" onclick=\"uncheckall();\" />";
+        echo "</fieldset>";
         echo "</form>";
     echo "</td>";
     echo "<td align=\"right\">";
         echo "<form action=\"index.php\" method=\"get\">";
+        echo "<fieldset class=\"invisiblefieldset\">";
         echo ' <input type="hidden" name="choose" value="'.$choose.'" />';
         echo " <input type=\"hidden\" name=\"id\" value=\"$id\" />";
         echo " <input type=\"hidden\" name=\"wdir\" value=\"$wdir\" />";
         echo " <input type=\"hidden\" name=\"action\" value=\"upload\" />";
         echo " <input type=\"submit\" value=\"$struploadafile\" />";
+        echo "</fieldset>";
         echo "</form>";
     echo "</td></tr>";
     echo "</table>";
-    echo "<hr width=\"640\" align=\"center\" noshade=\"noshade\" size=\"1\" />";
+    echo "<hr/>";
+    //echo "<hr width=\"640\" align=\"center\" noshade=\"noshade\" size=\"1\" />";
 
 }
 
diff --git a/lib/adminlib.php b/lib/adminlib.php
index 92a91ae817..3d1c7a4b16 100644
--- a/lib/adminlib.php
+++ b/lib/adminlib.php
@@ -1934,7 +1934,7 @@ class admin_setting_special_editorfontlist extends admin_setting {
         $return .= '<input type="text" class="form-text" name="s_editorfontlist[v' . ($i + 1) . ']" value="" />';
         $return .= '</div>';
 
-        return format_admin_setting($this->name, $this->visiblename, $return, $this->description);
+        return format_admin_setting($this->name, $this->visiblename, $return, $this->description, false);
     }
 
 }
@@ -2120,7 +2120,7 @@ class admin_setting_special_editorhidebuttons extends admin_setting {
         $return .= '</table>';
         $return .= '</div>';
 
-        return format_admin_setting($this->name, $this->visiblename, $return, $this->description);
+        return format_admin_setting($this->name, $this->visiblename, $return, $this->description, false);
     }
 
 }
@@ -2259,20 +2259,20 @@ class admin_setting_special_backupdays extends admin_setting {
         $currentsetting = $currentsetting['u'] . $currentsetting['m'] . $currentsetting['t'] . $currentsetting['w'] .
                           $currentsetting['r'] . $currentsetting['f'] . $currentsetting['s'];
 
-        $return = '<table><tr><td><div align="center">&nbsp;&nbsp;' . get_string('sunday', 'calendar') . '&nbsp;&nbsp;</div></td><td><div align="center">&nbsp;&nbsp;' .
-        get_string('monday', 'calendar') . '&nbsp;&nbsp;</div></td><td><div align="center">&nbsp;&nbsp;' . get_string('tuesday', 'calendar') . '&nbsp;&nbsp;</div></td><td><div align="center">&nbsp;&nbsp;' .
-        get_string('wednesday', 'calendar') . '&nbsp;&nbsp;</div></td><td><div align="center">&nbsp;&nbsp;' . get_string('thursday', 'calendar') . '&nbsp;&nbsp;</div></td><td><div align="center">&nbsp;&nbsp;' .
-        get_string('friday', 'calendar') . '&nbsp;&nbsp;</div></td><td><div align="center">&nbsp;&nbsp;' . get_string('saturday', 'calendar') . '&nbsp;&nbsp;</div></td></tr><tr>' .
-        '<td><div align="center"><input type="checkbox" class="form-checkbox" id="id_s_'.$this->name.'u" name="s_'. $this->name .'[u]" value="1" ' . (substr($currentsetting,0,1) == '1' ? 'checked="checked"' : '') . ' /></div></td>' .
-        '<td><div align="center"><input type="checkbox" class="form-checkbox" id="id_s_'.$this->name.'m" name="s_'. $this->name .'[m]" value="1" ' . (substr($currentsetting,1,1) == '1' ? 'checked="checked"' : '') . ' /></div></td>' .
-        '<td><div align="center"><input type="checkbox" class="form-checkbox" id="id_s_'.$this->name.'t" name="s_'. $this->name .'[t]" value="1" ' . (substr($currentsetting,2,1) == '1' ? 'checked="checked"' : '') . ' /></div></td>' .
-        '<td><div align="center"><input type="checkbox" class="form-checkbox" id="id_s_'.$this->name.'w" name="s_'. $this->name .'[w]" value="1" ' . (substr($currentsetting,3,1) == '1' ? 'checked="checked"' : '') . ' /></div></td>' .
-        '<td><div align="center"><input type="checkbox" class="form-checkbox" id="id_s_'.$this->name.'r" name="s_'. $this->name .'[r]" value="1" ' . (substr($currentsetting,4,1) == '1' ? 'checked="checked"' : '') . ' /></div></td>' .
-        '<td><div align="center"><input type="checkbox" class="form-checkbox" id="id_s_'.$this->name.'f" name="s_'. $this->name .'[f]" value="1" ' . (substr($currentsetting,5,1) == '1' ? 'checked="checked"' : '') . ' /></div></td>' .
-        '<td><div align="center"><input type="checkbox" class="form-checkbox" id="id_s_'.$this->name.'s" name="s_'. $this->name .'[s]" value="1" ' . (substr($currentsetting,6,1) == '1' ? 'checked="checked"' : '') . ' /></div></td>' .
+        $return = '<table><tr><td><div style="text-align:center">&nbsp;&nbsp;' . get_string('sunday', 'calendar') . '&nbsp;&nbsp;</div></td><td><div style="text-align:center">&nbsp;&nbsp;' .
+        get_string('monday', 'calendar') . '&nbsp;&nbsp;</div></td><td><div style="text-align:center">&nbsp;&nbsp;' . get_string('tuesday', 'calendar') . '&nbsp;&nbsp;</div></td><td><div style="text-align:center">&nbsp;&nbsp;' .
+        get_string('wednesday', 'calendar') . '&nbsp;&nbsp;</div></td><td><div style="text-align:center">&nbsp;&nbsp;' . get_string('thursday', 'calendar') . '&nbsp;&nbsp;</div></td><td><div style="text-align:center">&nbsp;&nbsp;' .
+        get_string('friday', 'calendar') . '&nbsp;&nbsp;</div></td><td><div style="text-align:center">&nbsp;&nbsp;' . get_string('saturday', 'calendar') . '&nbsp;&nbsp;</div></td></tr><tr>' .
+        '<td><div style="text-align:center"><input type="checkbox" class="form-checkbox" id="id_s_'.$this->name.'u" name="s_'. $this->name .'[u]" value="1" ' . (substr($currentsetting,0,1) == '1' ? 'checked="checked"' : '') . ' /></div></td>' .
+        '<td><div style="text-align:center"><input type="checkbox" class="form-checkbox" id="id_s_'.$this->name.'m" name="s_'. $this->name .'[m]" value="1" ' . (substr($currentsetting,1,1) == '1' ? 'checked="checked"' : '') . ' /></div></td>' .
+        '<td><div style="text-align:center"><input type="checkbox" class="form-checkbox" id="id_s_'.$this->name.'t" name="s_'. $this->name .'[t]" value="1" ' . (substr($currentsetting,2,1) == '1' ? 'checked="checked"' : '') . ' /></div></td>' .
+        '<td><div style="text-align:center"><input type="checkbox" class="form-checkbox" id="id_s_'.$this->name.'w" name="s_'. $this->name .'[w]" value="1" ' . (substr($currentsetting,3,1) == '1' ? 'checked="checked"' : '') . ' /></div></td>' .
+        '<td><div style="text-align:center"><input type="checkbox" class="form-checkbox" id="id_s_'.$this->name.'r" name="s_'. $this->name .'[r]" value="1" ' . (substr($currentsetting,4,1) == '1' ? 'checked="checked"' : '') . ' /></div></td>' .
+        '<td><div style="text-align:center"><input type="checkbox" class="form-checkbox" id="id_s_'.$this->name.'f" name="s_'. $this->name .'[f]" value="1" ' . (substr($currentsetting,5,1) == '1' ? 'checked="checked"' : '') . ' /></div></td>' .
+        '<td><div style="text-align:center"><input type="checkbox" class="form-checkbox" id="id_s_'.$this->name.'s" name="s_'. $this->name .'[s]" value="1" ' . (substr($currentsetting,6,1) == '1' ? 'checked="checked"' : '') . ' /></div></td>' .
         '</tr></table>';
 
-        return format_admin_setting($this->name, $this->visiblename, $return, $this->description);
+        return format_admin_setting($this->name, $this->visiblename, $return, $this->description, false);
 
     }
 
@@ -2462,7 +2462,7 @@ class admin_setting_special_gradebookroles extends admin_setting {
             $return .= '</div>';
         }
 
-        return format_admin_setting($this->name, $this->visiblename, $return, $this->description);
+        return format_admin_setting($this->name, $this->visiblename, $return, $this->description, false);
 
     }
 
@@ -2537,7 +2537,7 @@ class admin_setting_special_coursemanager extends admin_setting {
             }
             $return .= '</div>';
         }
-        return format_admin_setting($this->name, $this->visiblename, $return, $this->description);
+        return format_admin_setting($this->name, $this->visiblename, $return, $this->description, false);
     }
 }
 
diff --git a/theme/index.php b/theme/index.php
index ff0cb698f6..cfebb4b53c 100644
--- a/theme/index.php
+++ b/theme/index.php
@@ -50,7 +50,7 @@
         }
     }
 
-              admin_externalpage_print_header('themeselector');
+    admin_externalpage_print_header('themeselector');
 
 
     print_heading($strthemes);
@@ -58,8 +58,12 @@
     $themes = get_list_of_plugins("theme");
     $sesskey = !empty($USER->id) ? $USER->sesskey : '';
 
-    echo "<table align=\"center\" cellpadding=\"7\" cellspacing=\"5\">";
-    echo "<tr class=\"generaltableheader\"><th scope=\"col\">$strtheme</th><th scope=\"col\">$strinfo</th></tr>";
+    echo "<table style=\"margin-left:auto;margin-right:auto;\" cellpadding=\"7\" cellspacing=\"5\">";
+    
+    if (!$USER->screenreader) {
+        echo "<tr class=\"generaltableheader\"><th scope=\"col\">$strtheme</th>";
+        echo "<th scope=\"col\">$strinfo</th></tr>";
+    }
     foreach ($themes as $theme) {
 
         unset($THEME);
@@ -88,16 +92,18 @@
         }
 
         echo "<tr>";
-        echo "<td align=\"center\">";
-
-        if ($screenshotpath) {
-            $screenshot = "<li><a target=\"$theme\" href=\"$theme/screenshot.jpg\">$strscreenshot</a></li>";
-            echo "<iframe name=\"$theme\" src=\"$screenshotpath\" height=\"200\" width=\"400\"></iframe></td>";
-        } else {
-            echo "<iframe name=\"$theme\" src=\"preview.php?preview=$theme\" height=\"200\" width=\"400\"></iframe></td>";
+             
+        // no point showing this if user is using screen reader
+        if (!$USER->screenreader) {
+            echo "<td align=\"center\">";
+            if ($screenshotpath) {
+                $screenshot = "<li><a target=\"$theme\" href=\"$theme/screenshot.jpg\">$strscreenshot</a></li>";
+                echo "<iframe name=\"$theme\" src=\"$screenshotpath\" height=\"200\" width=\"400\"></iframe></td>";
+            } else {
+                echo "<iframe name=\"$theme\" src=\"preview.php?preview=$theme\" height=\"200\" width=\"400\"></iframe></td>";
+            }
         }
 
-
         if ($CFG->theme == $theme) {
             echo '<td valign="top" style="border-style:solid; border-width:1px; border-color=#555555">';
         } else {
@@ -109,14 +115,15 @@
         } else {
             echo '<p style="font-size:1.5em;font-style:bold;color:red;">'.$theme.' (Moodle 1.4)</p>';
         }
-
-        echo '<ul>';
-
+          
         if ($screenshot or $readme) {
-            echo "<li><a target=\"$theme\" href=\"preview.php?preview=$theme\">$strpreview</a></li>";
+            echo '<ul>';      
+            if (!$USER->screenreader) {
+                echo "<li><a target=\"$theme\" href=\"preview.php?preview=$theme\">$strpreview</a></li>";
+            }
+            echo $screenshot.$readme;
+            echo '</ul>';
         }
-        echo $screenshot.$readme;
-        echo '</ul>';
 
         $options = null;
         $options['choose'] = $theme;
-- 
2.39.5