Legacy code was probably wrong
[squirrelmail.git] / functions / template / general_util.php
index bfc50caa95b8a6cc4288d1bf3049002e9810ca61..3970c710e6e3cc7f6db62a4d6878a568cdf95b4f 100644 (file)
@@ -6,7 +6,7 @@
  * This file is intended to contain helper functions for template sets
  * that would like to use them.
  *
- * @copyright © 1999-2006 The SquirrelMail Project Team
+ * @copyright 1999-2017 The SquirrelMail Project Team
  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  * @version $Id$
  * @package squirrelmail
@@ -79,7 +79,7 @@ function create_css_link($uri, $name='', $alt=TRUE, $mtype='screen') {
  * @param string $icon_theme_path User's chosen icon set
  * @param string $icon_name File name of the desired icon
  * @param string $text_icon Text-based icon to display if desired
- * @param string $alt_text Optional.  Text for alt/title attribute of image
+ * @param string $alt_text Text for alt/title attribute of image
  * @param integer $w Optional.  Width of requested image.
  * @param integer $h Optional.  Height of requested image.
  *
@@ -87,9 +87,8 @@ function create_css_link($uri, $name='', $alt=TRUE, $mtype='screen') {
  *
  * @author Steve Brown
  * @since 1.5.2
- *
  */
-function getIcon($icon_theme_path, $icon_name, $text_icon, $alt_text='', $w=NULL, $h=NULL) {
+function getIcon($icon_theme_path, $icon_name, $text_icon, $alt_text, $w=NULL, $h=NULL) {
     $icon = '';
     if (is_null($icon_theme_path)) {
         $icon = $text_icon;
@@ -131,14 +130,17 @@ function getIconPath ($icon_theme_path, $icon_name) {
         return NULL;
 
     // Desired icon exists in the current theme?
+//FIXME: this assumes a URI path will be valid when used as a filesystem path - this will fail for some systems -- OTOH, if $icon_theme_path is meant as an internal filesystem path to the user's chosen theme directory, then the assumption that is wrong here is that this internal filesystem path is always correct for use as part of a URI.  This really should be mapped to/from an internal path to a URI path -- or can we guarantee that the two are always the same?
     if (is_file($icon_theme_path . $icon_name)) {
         return $icon_theme_path . $icon_name;
 
     // Icon not found, check for the admin-specified fallback
+//FIXME: same problem here as above
     } elseif (!is_null($fallback_icon_theme_path) && is_file($fallback_icon_theme_path . $icon_name)) {
         return $fallback_icon_theme_path . $icon_name;
 
     // Icon not found, return the SQM default icon
+//FIXME: same problem here -- SM_PATH is *NOT* intended for use in URIs
     } elseif (is_file(SM_PATH . 'images/themes/default/'.$icon_name)) {
         return SM_PATH . 'images/themes/default/'.$icon_name;
     }