Utility file for reading messages.
[squirrelmail.git] / templates / util_global.php
index 2299a0d6493e403ccff27bb9da78915e9e5dc48b..9ef9e040eca869e7ed834c8bf55df816f4a80446 100644 (file)
@@ -36,7 +36,8 @@ function getIcon($icon_theme_path, $icon_name, $text_icon, $alt_text='', $w=NULL
         // find an image, we will revert back to the text icon.
         if (!is_null($icon_path)) {
             $icon = '<img src="'.$icon_path.'" ' .
-                    (!empty($alt_text) ? 'alt="'.$alt_text.'" title="'.$alt_text.'" ' : '') .
+                    'alt="'.$alt_text.'" '.
+                    (!empty($alt_text) ? 'title="'.$alt_text.'" ' : '') .
                     (!is_null($w) ? 'width="'.$w.'" ' : '') .
                     (!is_null($h) ? 'height="'.$h.'" ' : '') .
                     ' />';
@@ -60,13 +61,19 @@ function getIcon($icon_theme_path, $icon_name, $text_icon, $alt_text='', $w=NULL
  * @since 1.5.2
  */
 function getIconPath ($icon_theme_path, $icon_name) {
+    global $default_icon_theme;
+
     if (is_null($icon_theme_path))
         return NULL;
     
     // Desired icon exists in the current theme?
     if (is_file($icon_theme_path . $icon_name)) {
         return $icon_theme_path . $icon_name;
-
+        
+    // Icon not found, check for the admin-specified default
+    } elseif (!is_null($default_icon_theme) && is_file($default_icon_theme . $icon_name)) {
+        return $default_icon_theme . $icon_name;
+        
     // Icon not found, return the SQM default icon
     } elseif (is_file(SM_PATH . 'images/themes/default/'.$icon_name)) {
         return SM_PATH . 'images/themes/default/'.$icon_name;
@@ -74,4 +81,29 @@ function getIconPath ($icon_theme_path, $icon_name) {
     
     return NULL;
 }
-?>
\ No newline at end of file
+
+/**
+ * Display error messages for use in footer.tpl
+ * 
+ * @author Steve Brown
+ * @since 1.5.2
+ **/
+function displayErrors () {
+    global $oErrorHandler;
+    
+    if ($oErrorHandler) {
+        $oErrorHandler->displayErrors();
+    }
+}
+
+/**
+ * Make the internal show_readable_size() function available to templates.
+ * 
+ * @param int size to be converted to human-readable
+ * @return string human-readable form
+ * @since 1.5.2
+ **/
+function humanReadableSize ($size) {
+    return show_readable_size($size);
+}
+