missing sprintf around string
[squirrelmail.git] / functions / page_header.php
index c9698c9c765121603a279ed590578bbfa2c97bf1..37d6c7dd1d6128333bb6a05fea058ddfc39168ab 100644 (file)
@@ -264,16 +264,36 @@ function displayPageHeader($color, $mailbox, $xtra='', $session=false) {
             break;
 
         case 'src/right_main.php':
-// following code graciously stolen from phpMyAdmin project at:
-// http://www.phpmyadmin.net
-            $js = <<<EOS
+            global $fancy_index_highlite;
+            if (!$fancy_index_highlite) {
+                $js = '';
+            } else //{ putting braces around this block creats strange PHP errors
+                // following code graciously borrowed from 
+                // phpMyAdmin project at:
+                // http://www.phpmyadmin.net
+                $js = <<<EOS
 /**
  * This array is used to remember mark status of rows in browse mode
  */
 var marked_row = new Array;
 
 
-/**
+/* 
+ * (un)Checks checkbox for the row that the current table cell is in
+ * when it gets clicked.
+ *
+ * @param   string   the name of the checkbox that should be (un)checked
+ */
+function row_click(chkboxName) {
+    chkbox = document.getElementById(chkboxName);
+    if (chkbox) { 
+        chkbox.checked = (chkbox.checked ? false : true); 
+    }
+}
+
+
+
+/*
  * Sets/unsets the pointer and marker in browse mode
  *
  * @param   object    the table row
@@ -403,8 +423,27 @@ function setPointer(theRow, theRowNum, theAction, theDefaultColor, thePointerCol
     return true;
 } // end of the 'setPointer()' function
 EOS;
+            //} putting braces around this block creats strange PHP errors
             $js = "\n".'<script language="JavaScript" type="text/javascript">' .
-                        "\n<!--\n" . $js . "// -->\n</script>\n";
+                        "\n<!--\n" . $js;
+            if ($compose_new_win == '1') {
+                if (!preg_match("/^[0-9]{3,4}$/", $compose_width)) {
+                    $compose_width = '640';
+                }
+                if (!preg_match("/^[0-9]{3,4}$/", $compose_height)) {
+                    $compose_height = '550';
+                }
+                $js .= "\n\nfunction comp_in_new(comp_uri) {\n".
+                     "       if (!comp_uri) {\n".
+                     '           comp_uri = "'.$compose_uri."\";\n".
+                     '       }'. "\n".
+                     '    var newwin = window.open(comp_uri' .
+                     ', "_blank",'.
+                     '"width='.$compose_width. ',height='.$compose_height.
+                     ',scrollbars=yes,resizable=yes,status=yes");'."\n".
+                     "}\n\n";
+            }
+            $js .= $xtra . "\n\n// -->\n</script>\n";
             $onload = '';
             displayHtmlHeader ('SquirrelMail', $js);
             break;
@@ -511,9 +550,12 @@ EOS;
     if (!$hide_sm_attributions)
     {
         echo html_tag( 'td', '', 'right' ) ."\n";
-        if (!isset($provider_uri)) $provider_uri= 'http://www.squirrelmail.org/';
-        if (!isset($provider_name)) $provider_name= 'SquirrelMail';
-        echo '<a href="'.$provider_uri.'" target="_blank">'.$provider_name.'</a>';
+        if (empty($provider_uri)) {
+            echo '<a href="about.php">SquirrelMail</a>';
+        } else {
+            if (empty($provider_name)) $provider_name= 'SquirrelMail';
+            echo '<a href="'.$provider_uri.'" target="_blank">'.$provider_name.'</a>';
+        }
         echo "</td>\n";
     }
     echo "   </tr>\n".