Fix XSS problem with unsanitized style tags in messages [CVE-2011-2023]
[squirrelmail.git] / templates / default / js / default.js
index 4c7b9e890a18d56524f1529c575d6796f1341c6a..a3fe521114d1619e3f8d1c998f753e105d593a03 100644 (file)
@@ -1,7 +1,7 @@
 /**
  * This array is used to remember mark status of rows in browse mode
  *
- * @copyright © 2005-2006 The SquirrelMail Project Team
+ * @copyright 2005-2011 The SquirrelMail Project Team
  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  * @version $Id$
  */
@@ -271,7 +271,7 @@ function checkForm(smaction) {
             var e = document.forms[i].elements.length;
             var j = 0;
             while( pos == -1 && j < e ) {
-                if ( document.forms[i].elements[j].type == 'text' || document.forms[i].elements[j].type == 'password' ) {
+                if ( document.forms[i].elements[j].type == 'text' || document.forms[i].elements[j].type == 'password' || document.forms[i].elements[j].type == 'textarea' ) {
                     pos = j;
                 }
                 j++;
@@ -289,3 +289,17 @@ function printThis()
     parent.frames['right'].focus();
     parent.frames['right'].print();
 }
+
+/* JS implementation of more/less links in To/CC. Could later be extended
+ * show/hide other interface items */
+function showhide (item, txtmore, txtless) {
+    var oTemp=document.getElementById("recpt_tail_" + item);
+    var oClick=document.getElementById("toggle_" + item);
+    if (oTemp.style.display=="inline") {
+        oTemp.style.display="none";
+        oClick.innerHTML=txtmore;
+    } else {
+        oTemp.style.display="inline";
+        oClick.innerHTML=txtless;
+    }
+}