Allow text alternative for images to percolate all the way through template layers
[squirrelmail.git] / functions / page_header.php
index 74456be4db92cc2675bd6c986e2f92c22d95aabf..27fa23a0ec91f7fc5ca3ec8a3d841f1bf70b684e 100644 (file)
@@ -50,7 +50,7 @@ function displayHtmlHeader( $title = 'SquirrelMail', $xtra = '', $do_hook = TRUE
 
     $used_fontset = (!empty($chosen_fontset) ? $chosen_fontset : $default_fontset);
     $used_fontsize = (!empty($chosen_fontsize) ? $chosen_fontsize : $default_fontsize);
-    $used_theme = !isset($chosen_theme) && $user_theme_default != 'none' ?  $user_themes[$user_theme_default]['PATH'].'/default.css' : $chosen_theme_path;
+    $used_theme = !isset($chosen_theme) && $user_theme_default != 'none' && is_dir($chosen_theme) && is_readable($chosen_theme)?  $user_themes[$user_theme_default]['PATH'].'/default.css' : $chosen_theme_path;
     
     /**
      * Stylesheets are loaded in the following order:
@@ -72,17 +72,12 @@ function displayHtmlHeader( $title = 'SquirrelMail', $xtra = '', $do_hook = TRUE
     // 2. Option user-defined stylesheet from preferences.
     if (!empty($used_theme)) {
         /**
-         * User styles just point to a directory, so we need to include all .css
-         * files in that directory.  Template themes point to a specific stylesheet,
-         * so we simply include it. 
+         * All styles just point to a directory, so we need to include all .css
+         * files in that directory. 
          */
-        if (is_dir($used_theme)) {
-            $styles = list_files($used_theme, '.css');
-            foreach ($styles as $sheet) { 
-                $aUserStyles[] = $used_theme .'/'.$sheet;
-            }
-        } else {
-            $aUserStyles[] = $used_theme;
+        $styles = list_files($used_theme, '.css');
+        foreach ($styles as $sheet) { 
+            $aUserStyles[] = $used_theme .'/'.$sheet;
         }
     }
 
@@ -113,7 +108,8 @@ function displayHtmlHeader( $title = 'SquirrelMail', $xtra = '', $do_hook = TRUE
     if ($do_hook) {
         // NOTE! plugins here must assign output to template 
         //       and NOT echo anything directly!!
-        do_hook('generic_header');
+        global $null;
+        do_hook('generic_header', $null);
     }
 
     $header_tags .= $xtra;
@@ -151,11 +147,8 @@ EOS;
  * @param string target the target frame for this link
  */
 function makeInternalLink($path, $text, $target='') {
-    global $base_uri;
+    global $base_uri, $oTemplate;
 //    sqgetGlobalVar('base_uri', $base_uri, SQ_SESSION);
-    if ($target != '') {
-        $target = " target=\"$target\"";
-    }
 
     // This is an inefficient hook and is only used by
     // one plugin that still needs to patch this code,
@@ -164,11 +157,9 @@ function makeInternalLink($path, $text, $target='') {
     // here just in case we find a good (non-visual?)
     // use for the internal_link hook.
     //
-    //$hooktext = do_hook_function('internal_link',$text);
-    //if ($hooktext != '')
-    //    $text = $hooktext;
+    //do_hook('internal_link', $text);
 
-    return '<a href="'.$base_uri.$path.'"'.$target.'>'.$text.'</a>';
+    return create_hyperlink($base_uri . $path, $text, $target);
 }
 
 /**