Fix bug while modifying addresses, if you get an error, you can't resubmit the form...
[squirrelmail.git] / functions / strings.php
index db5ff7c2e61b480d0f9d4e81e6de945d887d1b7d..c9e583f623b848ac73191b9bc139d43e9ba19e41 100644 (file)
@@ -415,6 +415,29 @@ function TrimArray(&$array) {
     }
 }   
 
+/* returns a link to the compose-page, taking in consideration
+ * the compose_in_new and javascript settings. */
+function makeComposeLink($url, $text = null)
+{
+    global $compose_new_win,$javascript_on;
+
+    if(!$text) {
+        $text = _("Compose");
+    }
+
+    if($compose_new_win != '1') {
+        return makeInternalLink($url, $text, 'right');
+    }
+
+    /* if we can use JS, use the fancy window, else just open a new one HTML-style */
+    if($javascript_on) {
+        sqgetGlobalVar('base_uri', $base_uri, SQ_SESSION);
+        return '<a href="javascript:void(0)" onclick="comp_in_new(\''.$base_uri.$url.'\')">'. $text.'</a>';
+    }
+
+    return makeInternalLink($url, $text, '_blank');
+}
+
 $PHP_SELF = php_self();
 
 ?>